Skip to content

tests/ui/issues/: The Issues Strike Back [2/N] #144397

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
Aug 1, 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
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/13264

//@ run-pass
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
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/11709

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

use std::sync::mpsc::channel;
use std::thread;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0382]: use of moved value: `tx`
--> $DIR/issue-12041.rs:8:22
--> $DIR/moved-value-in-thread-loop-12041.rs:10:22
|
LL | let tx = tx;
| ^^ value moved here, in previous iteration of loop
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/12033

//@ run-pass
use std::cell::RefCell;

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/11869

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

#![feature(unboxed_closures, tuple_trait)]

fn to_fn_once<A:std::marker::Tuple,F:FnOnce<A>>(f: F) -> F { f }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
error[E0382]: use of moved value: `f`
--> $DIR/issue-12127.rs:11:9
--> $DIR/fnonce-moved-twice-12127.rs:13:9
|
LL | f();
| --- `f` moved due to this call
LL | f();
| ^ value used here after move
|
note: this value implements `FnOnce`, which causes it to be moved when called
--> $DIR/issue-12127.rs:10:9
--> $DIR/fnonce-moved-twice-12127.rs:12:9
|
LL | f();
| ^
= note: move occurs because `f` has type `{closure@$DIR/issue-12127.rs:8:24: 8:30}`, which does not implement the `Copy` trait
= note: move occurs because `f` has type `{closure@$DIR/fnonce-moved-twice-12127.rs:10:24: 10:30}`, which does not implement the `Copy` trait

error: aborting due to 1 previous error

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/11958

//@ run-pass

// We shouldn't need to rebind a moved upvar as mut if it's already
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
warning: value assigned to `x` is never read
--> $DIR/issue-11958.rs:8:36
--> $DIR/moved-upvar-mut-rebind-11958.rs:10:36
|
LL | let _thunk = Box::new(move|| { x = 2; });
| ^
Expand All @@ -8,7 +8,7 @@ LL | let _thunk = Box::new(move|| { x = 2; });
= note: `#[warn(unused_assignments)]` on by default

warning: unused variable: `x`
--> $DIR/issue-11958.rs:8:36
--> $DIR/moved-upvar-mut-rebind-11958.rs:10:36
|
LL | let _thunk = Box::new(move|| { x = 2; });
| ^
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/12744

//@ run-pass
fn main() {
fn test() -> Box<dyn std::any::Any + 'static> { Box::new(1) }
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/12860

//@ run-pass
use std::collections::HashSet;

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/13446

// Used to cause ICE

static VEC: [u32; 256] = vec![];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/issue-13446.rs:3:26
--> $DIR/vec-macro-in-static-array.rs:5:26
|
LL | static VEC: [u32; 256] = vec![];
| ^^^^^^ expected `[u32; 256]`, found `Vec<_>`
Expand Down
49 changes: 49 additions & 0 deletions tests/ui/extern/windows-tcb-trash-13259.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//! Regression test for https://github.com/rust-lang/rust/issues/13259

//@ run-pass

#[cfg(windows)]
mod imp {
type LPVOID = *mut u8;
type DWORD = u32;
type LPWSTR = *mut u16;

extern "system" {
fn FormatMessageW(
flags: DWORD,
lpSrc: LPVOID,
msgId: DWORD,
langId: DWORD,
buf: LPWSTR,
nsize: DWORD,
args: *const u8,
) -> DWORD;
}

pub fn test() {
let mut buf: [u16; 50] = [0; 50];
let ret = unsafe {
FormatMessageW(
0x1000,
core::ptr::null_mut(),
1,
0x400,
buf.as_mut_ptr(),
buf.len() as u32,
core::ptr::null(),
)
};
// On some 32-bit Windowses (Win7-8 at least) this will panic with segmented
// stacks taking control of pvArbitrary
assert!(ret != 0);
}
}

#[cfg(not(windows))]
mod imp {
pub fn test() {}
}

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

//@ edition: 2015
//@ check-pass

Expand Down
39 changes: 0 additions & 39 deletions tests/ui/issues/issue-13259-windows-tcb-trash.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/12677

//@ run-pass

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/13058

use std::ops::Range;

trait Itble<'r, T, I: Iterator<Item=T>> { fn iter(&'r self) -> I; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0621]: explicit lifetime required in the type of `cont`
--> $DIR/issue-13058.rs:14:21
--> $DIR/iterator-trait-lifetime-error-13058.rs:16:21
|
LL | let cont_iter = cont.iter();
| ^^^^^^^^^^^ lifetime `'r` required
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/13167

