-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 #83486 - Aaron1011:fix/global-alloc-error, r=petroche…
…nkov Don't ICE when using `#[global_alloc]` on a non-item statement Fixes #83469 We need to return an `Annotatable::Stmt` if we were passed an `Annotatable::Stmt`
- Loading branch information
Showing
3 changed files
with
34 additions
and
16 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
10 changes: 10 additions & 0 deletions
10
src/test/ui/proc-macro/issue-83469-global-alloc-invalid-stmt.rs
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,10 @@ | ||
// Regression test for issue #83469 | ||
// Ensures that we recover from `#[global_alloc]` on an invalid | ||
// stmt without an ICE | ||
|
||
fn outer() { | ||
#[global_allocator] | ||
fn inner() {} //~ ERROR allocators must be statics | ||
} | ||
|
||
fn main() {} |
8 changes: 8 additions & 0 deletions
8
src/test/ui/proc-macro/issue-83469-global-alloc-invalid-stmt.stderr
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,8 @@ | ||
error: allocators must be statics | ||
--> $DIR/issue-83469-global-alloc-invalid-stmt.rs:7:5 | ||
| | ||
LL | fn inner() {} | ||
| ^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|