Rollup merge of #144151 - Kivooeo:issue1, r=jieyouxu

`tests/ui/issues/`: The Issues Strike Back [1/N]

I believe I’ve finally brought [my program](https://github.com/Kivooeo/test-manager) to life -- it now handles multiple test moves in one go: plain moves first, then a gentle touch on each file depends on given options. The process should be much smoother now.

Of course, I won’t rush through everything in a few days -- that would be unkind to `@Oneirical.` I’ll pace myself. And also I can't have more than one such PR because `issues.txt` will conflict with previous parts after merging them which is not fun as well.

This PR is just that: first commit - moves; second - regression comments and the occasional .stderr reblesses, also issue.txt and tidy changes. Nothing special, but progress nonetheless. This is for the purpose of preserving test file history during restructuring

Part of https://github.com/rust-lang/rust/issues/133895.

r? `@jieyouxu`
This commit is contained in:
Matthias Krüger
2025-07-28 08:36:51 +02:00
committed by GitHub
40 changed files with 152 additions and 32 deletions
+4
View File
@@ -412,6 +412,10 @@ These tests revolve around command-line flags which change the way error/warning
Exercises `#[diagnostic::*]` namespaced attributes. See [RFC 3368 Diagnostic attribute namespace](https://github.com/rust-lang/rfcs/blob/master/text/3368-diagnostic-attribute-namespace.md).
## `tests/ui/diagnostics-infra`
This directory contains tests and infrastructure related to the diagnostics system, including support for translatable diagnostics
## `tests/ui/diagnostic-width/`: `--diagnostic-width`
Everything to do with `--diagnostic-width`.
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/11192
struct Foo {
x: isize
}
@@ -1,5 +1,5 @@
error[E0502]: cannot borrow `*ptr` as immutable because it is also borrowed as mutable
--> $DIR/issue-11192.rs:20:10
--> $DIR/closure-borrow-conflict-11192.rs:22:10
|
LL | let mut test = |foo: &Foo| {
| ----------- mutable borrow occurs here
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/11085
//@ run-pass
#![allow(dead_code)]
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/11205
//@ run-pass
#![allow(dead_code)]
@@ -0,0 +1,24 @@
//! Regression test for https://github.com/rust-lang/rust/issues/106755
//@ compile-flags:-Ztranslate-lang=en_US
#![feature(negative_impls)]
#![feature(marker_trait_attr)]
#[marker]
trait MyTrait {}
struct TestType<T>(::std::marker::PhantomData<T>);
unsafe impl<T: MyTrait + 'static> Send for TestType<T> {}
impl<T: MyTrait> !Send for TestType<T> {}
//~^ ERROR found both positive and negative implementation
//~| ERROR `!Send` impl requires `T: MyTrait` but the struct it is implemented for does not
unsafe impl<T: 'static> Send for TestType<T> {} //~ ERROR conflicting implementations
impl !Send for TestType<i32> {}
//~^ ERROR `!Send` impls cannot be specialized
fn main() {}
@@ -0,0 +1,47 @@
error[E0751]: found both positive and negative implementation of trait `Send` for type `TestType<_>`:
--> $DIR/primary-fluent-bundle-missing.rs:15:1
|
LL | unsafe impl<T: MyTrait + 'static> Send for TestType<T> {}
| ------------------------------------------------------ positive implementation here
LL |
LL | impl<T: MyTrait> !Send for TestType<T> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ negative implementation here
error[E0119]: conflicting implementations of trait `Send` for type `TestType<_>`
--> $DIR/primary-fluent-bundle-missing.rs:19:1
|
LL | unsafe impl<T: MyTrait + 'static> Send for TestType<T> {}
| ------------------------------------------------------ first implementation here
...
LL | unsafe impl<T: 'static> Send for TestType<T> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<_>`
error[E0367]: `!Send` impl requires `T: MyTrait` but the struct it is implemented for does not
--> $DIR/primary-fluent-bundle-missing.rs:15:9
|
LL | impl<T: MyTrait> !Send for TestType<T> {}
| ^^^^^^^
|
note: the implementor must specify the same requirement
--> $DIR/primary-fluent-bundle-missing.rs:11:1
|
LL | struct TestType<T>(::std::marker::PhantomData<T>);
| ^^^^^^^^^^^^^^^^^^
error[E0366]: `!Send` impls cannot be specialized
--> $DIR/primary-fluent-bundle-missing.rs:21:1
|
LL | impl !Send for TestType<i32> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `i32` is not a generic parameter
note: use the same sequence of generic lifetime, type and const parameters as the struct definition
--> $DIR/primary-fluent-bundle-missing.rs:11:1
|
LL | struct TestType<T>(::std::marker::PhantomData<T>);
| ^^^^^^^^^^^^^^^^^^
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0119, E0366, E0367, E0751.
For more information about an error, try `rustc --explain E0119`.
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10734
//@ run-pass
#![allow(non_upper_case_globals)]
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10802
//@ run-pass
#![allow(dead_code)]
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10764
fn f(_: extern "Rust" fn()) {}
extern "C" fn bar() {}
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/issue-10764.rs:4:15
--> $DIR/extern-rust-fn-type-error-10764.rs:6:15
|
LL | fn main() { f(bar) }
| - ^^^ expected "Rust" fn, found "C" fn
@@ -9,7 +9,7 @@ LL | fn main() { f(bar) }
= note: expected fn pointer `fn()`
found fn item `extern "C" fn() {bar}`
note: function defined here
--> $DIR/issue-10764.rs:1:4
--> $DIR/extern-rust-fn-type-error-10764.rs:3:4
|
LL | fn f(_: extern "Rust" fn()) {}
| ^ ---------------------
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10877
struct Foo {
x: isize,
}
@@ -1,23 +1,23 @@
error[E0130]: patterns aren't allowed in foreign function declarations
--> $DIR/issue-10877.rs:5:12
--> $DIR/foreign-fn-pattern-error-10877.rs:7:12
|
LL | fn foo(1: ());
| ^ pattern not allowed in foreign function
error[E0130]: patterns aren't allowed in foreign function declarations
--> $DIR/issue-10877.rs:7:12
--> $DIR/foreign-fn-pattern-error-10877.rs:9:12
|
LL | fn bar((): isize);
| ^^ pattern not allowed in foreign function
error[E0130]: patterns aren't allowed in foreign function declarations
--> $DIR/issue-10877.rs:9:12
--> $DIR/foreign-fn-pattern-error-10877.rs:11:12
|
LL | fn baz(Foo { x }: isize);
| ^^^^^^^^^ pattern not allowed in foreign function
error[E0130]: patterns aren't allowed in foreign function declarations
--> $DIR/issue-10877.rs:11:12
--> $DIR/foreign-fn-pattern-error-10877.rs:13:12
|
LL | fn qux((x, y): ());
| ^^^^^^ pattern not allowed in foreign function
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10806
//@ edition: 2015
//@ run-pass
#![allow(unused_imports)]
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10718
//@ run-pass
fn f<F:FnOnce()>(p: F) {
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10436
//@ run-pass
fn works<T>(x: T) -> Vec<T> { vec![x] }
-7
View File
@@ -1,7 +0,0 @@
//@ run-pass
pub fn main() {
fn f() {
}
let _: Box<fn()> = Box::new(f as fn());
}
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10396
//@ check-pass
#![allow(dead_code)]
#[derive(Debug)]
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10291
fn test<'x>(x: &'x isize) {
drop::<Box<dyn for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
x
@@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/issue-10291.rs:3:9
--> $DIR/closure-lifetime-bounds-10291.rs:5:9
|
LL | fn test<'x>(x: &'x isize) {
| -- lifetime `'x` defined here
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/11374
use std::io::{self, Read};
use std::vec;
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/issue-11374.rs:27:15
--> $DIR/container-lifetime-error-11374.rs:29:15
|
LL | c.read_to(v);
| ------- ^ expected `&mut [u8]`, found `Vec<_>`
@@ -9,7 +9,7 @@ LL | c.read_to(v);
= note: expected mutable reference `&mut [u8]`
found struct `Vec<_>`
note: method defined here
--> $DIR/issue-11374.rs:13:12
--> $DIR/container-lifetime-error-11374.rs:15:12
|
LL | pub fn read_to(&mut self, vec: &mut [u8]) {
| ^^^^^^^ --------------
@@ -19,7 +19,7 @@ LL | c.read_to(&mut v);
| ++++
error[E0515]: cannot return value referencing local variable `r`
--> $DIR/issue-11374.rs:20:5
--> $DIR/container-lifetime-error-11374.rs:22:5
|
LL | Container::wrap(&mut r as &mut dyn io::Read)
| ^^^^^^^^^^^^^^^^------^^^^^^^^^^^^^^^^^^^^^^
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10228
//@ run-pass
#![allow(dead_code)]
#![allow(unused_variables)]
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10412
trait Serializable<'self, T> {
//~^ ERROR lifetimes cannot use keyword names
fn serialize(val: &'self T) -> Vec<u8>; //~ ERROR lifetimes cannot use keyword names
@@ -1,47 +1,47 @@
error: lifetimes cannot use keyword names
--> $DIR/issue-10412.rs:1:20
--> $DIR/keyword-self-lifetime-error-10412.rs:3:20
|
LL | trait Serializable<'self, T> {
| ^^^^^
error: lifetimes cannot use keyword names
--> $DIR/issue-10412.rs:3:24
--> $DIR/keyword-self-lifetime-error-10412.rs:5:24
|
LL | fn serialize(val: &'self T) -> Vec<u8>;
| ^^^^^
error: lifetimes cannot use keyword names
--> $DIR/issue-10412.rs:4:37
--> $DIR/keyword-self-lifetime-error-10412.rs:6:37
|
LL | fn deserialize(repr: &[u8]) -> &'self T;
| ^^^^^
error: lifetimes cannot use keyword names
--> $DIR/issue-10412.rs:7:6
--> $DIR/keyword-self-lifetime-error-10412.rs:9:6
|
LL | impl<'self> Serializable<str> for &'self str {
| ^^^^^
error: lifetimes cannot use keyword names
--> $DIR/issue-10412.rs:7:36
--> $DIR/keyword-self-lifetime-error-10412.rs:9:36
|
LL | impl<'self> Serializable<str> for &'self str {
| ^^^^^
error: lifetimes cannot use keyword names
--> $DIR/issue-10412.rs:11:24
--> $DIR/keyword-self-lifetime-error-10412.rs:13:24
|
LL | fn serialize(val: &'self str) -> Vec<u8> {
| ^^^^^
error: lifetimes cannot use keyword names
--> $DIR/issue-10412.rs:15:37
--> $DIR/keyword-self-lifetime-error-10412.rs:17:37
|
LL | fn deserialize(repr: &[u8]) -> &'self str {
| ^^^^^
error[E0726]: implicit elided lifetime not allowed here
--> $DIR/issue-10412.rs:7:13
--> $DIR/keyword-self-lifetime-error-10412.rs:9:13
|
LL | impl<'self> Serializable<str> for &'self str {
| ^^^^^^^^^^^^^^^^^ expected lifetime parameter
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10902
//@ check-pass
#![allow(dead_code)]
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10853
//@ check-pass
#![deny(missing_docs)]
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10638
//@ run-pass
pub fn main() {
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10683
//@ run-pass
static NAME: &'static str = "hello world";
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10545
mod a {
struct S;
impl S { }
@@ -1,11 +1,11 @@
error[E0603]: struct `S` is private
--> $DIR/issue-10545.rs:6:14
--> $DIR/struct-field-and-impl-expose-10545.rs:8:14
|
LL | fn foo(_: a::S) {
| ^ private struct
|
note: the struct `S` is defined here
--> $DIR/issue-10545.rs:2:5
--> $DIR/struct-field-and-impl-expose-10545.rs:4:5
|
LL | struct S;
| ^^^^^^^^^
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/11267
//@ run-pass
// Tests that unary structs can be mutably borrowed.
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10456
//@ check-pass
pub struct Foo;
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10465
pub mod a {
pub trait A {
fn foo(&self);
@@ -1,5 +1,5 @@
error[E0599]: no method named `foo` found for reference `&B` in the current scope
--> $DIR/issue-10465.rs:17:15
--> $DIR/nested-mod-trait-method-lookup-leak-10465.rs:19:15
|
LL | b.foo();
| ^^^ method not found in `&B`
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/102964
use std::rc::Rc;
type Foo<'a, T> = &'a dyn Fn(&T);
type RcFoo<'a, T> = Rc<Foo<'a, T>>;
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/issue-102964.rs:5:41
--> $DIR/dummy-binder-102964.rs:7:41
|
LL | fn bar_function<T>(function: Foo<T>) -> RcFoo<T> {
| ------------ ^^^^^^^^ expected `Rc<&dyn Fn(&T)>`, found `()`
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/11047
//@ run-pass
// Test that static methods can be invoked on `type` aliases
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/11004
use std::mem;
struct A { x: i32, y: f64 }
@@ -1,5 +1,5 @@
error[E0609]: no field `x` on type `*mut A`
--> $DIR/issue-11004.rs:7:21
--> $DIR/raw-pointer-field-access-error.rs:9:21
|
LL | let x : i32 = n.x;
| ^ unknown field
@@ -10,7 +10,7 @@ LL | let x : i32 = (*n).x;
| ++ +
error[E0609]: no field `y` on type `*mut A`
--> $DIR/issue-11004.rs:8:21
--> $DIR/raw-pointer-field-access-error.rs:10:21
|
LL | let y : f64 = n.y;
| ^ unknown field