Skip to content
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: 0 additions & 4 deletions tests/ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -770,10 +770,6 @@ Tests for the `{std,core}::intrinsics`, internal implementation detail.

Tests for I/O related behaviour, covering stdout/stderr handling and error propagation.

## `tests/ui/issues/`: Tests directly related to GitHub issues

**FIXME (#133895)**: Random collection of regression tests and tests for issues, tests in this directory should be audited and rehomed.

## `tests/ui/iterators/`

These tests revolve around anything to do with iterators, e.g. mismatched types.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Auxiliary file for <https://github.com/rust-lang/rust/issues/37291>.

#![crate_type = "lib"]

use std::ops::Mul;
Expand Down
24 changes: 24 additions & 0 deletions tests/ui/coherence/cross-crate-specialization-check.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/37291>.
//!
//! The problem was that the starting environment for a specialization
//! check was not including the where-clauses from the impl when attempting
//! to normalize the impl's trait-ref, so things like `<C as Foo>::Item`
//! could not resolve, since the `C: Foo` trait bound was not included in
//! the environment.

//@ aux-build:cross-crate-specialization-check.rs
//@ run-pass

#![allow(unused_imports)]

extern crate cross_crate_specialization_check;

use cross_crate_specialization_check::{CV, WrapperB, WrapperC};

fn main() {
let a = WrapperC(CV);
let b = WrapperC(CV);
if false {
let _ = a * b;
}
}
15 changes: 15 additions & 0 deletions tests/ui/crate-loading/missing-target-no-std-error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/49851>.
//! Test compiling for a target which is not installed with `no_std`
//! results in a helpful error message.
//~^^^ ERROR can't find crate for `core`

//@ compile-flags: --target thumbv7em-none-eabihf
//@ needs-llvm-components: arm
//@ ignore-backends: gcc
#![deny(unsafe_code)]
#![deny(warnings)]
#![no_std]

extern crate cortex_m;

fn main() {}
2 changes: 2 additions & 0 deletions tests/ui/cross-crate/auxiliary/cross-crate-array-len.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//! Auxiliary file for <https://github.com/rust-lang/rust/issues/38875>.
pub const FOO: usize = *&0;
11 changes: 11 additions & 0 deletions tests/ui/cross-crate/cross-crate-array-len.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/38875>.
//! This used to check `constant evaluation error` span doesn't point

@zedddie zedddie Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't error on const-eval anymore, so this doesn't test diagnostic quality

View changes since the review

//! on nothing when const is defined in another crate.
//@ aux-build:cross-crate-array-len.rs
//@ check-pass

extern crate cross_crate_array_len;

fn main() {
let test_x = [0; cross_crate_array_len::FOO];
}
12 changes: 12 additions & 0 deletions tests/ui/deref/option-result-as_deref.rs

@zedddie zedddie Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

combined 50264's tests into this

View changes since the review

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/50264>.

fn main() {
let _m = &Some(42).as_deref();
//~^ ERROR the method
let _e = &mut Some(42).as_deref_mut();
//~^ ERROR the method
let _o = &Ok(42).as_deref();
//~^ ERROR the method
let _w = &mut Ok(42).as_deref_mut();
//~^ ERROR the method
}
39 changes: 39 additions & 0 deletions tests/ui/deref/option-result-as_deref.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
error[E0599]: the method `as_deref` exists for enum `Option<{integer}>`, but its trait bounds were not satisfied
--> $DIR/option-result-as_deref.rs:4:24
|
LL | let _m = &Some(42).as_deref();
| ^^^^^^^^
|
= note: the following trait bounds were not satisfied:
`{integer}: Deref`

error[E0599]: the method `as_deref_mut` exists for enum `Option<{integer}>`, but its trait bounds were not satisfied
--> $DIR/option-result-as_deref.rs:6:28
|
LL | let _e = &mut Some(42).as_deref_mut();
| ^^^^^^^^^^^^
|
= note: the following trait bounds were not satisfied:
`{integer}: Deref`

error[E0599]: the method `as_deref` exists for enum `Result<{integer}, _>`, but its trait bounds were not satisfied
--> $DIR/option-result-as_deref.rs:8:22
|
LL | let _o = &Ok(42).as_deref();
| ^^^^^^^^
|
= note: the following trait bounds were not satisfied:
`{integer}: Deref`

error[E0599]: the method `as_deref_mut` exists for enum `Result<{integer}, _>`, but its trait bounds were not satisfied
--> $DIR/option-result-as_deref.rs:10:26
|
LL | let _w = &mut Ok(42).as_deref_mut();
| ^^^^^^^^^^^^
|
= note: the following trait bounds were not satisfied:
`{integer}: Deref`

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0599`.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Auxiliary file for <https://github.com/rust-lang/rust/issues/41652>.

pub trait Tr {
// Note: The function needs to be declared over multiple lines to reproduce
// the crash. DO NOT reformat.
Expand Down
17 changes: 17 additions & 0 deletions tests/ui/error-emitter/no-method-empty-span.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/41652>.
//! This used to ICE on empty string indexing internally, which came from
//! empty code span in error message, when method cannot be found.
//@ aux-build:no-method-empty-span.rs

extern crate no_method_empty_span;

struct S;

impl no_method_empty_span::Tr for S {
fn f() {
3.f()
//~^ ERROR can't call method `f` on ambiguous numeric type `{integer}`
}
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0689]: can't call method `f` on ambiguous numeric type `{integer}`
--> $DIR/issue-41652.rs:9:11
--> $DIR/no-method-empty-span.rs:12:11
|
LL | 3.f()
| ^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//! Auxiliary file for <https://github.com/rust-lang/rust/issues/50865>.
//@ revisions: default miropt
//@[miropt]compile-flags: -Z mir-opt-level=3
// ~^ This flag is for #77668, it used to be ICE.
Expand Down
16 changes: 16 additions & 0 deletions tests/ui/impl-trait/reachable-private-fn-codegen.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/50865>.
//! When using generics or specifying the type directly, this example
//! codegens `foo` internally. However, when using a private `impl Trait`
//! function which references another private item, `foo` (in this case)
//! wouldn't be codegenned until main.rs used `bar`, as with impl Trait
//! it is not cast to `fn()` automatically to satisfy e.g.
//! `fn foo() -> fn() { ... }`.
//@ run-pass
//@ aux-build:reachable-private-fn-codegen.rs


extern crate reachable_private_fn_codegen;

fn main() {
reachable_private_fn_codegen::bar(()); // Error won't happen if bar is called from same crate
}
17 changes: 0 additions & 17 deletions tests/ui/issues/auxiliary/reexported-trait.rs

@zedddie zedddie Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one is a lost duplicate of imports/auxiliary/reexported-trait-56175.rs

View changes since the review

This file was deleted.

21 changes: 0 additions & 21 deletions tests/ui/issues/issue-37291/main.rs

This file was deleted.

1 change: 0 additions & 1 deletion tests/ui/issues/issue-38875/auxiliary/issue-38875-b.rs

This file was deleted.

8 changes: 0 additions & 8 deletions tests/ui/issues/issue-38875/issue-38875.rs

This file was deleted.

14 changes: 0 additions & 14 deletions tests/ui/issues/issue-41652/issue-41652.rs

This file was deleted.

12 changes: 0 additions & 12 deletions tests/ui/issues/issue-49851/compiler-builtins-error.rs

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

16 changes: 0 additions & 16 deletions tests/ui/issues/issue-50865-private-impl-trait/main.rs

This file was deleted.

13 changes: 0 additions & 13 deletions tests/ui/issues/issue-52140/main.rs

This file was deleted.

16 changes: 0 additions & 16 deletions tests/ui/issues/issue-52141/main.rs

This file was deleted.

3 changes: 0 additions & 3 deletions tests/ui/issues/issue-52705/auxiliary/png2.rs

This file was deleted.

15 changes: 0 additions & 15 deletions tests/ui/issues/issue-52705/main.rs

This file was deleted.

Loading
Loading