diff --git a/tests/ui/crate-name-attr-used.rs b/tests/ui/attributes/crate-name-attr-validation.rs similarity index 68% rename from tests/ui/crate-name-attr-used.rs rename to tests/ui/attributes/crate-name-attr-validation.rs index 5d5a58c32c799..e27893c3d25b4 100644 --- a/tests/ui/crate-name-attr-used.rs +++ b/tests/ui/attributes/crate-name-attr-validation.rs @@ -1,3 +1,5 @@ +//! Checks proper validation of the `#![crate_name]` attribute. + //@ run-pass //@ compile-flags:--crate-name crate_name_attr_used -F unused-attributes diff --git a/tests/ui/complex.rs b/tests/ui/complex.rs deleted file mode 100644 index d1da9d189ca12..0000000000000 --- a/tests/ui/complex.rs +++ /dev/null @@ -1,38 +0,0 @@ -//@ run-pass - -#![allow(unconditional_recursion)] -#![allow(non_camel_case_types)] -#![allow(dead_code)] -#![allow(unused_mut)] - - - -type t = isize; - -fn nothing() { } - -fn putstr(_s: String) { } - -fn putint(_i: isize) { - let mut i: isize = 33; - while i < 36 { putstr("hi".to_string()); i = i + 1; } -} - -fn zerg(i: isize) -> isize { return i; } - -fn foo(x: isize) -> isize { - let mut y: t = x + 2; - putstr("hello".to_string()); - while y < 10 { putint(y); if y * 3 == 4 { y = y + 2; nothing(); } } - let mut z: t; - z = 0x55; - foo(z); - return 0; -} - -pub fn main() { - let x: isize = 2 + 2; - println!("{}", x); - println!("hello, world"); - println!("{}", 10); -} diff --git a/tests/ui/constructor-lifetime-args.rs b/tests/ui/constructor-lifetime-args.rs deleted file mode 100644 index f5802e7d8b118..0000000000000 --- a/tests/ui/constructor-lifetime-args.rs +++ /dev/null @@ -1,26 +0,0 @@ -// All lifetime parameters in struct constructors are currently considered early bound, -// i.e., `S::` is interpreted kinda like an associated item `S::::ctor`. -// This behavior is a bit weird, because if equivalent constructor were written manually -// it would get late bound lifetime parameters. -// Variant constructors behave in the same way, lifetime parameters are considered -// belonging to the enum and being early bound. -// https://github.com/rust-lang/rust/issues/30904 - -struct S<'a, 'b>(&'a u8, &'b u8); -enum E<'a, 'b> { - V(&'a u8), - U(&'b u8), -} - -fn main() { - S(&0, &0); // OK - S::<'static>(&0, &0); - //~^ ERROR struct takes 2 lifetime arguments - S::<'static, 'static, 'static>(&0, &0); - //~^ ERROR struct takes 2 lifetime arguments - E::V(&0); // OK - E::V::<'static>(&0); - //~^ ERROR enum takes 2 lifetime arguments - E::V::<'static, 'static, 'static>(&0); - //~^ ERROR enum takes 2 lifetime arguments -} diff --git a/tests/ui/auxiliary/crate-method-reexport-grrrrrrr2.rs b/tests/ui/cross-crate/auxiliary/method_reexport_aux.rs similarity index 79% rename from tests/ui/auxiliary/crate-method-reexport-grrrrrrr2.rs rename to tests/ui/cross-crate/auxiliary/method_reexport_aux.rs index 06413e13526ec..7579f033dc6d1 100644 --- a/tests/ui/auxiliary/crate-method-reexport-grrrrrrr2.rs +++ b/tests/ui/cross-crate/auxiliary/method_reexport_aux.rs @@ -1,4 +1,6 @@ -#![crate_name="crate_method_reexport_grrrrrrr2"] +//! Used by `tests/ui/cross-crate/cross-crate-method-reexport.rs` + +#![crate_name="method_reexport_aux"] pub use name_pool::add; diff --git a/tests/ui/crate-method-reexport-grrrrrrr.rs b/tests/ui/cross-crate/cross-crate-method-reexport.rs similarity index 56% rename from tests/ui/crate-method-reexport-grrrrrrr.rs rename to tests/ui/cross-crate/cross-crate-method-reexport.rs index aca399f4e2090..e9eab99e21453 100644 --- a/tests/ui/crate-method-reexport-grrrrrrr.rs +++ b/tests/ui/cross-crate/cross-crate-method-reexport.rs @@ -4,13 +4,13 @@ // name_pool::methods impl in the other crate is reachable from this // crate. -//@ aux-build:crate-method-reexport-grrrrrrr2.rs +//@ aux-build:method_reexport_aux.rs -extern crate crate_method_reexport_grrrrrrr2; +extern crate method_reexport_aux; pub fn main() { - use crate_method_reexport_grrrrrrr2::rust::add; - use crate_method_reexport_grrrrrrr2::rust::cx; + use method_reexport_aux::rust::add; + use method_reexport_aux::rust::cx; let x: Box<_> = Box::new(()); x.cx(); let y = (); diff --git a/tests/ui/conservative_impl_trait.rs b/tests/ui/diagnostic-width/impl-trait-invalid-iterator-error.rs similarity index 79% rename from tests/ui/conservative_impl_trait.rs rename to tests/ui/diagnostic-width/impl-trait-invalid-iterator-error.rs index b7f795eadb760..055889323952d 100644 --- a/tests/ui/conservative_impl_trait.rs +++ b/tests/ui/diagnostic-width/impl-trait-invalid-iterator-error.rs @@ -1,4 +1,4 @@ -// #39872, #39553 +//! Test for #39872 and #39553 fn will_ice(something: &u32) -> impl Iterator { //~^ ERROR `()` is not an iterator diff --git a/tests/ui/conservative_impl_trait.stderr b/tests/ui/diagnostic-width/impl-trait-invalid-iterator-error.stderr similarity index 87% rename from tests/ui/conservative_impl_trait.stderr rename to tests/ui/diagnostic-width/impl-trait-invalid-iterator-error.stderr index eecdb6f92667c..0146fa7a28b4d 100644 --- a/tests/ui/conservative_impl_trait.stderr +++ b/tests/ui/diagnostic-width/impl-trait-invalid-iterator-error.stderr @@ -1,5 +1,5 @@ error[E0277]: `()` is not an iterator - --> $DIR/conservative_impl_trait.rs:3:33 + --> $DIR/impl-trait-invalid-iterator-error.rs:3:33 | LL | fn will_ice(something: &u32) -> impl Iterator { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not an iterator diff --git a/tests/ui/crate-leading-sep.rs b/tests/ui/imports/global-path-resolution-drop.rs similarity index 59% rename from tests/ui/crate-leading-sep.rs rename to tests/ui/imports/global-path-resolution-drop.rs index 6f4dd0bcfd7f1..29a6afa10c96f 100644 --- a/tests/ui/crate-leading-sep.rs +++ b/tests/ui/imports/global-path-resolution-drop.rs @@ -1,3 +1,5 @@ +//! Checks global path resolution of `mem::drop` using a leading `::`. + //@ run-pass #![allow(dropping_copy_types)] diff --git a/tests/ui/lifetimes/constructor-lifetime-early-binding-error.rs b/tests/ui/lifetimes/constructor-lifetime-early-binding-error.rs new file mode 100644 index 0000000000000..2d5a444a942d5 --- /dev/null +++ b/tests/ui/lifetimes/constructor-lifetime-early-binding-error.rs @@ -0,0 +1,22 @@ +//! Tests that all lifetime parameters in struct (`S`) and enum (`E`) constructors are +//! treated as early bound, similar to associated items, rather than late bound as in manual +//! constructors. + +struct S<'a, 'b>(&'a u8, &'b u8); +enum E<'a, 'b> { + V(&'a u8), + U(&'b u8), +} + +fn main() { + S(&0, &0); // OK + S::<'static>(&0, &0); + //~^ ERROR struct takes 2 lifetime arguments + S::<'static, 'static, 'static>(&0, &0); + //~^ ERROR struct takes 2 lifetime arguments + E::V(&0); // OK + E::V::<'static>(&0); + //~^ ERROR enum takes 2 lifetime arguments + E::V::<'static, 'static, 'static>(&0); + //~^ ERROR enum takes 2 lifetime arguments +} diff --git a/tests/ui/constructor-lifetime-args.stderr b/tests/ui/lifetimes/constructor-lifetime-early-binding-error.stderr similarity index 79% rename from tests/ui/constructor-lifetime-args.stderr rename to tests/ui/lifetimes/constructor-lifetime-early-binding-error.stderr index d3759f4b3658e..94699a3509b5b 100644 --- a/tests/ui/constructor-lifetime-args.stderr +++ b/tests/ui/lifetimes/constructor-lifetime-early-binding-error.stderr @@ -1,5 +1,5 @@ error[E0107]: struct takes 2 lifetime arguments but 1 lifetime argument was supplied - --> $DIR/constructor-lifetime-args.rs:17:5 + --> $DIR/constructor-lifetime-early-binding-error.rs:13:5 | LL | S::<'static>(&0, &0); | ^ ------- supplied 1 lifetime argument @@ -7,7 +7,7 @@ LL | S::<'static>(&0, &0); | expected 2 lifetime arguments | note: struct defined here, with 2 lifetime parameters: `'a`, `'b` - --> $DIR/constructor-lifetime-args.rs:9:8 + --> $DIR/constructor-lifetime-early-binding-error.rs:5:8 | LL | struct S<'a, 'b>(&'a u8, &'b u8); | ^ -- -- @@ -17,7 +17,7 @@ LL | S::<'static, 'static>(&0, &0); | +++++++++ error[E0107]: struct takes 2 lifetime arguments but 3 lifetime arguments were supplied - --> $DIR/constructor-lifetime-args.rs:19:5 + --> $DIR/constructor-lifetime-early-binding-error.rs:15:5 | LL | S::<'static, 'static, 'static>(&0, &0); | ^ --------- help: remove the lifetime argument @@ -25,13 +25,13 @@ LL | S::<'static, 'static, 'static>(&0, &0); | expected 2 lifetime arguments | note: struct defined here, with 2 lifetime parameters: `'a`, `'b` - --> $DIR/constructor-lifetime-args.rs:9:8 + --> $DIR/constructor-lifetime-early-binding-error.rs:5:8 | LL | struct S<'a, 'b>(&'a u8, &'b u8); | ^ -- -- error[E0107]: enum takes 2 lifetime arguments but 1 lifetime argument was supplied - --> $DIR/constructor-lifetime-args.rs:22:8 + --> $DIR/constructor-lifetime-early-binding-error.rs:18:8 | LL | E::V::<'static>(&0); | ^ ------- supplied 1 lifetime argument @@ -39,7 +39,7 @@ LL | E::V::<'static>(&0); | expected 2 lifetime arguments | note: enum defined here, with 2 lifetime parameters: `'a`, `'b` - --> $DIR/constructor-lifetime-args.rs:10:6 + --> $DIR/constructor-lifetime-early-binding-error.rs:6:6 | LL | enum E<'a, 'b> { | ^ -- -- @@ -49,7 +49,7 @@ LL | E::V::<'static, 'static>(&0); | +++++++++ error[E0107]: enum takes 2 lifetime arguments but 3 lifetime arguments were supplied - --> $DIR/constructor-lifetime-args.rs:24:8 + --> $DIR/constructor-lifetime-early-binding-error.rs:20:8 | LL | E::V::<'static, 'static, 'static>(&0); | ^ --------- help: remove the lifetime argument @@ -57,7 +57,7 @@ LL | E::V::<'static, 'static, 'static>(&0); | expected 2 lifetime arguments | note: enum defined here, with 2 lifetime parameters: `'a`, `'b` - --> $DIR/constructor-lifetime-args.rs:10:6 + --> $DIR/constructor-lifetime-early-binding-error.rs:6:6 | LL | enum E<'a, 'b> { | ^ -- -- diff --git a/tests/ui/crate_type_flag.rs b/tests/ui/linking/crate-type-invalid-flag-error.rs similarity index 59% rename from tests/ui/crate_type_flag.rs rename to tests/ui/linking/crate-type-invalid-flag-error.rs index 03bea3638e1af..3f84184c989ac 100644 --- a/tests/ui/crate_type_flag.rs +++ b/tests/ui/linking/crate-type-invalid-flag-error.rs @@ -1,3 +1,5 @@ +// Test for #70183 that --crate-type flag display valid value. + //@ compile-flags: --crate-type dynlib fn main() {} diff --git a/tests/ui/crate_type_flag.stderr b/tests/ui/linking/crate-type-invalid-flag-error.stderr similarity index 100% rename from tests/ui/crate_type_flag.stderr rename to tests/ui/linking/crate-type-invalid-flag-error.stderr