2011-06-28 14:53:59 -05:00
|
|
|
// These are attributes of the implicit crate. Really this just needs to parse
|
|
|
|
// for completeness since .rs files linked from .rc files support this
|
|
|
|
// notation to specify their module's attributes
|
2015-02-14 04:45:43 -06:00
|
|
|
|
2020-04-19 19:27:28 -05:00
|
|
|
// check-pass
|
2019-06-08 09:42:58 -05:00
|
|
|
|
2019-06-08 03:36:43 -05:00
|
|
|
#![feature(rustc_attrs)]
|
|
|
|
#![rustc_dummy = "val"]
|
|
|
|
#![rustc_dummy = "val"]
|
|
|
|
#![rustc_dummy]
|
|
|
|
#![rustc_dummy(attr5)]
|
2011-06-28 14:53:59 -05:00
|
|
|
|
2013-06-06 02:38:41 -05:00
|
|
|
// These are attributes of the following mod
|
2019-06-08 03:36:43 -05:00
|
|
|
#[rustc_dummy = "val"]
|
|
|
|
#[rustc_dummy = "val"]
|
2013-01-30 17:56:40 -06:00
|
|
|
mod test_first_item_in_file_mod {}
|
2011-06-28 14:53:59 -05:00
|
|
|
|
|
|
|
mod test_single_attr_outer {
|
2019-06-08 03:36:43 -05:00
|
|
|
#[rustc_dummy = "val"]
|
|
|
|
pub static X: isize = 10;
|
2011-06-28 14:53:59 -05:00
|
|
|
|
2019-06-08 03:36:43 -05:00
|
|
|
#[rustc_dummy = "val"]
|
2020-09-01 16:12:52 -05:00
|
|
|
pub fn f() {}
|
2011-06-28 14:53:59 -05:00
|
|
|
|
2019-06-08 03:36:43 -05:00
|
|
|
#[rustc_dummy = "val"]
|
2013-01-30 17:56:40 -06:00
|
|
|
pub mod mod1 {}
|
2011-06-28 14:53:59 -05:00
|
|
|
|
2013-03-05 16:42:58 -06:00
|
|
|
pub mod rustrt {
|
2019-06-08 03:36:43 -05:00
|
|
|
#[rustc_dummy = "val"]
|
2020-09-01 16:12:52 -05:00
|
|
|
extern "C" {}
|
2013-03-05 16:42:58 -06:00
|
|
|
}
|
2011-06-28 14:53:59 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
mod test_multi_attr_outer {
|
2019-06-08 03:36:43 -05:00
|
|
|
#[rustc_dummy = "val"]
|
|
|
|
#[rustc_dummy = "val"]
|
|
|
|
pub static X: isize = 10;
|
2011-06-28 14:53:59 -05:00
|
|
|
|
2019-06-08 03:36:43 -05:00
|
|
|
#[rustc_dummy = "val"]
|
|
|
|
#[rustc_dummy = "val"]
|
2020-09-01 16:12:52 -05:00
|
|
|
pub fn f() {}
|
2011-06-28 14:53:59 -05:00
|
|
|
|
2019-06-08 03:36:43 -05:00
|
|
|
#[rustc_dummy = "val"]
|
|
|
|
#[rustc_dummy = "val"]
|
2013-01-30 17:56:40 -06:00
|
|
|
pub mod mod1 {}
|
2011-06-28 14:53:59 -05:00
|
|
|
|
2013-03-05 16:42:58 -06:00
|
|
|
pub mod rustrt {
|
2019-06-08 03:36:43 -05:00
|
|
|
#[rustc_dummy = "val"]
|
|
|
|
#[rustc_dummy = "val"]
|
2020-09-01 16:12:52 -05:00
|
|
|
extern "C" {}
|
2013-03-05 16:42:58 -06:00
|
|
|
}
|
2011-06-28 14:53:59 -05:00
|
|
|
|
2019-06-08 03:36:43 -05:00
|
|
|
#[rustc_dummy = "val"]
|
|
|
|
#[rustc_dummy = "val"]
|
2020-09-01 16:12:52 -05:00
|
|
|
struct T {
|
|
|
|
x: isize,
|
|
|
|
}
|
2011-06-28 14:53:59 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
mod test_stmt_single_attr_outer {
|
2013-01-30 17:56:40 -06:00
|
|
|
pub fn f() {
|
2019-06-08 03:36:43 -05:00
|
|
|
#[rustc_dummy = "val"]
|
|
|
|
static X: isize = 10;
|
2011-06-28 14:53:59 -05:00
|
|
|
|
2019-06-08 03:36:43 -05:00
|
|
|
#[rustc_dummy = "val"]
|
2020-09-01 16:12:52 -05:00
|
|
|
fn f() {}
|
2011-06-28 14:53:59 -05:00
|
|
|
|
2019-06-08 03:36:43 -05:00
|
|
|
#[rustc_dummy = "val"]
|
2020-09-01 16:12:52 -05:00
|
|
|
mod mod1 {}
|
2011-07-27 07:48:34 -05:00
|
|
|
|
2013-03-05 16:42:58 -06:00
|
|
|
mod rustrt {
|
2019-06-08 03:36:43 -05:00
|
|
|
#[rustc_dummy = "val"]
|
2020-09-01 16:12:52 -05:00
|
|
|
extern "C" {}
|
2011-06-28 14:53:59 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mod test_stmt_multi_attr_outer {
|
2013-01-30 17:56:40 -06:00
|
|
|
pub fn f() {
|
2019-06-08 03:36:43 -05:00
|
|
|
#[rustc_dummy = "val"]
|
|
|
|
#[rustc_dummy = "val"]
|
|
|
|
static X: isize = 10;
|
2011-06-28 14:53:59 -05:00
|
|
|
|
2019-06-08 03:36:43 -05:00
|
|
|
#[rustc_dummy = "val"]
|
|
|
|
#[rustc_dummy = "val"]
|
2020-09-01 16:12:52 -05:00
|
|
|
fn f() {}
|
2011-06-28 14:53:59 -05:00
|
|
|
|
2019-06-08 03:36:43 -05:00
|
|
|
#[rustc_dummy = "val"]
|
|
|
|
#[rustc_dummy = "val"]
|
2020-09-01 16:12:52 -05:00
|
|
|
mod mod1 {}
|
2011-07-27 07:48:34 -05:00
|
|
|
|
2014-06-23 12:01:14 -05:00
|
|
|
mod rustrt {
|
2019-06-08 03:36:43 -05:00
|
|
|
#[rustc_dummy = "val"]
|
|
|
|
#[rustc_dummy = "val"]
|
2020-09-01 16:12:52 -05:00
|
|
|
extern "C" {}
|
2011-06-28 14:53:59 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mod test_attr_inner {
|
2013-01-30 17:56:40 -06:00
|
|
|
pub mod m {
|
2011-06-28 14:53:59 -05:00
|
|
|
// This is an attribute of mod m
|
2019-06-08 03:36:43 -05:00
|
|
|
#![rustc_dummy = "val"]
|
2011-06-28 14:53:59 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mod test_attr_inner_then_outer {
|
2013-01-30 17:56:40 -06:00
|
|
|
pub mod m {
|
2011-06-28 14:53:59 -05:00
|
|
|
// This is an attribute of mod m
|
2019-06-08 03:36:43 -05:00
|
|
|
#![rustc_dummy = "val"]
|
2011-06-28 14:53:59 -05:00
|
|
|
// This is an attribute of fn f
|
2019-06-08 03:36:43 -05:00
|
|
|
#[rustc_dummy = "val"]
|
2020-09-01 16:12:52 -05:00
|
|
|
fn f() {}
|
2011-06-28 14:53:59 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mod test_attr_inner_then_outer_multi {
|
2013-01-30 17:56:40 -06:00
|
|
|
pub mod m {
|
2011-06-28 14:53:59 -05:00
|
|
|
// This is an attribute of mod m
|
2019-06-08 03:36:43 -05:00
|
|
|
#![rustc_dummy = "val"]
|
|
|
|
#![rustc_dummy = "val"]
|
2011-06-28 14:53:59 -05:00
|
|
|
// This is an attribute of fn f
|
2019-06-08 03:36:43 -05:00
|
|
|
#[rustc_dummy = "val"]
|
|
|
|
#[rustc_dummy = "val"]
|
2020-09-01 16:12:52 -05:00
|
|
|
fn f() {}
|
2011-06-28 14:53:59 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mod test_distinguish_syntax_ext {
|
2013-01-30 17:56:40 -06:00
|
|
|
pub fn f() {
|
2013-09-29 21:23:57 -05:00
|
|
|
format!("test{}", "s");
|
2019-06-08 03:36:43 -05:00
|
|
|
#[rustc_dummy = "val"]
|
2020-09-01 16:12:52 -05:00
|
|
|
fn g() {}
|
2011-06-28 14:53:59 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mod test_other_forms {
|
2019-06-08 03:36:43 -05:00
|
|
|
#[rustc_dummy]
|
|
|
|
#[rustc_dummy(word)]
|
|
|
|
#[rustc_dummy(attr(word))]
|
|
|
|
#[rustc_dummy(key1 = "val", key2 = "val", attr)]
|
2020-09-01 16:12:52 -05:00
|
|
|
pub fn f() {}
|
2011-06-28 14:53:59 -05:00
|
|
|
}
|
|
|
|
|
2012-06-26 18:18:37 -05:00
|
|
|
mod test_foreign_items {
|
2013-03-05 16:42:58 -06:00
|
|
|
pub mod rustrt {
|
2020-09-01 16:12:52 -05:00
|
|
|
extern "C" {
|
2019-06-08 03:36:43 -05:00
|
|
|
#![rustc_dummy]
|
2011-07-05 14:38:53 -05:00
|
|
|
|
2019-06-08 03:36:43 -05:00
|
|
|
#[rustc_dummy]
|
2017-10-22 22:01:00 -05:00
|
|
|
fn rust_get_test_int() -> u32;
|
2013-03-05 16:42:58 -06:00
|
|
|
}
|
2011-07-05 14:38:53 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-09 15:23:30 -06:00
|
|
|
// FIXME(#623): - these aren't supported yet
|
2013-10-29 19:47:11 -05:00
|
|
|
/*mod test_literals {
|
2014-04-14 10:30:31 -05:00
|
|
|
#![str = "s"]
|
|
|
|
#![char = 'c']
|
2015-03-25 19:06:52 -05:00
|
|
|
#![isize = 100]
|
|
|
|
#![usize = 100_usize]
|
2014-04-14 10:30:31 -05:00
|
|
|
#![mach_int = 100u32]
|
|
|
|
#![float = 1.0]
|
|
|
|
#![mach_float = 1.0f32]
|
|
|
|
#![nil = ()]
|
|
|
|
#![bool = true]
|
2013-01-30 17:56:40 -06:00
|
|
|
mod m {}
|
2013-10-29 19:47:11 -05:00
|
|
|
}*/
|
2011-07-05 19:01:23 -05:00
|
|
|
|
2012-01-15 19:23:59 -06:00
|
|
|
fn test_fn_inner() {
|
2019-06-08 03:36:43 -05:00
|
|
|
#![rustc_dummy]
|
2012-01-15 19:23:59 -06:00
|
|
|
}
|
|
|
|
|
2019-06-08 03:36:43 -05:00
|
|
|
fn main() {}
|