-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #101604 - compiler-errors:issue-101465, r=lcnr
Fix ICE in opt_suggest_box_span We were _totally_ mishandling substs and obligations in `opt_suggest_box_span`, so I reworked that function pretty heavily. Also some drive-by changes, namely removing `ret_type_span`. Fixes #101465
- Loading branch information
Showing
7 changed files
with
120 additions
and
50 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
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,25 @@ | ||
#![feature(trait_alias)] | ||
|
||
struct B; | ||
struct C; | ||
|
||
trait Tr {} | ||
|
||
impl Tr for B {} | ||
impl Tr for C {} | ||
|
||
trait Tr2<S> = Into<S>; | ||
|
||
fn foo2<T: Tr2<()>>() {} | ||
|
||
fn foo() -> impl Tr { | ||
let x = foo2::<_>(); | ||
|
||
match true { | ||
true => B, | ||
false => C, | ||
//~^ `match` arms have incompatible types | ||
} | ||
} | ||
|
||
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,25 @@ | ||
error[E0308]: `match` arms have incompatible types | ||
--> $DIR/issue-101465.rs:20:18 | ||
| | ||
LL | / match true { | ||
LL | | true => B, | ||
| | - this is found to be of type `B` | ||
LL | | false => C, | ||
| | ^ expected struct `B`, found struct `C` | ||
LL | | | ||
LL | | } | ||
| |_____- `match` arms have incompatible types | ||
| | ||
help: you could change the return type to be a boxed trait object | ||
| | ||
LL | fn foo() -> Box<dyn Tr> { | ||
| ~~~~~~~ + | ||
help: if you change the return type to expect trait objects, box the returned expressions | ||
| | ||
LL ~ true => Box::new(B), | ||
LL ~ false => Box::new(C), | ||
| | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |