Rollup merge of #145896 - Oneirical:uncountable-integer-10, r=jieyouxu

Rehome 30 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [#3 of Batch #2]

Part of rust-lang/rust#133895

Methodology:

1. Refer to the previously written `tests/ui/SUMMARY.md`
2. Find an appropriate category for the test, using the original issue thread and the test contents.
3. Add the issue URL at the bottom (not at the top, as that would mess up stderr line numbers)
4. Rename the tests to make their purpose clearer

Inspired by the methodology that `@Kivooeo` was using.

r? `@jieyouxu`
This commit is contained in:
Jacob Pratt
2025-09-13 03:26:02 -04:00
committed by GitHub
54 changed files with 104 additions and 57 deletions
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/56806
pub trait Trait {
fn dyn_instead_of_self(self: Box<dyn Trait>);
//~^ ERROR invalid `self` parameter type
@@ -1,5 +1,5 @@
error[E0307]: invalid `self` parameter type: `Box<(dyn Trait + 'static)>`
--> $DIR/issue-56806.rs:2:34
--> $DIR/invalid-self-parameter-type-56806.rs:3:34
|
LL | fn dyn_instead_of_self(self: Box<dyn Trait>);
| ^^^^^^^^^^^^^^
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/56870
//@ build-pass
// Regression test for #56870: Internal compiler error (traits & associated consts)
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/59326
//@ check-pass
trait Service {
type S;
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/57399
//@ check-pass
trait T {
@@ -12,7 +13,6 @@ struct S<A> {
a: A,
}
impl From<u32> for S<<i32 as T>::T> {
fn from(a: u32) -> Self {
Self { a }
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/59488
fn foo() -> i32 {
42
}
@@ -1,5 +1,5 @@
error[E0369]: binary operation `>` cannot be applied to type `fn() -> i32 {foo}`
--> $DIR/issue-59488.rs:14:9
--> $DIR/function-comparison-errors-59488.rs:15:9
|
LL | foo > 12;
| --- ^ -- {integer}
@@ -12,7 +12,7 @@ LL | foo() > 12;
| ++
error[E0308]: mismatched types
--> $DIR/issue-59488.rs:14:11
--> $DIR/function-comparison-errors-59488.rs:15:11
|
LL | foo > 12;
| ^^ expected fn item, found `i32`
@@ -21,7 +21,7 @@ LL | foo > 12;
found type `i32`
error[E0369]: binary operation `>` cannot be applied to type `fn(i64) -> i64 {bar}`
--> $DIR/issue-59488.rs:18:9
--> $DIR/function-comparison-errors-59488.rs:19:9
|
LL | bar > 13;
| --- ^ -- {integer}
@@ -34,7 +34,7 @@ LL | bar(/* i64 */) > 13;
| +++++++++++
error[E0308]: mismatched types
--> $DIR/issue-59488.rs:18:11
--> $DIR/function-comparison-errors-59488.rs:19:11
|
LL | bar > 13;
| ^^ expected fn item, found `i64`
@@ -43,7 +43,7 @@ LL | bar > 13;
found type `i64`
error[E0369]: binary operation `>` cannot be applied to type `fn() -> i32 {foo}`
--> $DIR/issue-59488.rs:22:9
--> $DIR/function-comparison-errors-59488.rs:23:9
|
LL | foo > foo;
| --- ^ --- fn() -> i32 {foo}
@@ -56,7 +56,7 @@ LL | foo() > foo();
| ++ ++
error[E0369]: binary operation `>` cannot be applied to type `fn() -> i32 {foo}`
--> $DIR/issue-59488.rs:25:9
--> $DIR/function-comparison-errors-59488.rs:26:9
|
LL | foo > bar;
| --- ^ --- fn(i64) -> i64 {bar}
@@ -64,7 +64,7 @@ LL | foo > bar;
| fn() -> i32 {foo}
error[E0308]: mismatched types
--> $DIR/issue-59488.rs:25:11
--> $DIR/function-comparison-errors-59488.rs:26:11
|
LL | foo > bar;
| ^^^ expected fn item, found a different fn item
@@ -73,7 +73,7 @@ LL | foo > bar;
found fn item `fn(i64) -> i64 {bar}`
error[E0369]: binary operation `==` cannot be applied to type `fn(usize) -> Foo {Foo::Bar}`
--> $DIR/issue-59488.rs:30:5
--> $DIR/function-comparison-errors-59488.rs:31:5
|
LL | assert_eq!(Foo::Bar, i);
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -84,7 +84,7 @@ LL | assert_eq!(Foo::Bar, i);
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug`
--> $DIR/issue-59488.rs:30:5
--> $DIR/function-comparison-errors-59488.rs:31:5
|
LL | assert_eq!(Foo::Bar, i);
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for fn item `fn(usize) -> Foo {Foo::Bar}`
@@ -92,7 +92,7 @@ LL | assert_eq!(Foo::Bar, i);
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug`
--> $DIR/issue-59488.rs:30:5
--> $DIR/function-comparison-errors-59488.rs:31:5
|
LL | assert_eq!(Foo::Bar, i);
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for fn item `fn(usize) -> Foo {Foo::Bar}`
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/57741
#![allow(warnings)]
// This tests that the `help: consider dereferencing the boxed value` suggestion isn't made
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/issue-57741-1.rs:14:9
--> $DIR/boxed-value-matching-57741.rs:15:9
|
LL | let y = match x {
| - this expression has type `Box<u32>`
@@ -10,7 +10,7 @@ LL | S::A { a } | S::B { b: a } => a,
found enum `S`
error[E0308]: mismatched types
--> $DIR/issue-57741-1.rs:14:22
--> $DIR/boxed-value-matching-57741.rs:15:22
|
LL | let y = match x {
| - this expression has type `Box<u32>`
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/57741
//@ run-rustfix
#![allow(warnings)]
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/57741
//@ run-rustfix
#![allow(warnings)]
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/issue-57741.rs:20:9
--> $DIR/dereferencing-boxed-enum-in-match-57741.rs:21:9
|
LL | let y = match x {
| - this expression has type `Box<T>`
@@ -14,7 +14,7 @@ LL | let y = match *x {
| +
error[E0308]: mismatched types
--> $DIR/issue-57741.rs:20:19
--> $DIR/dereferencing-boxed-enum-in-match-57741.rs:21:19
|
LL | let y = match x {
| - this expression has type `Box<T>`
@@ -29,7 +29,7 @@ LL | let y = match *x {
| +
error[E0308]: mismatched types
--> $DIR/issue-57741.rs:27:9
--> $DIR/dereferencing-boxed-enum-in-match-57741.rs:28:9
|
LL | let y = match x {
| - this expression has type `Box<S>`
@@ -44,7 +44,7 @@ LL | let y = match *x {
| +
error[E0308]: mismatched types
--> $DIR/issue-57741.rs:27:22
--> $DIR/dereferencing-boxed-enum-in-match-57741.rs:28:22
|
LL | let y = match x {
| - this expression has type `Box<S>`
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/59494
fn t7p<A, B, C>(f: impl Fn(B) -> C, g: impl Fn(A) -> B) -> impl Fn(A) -> C {
move |a: A| -> C { f(g(a)) }
}
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/issue-59494.rs:20:40
--> $DIR/generic-typed-nested-closures-59494.rs:21:40
|
LL | let t7 = |env| |a| |b| t7p(f, g)(((env, a), b));
| ^^^ cyclic type of infinite size
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/58375
// Make sure that the mono-item collector does not crash when trying to
// instantiate a default impl for DecodeUtf16<<u8 as A>::Item>
// See https://github.com/rust-lang/rust/issues/58375
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/57162
//@ check-pass
trait Foo {}
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/57781
//@ run-pass
use std::cell::UnsafeCell;
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/58463
//@ run-pass
//@ compile-flags:-C debuginfo=2
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/58734
trait Trait {
fn exists(self) -> ();
@@ -1,5 +1,5 @@
warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/issue-58734.rs:20:5
--> $DIR/spurious-dyn-compat-errors-58734.rs:21:5
|
LL | Trait::nonexistent(());
| ^^^^^
@@ -13,14 +13,14 @@ LL | <dyn Trait>::nonexistent(());
| ++++ +
error[E0038]: the trait `Trait` is not dyn compatible
--> $DIR/issue-58734.rs:20:5
--> $DIR/spurious-dyn-compat-errors-58734.rs:21:5
|
LL | Trait::nonexistent(());
| ^^^^^ `Trait` is not dyn compatible
|
note: for a trait to be dyn compatible it needs to allow building a vtable
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
--> $DIR/issue-58734.rs:4:8
--> $DIR/spurious-dyn-compat-errors-58734.rs:5:8
|
LL | trait Trait {
| ----- this trait is not dyn compatible...
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/56237
//@ run-pass
use std::ops::Deref;
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/55731
use std::marker::PhantomData;
trait DistributedIterator {
@@ -1,5 +1,5 @@
error: implementation of `DistributedIteratorMulti` is not general enough
--> $DIR/issue-55731.rs:48:5
--> $DIR/hrtb-associated-type-leak-check-55731.rs:49:5
|
LL | / multi(Map {
LL | | i: Cloned(PhantomData),
@@ -0,0 +1,17 @@
mod private {
pub trait Trait {
fn trait_method(&self) {
}
}
pub trait TraitB {
fn trait_method_b(&self) {
}
}
}
pub struct FooStruct;
pub use crate::private::Trait;
impl crate::private::Trait for FooStruct {}
pub use crate::private::TraitB as TraitBRename;
impl crate::private::TraitB for FooStruct {}
@@ -1,5 +1,6 @@
// https://github.com/rust-lang/rust/issues/56175
//@ edition:2018
//@ aux-crate:reexported_trait=reexported-trait.rs
//@ aux-crate:reexported_trait=reexported-trait-56175.rs
fn main() {
reexported_trait::FooStruct.trait_method();
@@ -1,10 +1,10 @@
error[E0599]: no method named `trait_method` found for struct `FooStruct` in the current scope
--> $DIR/issue-56175.rs:5:33
--> $DIR/private-types-suggested-without-extern-crate-56175.rs:6:33
|
LL | reexported_trait::FooStruct.trait_method();
| ^^^^^^^^^^^^
|
::: $DIR/auxiliary/reexported-trait.rs:3:12
::: $DIR/auxiliary/reexported-trait-56175.rs:3:12
|
LL | fn trait_method(&self) {
| ------------ the method is available for `FooStruct` here
@@ -12,7 +12,7 @@ LL | fn trait_method(&self) {
= help: items from traits can only be used if the trait is in scope
help: trait `Trait` which provides `trait_method` is implemented but not in scope; perhaps you want to import it
|
LL + use reexported_trait::Trait;
LL + use reexported_trait_56175::Trait;
|
help: there is a method `trait_method_b` with a similar name
|
@@ -20,12 +20,12 @@ LL | reexported_trait::FooStruct.trait_method_b();
| ++
error[E0599]: no method named `trait_method_b` found for struct `FooStruct` in the current scope
--> $DIR/issue-56175.rs:7:33
--> $DIR/private-types-suggested-without-extern-crate-56175.rs:8:33
|
LL | reexported_trait::FooStruct.trait_method_b();
| ^^^^^^^^^^^^^^
|
::: $DIR/auxiliary/reexported-trait.rs:7:12
::: $DIR/auxiliary/reexported-trait-56175.rs:7:12
|
LL | fn trait_method_b(&self) {
| -------------- the method is available for `FooStruct` here
@@ -33,7 +33,7 @@ LL | fn trait_method_b(&self) {
= help: items from traits can only be used if the trait is in scope
help: trait `TraitB` which provides `trait_method_b` is implemented but not in scope; perhaps you want to import it
|
LL + use reexported_trait::TraitBRename;
LL + use reexported_trait_56175::TraitBRename;
|
help: there is a method `trait_method` with a similar name
|
@@ -1,8 +1,9 @@
//@ aux-build:issue-57271-lib.rs
// https://github.com/rust-lang/rust/issues/57271
//@ aux-build:aux-57271-lib.rs
extern crate issue_57271_lib;
extern crate aux_57271_lib;
use issue_57271_lib::BaseType;
use aux_57271_lib::BaseType;
pub enum ObjectType { //~ ERROR recursive types `ObjectType` and `TypeSignature` have infinite size
Class(ClassTypeSignature),
@@ -1,5 +1,5 @@
error[E0072]: recursive types `ObjectType` and `TypeSignature` have infinite size
--> $DIR/issue-57271.rs:7:1
--> $DIR/mutually-recursive-infinite-types-57271.rs:8:1
|
LL | pub enum ObjectType {
| ^^^^^^^^^^^^^^^^^^^
-8
View File
@@ -1,8 +0,0 @@
//@ aux-build:issue-56943.rs
extern crate issue_56943;
fn main() {
let _: issue_56943::S = issue_56943::S2;
//~^ ERROR mismatched types [E0308]
}
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/57198
//@ run-pass
mod m {
@@ -0,0 +1,9 @@
// https://github.com/rust-lang/rust/issues/56943
//@ aux-build:aux-56943.rs
extern crate aux_56943;
fn main() {
let _: aux_56943::S = aux_56943::S2;
//~^ ERROR mismatched types [E0308]
}
@@ -1,8 +1,8 @@
error[E0308]: mismatched types
--> $DIR/issue-56943.rs:6:29
--> $DIR/type-mismatch-in-extern-crate-56943.rs:7:27
|
LL | let _: issue_56943::S = issue_56943::S2;
| -------------- ^^^^^^^^^^^^^^^ expected `S`, found `S2`
LL | let _: aux_56943::S = aux_56943::S2;
| ------------ ^^^^^^^^^^^^^ expected `S`, found `S2`
| |
| expected due to this
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/55587
use std::path::Path;
fn main() {
@@ -1,5 +1,5 @@
error[E0164]: expected tuple struct or tuple variant, found associated function `Path::new`
--> $DIR/issue-55587.rs:4:9
--> $DIR/invalid-variable-definition-55587.rs:5:9
|
LL | let Path::new();
| ^^^^^^^^^^^ `fn` calls are not allowed in patterns
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/58712
struct AddrVec<H, A> {
h: H,
a: A,
@@ -1,5 +1,5 @@
error[E0412]: cannot find type `DeviceId` in this scope
--> $DIR/issue-58712.rs:6:20
--> $DIR/missing-type-in-scope-58712.rs:7:20
|
LL | impl<H> AddrVec<H, DeviceId> {
| ^^^^^^^^ not found in this scope
@@ -10,7 +10,7 @@ LL | impl<H, DeviceId> AddrVec<H, DeviceId> {
| ++++++++++
error[E0412]: cannot find type `DeviceId` in this scope
--> $DIR/issue-58712.rs:8:29
--> $DIR/missing-type-in-scope-58712.rs:9:29
|
LL | pub fn device(&self) -> DeviceId {
| ^^^^^^^^ not found in this scope
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/59020
//@ edition:2018
//@ run-pass
//@ needs-threads
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/56835
pub struct Foo {}
impl Foo {
@@ -1,11 +1,11 @@
error: the `Self` constructor can only be used with tuple or unit structs
--> $DIR/issue-56835.rs:4:12
--> $DIR/invalid-self-constructor-56835.rs:5:12
|
LL | fn bar(Self(foo): Self) {}
| ^^^^^^^^^ help: use curly brackets: `Self { /* fields */ }`
error[E0164]: expected tuple struct or tuple variant, found self constructor `Self`
--> $DIR/issue-56835.rs:4:12
--> $DIR/invalid-self-constructor-56835.rs:5:12
|
LL | fn bar(Self(foo): Self) {}
| ^^^^^^^^^ not a tuple struct or tuple variant
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/59756
//@ run-rustfix
//@ ignore-test (rustfix needs multiple suggestions)
//
@@ -1,5 +1,5 @@
error[E0308]: try expression alternatives have incompatible types
--> $DIR/issue-59756.rs:13:5
--> $DIR/incompatible-types-in-try-expression-59756.rs:13:5
|
LL | foo()?
| ^^^^^^ expected enum `std::result::Result`, found struct `A`
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/58857
struct Conj<A> {a : A}
trait Valid {}
@@ -1,5 +1,5 @@
error: negative bounds are not supported
--> $DIR/issue-58857.rs:4:9
--> $DIR/negative-bound-not-supported-58857.rs:5:9
|
LL | impl<A: !Valid> Conj<A>{}
| ^
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/58212
//@ check-pass
trait FromUnchecked {
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/57156
//@ check-pass
trait Foo<Args> {
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/56229
//@ check-pass
trait Mirror {
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/57924
pub struct Gcm<E>(E);
impl<E> Gcm<E> {
@@ -1,5 +1,5 @@
error[E0109]: type arguments are not allowed on self constructor
--> $DIR/issue-57924.rs:5:16
--> $DIR/self-constructor-type-args-not-allowed-57924.rs:6:16
|
LL | Self::<E>(e)
| ---- ^ type argument not allowed
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/56199
enum Foo {}
struct Bar {}
@@ -1,5 +1,5 @@
error: the `Self` constructor can only be used with tuple or unit structs
--> $DIR/issue-56199.rs:6:17
--> $DIR/self-constructor-type-error-56199.rs:7:17
|
LL | let _ = Self;
| ^^^^
@@ -7,7 +7,7 @@ LL | let _ = Self;
= help: did you mean to use one of the enum's variants?
error: the `Self` constructor can only be used with tuple or unit structs
--> $DIR/issue-56199.rs:8:17
--> $DIR/self-constructor-type-error-56199.rs:9:17
|
LL | let _ = Self();
| ^^^^^^
@@ -15,13 +15,13 @@ LL | let _ = Self();
= help: did you mean to use one of the enum's variants?
error: the `Self` constructor can only be used with tuple or unit structs
--> $DIR/issue-56199.rs:15:17
--> $DIR/self-constructor-type-error-56199.rs:16:17
|
LL | let _ = Self;
| ^^^^ help: use curly brackets: `Self { /* fields */ }`
error: the `Self` constructor can only be used with tuple or unit structs
--> $DIR/issue-56199.rs:17:17
--> $DIR/self-constructor-type-error-56199.rs:18:17
|
LL | let _ = Self();
| ^^^^^^ help: use curly brackets: `Self { /* fields */ }`