Move some run-pass attribute tests to ui

This commit is contained in:
Vadim Petrochenkov 2019-06-08 17:42:58 +03:00
parent 6a66491883
commit 8e8ab49bca
14 changed files with 10 additions and 8 deletions

View file

@ -0,0 +1,10 @@
// compile-pass
// pretty-expanded FIXME #23616
#![feature(rustc_attrs)]
#![feature(test)]
#[rustc_dummy = "bar"]
extern crate test;
fn main() {}

View file

@ -0,0 +1,12 @@
// compile-pass
// pretty-expanded FIXME #23616
#![feature(rustc_attrs)]
#![feature(test)]
mod m {
#[rustc_dummy = "bar"]
extern crate test;
}
fn main() {}

View file

@ -0,0 +1,11 @@
// compile-pass
// pretty-expanded FIXME #23616
#![feature(rustc_attrs)]
#[rustc_dummy(bar)]
mod foo {
#![feature(globs)]
}
fn main() {}

View file

@ -0,0 +1,19 @@
// compile-pass
// pp-exact - Make sure we actually print the attributes
#![feature(rustc_attrs)]
struct Cat {
name: String,
}
impl Drop for Cat {
#[rustc_dummy]
fn drop(&mut self) { println!("{} landed on hir feet" , self . name); }
}
#[rustc_dummy]
fn cat(name: String) -> Cat { Cat{name: name,} }
fn main() { let _kitty = cat("Spotty".to_string()); }

View file

@ -0,0 +1,31 @@
// compile-pass
#![feature(rustc_attrs)]
struct Cat {
name: String,
}
impl Drop for Cat {
#[rustc_dummy]
/**
Actually, cats don't always land on their feet when you drop them.
*/
fn drop(&mut self) {
println!("{} landed on hir feet", self.name);
}
}
#[rustc_dummy]
/**
Maybe it should technically be a kitten_maker.
*/
fn cat(name: String) -> Cat {
Cat {
name: name
}
}
fn main() {
let _kitty = cat("Spotty".to_string());
}

View file

@ -0,0 +1,181 @@
// 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
// compile-pass
#![feature(rustc_attrs)]
#![rustc_dummy = "val"]
#![rustc_dummy = "val"]
#![rustc_dummy]
#![rustc_dummy(attr5)]
#![crate_id="foobar#0.1"]
// These are attributes of the following mod
#[rustc_dummy = "val"]
#[rustc_dummy = "val"]
mod test_first_item_in_file_mod {}
mod test_single_attr_outer {
#[rustc_dummy = "val"]
pub static X: isize = 10;
#[rustc_dummy = "val"]
pub fn f() { }
#[rustc_dummy = "val"]
pub mod mod1 {}
pub mod rustrt {
#[rustc_dummy = "val"]
extern {}
}
}
mod test_multi_attr_outer {
#[rustc_dummy = "val"]
#[rustc_dummy = "val"]
pub static X: isize = 10;
#[rustc_dummy = "val"]
#[rustc_dummy = "val"]
pub fn f() { }
#[rustc_dummy = "val"]
#[rustc_dummy = "val"]
pub mod mod1 {}
pub mod rustrt {
#[rustc_dummy = "val"]
#[rustc_dummy = "val"]
extern {}
}
#[rustc_dummy = "val"]
#[rustc_dummy = "val"]
struct T {x: isize}
}
mod test_stmt_single_attr_outer {
pub fn f() {
#[rustc_dummy = "val"]
static X: isize = 10;
#[rustc_dummy = "val"]
fn f() { }
#[rustc_dummy = "val"]
mod mod1 {
}
mod rustrt {
#[rustc_dummy = "val"]
extern {
}
}
}
}
mod test_stmt_multi_attr_outer {
pub fn f() {
#[rustc_dummy = "val"]
#[rustc_dummy = "val"]
static X: isize = 10;
#[rustc_dummy = "val"]
#[rustc_dummy = "val"]
fn f() { }
#[rustc_dummy = "val"]
#[rustc_dummy = "val"]
mod mod1 {
}
mod rustrt {
#[rustc_dummy = "val"]
#[rustc_dummy = "val"]
extern {
}
}
}
}
mod test_attr_inner {
pub mod m {
// This is an attribute of mod m
#![rustc_dummy = "val"]
}
}
mod test_attr_inner_then_outer {
pub mod m {
// This is an attribute of mod m
#![rustc_dummy = "val"]
// This is an attribute of fn f
#[rustc_dummy = "val"]
fn f() { }
}
}
mod test_attr_inner_then_outer_multi {
pub mod m {
// This is an attribute of mod m
#![rustc_dummy = "val"]
#![rustc_dummy = "val"]
// This is an attribute of fn f
#[rustc_dummy = "val"]
#[rustc_dummy = "val"]
fn f() { }
}
}
mod test_distinguish_syntax_ext {
pub fn f() {
format!("test{}", "s");
#[rustc_dummy = "val"]
fn g() { }
}
}
mod test_other_forms {
#[rustc_dummy]
#[rustc_dummy(word)]
#[rustc_dummy(attr(word))]
#[rustc_dummy(key1 = "val", key2 = "val", attr)]
pub fn f() { }
}
mod test_foreign_items {
pub mod rustrt {
extern {
#![rustc_dummy]
#[rustc_dummy]
fn rust_get_test_int() -> u32;
}
}
}
// FIXME(#623): - these aren't supported yet
/*mod test_literals {
#![str = "s"]
#![char = 'c']
#![isize = 100]
#![usize = 100_usize]
#![mach_int = 100u32]
#![float = 1.0]
#![mach_float = 1.0f32]
#![nil = ()]
#![bool = true]
mod m {}
}*/
fn test_fn_inner() {
#![rustc_dummy]
}
fn main() {}

View file

@ -0,0 +1,28 @@
// compile-pass
// pp-exact - Make sure we print all the attributes
// pretty-expanded FIXME #23616
#![feature(rustc_attrs)]
#[rustc_dummy]
trait Frobable {
#[rustc_dummy]
fn frob(&self);
#[rustc_dummy]
fn defrob(&self);
}
#[rustc_dummy]
impl Frobable for isize {
#[rustc_dummy]
fn frob(&self) {
#![rustc_dummy]
}
#[rustc_dummy]
fn defrob(&self) {
#![rustc_dummy]
}
}
fn main() {}

View file

@ -0,0 +1,37 @@
// compile-pass
// pp-exact - Make sure we actually print the attributes
// pretty-expanded FIXME #23616
#![allow(non_camel_case_types)]
#![feature(rustc_attrs)]
enum crew_of_enterprise_d {
#[rustc_dummy]
jean_luc_picard,
#[rustc_dummy]
william_t_riker,
#[rustc_dummy]
beverly_crusher,
#[rustc_dummy]
deanna_troi,
#[rustc_dummy]
data,
#[rustc_dummy]
worf,
#[rustc_dummy]
geordi_la_forge,
}
fn boldly_go(_crew_member: crew_of_enterprise_d, _where: String) { }
fn main() {
boldly_go(crew_of_enterprise_d::worf,
"where no one has gone before".to_string());
}