Fix issue with specifying generic arguments for primitive types
This commit is contained in:
parent
28928c750c
commit
c0d29fe7d7
|
@ -112,12 +112,16 @@ pub(super) fn opt_const_param_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<
|
||||||
tcx.sess.delay_span_bug(tcx.def_span(def_id), "anon const with Res::Err");
|
tcx.sess.delay_span_bug(tcx.def_span(def_id), "anon const with Res::Err");
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
_ => span_bug!(
|
_ => {
|
||||||
DUMMY_SP,
|
// If the user tries to specify generics on a type that does not take them,
|
||||||
"unexpected anon const res {:?} in path: {:?}",
|
// e.g. `usize<T>`, we may hit this branch, in which case we treat it as if
|
||||||
res,
|
// no arguments have been passed. An error should already have been emitted.
|
||||||
path,
|
tcx.sess.delay_span_bug(
|
||||||
),
|
tcx.def_span(def_id),
|
||||||
|
&format!("unexpected anon const res {:?} in path: {:?}", res, path),
|
||||||
|
);
|
||||||
|
return None;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
generics
|
generics
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
fn foo() {
|
||||||
|
let x: usize<foo>; //~ ERROR const arguments are not allowed for this type
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
|
@ -0,0 +1,9 @@
|
||||||
|
error[E0109]: const arguments are not allowed for this type
|
||||||
|
--> $DIR/usize-generic-argument-parent.rs:2:18
|
||||||
|
|
|
||||||
|
LL | let x: usize<foo>;
|
||||||
|
| ^^^ const argument not allowed
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0109`.
|
Loading…
Reference in New Issue