rust/tests/ui/attributes/linkage.rs
Jonathan Brouwer 4bb7bf64e0
Update uitests
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-14 18:18:42 +02:00

43 lines
783 B
Rust

#![feature(linkage)]
#![feature(stmt_expr_attributes)]
#![deny(unused_attributes)]
#![allow(dead_code)]
#[linkage = "weak"] //~ ERROR attribute cannot be used on
type InvalidTy = ();
#[linkage = "weak"] //~ ERROR attribute cannot be used on
mod invalid_module {}
#[linkage = "weak"] //~ ERROR attribute cannot be used on
struct F;
#[linkage = "weak"] //~ ERROR attribute cannot be used on
impl F {
#[linkage = "weak"]
fn valid(&self) {}
}
#[linkage = "weak"]
fn f() {
#[linkage = "weak"]
{
1
};
//~^^^^ ERROR attribute cannot be used on
}
extern "C" {
#[linkage = "weak"]
static A: *const ();
#[linkage = "weak"]
fn bar();
}
fn main() {
let _ = #[linkage = "weak"]
(|| 1);
//~^^ ERROR attribute cannot be used on
}