forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
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#123618 - compiler-errors:overflow-ambig, r=…
…spastorino Discard overflow obligations in `impl_may_apply` Hacky fix for rust-lang#123493. Throws away obligations that are overflowing in `impl_may_apply` when we recompute if an impl applies, since those will lead to fatal overflow if processed during fulfillment. Something about rust-lang#114811 (I think it's the predicate reordering) caused us to evaluate predicates differently in error reporting leading to fatal overflow, though I believe the underlying overflow is possible to hit since this code was rewritten to use fulfillment. Fixes rust-lang#123493
- Loading branch information
Showing
4 changed files
with
55 additions
and
6 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 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
trait Hello {} | ||
|
||
struct Foo<'a, T: ?Sized>(&'a T); | ||
|
||
impl<'a, T: ?Sized> Hello for Foo<'a, &'a T> where Foo<'a, T>: Hello {} | ||
|
||
impl Hello for Foo<'static, i32> {} | ||
|
||
fn hello<T: ?Sized + Hello>() {} | ||
|
||
fn main() { | ||
hello(); | ||
//~^ ERROR type annotations needed | ||
} |
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,23 @@ | ||
error[E0283]: type annotations needed | ||
--> $DIR/overflow-computing-ambiguity.rs:12:5 | ||
| | ||
LL | hello(); | ||
| ^^^^^ cannot infer type of the type parameter `T` declared on the function `hello` | ||
| | ||
= note: cannot satisfy `_: Hello` | ||
= help: the following types implement trait `Hello`: | ||
Foo<'a, &'a T> | ||
Foo<'static, i32> | ||
note: required by a bound in `hello` | ||
--> $DIR/overflow-computing-ambiguity.rs:9:22 | ||
| | ||
LL | fn hello<T: ?Sized + Hello>() {} | ||
| ^^^^^ required by this bound in `hello` | ||
help: consider specifying the generic argument | ||
| | ||
LL | hello::<T>(); | ||
| +++++ | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0283`. |