1 use rustc_data_structures::vec_map::VecMap;
3 use rustc_middle::ty::{OpaqueTypeKey, Ty};
6 pub type OpaqueTypeMap<'tcx> = VecMap<OpaqueTypeKey<'tcx>, OpaqueTypeDecl<'tcx>>;
8 /// Information about the opaque types whose values we
9 /// are inferring in this function (these are the `impl Trait` that
10 /// appear in the return type).
11 #[derive(Copy, Clone, Debug)]
12 pub struct OpaqueTypeDecl<'tcx> {
13 /// The opaque type (`ty::Opaque`) for this declaration.
14 pub opaque_type: Ty<'tcx>,
16 /// The span of this particular definition of the opaque type. So
19 /// ```ignore (incomplete snippet)
20 /// type Foo = impl Baz;
22 /// // ^^^ This is the span we are looking for!
26 /// In cases where the fn returns `(impl Trait, impl Trait)` or
27 /// other such combinations, the result is currently
28 /// over-approximated, but better than nothing.
29 pub definition_span: Span,
31 /// The type variable that represents the value of the opaque type
32 /// that we require. In other words, after we compile this function,
33 /// we will be created a constraint like:
37 /// where `?C` is the value of this type variable. =) It may
38 /// naturally refer to the type and lifetime parameters in scope
39 /// in this function, though ultimately it should only reference
40 /// those that are arguments to `Foo` in the constraint above. (In
41 /// other words, `?C` should not include `'b`, even though it's a
42 /// lifetime parameter on `foo`.)
43 pub concrete_ty: Ty<'tcx>,
45 /// The origin of the opaque type.
46 pub origin: hir::OpaqueTyOrigin,