diff options
| author | Kivooeo <Kivooeo123@gmail.com> | 2025-06-06 23:29:49 +0500 |
|---|---|---|
| committer | Kivooeo <Kivooeo123@gmail.com> | 2025-06-08 01:14:05 +0500 |
| commit | 3380a91f5baccd551fffd8a1f5dc1fa3d23e5b5e (patch) | |
| tree | c25f3ede999eee510a8ccc4a0be5225c71210b9c | |
| parent | c57119b9a1c86968188bb9703a7859c17f8bc71c (diff) | |
| download | rust-3380a91f5baccd551fffd8a1f5dc1fa3d23e5b5e.tar.gz rust-3380a91f5baccd551fffd8a1f5dc1fa3d23e5b5e.zip | |
cleaned up some tests
| -rw-r--r-- | tests/ui/attributes/crate-name-attr-validation.rs (renamed from tests/ui/crate-name-attr-used.rs) | 2 | ||||
| -rw-r--r-- | tests/ui/complex.rs | 38 | ||||
| -rw-r--r-- | tests/ui/constructor-lifetime-args.rs | 26 | ||||
| -rw-r--r-- | tests/ui/cross-crate/auxiliary/method_reexport_aux.rs (renamed from tests/ui/auxiliary/crate-method-reexport-grrrrrrr2.rs) | 4 | ||||
| -rw-r--r-- | tests/ui/cross-crate/cross-crate-method-reexport.rs (renamed from tests/ui/crate-method-reexport-grrrrrrr.rs) | 8 | ||||
| -rw-r--r-- | tests/ui/diagnostic-width/impl-trait-invalid-iterator-error.rs (renamed from tests/ui/conservative_impl_trait.rs) | 2 | ||||
| -rw-r--r-- | tests/ui/diagnostic-width/impl-trait-invalid-iterator-error.stderr (renamed from tests/ui/conservative_impl_trait.stderr) | 2 | ||||
| -rw-r--r-- | tests/ui/imports/global-path-resolution-drop.rs (renamed from tests/ui/crate-leading-sep.rs) | 2 | ||||
| -rw-r--r-- | tests/ui/lifetimes/constructor-lifetime-early-binding-error.rs | 22 | ||||
| -rw-r--r-- | tests/ui/lifetimes/constructor-lifetime-early-binding-error.stderr (renamed from tests/ui/constructor-lifetime-args.stderr) | 16 | ||||
| -rw-r--r-- | tests/ui/linking/crate-type-invalid-flag-error.rs (renamed from tests/ui/crate_type_flag.rs) | 2 | ||||
| -rw-r--r-- | tests/ui/linking/crate-type-invalid-flag-error.stderr (renamed from tests/ui/crate_type_flag.stderr) | 0 |
12 files changed, 45 insertions, 79 deletions
diff --git a/tests/ui/crate-name-attr-used.rs b/tests/ui/attributes/crate-name-attr-validation.rs index 5d5a58c32c7..e27893c3d25 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 d1da9d189ca..00000000000 --- 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 f5802e7d8b1..00000000000 --- 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::<ARGS>` is interpreted kinda like an associated item `S::<ARGS>::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 index 06413e13526..7579f033dc6 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 index aca399f4e20..e9eab99e214 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 index b7f795eadb7..05588932395 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<Item = &u32> { //~^ 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 index eecdb6f9266..0146fa7a28b 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<Item = &u32> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not an iterator diff --git a/tests/ui/crate-leading-sep.rs b/tests/ui/imports/global-path-resolution-drop.rs index 6f4dd0bcfd7..29a6afa10c9 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 00000000000..2d5a444a942 --- /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 index d3759f4b365..94699a3509b 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 index 03bea3638e1..3f84184c989 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 index 26a3e1fbd68..26a3e1fbd68 100644 --- a/tests/ui/crate_type_flag.stderr +++ b/tests/ui/linking/crate-type-invalid-flag-error.stderr |
