Struct rustc_typeck::collect::ItemCtxt [−][src]
🔬 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?
Context specific to some particular item. This is what implements
AstConv. It has information about the predicates that are defined
on the trait. Unfortunately, this predicate information is
available in various different forms at various points in the
process. So we can't just store a pointer to e.g. the AST or the
parsed ty form, we have to be more flexible. To this end, the
ItemCtxt
is parameterized by a DefId
that it uses to satisfy
get_type_parameter_bounds
requests, drawing the information from
the AST (hir::Generics
), recursively.
Fields
tcx: TyCtxt<'a, 'tcx, 'tcx>
🔬 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?
item_def_id: DefId
🔬 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?
Methods
impl<'a, 'tcx> ItemCtxt<'a, 'tcx>
[src]
impl<'a, 'tcx> ItemCtxt<'a, 'tcx>
pub fn new(
tcx: TyCtxt<'a, 'tcx, 'tcx>,
item_def_id: DefId
) -> ItemCtxt<'a, 'tcx>
[src]
pub fn new(
tcx: TyCtxt<'a, 'tcx, 'tcx>,
item_def_id: DefId
) -> ItemCtxt<'a, 'tcx>
🔬 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?
impl<'a, 'tcx> ItemCtxt<'a, 'tcx>
[src]
impl<'a, 'tcx> ItemCtxt<'a, 'tcx>
pub fn to_ty(&self, ast_ty: &Ty) -> Ty<'tcx>
[src]
pub fn to_ty(&self, ast_ty: &Ty) -> Ty<'tcx>
🔬 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?
impl<'a, 'tcx> ItemCtxt<'a, 'tcx>
[src]
impl<'a, 'tcx> ItemCtxt<'a, 'tcx>
fn type_parameter_bounds_in_generics(
&self,
ast_generics: &Generics,
param_id: NodeId,
ty: Ty<'tcx>
) -> Vec<Predicate<'tcx>>
[src]
fn type_parameter_bounds_in_generics(
&self,
ast_generics: &Generics,
param_id: NodeId,
ty: Ty<'tcx>
) -> Vec<Predicate<'tcx>>
🔬 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?
Find bounds from hir::Generics. This requires scanning through the
AST. We do this to avoid having to convert all the bounds, which
would create artificial cycles. Instead we can only convert the
bounds for a type parameter X
if X::Foo
is used.
Trait Implementations
impl<'a, 'tcx> AstConv<'tcx, 'tcx> for ItemCtxt<'a, 'tcx>
[src]
impl<'a, 'tcx> AstConv<'tcx, 'tcx> for ItemCtxt<'a, 'tcx>
fn tcx<'b>(&'b self) -> TyCtxt<'b, 'tcx, 'tcx>
[src]
fn tcx<'b>(&'b self) -> TyCtxt<'b, 'tcx, 'tcx>
🔬 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?
fn get_type_parameter_bounds(
&self,
span: Span,
def_id: DefId
) -> GenericPredicates<'tcx>
[src]
fn get_type_parameter_bounds(
&self,
span: Span,
def_id: DefId
) -> GenericPredicates<'tcx>
🔬 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?
Returns the set of bounds in scope for the type parameter with the given id. Read more
fn re_infer(
&self,
_span: Span,
_def: Option<&RegionParameterDef>
) -> Option<Region<'tcx>>
[src]
fn re_infer(
&self,
_span: Span,
_def: Option<&RegionParameterDef>
) -> Option<Region<'tcx>>
🔬 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 lifetime should we use when a lifetime is omitted (and not elided)?
fn ty_infer(&self, span: Span) -> Ty<'tcx>
[src]
fn ty_infer(&self, span: Span) -> Ty<'tcx>
🔬 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 type should we use when a type is omitted?
fn projected_ty_from_poly_trait_ref(
&self,
span: Span,
item_def_id: DefId,
poly_trait_ref: PolyTraitRef<'tcx>
) -> Ty<'tcx>
[src]
fn projected_ty_from_poly_trait_ref(
&self,
span: Span,
item_def_id: DefId,
poly_trait_ref: PolyTraitRef<'tcx>
) -> Ty<'tcx>
🔬 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?
Projecting an associated type from a (potentially) higher-ranked trait reference is more complicated, because of the possibility of late-bound regions appearing in the associated type binding. This is not legal in function signatures for that reason. In a function body, we can always handle it because we can use inference variables to remove the late-bound regions. Read more
fn normalize_ty(&self, _span: Span, ty: Ty<'tcx>) -> Ty<'tcx>
[src]
fn normalize_ty(&self, _span: Span, ty: Ty<'tcx>) -> Ty<'tcx>
🔬 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?
Normalize an associated type coming from the user.
fn set_tainted_by_errors(&self)
[src]
fn set_tainted_by_errors(&self)
🔬 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?
Invoked when we encounter an error from some prior pass (e.g. resolve) that is translated into a ty-error. This is used to help suppress derived errors typeck might otherwise report. Read more
fn record_ty(&self, _hir_id: HirId, _ty: Ty<'tcx>, _span: Span)
[src]
fn record_ty(&self, _hir_id: HirId, _ty: Ty<'tcx>, _span: Span)
🔬 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?
fn ty_infer_for_def(&self, _def: &TypeParameterDef, span: Span) -> Ty<'tcx>
[src]
fn ty_infer_for_def(&self, _def: &TypeParameterDef, span: Span) -> Ty<'tcx>
🔬 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?
Same as ty_infer, but with a known type parameter definition.