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#120801 - oli-obk:drop_recursion_ice, r=Nilstrieb Avoid ICE in drop recursion check in case of invalid drop impls fixes rust-lang#120787
- Loading branch information
Showing
4 changed files
with
28 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,11 @@ | ||
// 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 | ||
|
||
struct PrintOnDrop<'a>(&'a str); | ||
|
||
impl Drop for PrintOnDrop<'_> { | ||
fn drop() {} //~ ERROR method `drop` has a `&mut self` declaration in the trait | ||
} | ||
|
||
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,11 @@ | ||
error[E0186]: method `drop` has a `&mut self` declaration in the trait, but not in the impl | ||
--> $DIR/recursion-check-on-erroneous-impl.rs:8:5 | ||
| | ||
LL | fn drop() {} | ||
| ^^^^^^^^^ expected `&mut self` in impl | ||
| | ||
= note: `drop` from trait: `fn(&mut Self)` | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0186`. |