File tree Expand file tree Collapse file tree 3 files changed +25
-4
lines changed
compiler/rustc_next_trait_solver/src/solve
tests/ui/traits/const-traits Expand file tree Collapse file tree 3 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -189,10 +189,11 @@ where
189189 }
190190
191191 fn consider_auto_trait_candidate (
192- _ecx : & mut EvalCtxt < ' _ , D > ,
192+ ecx : & mut EvalCtxt < ' _ , D > ,
193193 _goal : Goal < I , Self > ,
194194 ) -> Result < Candidate < I > , NoSolution > {
195- unreachable ! ( "auto traits are never const" )
195+ ecx. cx ( ) . delay_bug ( "auto traits are never const" ) ;
196+ Err ( NoSolution )
196197 }
197198
198199 fn consider_trait_alias_candidate (
Original file line number Diff line number Diff line change 1+ //@ compile-flags: -Znext-solver
12#![ feature( auto_traits, const_trait_impl) ]
23
34const auto trait Marker { }
45//~^ ERROR: auto traits cannot be const
56
7+ fn scope ( ) {
8+ fn check < T : const Marker > ( ) { }
9+ check :: < ( ) > ( ) ;
10+ //~^ ERROR: the trait bound `(): const Marker` is not satisfied
11+ }
12+
613fn main ( ) { }
Original file line number Diff line number Diff line change 11error: auto traits cannot be const
2- --> $DIR/const-auto-trait.rs:3 :1
2+ --> $DIR/const-auto-trait.rs:4 :1
33 |
44LL | const auto trait Marker {}
55 | ^^^^^
66 |
77 = help: remove the `const` keyword
88
9- error: aborting due to 1 previous error
9+ error[E0277]: the trait bound `(): const Marker` is not satisfied
10+ --> $DIR/const-auto-trait.rs:9:13
11+ |
12+ LL | check::<()>();
13+ | ^^
14+ |
15+ note: required by a bound in `check`
16+ --> $DIR/const-auto-trait.rs:8:17
17+ |
18+ LL | fn check<T: const Marker>() {}
19+ | ^^^^^^^^^^^^ required by this bound in `check`
20+
21+ error: aborting due to 2 previous errors
1022
23+ For more information about this error, try `rustc --explain E0277`.
You can’t perform that action at this time.
0 commit comments