Rollup merge of #144553 - Oneirical:uncountable-integer-4, r=jieyouxu

Rehome 32 `tests/ui/issues/` tests to other subdirectories under `tests/ui/`

rust-lang/rust#143902 divided into smaller, easier to review chunks.

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-08-10 15:43:52 -04:00
committed by GitHub
48 changed files with 83 additions and 54 deletions
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/23442
//@ check-pass
#![allow(dead_code)]
use std::marker::PhantomData;
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/91489
//@ check-pass
// regression test for #91489
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/9725
struct A { foo: isize }
fn main() {
@@ -1,11 +1,11 @@
error[E0416]: identifier `foo` is bound more than once in the same pattern
--> $DIR/issue-9725.rs:4:18
--> $DIR/struct-destructuring-repeated-bindings-9725.rs:5:18
|
LL | let A { foo, foo } = A { foo: 3 };
| ^^^ used in a pattern more than once
error[E0025]: field `foo` bound multiple times in the pattern
--> $DIR/issue-9725.rs:4:18
--> $DIR/struct-destructuring-repeated-bindings-9725.rs:5:18
|
LL | let A { foo, foo } = A { foo: 3 };
| --- ^^^ multiple uses of `foo` in pattern
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/9942
//@ run-pass
pub fn main() {
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/9129
//@ run-pass
#![allow(dead_code)]
#![allow(non_camel_case_types)]
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/9951
//@ run-pass
#![allow(unused_variables)]
@@ -1,5 +1,5 @@
warning: method `noop` is never used
--> $DIR/issue-9951.rs:6:6
--> $DIR/trait-object-coercion-distribution-9951.rs:7:6
|
LL | trait Bar {
| --- method in this trait
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/98299
use std::convert::TryFrom;
pub fn test_usage(p: ()) {
@@ -1,5 +1,5 @@
error[E0284]: type annotations needed for `SmallCString<_>`
--> $DIR/issue-98299.rs:4:36
--> $DIR/try-from-with-const-genericsrs-98299.rs:5:36
|
LL | SmallCString::try_from(p).map(|cstr| cstr);
| ------------ ^^^^
@@ -7,7 +7,7 @@ LL | SmallCString::try_from(p).map(|cstr| cstr);
| type must be known at this point
|
note: required by a const generic parameter in `SmallCString`
--> $DIR/issue-98299.rs:10:25
--> $DIR/try-from-with-const-genericsrs-98299.rs:11:25
|
LL | pub struct SmallCString<const N: usize> {}
| ^^^^^^^^^^^^^^ required by this const generic parameter in `SmallCString`
@@ -17,7 +17,7 @@ LL | SmallCString::try_from(p).map(|cstr: SmallCString<N>| cstr);
| +++++++++++++++++
error[E0284]: type annotations needed for `SmallCString<_>`
--> $DIR/issue-98299.rs:4:36
--> $DIR/try-from-with-const-genericsrs-98299.rs:5:36
|
LL | SmallCString::try_from(p).map(|cstr| cstr);
| ------------ ^^^^
@@ -25,7 +25,7 @@ LL | SmallCString::try_from(p).map(|cstr| cstr);
| type must be known at this point
|
note: required for `SmallCString<_>` to implement `TryFrom<()>`
--> $DIR/issue-98299.rs:12:22
--> $DIR/try-from-with-const-genericsrs-98299.rs:13:22
|
LL | impl<const N: usize> TryFrom<()> for SmallCString<N> {
| -------------- ^^^^^^^^^^^ ^^^^^^^^^^^^^^^
@@ -37,7 +37,7 @@ LL | SmallCString::try_from(p).map(|cstr: SmallCString<N>| cstr);
| +++++++++++++++++
error[E0284]: type annotations needed for `SmallCString<_>`
--> $DIR/issue-98299.rs:4:36
--> $DIR/try-from-with-const-genericsrs-98299.rs:5:36
|
LL | SmallCString::try_from(p).map(|cstr| cstr);
| ------------------------- ^^^^
@@ -45,7 +45,7 @@ LL | SmallCString::try_from(p).map(|cstr| cstr);
| type must be known at this point
|
note: required for `SmallCString<_>` to implement `TryFrom<()>`
--> $DIR/issue-98299.rs:12:22
--> $DIR/try-from-with-const-genericsrs-98299.rs:13:22
|
LL | impl<const N: usize> TryFrom<()> for SmallCString<N> {
| -------------- ^^^^^^^^^^^ ^^^^^^^^^^^^^^^
@@ -0,0 +1,11 @@
// https://github.com/rust-lang/rust/issues/9155
//@ run-pass
//@ aux-build:aux-9155.rs
extern crate aux_9155;
struct Baz;
pub fn main() {
aux_9155::Foo::new(Baz);
}
@@ -0,0 +1,10 @@
// https://github.com/rust-lang/rust/issues/9906
//@ run-pass
//@ aux-build:aux-9906.rs
extern crate aux_9906 as testmod;
pub fn main() {
testmod::foo();
testmod::FooBar::new(1);
}
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/22992
//@ run-pass
struct X { val: i32 }
@@ -6,7 +7,6 @@ impl std::ops::Deref for X {
fn deref(&self) -> &i32 { &self.val }
}
trait M { fn m(self); }
impl M for i32 { fn m(self) { println!("i32::m()"); } }
impl M for X { fn m(self) { println!("X::m()"); } }
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/25549
//@ run-pass
#![allow(unused_variables)]
struct Foo<'r>(&'r mut i32);
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/9243
//@ build-pass
#![allow(dead_code)]
// Regression test for issue 9243
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/53333
//@ run-pass
#![allow(unused_imports)]
//@ edition:2018
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/9837
//@ run-pass
const C1: i32 = 0x12345678;
const C2: isize = C1 as i16 as isize;
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/9814
// Verify that single-variant enums can't be de-referenced
// Regression test for issue #9814
@@ -1,5 +1,5 @@
error[E0614]: type `Foo` cannot be dereferenced
--> $DIR/issue-9814.rs:7:13
--> $DIR/single-variant-enum-deref-error-9814.rs:8:13
|
LL | let _ = *Foo::Bar(2);
| ^^^^^^^^^^^^ can't be dereferenced
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/3037
//@ run-pass
#![allow(dead_code)]
#![allow(non_camel_case_types)]
@@ -0,0 +1,12 @@
// https://github.com/rust-lang/rust/issues/9968
//@ run-pass
//@ aux-build:aux-9968.rs
extern crate aux_9968 as lib;
use lib::{Trait, Struct};
pub fn main()
{
Struct::init().test();
}
-11
View File
@@ -1,11 +0,0 @@
//@ run-pass
//@ aux-build:issue-9155.rs
extern crate issue_9155;
struct Baz;
pub fn main() {
issue_9155::Foo::new(Baz);
}
-10
View File
@@ -1,10 +0,0 @@
//@ run-pass
//@ aux-build:issue-9906.rs
extern crate issue_9906 as testmod;
pub fn main() {
testmod::foo();
testmod::FooBar::new(1);
}
-12
View File
@@ -1,12 +0,0 @@
//@ run-pass
//@ aux-build:issue-9968.rs
extern crate issue_9968 as lib;
use lib::{Trait, Struct};
pub fn main()
{
Struct::init().test();
}
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/21655
//@ run-pass
fn test(it: &mut dyn Iterator<Item=i32>) {
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/9259
//@ run-pass
#![allow(dead_code)]
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/29710
//@ check-pass
#![deny(unused_results)]
#![allow(dead_code)]
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/9047
//@ run-pass
#![allow(unused_mut)]
#![allow(unused_variables)]
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/9110
//@ check-pass
#![allow(dead_code)]
#![allow(non_snake_case)]
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/9737
//@ run-pass
#![allow(unused_variables)]
macro_rules! f {
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/25386
mod stuff {
pub struct Item {
c_object: Box<CObj>,
@@ -1,5 +1,5 @@
error[E0616]: field `c_object` of struct `Item` is private
--> $DIR/issue-25386.rs:19:16
--> $DIR/private-struct-member-macro-access-25386.rs:20:16
|
LL | (*$var.c_object).$member.is_some()
| ^^^^^^^^ private field
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/92741
//@ run-rustfix
fn main() {}
fn _foo() -> bool {
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/92741
//@ run-rustfix
fn main() {}
fn _foo() -> bool {
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/issue-92741.rs:4:5
--> $DIR/newlines-in-diagnostic-fix-suggestions-92741.rs:5:5
|
LL | fn _foo() -> bool {
| ---- expected `bool` because of return type
@@ -15,7 +15,7 @@ LL - mut
|
error[E0308]: mismatched types
--> $DIR/issue-92741.rs:10:5
--> $DIR/newlines-in-diagnostic-fix-suggestions-92741.rs:11:5
|
LL | fn _bar() -> bool {
| ---- expected `bool` because of return type
@@ -31,7 +31,7 @@ LL + if true { true } else { false }
|
error[E0308]: mismatched types
--> $DIR/issue-92741.rs:15:5
--> $DIR/newlines-in-diagnostic-fix-suggestions-92741.rs:16:5
|
LL | fn _baz() -> bool {
| ---- expected `bool` because of return type
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/99838
//@ run-pass
use std::hint;
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/29383
enum E {
A,
B,
@@ -1,5 +1,5 @@
error[E0532]: expected tuple struct or tuple variant, found unit variant `E::A`
--> $DIR/issue-pr29383.rs:9:14
--> $DIR/unit-variant-pattern-matching-29383.rs:10:14
|
LL | A,
| - `E::A` defined here
@@ -8,7 +8,7 @@ LL | Some(E::A(..)) => {}
| ^^^^^^^^ help: use this syntax instead: `E::A`
error[E0532]: expected tuple struct or tuple variant, found unit variant `E::B`
--> $DIR/issue-pr29383.rs:11:14
--> $DIR/unit-variant-pattern-matching-29383.rs:12:14
|
LL | B,
| - `E::B` defined here
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/9249
//@ check-pass
#![allow(dead_code)]
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/24365
pub enum Attribute {
Code {attr_name_idx: u16},
}
@@ -1,17 +1,17 @@
error[E0609]: no field `b` on type `Foo`
--> $DIR/issue-24365.rs:10:22
--> $DIR/struct-field-access-errors-24365.rs:11:22
|
LL | println!("{}", a.b);
| ^ unknown field
error[E0609]: no field `attr_name_idx` on type `&Attribute`
--> $DIR/issue-24365.rs:17:18
--> $DIR/struct-field-access-errors-24365.rs:18:18
|
LL | let z = (&x).attr_name_idx;
| ^^^^^^^^^^^^^ unknown field
error[E0609]: no field `attr_name_idx` on type `Attribute`
--> $DIR/issue-24365.rs:18:15
--> $DIR/struct-field-access-errors-24365.rs:19:15
|
LL | let y = x.attr_name_idx;
| ^^^^^^^^^^^^^ unknown field
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/30756
//@ run-pass
#![forbid(unsafe_code)]
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/30236
type Foo<
Unused //~ ERROR type parameter `Unused` is never used
> = u8;
@@ -1,5 +1,5 @@
error[E0091]: type parameter `Unused` is never used
--> $DIR/issue-30236.rs:2:5
--> $DIR/unused-type-parameter-span-30236.rs:3:5
|
LL | Unused
| ^^^^^^ unused type parameter
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/88150
//@ run-pass
//@ compile-flags:-C debuginfo=2
//@ edition:2018