File tree 3 files changed +48
-1
lines changed
compiler/rustc_trait_selection/src/solve
tests/ui/traits/new-solver
3 files changed +48
-1
lines changed Original file line number Diff line number Diff line change @@ -174,7 +174,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
174
174
goal. predicate . def_id ( ) ,
175
175
impl_def_id
176
176
) ? else {
177
- return ecx. evaluate_added_goals_and_make_canonical_response ( Certainty :: Yes ) ;
177
+ return ecx. evaluate_added_goals_and_make_canonical_response ( Certainty :: AMBIGUOUS ) ;
178
178
} ;
179
179
180
180
if !assoc_def. item . defaultness ( tcx) . has_value ( ) {
Original file line number Diff line number Diff line change
1
+ // compile-flags: -Ztrait-solver=next
2
+
3
+ #![ feature( specialization) ]
4
+ //~^ WARN the feature `specialization` is incomplete
5
+
6
+ // Do not treat the RHS of a projection-goal as an unconstrained `Certainty::Yes` response
7
+ // if the impl is still further specializable.
8
+
9
+ trait Default {
10
+ type Id ;
11
+ }
12
+
13
+ impl < T > Default for T {
14
+ default type Id = T ;
15
+ }
16
+
17
+ fn test < T : Default < Id = U > , U > ( ) { }
18
+
19
+ fn main ( ) {
20
+ test :: < u32 , ( ) > ( ) ;
21
+ //~^ ERROR cannot satisfy `<u32 as Default>::Id == ()`
22
+ }
Original file line number Diff line number Diff line change
1
+ warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
2
+ --> $DIR/specialization-unconstrained.rs:3:12
3
+ |
4
+ LL | #![feature(specialization)]
5
+ | ^^^^^^^^^^^^^^
6
+ |
7
+ = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
8
+ = help: consider using `min_specialization` instead, which is more stable and complete
9
+ = note: `#[warn(incomplete_features)]` on by default
10
+
11
+ error[E0284]: type annotations needed: cannot satisfy `<u32 as Default>::Id == ()`
12
+ --> $DIR/specialization-unconstrained.rs:20:5
13
+ |
14
+ LL | test::<u32, ()>();
15
+ | ^^^^^^^^^^^^^^^ cannot satisfy `<u32 as Default>::Id == ()`
16
+ |
17
+ note: required by a bound in `test`
18
+ --> $DIR/specialization-unconstrained.rs:17:20
19
+ |
20
+ LL | fn test<T: Default<Id = U>, U>() {}
21
+ | ^^^^^^ required by this bound in `test`
22
+
23
+ error: aborting due to previous error; 1 warning emitted
24
+
25
+ For more information about this error, try `rustc --explain E0284`.
You can’t perform that action at this time.
0 commit comments