use rustc_hir::lang_items::LangItem;
use rustc_hir::{
Constness, HirId, ItemKind, ItemLocalId, ItemLocalMap, ItemLocalSet, Node, TraitCandidate,
+ TraitItemKind,
};
use rustc_index::vec::{Idx, IndexVec};
use rustc_macros::HashStable;
}
}
}
+ Node::TraitItem(item) => {
+ // #86483: Return early if it doesn't have a concrete type.
+ if let TraitItemKind::Type(_, None) = item.kind {
+ return None;
+ }
+ }
_ => { /* `type_of_def_id()` will work or panic */ }
}
--- /dev/null
+// Regression test of #86483.
+
+#![feature(generic_associated_types)]
+#![allow(incomplete_features)]
+
+pub trait IceIce<T> //~ ERROR: the parameter type `T` may not live long enough
+where
+ for<'a> T: 'a,
+{
+ type Ice<'v>: IntoIterator<Item = &'v T>;
+ //~^ ERROR: the parameter type `T` may not live long enough
+ //~| ERROR: the parameter type `T` may not live long enough
+}
+
+fn main() {}
--- /dev/null
+error[E0311]: the parameter type `T` may not live long enough
+ --> $DIR/issue-86483.rs:6:1
+ |
+LL | pub trait IceIce<T>
+ | ^ - help: consider adding an explicit lifetime bound...: `T: 'a`
+ | _|
+ | |
+LL | | where
+LL | | for<'a> T: 'a,
+LL | | {
+... |
+LL | |
+LL | | }
+ | |_^ ...so that the type `T` will meet its required lifetime bounds
+
+error[E0311]: the parameter type `T` may not live long enough
+ --> $DIR/issue-86483.rs:10:5
+ |
+LL | pub trait IceIce<T>
+ | - help: consider adding an explicit lifetime bound...: `T: 'a`
+...
+LL | type Ice<'v>: IntoIterator<Item = &'v T>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+
+error[E0309]: the parameter type `T` may not live long enough
+ --> $DIR/issue-86483.rs:10:32
+ |
+LL | pub trait IceIce<T>
+ | - help: consider adding an explicit lifetime bound...: `T: 'v`
+...
+LL | type Ice<'v>: IntoIterator<Item = &'v T>;
+ | ^^^^^^^^^^^^ ...so that the reference type `&'v T` does not outlive the data it points at
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0309`.