File tree Expand file tree Collapse file tree 3 files changed +42
-1
lines changed
compiler/rustc_middle/src/ty
tests/ui/traits/new-solver Expand file tree Collapse file tree 3 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -312,6 +312,7 @@ impl DeepRejectCtxt {
312312 // Impls cannot contain these types as these cannot be named directly.
313313 ty:: FnDef ( ..) | ty:: Closure ( ..) | ty:: Generator ( ..) => false ,
314314
315+ // Placeholder types don't unify with anything on their own
315316 ty:: Placeholder ( ..) | ty:: Bound ( ..) => false ,
316317
317318 // Depending on the value of `treat_obligation_params`, we either
@@ -359,6 +360,9 @@ impl DeepRejectCtxt {
359360 TreatParams :: AsCandidateKey => true ,
360361 } ,
361362
363+ // Placeholder consts don't unify with anything on their own
364+ ty:: ConstKind :: Placeholder ( _) => false ,
365+
362366 // As we don't necessarily eagerly evaluate constants,
363367 // they might unify with any value.
364368 ty:: ConstKind :: Expr ( _) | ty:: ConstKind :: Unevaluated ( _) | ty:: ConstKind :: Error ( _) => {
@@ -371,7 +375,7 @@ impl DeepRejectCtxt {
371375
372376 ty:: ConstKind :: Infer ( _) => true ,
373377
374- ty:: ConstKind :: Bound ( ..) | ty :: ConstKind :: Placeholder ( _ ) => {
378+ ty:: ConstKind :: Bound ( ..) => {
375379 bug ! ( "unexpected obl const: {:?}" , obligation_ct)
376380 }
377381 }
Original file line number Diff line number Diff line change 1+ error[E0277]: the trait bound `[T; N]: Foo` is not satisfied
2+ --> $DIR/const-param-placeholder.rs:17:17
3+ |
4+ LL | needs_foo::<[T; N]>();
5+ | ^^^^^^ the trait `Foo` is not implemented for `[T; N]`
6+ |
7+ = help: the trait `Foo` is implemented for `[T; 1]`
8+ note: required by a bound in `needs_foo`
9+ --> $DIR/const-param-placeholder.rs:8:17
10+ |
11+ LL | fn needs_foo<F: Foo>() {}
12+ | ^^^ required by this bound in `needs_foo`
13+
14+ error: aborting due to previous error
15+
16+ For more information about this error, try `rustc --explain E0277`.
Original file line number Diff line number Diff line change 1+ // compile-flags: -Ztrait-solver=next
2+ // revisions: pass fail
3+ //[pass] check-pass
4+
5+ struct Wrapper < T , const N : usize > ( [ T ; N ] ) ;
6+
7+ trait Foo { }
8+ fn needs_foo < F : Foo > ( ) { }
9+
10+ #[ cfg( fail) ]
11+ impl < T > Foo for [ T ; 1 ] { }
12+
13+ #[ cfg( pass) ]
14+ impl < T , const N : usize > Foo for [ T ; N ] { }
15+
16+ fn test < T , const N : usize > ( ) {
17+ needs_foo :: < [ T ; N ] > ( ) ;
18+ //[fail]~^ ERROR the trait bound `[T; N]: Foo` is not satisfied
19+ }
20+
21+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments