pub enum Reveal {
UserFacing,
All,
}
Expand description
Depending on the stage of compilation, we want projection to be more or less conservative.
Variants§
UserFacing
At type-checking time, we refuse to project any associated
type that is marked default
. Non-default
(“final”) types
are always projected. This is necessary in general for
soundness of specialization. However, we could allow
projections in fully-monomorphic cases. We choose not to,
because we prefer for default type
to force the type
definition to be treated abstractly by any consumers of the
impl. Concretely, that means that the following example will
fail to compile:
#![feature(specialization)]
trait Assoc {
type Output;
}
impl<T> Assoc for T {
default type Output = bool;
}
fn main() {
let x: <() as Assoc>::Output = true;
}
We also do not reveal the hidden type of opaque types during type-checking.
All
At codegen time, all monomorphic projections will succeed.
Also, impl Trait
is normalized to the concrete type,
which has to be already collected by type-checking.
NOTE: as impl Trait
’s concrete type should never
be observable directly by the user, Reveal::All
should not be used by checks which may expose
type equality or type contents to the user.
There are some exceptions, e.g., around auto traits and
transmute-checking, which expose some details, but
not the whole concrete type of the impl Trait
.
Trait Implementations§
source§impl<__CTX> HashStable<__CTX> for Reveal
impl<__CTX> HashStable<__CTX> for Reveal
fn hash_stable(&self, __hcx: &mut __CTX, __hasher: &mut StableHasher)
impl Copy for Reveal
impl Eq for Reveal
impl StructuralPartialEq for Reveal
Auto Trait Implementations§
impl DynSend for Reveal
impl DynSync for Reveal
impl Freeze for Reveal
impl RefUnwindSafe for Reveal
impl Send for Reveal
impl Sync for Reveal
impl Unpin for Reveal
impl UnwindSafe for Reveal
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
source§impl<I, T> UpcastFrom<I, T> for T
impl<I, T> UpcastFrom<I, T> for T
fn upcast_from(from: T, _tcx: I) -> T
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 1 byte
Size for each variant:
UserFacing
: 0 bytesAll
: 0 bytes