Rollup merge of #118396 - compiler-errors:ast-lang-items, r=cjgillot
Collect lang items from AST, get rid of `GenericBound::LangItemTrait` r? `@cjgillot` cc #115178 Looking forward, the work to remove `QPath::LangItem` will also be significantly more difficult, but I plan on doing it as well. Specifically, we have to change: 1. A lot of `rustc_ast_lowering` for things like expr `..` 2. A lot of astconv, since we actually instantiate lang and non-lang paths quite differently. 3. A ton of diagnostics and clippy lints that are special-cased via `QPath::LangItem` Meanwhile, it was pretty easy to remove `GenericBound::LangItemTrait`, so I just did that here.
This commit is contained in:
@@ -938,32 +938,6 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_param_bound(&mut self, bound: &'tcx hir::GenericBound<'tcx>) {
|
||||
match bound {
|
||||
hir::GenericBound::LangItemTrait(_, _, hir_id, _) => {
|
||||
// FIXME(jackh726): This is pretty weird. `LangItemTrait` doesn't go
|
||||
// through the regular poly trait ref code, so we don't get another
|
||||
// chance to introduce a binder. For now, I'm keeping the existing logic
|
||||
// of "if there isn't a Binder scope above us, add one", but I
|
||||
// imagine there's a better way to go about this.
|
||||
let (binders, scope_type) = self.poly_trait_ref_binder_info();
|
||||
|
||||
self.record_late_bound_vars(*hir_id, binders);
|
||||
let scope = Scope::Binder {
|
||||
hir_id: *hir_id,
|
||||
bound_vars: FxIndexMap::default(),
|
||||
s: self.scope,
|
||||
scope_type,
|
||||
where_bound_origin: None,
|
||||
};
|
||||
self.with(scope, |this| {
|
||||
intravisit::walk_param_bound(this, bound);
|
||||
});
|
||||
}
|
||||
_ => intravisit::walk_param_bound(self, bound),
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_poly_trait_ref(&mut self, trait_ref: &'tcx hir::PolyTraitRef<'tcx>) {
|
||||
self.visit_poly_trait_ref_inner(trait_ref, NonLifetimeBinderAllowed::Allow);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user