//@ check-pass
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
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/13323

//@ run-pass

struct StrWrap {
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/13405
//@ 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/11740

//@ check-pass

struct Attr {
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/11844

fn main() {
let a = Some(Box::new(1));
match a {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/issue-11844.rs:4:9
--> $DIR/option-result-mismatch-11844.rs:6:9
|
LL | match a {
| - this expression has type `Option<Box<{integer}>>`
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/13466

// Regression test for #13466

//@ dont-require-annotations: NOTE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/issue-13466.rs:10:9
--> $DIR/option-result-type-param-mismatch-13466.rs:12:9
|
LL | let _x: usize = match Some(1) {
| ------- this expression has type `Option<{integer}>`
Expand All @@ -10,7 +10,7 @@ LL | Ok(u) => u,
found enum `Result<_, _>`

error[E0308]: mismatched types
--> $DIR/issue-13466.rs:16:9
--> $DIR/option-result-type-param-mismatch-13466.rs:18:9
|
LL | let _x: usize = match Some(1) {
| ------- this expression has type `Option<{integer}>`
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/13027

//@ run-pass

// Tests that match expression handles overlapped literal and range
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/12567

fn match_vecs<'a, T>(l1: &'a [T], l2: &'a [T]) {
match (l1, l2) {
//~^ ERROR: cannot move out of type `[T]`, a non-copy slice
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0508]: cannot move out of type `[T]`, a non-copy slice
--> $DIR/issue-12567.rs:2:11
--> $DIR/slice-move-out-error-12567.rs:4:11
|
LL | match (l1, l2) {
| ^^^^^^^^ cannot move out of here
Expand All @@ -23,7 +23,7 @@ LL + (&[hd1, ..], [hd2, ..])
|

error[E0508]: cannot move out of type `[T]`, a non-copy slice
--> $DIR/issue-12567.rs:2:11
--> $DIR/slice-move-out-error-12567.rs:4:11
|
LL | match (l1, l2) {
| ^^^^^^^^ cannot move out of 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/12285

//@ run-pass

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/12920

//@ run-fail
//@ error-pattern:explicit panic
//@ needs-subprocess
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/13407

mod A {
struct C;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
error[E0603]: unit struct `C` is private
--> $DIR/issue-13407.rs:6:8
--> $DIR/private-unit-struct-assignment.rs:8:8
|
LL | A::C = 1;
| ^ private unit struct
|
note: the unit struct `C` is defined here
--> $DIR/issue-13407.rs:2:5
--> $DIR/private-unit-struct-assignment.rs:4:5
|
LL | struct C;
| ^^^^^^^^^

error[E0308]: mismatched types
--> $DIR/issue-13407.rs:6:5
--> $DIR/private-unit-struct-assignment.rs:8:5
|
LL | struct C;
| -------- unit struct 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/12729

//@ edition: 2015
//@ 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/11820

//@ run-pass

#![allow(noop_method_call)]
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/13214

//@ build-pass
#![allow(dead_code)]
// defining static with struct that contains enum
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/13204

//@ run-pass
#![allow(unused_mut)]
// Test that when instantiating trait default methods, typeck handles
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/13434

//@ run-pass
#[derive(Debug)]
struct MyStruct;
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/12909

//@ run-pass
#![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/12863
mod foo { pub fn bar() {} }

fn main() {
Expand Down
Loading
Loading