2019-02-24 08:59:58 -06:00
|
|
|
//! Check that we correctly lint procedural macros.
|
|
|
|
|
2019-10-18 08:54:25 -05:00
|
|
|
extern crate proc_macro;
|
|
|
|
|
|
|
|
use proc_macro::TokenStream;
|
|
|
|
|
2019-02-24 08:59:58 -06:00
|
|
|
#[allow(dead_code)]
|
|
|
|
fn f() {
|
|
|
|
let _x = 3.14;
|
2023-07-28 14:35:48 -05:00
|
|
|
//~^ ERROR: approximate value of `f{32, 64}::consts::PI` found
|
2019-02-24 08:59:58 -06:00
|
|
|
}
|
2019-10-18 08:54:25 -05:00
|
|
|
|
|
|
|
#[proc_macro]
|
|
|
|
pub fn mybangmacro(t: TokenStream) -> TokenStream {
|
|
|
|
t
|
|
|
|
}
|
|
|
|
|
|
|
|
#[proc_macro_derive(MyDerivedTrait)]
|
|
|
|
pub fn myderive(t: TokenStream) -> TokenStream {
|
|
|
|
t
|
|
|
|
}
|
|
|
|
|
|
|
|
#[proc_macro_attribute]
|
|
|
|
pub fn myattribute(t: TokenStream, a: TokenStream) -> TokenStream {
|
|
|
|
t
|
|
|
|
}
|