enum AnonymousLifetimeMode {
CreateParameter,
PassThrough,
}
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
What to do when we encounter an anonymous lifetime
reference. Anonymous lifetime references come in two flavors. You
have implicit, or fully elided, references to lifetimes, like the
one in &T
or Ref<T>
, and you have '_
lifetimes, like &'_ T
or Ref<'_, T>
. These often behave the same, but not always:
- certain usages of implicit references are deprecated, like
Ref<T>
, and we sometimes just give hard errors in those cases
as well.
- for object bounds there is a difference:
Box<dyn Foo>
is not
the same as Box<dyn Foo + '_>
.
We describe the effects of the various modes in terms of three cases:
- Modern -- includes all uses of
'_
, but also the lifetime arg
of a &
(e.g., the missing lifetime in something like &T
)
- Dyn Bound -- if you have something like
Box<dyn Foo>
,
there is an elided lifetime bound (Box<dyn Foo + 'X>
). These
elided bounds follow special rules. Note that this only covers
cases where nothing is written; the '_
in Box<dyn Foo + '_>
is a case of "modern" elision.
- Deprecated -- this coverse cases like
Ref<T>
, where the lifetime
parameter to ref is completely elided. Ref<'_, T>
would be the modern,
non-deprecated equivalent.
Currently, the handling of lifetime elision is somewhat spread out
between HIR lowering and -- as described below -- the
resolve_lifetime
module. Often we "fallthrough" to that code by generating
an "elided" or "underscore" lifetime name. In the future, we probably want to move
everything into HIR lowering.
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
For Modern cases, create a new anonymous region parameter
and reference that.
For Dyn Bound cases, pass responsibility to
resolve_lifetime
code.
For Deprecated cases, report an error.
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Pass responsibility to resolve_lifetime
code for all cases.
Performs copy-assignment from source
. Read more
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
type Error = <U as TryFrom<T>>::Error
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Create an error for a missing method specialization. Defaults to panicking with type, trait & method names. S
is the encoder/decoder state type, T
is the type being encoded/decoded, and the arguments are the names of the trait and method that should've been overridden. Read more