Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/21922>.
//!
//! Ensure Add works with all value/reference operand combinations,
//! both via the + operator and ufcs.
//!
//! Originally method lookup failed only for x + &y.
//@ run-pass
use std::ops::Add;
fn show(z: i32) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/21634>.
//@ run-pass

#[cfg(any(not(target_arch = "x86"), target_feature = "sse2"))]
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/22034>.
fn main() {
let ptr: *mut () = core::ptr::null_mut();
let _: &mut dyn Fn() = unsafe {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0277]: expected a `Fn()` closure, found `()`
--> $DIR/issue-22034.rs:4:16
--> $DIR/raw-ptr-to-dyn-fn-raw-ptr.rs:6:16
|
LL | &mut *(ptr as *mut dyn Fn())
| ^^^ expected an `Fn()` closure, found `()`
Expand Down
18 changes: 0 additions & 18 deletions tests/ui/issues/issue-21974.rs

This file was deleted.

9 changes: 0 additions & 9 deletions tests/ui/issues/issue-22008.rs

This file was deleted.

14 changes: 14 additions & 0 deletions tests/ui/match/match-str-proper-optimization.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/22008>.
//! Ensure matching against `str` doesn't cause segfault when compiled
//! with `opt-level` >= 2.
//
//@ compile-flags: -C opt-level=2

@zedddie zedddie Jun 15, 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.

test initially supposed to test behavior with opt-level >= 2

View changes since the review

//@ run-pass
pub fn main() {
let command = "a";

match command {
"foo" => println!("foo"),
_ => println!("{}", command),
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/21622>.
//@ check-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/2150>.
#![deny(unreachable_code)]
#![allow(unused_variables)]
#![allow(dead_code)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error: unreachable statement
--> $DIR/issue-2150.rs:8:5
--> $DIR/unreachable-ret-after-panic.rs:10:5
|
LL | panic!();
| -------- any code following this expression is unreachable
LL | for x in &v { i += 1; }
| ^^^^^^^^^^^^^^^^^^^^^^^ unreachable statement
|
note: the lint level is defined here
--> $DIR/issue-2150.rs:1:9
--> $DIR/unreachable-ret-after-panic.rs:3:9
|
LL | #![deny(unreachable_code)]
| ^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// Also works as a test for #14564
//! Regression test for <https://github.com/rust-lang/rust/issues/21546>.
//! Ensure structs, enums and modules cannot share name in namespace.
//!
//! Also works as a test for <https://github.com/rust-lang/rust/issues/14564>.
#[allow(non_snake_case)]
mod Foo { }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0428]: the name `Foo` is defined multiple times
--> $DIR/issue-21546.rs:7:1
--> $DIR/module-type-name-conflict.rs:10:1
|
LL | mod Foo { }
| ------- previous definition of the module `Foo` here
Expand All @@ -10,7 +10,7 @@ LL | struct Foo;
= note: `Foo` must be defined only once in the type namespace of this module

error[E0428]: the name `Bar` is defined multiple times
--> $DIR/issue-21546.rs:14:1
--> $DIR/module-type-name-conflict.rs:17:1
|
LL | mod Bar { }
| ------- previous definition of the module `Bar` here
Expand All @@ -21,7 +21,7 @@ LL | struct Bar(i32);
= note: `Bar` must be defined only once in the type namespace of this module

error[E0428]: the name `Baz` is defined multiple times
--> $DIR/issue-21546.rs:22:1
--> $DIR/module-type-name-conflict.rs:25:1
|
LL | struct Baz(i32);
| ---------------- previous definition of the type `Baz` here
Expand All @@ -32,7 +32,7 @@ LL | mod Baz { }
= note: `Baz` must be defined only once in the type namespace of this module

error[E0428]: the name `Qux` is defined multiple times
--> $DIR/issue-21546.rs:30:1
--> $DIR/module-type-name-conflict.rs:33:1
|
LL | struct Qux { x: bool }
| ---------- previous definition of the type `Qux` here
Expand All @@ -43,7 +43,7 @@ LL | mod Qux { }
= note: `Qux` must be defined only once in the type namespace of this module

error[E0428]: the name `Quux` is defined multiple times
--> $DIR/issue-21546.rs:38:1
--> $DIR/module-type-name-conflict.rs:41:1
|
LL | struct Quux;
| ------------ previous definition of the type `Quux` here
Expand All @@ -54,7 +54,7 @@ LL | mod Quux { }
= note: `Quux` must be defined only once in the type namespace of this module

error[E0428]: the name `Corge` is defined multiple times
--> $DIR/issue-21546.rs:46:1
--> $DIR/module-type-name-conflict.rs:49:1
|
LL | enum Corge { A, B }
| ---------- previous definition of the type `Corge` here
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Regression test for HashMap only impl'ing Send/Sync if its contents do
//! Regression test for <https://github.com/rust-lang/rust/issues/21763>.
//! Test HashMap only impl Send/Sync if its contents do
//@ normalize-stderr: "(?:[A-Za-z]:[/\\]|/).*[\\/]hashbrown\S+" -> "$$HASHBROWN_SRC_LOCATION"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0277]: `Rc<()>` cannot be sent between threads safely
--> $DIR/issue-21763.rs:11:11
--> $DIR/hashmap-send-requires-send-contents.rs:12:11
|
LL | foo::<HashMap<Rc<()>, Rc<()>>>();
| ^^^^^^^^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely
Expand All @@ -12,7 +12,7 @@ note: required because it appears within the type `hashbrown::map::HashMap<Rc<()
note: required because it appears within the type `HashMap<Rc<()>, Rc<()>>`
--> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
note: required by a bound in `foo`
--> $DIR/issue-21763.rs:8:11
--> $DIR/hashmap-send-requires-send-contents.rs:9:11
|
LL | fn foo<T: Send>() {}
| ^^^^ required by this bound in `foo`
Expand Down
20 changes: 20 additions & 0 deletions tests/ui/traits/ambiguous-trait-matching-distinct-lifetimes.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//! <https://github.com/rust-lang/rust/issues/21974>.
//!
//! Test that (for now) we report an ambiguity error here, because
//! specific trait relationships are ignored for the purposes of trait
//! matching. This behavior should likely be improved such that this
//! test passes.

trait Foo {
fn foo(self);
}

fn foo<'a,'b,T>(x: &'a T, y: &'b T)
where &'a T : Foo, //~ ERROR type annotations needed
&'b T : Foo
{
x.foo(); //~ ERROR type annotations needed
y.foo();
}

fn main() { }
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
error[E0283]: type annotations needed: cannot satisfy `&'a T: Foo`
--> $DIR/issue-21974.rs:11:19
--> $DIR/ambiguous-trait-matching-distinct-lifetimes.rs:13:19
|
LL | where &'a T : Foo,
| ^^^
|
note: multiple `impl`s or `where` clauses satisfying `&'a T: Foo` found
--> $DIR/issue-21974.rs:11:19
--> $DIR/ambiguous-trait-matching-distinct-lifetimes.rs:13:19
|
LL | where &'a T : Foo,
| ^^^
LL | &'b T : Foo
| ^^^

error[E0283]: type annotations needed: cannot satisfy `&T: Foo`
--> $DIR/issue-21974.rs:14:7
--> $DIR/ambiguous-trait-matching-distinct-lifetimes.rs:16:7
|
LL | x.foo();
| ^^^
|
note: multiple `impl`s or `where` clauses satisfying `&T: Foo` found
--> $DIR/issue-21974.rs:11:19
--> $DIR/ambiguous-trait-matching-distinct-lifetimes.rs:13:19
|
LL | where &'a T : 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/21701>.
fn foo<U>(t: U) {
let y = t();
//~^ ERROR: expected function, found `U`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0618]: expected function, found `U`
--> $DIR/issue-21701.rs:2:13
--> $DIR/call-non-fn-type-param.rs:4:13
|
LL | fn foo<U>(t: U) {
| - `t` has type `U`
Expand All @@ -9,7 +9,7 @@ LL | let y = t();
| call expression requires function

error[E0618]: expected function, found struct `Bar`
--> $DIR/issue-21701.rs:9:13
--> $DIR/call-non-fn-type-param.rs:11:13
|
LL | struct Bar;
| ---------- struct `Bar` defined here
Expand Down
Loading