Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tests/ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/11192

struct Foo {
x: isize
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/11085

//@ run-pass

#![allow(dead_code)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/11205

//@ run-pass

#![allow(dead_code)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/106755

//@ compile-flags:-Ztranslate-lang=en_US

#![feature(negative_impls)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0751]: found both positive and negative implementation of trait `Send` for type `TestType<_>`:
--> $DIR/issue-106755.rs:13:1
--> $DIR/primary-fluent-bundle-missing.rs:15:1
|
LL | unsafe impl<T: MyTrait + 'static> Send for TestType<T> {}
| ------------------------------------------------------ positive implementation here
Expand All @@ -8,7 +8,7 @@ LL | impl<T: MyTrait> !Send for TestType<T> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ negative implementation here

error[E0119]: conflicting implementations of trait `Send` for type `TestType<_>`
--> $DIR/issue-106755.rs:17:1
--> $DIR/primary-fluent-bundle-missing.rs:19:1
|
LL | unsafe impl<T: MyTrait + 'static> Send for TestType<T> {}
| ------------------------------------------------------ first implementation here
Expand All @@ -17,26 +17,26 @@ 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/issue-106755.rs:13:9
--> $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/issue-106755.rs:9:1
--> $DIR/primary-fluent-bundle-missing.rs:11:1
|
LL | struct TestType<T>(::std::marker::PhantomData<T>);
| ^^^^^^^^^^^^^^^^^^

error[E0366]: `!Send` impls cannot be specialized
--> $DIR/issue-106755.rs:19:1
--> $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/issue-106755.rs:9:1
--> $DIR/primary-fluent-bundle-missing.rs:11:1
|
LL | struct TestType<T>(::std::marker::PhantomData<T>);
| ^^^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10734

//@ run-pass
#![allow(non_upper_case_globals)]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10802

//@ run-pass
#![allow(dead_code)]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10764

fn f(_: extern "Rust" fn()) {}
extern "C" fn bar() {}

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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()) {}
| ^ ---------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10877

struct Foo {
x: isize,
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10806

//@ edition: 2015
//@ run-pass
#![allow(unused_imports)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10718
//@ run-pass

fn f<F:FnOnce()>(p: F) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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] }

Expand Down
7 changes: 0 additions & 7 deletions tests/ui/issues/issue-10767.rs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10396

//@ check-pass
#![allow(dead_code)]
#[derive(Debug)]
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/11374

use std::io::{self, Read};
use std::vec;

Expand Down
Original file line number Diff line number Diff line change
@@ -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<_>`
Expand All @@ -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]) {
| ^^^^^^^ --------------
Expand All @@ -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)
| ^^^^^^^^^^^^^^^^------^^^^^^^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10228

//@ run-pass
#![allow(dead_code)]
#![allow(unused_variables)]
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10902

//@ check-pass
#![allow(dead_code)]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10853

//@ check-pass

#![deny(missing_docs)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10638

//@ run-pass

pub fn main() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10683

//@ run-pass

static NAME: &'static str = "hello world";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10545

mod a {
struct S;
impl S { }
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
| ^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10456

//@ check-pass

pub struct Foo;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10465

pub mod a {
pub trait A {
fn foo(&self);
Expand Down
Original file line number Diff line number Diff line change
@@ -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`
Expand Down
Original file line number Diff line number Diff line change
@@ -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>>;
Expand Down
Original file line number Diff line number Diff line change
@@ -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 `()`
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/11004

use std::mem;

struct A { x: i32, y: f64 }
Expand Down
Loading
Loading