Rollup merge of #142132 - Kivooeo:tf6, r=workingjubilee

`tests/ui`: A New Order [6/N]

> [!NOTE]
>
> Intermediate commits are intended to help review, but will be squashed prior to merge.

Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895.

r? `````@jieyouxu`````

auxiliary tag means some changes in realted auxiliary file for test
This commit is contained in:
Jubilee 2025-06-08 17:17:55 -07:00 committed by GitHub
commit a5b8a45f01
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 45 additions and 79 deletions

View file

@ -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

View file

@ -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);
}

View file

@ -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
}

View file

@ -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;

View file

@ -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 = ();

View file

@ -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

View file

@ -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

View file

@ -1,3 +1,5 @@
//! Checks global path resolution of `mem::drop` using a leading `::`.
//@ run-pass
#![allow(dropping_copy_types)]

View file

@ -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
}

View file

@ -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> {
| ^ -- --

View file

@ -1,3 +1,5 @@
// Test for #70183 that --crate-type flag display valid value.
//@ compile-flags: --crate-type dynlib
fn main() {}