From 2e659f58940a31fa625e88f75f78111ed773f32d Mon Sep 17 00:00:00 2001 From: Oneirical Date: Wed, 20 Aug 2025 14:02:39 -0400 Subject: Add test batch 1 --- ...ld-generic-type-binary-assignment-error-6738.rs | 11 +++++ ...eneric-type-binary-assignment-error-6738.stderr | 16 +++++++ tests/ui/borrowck/auxiliary/aux-5518.rs | 4 ++ .../ui/borrowck/borrowed-pointer-in-struct-5884.rs | 18 +++++++ .../incorrect-loan-error-on-local-update-5550.rs | 9 ++++ .../struct-with-reference-to-trait-5708.rs | 54 +++++++++++++++++++++ .../trait-method-lifetime-substitution-5518.rs | 7 +++ tests/ui/box/box-patterns-feature-usage-6557.rs | 9 ++++ tests/ui/cast/owned-struct-to-trait-cast-6318.rs | 20 ++++++++ tests/ui/closures/closure-mut-argument-6153.rs | 13 +++++ tests/ui/codegen/static-array-comparison-7012.rs | 23 +++++++++ tests/ui/enum/enum-referred-by-submodule-5900.rs | 15 ++++++ tests/ui/enum/enum-with-generic-parameter-5997.rs | 16 +++++++ tests/ui/enum/match-either-enum-variants-6117.rs | 12 +++++ ...definition-with-outer-generic-parameter-5997.rs | 11 +++++ ...nition-with-outer-generic-parameter-5997.stderr | 13 +++++ tests/ui/issues/auxiliary/iss.rs | 12 ----- tests/ui/issues/auxiliary/issue-5518.rs | 4 -- tests/ui/issues/auxiliary/issue-5844-aux.rs | 3 -- tests/ui/issues/issue-5358-1.rs | 13 ----- tests/ui/issues/issue-5358-1.stderr | 22 --------- tests/ui/issues/issue-5439.rs | 19 -------- tests/ui/issues/issue-5439.stderr | 11 ----- tests/ui/issues/issue-5518.rs | 7 --- tests/ui/issues/issue-5550.rs | 8 ---- tests/ui/issues/issue-5554.rs | 27 ----------- tests/ui/issues/issue-5572.rs | 6 --- tests/ui/issues/issue-5666.rs | 26 ---------- tests/ui/issues/issue-5688.rs | 20 -------- tests/ui/issues/issue-5708.rs | 55 ---------------------- tests/ui/issues/issue-5718.rs | 23 --------- tests/ui/issues/issue-5741.rs | 8 ---- tests/ui/issues/issue-5844.rs | 7 --- tests/ui/issues/issue-5844.stderr | 11 ----- tests/ui/issues/issue-5883.rs | 13 ----- tests/ui/issues/issue-5883.stderr | 35 -------------- tests/ui/issues/issue-5884.rs | 17 ------- tests/ui/issues/issue-5900.rs | 14 ------ tests/ui/issues/issue-5917.rs | 9 ---- tests/ui/issues/issue-5950.rs | 8 ---- tests/ui/issues/issue-5988.rs | 23 --------- .../issue-5997-enum.rs | 10 ---- .../issue-5997-enum.stderr | 13 ----- .../issue-5997-struct.rs | 10 ---- .../issue-5997-struct.stderr | 13 ----- .../issue-5997.rs | 15 ------ tests/ui/issues/issue-6117.rs | 11 ----- tests/ui/issues/issue-6130.rs | 10 ---- tests/ui/issues/issue-6153.rs | 13 ----- tests/ui/issues/issue-6318.rs | 19 -------- tests/ui/issues/issue-6344-let.rs | 15 ------ tests/ui/issues/issue-6344-match.rs | 18 ------- tests/ui/issues/issue-6557.rs | 8 ---- tests/ui/issues/issue-6738.rs | 10 ---- tests/ui/issues/issue-6738.stderr | 16 ------- tests/ui/issues/issue-6898.rs | 32 ------------- tests/ui/issues/issue-6919.rs | 10 ---- tests/ui/issues/issue-6936.rs | 34 ------------- tests/ui/issues/issue-6936.stderr | 43 ----------------- tests/ui/issues/issue-7012.rs | 22 --------- tests/ui/loops/unreachable-while-loop-5741.rs | 9 ++++ .../macro-variable-declaration-with-bounds-5554.rs | 27 +++++++++++ .../macros/macro-variable-unused-reporting-5718.rs | 24 ++++++++++ tests/ui/match/mismatched-types-in-match-5358.rs | 18 +++++++ .../ui/match/mismatched-types-in-match-5358.stderr | 23 +++++++++ tests/ui/modules/pub-use-module-alias-5950.rs | 8 ++++ tests/ui/numeric/type-limit-comparisons-6130.rs | 11 +++++ tests/ui/parser/partial-eq-trait-bound-5572.rs | 7 +++ tests/ui/privacy/auxiliary/iss-6919.rs | 12 +++++ .../ui/privacy/deref-separate-compile-unit-6919.rs | 10 ++++ tests/ui/resolve/duplicate-name-in-module-6936.rs | 34 +++++++++++++ .../resolve/duplicate-name-in-module-6936.stderr | 43 +++++++++++++++++ tests/ui/static/static-list-initialization-5917.rs | 10 ++++ .../ui/static/static-struct-initialization-5688.rs | 21 +++++++++ .../structs/destructuring-struct-with-dtor-6344.rs | 16 +++++++ .../structs/nonexistent-struct-field-error-5439.rs | 20 ++++++++ .../nonexistent-struct-field-error-5439.stderr | 11 +++++ .../traits/dynamic-dispatch-trait-objects-5666.rs | 26 ++++++++++ tests/ui/traits/opaque-trait-size-error-5883.rs | 14 ++++++ .../ui/traits/opaque-trait-size-error-5883.stderr | 35 ++++++++++++++ .../trait-implementation-generic-access-6898.rs | 33 +++++++++++++ .../trait-implementation-restriction-5988.rs | 24 ++++++++++ tests/ui/unsafe/auxiliary/aux-5844.rs | 3 ++ .../unsafe/extern-function-requires-unsafe-5844.rs | 8 ++++ .../extern-function-requires-unsafe-5844.stderr | 11 +++++ 85 files changed, 709 insertions(+), 723 deletions(-) create mode 100644 tests/ui/binop/struct-field-generic-type-binary-assignment-error-6738.rs create mode 100644 tests/ui/binop/struct-field-generic-type-binary-assignment-error-6738.stderr create mode 100644 tests/ui/borrowck/auxiliary/aux-5518.rs create mode 100644 tests/ui/borrowck/borrowed-pointer-in-struct-5884.rs create mode 100644 tests/ui/borrowck/incorrect-loan-error-on-local-update-5550.rs create mode 100644 tests/ui/borrowck/struct-with-reference-to-trait-5708.rs create mode 100644 tests/ui/borrowck/trait-method-lifetime-substitution-5518.rs create mode 100644 tests/ui/box/box-patterns-feature-usage-6557.rs create mode 100644 tests/ui/cast/owned-struct-to-trait-cast-6318.rs create mode 100644 tests/ui/closures/closure-mut-argument-6153.rs create mode 100644 tests/ui/codegen/static-array-comparison-7012.rs create mode 100644 tests/ui/enum/enum-referred-by-submodule-5900.rs create mode 100644 tests/ui/enum/enum-with-generic-parameter-5997.rs create mode 100644 tests/ui/enum/match-either-enum-variants-6117.rs create mode 100644 tests/ui/generics/enum-definition-with-outer-generic-parameter-5997.rs create mode 100644 tests/ui/generics/enum-definition-with-outer-generic-parameter-5997.stderr delete mode 100644 tests/ui/issues/auxiliary/iss.rs delete mode 100644 tests/ui/issues/auxiliary/issue-5518.rs delete mode 100644 tests/ui/issues/auxiliary/issue-5844-aux.rs delete mode 100644 tests/ui/issues/issue-5358-1.rs delete mode 100644 tests/ui/issues/issue-5358-1.stderr delete mode 100644 tests/ui/issues/issue-5439.rs delete mode 100644 tests/ui/issues/issue-5439.stderr delete mode 100644 tests/ui/issues/issue-5518.rs delete mode 100644 tests/ui/issues/issue-5550.rs delete mode 100644 tests/ui/issues/issue-5554.rs delete mode 100644 tests/ui/issues/issue-5572.rs delete mode 100644 tests/ui/issues/issue-5666.rs delete mode 100644 tests/ui/issues/issue-5688.rs delete mode 100644 tests/ui/issues/issue-5708.rs delete mode 100644 tests/ui/issues/issue-5718.rs delete mode 100644 tests/ui/issues/issue-5741.rs delete mode 100644 tests/ui/issues/issue-5844.rs delete mode 100644 tests/ui/issues/issue-5844.stderr delete mode 100644 tests/ui/issues/issue-5883.rs delete mode 100644 tests/ui/issues/issue-5883.stderr delete mode 100644 tests/ui/issues/issue-5884.rs delete mode 100644 tests/ui/issues/issue-5900.rs delete mode 100644 tests/ui/issues/issue-5917.rs delete mode 100644 tests/ui/issues/issue-5950.rs delete mode 100644 tests/ui/issues/issue-5988.rs delete mode 100644 tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-enum.rs delete mode 100644 tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-enum.stderr delete mode 100644 tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-struct.rs delete mode 100644 tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-struct.stderr delete mode 100644 tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997.rs delete mode 100644 tests/ui/issues/issue-6117.rs delete mode 100644 tests/ui/issues/issue-6130.rs delete mode 100644 tests/ui/issues/issue-6153.rs delete mode 100644 tests/ui/issues/issue-6318.rs delete mode 100644 tests/ui/issues/issue-6344-let.rs delete mode 100644 tests/ui/issues/issue-6344-match.rs delete mode 100644 tests/ui/issues/issue-6557.rs delete mode 100644 tests/ui/issues/issue-6738.rs delete mode 100644 tests/ui/issues/issue-6738.stderr delete mode 100644 tests/ui/issues/issue-6898.rs delete mode 100644 tests/ui/issues/issue-6919.rs delete mode 100644 tests/ui/issues/issue-6936.rs delete mode 100644 tests/ui/issues/issue-6936.stderr delete mode 100644 tests/ui/issues/issue-7012.rs create mode 100644 tests/ui/loops/unreachable-while-loop-5741.rs create mode 100644 tests/ui/macros/macro-variable-declaration-with-bounds-5554.rs create mode 100644 tests/ui/macros/macro-variable-unused-reporting-5718.rs create mode 100644 tests/ui/match/mismatched-types-in-match-5358.rs create mode 100644 tests/ui/match/mismatched-types-in-match-5358.stderr create mode 100644 tests/ui/modules/pub-use-module-alias-5950.rs create mode 100644 tests/ui/numeric/type-limit-comparisons-6130.rs create mode 100644 tests/ui/parser/partial-eq-trait-bound-5572.rs create mode 100644 tests/ui/privacy/auxiliary/iss-6919.rs create mode 100644 tests/ui/privacy/deref-separate-compile-unit-6919.rs create mode 100644 tests/ui/resolve/duplicate-name-in-module-6936.rs create mode 100644 tests/ui/resolve/duplicate-name-in-module-6936.stderr create mode 100644 tests/ui/static/static-list-initialization-5917.rs create mode 100644 tests/ui/static/static-struct-initialization-5688.rs create mode 100644 tests/ui/structs/destructuring-struct-with-dtor-6344.rs create mode 100644 tests/ui/structs/nonexistent-struct-field-error-5439.rs create mode 100644 tests/ui/structs/nonexistent-struct-field-error-5439.stderr create mode 100644 tests/ui/traits/dynamic-dispatch-trait-objects-5666.rs create mode 100644 tests/ui/traits/opaque-trait-size-error-5883.rs create mode 100644 tests/ui/traits/opaque-trait-size-error-5883.stderr create mode 100644 tests/ui/traits/trait-implementation-generic-access-6898.rs create mode 100644 tests/ui/traits/trait-implementation-restriction-5988.rs create mode 100644 tests/ui/unsafe/auxiliary/aux-5844.rs create mode 100644 tests/ui/unsafe/extern-function-requires-unsafe-5844.rs create mode 100644 tests/ui/unsafe/extern-function-requires-unsafe-5844.stderr diff --git a/tests/ui/binop/struct-field-generic-type-binary-assignment-error-6738.rs b/tests/ui/binop/struct-field-generic-type-binary-assignment-error-6738.rs new file mode 100644 index 00000000000..856caa2b297 --- /dev/null +++ b/tests/ui/binop/struct-field-generic-type-binary-assignment-error-6738.rs @@ -0,0 +1,11 @@ +// https://github.com/rust-lang/rust/issues/6738 +struct Foo { + x: T, +} +impl Foo { + fn add(&mut self, v: Foo){ + self.x += v.x; + //~^ ERROR: binary assignment operation `+=` cannot be applied + } +} +fn main() {} diff --git a/tests/ui/binop/struct-field-generic-type-binary-assignment-error-6738.stderr b/tests/ui/binop/struct-field-generic-type-binary-assignment-error-6738.stderr new file mode 100644 index 00000000000..060d33079d3 --- /dev/null +++ b/tests/ui/binop/struct-field-generic-type-binary-assignment-error-6738.stderr @@ -0,0 +1,16 @@ +error[E0368]: binary assignment operation `+=` cannot be applied to type `T` + --> $DIR/struct-field-generic-type-binary-assignment-error-6738.rs:7:9 + | +LL | self.x += v.x; + | ------^^^^^^^ + | | + | cannot use `+=` on type `T` + | +help: consider restricting type parameter `T` with trait `AddAssign` + | +LL | impl Foo { + | +++++++++++++++++++++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0368`. diff --git a/tests/ui/borrowck/auxiliary/aux-5518.rs b/tests/ui/borrowck/auxiliary/aux-5518.rs new file mode 100644 index 00000000000..bfe96552a5c --- /dev/null +++ b/tests/ui/borrowck/auxiliary/aux-5518.rs @@ -0,0 +1,4 @@ +trait A<'a, T> { + fn f(&mut self) -> &'a mut T; + fn p() -> T; +} diff --git a/tests/ui/borrowck/borrowed-pointer-in-struct-5884.rs b/tests/ui/borrowck/borrowed-pointer-in-struct-5884.rs new file mode 100644 index 00000000000..d2f17cf905d --- /dev/null +++ b/tests/ui/borrowck/borrowed-pointer-in-struct-5884.rs @@ -0,0 +1,18 @@ +// https://github.com/rust-lang/rust/issues/5884 +//@ build-pass +#![allow(dead_code)] + +pub struct Foo { + a: isize, +} + +struct Bar<'a> { + a: Box>, + b: &'a Foo, +} + +fn check(a: Box) { + let _ic = Bar{ b: &*a, a: Box::new(None) }; +} + +pub fn main(){} diff --git a/tests/ui/borrowck/incorrect-loan-error-on-local-update-5550.rs b/tests/ui/borrowck/incorrect-loan-error-on-local-update-5550.rs new file mode 100644 index 00000000000..2258d768657 --- /dev/null +++ b/tests/ui/borrowck/incorrect-loan-error-on-local-update-5550.rs @@ -0,0 +1,9 @@ +// https://github.com/rust-lang/rust/issues/5550 +//@ run-pass +#![allow(unused_assignments)] + +pub fn main() { + let s: String = "foobar".to_string(); + let mut t: &str = &s; + t = &t[0..3]; // for master: str::view(t, 0, 3) maybe +} diff --git a/tests/ui/borrowck/struct-with-reference-to-trait-5708.rs b/tests/ui/borrowck/struct-with-reference-to-trait-5708.rs new file mode 100644 index 00000000000..5157a3bf36b --- /dev/null +++ b/tests/ui/borrowck/struct-with-reference-to-trait-5708.rs @@ -0,0 +1,54 @@ +// https://github.com/rust-lang/rust/issues/5708 +//@ run-pass +#![allow(unused_variables)] +/* +# ICE when returning struct with reference to trait + +A function which takes a reference to a trait and returns a +struct with that reference results in an ICE. + +This does not occur with concrete types, only with references +to traits. +*/ + +// original +trait Inner { + fn print(&self); +} + +impl Inner for isize { + fn print(&self) { print!("Inner: {}\n", *self); } +} + +struct Outer<'a> { + inner: &'a (dyn Inner+'a) +} + +impl<'a> Outer<'a> { + fn new(inner: &dyn Inner) -> Outer<'_> { + Outer { + inner: inner + } + } +} + +pub fn main() { + let inner: isize = 5; + let outer = Outer::new(&inner as &dyn Inner); + outer.inner.print(); +} + +// minimal +pub trait MyTrait { + fn dummy(&self, t: T) -> T { panic!() } +} + +pub struct MyContainer<'a, T:'a> { + foos: Vec<&'a (dyn MyTrait+'a)> , +} + +impl<'a, T> MyContainer<'a, T> { + pub fn add (&mut self, foo: &'a dyn MyTrait) { + self.foos.push(foo); + } +} diff --git a/tests/ui/borrowck/trait-method-lifetime-substitution-5518.rs b/tests/ui/borrowck/trait-method-lifetime-substitution-5518.rs new file mode 100644 index 00000000000..f254030a011 --- /dev/null +++ b/tests/ui/borrowck/trait-method-lifetime-substitution-5518.rs @@ -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() {} diff --git a/tests/ui/box/box-patterns-feature-usage-6557.rs b/tests/ui/box/box-patterns-feature-usage-6557.rs new file mode 100644 index 00000000000..e0d9b25c366 --- /dev/null +++ b/tests/ui/box/box-patterns-feature-usage-6557.rs @@ -0,0 +1,9 @@ +// https://github.com/rust-lang/rust/issues/6557 +//@ check-pass +#![allow(dead_code)] + +#![feature(box_patterns)] + +fn foo(box (_x, _y): Box<(isize, isize)>) {} + +pub fn main() {} diff --git a/tests/ui/cast/owned-struct-to-trait-cast-6318.rs b/tests/ui/cast/owned-struct-to-trait-cast-6318.rs new file mode 100644 index 00000000000..8cfc77c4274 --- /dev/null +++ b/tests/ui/cast/owned-struct-to-trait-cast-6318.rs @@ -0,0 +1,20 @@ +// https://github.com/rust-lang/rust/issues/6318 +//@ run-pass + +pub enum Thing { + A(Box) +} + +pub trait Foo { + fn dummy(&self) { } +} + +pub struct Struct; + +impl Foo for Struct {} + +pub fn main() { + match Thing::A(Box::new(Struct) as Box) { + Thing::A(_a) => 0, + }; +} diff --git a/tests/ui/closures/closure-mut-argument-6153.rs b/tests/ui/closures/closure-mut-argument-6153.rs new file mode 100644 index 00000000000..ac19c2bd15f --- /dev/null +++ b/tests/ui/closures/closure-mut-argument-6153.rs @@ -0,0 +1,13 @@ +// https://github.com/rust-lang/rust/issues/6153 +//@ run-pass + +fn swap(f: F) -> Vec where F: FnOnce(Vec) -> Vec { + let x = vec![1, 2, 3]; + f(x) +} + +pub fn main() { + let v = swap(|mut x| { x.push(4); x }); + let w = swap(|mut x| { x.push(4); x }); + assert_eq!(v, w); +} diff --git a/tests/ui/codegen/static-array-comparison-7012.rs b/tests/ui/codegen/static-array-comparison-7012.rs new file mode 100644 index 00000000000..c08b1c0059b --- /dev/null +++ b/tests/ui/codegen/static-array-comparison-7012.rs @@ -0,0 +1,23 @@ +// https://github.com/rust-lang/rust/issues/7012 +//@ run-pass +#![allow(non_camel_case_types)] +#![allow(non_upper_case_globals)] + +/* +# Comparison of static arrays + +The expected behaviour would be that `test == test1`, therefore 'true' +would be printed, however the below prints false. +*/ + +struct signature<'a> { pattern : &'a [u32] } + +static test1: signature<'static> = signature { + pattern: &[0x243f6a88,0x85a308d3,0x13198a2e,0x03707344,0xa4093822,0x299f31d0] +}; + +pub fn main() { + let test: &[u32] = &[0x243f6a88,0x85a308d3,0x13198a2e, + 0x03707344,0xa4093822,0x299f31d0]; + println!("{}",test==test1.pattern); +} diff --git a/tests/ui/enum/enum-referred-by-submodule-5900.rs b/tests/ui/enum/enum-referred-by-submodule-5900.rs new file mode 100644 index 00000000000..4ed092670a8 --- /dev/null +++ b/tests/ui/enum/enum-referred-by-submodule-5900.rs @@ -0,0 +1,15 @@ +// https://github.com/rust-lang/rust/issues/5900 +//@ check-pass +#![allow(dead_code)] + +pub mod foo { + use super::Bar; + + pub struct FooStruct { bar : Bar } +} + +pub enum Bar { + Bar0 = 0 as isize +} + +pub fn main() {} diff --git a/tests/ui/enum/enum-with-generic-parameter-5997.rs b/tests/ui/enum/enum-with-generic-parameter-5997.rs new file mode 100644 index 00000000000..fab7ebbbbdc --- /dev/null +++ b/tests/ui/enum/enum-with-generic-parameter-5997.rs @@ -0,0 +1,16 @@ +// https://github.com/rust-lang/rust/issues/5997 +//@ run-pass +#![allow(dead_code)] + +fn f() -> bool { + enum E { V(T) } + + struct S(T); + + true +} + +fn main() { + let b = f::(); + assert!(b); +} diff --git a/tests/ui/enum/match-either-enum-variants-6117.rs b/tests/ui/enum/match-either-enum-variants-6117.rs new file mode 100644 index 00000000000..7b395066166 --- /dev/null +++ b/tests/ui/enum/match-either-enum-variants-6117.rs @@ -0,0 +1,12 @@ +// https://github.com/rust-lang/rust/issues/6117 +//@ run-pass +#![allow(dead_code)] + +enum Either { Left(T), Right(U) } + +pub fn main() { + match Either::Left(Box::new(17)) { + Either::Right(()) => {} + _ => {} + } +} diff --git a/tests/ui/generics/enum-definition-with-outer-generic-parameter-5997.rs b/tests/ui/generics/enum-definition-with-outer-generic-parameter-5997.rs new file mode 100644 index 00000000000..00bf66dd4e0 --- /dev/null +++ b/tests/ui/generics/enum-definition-with-outer-generic-parameter-5997.rs @@ -0,0 +1,11 @@ +// https://github.com/rust-lang/rust/issues/5997 +fn f() -> bool { + enum E { V(Z) } + //~^ ERROR can't use generic parameters from outer item + true +} + +fn main() { + let b = f::(); + assert!(b); +} diff --git a/tests/ui/generics/enum-definition-with-outer-generic-parameter-5997.stderr b/tests/ui/generics/enum-definition-with-outer-generic-parameter-5997.stderr new file mode 100644 index 00000000000..aea0f049b07 --- /dev/null +++ b/tests/ui/generics/enum-definition-with-outer-generic-parameter-5997.stderr @@ -0,0 +1,13 @@ +error[E0401]: can't use generic parameters from outer item + --> $DIR/enum-definition-with-outer-generic-parameter-5997.rs:3:16 + | +LL | fn f() -> bool { + | - type parameter from outer item +LL | enum E { V(Z) } + | - ^ use of generic parameter from outer item + | | + | help: try introducing a local generic parameter here: `` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0401`. diff --git a/tests/ui/issues/auxiliary/iss.rs b/tests/ui/issues/auxiliary/iss.rs deleted file mode 100644 index cf32f6c2d5d..00000000000 --- a/tests/ui/issues/auxiliary/iss.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![crate_name="issue6919_3"] - -// part of issue-6919.rs - -pub struct C where K: FnOnce() { - pub k: K, -} - -fn no_op() { } -pub const D : C = C { - k: no_op as fn() -}; diff --git a/tests/ui/issues/auxiliary/issue-5518.rs b/tests/ui/issues/auxiliary/issue-5518.rs deleted file mode 100644 index bfe96552a5c..00000000000 --- a/tests/ui/issues/auxiliary/issue-5518.rs +++ /dev/null @@ -1,4 +0,0 @@ -trait A<'a, T> { - fn f(&mut self) -> &'a mut T; - fn p() -> T; -} diff --git a/tests/ui/issues/auxiliary/issue-5844-aux.rs b/tests/ui/issues/auxiliary/issue-5844-aux.rs deleted file mode 100644 index ea83378cad6..00000000000 --- a/tests/ui/issues/auxiliary/issue-5844-aux.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern "C" { - pub fn rand() -> u32; -} diff --git a/tests/ui/issues/issue-5358-1.rs b/tests/ui/issues/issue-5358-1.rs deleted file mode 100644 index 281f219c039..00000000000 --- a/tests/ui/issues/issue-5358-1.rs +++ /dev/null @@ -1,13 +0,0 @@ -enum Either { Left(T), Right(U) } -struct S(Either); - -fn main() { - match S(Either::Left(5)) { //~ NOTE this expression has type `S` - Either::Right(_) => {} - //~^ ERROR mismatched types - //~| NOTE expected `S`, found `Either<_, _>` - //~| NOTE expected struct `S` - //~| NOTE found enum `Either<_, _>` - _ => {} - } -} diff --git a/tests/ui/issues/issue-5358-1.stderr b/tests/ui/issues/issue-5358-1.stderr deleted file mode 100644 index e68db865dc4..00000000000 --- a/tests/ui/issues/issue-5358-1.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/issue-5358-1.rs:6:9 - | -LL | match S(Either::Left(5)) { - | ------------------ this expression has type `S` -LL | Either::Right(_) => {} - | ^^^^^^^^^^^^^^^^ expected `S`, found `Either<_, _>` - | - = note: expected struct `S` - found enum `Either<_, _>` -help: try wrapping the pattern in `S` - | -LL | S(Either::Right(_)) => {} - | ++ + -help: you might have meant to use field `0` whose type is `Either` - | -LL | match S(Either::Left(5)).0 { - | ++ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-5439.rs b/tests/ui/issues/issue-5439.rs deleted file mode 100644 index 852b264dc5d..00000000000 --- a/tests/ui/issues/issue-5439.rs +++ /dev/null @@ -1,19 +0,0 @@ -struct Foo { - foo: isize, -} - -struct Bar { - bar: isize, -} - -impl Bar { - fn make_foo (&self, i: isize) -> Box { - return Box::new(Foo { nonexistent: self, foo: i }); //~ ERROR: no field named - } -} - -fn main () { - let bar = Bar { bar: 1 }; - let foo = bar.make_foo(2); - println!("{}", foo.foo); -} diff --git a/tests/ui/issues/issue-5439.stderr b/tests/ui/issues/issue-5439.stderr deleted file mode 100644 index 6d1d74e3045..00000000000 --- a/tests/ui/issues/issue-5439.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0560]: struct `Foo` has no field named `nonexistent` - --> $DIR/issue-5439.rs:11:31 - | -LL | return Box::new(Foo { nonexistent: self, foo: i }); - | ^^^^^^^^^^^ `Foo` does not have this field - | - = note: all struct fields are already assigned - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0560`. diff --git a/tests/ui/issues/issue-5518.rs b/tests/ui/issues/issue-5518.rs deleted file mode 100644 index 333185c482f..00000000000 --- a/tests/ui/issues/issue-5518.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@ run-pass -//@ aux-build:issue-5518.rs - - -extern crate issue_5518 as other; - -fn main() {} diff --git a/tests/ui/issues/issue-5550.rs b/tests/ui/issues/issue-5550.rs deleted file mode 100644 index 41de8ee5d32..00000000000 --- a/tests/ui/issues/issue-5550.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ run-pass -#![allow(unused_assignments)] - -pub fn main() { - let s: String = "foobar".to_string(); - let mut t: &str = &s; - t = &t[0..3]; // for master: str::view(t, 0, 3) maybe -} diff --git a/tests/ui/issues/issue-5554.rs b/tests/ui/issues/issue-5554.rs deleted file mode 100644 index 7d219a0df70..00000000000 --- a/tests/ui/issues/issue-5554.rs +++ /dev/null @@ -1,27 +0,0 @@ -//@ run-pass -#![allow(dead_code)] - - -pub struct X { - a: T, -} - -// reordering these bounds stops the ICE -// -// nmatsakis: This test used to have the bounds Default + PartialEq + -// Default, but having duplicate bounds became illegal. -impl Default for X { - fn default() -> X { - X { a: Default::default() } - } -} - -macro_rules! constants { - () => { - let _ : X = Default::default(); - } -} - -pub fn main() { - constants!(); -} diff --git a/tests/ui/issues/issue-5572.rs b/tests/ui/issues/issue-5572.rs deleted file mode 100644 index f27744ef0ac..00000000000 --- a/tests/ui/issues/issue-5572.rs +++ /dev/null @@ -1,6 +0,0 @@ -//@ check-pass -#![allow(dead_code)] - -fn foo(_t: T) { } - -pub fn main() { } diff --git a/tests/ui/issues/issue-5666.rs b/tests/ui/issues/issue-5666.rs deleted file mode 100644 index 76e2f8229a0..00000000000 --- a/tests/ui/issues/issue-5666.rs +++ /dev/null @@ -1,26 +0,0 @@ -//@ run-pass - -struct Dog { - name : String -} - -trait Barks { - fn bark(&self) -> String; -} - -impl Barks for Dog { - fn bark(&self) -> String { - return format!("woof! (I'm {})", self.name); - } -} - - -pub fn main() { - let snoopy = Box::new(Dog{name: "snoopy".to_string()}); - let bubbles = Box::new(Dog{name: "bubbles".to_string()}); - let barker = [snoopy as Box, bubbles as Box]; - - for pup in &barker { - println!("{}", pup.bark()); - } -} diff --git a/tests/ui/issues/issue-5688.rs b/tests/ui/issues/issue-5688.rs deleted file mode 100644 index a7db1dfb15f..00000000000 --- a/tests/ui/issues/issue-5688.rs +++ /dev/null @@ -1,20 +0,0 @@ -//@ run-pass -/* -# Corrupted initialization in the static struct - -...should print &[1, 2, 3] but instead prints something like -&[4492532864, 24]. It is pretty evident that the compiler messed up -with the representation of [isize; n] and [isize] somehow, or at least -failed to typecheck correctly. -*/ - -#[derive(Copy, Clone)] -struct X { vec: &'static [isize] } - -static V: &'static [X] = &[X { vec: &[1, 2, 3] }]; - -pub fn main() { - for &v in V { - println!("{:?}", v.vec); - } -} diff --git a/tests/ui/issues/issue-5708.rs b/tests/ui/issues/issue-5708.rs deleted file mode 100644 index 6fa3cfa4724..00000000000 --- a/tests/ui/issues/issue-5708.rs +++ /dev/null @@ -1,55 +0,0 @@ -//@ run-pass -#![allow(unused_variables)] -/* -# ICE when returning struct with reference to trait - -A function which takes a reference to a trait and returns a -struct with that reference results in an ICE. - -This does not occur with concrete types, only with references -to traits. -*/ - - -// original -trait Inner { - fn print(&self); -} - -impl Inner for isize { - fn print(&self) { print!("Inner: {}\n", *self); } -} - -struct Outer<'a> { - inner: &'a (dyn Inner+'a) -} - -impl<'a> Outer<'a> { - fn new(inner: &dyn Inner) -> Outer<'_> { - Outer { - inner: inner - } - } -} - -pub fn main() { - let inner: isize = 5; - let outer = Outer::new(&inner as &dyn Inner); - outer.inner.print(); -} - - -// minimal -pub trait MyTrait { - fn dummy(&self, t: T) -> T { panic!() } -} - -pub struct MyContainer<'a, T:'a> { - foos: Vec<&'a (dyn MyTrait+'a)> , -} - -impl<'a, T> MyContainer<'a, T> { - pub fn add (&mut self, foo: &'a dyn MyTrait) { - self.foos.push(foo); - } -} diff --git a/tests/ui/issues/issue-5718.rs b/tests/ui/issues/issue-5718.rs deleted file mode 100644 index 234fb2e2222..00000000000 --- a/tests/ui/issues/issue-5718.rs +++ /dev/null @@ -1,23 +0,0 @@ -//@ run-pass - -struct Element; - -macro_rules! foo { - ($tag: expr, $string: expr) => { - if $tag == $string { - let element: Box<_> = Box::new(Element); - unsafe { - return std::mem::transmute::<_, usize>(element); - } - } - } -} - -fn bar() -> usize { - foo!("a", "b"); - 0 -} - -fn main() { - bar(); -} diff --git a/tests/ui/issues/issue-5741.rs b/tests/ui/issues/issue-5741.rs deleted file mode 100644 index af4702ec22c..00000000000 --- a/tests/ui/issues/issue-5741.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ run-pass -#![allow(while_true)] -#![allow(unreachable_code)] - -pub fn main() { - return; - while true {}; -} diff --git a/tests/ui/issues/issue-5844.rs b/tests/ui/issues/issue-5844.rs deleted file mode 100644 index 23021207ae1..00000000000 --- a/tests/ui/issues/issue-5844.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@aux-build:issue-5844-aux.rs - -extern crate issue_5844_aux; - -fn main() { - issue_5844_aux::rand(); //~ ERROR: requires unsafe -} diff --git a/tests/ui/issues/issue-5844.stderr b/tests/ui/issues/issue-5844.stderr deleted file mode 100644 index bae917fa72c..00000000000 --- a/tests/ui/issues/issue-5844.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function `rand` is unsafe and requires unsafe function or block - --> $DIR/issue-5844.rs:6:5 - | -LL | issue_5844_aux::rand(); - | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/issues/issue-5883.rs b/tests/ui/issues/issue-5883.rs deleted file mode 100644 index dd4753e0344..00000000000 --- a/tests/ui/issues/issue-5883.rs +++ /dev/null @@ -1,13 +0,0 @@ -trait A {} - -struct Struct { - r: dyn A + 'static -} - -fn new_struct( - r: dyn A + 'static //~ ERROR the size for values of type -) -> Struct { //~ ERROR the size for values of type - Struct { r: r } -} - -fn main() {} diff --git a/tests/ui/issues/issue-5883.stderr b/tests/ui/issues/issue-5883.stderr deleted file mode 100644 index 2ca437b8c47..00000000000 --- a/tests/ui/issues/issue-5883.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time - --> $DIR/issue-5883.rs:9: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 - | -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 - | -LL | r: dyn A + 'static - | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `(dyn A + 'static)` - = help: unsized fn params are gated as an unstable feature -help: you can use `impl Trait` as the argument type - | -LL - r: dyn A + 'static -LL + r: impl A + 'static - | -help: function arguments must have a statically known size, borrowed types always have a known size - | -LL | r: &dyn A + 'static - | + - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-5884.rs b/tests/ui/issues/issue-5884.rs deleted file mode 100644 index 559b897395d..00000000000 --- a/tests/ui/issues/issue-5884.rs +++ /dev/null @@ -1,17 +0,0 @@ -//@ build-pass -#![allow(dead_code)] - -pub struct Foo { - a: isize, -} - -struct Bar<'a> { - a: Box>, - b: &'a Foo, -} - -fn check(a: Box) { - let _ic = Bar{ b: &*a, a: Box::new(None) }; -} - -pub fn main(){} diff --git a/tests/ui/issues/issue-5900.rs b/tests/ui/issues/issue-5900.rs deleted file mode 100644 index 14b7b8f815a..00000000000 --- a/tests/ui/issues/issue-5900.rs +++ /dev/null @@ -1,14 +0,0 @@ -//@ check-pass -#![allow(dead_code)] - -pub mod foo { - use super::Bar; - - pub struct FooStruct { bar : Bar } -} - -pub enum Bar { - Bar0 = 0 as isize -} - -pub fn main() {} diff --git a/tests/ui/issues/issue-5917.rs b/tests/ui/issues/issue-5917.rs deleted file mode 100644 index 8e91b1052a2..00000000000 --- a/tests/ui/issues/issue-5917.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ run-pass -#![allow(non_upper_case_globals)] - -struct T (&'static [isize]); -static t : T = T (&[5, 4, 3]); -pub fn main () { - let T(ref v) = t; - assert_eq!(v[0], 5); -} diff --git a/tests/ui/issues/issue-5950.rs b/tests/ui/issues/issue-5950.rs deleted file mode 100644 index 6015560fcf8..00000000000 --- a/tests/ui/issues/issue-5950.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ check-pass - - -pub use local as local_alias; - -pub mod local { } - -pub fn main() {} diff --git a/tests/ui/issues/issue-5988.rs b/tests/ui/issues/issue-5988.rs deleted file mode 100644 index b7527d9bea8..00000000000 --- a/tests/ui/issues/issue-5988.rs +++ /dev/null @@ -1,23 +0,0 @@ -//@ run-pass - -trait B { - fn f(&self); -} - -trait T : B { -} - -struct A; - -impl B for U { - fn f(&self) { } -} - -impl T for A { -} - -fn main() { - let a = A; - let br = &a as &dyn B; - br.f(); -} diff --git a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-enum.rs b/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-enum.rs deleted file mode 100644 index 0b1857ae3df..00000000000 --- a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-enum.rs +++ /dev/null @@ -1,10 +0,0 @@ -fn f() -> bool { - enum E { V(Z) } - //~^ ERROR can't use generic parameters from outer item - true -} - -fn main() { - let b = f::(); - assert!(b); -} diff --git a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-enum.stderr b/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-enum.stderr deleted file mode 100644 index c0b3cd6de66..00000000000 --- a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-enum.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0401]: can't use generic parameters from outer item - --> $DIR/issue-5997-enum.rs:2:16 - | -LL | fn f() -> bool { - | - type parameter from outer item -LL | enum E { V(Z) } - | - ^ use of generic parameter from outer item - | | - | help: try introducing a local generic parameter here: `` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0401`. diff --git a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-struct.rs b/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-struct.rs deleted file mode 100644 index 19d994b0dfb..00000000000 --- a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-struct.rs +++ /dev/null @@ -1,10 +0,0 @@ -fn f() -> bool { - struct S(T); //~ ERROR can't use generic parameters from outer item - - true -} - -fn main() { - let b = f::(); - assert!(b); -} diff --git a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-struct.stderr b/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-struct.stderr deleted file mode 100644 index 670a54894b5..00000000000 --- a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997-struct.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0401]: can't use generic parameters from outer item - --> $DIR/issue-5997-struct.rs:2:14 - | -LL | fn f() -> 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: `` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0401`. diff --git a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997.rs b/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997.rs deleted file mode 100644 index 7ed8819f322..00000000000 --- a/tests/ui/issues/issue-5997-outer-generic-parameter/issue-5997.rs +++ /dev/null @@ -1,15 +0,0 @@ -//@ run-pass -#![allow(dead_code)] - -fn f() -> bool { - enum E { V(T) } - - struct S(T); - - true -} - -fn main() { - let b = f::(); - assert!(b); -} diff --git a/tests/ui/issues/issue-6117.rs b/tests/ui/issues/issue-6117.rs deleted file mode 100644 index 3ccf67b0319..00000000000 --- a/tests/ui/issues/issue-6117.rs +++ /dev/null @@ -1,11 +0,0 @@ -//@ run-pass -#![allow(dead_code)] - -enum Either { Left(T), Right(U) } - -pub fn main() { - match Either::Left(Box::new(17)) { - Either::Right(()) => {} - _ => {} - } -} diff --git a/tests/ui/issues/issue-6130.rs b/tests/ui/issues/issue-6130.rs deleted file mode 100644 index c675a8a41dd..00000000000 --- a/tests/ui/issues/issue-6130.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ run-pass - -pub fn main() { - let i: usize = 0; - assert!(i <= 0xFFFF_FFFF); - - let i: isize = 0; - assert!(i >= -0x8000_0000); - assert!(i <= 0x7FFF_FFFF); -} diff --git a/tests/ui/issues/issue-6153.rs b/tests/ui/issues/issue-6153.rs deleted file mode 100644 index cd78c85d94b..00000000000 --- a/tests/ui/issues/issue-6153.rs +++ /dev/null @@ -1,13 +0,0 @@ -//@ run-pass - - -fn swap(f: F) -> Vec where F: FnOnce(Vec) -> Vec { - let x = vec![1, 2, 3]; - f(x) -} - -pub fn main() { - let v = swap(|mut x| { x.push(4); x }); - let w = swap(|mut x| { x.push(4); x }); - assert_eq!(v, w); -} diff --git a/tests/ui/issues/issue-6318.rs b/tests/ui/issues/issue-6318.rs deleted file mode 100644 index d3f08285a93..00000000000 --- a/tests/ui/issues/issue-6318.rs +++ /dev/null @@ -1,19 +0,0 @@ -//@ run-pass - -pub enum Thing { - A(Box) -} - -pub trait Foo { - fn dummy(&self) { } -} - -pub struct Struct; - -impl Foo for Struct {} - -pub fn main() { - match Thing::A(Box::new(Struct) as Box) { - Thing::A(_a) => 0, - }; -} diff --git a/tests/ui/issues/issue-6344-let.rs b/tests/ui/issues/issue-6344-let.rs deleted file mode 100644 index 1e1bdfa17be..00000000000 --- a/tests/ui/issues/issue-6344-let.rs +++ /dev/null @@ -1,15 +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 }; - - let A { x: ref x } = a; - println!("{}", x) -} diff --git a/tests/ui/issues/issue-6344-match.rs b/tests/ui/issues/issue-6344-match.rs deleted file mode 100644 index 9251e274383..00000000000 --- a/tests/ui/issues/issue-6344-match.rs +++ /dev/null @@ -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) - } - } -} diff --git a/tests/ui/issues/issue-6557.rs b/tests/ui/issues/issue-6557.rs deleted file mode 100644 index 64a025a294f..00000000000 --- a/tests/ui/issues/issue-6557.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ check-pass -#![allow(dead_code)] - -#![feature(box_patterns)] - -fn foo(box (_x, _y): Box<(isize, isize)>) {} - -pub fn main() {} diff --git a/tests/ui/issues/issue-6738.rs b/tests/ui/issues/issue-6738.rs deleted file mode 100644 index a2f8dfe9c49..00000000000 --- a/tests/ui/issues/issue-6738.rs +++ /dev/null @@ -1,10 +0,0 @@ -struct Foo { - x: T, -} -impl Foo { - fn add(&mut self, v: Foo){ - self.x += v.x; - //~^ ERROR: binary assignment operation `+=` cannot be applied - } -} -fn main() {} diff --git a/tests/ui/issues/issue-6738.stderr b/tests/ui/issues/issue-6738.stderr deleted file mode 100644 index f22d6a2e468..00000000000 --- a/tests/ui/issues/issue-6738.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0368]: binary assignment operation `+=` cannot be applied to type `T` - --> $DIR/issue-6738.rs:6:9 - | -LL | self.x += v.x; - | ------^^^^^^^ - | | - | cannot use `+=` on type `T` - | -help: consider restricting type parameter `T` with trait `AddAssign` - | -LL | impl Foo { - | +++++++++++++++++++++ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0368`. diff --git a/tests/ui/issues/issue-6898.rs b/tests/ui/issues/issue-6898.rs deleted file mode 100644 index c810acaf61b..00000000000 --- a/tests/ui/issues/issue-6898.rs +++ /dev/null @@ -1,32 +0,0 @@ -//@ check-pass - -use std::mem; - -/// Returns the size of a type -pub fn size_of() -> usize { - TypeInfo::size_of(None::) -} - -/// Returns the size of the type that `val` points to -pub fn size_of_val(val: &T) -> usize { - val.size_of_val() -} - -pub trait TypeInfo: Sized { - fn size_of(_lame_type_hint: Option) -> usize; - fn size_of_val(&self) -> usize; -} - -impl TypeInfo for T { - /// The size of the type in bytes. - fn size_of(_lame_type_hint: Option) -> usize { - mem::size_of::() - } - - /// Returns the size of the type of `self` in bytes. - fn size_of_val(&self) -> usize { - TypeInfo::size_of(None::) - } -} - -pub fn main() {} diff --git a/tests/ui/issues/issue-6919.rs b/tests/ui/issues/issue-6919.rs deleted file mode 100644 index 7fb8a2f33bc..00000000000 --- a/tests/ui/issues/issue-6919.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ run-pass -#![allow(unused_attributes)] -//@ aux-build:iss.rs - - -extern crate issue6919_3; - -pub fn main() { - let _ = issue6919_3::D.k; -} diff --git a/tests/ui/issues/issue-6936.rs b/tests/ui/issues/issue-6936.rs deleted file mode 100644 index e9aa80b4eb3..00000000000 --- a/tests/ui/issues/issue-6936.rs +++ /dev/null @@ -1,34 +0,0 @@ -struct T; - -mod t1 { - type Foo = crate::T; - mod Foo {} //~ ERROR the name `Foo` is defined multiple times -} - -mod t2 { - type Foo = crate::T; - struct Foo; //~ ERROR the name `Foo` is defined multiple times -} - -mod t3 { - type Foo = crate::T; - enum Foo {} //~ ERROR the name `Foo` is defined multiple times -} - -mod t4 { - type Foo = crate::T; - fn Foo() {} // ok -} - -mod t5 { - type Bar = T; - mod Bar {} //~ ERROR the name `Bar` is defined multiple times -} - -mod t6 { - type Foo = crate::T; - impl Foo {} // ok -} - - -fn main() {} diff --git a/tests/ui/issues/issue-6936.stderr b/tests/ui/issues/issue-6936.stderr deleted file mode 100644 index 03cc50636b4..00000000000 --- a/tests/ui/issues/issue-6936.stderr +++ /dev/null @@ -1,43 +0,0 @@ -error[E0428]: the name `Foo` is defined multiple times - --> $DIR/issue-6936.rs:5:5 - | -LL | type Foo = crate::T; - | -------------------- previous definition of the type `Foo` here -LL | mod Foo {} - | ^^^^^^^ `Foo` redefined here - | - = 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 - | -LL | type Foo = crate::T; - | -------------------- previous definition of the type `Foo` here -LL | struct Foo; - | ^^^^^^^^^^^ `Foo` redefined here - | - = 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 - | -LL | type Foo = crate::T; - | -------------------- previous definition of the type `Foo` here -LL | enum Foo {} - | ^^^^^^^^ `Foo` redefined here - | - = 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 - | -LL | type Bar = T; - | ---------------- previous definition of the type `Bar` here -LL | mod Bar {} - | ^^^^^^^ `Bar` redefined here - | - = note: `Bar` must be defined only once in the type namespace of this module - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0428`. diff --git a/tests/ui/issues/issue-7012.rs b/tests/ui/issues/issue-7012.rs deleted file mode 100644 index 69b881e2a43..00000000000 --- a/tests/ui/issues/issue-7012.rs +++ /dev/null @@ -1,22 +0,0 @@ -//@ run-pass -#![allow(non_camel_case_types)] -#![allow(non_upper_case_globals)] - -/* -# Comparison of static arrays - -The expected behaviour would be that `test == test1`, therefore 'true' -would be printed, however the below prints false. -*/ - -struct signature<'a> { pattern : &'a [u32] } - -static test1: signature<'static> = signature { - pattern: &[0x243f6a88,0x85a308d3,0x13198a2e,0x03707344,0xa4093822,0x299f31d0] -}; - -pub fn main() { - let test: &[u32] = &[0x243f6a88,0x85a308d3,0x13198a2e, - 0x03707344,0xa4093822,0x299f31d0]; - println!("{}",test==test1.pattern); -} diff --git a/tests/ui/loops/unreachable-while-loop-5741.rs b/tests/ui/loops/unreachable-while-loop-5741.rs new file mode 100644 index 00000000000..bc69df0f675 --- /dev/null +++ b/tests/ui/loops/unreachable-while-loop-5741.rs @@ -0,0 +1,9 @@ +// https://github.com/rust-lang/rust/issues/5741 +//@ run-pass +#![allow(while_true)] +#![allow(unreachable_code)] + +pub fn main() { + return; + while true {}; +} diff --git a/tests/ui/macros/macro-variable-declaration-with-bounds-5554.rs b/tests/ui/macros/macro-variable-declaration-with-bounds-5554.rs new file mode 100644 index 00000000000..8ccf8e80131 --- /dev/null +++ b/tests/ui/macros/macro-variable-declaration-with-bounds-5554.rs @@ -0,0 +1,27 @@ +// https://github.com/rust-lang/rust/issues/5554 +//@ run-pass +#![allow(dead_code)] + +pub struct X { + a: T, +} + +// reordering these bounds stops the ICE +// +// nmatsakis: This test used to have the bounds Default + PartialEq + +// Default, but having duplicate bounds became illegal. +impl Default for X { + fn default() -> X { + X { a: Default::default() } + } +} + +macro_rules! constants { + () => { + let _ : X = Default::default(); + } +} + +pub fn main() { + constants!(); +} diff --git a/tests/ui/macros/macro-variable-unused-reporting-5718.rs b/tests/ui/macros/macro-variable-unused-reporting-5718.rs new file mode 100644 index 00000000000..55da925461d --- /dev/null +++ b/tests/ui/macros/macro-variable-unused-reporting-5718.rs @@ -0,0 +1,24 @@ +// https://github.com/rust-lang/rust/issues/5718 +//@ run-pass + +struct Element; + +macro_rules! foo { + ($tag: expr, $string: expr) => { + if $tag == $string { + let element: Box<_> = Box::new(Element); + unsafe { + return std::mem::transmute::<_, usize>(element); + } + } + } +} + +fn bar() -> usize { + foo!("a", "b"); + 0 +} + +fn main() { + bar(); +} diff --git a/tests/ui/match/mismatched-types-in-match-5358.rs b/tests/ui/match/mismatched-types-in-match-5358.rs new file mode 100644 index 00000000000..d096bf3a493 --- /dev/null +++ b/tests/ui/match/mismatched-types-in-match-5358.rs @@ -0,0 +1,18 @@ +// https://github.com/rust-lang/rust/issues/5358 +enum Either { + Left(T), + Right(U), +} +struct S(Either); + +fn main() { + match S(Either::Left(5)) { + //~^ NOTE this expression has type `S` + Either::Right(_) => {} + //~^ ERROR mismatched types + //~| NOTE expected `S`, found `Either<_, _>` + //~| NOTE expected struct `S` + //~| NOTE found enum `Either<_, _>` + _ => {} + } +} diff --git a/tests/ui/match/mismatched-types-in-match-5358.stderr b/tests/ui/match/mismatched-types-in-match-5358.stderr new file mode 100644 index 00000000000..6a6cf3ee269 --- /dev/null +++ b/tests/ui/match/mismatched-types-in-match-5358.stderr @@ -0,0 +1,23 @@ +error[E0308]: mismatched types + --> $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<_, _>` + | + = note: expected struct `S` + found enum `Either<_, _>` +help: try wrapping the pattern in `S` + | +LL | S(Either::Right(_)) => {} + | ++ + +help: you might have meant to use field `0` whose type is `Either` + | +LL | match S(Either::Left(5)).0 { + | ++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/modules/pub-use-module-alias-5950.rs b/tests/ui/modules/pub-use-module-alias-5950.rs new file mode 100644 index 00000000000..91d3f9b16ff --- /dev/null +++ b/tests/ui/modules/pub-use-module-alias-5950.rs @@ -0,0 +1,8 @@ +// https://github.com/rust-lang/rust/issues/5950 +//@ check-pass + +pub use local as local_alias; + +pub mod local { } + +pub fn main() {} diff --git a/tests/ui/numeric/type-limit-comparisons-6130.rs b/tests/ui/numeric/type-limit-comparisons-6130.rs new file mode 100644 index 00000000000..54b3f631e67 --- /dev/null +++ b/tests/ui/numeric/type-limit-comparisons-6130.rs @@ -0,0 +1,11 @@ +// https://github.com/rust-lang/rust/issues/6130 +//@ run-pass + +pub fn main() { + let i: usize = 0; + assert!(i <= 0xFFFF_FFFF); + + let i: isize = 0; + assert!(i >= -0x8000_0000); + assert!(i <= 0x7FFF_FFFF); +} diff --git a/tests/ui/parser/partial-eq-trait-bound-5572.rs b/tests/ui/parser/partial-eq-trait-bound-5572.rs new file mode 100644 index 00000000000..7ee0cdc43ee --- /dev/null +++ b/tests/ui/parser/partial-eq-trait-bound-5572.rs @@ -0,0 +1,7 @@ +// https://github.com/rust-lang/rust/issues/5572 +//@ check-pass +#![allow(dead_code)] + +fn foo(_t: T) { } + +pub fn main() { } diff --git a/tests/ui/privacy/auxiliary/iss-6919.rs b/tests/ui/privacy/auxiliary/iss-6919.rs new file mode 100644 index 00000000000..cf32f6c2d5d --- /dev/null +++ b/tests/ui/privacy/auxiliary/iss-6919.rs @@ -0,0 +1,12 @@ +#![crate_name="issue6919_3"] + +// part of issue-6919.rs + +pub struct C where K: FnOnce() { + pub k: K, +} + +fn no_op() { } +pub const D : C = C { + k: no_op as fn() +}; diff --git a/tests/ui/privacy/deref-separate-compile-unit-6919.rs b/tests/ui/privacy/deref-separate-compile-unit-6919.rs new file mode 100644 index 00000000000..5d8934987e5 --- /dev/null +++ b/tests/ui/privacy/deref-separate-compile-unit-6919.rs @@ -0,0 +1,10 @@ +// https://github.com/rust-lang/rust/issues/6919 +//@ run-pass +#![allow(unused_attributes)] +//@ aux-build:iss-6919.rs + +extern crate issue6919_3; + +pub fn main() { + let _ = issue6919_3::D.k; +} diff --git a/tests/ui/resolve/duplicate-name-in-module-6936.rs b/tests/ui/resolve/duplicate-name-in-module-6936.rs new file mode 100644 index 00000000000..ae9282c0c24 --- /dev/null +++ b/tests/ui/resolve/duplicate-name-in-module-6936.rs @@ -0,0 +1,34 @@ +// https://github.com/rust-lang/rust/issues/6936 +struct T; + +mod t1 { + type Foo = crate::T; + mod Foo {} //~ ERROR the name `Foo` is defined multiple times +} + +mod t2 { + type Foo = crate::T; + struct Foo; //~ ERROR the name `Foo` is defined multiple times +} + +mod t3 { + type Foo = crate::T; + enum Foo {} //~ ERROR the name `Foo` is defined multiple times +} + +mod t4 { + type Foo = crate::T; + fn Foo() {} // ok +} + +mod t5 { + type Bar = T; + mod Bar {} //~ ERROR the name `Bar` is defined multiple times +} + +mod t6 { + type Foo = crate::T; + impl Foo {} // ok +} + +fn main() {} diff --git a/tests/ui/resolve/duplicate-name-in-module-6936.stderr b/tests/ui/resolve/duplicate-name-in-module-6936.stderr new file mode 100644 index 00000000000..76bb8f57386 --- /dev/null +++ b/tests/ui/resolve/duplicate-name-in-module-6936.stderr @@ -0,0 +1,43 @@ +error[E0428]: the name `Foo` is defined multiple times + --> $DIR/duplicate-name-in-module-6936.rs:6:5 + | +LL | type Foo = crate::T; + | -------------------- previous definition of the type `Foo` here +LL | mod Foo {} + | ^^^^^^^ `Foo` redefined here + | + = note: `Foo` must be defined only once in the type namespace of this module + +error[E0428]: the name `Foo` is defined multiple times + --> $DIR/duplicate-name-in-module-6936.rs:11:5 + | +LL | type Foo = crate::T; + | -------------------- previous definition of the type `Foo` here +LL | struct Foo; + | ^^^^^^^^^^^ `Foo` redefined here + | + = note: `Foo` must be defined only once in the type namespace of this module + +error[E0428]: the name `Foo` is defined multiple times + --> $DIR/duplicate-name-in-module-6936.rs:16:5 + | +LL | type Foo = crate::T; + | -------------------- previous definition of the type `Foo` here +LL | enum Foo {} + | ^^^^^^^^ `Foo` redefined here + | + = note: `Foo` must be defined only once in the type namespace of this module + +error[E0428]: the name `Bar` is defined multiple times + --> $DIR/duplicate-name-in-module-6936.rs:26:5 + | +LL | type Bar = T; + | ---------------- previous definition of the type `Bar` here +LL | mod Bar {} + | ^^^^^^^ `Bar` redefined here + | + = note: `Bar` must be defined only once in the type namespace of this module + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0428`. diff --git a/tests/ui/static/static-list-initialization-5917.rs b/tests/ui/static/static-list-initialization-5917.rs new file mode 100644 index 00000000000..c6c32f7582e --- /dev/null +++ b/tests/ui/static/static-list-initialization-5917.rs @@ -0,0 +1,10 @@ +// https://github.com/rust-lang/rust/issues/5917 +//@ run-pass +#![allow(non_upper_case_globals)] + +struct T (&'static [isize]); +static t : T = T (&[5, 4, 3]); +pub fn main () { + let T(ref v) = t; + assert_eq!(v[0], 5); +} diff --git a/tests/ui/static/static-struct-initialization-5688.rs b/tests/ui/static/static-struct-initialization-5688.rs new file mode 100644 index 00000000000..6a4c2f45b6b --- /dev/null +++ b/tests/ui/static/static-struct-initialization-5688.rs @@ -0,0 +1,21 @@ +// https://github.com/rust-lang/rust/issues/5688 +//@ run-pass +/* +# Corrupted initialization in the static struct + +...should print &[1, 2, 3] but instead prints something like +&[4492532864, 24]. It is pretty evident that the compiler messed up +with the representation of [isize; n] and [isize] somehow, or at least +failed to typecheck correctly. +*/ + +#[derive(Copy, Clone)] +struct X { vec: &'static [isize] } + +static V: &'static [X] = &[X { vec: &[1, 2, 3] }]; + +pub fn main() { + for &v in V { + println!("{:?}", v.vec); + } +} diff --git a/tests/ui/structs/destructuring-struct-with-dtor-6344.rs b/tests/ui/structs/destructuring-struct-with-dtor-6344.rs new file mode 100644 index 00000000000..b107a99e89f --- /dev/null +++ b/tests/ui/structs/destructuring-struct-with-dtor-6344.rs @@ -0,0 +1,16 @@ +// https://github.com/rust-lang/rust/issues/6344 +//@ 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 }; + + let A { x: ref x } = a; + println!("{}", x) +} diff --git a/tests/ui/structs/nonexistent-struct-field-error-5439.rs b/tests/ui/structs/nonexistent-struct-field-error-5439.rs new file mode 100644 index 00000000000..b2b3293ac91 --- /dev/null +++ b/tests/ui/structs/nonexistent-struct-field-error-5439.rs @@ -0,0 +1,20 @@ +// https://github.com/rust-lang/rust/issues/5439 +struct Foo { + foo: isize, +} + +struct Bar { + bar: isize, +} + +impl Bar { + fn make_foo (&self, i: isize) -> Box { + return Box::new(Foo { nonexistent: self, foo: i }); //~ ERROR: no field named + } +} + +fn main () { + let bar = Bar { bar: 1 }; + let foo = bar.make_foo(2); + println!("{}", foo.foo); +} diff --git a/tests/ui/structs/nonexistent-struct-field-error-5439.stderr b/tests/ui/structs/nonexistent-struct-field-error-5439.stderr new file mode 100644 index 00000000000..b560772fbf0 --- /dev/null +++ b/tests/ui/structs/nonexistent-struct-field-error-5439.stderr @@ -0,0 +1,11 @@ +error[E0560]: struct `Foo` has no field named `nonexistent` + --> $DIR/nonexistent-struct-field-error-5439.rs:12:31 + | +LL | return Box::new(Foo { nonexistent: self, foo: i }); + | ^^^^^^^^^^^ `Foo` does not have this field + | + = note: all struct fields are already assigned + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0560`. diff --git a/tests/ui/traits/dynamic-dispatch-trait-objects-5666.rs b/tests/ui/traits/dynamic-dispatch-trait-objects-5666.rs new file mode 100644 index 00000000000..e335949d832 --- /dev/null +++ b/tests/ui/traits/dynamic-dispatch-trait-objects-5666.rs @@ -0,0 +1,26 @@ +// https://github.com/rust-lang/rust/issues/5666 +//@ run-pass + +struct Dog { + name : String +} + +trait Barks { + fn bark(&self) -> String; +} + +impl Barks for Dog { + fn bark(&self) -> String { + return format!("woof! (I'm {})", self.name); + } +} + +pub fn main() { + let snoopy = Box::new(Dog{name: "snoopy".to_string()}); + let bubbles = Box::new(Dog{name: "bubbles".to_string()}); + let barker = [snoopy as Box, bubbles as Box]; + + for pup in &barker { + println!("{}", pup.bark()); + } +} diff --git a/tests/ui/traits/opaque-trait-size-error-5883.rs b/tests/ui/traits/opaque-trait-size-error-5883.rs new file mode 100644 index 00000000000..e39e24e7342 --- /dev/null +++ b/tests/ui/traits/opaque-trait-size-error-5883.rs @@ -0,0 +1,14 @@ +// https://github.com/rust-lang/rust/issues/5883 +trait A {} + +struct Struct { + r: dyn A + 'static +} + +fn new_struct( + r: dyn A + 'static //~ ERROR the size for values of type +) -> Struct { //~ ERROR the size for values of type + Struct { r: r } +} + +fn main() {} diff --git a/tests/ui/traits/opaque-trait-size-error-5883.stderr b/tests/ui/traits/opaque-trait-size-error-5883.stderr new file mode 100644 index 00000000000..78de250b19a --- /dev/null +++ b/tests/ui/traits/opaque-trait-size-error-5883.stderr @@ -0,0 +1,35 @@ +error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time + --> $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/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/opaque-trait-size-error-5883.rs:9:8 + | +LL | r: dyn A + 'static + | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `(dyn A + 'static)` + = help: unsized fn params are gated as an unstable feature +help: you can use `impl Trait` as the argument type + | +LL - r: dyn A + 'static +LL + r: impl A + 'static + | +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | r: &dyn A + 'static + | + + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/trait-implementation-generic-access-6898.rs b/tests/ui/traits/trait-implementation-generic-access-6898.rs new file mode 100644 index 00000000000..e9437b1c522 --- /dev/null +++ b/tests/ui/traits/trait-implementation-generic-access-6898.rs @@ -0,0 +1,33 @@ +// https://github.com/rust-lang/rust/issues/6898 +//@ check-pass + +use std::mem; + +/// Returns the size of a type +pub fn size_of() -> usize { + TypeInfo::size_of(None::) +} + +/// Returns the size of the type that `val` points to +pub fn size_of_val(val: &T) -> usize { + val.size_of_val() +} + +pub trait TypeInfo: Sized { + fn size_of(_lame_type_hint: Option) -> usize; + fn size_of_val(&self) -> usize; +} + +impl TypeInfo for T { + /// The size of the type in bytes. + fn size_of(_lame_type_hint: Option) -> usize { + mem::size_of::() + } + + /// Returns the size of the type of `self` in bytes. + fn size_of_val(&self) -> usize { + TypeInfo::size_of(None::) + } +} + +pub fn main() {} diff --git a/tests/ui/traits/trait-implementation-restriction-5988.rs b/tests/ui/traits/trait-implementation-restriction-5988.rs new file mode 100644 index 00000000000..d3a5b10569b --- /dev/null +++ b/tests/ui/traits/trait-implementation-restriction-5988.rs @@ -0,0 +1,24 @@ +// https://github.com/rust-lang/rust/issues/5988 +//@ run-pass + +trait B { + fn f(&self); +} + +trait T : B { +} + +struct A; + +impl B for U { + fn f(&self) { } +} + +impl T for A { +} + +fn main() { + let a = A; + let br = &a as &dyn B; + br.f(); +} diff --git a/tests/ui/unsafe/auxiliary/aux-5844.rs b/tests/ui/unsafe/auxiliary/aux-5844.rs new file mode 100644 index 00000000000..ea83378cad6 --- /dev/null +++ b/tests/ui/unsafe/auxiliary/aux-5844.rs @@ -0,0 +1,3 @@ +extern "C" { + pub fn rand() -> u32; +} diff --git a/tests/ui/unsafe/extern-function-requires-unsafe-5844.rs b/tests/ui/unsafe/extern-function-requires-unsafe-5844.rs new file mode 100644 index 00000000000..11863ce647a --- /dev/null +++ b/tests/ui/unsafe/extern-function-requires-unsafe-5844.rs @@ -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 +} diff --git a/tests/ui/unsafe/extern-function-requires-unsafe-5844.stderr b/tests/ui/unsafe/extern-function-requires-unsafe-5844.stderr new file mode 100644 index 00000000000..44dee178991 --- /dev/null +++ b/tests/ui/unsafe/extern-function-requires-unsafe-5844.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function `rand` is unsafe and requires unsafe function or block + --> $DIR/extern-function-requires-unsafe-5844.rs:7:5 + | +LL | aux_5844::rand(); + | ^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0133`. -- cgit 1.4.1-3-g733a5