about summary refs log tree commit diff
path: root/compiler/rustc_resolve
diff options
context:
space:
mode:
authorJack Huey <jack.huey@umassmed.edu>2021-04-06 15:34:29 -0400
committerJack Huey <jack.huey@umassmed.edu>2021-04-06 17:10:15 -0400
commit3ae5fed04c94be2f8591c7f4ab76f78ec882cd32 (patch)
tree4178a2ca3453857236e46e4a9d4690ffa18f22d6 /compiler/rustc_resolve
parent5c897d430dcbec6b10a9925f7de054dbc0ad3c52 (diff)
downloadrust-3ae5fed04c94be2f8591c7f4ab76f78ec882cd32.tar.gz
rust-3ae5fed04c94be2f8591c7f4ab76f78ec882cd32.zip
Fix a couple resolve bugs from binder refactor
Diffstat (limited to 'compiler/rustc_resolve')
-rw-r--r--compiler/rustc_resolve/src/late/lifetimes.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/compiler/rustc_resolve/src/late/lifetimes.rs b/compiler/rustc_resolve/src/late/lifetimes.rs
index b89ad867f46..70ddfcc9004 100644
--- a/compiler/rustc_resolve/src/late/lifetimes.rs
+++ b/compiler/rustc_resolve/src/late/lifetimes.rs
@@ -2659,6 +2659,13 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
                 Some(next) => next,
                 None => break None,
             };
+            // See issue #83753. If someone writes an associated type on a non-trait, just treat it as
+            // there being no supertrait HRTBs.
+            match tcx.def_kind(def_id) {
+                DefKind::Trait | DefKind::TraitAlias | DefKind::Impl => {}
+                _ => break None,
+            }
+
             if trait_defines_associated_type_named(def_id) {
                 break Some(bound_vars.into_iter().collect());
             }
@@ -2703,7 +2710,14 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
                 | Scope::Supertrait { ref s, .. } => {
                     scope = *s;
                 }
-                Scope::Root => bug!("In fn_like_elision without appropriate scope above"),
+                Scope::Root => {
+                    // See issue #83907. Just bail out from looking inside.
+                    self.tcx.sess.delay_span_bug(
+                        rustc_span::DUMMY_SP,
+                        "In fn_like_elision without appropriate scope above",
+                    );
+                    return;
+                }
             }
         };
         // While not strictly necessary, we gather anon lifetimes *before* actually