[−][src]Struct rustc_ast_lowering::LoweringContext
Fields
sess: &'a SessionUsed to assign IDs to HIR nodes that do not directly correspond to AST nodes.
resolver: &'a mut dyn ResolverAstLoweringnt_to_tokenstream: fn(_: &Nonterminal, _: &ParseSess, _: Span) -> TokenStreamHACK(Centril): there is a cyclic dependency between the parser and lowering if we don't have this function pointer. To avoid that dependency so that librustc_middle is independent of the parser, we use dynamic dispatch here.
arena: &'hir Arena<'hir>Used to allocate HIR nodes
items: BTreeMap<HirId, Item<'hir>>The items being lowered are collected here.
trait_items: BTreeMap<TraitItemId, TraitItem<'hir>>impl_items: BTreeMap<ImplItemId, ImplItem<'hir>>bodies: BTreeMap<BodyId, Body<'hir>>exported_macros: Vec<MacroDef<'hir>>non_exported_macro_attrs: Vec<Attribute>trait_impls: BTreeMap<DefId, Vec<HirId>>modules: BTreeMap<HirId, ModuleItems>generator_kind: Option<GeneratorKind>task_context: Option<HirId>When inside an async context, this is the HirId of the
task_context local bound to the resume argument of the generator.
current_item: Option<Span>Used to get the current fn's def span to point to when using await
outside of an async fn.
catch_scopes: Vec<NodeId>loop_scopes: Vec<NodeId>is_in_loop_condition: boolis_in_trait_impl: boolis_in_dyn_type: boolanonymous_lifetime_mode: AnonymousLifetimeModeWhat to do when we encounter either an "anonymous lifetime
reference". The term "anonymous" is meant to encompass both
'_ lifetimes as well as fully elided cases where nothing is
written at all (e.g., &T or std::cell::Ref<T>).
lifetimes_to_define: Vec<(Span, ParamName)>Used to create lifetime definitions from in-band lifetime usages.
e.g., fn foo(x: &'x u8) -> &'x u8 to fn foo<'x>(x: &'x u8) -> &'x u8
When a named lifetime is encountered in a function or impl header and
has not been defined
(i.e., it doesn't appear in the in_scope_lifetimes list), it is added
to this list. The results of this list are then added to the list of
lifetime definitions in the corresponding impl or function generics.
is_collecting_in_band_lifetimes: booltrue if in-band lifetimes are being collected. This is used to
indicate whether or not we're in a place where new lifetimes will result
in in-band lifetime definitions, such a function or an impl header,
including implicit lifetimes from impl_header_lifetime_elision.
in_scope_lifetimes: Vec<ParamName>Currently in-scope lifetimes defined in impl headers, fn headers, or HRTB.
When is_collecting_in_band_lifetimes is true, each lifetime is checked
against this list to see if it is already in-scope, or if a definition
needs to be created for it.
We always store a normalize_to_macros_2_0() version of the param-name in this
vector.
current_module: HirIdtype_def_lifetime_params: DefIdMap<usize>current_hir_id_owner: Vec<(LocalDefId, u32)>item_local_id_counters: NodeMap<u32>node_id_to_hir_id: IndexVec<NodeId, Option<HirId>>allow_try_trait: Option<Lrc<[Symbol]>>allow_gen_future: Option<Lrc<[Symbol]>>Implementations
impl<'hir, '_> LoweringContext<'_, 'hir>[src]
pub(in expr) fn lower_exprs(
&mut self,
exprs: &[AstP<Expr>]
) -> &'hir [Expr<'hir>][src]
&mut self,
exprs: &[AstP<Expr>]
) -> &'hir [Expr<'hir>]
pub(crate) fn lower_expr(&mut self, e: &Expr) -> &'hir Expr<'hir>[src]
pub(crate) fn lower_expr_mut(&mut self, e: &Expr) -> Expr<'hir>[src]
pub(in expr) fn lower_unop(
&mut self,
u: UnOp
) -> UnOp[src]
&mut self,
u: UnOp
) -> UnOp
pub(in expr) fn lower_binop(
&mut self,
b: BinOp
) -> BinOp[src]
&mut self,
b: BinOp
) -> BinOp
pub(in expr) fn lower_expr_let(
&mut self,
span: Span,
pat: &Pat,
scrutinee: &Expr
) -> ExprKind<'hir>[src]
&mut self,
span: Span,
pat: &Pat,
scrutinee: &Expr
) -> ExprKind<'hir>
Emit an error and lower ast::ExprKind::Let(pat, scrutinee) into:
match scrutinee { pats => true, _ => false }
pub(in expr) fn lower_expr_if(
&mut self,
span: Span,
cond: &Expr,
then: &Block,
else_opt: Option<&Expr>
) -> ExprKind<'hir>[src]
&mut self,
span: Span,
cond: &Expr,
then: &Block,
else_opt: Option<&Expr>
) -> ExprKind<'hir>
pub(in expr) fn lower_expr_while_in_loop_scope(
&mut self,
span: Span,
cond: &Expr,
body: &Block,
opt_label: Option<Label>
) -> ExprKind<'hir>[src]
&mut self,
span: Span,
cond: &Expr,
body: &Block,
opt_label: Option<Label>
) -> ExprKind<'hir>
pub(in expr) fn lower_expr_try_block(
&mut self,
body: &Block
) -> ExprKind<'hir>[src]
&mut self,
body: &Block
) -> ExprKind<'hir>
Desugar try { <stmts>; <expr> } into { <stmts>; ::std::ops::Try::from_ok(<expr>) },
try { <stmts>; } into { <stmts>; ::std::ops::Try::from_ok(()) }
and save the block id to use it as a break target for desugaring of the ? operator.
pub(in expr) fn wrap_in_try_constructor(
&mut self,
lang_item: LangItem,
method_span: Span,
expr: &'hir Expr<'hir>,
overall_span: Span
) -> &'hir Expr<'hir>[src]
&mut self,
lang_item: LangItem,
method_span: Span,
expr: &'hir Expr<'hir>,
overall_span: Span
) -> &'hir Expr<'hir>
pub(in expr) fn lower_arm(
&mut self,
arm: &Arm
) -> Arm<'hir>[src]
&mut self,
arm: &Arm
) -> Arm<'hir>
pub(crate) fn make_async_expr(
&mut self,
capture_clause: CaptureBy,
closure_node_id: NodeId,
ret_ty: Option<AstP<Ty>>,
span: Span,
async_gen_kind: AsyncGeneratorKind,
body: impl FnOnce(&mut Self) -> Expr<'hir>
) -> ExprKind<'hir>[src]
&mut self,
capture_clause: CaptureBy,
closure_node_id: NodeId,
ret_ty: Option<AstP<Ty>>,
span: Span,
async_gen_kind: AsyncGeneratorKind,
body: impl FnOnce(&mut Self) -> Expr<'hir>
) -> ExprKind<'hir>
Lower an async construct to a generator that is then wrapped so it implements Future.
This results in:
std::future::from_generator(static move? |_task_context| -> <ret_ty> {
<body>
})
pub(in expr) fn lower_expr_await(
&mut self,
await_span: Span,
expr: &Expr
) -> ExprKind<'hir>[src]
&mut self,
await_span: Span,
expr: &Expr
) -> ExprKind<'hir>
Desugar <expr>.await into:
match <expr> { mut pinned => loop { match unsafe { ::std::future::Future::poll( <::std::pin::Pin>::new_unchecked(&mut pinned), ::std::future::get_context(task_context), ) } { ::std::task::Poll::Ready(result) => break result, ::std::task::Poll::Pending => {} } task_context = yield (); } }
pub(in expr) fn lower_expr_closure(
&mut self,
capture_clause: CaptureBy,
movability: Movability,
decl: &FnDecl,
body: &Expr,
fn_decl_span: Span
) -> ExprKind<'hir>[src]
&mut self,
capture_clause: CaptureBy,
movability: Movability,
decl: &FnDecl,
body: &Expr,
fn_decl_span: Span
) -> ExprKind<'hir>
pub(in expr) fn generator_movability_for_fn(
&mut self,
decl: &FnDecl,
fn_decl_span: Span,
generator_kind: Option<GeneratorKind>,
movability: Movability
) -> Option<Movability>[src]
&mut self,
decl: &FnDecl,
fn_decl_span: Span,
generator_kind: Option<GeneratorKind>,
movability: Movability
) -> Option<Movability>
pub(in expr) fn lower_expr_async_closure(
&mut self,
capture_clause: CaptureBy,
closure_id: NodeId,
decl: &FnDecl,
body: &Expr,
fn_decl_span: Span
) -> ExprKind<'hir>[src]
&mut self,
capture_clause: CaptureBy,
closure_id: NodeId,
decl: &FnDecl,
body: &Expr,
fn_decl_span: Span
) -> ExprKind<'hir>
pub(in expr) fn lower_expr_assign(
&mut self,
lhs: &Expr,
rhs: &Expr,
eq_sign_span: Span,
whole_span: Span
) -> ExprKind<'hir>[src]
&mut self,
lhs: &Expr,
rhs: &Expr,
eq_sign_span: Span,
whole_span: Span
) -> ExprKind<'hir>
Destructure the LHS of complex assignments.
For instance, lower (a, b) = t to { let (lhs1, lhs2) = t; a = lhs1; b = lhs2; }.
pub(in expr) fn extract_tuple_struct_path<'a>(
&mut self,
expr: &'a Expr
) -> Option<&'a Path>[src]
&mut self,
expr: &'a Expr
) -> Option<&'a Path>
If the given expression is a path to a tuple struct, returns that path. It is not a complete check, but just tries to reject most paths early if they are not tuple structs. Type checking will take care of the full validation later.
pub(in expr) fn destructure_assign(
&mut self,
lhs: &Expr,
eq_sign_span: Span,
assignments: &mut Vec<Stmt<'hir>>
) -> &'hir Pat<'hir>[src]
&mut self,
lhs: &Expr,
eq_sign_span: Span,
assignments: &mut Vec<Stmt<'hir>>
) -> &'hir Pat<'hir>
Convert the LHS of a destructuring assignment to a pattern.
Each sub-assignment is recorded in assignments.
pub(in expr) fn destructure_sequence(
&mut self,
elements: &[AstP<Expr>],
ctx: &str,
eq_sign_span: Span,
assignments: &mut Vec<Stmt<'hir>>
) -> (&'hir [&'hir Pat<'hir>], Option<(usize, Span)>)[src]
&mut self,
elements: &[AstP<Expr>],
ctx: &str,
eq_sign_span: Span,
assignments: &mut Vec<Stmt<'hir>>
) -> (&'hir [&'hir Pat<'hir>], Option<(usize, Span)>)
Destructure a sequence of expressions occurring on the LHS of an assignment.
Such a sequence occurs in a tuple (struct)/slice.
Return a sequence of corresponding patterns, and the index and the span of .. if it
exists.
Each sub-assignment is recorded in assignments.
pub(in expr) fn lower_expr_range_closed(
&mut self,
span: Span,
e1: &Expr,
e2: &Expr
) -> ExprKind<'hir>[src]
&mut self,
span: Span,
e1: &Expr,
e2: &Expr
) -> ExprKind<'hir>
Desugar <start>..=<end> into std::ops::RangeInclusive::new(<start>, <end>).
pub(in expr) fn lower_expr_range(
&mut self,
span: Span,
e1: Option<&Expr>,
e2: Option<&Expr>,
lims: RangeLimits
) -> ExprKind<'hir>[src]
&mut self,
span: Span,
e1: Option<&Expr>,
e2: Option<&Expr>,
lims: RangeLimits
) -> ExprKind<'hir>
pub(in expr) fn lower_loop_destination(
&mut self,
destination: Option<(NodeId, Label)>
) -> Destination[src]
&mut self,
destination: Option<(NodeId, Label)>
) -> Destination
pub(in expr) fn lower_jump_destination(
&mut self,
id: NodeId,
opt_label: Option<Label>
) -> Destination[src]
&mut self,
id: NodeId,
opt_label: Option<Label>
) -> Destination
pub(in expr) fn with_catch_scope<T>(
&mut self,
catch_id: NodeId,
f: impl FnOnce(&mut Self) -> T
) -> T[src]
&mut self,
catch_id: NodeId,
f: impl FnOnce(&mut Self) -> T
) -> T
pub(in expr) fn with_loop_scope<T>(
&mut self,
loop_id: NodeId,
f: impl FnOnce(&mut Self) -> T
) -> T[src]
&mut self,
loop_id: NodeId,
f: impl FnOnce(&mut Self) -> T
) -> T
pub(in expr) fn with_loop_condition_scope<T>(
&mut self,
f: impl FnOnce(&mut Self) -> T
) -> T[src]
&mut self,
f: impl FnOnce(&mut Self) -> T
) -> T
pub(in expr) fn lower_expr_asm(
&mut self,
sp: Span,
asm: &InlineAsm
) -> ExprKind<'hir>[src]
&mut self,
sp: Span,
asm: &InlineAsm
) -> ExprKind<'hir>
pub(in expr) fn lower_expr_llvm_asm(
&mut self,
asm: &LlvmInlineAsm
) -> ExprKind<'hir>[src]
&mut self,
asm: &LlvmInlineAsm
) -> ExprKind<'hir>
pub(in expr) fn lower_field(
&mut self,
f: &Field
) -> Field<'hir>[src]
&mut self,
f: &Field
) -> Field<'hir>
pub(in expr) fn lower_expr_yield(
&mut self,
span: Span,
opt_expr: Option<&Expr>
) -> ExprKind<'hir>[src]
&mut self,
span: Span,
opt_expr: Option<&Expr>
) -> ExprKind<'hir>
pub(in expr) fn lower_expr_for(
&mut self,
e: &Expr,
pat: &Pat,
head: &Expr,
body: &Block,
opt_label: Option<Label>
) -> Expr<'hir>[src]
&mut self,
e: &Expr,
pat: &Pat,
head: &Expr,
body: &Block,
opt_label: Option<Label>
) -> Expr<'hir>
Desugar ExprForLoop from: [opt_ident]: for <pat> in <head> <body> into:
{
let result = match ::std::iter::IntoIterator::into_iter(<head>) {
mut iter => {
[opt_ident]: loop {
let mut __next;
match ::std::iter::Iterator::next(&mut iter) {
::std::option::Option::Some(val) => __next = val,
::std::option::Option::None => break
};
let <pat> = __next;
StmtKind::Expr(<body>);
}
}
};
result
}pub(in expr) fn lower_expr_try(
&mut self,
span: Span,
sub_expr: &Expr
) -> ExprKind<'hir>[src]
&mut self,
span: Span,
sub_expr: &Expr
) -> ExprKind<'hir>
Desugar ExprKind::Try from: <expr>? into:
match Try::into_result(<expr>) { Ok(val) => #[allow(unreachable_code)] val, Err(err) => #[allow(unreachable_code)] // If there is an enclosing `try {...}`: break 'catch_target Try::from_error(From::from(err)), // Otherwise: return Try::from_error(From::from(err)), }
pub(crate) fn expr_bool(&mut self, span: Span, val: bool) -> &'hir Expr<'hir>[src]
Constructs a true or false literal expression.
pub(crate) fn expr_drop_temps(
&mut self,
span: Span,
expr: &'hir Expr<'hir>,
attrs: AttrVec
) -> &'hir Expr<'hir>[src]
&mut self,
span: Span,
expr: &'hir Expr<'hir>,
attrs: AttrVec
) -> &'hir Expr<'hir>
Wrap the given expr in a terminating scope using hir::ExprKind::DropTemps.
In terms of drop order, it has the same effect as wrapping expr in
{ let _t = $expr; _t } but should provide better compile-time performance.
The drop order can be important in e.g. if expr { .. }.
pub(crate) fn expr_drop_temps_mut(
&mut self,
span: Span,
expr: &'hir Expr<'hir>,
attrs: AttrVec
) -> Expr<'hir>[src]
&mut self,
span: Span,
expr: &'hir Expr<'hir>,
attrs: AttrVec
) -> Expr<'hir>
pub(in expr) fn expr_match(
&mut self,
span: Span,
arg: &'hir Expr<'hir>,
arms: &'hir [Arm<'hir>],
source: MatchSource
) -> Expr<'hir>[src]
&mut self,
span: Span,
arg: &'hir Expr<'hir>,
arms: &'hir [Arm<'hir>],
source: MatchSource
) -> Expr<'hir>
pub(in expr) fn expr_break(
&mut self,
span: Span,
attrs: AttrVec
) -> &'hir Expr<'hir>[src]
&mut self,
span: Span,
attrs: AttrVec
) -> &'hir Expr<'hir>
pub(in expr) fn expr_mut_addr_of(
&mut self,
span: Span,
e: &'hir Expr<'hir>
) -> Expr<'hir>[src]
&mut self,
span: Span,
e: &'hir Expr<'hir>
) -> Expr<'hir>
pub(in expr) fn expr_unit(
&mut self,
sp: Span
) -> &'hir Expr<'hir>[src]
&mut self,
sp: Span
) -> &'hir Expr<'hir>
pub(in expr) fn expr_call_mut(
&mut self,
span: Span,
e: &'hir Expr<'hir>,
args: &'hir [Expr<'hir>]
) -> Expr<'hir>[src]
&mut self,
span: Span,
e: &'hir Expr<'hir>,
args: &'hir [Expr<'hir>]
) -> Expr<'hir>
pub(in expr) fn expr_call(
&mut self,
span: Span,
e: &'hir Expr<'hir>,
args: &'hir [Expr<'hir>]
) -> &'hir Expr<'hir>[src]
&mut self,
span: Span,
e: &'hir Expr<'hir>,
args: &'hir [Expr<'hir>]
) -> &'hir Expr<'hir>
pub(in expr) fn expr_call_lang_item_fn_mut(
&mut self,
span: Span,
lang_item: LangItem,
args: &'hir [Expr<'hir>]
) -> Expr<'hir>[src]
&mut self,
span: Span,
lang_item: LangItem,
args: &'hir [Expr<'hir>]
) -> Expr<'hir>
pub(in expr) fn expr_call_lang_item_fn(
&mut self,
span: Span,
lang_item: LangItem,
args: &'hir [Expr<'hir>]
) -> &'hir Expr<'hir>[src]
&mut self,
span: Span,
lang_item: LangItem,
args: &'hir [Expr<'hir>]
) -> &'hir Expr<'hir>
pub(in expr) fn expr_lang_item_path(
&mut self,
span: Span,
lang_item: LangItem,
attrs: AttrVec
) -> Expr<'hir>[src]
&mut self,
span: Span,
lang_item: LangItem,
attrs: AttrVec
) -> Expr<'hir>
pub(crate) fn expr_ident(
&mut self,
sp: Span,
ident: Ident,
binding: HirId
) -> &'hir Expr<'hir>[src]
&mut self,
sp: Span,
ident: Ident,
binding: HirId
) -> &'hir Expr<'hir>
pub(crate) fn expr_ident_mut(
&mut self,
sp: Span,
ident: Ident,
binding: HirId
) -> Expr<'hir>[src]
&mut self,
sp: Span,
ident: Ident,
binding: HirId
) -> Expr<'hir>
pub(in expr) fn expr_ident_with_attrs(
&mut self,
span: Span,
ident: Ident,
binding: HirId,
attrs: AttrVec
) -> Expr<'hir>[src]
&mut self,
span: Span,
ident: Ident,
binding: HirId,
attrs: AttrVec
) -> Expr<'hir>
pub(in expr) fn expr_unsafe(
&mut self,
expr: &'hir Expr<'hir>
) -> Expr<'hir>[src]
&mut self,
expr: &'hir Expr<'hir>
) -> Expr<'hir>
pub(in expr) fn expr_block_empty(
&mut self,
span: Span
) -> &'hir Expr<'hir>[src]
&mut self,
span: Span
) -> &'hir Expr<'hir>
pub(crate) fn expr_block(
&mut self,
b: &'hir Block<'hir>,
attrs: AttrVec
) -> Expr<'hir>[src]
&mut self,
b: &'hir Block<'hir>,
attrs: AttrVec
) -> Expr<'hir>
pub(crate) fn expr(
&mut self,
span: Span,
kind: ExprKind<'hir>,
attrs: AttrVec
) -> Expr<'hir>[src]
&mut self,
span: Span,
kind: ExprKind<'hir>,
attrs: AttrVec
) -> Expr<'hir>
pub(in expr) fn field(
&mut self,
ident: Ident,
expr: &'hir Expr<'hir>,
span: Span
) -> Field<'hir>[src]
&mut self,
ident: Ident,
expr: &'hir Expr<'hir>,
span: Span
) -> Field<'hir>
pub(in expr) fn arm(
&mut self,
pat: &'hir Pat<'hir>,
expr: &'hir Expr<'hir>
) -> Arm<'hir>[src]
&mut self,
pat: &'hir Pat<'hir>,
expr: &'hir Expr<'hir>
) -> Arm<'hir>
impl<'hir, '_> LoweringContext<'_, 'hir>[src]
pub(in item) fn with_parent_item_lifetime_defs<T>(
&mut self,
parent_hir_id: HirId,
f: impl FnOnce(&mut LoweringContext<'_, '_>) -> T
) -> T[src]
&mut self,
parent_hir_id: HirId,
f: impl FnOnce(&mut LoweringContext<'_, '_>) -> T
) -> T
pub(in item) fn without_in_scope_lifetime_defs<T>(
&mut self,
f: impl FnOnce(&mut LoweringContext<'_, '_>) -> T
) -> T[src]
&mut self,
f: impl FnOnce(&mut LoweringContext<'_, '_>) -> T
) -> T
pub(crate) fn lower_mod(&mut self, m: &Mod) -> Mod<'hir>[src]
pub(crate) fn lower_item_id(&mut self, i: &Item) -> SmallVec<[ItemId; 1]>[src]
pub(in item) fn lower_item_id_use_tree(
&mut self,
tree: &UseTree,
base_id: NodeId,
vec: &mut SmallVec<[NodeId; 1]>
)[src]
&mut self,
tree: &UseTree,
base_id: NodeId,
vec: &mut SmallVec<[NodeId; 1]>
)
pub fn lower_item(&mut self, i: &Item) -> Option<Item<'hir>>[src]
pub(in item) fn lower_item_kind(
&mut self,
span: Span,
id: NodeId,
ident: &mut Ident,
attrs: &'hir [Attribute],
vis: &mut Visibility<'hir>,
i: &ItemKind
) -> ItemKind<'hir>[src]
&mut self,
span: Span,
id: NodeId,
ident: &mut Ident,
attrs: &'hir [Attribute],
vis: &mut Visibility<'hir>,
i: &ItemKind
) -> ItemKind<'hir>
pub(in item) fn lower_const_item(
&mut self,
ty: &Ty,
span: Span,
body: Option<&Expr>
) -> (&'hir Ty<'hir>, BodyId)[src]
&mut self,
ty: &Ty,
span: Span,
body: Option<&Expr>
) -> (&'hir Ty<'hir>, BodyId)
pub(in item) fn lower_use_tree(
&mut self,
tree: &UseTree,
prefix: &Path,
id: NodeId,
vis: &mut Visibility<'hir>,
ident: &mut Ident,
attrs: &'hir [Attribute]
) -> ItemKind<'hir>[src]
&mut self,
tree: &UseTree,
prefix: &Path,
id: NodeId,
vis: &mut Visibility<'hir>,
ident: &mut Ident,
attrs: &'hir [Attribute]
) -> ItemKind<'hir>
pub(in item) fn rebuild_use_path(
&mut self,
path: &Path<'hir>
) -> &'hir Path<'hir>[src]
&mut self,
path: &Path<'hir>
) -> &'hir Path<'hir>
Paths like the visibility path in pub(super) use foo::{bar, baz} are repeated
many times in the HIR tree; for each occurrence, we need to assign distinct
NodeIds. (See, e.g., #56128.)
pub(in item) fn rebuild_vis(
&mut self,
vis: &Visibility<'hir>
) -> Visibility<'hir>[src]
&mut self,
vis: &Visibility<'hir>
) -> Visibility<'hir>
pub(in item) fn lower_foreign_item(
&mut self,
i: &ForeignItem
) -> ForeignItem<'hir>[src]
&mut self,
i: &ForeignItem
) -> ForeignItem<'hir>
pub(in item) fn lower_foreign_mod(
&mut self,
fm: &ForeignMod
) -> ForeignMod<'hir>[src]
&mut self,
fm: &ForeignMod
) -> ForeignMod<'hir>
pub(in item) fn lower_global_asm(
&mut self,
ga: &GlobalAsm
) -> &'hir GlobalAsm[src]
&mut self,
ga: &GlobalAsm
) -> &'hir GlobalAsm
pub(in item) fn lower_variant(
&mut self,
v: &Variant
) -> Variant<'hir>[src]
&mut self,
v: &Variant
) -> Variant<'hir>
pub(in item) fn lower_variant_data(
&mut self,
vdata: &VariantData
) -> VariantData<'hir>[src]
&mut self,
vdata: &VariantData
) -> VariantData<'hir>
pub(in item) fn lower_struct_field(
&mut self,
(index, f): (usize, &StructField)
) -> StructField<'hir>[src]
&mut self,
(index, f): (usize, &StructField)
) -> StructField<'hir>
pub(in item) fn lower_trait_item(
&mut self,
i: &AssocItem
) -> TraitItem<'hir>[src]
&mut self,
i: &AssocItem
) -> TraitItem<'hir>
pub(in item) fn lower_trait_item_ref(
&mut self,
i: &AssocItem
) -> TraitItemRef[src]
&mut self,
i: &AssocItem
) -> TraitItemRef
pub(crate) fn expr_err(&mut self, span: Span) -> Expr<'hir>[src]
Construct ExprKind::Err for the given span.
pub(in item) fn lower_impl_item(
&mut self,
i: &AssocItem
) -> ImplItem<'hir>[src]
&mut self,
i: &AssocItem
) -> ImplItem<'hir>
pub(in item) fn lower_impl_item_ref(
&mut self,
i: &AssocItem
) -> ImplItemRef<'hir>[src]
&mut self,
i: &AssocItem
) -> ImplItemRef<'hir>
pub(in item) fn lower_visibility(
&mut self,
v: &Visibility,
explicit_owner: Option<NodeId>
) -> Visibility<'hir>[src]
&mut self,
v: &Visibility,
explicit_owner: Option<NodeId>
) -> Visibility<'hir>
If an explicit_owner is given, this method allocates the HirId in
the address space of that item instead of the item currently being
lowered. This can happen during lower_impl_item_ref() where we need to
lower a Visibility value although we haven't lowered the owning
ImplItem in question yet.
pub(in item) fn lower_defaultness(
&self,
d: Defaultness,
has_value: bool
) -> (Defaultness, Option<Span>)[src]
&self,
d: Defaultness,
has_value: bool
) -> (Defaultness, Option<Span>)
pub(in item) fn record_body(
&mut self,
params: &'hir [Param<'hir>],
value: Expr<'hir>
) -> BodyId[src]
&mut self,
params: &'hir [Param<'hir>],
value: Expr<'hir>
) -> BodyId
pub(crate) fn lower_body(
&mut self,
f: impl FnOnce(&mut Self) -> (&'hir [Param<'hir>], Expr<'hir>)
) -> BodyId[src]
&mut self,
f: impl FnOnce(&mut Self) -> (&'hir [Param<'hir>], Expr<'hir>)
) -> BodyId
pub(in item) fn lower_param(
&mut self,
param: &Param
) -> Param<'hir>[src]
&mut self,
param: &Param
) -> Param<'hir>
pub(crate) fn lower_fn_body(
&mut self,
decl: &FnDecl,
body: impl FnOnce(&mut Self) -> Expr<'hir>
) -> BodyId[src]
&mut self,
decl: &FnDecl,
body: impl FnOnce(&mut Self) -> Expr<'hir>
) -> BodyId
pub(in item) fn lower_fn_body_block(
&mut self,
span: Span,
decl: &FnDecl,
body: Option<&Block>
) -> BodyId[src]
&mut self,
span: Span,
decl: &FnDecl,
body: Option<&Block>
) -> BodyId
pub(in item) fn lower_block_expr_opt(
&mut self,
span: Span,
block: Option<&Block>
) -> Expr<'hir>[src]
&mut self,
span: Span,
block: Option<&Block>
) -> Expr<'hir>
pub(crate) fn lower_const_body(
&mut self,
span: Span,
expr: Option<&Expr>
) -> BodyId[src]
&mut self,
span: Span,
expr: Option<&Expr>
) -> BodyId
pub(in item) fn lower_maybe_async_body(
&mut self,
span: Span,
decl: &FnDecl,
asyncness: Async,
body: Option<&Block>
) -> BodyId[src]
&mut self,
span: Span,
decl: &FnDecl,
asyncness: Async,
body: Option<&Block>
) -> BodyId
pub(in item) fn lower_method_sig(
&mut self,
generics: &Generics,
sig: &FnSig,
fn_def_id: LocalDefId,
impl_trait_return_allow: bool,
is_async: Option<NodeId>
) -> (Generics<'hir>, FnSig<'hir>)[src]
&mut self,
generics: &Generics,
sig: &FnSig,
fn_def_id: LocalDefId,
impl_trait_return_allow: bool,
is_async: Option<NodeId>
) -> (Generics<'hir>, FnSig<'hir>)
pub(in item) fn lower_fn_header(
&mut self,
h: FnHeader
) -> FnHeader[src]
&mut self,
h: FnHeader
) -> FnHeader
pub(crate) fn lower_abi(&mut self, abi: StrLit) -> Abi[src]
pub(crate) fn lower_extern(&mut self, ext: Extern) -> Abi[src]
pub(in item) fn error_on_invalid_abi(
&self,
abi: StrLit
)[src]
&self,
abi: StrLit
)
pub(in item) fn lower_asyncness(
&mut self,
a: Async
) -> IsAsync[src]
&mut self,
a: Async
) -> IsAsync
pub(in item) fn lower_constness(
&mut self,
c: Const
) -> Constness[src]
&mut self,
c: Const
) -> Constness
pub(crate) fn lower_unsafety(&mut self, u: Unsafe) -> Unsafety[src]
pub(crate) fn lower_generics_mut(
&mut self,
generics: &Generics,
itctx: ImplTraitContext<'_, 'hir>
) -> GenericsCtor<'hir>[src]
&mut self,
generics: &Generics,
itctx: ImplTraitContext<'_, 'hir>
) -> GenericsCtor<'hir>
pub(crate) fn lower_generics(
&mut self,
generics: &Generics,
itctx: ImplTraitContext<'_, 'hir>
) -> Generics<'hir>[src]
&mut self,
generics: &Generics,
itctx: ImplTraitContext<'_, 'hir>
) -> Generics<'hir>
pub(in item) fn lower_where_clause(
&mut self,
wc: &WhereClause
) -> WhereClause<'hir>[src]
&mut self,
wc: &WhereClause
) -> WhereClause<'hir>
pub(in item) fn lower_where_predicate(
&mut self,
pred: &WherePredicate
) -> WherePredicate<'hir>[src]
&mut self,
pred: &WherePredicate
) -> WherePredicate<'hir>
impl<'a, 'hir> LoweringContext<'a, 'hir>[src]
pub(crate) fn lower_pat(&mut self, pattern: &Pat) -> &'hir Pat<'hir>[src]
pub(in pat) fn lower_pat_tuple(
&mut self,
pats: &[P<Pat>],
ctx: &str
) -> (&'hir [&'hir Pat<'hir>], Option<usize>)[src]
&mut self,
pats: &[P<Pat>],
ctx: &str
) -> (&'hir [&'hir Pat<'hir>], Option<usize>)
pub(in pat) fn lower_pat_slice(
&mut self,
pats: &[P<Pat>]
) -> PatKind<'hir>[src]
&mut self,
pats: &[P<Pat>]
) -> PatKind<'hir>
Lower a slice pattern of form [pat_0, ..., pat_n] into
hir::PatKind::Slice(before, slice, after).
When encountering ($binding_mode $ident @)? .. (slice),
this is interpreted as a sub-slice pattern semantically.
Patterns that follow, which are not like slice -- or an error occurs, are in after.
pub(in pat) fn lower_pat_ident(
&mut self,
p: &Pat,
binding_mode: &BindingMode,
ident: Ident,
lower_sub: impl FnOnce(&mut Self) -> Option<&'hir Pat<'hir>>
) -> PatKind<'hir>[src]
&mut self,
p: &Pat,
binding_mode: &BindingMode,
ident: Ident,
lower_sub: impl FnOnce(&mut Self) -> Option<&'hir Pat<'hir>>
) -> PatKind<'hir>
pub(in pat) fn lower_binding_mode(
&mut self,
b: &BindingMode
) -> BindingAnnotation[src]
&mut self,
b: &BindingMode
) -> BindingAnnotation
pub(in pat) fn pat_wild_with_node_id_of(
&mut self,
p: &Pat
) -> &'hir Pat<'hir>[src]
&mut self,
p: &Pat
) -> &'hir Pat<'hir>
pub(in pat) fn pat_with_node_id_of(
&mut self,
p: &Pat,
kind: PatKind<'hir>
) -> &'hir Pat<'hir>[src]
&mut self,
p: &Pat,
kind: PatKind<'hir>
) -> &'hir Pat<'hir>
Construct a Pat with the HirId of p.id lowered.
pub(crate) fn ban_extra_rest_pat(&self, sp: Span, prev_sp: Span, ctx: &str)[src]
Emit a friendly error for extra .. patterns in a tuple/tuple struct/slice pattern.
pub(in pat) fn ban_illegal_rest_pat(
&self,
sp: Span
) -> PatKind<'hir>[src]
&self,
sp: Span
) -> PatKind<'hir>
Used to ban the .. pattern in places it shouldn't be semantically.
pub(in pat) fn lower_range_end(
&mut self,
e: &RangeEnd,
has_end: bool
) -> RangeEnd[src]
&mut self,
e: &RangeEnd,
has_end: bool
) -> RangeEnd
impl<'a, 'hir> LoweringContext<'a, 'hir>[src]
pub(crate) fn lower_qpath(
&mut self,
id: NodeId,
qself: &Option<QSelf>,
p: &Path,
param_mode: ParamMode,
itctx: ImplTraitContext<'_, 'hir>
) -> QPath<'hir>[src]
&mut self,
id: NodeId,
qself: &Option<QSelf>,
p: &Path,
param_mode: ParamMode,
itctx: ImplTraitContext<'_, 'hir>
) -> QPath<'hir>
pub(crate) fn lower_path_extra(
&mut self,
res: Res,
p: &Path,
param_mode: ParamMode,
explicit_owner: Option<NodeId>
) -> &'hir Path<'hir>[src]
&mut self,
res: Res,
p: &Path,
param_mode: ParamMode,
explicit_owner: Option<NodeId>
) -> &'hir Path<'hir>
pub(crate) fn lower_path(
&mut self,
id: NodeId,
p: &Path,
param_mode: ParamMode
) -> &'hir Path<'hir>[src]
&mut self,
id: NodeId,
p: &Path,
param_mode: ParamMode
) -> &'hir Path<'hir>
pub(crate) fn lower_path_segment(
&mut self,
path_span: Span,
segment: &PathSegment,
param_mode: ParamMode,
expected_lifetimes: usize,
parenthesized_generic_args: ParenthesizedGenericArgs,
itctx: ImplTraitContext<'_, 'hir>,
explicit_owner: Option<NodeId>
) -> PathSegment<'hir>[src]
&mut self,
path_span: Span,
segment: &PathSegment,
param_mode: ParamMode,
expected_lifetimes: usize,
parenthesized_generic_args: ParenthesizedGenericArgs,
itctx: ImplTraitContext<'_, 'hir>,
explicit_owner: Option<NodeId>
) -> PathSegment<'hir>
pub(in path) fn lower_angle_bracketed_parameter_data(
&mut self,
data: &AngleBracketedArgs,
param_mode: ParamMode,
itctx: ImplTraitContext<'_, 'hir>
) -> (GenericArgsCtor<'hir>, bool)[src]
&mut self,
data: &AngleBracketedArgs,
param_mode: ParamMode,
itctx: ImplTraitContext<'_, 'hir>
) -> (GenericArgsCtor<'hir>, bool)
pub(in path) fn lower_parenthesized_parameter_data(
&mut self,
data: &ParenthesizedArgs
) -> (GenericArgsCtor<'hir>, bool)[src]
&mut self,
data: &ParenthesizedArgs
) -> (GenericArgsCtor<'hir>, bool)
pub(crate) fn output_ty_binding(
&mut self,
span: Span,
ty: &'hir Ty<'hir>
) -> TypeBinding<'hir>[src]
&mut self,
span: Span,
ty: &'hir Ty<'hir>
) -> TypeBinding<'hir>
An associated type binding Output = $ty.
impl<'a, 'hir> LoweringContext<'a, 'hir>[src]
pub(crate) fn lower_crate(self, c: &Crate) -> Crate<'hir>[src]
pub(crate) fn insert_item(&mut self, item: Item<'hir>)[src]
pub(crate) fn allocate_hir_id_counter(&mut self, owner: NodeId) -> HirId[src]
pub(crate) fn lower_node_id_generic(
&mut self,
ast_node_id: NodeId,
alloc_hir_id: impl FnOnce(&mut Self) -> HirId
) -> HirId[src]
&mut self,
ast_node_id: NodeId,
alloc_hir_id: impl FnOnce(&mut Self) -> HirId
) -> HirId
pub(crate) fn with_hir_id_owner<T>(
&mut self,
owner: NodeId,
f: impl FnOnce(&mut Self) -> T
) -> T[src]
&mut self,
owner: NodeId,
f: impl FnOnce(&mut Self) -> T
) -> T
pub(crate) fn lower_node_id(&mut self, ast_node_id: NodeId) -> HirId[src]
This method allocates a new HirId for the given NodeId and stores it in
the LoweringContext's NodeId => HirId map.
Take care not to call this method if the resulting HirId is then not
actually used in the HIR, as that would trigger an assertion in the
HirIdValidator later on, which makes sure that all NodeIds got mapped
properly. Calling the method twice with the same NodeId is fine though.
pub(crate) fn lower_node_id_with_owner(
&mut self,
ast_node_id: NodeId,
owner: NodeId
) -> HirId[src]
&mut self,
ast_node_id: NodeId,
owner: NodeId
) -> HirId
pub(crate) fn next_id(&mut self) -> HirId[src]
pub(crate) fn lower_res(&mut self, res: Res<NodeId>) -> Res[src]
pub(crate) fn expect_full_res(&mut self, id: NodeId) -> Res<NodeId>[src]
pub(crate) fn expect_full_res_from_use(
&mut self,
id: NodeId
) -> impl Iterator<Item = Res<NodeId>>[src]
&mut self,
id: NodeId
) -> impl Iterator<Item = Res<NodeId>>
pub(crate) fn diagnostic(&self) -> &Handler[src]
pub(crate) fn mark_span_with_reason(
&self,
reason: DesugaringKind,
span: Span,
allow_internal_unstable: Option<Lrc<[Symbol]>>
) -> Span[src]
&self,
reason: DesugaringKind,
span: Span,
allow_internal_unstable: Option<Lrc<[Symbol]>>
) -> Span
Reuses the span but adds information like the kind of the desugaring and features that are allowed inside this span.
pub(crate) fn with_anonymous_lifetime_mode<R>(
&mut self,
anonymous_lifetime_mode: AnonymousLifetimeMode,
op: impl FnOnce(&mut Self) -> R
) -> R[src]
&mut self,
anonymous_lifetime_mode: AnonymousLifetimeMode,
op: impl FnOnce(&mut Self) -> R
) -> R
pub(crate) fn collect_in_band_defs<T>(
&mut self,
parent_def_id: LocalDefId,
anonymous_lifetime_mode: AnonymousLifetimeMode,
f: impl FnOnce(&mut Self) -> (Vec<GenericParam<'hir>>, T)
) -> (Vec<GenericParam<'hir>>, T)[src]
&mut self,
parent_def_id: LocalDefId,
anonymous_lifetime_mode: AnonymousLifetimeMode,
f: impl FnOnce(&mut Self) -> (Vec<GenericParam<'hir>>, T)
) -> (Vec<GenericParam<'hir>>, T)
Creates a new hir::GenericParam for every new lifetime and
type parameter encountered while evaluating f. Definitions
are created with the parent provided. If no parent_id is
provided, no definitions will be returned.
Presuming that in-band lifetimes are enabled, then
self.anonymous_lifetime_mode will be updated to match the
parameter while f is running (and restored afterwards).
pub(crate) fn lifetime_to_generic_param(
&mut self,
span: Span,
hir_name: ParamName,
parent_def_id: LocalDefId
) -> GenericParam<'hir>[src]
&mut self,
span: Span,
hir_name: ParamName,
parent_def_id: LocalDefId
) -> GenericParam<'hir>
Converts a lifetime into a new generic parameter.
pub(crate) fn maybe_collect_in_band_lifetime(&mut self, ident: Ident)[src]
When there is a reference to some lifetime 'a, and in-band
lifetimes are enabled, then we want to push that lifetime into
the vector of names to define later. In that case, it will get
added to the appropriate generics.
pub(crate) fn collect_fresh_in_band_lifetime(&mut self, span: Span) -> ParamName[src]
When we have either an elided or '_ lifetime in an impl
header, we convert it to an in-band lifetime.
pub(crate) fn with_in_scope_lifetime_defs<T>(
&mut self,
params: &[GenericParam],
f: impl FnOnce(&mut Self) -> T
) -> T[src]
&mut self,
params: &[GenericParam],
f: impl FnOnce(&mut Self) -> T
) -> T
pub(crate) fn add_in_band_defs<T>(
&mut self,
generics: &Generics,
parent_def_id: LocalDefId,
anonymous_lifetime_mode: AnonymousLifetimeMode,
f: impl FnOnce(&mut Self, &mut Vec<GenericParam<'hir>>) -> T
) -> (Generics<'hir>, T)[src]
&mut self,
generics: &Generics,
parent_def_id: LocalDefId,
anonymous_lifetime_mode: AnonymousLifetimeMode,
f: impl FnOnce(&mut Self, &mut Vec<GenericParam<'hir>>) -> T
) -> (Generics<'hir>, T)
Appends in-band lifetime defs and argument-position impl Trait defs to the existing set of generics.
Presuming that in-band lifetimes are enabled, then
self.anonymous_lifetime_mode will be updated to match the
parameter while f is running (and restored afterwards).
pub(crate) fn with_dyn_type_scope<T>(
&mut self,
in_scope: bool,
f: impl FnOnce(&mut Self) -> T
) -> T[src]
&mut self,
in_scope: bool,
f: impl FnOnce(&mut Self) -> T
) -> T
pub(crate) fn with_new_scopes<T>(&mut self, f: impl FnOnce(&mut Self) -> T) -> T[src]
pub(crate) fn lower_attrs(&mut self, attrs: &[Attribute]) -> &'hir [Attribute][src]
pub(crate) fn lower_attr(&mut self, attr: &Attribute) -> Attribute[src]
pub(crate) fn lower_mac_args(&mut self, args: &MacArgs) -> MacArgs[src]
pub(crate) fn lower_token_stream(&mut self, tokens: TokenStream) -> TokenStream[src]
pub(crate) fn lower_token_tree(&mut self, tree: TokenTree) -> TokenStream[src]
pub(crate) fn lower_token(&mut self, token: Token) -> TokenStream[src]
pub(crate) fn lower_assoc_ty_constraint(
&mut self,
constraint: &AssocTyConstraint,
itctx: ImplTraitContext<'_, 'hir>
) -> TypeBinding<'hir>[src]
&mut self,
constraint: &AssocTyConstraint,
itctx: ImplTraitContext<'_, 'hir>
) -> TypeBinding<'hir>
Given an associated type constraint like one of these:
T: Iterator<Item: Debug> ^^^^^^^^^^^ T: Iterator<Item = Debug> ^^^^^^^^^^^^
returns a hir::TypeBinding representing Item.
pub(crate) fn lower_generic_arg(
&mut self,
arg: &GenericArg,
itctx: ImplTraitContext<'_, 'hir>
) -> GenericArg<'hir>[src]
&mut self,
arg: &GenericArg,
itctx: ImplTraitContext<'_, 'hir>
) -> GenericArg<'hir>
pub(crate) fn lower_ty(
&mut self,
t: &Ty,
itctx: ImplTraitContext<'_, 'hir>
) -> &'hir Ty<'hir>[src]
&mut self,
t: &Ty,
itctx: ImplTraitContext<'_, 'hir>
) -> &'hir Ty<'hir>
pub(crate) fn lower_path_ty(
&mut self,
t: &Ty,
qself: &Option<QSelf>,
path: &Path,
param_mode: ParamMode,
itctx: ImplTraitContext<'_, 'hir>
) -> Ty<'hir>[src]
&mut self,
t: &Ty,
qself: &Option<QSelf>,
path: &Path,
param_mode: ParamMode,
itctx: ImplTraitContext<'_, 'hir>
) -> Ty<'hir>
pub(crate) fn ty(&mut self, span: Span, kind: TyKind<'hir>) -> Ty<'hir>[src]
pub(crate) fn ty_tup(&mut self, span: Span, tys: &'hir [Ty<'hir>]) -> Ty<'hir>[src]
pub(crate) fn lower_ty_direct(
&mut self,
t: &Ty,
itctx: ImplTraitContext<'_, 'hir>
) -> Ty<'hir>[src]
&mut self,
t: &Ty,
itctx: ImplTraitContext<'_, 'hir>
) -> Ty<'hir>
pub(crate) fn lower_opaque_impl_trait(
&mut self,
span: Span,
fn_def_id: Option<DefId>,
origin: OpaqueTyOrigin,
opaque_ty_node_id: NodeId,
capturable_lifetimes: Option<&FxHashSet<LifetimeName>>,
lower_bounds: impl FnOnce(&mut Self) -> GenericBounds<'hir>
) -> TyKind<'hir>[src]
&mut self,
span: Span,
fn_def_id: Option<DefId>,
origin: OpaqueTyOrigin,
opaque_ty_node_id: NodeId,
capturable_lifetimes: Option<&FxHashSet<LifetimeName>>,
lower_bounds: impl FnOnce(&mut Self) -> GenericBounds<'hir>
) -> TyKind<'hir>
pub(crate) fn generate_opaque_type(
&mut self,
opaque_ty_node_id: NodeId,
opaque_ty_item: OpaqueTy<'hir>,
span: Span,
opaque_ty_span: Span
) -> HirId[src]
&mut self,
opaque_ty_node_id: NodeId,
opaque_ty_item: OpaqueTy<'hir>,
span: Span,
opaque_ty_span: Span
) -> HirId
Registers a new opaque type with the proper NodeIds and
returns the lowered node-ID for the opaque type.
pub(crate) fn lifetimes_from_impl_trait_bounds(
&mut self,
opaque_ty_id: NodeId,
parent_def_id: LocalDefId,
bounds: GenericBounds<'hir>,
lifetimes_to_include: Option<&FxHashSet<LifetimeName>>
) -> (&'hir [GenericArg<'hir>], &'hir [GenericParam<'hir>])[src]
&mut self,
opaque_ty_id: NodeId,
parent_def_id: LocalDefId,
bounds: GenericBounds<'hir>,
lifetimes_to_include: Option<&FxHashSet<LifetimeName>>
) -> (&'hir [GenericArg<'hir>], &'hir [GenericParam<'hir>])
pub(crate) fn lower_local(
&mut self,
l: &Local
) -> (Local<'hir>, SmallVec<[NodeId; 1]>)[src]
&mut self,
l: &Local
) -> (Local<'hir>, SmallVec<[NodeId; 1]>)
pub(crate) fn lower_fn_params_to_names(
&mut self,
decl: &FnDecl
) -> &'hir [Ident][src]
&mut self,
decl: &FnDecl
) -> &'hir [Ident]
pub(crate) fn lower_fn_decl(
&mut self,
decl: &FnDecl,
in_band_ty_params: Option<(DefId, &mut Vec<GenericParam<'hir>>)>,
impl_trait_return_allow: bool,
make_ret_async: Option<NodeId>
) -> &'hir FnDecl<'hir>[src]
&mut self,
decl: &FnDecl,
in_band_ty_params: Option<(DefId, &mut Vec<GenericParam<'hir>>)>,
impl_trait_return_allow: bool,
make_ret_async: Option<NodeId>
) -> &'hir FnDecl<'hir>
pub(crate) fn lower_async_fn_ret_ty(
&mut self,
output: &FnRetTy,
fn_def_id: DefId,
opaque_ty_node_id: NodeId
) -> FnRetTy<'hir>[src]
&mut self,
output: &FnRetTy,
fn_def_id: DefId,
opaque_ty_node_id: NodeId
) -> FnRetTy<'hir>
pub(crate) fn lower_async_fn_output_type_to_future_bound(
&mut self,
output: &FnRetTy,
fn_def_id: DefId,
span: Span
) -> GenericBound<'hir>[src]
&mut self,
output: &FnRetTy,
fn_def_id: DefId,
span: Span
) -> GenericBound<'hir>
Transforms -> T into Future<Output = T>
pub(crate) fn lower_param_bound(
&mut self,
tpb: &GenericBound,
itctx: ImplTraitContext<'_, 'hir>
) -> GenericBound<'hir>[src]
&mut self,
tpb: &GenericBound,
itctx: ImplTraitContext<'_, 'hir>
) -> GenericBound<'hir>
pub(crate) fn lower_lifetime(&mut self, l: &Lifetime) -> Lifetime[src]
pub(crate) fn new_named_lifetime(
&mut self,
id: NodeId,
span: Span,
name: LifetimeName
) -> Lifetime[src]
&mut self,
id: NodeId,
span: Span,
name: LifetimeName
) -> Lifetime
pub(crate) fn lower_generic_params_mut<'s>(
&'s mut self,
params: &'s [GenericParam],
add_bounds: &'s NodeMap<Vec<GenericBound>>,
itctx: ImplTraitContext<'s, 'hir>
) -> impl Iterator<Item = GenericParam<'hir>> + Captures<'a> + Captures<'s>[src]
&'s mut self,
params: &'s [GenericParam],
add_bounds: &'s NodeMap<Vec<GenericBound>>,
itctx: ImplTraitContext<'s, 'hir>
) -> impl Iterator<Item = GenericParam<'hir>> + Captures<'a> + Captures<'s>
pub(crate) fn lower_generic_params(
&mut self,
params: &[GenericParam],
add_bounds: &NodeMap<Vec<GenericBound>>,
itctx: ImplTraitContext<'_, 'hir>
) -> &'hir [GenericParam<'hir>][src]
&mut self,
params: &[GenericParam],
add_bounds: &NodeMap<Vec<GenericBound>>,
itctx: ImplTraitContext<'_, 'hir>
) -> &'hir [GenericParam<'hir>]
pub(crate) fn lower_generic_param(
&mut self,
param: &GenericParam,
add_bounds: &NodeMap<Vec<GenericBound>>,
itctx: ImplTraitContext<'_, 'hir>
) -> GenericParam<'hir>[src]
&mut self,
param: &GenericParam,
add_bounds: &NodeMap<Vec<GenericBound>>,
itctx: ImplTraitContext<'_, 'hir>
) -> GenericParam<'hir>
pub(crate) fn lower_trait_ref(
&mut self,
p: &TraitRef,
itctx: ImplTraitContext<'_, 'hir>
) -> TraitRef<'hir>[src]
&mut self,
p: &TraitRef,
itctx: ImplTraitContext<'_, 'hir>
) -> TraitRef<'hir>
pub(crate) fn lower_poly_trait_ref(
&mut self,
p: &PolyTraitRef,
itctx: ImplTraitContext<'_, 'hir>
) -> PolyTraitRef<'hir>[src]
&mut self,
p: &PolyTraitRef,
itctx: ImplTraitContext<'_, 'hir>
) -> PolyTraitRef<'hir>
pub(crate) fn lower_mt(
&mut self,
mt: &MutTy,
itctx: ImplTraitContext<'_, 'hir>
) -> MutTy<'hir>[src]
&mut self,
mt: &MutTy,
itctx: ImplTraitContext<'_, 'hir>
) -> MutTy<'hir>
pub(crate) fn lower_param_bounds(
&mut self,
bounds: &[GenericBound],
itctx: ImplTraitContext<'_, 'hir>
) -> GenericBounds<'hir>[src]
&mut self,
bounds: &[GenericBound],
itctx: ImplTraitContext<'_, 'hir>
) -> GenericBounds<'hir>
pub(crate) fn lower_param_bounds_mut<'s>(
&'s mut self,
bounds: &'s [GenericBound],
itctx: ImplTraitContext<'s, 'hir>
) -> impl Iterator<Item = GenericBound<'hir>> + Captures<'s> + Captures<'a>[src]
&'s mut self,
bounds: &'s [GenericBound],
itctx: ImplTraitContext<'s, 'hir>
) -> impl Iterator<Item = GenericBound<'hir>> + Captures<'s> + Captures<'a>
pub(crate) fn lower_block(
&mut self,
b: &Block,
targeted_by_break: bool
) -> &'hir Block<'hir>[src]
&mut self,
b: &Block,
targeted_by_break: bool
) -> &'hir Block<'hir>
pub(crate) fn lower_block_noalloc(
&mut self,
b: &Block,
targeted_by_break: bool
) -> Block<'hir>[src]
&mut self,
b: &Block,
targeted_by_break: bool
) -> Block<'hir>
pub(crate) fn lower_block_expr(&mut self, b: &Block) -> Expr<'hir>[src]
Lowers a block directly to an expression, presuming that it
has no attributes and is not targeted by a break.
pub(crate) fn lower_anon_const(&mut self, c: &AnonConst) -> AnonConst[src]
pub(crate) fn lower_stmt(&mut self, s: &Stmt) -> SmallVec<[Stmt<'hir>; 1]>[src]
pub(crate) fn lower_block_check_mode(
&mut self,
b: &BlockCheckMode
) -> BlockCheckMode[src]
&mut self,
b: &BlockCheckMode
) -> BlockCheckMode
pub(crate) fn lower_unsafe_source(&mut self, u: UnsafeSource) -> UnsafeSource[src]
pub(crate) fn lower_trait_bound_modifier(
&mut self,
f: TraitBoundModifier
) -> TraitBoundModifier[src]
&mut self,
f: TraitBoundModifier
) -> TraitBoundModifier
pub(crate) fn stmt(&mut self, span: Span, kind: StmtKind<'hir>) -> Stmt<'hir>[src]
pub(crate) fn stmt_expr(&mut self, span: Span, expr: Expr<'hir>) -> Stmt<'hir>[src]
pub(crate) fn stmt_let_pat(
&mut self,
attrs: AttrVec,
span: Span,
init: Option<&'hir Expr<'hir>>,
pat: &'hir Pat<'hir>,
source: LocalSource
) -> Stmt<'hir>[src]
&mut self,
attrs: AttrVec,
span: Span,
init: Option<&'hir Expr<'hir>>,
pat: &'hir Pat<'hir>,
source: LocalSource
) -> Stmt<'hir>
pub(crate) fn block_expr(&mut self, expr: &'hir Expr<'hir>) -> &'hir Block<'hir>[src]
pub(crate) fn block_all(
&mut self,
span: Span,
stmts: &'hir [Stmt<'hir>],
expr: Option<&'hir Expr<'hir>>
) -> &'hir Block<'hir>[src]
&mut self,
span: Span,
stmts: &'hir [Stmt<'hir>],
expr: Option<&'hir Expr<'hir>>
) -> &'hir Block<'hir>
pub(crate) fn pat_bool(&mut self, span: Span, val: bool) -> &'hir Pat<'hir>[src]
Constructs a true or false literal pattern.
pub(crate) fn pat_ok(
&mut self,
span: Span,
pat: &'hir Pat<'hir>
) -> &'hir Pat<'hir>[src]
&mut self,
span: Span,
pat: &'hir Pat<'hir>
) -> &'hir Pat<'hir>
pub(crate) fn pat_err(
&mut self,
span: Span,
pat: &'hir Pat<'hir>
) -> &'hir Pat<'hir>[src]
&mut self,
span: Span,
pat: &'hir Pat<'hir>
) -> &'hir Pat<'hir>
pub(crate) fn pat_some(
&mut self,
span: Span,
pat: &'hir Pat<'hir>
) -> &'hir Pat<'hir>[src]
&mut self,
span: Span,
pat: &'hir Pat<'hir>
) -> &'hir Pat<'hir>
pub(crate) fn pat_none(&mut self, span: Span) -> &'hir Pat<'hir>[src]
pub(crate) fn single_pat_field(
&mut self,
span: Span,
pat: &'hir Pat<'hir>
) -> &'hir [FieldPat<'hir>][src]
&mut self,
span: Span,
pat: &'hir Pat<'hir>
) -> &'hir [FieldPat<'hir>]
pub(crate) fn pat_lang_item_variant(
&mut self,
span: Span,
lang_item: LangItem,
fields: &'hir [FieldPat<'hir>]
) -> &'hir Pat<'hir>[src]
&mut self,
span: Span,
lang_item: LangItem,
fields: &'hir [FieldPat<'hir>]
) -> &'hir Pat<'hir>
pub(crate) fn pat_ident(
&mut self,
span: Span,
ident: Ident
) -> (&'hir Pat<'hir>, HirId)[src]
&mut self,
span: Span,
ident: Ident
) -> (&'hir Pat<'hir>, HirId)
pub(crate) fn pat_ident_binding_mode(
&mut self,
span: Span,
ident: Ident,
bm: BindingAnnotation
) -> (&'hir Pat<'hir>, HirId)[src]
&mut self,
span: Span,
ident: Ident,
bm: BindingAnnotation
) -> (&'hir Pat<'hir>, HirId)
pub(crate) fn pat_wild(&mut self, span: Span) -> &'hir Pat<'hir>[src]
pub(crate) fn pat(&mut self, span: Span, kind: PatKind<'hir>) -> &'hir Pat<'hir>[src]
pub(crate) fn pat_without_dbm(
&mut self,
span: Span,
kind: PatKind<'hir>
) -> &'hir Pat<'hir>[src]
&mut self,
span: Span,
kind: PatKind<'hir>
) -> &'hir Pat<'hir>
pub(crate) fn ty_path(
&mut self,
hir_id: HirId,
span: Span,
qpath: QPath<'hir>
) -> Ty<'hir>[src]
&mut self,
hir_id: HirId,
span: Span,
qpath: QPath<'hir>
) -> Ty<'hir>
pub(crate) fn elided_ref_lifetime(&mut self, span: Span) -> Lifetime[src]
Invoked to create the lifetime argument for a type &T
with no explicit lifetime.
pub(crate) fn new_error_lifetime(
&mut self,
id: Option<NodeId>,
span: Span
) -> Lifetime[src]
&mut self,
id: Option<NodeId>,
span: Span
) -> Lifetime
Report an error on illegal use of '_ or a &T with no explicit lifetime;
return a "error lifetime".
pub(crate) fn elided_path_lifetimes<'s>(
&'s mut self,
span: Span,
count: usize
) -> impl Iterator<Item = Lifetime> + Captures<'a> + Captures<'s> + Captures<'hir>[src]
&'s mut self,
span: Span,
count: usize
) -> impl Iterator<Item = Lifetime> + Captures<'a> + Captures<'s> + Captures<'hir>
Invoked to create the lifetime argument(s) for a path like
std::cell::Ref<T>; note that implicit lifetimes in these
sorts of cases are deprecated. This may therefore report a warning or an
error, depending on the mode.
pub(crate) fn elided_path_lifetime(&mut self, span: Span) -> Lifetime[src]
pub(crate) fn elided_dyn_bound(&mut self, span: Span) -> Lifetime[src]
Invoked to create the lifetime argument(s) for an elided trait object
bound, like the bound in Box<dyn Debug>. This method is not invoked
when the bound is written, even if it is written with '_ like in
Box<dyn Debug + '_>. In those cases, lower_lifetime is invoked.
pub(crate) fn new_implicit_lifetime(&mut self, span: Span) -> Lifetime[src]
pub(crate) fn maybe_lint_bare_trait(
&mut self,
span: Span,
id: NodeId,
is_global: bool
)[src]
&mut self,
span: Span,
id: NodeId,
is_global: bool
)
Auto Trait Implementations
impl<'a, 'hir> !RefUnwindSafe for LoweringContext<'a, 'hir>
impl<'a, 'hir> !Send for LoweringContext<'a, 'hir>
impl<'a, 'hir> !Sync for LoweringContext<'a, 'hir>
impl<'a, 'hir> Unpin for LoweringContext<'a, 'hir>
impl<'a, 'hir> !UnwindSafe for LoweringContext<'a, 'hir>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<'a, T> Captures<'a> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,