diff --git a/tests/ui/type-param-constraints.rs b/tests/ui/auto-traits/auto-traits-type-parameter.rs similarity index 59% rename from tests/ui/type-param-constraints.rs rename to tests/ui/auto-traits/auto-traits-type-parameter.rs index 83d81c0d833f1..710be5404263b 100644 --- a/tests/ui/type-param-constraints.rs +++ b/tests/ui/auto-traits/auto-traits-type-parameter.rs @@ -1,24 +1,25 @@ +//! Checks how type parameters interact with auto-traits like `Send` and `Sync` with implicit, +//! bounds + //@ run-pass #![allow(non_camel_case_types)] #![allow(dead_code)] -fn p_foo(_pinned: T) { } -fn s_foo(_shared: T) { } -fn u_foo(_unique: T) { } +fn p_foo(_pinned: T) {} +fn s_foo(_shared: T) {} +fn u_foo(_unique: T) {} struct r { - i: isize, + i: isize, } impl Drop for r { fn drop(&mut self) {} } -fn r(i:isize) -> r { - r { - i: i - } +fn r(i: isize) -> r { + r { i } } pub fn main() { diff --git a/tests/ui/consts/const-eval-array-len-in-impl.rs b/tests/ui/consts/const-eval-array-len-in-impl.rs new file mode 100644 index 0000000000000..0373274770de5 --- /dev/null +++ b/tests/ui/consts/const-eval-array-len-in-impl.rs @@ -0,0 +1,15 @@ +//! This checks that compiler correctly evaluate constant array lengths within trait `impl` headers. +//! +//! Regression test for . + +trait Foo { + fn foo(); +} + +impl Foo for [(); 1] { + fn foo() {} +} + +fn main() { + <[(); 0] as Foo>::foo() //~ ERROR E0277 +} diff --git a/tests/ui/unevaluated_fixed_size_array_len.stderr b/tests/ui/consts/const-eval-array-len-in-impl.stderr similarity index 86% rename from tests/ui/unevaluated_fixed_size_array_len.stderr rename to tests/ui/consts/const-eval-array-len-in-impl.stderr index 43cc377006e0e..faff7aa3ff7a7 100644 --- a/tests/ui/unevaluated_fixed_size_array_len.stderr +++ b/tests/ui/consts/const-eval-array-len-in-impl.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `[(); 0]: Foo` is not satisfied - --> $DIR/unevaluated_fixed_size_array_len.rs:12:6 + --> $DIR/const-eval-array-len-in-impl.rs:14:6 | LL | <[(); 0] as Foo>::foo() | ^^^^^^^ the trait `Foo` is not implemented for `[(); 0]` diff --git a/tests/ui/typestate-multi-decl.rs b/tests/ui/destructuring-assignment/let-binding-tuple-destructuring.rs similarity index 51% rename from tests/ui/typestate-multi-decl.rs rename to tests/ui/destructuring-assignment/let-binding-tuple-destructuring.rs index 3d0e79632bb33..f62fae8621934 100644 --- a/tests/ui/typestate-multi-decl.rs +++ b/tests/ui/destructuring-assignment/let-binding-tuple-destructuring.rs @@ -1,3 +1,5 @@ +//! Checks basic multiple variable declaration using tuple destructuring in a `let` binding. + //@ run-pass pub fn main() { diff --git a/tests/ui/type-id-higher-rank-2.rs b/tests/ui/lifetimes/any-lifetime-escape-higher-rank.rs similarity index 76% rename from tests/ui/type-id-higher-rank-2.rs rename to tests/ui/lifetimes/any-lifetime-escape-higher-rank.rs index 7b0c7b5394084..f9f38ee532d9d 100644 --- a/tests/ui/type-id-higher-rank-2.rs +++ b/tests/ui/lifetimes/any-lifetime-escape-higher-rank.rs @@ -1,11 +1,15 @@ +//! Checks that `std::any::Any` cannot be used to circumvent lifetime rules +//! with higher-rank types. + //@ run-pass -// Test that we can't ignore lifetimes by going through Any. use std::any::Any; struct Foo<'a>(&'a str); -fn good(s: &String) -> Foo<'_> { Foo(s) } +fn good(s: &String) -> Foo<'_> { + Foo(s) +} fn bad1(s: String) -> Option<&'static str> { let a: Box = Box::new(good as fn(&String) -> Foo); @@ -17,7 +21,9 @@ trait AsStr<'a, 'b> { } impl<'a> AsStr<'a, 'a> for String { - fn get(&'a self) -> &'a str { self } + fn get(&'a self) -> &'a str { + self + } } fn bad2(s: String) -> Option<&'static str> { diff --git a/tests/ui/type_length_limit.rs b/tests/ui/limits/type-length-limit-enforcement.rs similarity index 66% rename from tests/ui/type_length_limit.rs rename to tests/ui/limits/type-length-limit-enforcement.rs index 87f5ffd76d7a6..3b34d6eb5c855 100644 --- a/tests/ui/type_length_limit.rs +++ b/tests/ui/limits/type-length-limit-enforcement.rs @@ -1,17 +1,19 @@ -//@ build-fail +//~ ERROR reached the type-length limit + +//! Checks the enforcement of the type-length limit +//! and its configurability via `#![type_length_limit]`. + //@ compile-flags: -Copt-level=0 -Zenforce-type-length-limit -//~^^ ERROR reached the type-length limit -// Test that the type length limit can be changed. -// The exact type depends on optimizations, so disable them. +//@ build-fail #![allow(dead_code)] -#![type_length_limit="8"] +#![type_length_limit = "8"] macro_rules! link { ($id:ident, $t:ty) => { pub type $id = ($t, $t, $t); - } + }; } link! { A1, B1 } @@ -26,7 +28,7 @@ link! { D, E } link! { E, F } link! { F, G, Option> } -pub struct G(std::marker::PhantomData::<(T, K)>); +pub struct G(std::marker::PhantomData<(T, K)>); fn main() { drop::>(None); diff --git a/tests/ui/type_length_limit.stderr b/tests/ui/limits/type-length-limit-enforcement.stderr similarity index 86% rename from tests/ui/type_length_limit.stderr rename to tests/ui/limits/type-length-limit-enforcement.stderr index 198d133c08c88..516230ae832dc 100644 --- a/tests/ui/type_length_limit.stderr +++ b/tests/ui/limits/type-length-limit-enforcement.stderr @@ -1,11 +1,11 @@ error: reached the type-length limit while instantiating `std::mem::drop::>` - --> $DIR/type_length_limit.rs:32:5 + --> $DIR/type-length-limit-enforcement.rs:34:5 | LL | drop::>(None); | ^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider adding a `#![type_length_limit="4010"]` attribute to your crate - = note: the full type name has been written to '$TEST_BUILD_DIR/type_length_limit.long-type.txt' + = note: the full type name has been written to '$TEST_BUILD_DIR/type-length-limit-enforcement.long-type.txt' error: reached the type-length limit while instantiating `<{closure@rt::lang_start<()>::{closure#0}} as FnMut<()>>::call_mut` | diff --git a/tests/ui/macros/macro-fragment-ident-underscore-error.rs b/tests/ui/macros/macro-fragment-ident-underscore-error.rs new file mode 100644 index 0000000000000..882dd167adc7d --- /dev/null +++ b/tests/ui/macros/macro-fragment-ident-underscore-error.rs @@ -0,0 +1,12 @@ +//! Verifies that the reserved underscore `_` cannot be used as an `ident` fragment specifier +//! within a macro pattern, as it leads to a compilation error. + +macro_rules! identity { + ($i: ident) => { + $i + }; +} + +fn main() { + let identity!(_) = 10; //~ ERROR no rules expected reserved identifier `_` +} diff --git a/tests/ui/underscore-ident-matcher.stderr b/tests/ui/macros/macro-fragment-ident-underscore-error.stderr similarity index 72% rename from tests/ui/underscore-ident-matcher.stderr rename to tests/ui/macros/macro-fragment-ident-underscore-error.stderr index 0c3f980cf6c71..929e4624e4b2e 100644 --- a/tests/ui/underscore-ident-matcher.stderr +++ b/tests/ui/macros/macro-fragment-ident-underscore-error.stderr @@ -1,5 +1,5 @@ error: no rules expected reserved identifier `_` - --> $DIR/underscore-ident-matcher.rs:8:19 + --> $DIR/macro-fragment-ident-underscore-error.rs:11:19 | LL | macro_rules! identity { | --------------------- when calling this macro @@ -8,9 +8,9 @@ LL | let identity!(_) = 10; | ^ no rules expected this token in macro call | note: while trying to match meta-variable `$i:ident` - --> $DIR/underscore-ident-matcher.rs:2:6 + --> $DIR/macro-fragment-ident-underscore-error.rs:5:6 | -LL | ($i: ident) => ( +LL | ($i: ident) => { | ^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/namespace/struct-type-and-function-name-coexistence.rs b/tests/ui/namespace/struct-type-and-function-name-coexistence.rs new file mode 100644 index 0000000000000..8d5ab3781b5c3 --- /dev/null +++ b/tests/ui/namespace/struct-type-and-function-name-coexistence.rs @@ -0,0 +1,14 @@ +//@ run-pass + +struct A { + a: isize, +} + +fn a(a: A) -> isize { + return a.a; +} + +pub fn main() { + let x: A = A { a: 1 }; + assert_eq!(a(x), 1); +} diff --git a/tests/ui/parser/integer-literal-method-call-underscore.rs b/tests/ui/parser/integer-literal-method-call-underscore.rs new file mode 100644 index 0000000000000..9e4abf28cbaa6 --- /dev/null +++ b/tests/ui/parser/integer-literal-method-call-underscore.rs @@ -0,0 +1,15 @@ +//! Checks that methods with names starting with an underscore (`_`) can be +//! successfully called directly on integer literals, confirming the correct +//! parsing of such expressions where the underscore is part of the method identifier. + +//@ run-pass + +trait Tr: Sized { + fn _method_on_numbers(self) {} +} + +impl Tr for i32 {} + +fn main() { + 42._method_on_numbers(); +} diff --git a/tests/ui/ptr_ops/ptr-write-bool-representation.rs b/tests/ui/ptr_ops/ptr-write-bool-representation.rs new file mode 100644 index 0000000000000..3dfc3e51ab298 --- /dev/null +++ b/tests/ui/ptr_ops/ptr-write-bool-representation.rs @@ -0,0 +1,18 @@ +//! Validates the correct behavior of writing a `bool` value using `std::ptr::write`. +//! +//! This test addresses historical concerns regarding the internal representation of `bool` +//! (e.g., as `i1` in LLVM versus its byte-aligned memory layout) and checks that +//! `ptr::write` correctly handles this type without issues, confirming its memory +//! behavior is as expected. + +//@ run-pass + +use std::ptr; + +pub fn main() { + unsafe { + let mut x: bool = false; + // this line breaks it + ptr::write(&mut x, false); + } +} diff --git a/tests/ui/ptr_ops/raw-pointer-type-basic.rs b/tests/ui/ptr_ops/raw-pointer-type-basic.rs new file mode 100644 index 0000000000000..349e8e67909fd --- /dev/null +++ b/tests/ui/ptr_ops/raw-pointer-type-basic.rs @@ -0,0 +1,18 @@ +//! Checks the basic usage of raw pointers (`*const isize`) as function argument and return types. + +//@ run-pass + +#![allow(dead_code)] + +fn f(a: *const isize) -> *const isize { + return a; +} + +fn g(a: *const isize) -> *const isize { + let b = f(a); + return b; +} + +pub fn main() { + return; +} diff --git a/tests/ui/try-operator-hygiene.rs b/tests/ui/try-trait/try-operator-expansion-hygiene.rs similarity index 51% rename from tests/ui/try-operator-hygiene.rs rename to tests/ui/try-trait/try-operator-expansion-hygiene.rs index 20538e094c6d6..bc1f05f5da9c8 100644 --- a/tests/ui/try-operator-hygiene.rs +++ b/tests/ui/try-trait/try-operator-expansion-hygiene.rs @@ -1,16 +1,9 @@ +//! Checks the `?` operator expansion. + //@ run-pass #![allow(non_upper_case_globals)] #![allow(dead_code)] -// `expr?` expands to: -// -// match expr { -// Ok(val) => val, -// Err(err) => return Err(From::from(err)), -// } -// -// This test verifies that the expansion is hygienic, i.e., it's not affected by other `val` and -// `err` bindings that may be in scope. use std::num::ParseIntError; diff --git a/tests/ui/try-operator.rs b/tests/ui/try-trait/try-operator-various-contexts.rs similarity index 86% rename from tests/ui/try-operator.rs rename to tests/ui/try-trait/try-operator-various-contexts.rs index b99782045575f..41c3679c96f6a 100644 --- a/tests/ui/try-operator.rs +++ b/tests/ui/try-trait/try-operator-various-contexts.rs @@ -1,9 +1,11 @@ +//! Checks the functionality of the `?` operator in various syntactic contexts. + //@ run-pass #![allow(dead_code)] use std::fs::File; -use std::io::{Read, self}; +use std::io::{self, Read}; use std::num::ParseIntError; use std::str::FromStr; @@ -35,7 +37,9 @@ fn on_path() -> Result { fn on_macro() -> Result { macro_rules! id { - ($e:expr) => { $e } + ($e:expr) => { + $e + }; } Ok(id!("7".parse::())?) @@ -50,11 +54,14 @@ fn on_parens() -> Result { fn on_block() -> Result { let x = "9".parse::(); - Ok({x}?) + Ok({ x }?) } fn on_field() -> Result { - struct Pair { a: A, b: B } + struct Pair { + a: A, + b: B, + } let x = Pair { a: "10".parse::(), b: 0 }; @@ -89,7 +96,9 @@ fn on_index() -> Result { } fn on_args() -> Result { - fn sub(x: i32, y: i32) -> i32 { x - y } + fn sub(x: i32, y: i32) -> i32 { + x - y + } let x = "20".parse(); let y = "21".parse(); @@ -98,19 +107,11 @@ fn on_args() -> Result { } fn on_if() -> Result { - Ok(if true { - "22".parse::() - } else { - "23".parse::() - }?) + Ok(if true { "22".parse::() } else { "23".parse::() }?) } fn on_if_let() -> Result { - Ok(if let Ok(..) = "24".parse::() { - "25".parse::() - } else { - "26".parse::() - }?) + Ok(if let Ok(..) = "24".parse::() { "25".parse::() } else { "26".parse::() }?) } fn on_match() -> Result { @@ -121,7 +122,9 @@ fn on_match() -> Result { } fn tight_binding() -> Result { - fn ok(x: T) -> Result { Ok(x) } + fn ok(x: T) -> Result { + Ok(x) + } let x = ok(true); Ok(!x?) diff --git a/tests/ui/tydesc-name.rs b/tests/ui/tydesc-name.rs deleted file mode 100644 index 068a42606c2f3..0000000000000 --- a/tests/ui/tydesc-name.rs +++ /dev/null @@ -1,14 +0,0 @@ -//@ run-pass - -#![allow(dead_code)] - -use std::any::type_name; - -struct Foo { - x: T -} - -pub fn main() { - assert_eq!(type_name::(), "isize"); - assert_eq!(type_name::>(), "tydesc_name::Foo"); -} diff --git a/tests/ui/type-inference/type-inference-none-in-generic-ref.rs b/tests/ui/type-inference/type-inference-none-in-generic-ref.rs new file mode 100644 index 0000000000000..9c1b7c19e3da3 --- /dev/null +++ b/tests/ui/type-inference/type-inference-none-in-generic-ref.rs @@ -0,0 +1,9 @@ +//! Checks that unconstrained `None` is rejected through references and generics + +struct S<'a, T: 'a> { + o: &'a Option, +} + +fn main() { + S { o: &None }; //~ ERROR type annotations needed [E0282] +} diff --git a/tests/ui/unconstrained-ref.stderr b/tests/ui/type-inference/type-inference-none-in-generic-ref.stderr similarity index 87% rename from tests/ui/unconstrained-ref.stderr rename to tests/ui/type-inference/type-inference-none-in-generic-ref.stderr index 72fd0202f4e53..d671c189b3730 100644 --- a/tests/ui/unconstrained-ref.stderr +++ b/tests/ui/type-inference/type-inference-none-in-generic-ref.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/unconstrained-ref.rs:6:5 + --> $DIR/type-inference-none-in-generic-ref.rs:8:5 | LL | S { o: &None }; | ^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the struct `S` diff --git a/tests/ui/type-inference/type-inference-unconstrained-none.rs b/tests/ui/type-inference/type-inference-unconstrained-none.rs new file mode 100644 index 0000000000000..38a506763c761 --- /dev/null +++ b/tests/ui/type-inference/type-inference-unconstrained-none.rs @@ -0,0 +1,5 @@ +//! Regression test for . + +fn main() { + None; //~ ERROR type annotations needed [E0282] +} diff --git a/tests/ui/unconstrained-none.stderr b/tests/ui/type-inference/type-inference-unconstrained-none.stderr similarity index 87% rename from tests/ui/unconstrained-none.stderr rename to tests/ui/type-inference/type-inference-unconstrained-none.stderr index 4af6f412e5b22..80572b845e84f 100644 --- a/tests/ui/unconstrained-none.stderr +++ b/tests/ui/type-inference/type-inference-unconstrained-none.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/unconstrained-none.rs:4:5 + --> $DIR/type-inference-unconstrained-none.rs:4:5 | LL | None; | ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option` diff --git a/tests/ui/type-namespace.rs b/tests/ui/type-namespace.rs deleted file mode 100644 index 31dc684a214a7..0000000000000 --- a/tests/ui/type-namespace.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@ run-pass - -struct A { a: isize } - -fn a(a: A) -> isize { return a.a; } - -pub fn main() { let x: A = A {a: 1}; assert_eq!(a(x), 1); } diff --git a/tests/ui/type-ptr.rs b/tests/ui/type-ptr.rs deleted file mode 100644 index 5c8ed344ab33a..0000000000000 --- a/tests/ui/type-ptr.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ run-pass - -#![allow(dead_code)] - -fn f(a: *const isize) -> *const isize { return a; } - -fn g(a: *const isize) -> *const isize { let b = f(a); return b; } - -pub fn main() { return; } diff --git a/tests/ui/type-use-i1-versus-i8.rs b/tests/ui/type-use-i1-versus-i8.rs deleted file mode 100644 index 4eb25329223cf..0000000000000 --- a/tests/ui/type-use-i1-versus-i8.rs +++ /dev/null @@ -1,11 +0,0 @@ -//@ run-pass - -use std::ptr; - -pub fn main() { - unsafe { - let mut x: bool = false; - // this line breaks it - ptr::write(&mut x, false); - } -} diff --git a/tests/ui/auxiliary/typeid-intrinsic-aux1.rs b/tests/ui/type/auxiliary/typeid-consistency-aux1.rs similarity index 100% rename from tests/ui/auxiliary/typeid-intrinsic-aux1.rs rename to tests/ui/type/auxiliary/typeid-consistency-aux1.rs diff --git a/tests/ui/auxiliary/typeid-intrinsic-aux2.rs b/tests/ui/type/auxiliary/typeid-consistency-aux2.rs similarity index 100% rename from tests/ui/auxiliary/typeid-intrinsic-aux2.rs rename to tests/ui/type/auxiliary/typeid-consistency-aux2.rs diff --git a/tests/ui/type/type-name-basic.rs b/tests/ui/type/type-name-basic.rs new file mode 100644 index 0000000000000..9381cb8257811 --- /dev/null +++ b/tests/ui/type/type-name-basic.rs @@ -0,0 +1,17 @@ +//! Checks the basic functionality of `std::any::type_name` for primitive types +//! and simple generic structs. + +//@ run-pass + +#![allow(dead_code)] + +use std::any::type_name; + +struct Foo { + x: T, +} + +pub fn main() { + assert_eq!(type_name::(), "isize"); + assert_eq!(type_name::>(), "type_name_basic::Foo"); +} diff --git a/tests/ui/typeid-intrinsic.rs b/tests/ui/type/typeid-consistency.rs similarity index 85% rename from tests/ui/typeid-intrinsic.rs rename to tests/ui/type/typeid-consistency.rs index 7c4fb3f95a94e..67ee1b6d839ab 100644 --- a/tests/ui/typeid-intrinsic.rs +++ b/tests/ui/type/typeid-consistency.rs @@ -1,16 +1,18 @@ +//! Checks the correctness and consistency of `std::any::TypeId::of`. + //@ run-pass #![allow(deprecated)] -//@ aux-build:typeid-intrinsic-aux1.rs -//@ aux-build:typeid-intrinsic-aux2.rs - #![feature(core_intrinsics)] -extern crate typeid_intrinsic_aux1 as other1; -extern crate typeid_intrinsic_aux2 as other2; +//@ aux-build:typeid-consistency-aux1.rs +//@ aux-build:typeid-consistency-aux2.rs + +extern crate typeid_consistency_aux1 as other1; +extern crate typeid_consistency_aux2 as other2; -use std::hash::{SipHasher, Hasher, Hash}; use std::any::TypeId; +use std::hash::{Hash, Hasher, SipHasher}; struct A; struct Test; @@ -34,7 +36,7 @@ pub fn main() { assert_eq!(TypeId::of::(), other2::id_F()); assert_eq!(TypeId::of::(), other2::id_G()); assert_eq!(TypeId::of::(), other2::id_H()); - assert_eq!(TypeId::of::(), other2::id_I()); + assert_eq!(TypeId::of::(), other2::id_I()); assert_eq!(other1::id_F(), other2::id_F()); assert_eq!(other1::id_G(), other2::id_G()); @@ -49,10 +51,8 @@ pub fn main() { assert_eq!(other2::foo::(), other1::foo::()); // sanity test of TypeId - let (a, b, c) = (TypeId::of::(), TypeId::of::<&'static str>(), - TypeId::of::()); - let (d, e, f) = (TypeId::of::(), TypeId::of::<&'static str>(), - TypeId::of::()); + let (a, b, c) = (TypeId::of::(), TypeId::of::<&'static str>(), TypeId::of::()); + let (d, e, f) = (TypeId::of::(), TypeId::of::<&'static str>(), TypeId::of::()); assert!(a != b); assert!(a != c); @@ -82,10 +82,7 @@ pub fn main() { assert_ne!(TypeId::of::(), TypeId::of::()); // Check fn pointer against collisions - assert_ne!( - TypeId::of:: A) -> A>(), - TypeId::of:: A, A) -> A>() - ); + assert_ne!(TypeId::of:: A) -> A>(), TypeId::of:: A, A) -> A>()); assert_ne!( TypeId::of:: fn(&'a i32) -> &'a i32>(), TypeId::of:: fn(&'a i32) -> &'static i32>() diff --git a/tests/ui/unconstrained-none.rs b/tests/ui/unconstrained-none.rs deleted file mode 100644 index e180b3163d412..0000000000000 --- a/tests/ui/unconstrained-none.rs +++ /dev/null @@ -1,5 +0,0 @@ -// Issue #5062 - -fn main() { - None; //~ ERROR type annotations needed [E0282] -} diff --git a/tests/ui/unconstrained-ref.rs b/tests/ui/unconstrained-ref.rs deleted file mode 100644 index 473ca954b232d..0000000000000 --- a/tests/ui/unconstrained-ref.rs +++ /dev/null @@ -1,7 +0,0 @@ -struct S<'a, T:'a> { - o: &'a Option -} - -fn main() { - S { o: &None }; //~ ERROR type annotations needed [E0282] -} diff --git a/tests/ui/underscore-ident-matcher.rs b/tests/ui/underscore-ident-matcher.rs deleted file mode 100644 index 77ec70d43d54e..0000000000000 --- a/tests/ui/underscore-ident-matcher.rs +++ /dev/null @@ -1,9 +0,0 @@ -macro_rules! identity { - ($i: ident) => ( - $i - ) -} - -fn main() { - let identity!(_) = 10; //~ ERROR no rules expected reserved identifier `_` -} diff --git a/tests/ui/underscore-lifetimes.rs b/tests/ui/underscore-lifetime/basic-underscore-lifetime-elision.rs similarity index 77% rename from tests/ui/underscore-lifetimes.rs rename to tests/ui/underscore-lifetime/basic-underscore-lifetime-elision.rs index a372851f9cfff..a2e3c8e26d4be 100644 --- a/tests/ui/underscore-lifetimes.rs +++ b/tests/ui/underscore-lifetime/basic-underscore-lifetime-elision.rs @@ -1,6 +1,9 @@ +//! Checks the correct usage and behavior of the anonymous lifetime `'_` (underscore lifetime) + //@ run-pass #![allow(dead_code, mismatched_lifetime_syntaxes)] + struct Foo<'a>(&'a u8); fn foo(x: &u8) -> Foo<'_> { @@ -31,8 +34,5 @@ fn main() { let _ = foo2(x); let _ = foo3(x); foo4(Foo(x)); - let _ = foo5(Foo2 { - a: x, - b: &6, - }); + let _ = foo5(Foo2 { a: x, b: &6 }); } diff --git a/tests/ui/underscore-method-after-integer.rs b/tests/ui/underscore-method-after-integer.rs deleted file mode 100644 index d9eb21894e8ca..0000000000000 --- a/tests/ui/underscore-method-after-integer.rs +++ /dev/null @@ -1,11 +0,0 @@ -//@ run-pass - -trait Tr : Sized { - fn _method_on_numbers(self) {} -} - -impl Tr for i32 {} - -fn main() { - 42._method_on_numbers(); -} diff --git a/tests/ui/unevaluated_fixed_size_array_len.rs b/tests/ui/unevaluated_fixed_size_array_len.rs deleted file mode 100644 index 6c545913dd9dc..0000000000000 --- a/tests/ui/unevaluated_fixed_size_array_len.rs +++ /dev/null @@ -1,13 +0,0 @@ -// https://github.com/rust-lang/rust/issues/49208 - -trait Foo { - fn foo(); -} - -impl Foo for [(); 1] { - fn foo() {} -} - -fn main() { - <[(); 0] as Foo>::foo() //~ ERROR E0277 -}