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#109347 - cjgillot:issue-109305, r=WaffleLapkin
Skip no_mangle if the item has no name. Fixes rust-lang#109305
- Loading branch information
Showing
3 changed files
with
65 additions
and
69 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Check that we do not ICE when `no_mangle` is applied to something that has no name. | ||
|
||
#![crate_type = "lib"] | ||
#![feature(stmt_expr_attributes)] | ||
|
||
pub struct S([usize; 8]); | ||
|
||
pub fn outer_function(x: S, y: S) -> usize { | ||
(#[no_mangle] || y.0[0])() | ||
//~^ ERROR `#[no_mangle]` cannot be used on a closure as it has no name | ||
} |
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: `#[no_mangle]` cannot be used on a closure as it has no name | ||
--> $DIR/no-mangle-closure.rs:9:6 | ||
| | ||
LL | (#[no_mangle] || y.0[0])() | ||
| ^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|