Don't use RibKind::*
This commit is contained in:
parent
4b87ed9d0f
commit
6197e4d209
2 changed files with 106 additions and 103 deletions
|
@ -24,7 +24,6 @@ use crate::{ResolutionError, Resolver, Scope, ScopeSet, Segment, ToNameBinding,
|
||||||
|
|
||||||
use Determinacy::*;
|
use Determinacy::*;
|
||||||
use Namespace::*;
|
use Namespace::*;
|
||||||
use RibKind::*;
|
|
||||||
|
|
||||||
type Visibility = ty::Visibility<LocalDefId>;
|
type Visibility = ty::Visibility<LocalDefId>;
|
||||||
|
|
||||||
|
@ -324,8 +323,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
module = match ribs[i].kind {
|
module = match ribs[i].kind {
|
||||||
ModuleRibKind(module) => module,
|
RibKind::ModuleRibKind(module) => module,
|
||||||
MacroDefinition(def) if def == self.macro_def(ident.span.ctxt()) => {
|
RibKind::MacroDefinition(def) if def == self.macro_def(ident.span.ctxt()) => {
|
||||||
// If an invocation of this macro created `ident`, give up on `ident`
|
// If an invocation of this macro created `ident`, give up on `ident`
|
||||||
// and switch to `ident`'s source from the macro definition.
|
// and switch to `ident`'s source from the macro definition.
|
||||||
ident.span.remove_mark();
|
ident.span.remove_mark();
|
||||||
|
@ -1084,7 +1083,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||||
let ribs = &all_ribs[rib_index + 1..];
|
let ribs = &all_ribs[rib_index + 1..];
|
||||||
|
|
||||||
// An invalid forward use of a generic parameter from a previous default.
|
// An invalid forward use of a generic parameter from a previous default.
|
||||||
if let ForwardGenericParamBanRibKind = all_ribs[rib_index].kind {
|
if let RibKind::ForwardGenericParamBanRibKind = all_ribs[rib_index].kind {
|
||||||
if let Some(span) = finalize {
|
if let Some(span) = finalize {
|
||||||
let res_error = if rib_ident.name == kw::SelfUpper {
|
let res_error = if rib_ident.name == kw::SelfUpper {
|
||||||
ResolutionError::SelfInGenericParamDefault
|
ResolutionError::SelfInGenericParamDefault
|
||||||
|
@ -1104,14 +1103,14 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||||
|
|
||||||
for rib in ribs {
|
for rib in ribs {
|
||||||
match rib.kind {
|
match rib.kind {
|
||||||
NormalRibKind
|
RibKind::NormalRibKind
|
||||||
| ClosureOrAsyncRibKind
|
| RibKind::ClosureOrAsyncRibKind
|
||||||
| ModuleRibKind(..)
|
| RibKind::ModuleRibKind(..)
|
||||||
| MacroDefinition(..)
|
| RibKind::MacroDefinition(..)
|
||||||
| ForwardGenericParamBanRibKind => {
|
| RibKind::ForwardGenericParamBanRibKind => {
|
||||||
// Nothing to do. Continue.
|
// Nothing to do. Continue.
|
||||||
}
|
}
|
||||||
ItemRibKind(_) | AssocItemRibKind => {
|
RibKind::ItemRibKind(_) | RibKind::AssocItemRibKind => {
|
||||||
// This was an attempt to access an upvar inside a
|
// This was an attempt to access an upvar inside a
|
||||||
// named function item. This is not allowed, so we
|
// named function item. This is not allowed, so we
|
||||||
// report an error.
|
// report an error.
|
||||||
|
@ -1123,7 +1122,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||||
res_err = Some((span, CannotCaptureDynamicEnvironmentInFnItem));
|
res_err = Some((span, CannotCaptureDynamicEnvironmentInFnItem));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ConstantItemRibKind(_, item) => {
|
RibKind::ConstantItemRibKind(_, item) => {
|
||||||
// Still doesn't deal with upvars
|
// Still doesn't deal with upvars
|
||||||
if let Some(span) = finalize {
|
if let Some(span) = finalize {
|
||||||
let (span, resolution_error) =
|
let (span, resolution_error) =
|
||||||
|
@ -1152,13 +1151,13 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
return Res::Err;
|
return Res::Err;
|
||||||
}
|
}
|
||||||
ConstParamTyRibKind => {
|
RibKind::ConstParamTyRibKind => {
|
||||||
if let Some(span) = finalize {
|
if let Some(span) = finalize {
|
||||||
self.report_error(span, ParamInTyOfConstParam(rib_ident.name));
|
self.report_error(span, ParamInTyOfConstParam(rib_ident.name));
|
||||||
}
|
}
|
||||||
return Res::Err;
|
return Res::Err;
|
||||||
}
|
}
|
||||||
InlineAsmSymRibKind => {
|
RibKind::InlineAsmSymRibKind => {
|
||||||
if let Some(span) = finalize {
|
if let Some(span) = finalize {
|
||||||
self.report_error(span, InvalidAsmSym);
|
self.report_error(span, InvalidAsmSym);
|
||||||
}
|
}
|
||||||
|
@ -1174,18 +1173,18 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||||
Res::Def(DefKind::TyParam, _) | Res::SelfTyParam { .. } | Res::SelfTyAlias { .. } => {
|
Res::Def(DefKind::TyParam, _) | Res::SelfTyParam { .. } | Res::SelfTyAlias { .. } => {
|
||||||
for rib in ribs {
|
for rib in ribs {
|
||||||
let has_generic_params: HasGenericParams = match rib.kind {
|
let has_generic_params: HasGenericParams = match rib.kind {
|
||||||
NormalRibKind
|
RibKind::NormalRibKind
|
||||||
| ClosureOrAsyncRibKind
|
| RibKind::ClosureOrAsyncRibKind
|
||||||
| ModuleRibKind(..)
|
| RibKind::ModuleRibKind(..)
|
||||||
| MacroDefinition(..)
|
| RibKind::MacroDefinition(..)
|
||||||
| InlineAsmSymRibKind
|
| RibKind::InlineAsmSymRibKind
|
||||||
| AssocItemRibKind
|
| RibKind::AssocItemRibKind
|
||||||
| ForwardGenericParamBanRibKind => {
|
| RibKind::ForwardGenericParamBanRibKind => {
|
||||||
// Nothing to do. Continue.
|
// Nothing to do. Continue.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConstantItemRibKind(trivial, _) => {
|
RibKind::ConstantItemRibKind(trivial, _) => {
|
||||||
let features = self.tcx.sess.features_untracked();
|
let features = self.tcx.sess.features_untracked();
|
||||||
// HACK(min_const_generics): We currently only allow `N` or `{ N }`.
|
// HACK(min_const_generics): We currently only allow `N` or `{ N }`.
|
||||||
if !(trivial == ConstantHasGenerics::Yes
|
if !(trivial == ConstantHasGenerics::Yes
|
||||||
|
@ -1226,8 +1225,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// This was an attempt to use a type parameter outside its scope.
|
// This was an attempt to use a type parameter outside its scope.
|
||||||
ItemRibKind(has_generic_params) => has_generic_params,
|
RibKind::ItemRibKind(has_generic_params) => has_generic_params,
|
||||||
ConstParamTyRibKind => {
|
RibKind::ConstParamTyRibKind => {
|
||||||
if let Some(span) = finalize {
|
if let Some(span) = finalize {
|
||||||
self.report_error(
|
self.report_error(
|
||||||
span,
|
span,
|
||||||
|
@ -1253,15 +1252,15 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||||
Res::Def(DefKind::ConstParam, _) => {
|
Res::Def(DefKind::ConstParam, _) => {
|
||||||
for rib in ribs {
|
for rib in ribs {
|
||||||
let has_generic_params = match rib.kind {
|
let has_generic_params = match rib.kind {
|
||||||
NormalRibKind
|
RibKind::NormalRibKind
|
||||||
| ClosureOrAsyncRibKind
|
| RibKind::ClosureOrAsyncRibKind
|
||||||
| ModuleRibKind(..)
|
| RibKind::ModuleRibKind(..)
|
||||||
| MacroDefinition(..)
|
| RibKind::MacroDefinition(..)
|
||||||
| InlineAsmSymRibKind
|
| RibKind::InlineAsmSymRibKind
|
||||||
| AssocItemRibKind
|
| RibKind::AssocItemRibKind
|
||||||
| ForwardGenericParamBanRibKind => continue,
|
| RibKind::ForwardGenericParamBanRibKind => continue,
|
||||||
|
|
||||||
ConstantItemRibKind(trivial, _) => {
|
RibKind::ConstantItemRibKind(trivial, _) => {
|
||||||
let features = self.tcx.sess.features_untracked();
|
let features = self.tcx.sess.features_untracked();
|
||||||
// HACK(min_const_generics): We currently only allow `N` or `{ N }`.
|
// HACK(min_const_generics): We currently only allow `N` or `{ N }`.
|
||||||
if !(trivial == ConstantHasGenerics::Yes
|
if !(trivial == ConstantHasGenerics::Yes
|
||||||
|
@ -1284,8 +1283,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemRibKind(has_generic_params) => has_generic_params,
|
RibKind::ItemRibKind(has_generic_params) => has_generic_params,
|
||||||
ConstParamTyRibKind => {
|
RibKind::ConstParamTyRibKind => {
|
||||||
if let Some(span) = finalize {
|
if let Some(span) = finalize {
|
||||||
self.report_error(
|
self.report_error(
|
||||||
span,
|
span,
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
//! If you wonder why there's no `early.rs`, that's because it's split into three files -
|
//! If you wonder why there's no `early.rs`, that's because it's split into three files -
|
||||||
//! `build_reduced_graph.rs`, `macros.rs` and `imports.rs`.
|
//! `build_reduced_graph.rs`, `macros.rs` and `imports.rs`.
|
||||||
|
|
||||||
use RibKind::*;
|
|
||||||
|
|
||||||
use crate::{path_names_to_string, rustdoc, BindingError, Finalize, LexicalScopeBinding};
|
use crate::{path_names_to_string, rustdoc, BindingError, Finalize, LexicalScopeBinding};
|
||||||
use crate::{Module, ModuleOrUniformRoot, NameBinding, ParentScope, PathResult};
|
use crate::{Module, ModuleOrUniformRoot, NameBinding, ParentScope, PathResult};
|
||||||
use crate::{ResolutionError, Resolver, Segment, UseError};
|
use crate::{ResolutionError, Resolver, Segment, UseError};
|
||||||
|
@ -178,30 +176,32 @@ impl RibKind<'_> {
|
||||||
/// variables.
|
/// variables.
|
||||||
pub(crate) fn contains_params(&self) -> bool {
|
pub(crate) fn contains_params(&self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
NormalRibKind
|
RibKind::NormalRibKind
|
||||||
| ClosureOrAsyncRibKind
|
| RibKind::ClosureOrAsyncRibKind
|
||||||
| ConstantItemRibKind(..)
|
| RibKind::ConstantItemRibKind(..)
|
||||||
| ModuleRibKind(_)
|
| RibKind::ModuleRibKind(_)
|
||||||
| MacroDefinition(_)
|
| RibKind::MacroDefinition(_)
|
||||||
| ConstParamTyRibKind
|
| RibKind::ConstParamTyRibKind
|
||||||
| InlineAsmSymRibKind => false,
|
| RibKind::InlineAsmSymRibKind => false,
|
||||||
AssocItemRibKind | ItemRibKind(_) | ForwardGenericParamBanRibKind => true,
|
RibKind::AssocItemRibKind
|
||||||
|
| RibKind::ItemRibKind(_)
|
||||||
|
| RibKind::ForwardGenericParamBanRibKind => true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This rib forbids referring to labels defined in upwards ribs.
|
/// This rib forbids referring to labels defined in upwards ribs.
|
||||||
fn is_label_barrier(self) -> bool {
|
fn is_label_barrier(self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
NormalRibKind | MacroDefinition(..) => false,
|
RibKind::NormalRibKind | RibKind::MacroDefinition(..) => false,
|
||||||
|
|
||||||
AssocItemRibKind
|
RibKind::AssocItemRibKind
|
||||||
| ClosureOrAsyncRibKind
|
| RibKind::ClosureOrAsyncRibKind
|
||||||
| ItemRibKind(..)
|
| RibKind::ItemRibKind(..)
|
||||||
| ConstantItemRibKind(..)
|
| RibKind::ConstantItemRibKind(..)
|
||||||
| ModuleRibKind(..)
|
| RibKind::ModuleRibKind(..)
|
||||||
| ForwardGenericParamBanRibKind
|
| RibKind::ForwardGenericParamBanRibKind
|
||||||
| ConstParamTyRibKind
|
| RibKind::ConstParamTyRibKind
|
||||||
| InlineAsmSymRibKind => true,
|
| RibKind::InlineAsmSymRibKind => true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -705,7 +705,7 @@ impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast,
|
||||||
let span = ty.span.shrink_to_lo().to(path.span.shrink_to_lo());
|
let span = ty.span.shrink_to_lo().to(path.span.shrink_to_lo());
|
||||||
self.with_generic_param_rib(
|
self.with_generic_param_rib(
|
||||||
&[],
|
&[],
|
||||||
NormalRibKind,
|
RibKind::NormalRibKind,
|
||||||
LifetimeRibKind::Generics {
|
LifetimeRibKind::Generics {
|
||||||
binder: ty.id,
|
binder: ty.id,
|
||||||
kind: LifetimeBinderKind::PolyTrait,
|
kind: LifetimeBinderKind::PolyTrait,
|
||||||
|
@ -743,7 +743,7 @@ impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast,
|
||||||
let span = ty.span.shrink_to_lo().to(bare_fn.decl_span.shrink_to_lo());
|
let span = ty.span.shrink_to_lo().to(bare_fn.decl_span.shrink_to_lo());
|
||||||
self.with_generic_param_rib(
|
self.with_generic_param_rib(
|
||||||
&bare_fn.generic_params,
|
&bare_fn.generic_params,
|
||||||
NormalRibKind,
|
RibKind::NormalRibKind,
|
||||||
LifetimeRibKind::Generics {
|
LifetimeRibKind::Generics {
|
||||||
binder: ty.id,
|
binder: ty.id,
|
||||||
kind: LifetimeBinderKind::BareFnType,
|
kind: LifetimeBinderKind::BareFnType,
|
||||||
|
@ -783,7 +783,7 @@ impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast,
|
||||||
let span = tref.span.shrink_to_lo().to(tref.trait_ref.path.span.shrink_to_lo());
|
let span = tref.span.shrink_to_lo().to(tref.trait_ref.path.span.shrink_to_lo());
|
||||||
self.with_generic_param_rib(
|
self.with_generic_param_rib(
|
||||||
&tref.bound_generic_params,
|
&tref.bound_generic_params,
|
||||||
NormalRibKind,
|
RibKind::NormalRibKind,
|
||||||
LifetimeRibKind::Generics {
|
LifetimeRibKind::Generics {
|
||||||
binder: tref.trait_ref.ref_id,
|
binder: tref.trait_ref.ref_id,
|
||||||
kind: LifetimeBinderKind::PolyTrait,
|
kind: LifetimeBinderKind::PolyTrait,
|
||||||
|
@ -807,7 +807,7 @@ impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast,
|
||||||
ForeignItemKind::TyAlias(box TyAlias { ref generics, .. }) => {
|
ForeignItemKind::TyAlias(box TyAlias { ref generics, .. }) => {
|
||||||
self.with_generic_param_rib(
|
self.with_generic_param_rib(
|
||||||
&generics.params,
|
&generics.params,
|
||||||
ItemRibKind(HasGenericParams::Yes(generics.span)),
|
RibKind::ItemRibKind(HasGenericParams::Yes(generics.span)),
|
||||||
LifetimeRibKind::Generics {
|
LifetimeRibKind::Generics {
|
||||||
binder: foreign_item.id,
|
binder: foreign_item.id,
|
||||||
kind: LifetimeBinderKind::Item,
|
kind: LifetimeBinderKind::Item,
|
||||||
|
@ -819,7 +819,7 @@ impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast,
|
||||||
ForeignItemKind::Fn(box Fn { ref generics, .. }) => {
|
ForeignItemKind::Fn(box Fn { ref generics, .. }) => {
|
||||||
self.with_generic_param_rib(
|
self.with_generic_param_rib(
|
||||||
&generics.params,
|
&generics.params,
|
||||||
ItemRibKind(HasGenericParams::Yes(generics.span)),
|
RibKind::ItemRibKind(HasGenericParams::Yes(generics.span)),
|
||||||
LifetimeRibKind::Generics {
|
LifetimeRibKind::Generics {
|
||||||
binder: foreign_item.id,
|
binder: foreign_item.id,
|
||||||
kind: LifetimeBinderKind::Function,
|
kind: LifetimeBinderKind::Function,
|
||||||
|
@ -873,9 +873,9 @@ impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast,
|
||||||
debug!("(resolving function) entering function");
|
debug!("(resolving function) entering function");
|
||||||
|
|
||||||
// Create a value rib for the function.
|
// Create a value rib for the function.
|
||||||
self.with_rib(ValueNS, ClosureOrAsyncRibKind, |this| {
|
self.with_rib(ValueNS, RibKind::ClosureOrAsyncRibKind, |this| {
|
||||||
// Create a label rib for the function.
|
// Create a label rib for the function.
|
||||||
this.with_label_rib(ClosureOrAsyncRibKind, |this| {
|
this.with_label_rib(RibKind::ClosureOrAsyncRibKind, |this| {
|
||||||
match fn_kind {
|
match fn_kind {
|
||||||
FnKind::Fn(_, _, sig, _, generics, body) => {
|
FnKind::Fn(_, _, sig, _, generics, body) => {
|
||||||
this.visit_generics(generics);
|
this.visit_generics(generics);
|
||||||
|
@ -1132,7 +1132,7 @@ impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast,
|
||||||
let span = predicate_span.shrink_to_lo().to(bounded_ty.span.shrink_to_lo());
|
let span = predicate_span.shrink_to_lo().to(bounded_ty.span.shrink_to_lo());
|
||||||
this.with_generic_param_rib(
|
this.with_generic_param_rib(
|
||||||
&bound_generic_params,
|
&bound_generic_params,
|
||||||
NormalRibKind,
|
RibKind::NormalRibKind,
|
||||||
LifetimeRibKind::Generics {
|
LifetimeRibKind::Generics {
|
||||||
binder: bounded_ty.id,
|
binder: bounded_ty.id,
|
||||||
kind: LifetimeBinderKind::WhereBound,
|
kind: LifetimeBinderKind::WhereBound,
|
||||||
|
@ -1178,9 +1178,9 @@ impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast,
|
||||||
|
|
||||||
fn visit_inline_asm_sym(&mut self, sym: &'ast InlineAsmSym) {
|
fn visit_inline_asm_sym(&mut self, sym: &'ast InlineAsmSym) {
|
||||||
// This is similar to the code for AnonConst.
|
// This is similar to the code for AnonConst.
|
||||||
self.with_rib(ValueNS, InlineAsmSymRibKind, |this| {
|
self.with_rib(ValueNS, RibKind::InlineAsmSymRibKind, |this| {
|
||||||
this.with_rib(TypeNS, InlineAsmSymRibKind, |this| {
|
this.with_rib(TypeNS, RibKind::InlineAsmSymRibKind, |this| {
|
||||||
this.with_label_rib(InlineAsmSymRibKind, |this| {
|
this.with_label_rib(RibKind::InlineAsmSymRibKind, |this| {
|
||||||
this.smart_resolve_path(sym.id, &sym.qself, &sym.path, PathSource::Expr(None));
|
this.smart_resolve_path(sym.id, &sym.qself, &sym.path, PathSource::Expr(None));
|
||||||
visit::walk_inline_asm_sym(this, sym);
|
visit::walk_inline_asm_sym(this, sym);
|
||||||
});
|
});
|
||||||
|
@ -1205,7 +1205,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||||
// although it may be useful to track other components as well for diagnostics.
|
// although it may be useful to track other components as well for diagnostics.
|
||||||
let graph_root = resolver.graph_root;
|
let graph_root = resolver.graph_root;
|
||||||
let parent_scope = ParentScope::module(graph_root, resolver);
|
let parent_scope = ParentScope::module(graph_root, resolver);
|
||||||
let start_rib_kind = ModuleRibKind(graph_root);
|
let start_rib_kind = RibKind::ModuleRibKind(graph_root);
|
||||||
LateResolutionVisitor {
|
LateResolutionVisitor {
|
||||||
r: resolver,
|
r: resolver,
|
||||||
parent_scope,
|
parent_scope,
|
||||||
|
@ -1309,8 +1309,8 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||||
if let Some(module) = self.r.get_module(self.r.local_def_id(id).to_def_id()) {
|
if let Some(module) = self.r.get_module(self.r.local_def_id(id).to_def_id()) {
|
||||||
// Move down in the graph.
|
// Move down in the graph.
|
||||||
let orig_module = replace(&mut self.parent_scope.module, module);
|
let orig_module = replace(&mut self.parent_scope.module, module);
|
||||||
self.with_rib(ValueNS, ModuleRibKind(module), |this| {
|
self.with_rib(ValueNS, RibKind::ModuleRibKind(module), |this| {
|
||||||
this.with_rib(TypeNS, ModuleRibKind(module), |this| {
|
this.with_rib(TypeNS, RibKind::ModuleRibKind(module), |this| {
|
||||||
let ret = f(this);
|
let ret = f(this);
|
||||||
this.parent_scope.module = orig_module;
|
this.parent_scope.module = orig_module;
|
||||||
ret
|
ret
|
||||||
|
@ -1327,8 +1327,8 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||||
// provide previous type parameters as they're built. We
|
// provide previous type parameters as they're built. We
|
||||||
// put all the parameters on the ban list and then remove
|
// put all the parameters on the ban list and then remove
|
||||||
// them one by one as they are processed and become available.
|
// them one by one as they are processed and become available.
|
||||||
let mut forward_ty_ban_rib = Rib::new(ForwardGenericParamBanRibKind);
|
let mut forward_ty_ban_rib = Rib::new(RibKind::ForwardGenericParamBanRibKind);
|
||||||
let mut forward_const_ban_rib = Rib::new(ForwardGenericParamBanRibKind);
|
let mut forward_const_ban_rib = Rib::new(RibKind::ForwardGenericParamBanRibKind);
|
||||||
for param in params.iter() {
|
for param in params.iter() {
|
||||||
match param.kind {
|
match param.kind {
|
||||||
GenericParamKind::Type { .. } => {
|
GenericParamKind::Type { .. } => {
|
||||||
|
@ -1389,8 +1389,8 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||||
// Const parameters can't have param bounds.
|
// Const parameters can't have param bounds.
|
||||||
assert!(param.bounds.is_empty());
|
assert!(param.bounds.is_empty());
|
||||||
|
|
||||||
this.ribs[TypeNS].push(Rib::new(ConstParamTyRibKind));
|
this.ribs[TypeNS].push(Rib::new(RibKind::ConstParamTyRibKind));
|
||||||
this.ribs[ValueNS].push(Rib::new(ConstParamTyRibKind));
|
this.ribs[ValueNS].push(Rib::new(RibKind::ConstParamTyRibKind));
|
||||||
this.with_lifetime_rib(LifetimeRibKind::ConstGeneric, |this| {
|
this.with_lifetime_rib(LifetimeRibKind::ConstGeneric, |this| {
|
||||||
this.visit_ty(ty)
|
this.visit_ty(ty)
|
||||||
});
|
});
|
||||||
|
@ -2112,7 +2112,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||||
for i in (0..self.label_ribs.len()).rev() {
|
for i in (0..self.label_ribs.len()).rev() {
|
||||||
let rib = &self.label_ribs[i];
|
let rib = &self.label_ribs[i];
|
||||||
|
|
||||||
if let MacroDefinition(def) = rib.kind {
|
if let RibKind::MacroDefinition(def) = rib.kind {
|
||||||
// If an invocation of this macro created `ident`, give up on `ident`
|
// If an invocation of this macro created `ident`, give up on `ident`
|
||||||
// and switch to `ident`'s source from the macro definition.
|
// and switch to `ident`'s source from the macro definition.
|
||||||
if def == self.r.macro_def(label.span.ctxt()) {
|
if def == self.r.macro_def(label.span.ctxt()) {
|
||||||
|
@ -2160,7 +2160,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||||
self.with_current_self_item(item, |this| {
|
self.with_current_self_item(item, |this| {
|
||||||
this.with_generic_param_rib(
|
this.with_generic_param_rib(
|
||||||
&generics.params,
|
&generics.params,
|
||||||
ItemRibKind(HasGenericParams::Yes(generics.span)),
|
RibKind::ItemRibKind(HasGenericParams::Yes(generics.span)),
|
||||||
LifetimeRibKind::Generics {
|
LifetimeRibKind::Generics {
|
||||||
binder: item.id,
|
binder: item.id,
|
||||||
kind: LifetimeBinderKind::Item,
|
kind: LifetimeBinderKind::Item,
|
||||||
|
@ -2241,7 +2241,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||||
ItemKind::TyAlias(box TyAlias { ref generics, .. }) => {
|
ItemKind::TyAlias(box TyAlias { ref generics, .. }) => {
|
||||||
self.with_generic_param_rib(
|
self.with_generic_param_rib(
|
||||||
&generics.params,
|
&generics.params,
|
||||||
ItemRibKind(HasGenericParams::Yes(generics.span)),
|
RibKind::ItemRibKind(HasGenericParams::Yes(generics.span)),
|
||||||
LifetimeRibKind::Generics {
|
LifetimeRibKind::Generics {
|
||||||
binder: item.id,
|
binder: item.id,
|
||||||
kind: LifetimeBinderKind::Item,
|
kind: LifetimeBinderKind::Item,
|
||||||
|
@ -2254,7 +2254,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||||
ItemKind::Fn(box Fn { ref generics, .. }) => {
|
ItemKind::Fn(box Fn { ref generics, .. }) => {
|
||||||
self.with_generic_param_rib(
|
self.with_generic_param_rib(
|
||||||
&generics.params,
|
&generics.params,
|
||||||
ItemRibKind(HasGenericParams::Yes(generics.span)),
|
RibKind::ItemRibKind(HasGenericParams::Yes(generics.span)),
|
||||||
LifetimeRibKind::Generics {
|
LifetimeRibKind::Generics {
|
||||||
binder: item.id,
|
binder: item.id,
|
||||||
kind: LifetimeBinderKind::Function,
|
kind: LifetimeBinderKind::Function,
|
||||||
|
@ -2293,7 +2293,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||||
// Create a new rib for the trait-wide type parameters.
|
// Create a new rib for the trait-wide type parameters.
|
||||||
self.with_generic_param_rib(
|
self.with_generic_param_rib(
|
||||||
&generics.params,
|
&generics.params,
|
||||||
ItemRibKind(HasGenericParams::Yes(generics.span)),
|
RibKind::ItemRibKind(HasGenericParams::Yes(generics.span)),
|
||||||
LifetimeRibKind::Generics {
|
LifetimeRibKind::Generics {
|
||||||
binder: item.id,
|
binder: item.id,
|
||||||
kind: LifetimeBinderKind::Item,
|
kind: LifetimeBinderKind::Item,
|
||||||
|
@ -2314,7 +2314,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||||
// Create a new rib for the trait-wide type parameters.
|
// Create a new rib for the trait-wide type parameters.
|
||||||
self.with_generic_param_rib(
|
self.with_generic_param_rib(
|
||||||
&generics.params,
|
&generics.params,
|
||||||
ItemRibKind(HasGenericParams::Yes(generics.span)),
|
RibKind::ItemRibKind(HasGenericParams::Yes(generics.span)),
|
||||||
LifetimeRibKind::Generics {
|
LifetimeRibKind::Generics {
|
||||||
binder: item.id,
|
binder: item.id,
|
||||||
kind: LifetimeBinderKind::Item,
|
kind: LifetimeBinderKind::Item,
|
||||||
|
@ -2417,11 +2417,11 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||||
let mut seen_lifetimes = FxHashSet::default();
|
let mut seen_lifetimes = FxHashSet::default();
|
||||||
|
|
||||||
// We also can't shadow bindings from the parent item
|
// We also can't shadow bindings from the parent item
|
||||||
if let AssocItemRibKind = kind {
|
if let RibKind::AssocItemRibKind = kind {
|
||||||
let mut add_bindings_for_ns = |ns| {
|
let mut add_bindings_for_ns = |ns| {
|
||||||
let parent_rib = self.ribs[ns]
|
let parent_rib = self.ribs[ns]
|
||||||
.iter()
|
.iter()
|
||||||
.rfind(|r| matches!(r.kind, ItemRibKind(_)))
|
.rfind(|r| matches!(r.kind, RibKind::ItemRibKind(_)))
|
||||||
.expect("associated item outside of an item");
|
.expect("associated item outside of an item");
|
||||||
seen_bindings.extend(parent_rib.bindings.keys().map(|ident| (*ident, ident.span)));
|
seen_bindings.extend(parent_rib.bindings.keys().map(|ident| (*ident, ident.span)));
|
||||||
};
|
};
|
||||||
|
@ -2510,8 +2510,10 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||||
};
|
};
|
||||||
|
|
||||||
let res = match kind {
|
let res = match kind {
|
||||||
ItemRibKind(..) | AssocItemRibKind => Res::Def(def_kind, def_id.to_def_id()),
|
RibKind::ItemRibKind(..) | RibKind::AssocItemRibKind => {
|
||||||
NormalRibKind => {
|
Res::Def(def_kind, def_id.to_def_id())
|
||||||
|
}
|
||||||
|
RibKind::NormalRibKind => {
|
||||||
if self.r.tcx.sess.features_untracked().non_lifetime_binders {
|
if self.r.tcx.sess.features_untracked().non_lifetime_binders {
|
||||||
Res::Def(def_kind, def_id.to_def_id())
|
Res::Def(def_kind, def_id.to_def_id())
|
||||||
} else {
|
} else {
|
||||||
|
@ -2557,7 +2559,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn with_static_rib(&mut self, f: impl FnOnce(&mut Self)) {
|
fn with_static_rib(&mut self, f: impl FnOnce(&mut Self)) {
|
||||||
let kind = ItemRibKind(HasGenericParams::No);
|
let kind = RibKind::ItemRibKind(HasGenericParams::No);
|
||||||
self.with_rib(ValueNS, kind, |this| this.with_rib(TypeNS, kind, f))
|
self.with_rib(ValueNS, kind, |this| this.with_rib(TypeNS, kind, f))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2577,15 +2579,15 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||||
item: Option<(Ident, ConstantItemKind)>,
|
item: Option<(Ident, ConstantItemKind)>,
|
||||||
f: impl FnOnce(&mut Self),
|
f: impl FnOnce(&mut Self),
|
||||||
) {
|
) {
|
||||||
self.with_rib(ValueNS, ConstantItemRibKind(may_use_generics, item), |this| {
|
self.with_rib(ValueNS, RibKind::ConstantItemRibKind(may_use_generics, item), |this| {
|
||||||
this.with_rib(
|
this.with_rib(
|
||||||
TypeNS,
|
TypeNS,
|
||||||
ConstantItemRibKind(
|
RibKind::ConstantItemRibKind(
|
||||||
may_use_generics.force_yes_if(is_repeat == IsRepeatExpr::Yes),
|
may_use_generics.force_yes_if(is_repeat == IsRepeatExpr::Yes),
|
||||||
item,
|
item,
|
||||||
),
|
),
|
||||||
|this| {
|
|this| {
|
||||||
this.with_label_rib(ConstantItemRibKind(may_use_generics, item), f);
|
this.with_label_rib(RibKind::ConstantItemRibKind(may_use_generics, item), f);
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
@ -2617,7 +2619,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||||
|this: &mut Self, generics: &Generics, kind, item: &'ast AssocItem| {
|
|this: &mut Self, generics: &Generics, kind, item: &'ast AssocItem| {
|
||||||
this.with_generic_param_rib(
|
this.with_generic_param_rib(
|
||||||
&generics.params,
|
&generics.params,
|
||||||
AssocItemRibKind,
|
RibKind::AssocItemRibKind,
|
||||||
LifetimeRibKind::Generics { binder: item.id, span: generics.span, kind },
|
LifetimeRibKind::Generics { binder: item.id, span: generics.span, kind },
|
||||||
|this| visit::walk_assoc_item(this, item, AssocCtxt::Trait),
|
|this| visit::walk_assoc_item(this, item, AssocCtxt::Trait),
|
||||||
);
|
);
|
||||||
|
@ -2698,7 +2700,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn with_self_rib_ns(&mut self, ns: Namespace, self_res: Res, f: impl FnOnce(&mut Self)) {
|
fn with_self_rib_ns(&mut self, ns: Namespace, self_res: Res, f: impl FnOnce(&mut Self)) {
|
||||||
let mut self_type_rib = Rib::new(NormalRibKind);
|
let mut self_type_rib = Rib::new(RibKind::NormalRibKind);
|
||||||
|
|
||||||
// Plain insert (no renaming, since types are not currently hygienic)
|
// Plain insert (no renaming, since types are not currently hygienic)
|
||||||
self_type_rib.bindings.insert(Ident::with_dummy_span(kw::SelfUpper), self_res);
|
self_type_rib.bindings.insert(Ident::with_dummy_span(kw::SelfUpper), self_res);
|
||||||
|
@ -2724,7 +2726,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||||
// If applicable, create a rib for the type parameters.
|
// If applicable, create a rib for the type parameters.
|
||||||
self.with_generic_param_rib(
|
self.with_generic_param_rib(
|
||||||
&generics.params,
|
&generics.params,
|
||||||
ItemRibKind(HasGenericParams::Yes(generics.span)),
|
RibKind::ItemRibKind(HasGenericParams::Yes(generics.span)),
|
||||||
LifetimeRibKind::Generics {
|
LifetimeRibKind::Generics {
|
||||||
span: generics.span,
|
span: generics.span,
|
||||||
binder: item_id,
|
binder: item_id,
|
||||||
|
@ -2838,7 +2840,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||||
// We also need a new scope for the impl item type parameters.
|
// We also need a new scope for the impl item type parameters.
|
||||||
self.with_generic_param_rib(
|
self.with_generic_param_rib(
|
||||||
&generics.params,
|
&generics.params,
|
||||||
AssocItemRibKind,
|
RibKind::AssocItemRibKind,
|
||||||
LifetimeRibKind::Generics {
|
LifetimeRibKind::Generics {
|
||||||
binder: item.id,
|
binder: item.id,
|
||||||
span: generics.span,
|
span: generics.span,
|
||||||
|
@ -2866,7 +2868,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||||
// We also need a new scope for the impl item type parameters.
|
// We also need a new scope for the impl item type parameters.
|
||||||
self.with_generic_param_rib(
|
self.with_generic_param_rib(
|
||||||
&generics.params,
|
&generics.params,
|
||||||
AssocItemRibKind,
|
RibKind::AssocItemRibKind,
|
||||||
LifetimeRibKind::Generics {
|
LifetimeRibKind::Generics {
|
||||||
binder: item.id,
|
binder: item.id,
|
||||||
span: generics.span,
|
span: generics.span,
|
||||||
|
@ -3138,7 +3140,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn resolve_arm(&mut self, arm: &'ast Arm) {
|
fn resolve_arm(&mut self, arm: &'ast Arm) {
|
||||||
self.with_rib(ValueNS, NormalRibKind, |this| {
|
self.with_rib(ValueNS, RibKind::NormalRibKind, |this| {
|
||||||
this.resolve_pattern_top(&arm.pat, PatternSource::Match);
|
this.resolve_pattern_top(&arm.pat, PatternSource::Match);
|
||||||
walk_list!(this, visit_expr, &arm.guard);
|
walk_list!(this, visit_expr, &arm.guard);
|
||||||
this.visit_expr(&arm.body);
|
this.visit_expr(&arm.body);
|
||||||
|
@ -3860,7 +3862,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||||
diagnostics::signal_label_shadowing(self.r.tcx.sess, orig_span, label.ident)
|
diagnostics::signal_label_shadowing(self.r.tcx.sess, orig_span, label.ident)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.with_label_rib(NormalRibKind, |this| {
|
self.with_label_rib(RibKind::NormalRibKind, |this| {
|
||||||
let ident = label.ident.normalize_to_macro_rules();
|
let ident = label.ident.normalize_to_macro_rules();
|
||||||
this.label_ribs.last_mut().unwrap().bindings.insert(ident, id);
|
this.label_ribs.last_mut().unwrap().bindings.insert(ident, id);
|
||||||
f(this);
|
f(this);
|
||||||
|
@ -3883,11 +3885,11 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||||
let mut num_macro_definition_ribs = 0;
|
let mut num_macro_definition_ribs = 0;
|
||||||
if let Some(anonymous_module) = anonymous_module {
|
if let Some(anonymous_module) = anonymous_module {
|
||||||
debug!("(resolving block) found anonymous module, moving down");
|
debug!("(resolving block) found anonymous module, moving down");
|
||||||
self.ribs[ValueNS].push(Rib::new(ModuleRibKind(anonymous_module)));
|
self.ribs[ValueNS].push(Rib::new(RibKind::ModuleRibKind(anonymous_module)));
|
||||||
self.ribs[TypeNS].push(Rib::new(ModuleRibKind(anonymous_module)));
|
self.ribs[TypeNS].push(Rib::new(RibKind::ModuleRibKind(anonymous_module)));
|
||||||
self.parent_scope.module = anonymous_module;
|
self.parent_scope.module = anonymous_module;
|
||||||
} else {
|
} else {
|
||||||
self.ribs[ValueNS].push(Rib::new(NormalRibKind));
|
self.ribs[ValueNS].push(Rib::new(RibKind::NormalRibKind));
|
||||||
}
|
}
|
||||||
|
|
||||||
let prev = self.diagnostic_metadata.current_block_could_be_bare_struct_literal.take();
|
let prev = self.diagnostic_metadata.current_block_could_be_bare_struct_literal.take();
|
||||||
|
@ -3904,8 +3906,8 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||||
&& let ItemKind::MacroDef(..) = item.kind {
|
&& let ItemKind::MacroDef(..) = item.kind {
|
||||||
num_macro_definition_ribs += 1;
|
num_macro_definition_ribs += 1;
|
||||||
let res = self.r.local_def_id(item.id).to_def_id();
|
let res = self.r.local_def_id(item.id).to_def_id();
|
||||||
self.ribs[ValueNS].push(Rib::new(MacroDefinition(res)));
|
self.ribs[ValueNS].push(Rib::new(RibKind::MacroDefinition(res)));
|
||||||
self.label_ribs.push(Rib::new(MacroDefinition(res)));
|
self.label_ribs.push(Rib::new(RibKind::MacroDefinition(res)));
|
||||||
}
|
}
|
||||||
|
|
||||||
self.visit_stmt(stmt);
|
self.visit_stmt(stmt);
|
||||||
|
@ -3992,7 +3994,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
ExprKind::If(ref cond, ref then, ref opt_else) => {
|
ExprKind::If(ref cond, ref then, ref opt_else) => {
|
||||||
self.with_rib(ValueNS, NormalRibKind, |this| {
|
self.with_rib(ValueNS, RibKind::NormalRibKind, |this| {
|
||||||
let old = this.diagnostic_metadata.in_if_condition.replace(cond);
|
let old = this.diagnostic_metadata.in_if_condition.replace(cond);
|
||||||
this.visit_expr(cond);
|
this.visit_expr(cond);
|
||||||
this.diagnostic_metadata.in_if_condition = old;
|
this.diagnostic_metadata.in_if_condition = old;
|
||||||
|
@ -4009,7 +4011,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||||
|
|
||||||
ExprKind::While(ref cond, ref block, label) => {
|
ExprKind::While(ref cond, ref block, label) => {
|
||||||
self.with_resolved_label(label, expr.id, |this| {
|
self.with_resolved_label(label, expr.id, |this| {
|
||||||
this.with_rib(ValueNS, NormalRibKind, |this| {
|
this.with_rib(ValueNS, RibKind::NormalRibKind, |this| {
|
||||||
let old = this.diagnostic_metadata.in_if_condition.replace(cond);
|
let old = this.diagnostic_metadata.in_if_condition.replace(cond);
|
||||||
this.visit_expr(cond);
|
this.visit_expr(cond);
|
||||||
this.diagnostic_metadata.in_if_condition = old;
|
this.diagnostic_metadata.in_if_condition = old;
|
||||||
|
@ -4020,7 +4022,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||||
|
|
||||||
ExprKind::ForLoop(ref pat, ref iter_expr, ref block, label) => {
|
ExprKind::ForLoop(ref pat, ref iter_expr, ref block, label) => {
|
||||||
self.visit_expr(iter_expr);
|
self.visit_expr(iter_expr);
|
||||||
self.with_rib(ValueNS, NormalRibKind, |this| {
|
self.with_rib(ValueNS, RibKind::NormalRibKind, |this| {
|
||||||
this.resolve_pattern_top(pat, PatternSource::For);
|
this.resolve_pattern_top(pat, PatternSource::For);
|
||||||
this.resolve_labeled_block(label, expr.id, block);
|
this.resolve_labeled_block(label, expr.id, block);
|
||||||
});
|
});
|
||||||
|
@ -4085,8 +4087,8 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||||
ref body,
|
ref body,
|
||||||
..
|
..
|
||||||
}) => {
|
}) => {
|
||||||
self.with_rib(ValueNS, NormalRibKind, |this| {
|
self.with_rib(ValueNS, RibKind::NormalRibKind, |this| {
|
||||||
this.with_label_rib(ClosureOrAsyncRibKind, |this| {
|
this.with_label_rib(RibKind::ClosureOrAsyncRibKind, |this| {
|
||||||
// Resolve arguments:
|
// Resolve arguments:
|
||||||
this.resolve_params(&fn_decl.inputs);
|
this.resolve_params(&fn_decl.inputs);
|
||||||
// No need to resolve return type --
|
// No need to resolve return type --
|
||||||
|
@ -4110,7 +4112,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||||
}) => {
|
}) => {
|
||||||
self.with_generic_param_rib(
|
self.with_generic_param_rib(
|
||||||
&generic_params,
|
&generic_params,
|
||||||
NormalRibKind,
|
RibKind::NormalRibKind,
|
||||||
LifetimeRibKind::Generics {
|
LifetimeRibKind::Generics {
|
||||||
binder: expr.id,
|
binder: expr.id,
|
||||||
kind: LifetimeBinderKind::Closure,
|
kind: LifetimeBinderKind::Closure,
|
||||||
|
@ -4121,7 +4123,9 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||||
}
|
}
|
||||||
ExprKind::Closure(..) => visit::walk_expr(self, expr),
|
ExprKind::Closure(..) => visit::walk_expr(self, expr),
|
||||||
ExprKind::Async(..) => {
|
ExprKind::Async(..) => {
|
||||||
self.with_label_rib(ClosureOrAsyncRibKind, |this| visit::walk_expr(this, expr));
|
self.with_label_rib(RibKind::ClosureOrAsyncRibKind, |this| {
|
||||||
|
visit::walk_expr(this, expr)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
ExprKind::Repeat(ref elem, ref ct) => {
|
ExprKind::Repeat(ref elem, ref ct) => {
|
||||||
self.visit_expr(elem);
|
self.visit_expr(elem);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue