-
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.
Rollup merge of #120802 - oli-obk:drop_elab_ice, r=compiler-errors
Bail out of drop elaboration when encountering error types fixes #120788
- Loading branch information
Showing
3 changed files
with
38 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// can't use build-fail, because this also fails check-fail, but | ||
// the ICE from #120787 only reproduces on build-fail. | ||
// compile-flags: --emit=mir | ||
|
||
#![feature(type_alias_impl_trait)] | ||
|
||
struct Foo { | ||
field: String, | ||
} | ||
|
||
type Tait = impl Sized; | ||
|
||
fn ice_cold(beverage: Tait) { | ||
let Foo { field } = beverage; | ||
_ = field; | ||
} | ||
|
||
fn main() { | ||
Ok(()) //~ ERROR mismatched types | ||
} |
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 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/drop_elaboration_with_errors.rs:19:5 | ||
| | ||
LL | fn main() { | ||
| - expected `()` because of default return type | ||
LL | Ok(()) | ||
| ^^^^^^ expected `()`, found `Result<(), _>` | ||
| | ||
= note: expected unit type `()` | ||
found enum `Result<(), _>` | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |