This commit is contained in:
Kivooeo 2025-07-18 22:06:07 +05:00
parent 9f38ca97ea
commit e9959aa74e
40 changed files with 89 additions and 38 deletions

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`.

View file

@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/11192
struct Foo {
x: isize
}

View file

@ -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

View file

@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/11085
//@ run-pass
#![allow(dead_code)]

View file

@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/11205
//@ run-pass
#![allow(dead_code)]

View file

@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/106755
//@ compile-flags:-Ztranslate-lang=en_US
#![feature(negative_impls)]

View file

@ -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
@ -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
@ -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>);
| ^^^^^^^^^^^^^^^^^^

View file

@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10734
//@ run-pass
#![allow(non_upper_case_globals)]

View file

@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10802
//@ run-pass
#![allow(dead_code)]

View file

@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10764
fn f(_: extern "Rust" fn()) {}
extern "C" fn bar() {}

View file

@ -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()) {}
| ^ ---------------------

View file

@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10877
struct Foo {
x: isize,
}

View file

@ -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

View file

@ -1,7 +0,0 @@
//@ run-pass
pub fn main() {
fn f() {
}
let _: Box<fn()> = Box::new(f as fn());
}

View file

@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10806
//@ edition: 2015
//@ run-pass
#![allow(unused_imports)]

View file

@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10718
//@ run-pass
fn f<F:FnOnce()>(p: F) {

View file

@ -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] }

View file

@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10396
//@ check-pass
#![allow(dead_code)]
#[derive(Debug)]

View file

@ -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

View file

@ -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

View file

@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/11374
use std::io::{self, Read};
use std::vec;

View file

@ -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)
| ^^^^^^^^^^^^^^^^------^^^^^^^^^^^^^^^^^^^^^^

View file

@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10228
//@ run-pass
#![allow(dead_code)]
#![allow(unused_variables)]

View file

@ -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

View file

@ -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

View file

@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10902
//@ check-pass
#![allow(dead_code)]

View file

@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10853
//@ check-pass
#![deny(missing_docs)]

View file

@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10638
//@ run-pass
pub fn main() {

View file

@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10683
//@ run-pass
static NAME: &'static str = "hello world";

View file

@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10545
mod a {
struct S;
impl S { }

View file

@ -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;
| ^^^^^^^^^

View file

@ -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.

View file

@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10456
//@ check-pass
pub struct Foo;

View file

@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/10465
pub mod a {
pub trait A {
fn foo(&self);

View file

@ -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`

View file

@ -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>>;

View file

@ -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 `()`

View file

@ -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

View file

@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/11004
use std::mem;
struct A { x: i32, y: f64 }

View file

@ -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