// figure out which generic parameter it corresponds to and return
// the relevant type.
let generics = match path.res {
- Res::Def(DefKind::Ctor(..), def_id) => {
+ Res::Def(DefKind::Ctor(..), def_id)
+ | Res::Def(DefKind::AssocTy, def_id) => {
tcx.generics_of(tcx.parent(def_id).unwrap())
}
Res::Def(_, def_id) => tcx.generics_of(def_id),
- Res::Err => return tcx.types.err,
res => {
tcx.sess.delay_span_bug(
DUMMY_SP,
- &format!("unexpected const parent path def {:?}", res,),
+ &format!(
+ "unexpected const parent path def, parent: {:?}, def: {:?}",
+ parent_node, res
+ ),
);
return tcx.types.err;
}
.map(|param| tcx.type_of(param.def_id))
// This is no generic parameter associated with the arg. This is
// probably from an extra arg where one is not needed.
- .unwrap_or(tcx.types.err)
+ .unwrap_or_else(|| {
+ tcx.sess.delay_span_bug(
+ DUMMY_SP,
+ &format!(
+ "missing generic parameter for `AnonConst`, parent {:?}",
+ parent_node
+ ),
+ );
+ tcx.types.err
+ })
} else {
tcx.sess.delay_span_bug(
DUMMY_SP,
--- /dev/null
+// check-pass
+
+#![feature(const_generics)]
+//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
+
+pub struct Tuple;
+
+pub trait Trait<const I: usize> {
+ type Input: From<<Self as Trait<I>>::Input>;
+}
+
+fn main() {}
--- /dev/null
+warning: the feature `const_generics` is incomplete and may cause the compiler to crash
+ --> $DIR/issue-66906.rs:3:12
+ |
+LL | #![feature(const_generics)]
+ | ^^^^^^^^^^^^^^
+ |
+ = note: `#[warn(incomplete_features)]` on by default
+
--- /dev/null
+warning: the feature `const_generics` is incomplete and may cause the compiler to crash
+ --> $DIR/issue-70167.rs:3:12
+ |
+LL | #![feature(const_generics)]
+ | ^^^^^^^^^^^^^^
+ |
+ = note: `#[warn(incomplete_features)]` on by default
+