File tree Expand file tree Collapse file tree 4 files changed +23
-16
lines changed
compiler/rustc_hir_analysis/src/collect
ui/const-generics/generic_const_exprs Expand file tree Collapse file tree 4 files changed +23
-16
lines changed Original file line number Diff line number Diff line change @@ -421,7 +421,9 @@ fn const_evaluatable_predicates_of<'tcx>(
421
421
impl < ' tcx > TypeVisitor < TyCtxt < ' tcx > > for ConstCollector < ' tcx > {
422
422
fn visit_const ( & mut self , c : ty:: Const < ' tcx > ) {
423
423
if let ty:: ConstKind :: Unevaluated ( uv) = c. kind ( ) {
424
- if is_const_param_default ( self . tcx , uv. def . expect_local ( ) ) {
424
+ if let Some ( local) = uv. def . as_local ( )
425
+ && is_const_param_default ( self . tcx , local)
426
+ {
425
427
// Do not look into const param defaults,
426
428
// these get checked when they are actually instantiated.
427
429
//
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ // regression test for #133808.
2
+
3
+ #![ feature( generic_const_exprs) ]
4
+ #![ feature( min_generic_const_args) ]
5
+ #![ allow( incomplete_features) ]
6
+ #![ crate_type = "lib" ]
7
+
8
+ pub trait Foo { }
9
+ impl Foo for [ u8 ; std:: path:: MAIN_SEPARATOR ] { }
10
+ //~^ ERROR the constant `MAIN_SEPARATOR` is not of type `usize`
Original file line number Diff line number Diff line change
1
+ error: the constant `MAIN_SEPARATOR` is not of type `usize`
2
+ --> $DIR/non-local-const.rs:9:14
3
+ |
4
+ LL | impl Foo for [u8; std::path::MAIN_SEPARATOR] {}
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `char`
6
+ |
7
+ = note: the length of array `[u8; MAIN_SEPARATOR]` must be type `usize`
8
+
9
+ error: aborting due to 1 previous error
10
+
You can’t perform that action at this time.
0 commit comments