rust/tests/ui/attributes/codegen_attr_on_required_trait_method.rs
Jonathan Brouwer 8fa10c0ed7
Add regression test for codegen attributes on required trait methods
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-12-13 20:19:20 +01:00

24 lines
656 B
Rust

#![deny(unused_attributes)]
#![feature(linkage)]
#![feature(fn_align)]
trait Test {
#[cold]
//~^ ERROR cannot be used on required trait methods [unused_attributes]
//~| WARN previously accepted
fn method1(&self);
#[link_section = ".text"]
//~^ ERROR cannot be used on required trait methods [unused_attributes]
//~| WARN previously accepted
fn method2(&self);
#[linkage = "common"]
//~^ ERROR cannot be used on required trait methods [unused_attributes]
//~| WARN previously accepted
fn method3(&self);
#[track_caller]
fn method4(&self);
#[rustc_align(1)]
fn method5(&self);
}
fn main() {}