forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#133493 - lcnr:fulfill-fudge, r=compiler-errors do not constrain infer vars in `find_best_leaf_obligation` This ended up causing an ICE by making the following code path reachable by incorrectly constraining an inference variable while computing the best obligation for a preceding ambiguity. Closes rust-lang#129444. https://github.com/rust-lang/rust/blob/f2abf827c128120ed7a874d02973947968c158b8/compiler/rustc_trait_selection/src/solve/fulfill.rs#L312-L314 I have to be honest, I don't fully understand how that change removes all the additional diagnostics :3 r? `@compiler-errors`
- Loading branch information
Showing
13 changed files
with
114 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// A regression test for #129444. This previously ICE'd as | ||
// computing the best obligation for one ambiguous obligation | ||
// added spurious inference constraints which caused another | ||
// candidate to pass. | ||
trait Trait { | ||
type Assoc; | ||
} | ||
|
||
struct W<T: Trait>(*mut T); | ||
impl<T> Trait for W<W<W<T>>> {} | ||
//~^ ERROR the trait bound `W<W<T>>: Trait` is not satisfied | ||
//~| ERROR the trait bound `W<T>: Trait` is not satisfied | ||
//~| ERROR the trait bound `T: Trait` is not satisfied | ||
//~| ERROR not all trait items implemented, missing: `Assoc` | ||
|
||
trait NoOverlap {} | ||
impl<T: Trait> NoOverlap for T {} | ||
impl<T: Trait<Assoc = u32>> NoOverlap for W<T> {} | ||
//~^ ERROR conflicting implementations of trait `NoOverlap` for type `W<W<W<W<_>>>>` | ||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
error[E0277]: the trait bound `W<W<T>>: Trait` is not satisfied | ||
--> $DIR/best-obligation-ICE.rs:10:19 | ||
| | ||
LL | impl<T> Trait for W<W<W<T>>> {} | ||
| ^^^^^^^^^^ the trait `Trait` is not implemented for `W<W<T>>` | ||
| | ||
note: required by a bound in `W` | ||
--> $DIR/best-obligation-ICE.rs:9:13 | ||
| | ||
LL | struct W<T: Trait>(*mut T); | ||
| ^^^^^ required by this bound in `W` | ||
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | ||
| | ||
LL | impl<T> Trait for W<W<W<T>>> where W<W<T>>: Trait {} | ||
| ++++++++++++++++++++ | ||
|
||
error[E0277]: the trait bound `W<T>: Trait` is not satisfied | ||
--> $DIR/best-obligation-ICE.rs:10:19 | ||
| | ||
LL | impl<T> Trait for W<W<W<T>>> {} | ||
| ^^^^^^^^^^ the trait `Trait` is not implemented for `W<T>` | ||
| | ||
note: required by a bound in `W` | ||
--> $DIR/best-obligation-ICE.rs:9:13 | ||
| | ||
LL | struct W<T: Trait>(*mut T); | ||
| ^^^^^ required by this bound in `W` | ||
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | ||
| | ||
LL | impl<T> Trait for W<W<W<T>>> where W<T>: Trait {} | ||
| +++++++++++++++++ | ||
|
||
error[E0277]: the trait bound `T: Trait` is not satisfied | ||
--> $DIR/best-obligation-ICE.rs:10:19 | ||
| | ||
LL | impl<T> Trait for W<W<W<T>>> {} | ||
| ^^^^^^^^^^ the trait `Trait` is not implemented for `T` | ||
| | ||
note: required by a bound in `W` | ||
--> $DIR/best-obligation-ICE.rs:9:13 | ||
| | ||
LL | struct W<T: Trait>(*mut T); | ||
| ^^^^^ required by this bound in `W` | ||
help: consider restricting type parameter `T` | ||
| | ||
LL | impl<T: Trait> Trait for W<W<W<T>>> {} | ||
| +++++++ | ||
|
||
error[E0046]: not all trait items implemented, missing: `Assoc` | ||
--> $DIR/best-obligation-ICE.rs:10:1 | ||
| | ||
LL | type Assoc; | ||
| ---------- `Assoc` from trait | ||
... | ||
LL | impl<T> Trait for W<W<W<T>>> {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Assoc` in implementation | ||
|
||
error[E0119]: conflicting implementations of trait `NoOverlap` for type `W<W<W<W<_>>>>` | ||
--> $DIR/best-obligation-ICE.rs:18:1 | ||
| | ||
LL | impl<T: Trait> NoOverlap for T {} | ||
| ------------------------------ first implementation here | ||
LL | impl<T: Trait<Assoc = u32>> NoOverlap for W<T> {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `W<W<W<W<_>>>>` | ||
|
||
error: aborting due to 5 previous errors | ||
|
||
Some errors have detailed explanations: E0046, E0119, E0277. | ||
For more information about an error, try `rustc --explain E0046`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,11 @@ | ||
error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time | ||
--> $DIR/unsized_coercion.rs:15:17 | ||
--> $DIR/unsized_coercion.rs:14:17 | ||
| | ||
LL | let x = hello(); | ||
| ^^^^^^^ doesn't have a size known at compile-time | ||
| | ||
= help: the trait `Sized` is not implemented for `dyn Trait` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/unsized_coercion.rs:19:5 | ||
| | ||
LL | fn hello() -> Box<impl Trait> { | ||
| --------------- | ||
| | | | ||
| | the expected opaque type | ||
| expected `Box<impl Trait>` because of return type | ||
... | ||
LL | Box::new(1u32) | ||
| ^^^^^^^^^^^^^^ types differ | ||
| | ||
= note: expected struct `Box<impl Trait>` | ||
found struct `Box<u32>` | ||
|
||
error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time | ||
--> $DIR/unsized_coercion.rs:12:1 | ||
| | ||
LL | fn hello() -> Box<impl Trait> { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | ||
| | ||
= help: the trait `Sized` is not implemented for `dyn Trait` | ||
|
||
error: aborting due to 3 previous errors | ||
error: aborting due to 1 previous error | ||
|
||
Some errors have detailed explanations: E0277, E0308. | ||
For more information about an error, try `rustc --explain E0277`. | ||
For more information about this error, try `rustc --explain E0277`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,11 @@ | ||
error[E0277]: the trait bound `dyn Send: Trait` is not satisfied | ||
--> $DIR/unsized_coercion3.rs:14:17 | ||
--> $DIR/unsized_coercion3.rs:13:17 | ||
| | ||
LL | let x = hello(); | ||
| ^^^^^^^ the trait `Trait` is not implemented for `dyn Send` | ||
| | ||
= help: the trait `Trait` is implemented for `u32` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/unsized_coercion3.rs:19:5 | ||
| | ||
LL | fn hello() -> Box<impl Trait + ?Sized> { | ||
| ------------------------ | ||
| | | | ||
| | the expected opaque type | ||
| expected `Box<impl Trait + ?Sized>` because of return type | ||
... | ||
LL | Box::new(1u32) | ||
| ^^^^^^^^^^^^^^ types differ | ||
| | ||
= note: expected struct `Box<impl Trait + ?Sized>` | ||
found struct `Box<u32>` | ||
|
||
error[E0277]: the trait bound `dyn Send: Trait` is not satisfied | ||
--> $DIR/unsized_coercion3.rs:11:1 | ||
| | ||
LL | fn hello() -> Box<impl Trait + ?Sized> { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `dyn Send` | ||
| | ||
= help: the trait `Trait` is implemented for `u32` | ||
|
||
error: aborting due to 3 previous errors | ||
error: aborting due to 1 previous error | ||
|
||
Some errors have detailed explanations: E0277, E0308. | ||
For more information about an error, try `rustc --explain E0277`. | ||
For more information about this error, try `rustc --explain E0277`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters