Skip to content
Browse files

The crux of the bug fix.

Update: review feedback
Update: placate tidy
  • Loading branch information...
pnkfelix committed Sep 27, 2019
1 parent 0221e26 commit 3a4921cde162af1ffbb2fbff4b395408eab1deab
Showing with 13 additions and 0 deletions.
  1. +13 −0 src/librustc_resolve/
@@ -468,6 +468,19 @@ impl<'a, 'tcx> Visitor<'tcx> for LateResolutionVisitor<'a, '_> {

// rust-lang/rust#61631: The type `Self` is essentially
// another type parameter. For ADTs, we consider it
// well-defined only after all of the ADT type parameters have
// been provided. Therefore, we do not allow use of `Self`
// anywhere in ADT type parameter defaults.
// (We however cannot ban `Self` for defaults on *all* generic
// lists; e.g. trait generics can usefully refer to `Self`,
// such as in the case of `trait Add<Rhs = Self>`.)
if self.current_self_item.is_some() { // (`Some` if + only if we are in ADT's generics.)
default_ban_rib.bindings.insert(Ident::with_dummy_span(kw::SelfUpper), Res::Err);

// We also ban access to type parameters for use as the types of const parameters.
let mut const_ty_param_ban_rib = Rib::new(TyParamAsConstParamTy);

0 comments on commit 3a4921c

Please sign in to comment.
You can’t perform that action at this time.