Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions tests/ui/attributes/positions/link-section.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//! Checks that `link_section` cannot be used on foreign statics.
#![crate_type = "lib"]

//@ edition:2024
//@ check-pass
// Regression test for <https://github.com/rust-lang/rust/issues/136220>.
unsafe extern "C" {
#[unsafe(link_section = "__DATA,__buffer")] //~ WARN attribute cannot be used on foreign statics
//~| WARN previously accepted
pub static mut a: [u8; 1024];
}
12 changes: 12 additions & 0 deletions tests/ui/attributes/positions/link-section.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
warning: the `link_section` attribute cannot be used on foreign statics
--> $DIR/link-section.rs:8:14
|
LL | #[unsafe(link_section = "__DATA,__buffer")]
| ^^^^^^^^^^^^
|
= help: the `link_section` attribute can be applied to functions and statics
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: requested on the command line with `-W unused-attributes`

warning: 1 warning emitted

Loading