@@ -19,52 +19,11 @@ use crate::ty::subst::{InternalSubsts, Subst};
1919use crate :: ty:: { self , ToPolyTraitRef , ToPredicate , Ty , TyCtxt , WithConstness } ;
2020use rustc_data_structures:: snapshot_map:: { Snapshot , SnapshotMap } ;
2121use rustc_hir:: def_id:: DefId ;
22- use rustc_macros:: HashStable ;
2322use rustc_span:: symbol:: sym;
2423use rustc_span:: DUMMY_SP ;
2524use syntax:: ast:: Ident ;
2625
27- /// Depending on the stage of compilation, we want projection to be
28- /// more or less conservative.
29- #[ derive( Debug , Copy , Clone , PartialEq , Eq , Hash , HashStable ) ]
30- pub enum Reveal {
31- /// At type-checking time, we refuse to project any associated
32- /// type that is marked `default`. Non-`default` ("final") types
33- /// are always projected. This is necessary in general for
34- /// soundness of specialization. However, we *could* allow
35- /// projections in fully-monomorphic cases. We choose not to,
36- /// because we prefer for `default type` to force the type
37- /// definition to be treated abstractly by any consumers of the
38- /// impl. Concretely, that means that the following example will
39- /// fail to compile:
40- ///
41- /// ```
42- /// trait Assoc {
43- /// type Output;
44- /// }
45- ///
46- /// impl<T> Assoc for T {
47- /// default type Output = bool;
48- /// }
49- ///
50- /// fn main() {
51- /// let <() as Assoc>::Output = true;
52- /// }
53- UserFacing ,
54-
55- /// At codegen time, all monomorphic projections will succeed.
56- /// Also, `impl Trait` is normalized to the concrete type,
57- /// which has to be already collected by type-checking.
58- ///
59- /// NOTE: as `impl Trait`'s concrete type should *never*
60- /// be observable directly by the user, `Reveal::All`
61- /// should not be used by checks which may expose
62- /// type equality or type contents to the user.
63- /// There are some exceptions, e.g., around OIBITS and
64- /// transmute-checking, which expose some details, but
65- /// not the whole concrete type of the `impl Trait`.
66- All ,
67- }
26+ pub use rustc:: traits:: Reveal ;
6827
6928pub type PolyProjectionObligation < ' tcx > = Obligation < ' tcx , ty:: PolyProjectionPredicate < ' tcx > > ;
7029
0 commit comments