Add test batch 1

This commit is contained in:
Oneirical 2025-08-20 14:02:39 -04:00
parent e8a792daf5
commit 2e659f5894
46 changed files with 66 additions and 80 deletions

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/6738
struct Foo<T> {
x: T,
}

View file

@ -1,5 +1,5 @@
error[E0368]: binary assignment operation `+=` cannot be applied to type `T`
--> $DIR/issue-6738.rs:6:9
--> $DIR/struct-field-generic-type-binary-assignment-error-6738.rs:7:9
|
LL | self.x += v.x;
| ------^^^^^^^

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/5884
//@ build-pass
#![allow(dead_code)]

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/5550
//@ run-pass
#![allow(unused_assignments)]

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/5708
//@ run-pass
#![allow(unused_variables)]
/*
@ -10,7 +11,6 @@ This does not occur with concrete types, only with references
to traits.
*/
// original
trait Inner {
fn print(&self);
@ -38,7 +38,6 @@ pub fn main() {
outer.inner.print();
}
// minimal
pub trait MyTrait<T> {
fn dummy(&self, t: T) -> T { panic!() }

View file

@ -0,0 +1,7 @@
// https://github.com/rust-lang/rust/issues/5518
//@ run-pass
//@ aux-build:aux-5518.rs
extern crate aux_5518 as other;
fn main() {}

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/6557
//@ check-pass
#![allow(dead_code)]

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/6318
//@ run-pass
pub enum Thing {

View file

@ -1,6 +1,6 @@
// https://github.com/rust-lang/rust/issues/6153
//@ run-pass
fn swap<F>(f: F) -> Vec<isize> where F: FnOnce(Vec<isize>) -> Vec<isize> {
let x = vec![1, 2, 3];
f(x)

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/7012
//@ run-pass
#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/5900
//@ check-pass
#![allow(dead_code)]

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/5997
//@ run-pass
#![allow(dead_code)]

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/6117
//@ run-pass
#![allow(dead_code)]

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/5997
fn f<Z>() -> bool {
enum E { V(Z) }
//~^ ERROR can't use generic parameters from outer item

View file

@ -1,5 +1,5 @@
error[E0401]: can't use generic parameters from outer item
--> $DIR/issue-5997-enum.rs:2:16
--> $DIR/enum-definition-with-outer-generic-parameter-5997.rs:3:16
|
LL | fn f<Z>() -> bool {
| - type parameter from outer item

View file

@ -1,7 +0,0 @@
//@ run-pass
//@ aux-build:issue-5518.rs
extern crate issue_5518 as other;
fn main() {}

View file

@ -1,7 +0,0 @@
//@aux-build:issue-5844-aux.rs
extern crate issue_5844_aux;
fn main() {
issue_5844_aux::rand(); //~ ERROR: requires unsafe
}

View file

@ -1,10 +0,0 @@
fn f<T>() -> bool {
struct S(T); //~ ERROR can't use generic parameters from outer item
true
}
fn main() {
let b = f::<isize>();
assert!(b);
}

View file

@ -1,13 +0,0 @@
error[E0401]: can't use generic parameters from outer item
--> $DIR/issue-5997-struct.rs:2:14
|
LL | fn f<T>() -> bool {
| - type parameter from outer item
LL | struct S(T);
| -^ use of generic parameter from outer item
| |
| help: try introducing a local generic parameter here: `<T>`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0401`.

View file

@ -1,18 +0,0 @@
//@ run-pass
#![allow(non_shorthand_field_patterns)]
struct A { x: usize }
impl Drop for A {
fn drop(&mut self) {}
}
pub fn main() {
let a = A { x: 0 };
match a {
A { x : ref x } => {
println!("{}", x)
}
}
}

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/5741
//@ run-pass
#![allow(while_true)]
#![allow(unreachable_code)]

View file

@ -1,7 +1,7 @@
// https://github.com/rust-lang/rust/issues/5554
//@ run-pass
#![allow(dead_code)]
pub struct X<T> {
a: T,
}

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/5718
//@ run-pass
struct Element;

View file

@ -1,8 +1,13 @@
enum Either<T, U> { Left(T), Right(U) }
// https://github.com/rust-lang/rust/issues/5358
enum Either<T, U> {
Left(T),
Right(U),
}
struct S(Either<usize, usize>);
fn main() {
match S(Either::Left(5)) { //~ NOTE this expression has type `S`
match S(Either::Left(5)) {
//~^ NOTE this expression has type `S`
Either::Right(_) => {}
//~^ ERROR mismatched types
//~| NOTE expected `S`, found `Either<_, _>`

View file

@ -1,8 +1,9 @@
error[E0308]: mismatched types
--> $DIR/issue-5358-1.rs:6:9
--> $DIR/mismatched-types-in-match-5358.rs:11:9
|
LL | match S(Either::Left(5)) {
| ------------------ this expression has type `S`
LL |
LL | Either::Right(_) => {}
| ^^^^^^^^^^^^^^^^ expected `S`, found `Either<_, _>`
|

View file

@ -1,6 +1,6 @@
// https://github.com/rust-lang/rust/issues/5950
//@ check-pass
pub use local as local_alias;
pub mod local { }

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/6130
//@ run-pass
pub fn main() {

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/5572
//@ check-pass
#![allow(dead_code)]

View file

@ -1,7 +1,7 @@
// https://github.com/rust-lang/rust/issues/6919
//@ run-pass
#![allow(unused_attributes)]
//@ aux-build:iss.rs
//@ aux-build:iss-6919.rs
extern crate issue6919_3;

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/6936
struct T;
mod t1 {
@ -30,5 +31,4 @@ mod t6 {
impl Foo {} // ok
}
fn main() {}

View file

@ -1,5 +1,5 @@
error[E0428]: the name `Foo` is defined multiple times
--> $DIR/issue-6936.rs:5:5
--> $DIR/duplicate-name-in-module-6936.rs:6:5
|
LL | type Foo = crate::T;
| -------------------- previous definition of the type `Foo` here
@ -9,7 +9,7 @@ LL | mod Foo {}
= note: `Foo` must be defined only once in the type namespace of this module
error[E0428]: the name `Foo` is defined multiple times
--> $DIR/issue-6936.rs:10:5
--> $DIR/duplicate-name-in-module-6936.rs:11:5
|
LL | type Foo = crate::T;
| -------------------- previous definition of the type `Foo` here
@ -19,7 +19,7 @@ LL | struct Foo;
= note: `Foo` must be defined only once in the type namespace of this module
error[E0428]: the name `Foo` is defined multiple times
--> $DIR/issue-6936.rs:15:5
--> $DIR/duplicate-name-in-module-6936.rs:16:5
|
LL | type Foo = crate::T;
| -------------------- previous definition of the type `Foo` here
@ -29,7 +29,7 @@ LL | enum 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-6936.rs:25:5
--> $DIR/duplicate-name-in-module-6936.rs:26:5
|
LL | type Bar<T> = T;
| ---------------- previous definition of the type `Bar` here

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/5917
//@ run-pass
#![allow(non_upper_case_globals)]

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/5688
//@ run-pass
/*
# Corrupted initialization in the static struct

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/6344
//@ run-pass
#![allow(non_shorthand_field_patterns)]

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/5439
struct Foo {
foo: isize,
}

View file

@ -1,5 +1,5 @@
error[E0560]: struct `Foo` has no field named `nonexistent`
--> $DIR/issue-5439.rs:11:31
--> $DIR/nonexistent-struct-field-error-5439.rs:12:31
|
LL | return Box::new(Foo { nonexistent: self, foo: i });
| ^^^^^^^^^^^ `Foo` does not have this field

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/5666
//@ run-pass
struct Dog {
@ -14,7 +15,6 @@ impl Barks for Dog {
}
}
pub fn main() {
let snoopy = Box::new(Dog{name: "snoopy".to_string()});
let bubbles = Box::new(Dog{name: "bubbles".to_string()});

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/5883
trait A {}
struct Struct {

View file

@ -1,19 +1,19 @@
error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time
--> $DIR/issue-5883.rs:9:6
--> $DIR/opaque-trait-size-error-5883.rs:10:6
|
LL | ) -> Struct {
| ^^^^^^ doesn't have a size known at compile-time
|
= help: within `Struct`, the trait `Sized` is not implemented for `(dyn A + 'static)`
note: required because it appears within the type `Struct`
--> $DIR/issue-5883.rs:3:8
--> $DIR/opaque-trait-size-error-5883.rs:4:8
|
LL | struct Struct {
| ^^^^^^
= note: the return type of a function must have a statically known size
error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time
--> $DIR/issue-5883.rs:8:8
--> $DIR/opaque-trait-size-error-5883.rs:9:8
|
LL | r: dyn A + 'static
| ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/6898
//@ check-pass
use std::mem;

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/5988
//@ run-pass
trait B {

View file

@ -0,0 +1,8 @@
// https://github.com/rust-lang/rust/issues/5844
//@aux-build:aux-5844.rs
extern crate aux_5844;
fn main() {
aux_5844::rand(); //~ ERROR: requires unsafe
}

View file

@ -1,8 +1,8 @@
error[E0133]: call to unsafe function `rand` is unsafe and requires unsafe function or block
--> $DIR/issue-5844.rs:6:5
--> $DIR/extern-function-requires-unsafe-5844.rs:7:5
|
LL | issue_5844_aux::rand();
| ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
LL | aux_5844::rand();
| ^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior