From 1a64684b0421d9e7090c0f805ef7637d0d6789ba Mon Sep 17 00:00:00 2001 From: lucarlig Date: Fri, 1 Aug 2025 15:04:58 +0100 Subject: LLVM error with unsupported expression in static initializer for const pointer in array on macOS --- .../unsupported-static-initializer-in-const-array.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tests/ui/codegen/unsupported-static-initializer-in-const-array.rs (limited to 'tests/ui/codegen') diff --git a/tests/ui/codegen/unsupported-static-initializer-in-const-array.rs b/tests/ui/codegen/unsupported-static-initializer-in-const-array.rs new file mode 100644 index 00000000000..bc94130ee19 --- /dev/null +++ b/tests/ui/codegen/unsupported-static-initializer-in-const-array.rs @@ -0,0 +1,18 @@ +//! LLVM error with unsupported expression in static +//! initializer for const pointer in array on macOS. +//! +//! Regression test for . + +//@ build-pass +//@ compile-flags: -C opt-level=3 + +const fn make() -> (i32, i32, *const i32) { + const V: i32 = 123; + &V as *const i32; + (0, 0, &V) +} + +fn main() { + let arr = [make(); 32]; + println!("{}", arr[0].0); +} -- cgit 1.4.1-3-g733a5 From 807d3406c215a9b3078e69ffc1a956b77f685ae9 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Sun, 13 Jul 2025 16:06:48 -0400 Subject: Rehome tests/ui/issues/ tests [2/?] --- ...onstant-trait-item-reference-selection-26095.rs | 23 +++++++++++++ .../attributes/cold-attribute-application-54044.rs | 14 ++++++++ .../cold-attribute-application-54044.stderr | 29 ++++++++++++++++ .../autoderef-vec-box-fn-36786.rs | 9 +++++ .../borrow-checker-lifetime-error-46471.rs | 9 +++++ .../borrow-checker-lifetime-error-46471.stderr | 13 ++++++++ .../string-borrowing-pattern-matching-11869.rs | 17 ++++++++++ tests/ui/cast/u8-to-char-cast-9918.rs | 6 ++++ .../llvm-miscompile-metadata-invalidation-36023.rs | 25 ++++++++++++++ ...mpl-coherence-error-for-undefined-type-18058.rs | 5 +++ ...coherence-error-for-undefined-type-18058.stderr | 9 +++++ ...t-resolution-error-with-const-generics-77919.rs | 14 ++++++++ ...solution-error-with-const-generics-77919.stderr | 35 +++++++++++++++++++ .../ui/drop/destructor-run-for-expression-4734.rs | 39 ++++++++++++++++++++++ .../unnecessary-path-disambiguator-36116.rs | 26 +++++++++++++++ .../collection-type-copy-behavior-12909.rs | 20 +++++++++++ tests/ui/issues/auxiliary/issue-25185-1.rs | 8 ----- tests/ui/issues/auxiliary/issue-25185-2.rs | 3 -- tests/ui/issues/issue-11869.rs | 16 --------- tests/ui/issues/issue-12909.rs | 19 ----------- tests/ui/issues/issue-15673.rs | 9 ----- tests/ui/issues/issue-18058.rs | 4 --- tests/ui/issues/issue-18058.stderr | 9 ----- tests/ui/issues/issue-18685.rs | 20 ----------- tests/ui/issues/issue-22434.rs | 8 ----- tests/ui/issues/issue-22434.stderr | 12 ------- tests/ui/issues/issue-25185.rs | 12 ------- tests/ui/issues/issue-26093.rs | 12 ------- tests/ui/issues/issue-26093.stderr | 32 ------------------ tests/ui/issues/issue-26095.rs | 23 ------------- tests/ui/issues/issue-32655.rs | 19 ----------- tests/ui/issues/issue-32655.stderr | 25 -------------- tests/ui/issues/issue-32995-2.rs | 13 -------- tests/ui/issues/issue-32995-2.stderr | 21 ------------ tests/ui/issues/issue-36023.rs | 24 ------------- tests/ui/issues/issue-36116.rs | 25 -------------- tests/ui/issues/issue-36786-resolve-call.rs | 8 ----- tests/ui/issues/issue-46471-1.rs | 8 ----- tests/ui/issues/issue-46471-1.stderr | 13 -------- tests/ui/issues/issue-4734.rs | 38 --------------------- tests/ui/issues/issue-48276.rs | 33 ------------------ tests/ui/issues/issue-48276.stderr | 28 ---------------- tests/ui/issues/issue-54044.rs | 13 -------- tests/ui/issues/issue-54044.stderr | 29 ---------------- tests/ui/issues/issue-7519-match-unit-in-arg.rs | 11 ------ tests/ui/issues/issue-77919.rs | 13 -------- tests/ui/issues/issue-77919.stderr | 35 ------------------- tests/ui/issues/issue-9918.rs | 5 --- .../iterators/iterator-type-inference-sum-15673.rs | 10 ++++++ tests/ui/linking/auxiliary/aux-25185-1.rs | 8 +++++ tests/ui/linking/auxiliary/aux-25185-2.rs | 3 ++ .../rlib-to-dylib-native-deps-inclusion-25185.rs | 13 ++++++++ .../ui/macros/invalid-assignment-in-macro-26093.rs | 13 ++++++++ .../invalid-assignment-in-macro-26093.stderr | 32 ++++++++++++++++++ ...t-pattern-matching-in-function-argument-7519.rs | 12 +++++++ ...issing-associated-type-in-trait-object-22434.rs | 9 +++++ ...ng-associated-type-in-trait-object-22434.stderr | 12 +++++++ .../incorrect-self-type-in-trait-impl-48276.rs | 34 +++++++++++++++++++ .../incorrect-self-type-in-trait-impl-48276.stderr | 28 ++++++++++++++++ .../parenthesized-type-parameters-error-32995.rs | 14 ++++++++ ...arenthesized-type-parameters-error-32995.stderr | 21 ++++++++++++ ...aram-space-conflict-in-unboxed-closure-18685.rs | 20 +++++++++++ 62 files changed, 522 insertions(+), 548 deletions(-) create mode 100644 tests/ui/associated-consts/constant-trait-item-reference-selection-26095.rs create mode 100644 tests/ui/attributes/cold-attribute-application-54044.rs create mode 100644 tests/ui/attributes/cold-attribute-application-54044.stderr create mode 100644 tests/ui/autoref-autoderef/autoderef-vec-box-fn-36786.rs create mode 100644 tests/ui/borrowck/borrow-checker-lifetime-error-46471.rs create mode 100644 tests/ui/borrowck/borrow-checker-lifetime-error-46471.stderr create mode 100644 tests/ui/borrowck/string-borrowing-pattern-matching-11869.rs create mode 100644 tests/ui/cast/u8-to-char-cast-9918.rs create mode 100644 tests/ui/codegen/llvm-miscompile-metadata-invalidation-36023.rs create mode 100644 tests/ui/coherence/impl-coherence-error-for-undefined-type-18058.rs create mode 100644 tests/ui/coherence/impl-coherence-error-for-undefined-type-18058.stderr create mode 100644 tests/ui/const-generics/trait-resolution-error-with-const-generics-77919.rs create mode 100644 tests/ui/const-generics/trait-resolution-error-with-const-generics-77919.stderr create mode 100644 tests/ui/drop/destructor-run-for-expression-4734.rs create mode 100644 tests/ui/generics/unnecessary-path-disambiguator-36116.rs create mode 100644 tests/ui/inference/collection-type-copy-behavior-12909.rs delete mode 100644 tests/ui/issues/auxiliary/issue-25185-1.rs delete mode 100644 tests/ui/issues/auxiliary/issue-25185-2.rs delete mode 100644 tests/ui/issues/issue-11869.rs delete mode 100644 tests/ui/issues/issue-12909.rs delete mode 100644 tests/ui/issues/issue-15673.rs delete mode 100644 tests/ui/issues/issue-18058.rs delete mode 100644 tests/ui/issues/issue-18058.stderr delete mode 100644 tests/ui/issues/issue-18685.rs delete mode 100644 tests/ui/issues/issue-22434.rs delete mode 100644 tests/ui/issues/issue-22434.stderr delete mode 100644 tests/ui/issues/issue-25185.rs delete mode 100644 tests/ui/issues/issue-26093.rs delete mode 100644 tests/ui/issues/issue-26093.stderr delete mode 100644 tests/ui/issues/issue-26095.rs delete mode 100644 tests/ui/issues/issue-32655.rs delete mode 100644 tests/ui/issues/issue-32655.stderr delete mode 100644 tests/ui/issues/issue-32995-2.rs delete mode 100644 tests/ui/issues/issue-32995-2.stderr delete mode 100644 tests/ui/issues/issue-36023.rs delete mode 100644 tests/ui/issues/issue-36116.rs delete mode 100644 tests/ui/issues/issue-36786-resolve-call.rs delete mode 100644 tests/ui/issues/issue-46471-1.rs delete mode 100644 tests/ui/issues/issue-46471-1.stderr delete mode 100644 tests/ui/issues/issue-4734.rs delete mode 100644 tests/ui/issues/issue-48276.rs delete mode 100644 tests/ui/issues/issue-48276.stderr delete mode 100644 tests/ui/issues/issue-54044.rs delete mode 100644 tests/ui/issues/issue-54044.stderr delete mode 100644 tests/ui/issues/issue-7519-match-unit-in-arg.rs delete mode 100644 tests/ui/issues/issue-77919.rs delete mode 100644 tests/ui/issues/issue-77919.stderr delete mode 100644 tests/ui/issues/issue-9918.rs create mode 100644 tests/ui/iterators/iterator-type-inference-sum-15673.rs create mode 100644 tests/ui/linking/auxiliary/aux-25185-1.rs create mode 100644 tests/ui/linking/auxiliary/aux-25185-2.rs create mode 100644 tests/ui/linking/rlib-to-dylib-native-deps-inclusion-25185.rs create mode 100644 tests/ui/macros/invalid-assignment-in-macro-26093.rs create mode 100644 tests/ui/macros/invalid-assignment-in-macro-26093.stderr create mode 100644 tests/ui/pattern/unit-pattern-matching-in-function-argument-7519.rs create mode 100644 tests/ui/type-alias/missing-associated-type-in-trait-object-22434.rs create mode 100644 tests/ui/type-alias/missing-associated-type-in-trait-object-22434.stderr create mode 100644 tests/ui/typeck/incorrect-self-type-in-trait-impl-48276.rs create mode 100644 tests/ui/typeck/incorrect-self-type-in-trait-impl-48276.stderr create mode 100644 tests/ui/typeck/parenthesized-type-parameters-error-32995.rs create mode 100644 tests/ui/typeck/parenthesized-type-parameters-error-32995.stderr create mode 100644 tests/ui/unboxed-closures/self-param-space-conflict-in-unboxed-closure-18685.rs (limited to 'tests/ui/codegen') diff --git a/tests/ui/associated-consts/constant-trait-item-reference-selection-26095.rs b/tests/ui/associated-consts/constant-trait-item-reference-selection-26095.rs new file mode 100644 index 00000000000..f0fe2db432b --- /dev/null +++ b/tests/ui/associated-consts/constant-trait-item-reference-selection-26095.rs @@ -0,0 +1,23 @@ +// https://github.com/rust-lang/rust/issues/26095 +//@ check-pass +#![allow(dead_code)] +#![allow(non_upper_case_globals)] + +trait HasNumber { + const Number: usize; +} + +enum One {} +enum Two {} + +enum Foo {} + +impl HasNumber for One { + const Number: usize = 1; +} + +impl HasNumber for Two { + const Number: usize = 2; +} + +fn main() {} diff --git a/tests/ui/attributes/cold-attribute-application-54044.rs b/tests/ui/attributes/cold-attribute-application-54044.rs new file mode 100644 index 00000000000..2e644b91c07 --- /dev/null +++ b/tests/ui/attributes/cold-attribute-application-54044.rs @@ -0,0 +1,14 @@ +// https://github.com/rust-lang/rust/issues/54044 +#![deny(unused_attributes)] //~ NOTE lint level is defined here + +#[cold] +//~^ ERROR attribute should be applied to a function +//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +struct Foo; //~ NOTE not a function + +fn main() { + #[cold] + //~^ ERROR attribute should be applied to a function + //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + 5; //~ NOTE not a function +} diff --git a/tests/ui/attributes/cold-attribute-application-54044.stderr b/tests/ui/attributes/cold-attribute-application-54044.stderr new file mode 100644 index 00000000000..efdf5e0de52 --- /dev/null +++ b/tests/ui/attributes/cold-attribute-application-54044.stderr @@ -0,0 +1,29 @@ +error: attribute should be applied to a function definition + --> $DIR/cold-attribute-application-54044.rs:4:1 + | +LL | #[cold] + | ^^^^^^^ +... +LL | struct Foo; + | ----------- not a function definition + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +note: the lint level is defined here + --> $DIR/cold-attribute-application-54044.rs:2:9 + | +LL | #![deny(unused_attributes)] + | ^^^^^^^^^^^^^^^^^ + +error: attribute should be applied to a function definition + --> $DIR/cold-attribute-application-54044.rs:10:5 + | +LL | #[cold] + | ^^^^^^^ +... +LL | 5; + | - not a function definition + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + +error: aborting due to 2 previous errors + diff --git a/tests/ui/autoref-autoderef/autoderef-vec-box-fn-36786.rs b/tests/ui/autoref-autoderef/autoderef-vec-box-fn-36786.rs new file mode 100644 index 00000000000..e16929bf48a --- /dev/null +++ b/tests/ui/autoref-autoderef/autoderef-vec-box-fn-36786.rs @@ -0,0 +1,9 @@ +// https://github.com/rust-lang/rust/issues/36786 +//@ run-pass +// Ensure that types that rely on obligations are autoderefed +// correctly + +fn main() { + let x : Vec> = vec![Box::new(|| ())]; + x[0]() +} diff --git a/tests/ui/borrowck/borrow-checker-lifetime-error-46471.rs b/tests/ui/borrowck/borrow-checker-lifetime-error-46471.rs new file mode 100644 index 00000000000..020b02aa34d --- /dev/null +++ b/tests/ui/borrowck/borrow-checker-lifetime-error-46471.rs @@ -0,0 +1,9 @@ +// https://github.com/rust-lang/rust/issues/46471 +fn main() { + let y = { + let mut z = 0; + &mut z + }; + //~^^ ERROR `z` does not live long enough [E0597] + println!("{}", y); +} diff --git a/tests/ui/borrowck/borrow-checker-lifetime-error-46471.stderr b/tests/ui/borrowck/borrow-checker-lifetime-error-46471.stderr new file mode 100644 index 00000000000..c90da551620 --- /dev/null +++ b/tests/ui/borrowck/borrow-checker-lifetime-error-46471.stderr @@ -0,0 +1,13 @@ +error[E0597]: `z` does not live long enough + --> $DIR/borrow-checker-lifetime-error-46471.rs:5:9 + | +LL | let mut z = 0; + | ----- binding `z` declared here +LL | &mut z + | ^^^^^^ borrowed value does not live long enough +LL | }; + | - `z` dropped here while still borrowed + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0597`. diff --git a/tests/ui/borrowck/string-borrowing-pattern-matching-11869.rs b/tests/ui/borrowck/string-borrowing-pattern-matching-11869.rs new file mode 100644 index 00000000000..fe3d1bf6e8a --- /dev/null +++ b/tests/ui/borrowck/string-borrowing-pattern-matching-11869.rs @@ -0,0 +1,17 @@ +// https://github.com/rust-lang/rust/issues/11869 +//@ check-pass +#![allow(dead_code)] + +struct A { + a: String +} + +fn borrow<'a>(binding: &'a A) -> &'a str { + match &*binding.a { + "in" => "in_", + "ref" => "ref_", + ident => ident + } +} + +fn main() {} diff --git a/tests/ui/cast/u8-to-char-cast-9918.rs b/tests/ui/cast/u8-to-char-cast-9918.rs new file mode 100644 index 00000000000..2b8be1f0fc9 --- /dev/null +++ b/tests/ui/cast/u8-to-char-cast-9918.rs @@ -0,0 +1,6 @@ +// https://github.com/rust-lang/rust/issues/9918 +//@ run-pass + +pub fn main() { + assert_eq!((0 + 0u8) as char, '\0'); +} diff --git a/tests/ui/codegen/llvm-miscompile-metadata-invalidation-36023.rs b/tests/ui/codegen/llvm-miscompile-metadata-invalidation-36023.rs new file mode 100644 index 00000000000..efa31a51881 --- /dev/null +++ b/tests/ui/codegen/llvm-miscompile-metadata-invalidation-36023.rs @@ -0,0 +1,25 @@ +// https://github.com/rust-lang/rust/issues/36023 +//@ run-pass +#![allow(unused_variables)] +use std::ops::Deref; + +fn main() { + if env_var("FOOBAR").as_ref().map(Deref::deref).ok() == Some("yes") { + panic!() + } + + let env_home: Result = Ok("foo-bar-baz".to_string()); + let env_home = env_home.as_ref().map(Deref::deref).ok(); + + if env_home == Some("") { panic!() } +} + +#[inline(never)] +fn env_var(s: &str) -> Result { + Err(VarError::NotPresent) +} + +pub enum VarError { + NotPresent, + NotUnicode(String), +} diff --git a/tests/ui/coherence/impl-coherence-error-for-undefined-type-18058.rs b/tests/ui/coherence/impl-coherence-error-for-undefined-type-18058.rs new file mode 100644 index 00000000000..52baf9871c3 --- /dev/null +++ b/tests/ui/coherence/impl-coherence-error-for-undefined-type-18058.rs @@ -0,0 +1,5 @@ +// https://github.com/rust-lang/rust/issues/18058 +impl Undefined {} +//~^ ERROR cannot find type `Undefined` in this scope + +fn main() {} diff --git a/tests/ui/coherence/impl-coherence-error-for-undefined-type-18058.stderr b/tests/ui/coherence/impl-coherence-error-for-undefined-type-18058.stderr new file mode 100644 index 00000000000..07dce0b04fd --- /dev/null +++ b/tests/ui/coherence/impl-coherence-error-for-undefined-type-18058.stderr @@ -0,0 +1,9 @@ +error[E0412]: cannot find type `Undefined` in this scope + --> $DIR/impl-coherence-error-for-undefined-type-18058.rs:2:6 + | +LL | impl Undefined {} + | ^^^^^^^^^ not found in this scope + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/const-generics/trait-resolution-error-with-const-generics-77919.rs b/tests/ui/const-generics/trait-resolution-error-with-const-generics-77919.rs new file mode 100644 index 00000000000..5ab443422df --- /dev/null +++ b/tests/ui/const-generics/trait-resolution-error-with-const-generics-77919.rs @@ -0,0 +1,14 @@ +// https://github.com/rust-lang/rust/issues/77919 +fn main() { + [1; >::VAL]; +} +trait TypeVal { + const VAL: T; +} +struct Five; +struct Multiply { + _n: PhantomData, //~ ERROR cannot find type `PhantomData` in this scope +} +impl TypeVal for Multiply where N: TypeVal {} +//~^ ERROR cannot find type `VAL` in this scope +//~| ERROR not all trait items implemented diff --git a/tests/ui/const-generics/trait-resolution-error-with-const-generics-77919.stderr b/tests/ui/const-generics/trait-resolution-error-with-const-generics-77919.stderr new file mode 100644 index 00000000000..bac8abf46dc --- /dev/null +++ b/tests/ui/const-generics/trait-resolution-error-with-const-generics-77919.stderr @@ -0,0 +1,35 @@ +error[E0412]: cannot find type `PhantomData` in this scope + --> $DIR/trait-resolution-error-with-const-generics-77919.rs:10:9 + | +LL | _n: PhantomData, + | ^^^^^^^^^^^ not found in this scope + | +help: consider importing this struct + | +LL + use std::marker::PhantomData; + | + +error[E0412]: cannot find type `VAL` in this scope + --> $DIR/trait-resolution-error-with-const-generics-77919.rs:12:63 + | +LL | impl TypeVal for Multiply where N: TypeVal {} + | ^^^ not found in this scope + | +help: you might be missing a type parameter + | +LL | impl TypeVal for Multiply where N: TypeVal {} + | +++++ + +error[E0046]: not all trait items implemented, missing: `VAL` + --> $DIR/trait-resolution-error-with-const-generics-77919.rs:12:1 + | +LL | const VAL: T; + | ------------ `VAL` from trait +... +LL | impl TypeVal for Multiply where N: TypeVal {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0046, E0412. +For more information about an error, try `rustc --explain E0046`. diff --git a/tests/ui/drop/destructor-run-for-expression-4734.rs b/tests/ui/drop/destructor-run-for-expression-4734.rs new file mode 100644 index 00000000000..57971ee5ef7 --- /dev/null +++ b/tests/ui/drop/destructor-run-for-expression-4734.rs @@ -0,0 +1,39 @@ +// https://github.com/rust-lang/rust/issues/4734 +//@ run-pass +#![allow(dead_code)] +// Ensures that destructors are run for expressions of the form "e;" where +// `e` is a type which requires a destructor. + +// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint +#![allow(static_mut_refs)] +#![allow(path_statements)] + +struct A { n: isize } +struct B; + +static mut NUM_DROPS: usize = 0; + +impl Drop for A { + fn drop(&mut self) { + unsafe { NUM_DROPS += 1; } + } +} + +impl Drop for B { + fn drop(&mut self) { + unsafe { NUM_DROPS += 1; } + } +} + +fn main() { + assert_eq!(unsafe { NUM_DROPS }, 0); + { let _a = A { n: 1 }; } + assert_eq!(unsafe { NUM_DROPS }, 1); + { A { n: 3 }; } + assert_eq!(unsafe { NUM_DROPS }, 2); + + { let _b = B; } + assert_eq!(unsafe { NUM_DROPS }, 3); + { B; } + assert_eq!(unsafe { NUM_DROPS }, 4); +} diff --git a/tests/ui/generics/unnecessary-path-disambiguator-36116.rs b/tests/ui/generics/unnecessary-path-disambiguator-36116.rs new file mode 100644 index 00000000000..c2dab605f59 --- /dev/null +++ b/tests/ui/generics/unnecessary-path-disambiguator-36116.rs @@ -0,0 +1,26 @@ +// https://github.com/rust-lang/rust/issues/36116 +// Unnecessary path disambiguator is ok + +//@ check-pass + +macro_rules! m { + ($p: path) => { + let _ = $p(0); + let _: $p; + } +} + +struct Foo { + _a: T, +} + +struct S(T); + +fn f() { + let f = Some(Foo { _a: 42 }).map(|a| a as Foo::); + let g: Foo:: = Foo { _a: 42 }; + + m!(S::); +} + +fn main() {} diff --git a/tests/ui/inference/collection-type-copy-behavior-12909.rs b/tests/ui/inference/collection-type-copy-behavior-12909.rs new file mode 100644 index 00000000000..83536e8875c --- /dev/null +++ b/tests/ui/inference/collection-type-copy-behavior-12909.rs @@ -0,0 +1,20 @@ +// https://github.com/rust-lang/rust/issues/12909 +//@ run-pass +#![allow(unused_variables)] + +use std::collections::HashMap; + +fn copy(&x: &T) -> T { + x +} + +fn main() { + let arr = [(1, 1), (2, 2), (3, 3)]; + + let v1: Vec<&_> = arr.iter().collect(); + let v2: Vec<_> = arr.iter().map(copy).collect(); + + let m1: HashMap<_, _> = arr.iter().map(copy).collect(); + let m2: HashMap = arr.iter().map(copy).collect(); + let m3: HashMap<_, usize> = arr.iter().map(copy).collect(); +} diff --git a/tests/ui/issues/auxiliary/issue-25185-1.rs b/tests/ui/issues/auxiliary/issue-25185-1.rs deleted file mode 100644 index 032d7d5de34..00000000000 --- a/tests/ui/issues/auxiliary/issue-25185-1.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ no-prefer-dynamic - -#![crate_type = "rlib"] - -#[link(name = "rust_test_helpers", kind = "static")] -extern "C" { - pub fn rust_dbg_extern_identity_u32(u: u32) -> u32; -} diff --git a/tests/ui/issues/auxiliary/issue-25185-2.rs b/tests/ui/issues/auxiliary/issue-25185-2.rs deleted file mode 100644 index 7ce3df255a3..00000000000 --- a/tests/ui/issues/auxiliary/issue-25185-2.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate issue_25185_1; - -pub use issue_25185_1::rust_dbg_extern_identity_u32; diff --git a/tests/ui/issues/issue-11869.rs b/tests/ui/issues/issue-11869.rs deleted file mode 100644 index dd752227bbe..00000000000 --- a/tests/ui/issues/issue-11869.rs +++ /dev/null @@ -1,16 +0,0 @@ -//@ check-pass -#![allow(dead_code)] - -struct A { - a: String -} - -fn borrow<'a>(binding: &'a A) -> &'a str { - match &*binding.a { - "in" => "in_", - "ref" => "ref_", - ident => ident - } -} - -fn main() {} diff --git a/tests/ui/issues/issue-12909.rs b/tests/ui/issues/issue-12909.rs deleted file mode 100644 index f2c33806aae..00000000000 --- a/tests/ui/issues/issue-12909.rs +++ /dev/null @@ -1,19 +0,0 @@ -//@ run-pass -#![allow(unused_variables)] - -use std::collections::HashMap; - -fn copy(&x: &T) -> T { - x -} - -fn main() { - let arr = [(1, 1), (2, 2), (3, 3)]; - - let v1: Vec<&_> = arr.iter().collect(); - let v2: Vec<_> = arr.iter().map(copy).collect(); - - let m1: HashMap<_, _> = arr.iter().map(copy).collect(); - let m2: HashMap = arr.iter().map(copy).collect(); - let m3: HashMap<_, usize> = arr.iter().map(copy).collect(); -} diff --git a/tests/ui/issues/issue-15673.rs b/tests/ui/issues/issue-15673.rs deleted file mode 100644 index bb61c246276..00000000000 --- a/tests/ui/issues/issue-15673.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ run-pass -#![allow(stable_features)] - -#![feature(iter_arith)] - -fn main() { - let x: [u64; 3] = [1, 2, 3]; - assert_eq!(6, (0..3).map(|i| x[i]).sum::()); -} diff --git a/tests/ui/issues/issue-18058.rs b/tests/ui/issues/issue-18058.rs deleted file mode 100644 index cced66717e1..00000000000 --- a/tests/ui/issues/issue-18058.rs +++ /dev/null @@ -1,4 +0,0 @@ -impl Undefined {} -//~^ ERROR cannot find type `Undefined` in this scope - -fn main() {} diff --git a/tests/ui/issues/issue-18058.stderr b/tests/ui/issues/issue-18058.stderr deleted file mode 100644 index c880bb00291..00000000000 --- a/tests/ui/issues/issue-18058.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0412]: cannot find type `Undefined` in this scope - --> $DIR/issue-18058.rs:1:6 - | -LL | impl Undefined {} - | ^^^^^^^^^ not found in this scope - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/issues/issue-18685.rs b/tests/ui/issues/issue-18685.rs deleted file mode 100644 index 3dab341f615..00000000000 --- a/tests/ui/issues/issue-18685.rs +++ /dev/null @@ -1,20 +0,0 @@ -//@ run-pass -// Test that the self param space is not used in a conflicting -// manner by unboxed closures within a default method on a trait - - -trait Tr { - fn foo(&self); - - fn bar(&self) { - (|| { self.foo() })() - } -} - -impl Tr for () { - fn foo(&self) {} -} - -fn main() { - ().bar(); -} diff --git a/tests/ui/issues/issue-22434.rs b/tests/ui/issues/issue-22434.rs deleted file mode 100644 index d9f7b987c64..00000000000 --- a/tests/ui/issues/issue-22434.rs +++ /dev/null @@ -1,8 +0,0 @@ -pub trait Foo { - type A; -} - -type I<'a> = &'a (dyn Foo + 'a); -//~^ ERROR the value of the associated type `A` in `Foo` must be specified - -fn main() {} diff --git a/tests/ui/issues/issue-22434.stderr b/tests/ui/issues/issue-22434.stderr deleted file mode 100644 index 172ae386c3e..00000000000 --- a/tests/ui/issues/issue-22434.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0191]: the value of the associated type `A` in `Foo` must be specified - --> $DIR/issue-22434.rs:5:23 - | -LL | type A; - | ------ `A` defined here -... -LL | type I<'a> = &'a (dyn Foo + 'a); - | ^^^ help: specify the associated type: `Foo` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0191`. diff --git a/tests/ui/issues/issue-25185.rs b/tests/ui/issues/issue-25185.rs deleted file mode 100644 index 7dc06ad96df..00000000000 --- a/tests/ui/issues/issue-25185.rs +++ /dev/null @@ -1,12 +0,0 @@ -//@ run-pass -//@ aux-build:issue-25185-1.rs -//@ aux-build:issue-25185-2.rs - -extern crate issue_25185_2; - -fn main() { - let x = unsafe { - issue_25185_2::rust_dbg_extern_identity_u32(1) - }; - assert_eq!(x, 1); -} diff --git a/tests/ui/issues/issue-26093.rs b/tests/ui/issues/issue-26093.rs deleted file mode 100644 index c838515caf9..00000000000 --- a/tests/ui/issues/issue-26093.rs +++ /dev/null @@ -1,12 +0,0 @@ -macro_rules! not_a_place { - ($thing:expr) => { - $thing = 42; - //~^ ERROR invalid left-hand side of assignment - $thing += 42; - //~^ ERROR invalid left-hand side of assignment - } -} - -fn main() { - not_a_place!(99); -} diff --git a/tests/ui/issues/issue-26093.stderr b/tests/ui/issues/issue-26093.stderr deleted file mode 100644 index 1a08d0fef41..00000000000 --- a/tests/ui/issues/issue-26093.stderr +++ /dev/null @@ -1,32 +0,0 @@ -error[E0070]: invalid left-hand side of assignment - --> $DIR/issue-26093.rs:3:16 - | -LL | $thing = 42; - | ^ -... -LL | not_a_place!(99); - | ---------------- - | | | - | | cannot assign to this expression - | in this macro invocation - | - = note: this error originates in the macro `not_a_place` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0067]: invalid left-hand side of assignment - --> $DIR/issue-26093.rs:5:16 - | -LL | $thing += 42; - | ^^ -... -LL | not_a_place!(99); - | ---------------- - | | | - | | cannot assign to this expression - | in this macro invocation - | - = note: this error originates in the macro `not_a_place` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0067, E0070. -For more information about an error, try `rustc --explain E0067`. diff --git a/tests/ui/issues/issue-26095.rs b/tests/ui/issues/issue-26095.rs deleted file mode 100644 index 34c617dc495..00000000000 --- a/tests/ui/issues/issue-26095.rs +++ /dev/null @@ -1,23 +0,0 @@ -//@ check-pass -#![allow(dead_code)] -#![allow(non_upper_case_globals)] - - -trait HasNumber { - const Number: usize; -} - -enum One {} -enum Two {} - -enum Foo {} - -impl HasNumber for One { - const Number: usize = 1; -} - -impl HasNumber for Two { - const Number: usize = 2; -} - -fn main() {} diff --git a/tests/ui/issues/issue-32655.rs b/tests/ui/issues/issue-32655.rs deleted file mode 100644 index f52e0923129..00000000000 --- a/tests/ui/issues/issue-32655.rs +++ /dev/null @@ -1,19 +0,0 @@ -macro_rules! foo ( - () => ( - #[derive_Clone] //~ ERROR cannot find attribute `derive_Clone` in this scope - struct T; - ); -); - -macro_rules! bar ( - ($e:item) => ($e) -); - -foo!(); - -bar!( - #[derive_Clone] //~ ERROR cannot find attribute `derive_Clone` in this scope - struct S; -); - -fn main() {} diff --git a/tests/ui/issues/issue-32655.stderr b/tests/ui/issues/issue-32655.stderr deleted file mode 100644 index b8362499b2d..00000000000 --- a/tests/ui/issues/issue-32655.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error: cannot find attribute `derive_Clone` in this scope - --> $DIR/issue-32655.rs:3:11 - | -LL | #[derive_Clone] - | ^^^^^^^^^^^^ help: an attribute macro with a similar name exists: `derive_const` -... -LL | foo!(); - | ------ in this macro invocation - --> $SRC_DIR/core/src/macros/mod.rs:LL:COL - | - = note: similarly named attribute macro `derive_const` defined here - | - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: cannot find attribute `derive_Clone` in this scope - --> $DIR/issue-32655.rs:15:7 - | -LL | #[derive_Clone] - | ^^^^^^^^^^^^ help: an attribute macro with a similar name exists: `derive_const` - --> $SRC_DIR/core/src/macros/mod.rs:LL:COL - | - = note: similarly named attribute macro `derive_const` defined here - -error: aborting due to 2 previous errors - diff --git a/tests/ui/issues/issue-32995-2.rs b/tests/ui/issues/issue-32995-2.rs deleted file mode 100644 index e713a64d3f5..00000000000 --- a/tests/ui/issues/issue-32995-2.rs +++ /dev/null @@ -1,13 +0,0 @@ -fn main() { - { fn f() {} } - //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait - - { fn f() -> impl ::std::marker()::Send { } } - //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait -} - -#[derive(Clone)] -struct X; - -impl ::std::marker()::Copy for X {} -//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait diff --git a/tests/ui/issues/issue-32995-2.stderr b/tests/ui/issues/issue-32995-2.stderr deleted file mode 100644 index 6c2d772a233..00000000000 --- a/tests/ui/issues/issue-32995-2.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/issue-32995-2.rs:2:22 - | -LL | { fn f() {} } - | ^^^^^^^^ only `Fn` traits may use parentheses - -error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/issue-32995-2.rs:5:29 - | -LL | { fn f() -> impl ::std::marker()::Send { } } - | ^^^^^^^^ only `Fn` traits may use parentheses - -error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/issue-32995-2.rs:12:13 - | -LL | impl ::std::marker()::Copy for X {} - | ^^^^^^^^ only `Fn` traits may use parentheses - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0214`. diff --git a/tests/ui/issues/issue-36023.rs b/tests/ui/issues/issue-36023.rs deleted file mode 100644 index 32e8af65c7d..00000000000 --- a/tests/ui/issues/issue-36023.rs +++ /dev/null @@ -1,24 +0,0 @@ -//@ run-pass -#![allow(unused_variables)] -use std::ops::Deref; - -fn main() { - if env_var("FOOBAR").as_ref().map(Deref::deref).ok() == Some("yes") { - panic!() - } - - let env_home: Result = Ok("foo-bar-baz".to_string()); - let env_home = env_home.as_ref().map(Deref::deref).ok(); - - if env_home == Some("") { panic!() } -} - -#[inline(never)] -fn env_var(s: &str) -> Result { - Err(VarError::NotPresent) -} - -pub enum VarError { - NotPresent, - NotUnicode(String), -} diff --git a/tests/ui/issues/issue-36116.rs b/tests/ui/issues/issue-36116.rs deleted file mode 100644 index 2313e189aff..00000000000 --- a/tests/ui/issues/issue-36116.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Unnecessary path disambiguator is ok - -//@ check-pass - -macro_rules! m { - ($p: path) => { - let _ = $p(0); - let _: $p; - } -} - -struct Foo { - _a: T, -} - -struct S(T); - -fn f() { - let f = Some(Foo { _a: 42 }).map(|a| a as Foo::); - let g: Foo:: = Foo { _a: 42 }; - - m!(S::); -} - -fn main() {} diff --git a/tests/ui/issues/issue-36786-resolve-call.rs b/tests/ui/issues/issue-36786-resolve-call.rs deleted file mode 100644 index de7b0e18d52..00000000000 --- a/tests/ui/issues/issue-36786-resolve-call.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ run-pass -// Ensure that types that rely on obligations are autoderefed -// correctly - -fn main() { - let x : Vec> = vec![Box::new(|| ())]; - x[0]() -} diff --git a/tests/ui/issues/issue-46471-1.rs b/tests/ui/issues/issue-46471-1.rs deleted file mode 100644 index aa161d40f70..00000000000 --- a/tests/ui/issues/issue-46471-1.rs +++ /dev/null @@ -1,8 +0,0 @@ -fn main() { - let y = { - let mut z = 0; - &mut z - }; - //~^^ ERROR `z` does not live long enough [E0597] - println!("{}", y); -} diff --git a/tests/ui/issues/issue-46471-1.stderr b/tests/ui/issues/issue-46471-1.stderr deleted file mode 100644 index d4517223982..00000000000 --- a/tests/ui/issues/issue-46471-1.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0597]: `z` does not live long enough - --> $DIR/issue-46471-1.rs:4:9 - | -LL | let mut z = 0; - | ----- binding `z` declared here -LL | &mut z - | ^^^^^^ borrowed value does not live long enough -LL | }; - | - `z` dropped here while still borrowed - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0597`. diff --git a/tests/ui/issues/issue-4734.rs b/tests/ui/issues/issue-4734.rs deleted file mode 100644 index 58aa0179693..00000000000 --- a/tests/ui/issues/issue-4734.rs +++ /dev/null @@ -1,38 +0,0 @@ -//@ run-pass -#![allow(dead_code)] -// Ensures that destructors are run for expressions of the form "e;" where -// `e` is a type which requires a destructor. - -// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint -#![allow(static_mut_refs)] -#![allow(path_statements)] - -struct A { n: isize } -struct B; - -static mut NUM_DROPS: usize = 0; - -impl Drop for A { - fn drop(&mut self) { - unsafe { NUM_DROPS += 1; } - } -} - -impl Drop for B { - fn drop(&mut self) { - unsafe { NUM_DROPS += 1; } - } -} - -fn main() { - assert_eq!(unsafe { NUM_DROPS }, 0); - { let _a = A { n: 1 }; } - assert_eq!(unsafe { NUM_DROPS }, 1); - { A { n: 3 }; } - assert_eq!(unsafe { NUM_DROPS }, 2); - - { let _b = B; } - assert_eq!(unsafe { NUM_DROPS }, 3); - { B; } - assert_eq!(unsafe { NUM_DROPS }, 4); -} diff --git a/tests/ui/issues/issue-48276.rs b/tests/ui/issues/issue-48276.rs deleted file mode 100644 index f55c056fa67..00000000000 --- a/tests/ui/issues/issue-48276.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Regression test for issue #48276 - ICE when self type does not match what is -// required by a trait and regions are involved. - -trait MyFrom { - fn from(a: A) -> Self; -} - -struct A; - -impl<'a, 'b> MyFrom for &'a str { - fn from(self: &'a Self) -> &'b str { - //~^ ERROR: method `from` has a `&self` declaration in the impl, but not in the trait - "asdf" - } -} - -struct B; - -impl From for B { - fn from(&self) -> B { - //~^ ERROR: method `from` has a `&self` declaration in the impl, but not in the trait - B - } -} - -impl From for &'static str { - fn from(&self) -> &'static str { - //~^ ERROR: method `from` has a `&self` declaration in the impl, but not in the trait - "" - } -} - -fn main(){} diff --git a/tests/ui/issues/issue-48276.stderr b/tests/ui/issues/issue-48276.stderr deleted file mode 100644 index 370905ee0df..00000000000 --- a/tests/ui/issues/issue-48276.stderr +++ /dev/null @@ -1,28 +0,0 @@ -error[E0185]: method `from` has a `&self` declaration in the impl, but not in the trait - --> $DIR/issue-48276.rs:11:5 - | -LL | fn from(a: A) -> Self; - | ---------------------- trait method declared without `&self` -... -LL | fn from(self: &'a Self) -> &'b str { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&self` used in impl - -error[E0185]: method `from` has a `&self` declaration in the impl, but not in the trait - --> $DIR/issue-48276.rs:20:5 - | -LL | fn from(&self) -> B { - | ^^^^^^^^^^^^^^^^^^^ `&self` used in impl - | - = note: `from` from trait: `fn(T) -> Self` - -error[E0185]: method `from` has a `&self` declaration in the impl, but not in the trait - --> $DIR/issue-48276.rs:27:5 - | -LL | fn from(&self) -> &'static str { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&self` used in impl - | - = note: `from` from trait: `fn(T) -> Self` - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0185`. diff --git a/tests/ui/issues/issue-54044.rs b/tests/ui/issues/issue-54044.rs deleted file mode 100644 index 809ea7a87db..00000000000 --- a/tests/ui/issues/issue-54044.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![deny(unused_attributes)] //~ NOTE lint level is defined here - -#[cold] -//~^ ERROR attribute should be applied to a function -//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -struct Foo; //~ NOTE not a function - -fn main() { - #[cold] - //~^ ERROR attribute should be applied to a function - //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - 5; //~ NOTE not a function -} diff --git a/tests/ui/issues/issue-54044.stderr b/tests/ui/issues/issue-54044.stderr deleted file mode 100644 index 8bd94a041d0..00000000000 --- a/tests/ui/issues/issue-54044.stderr +++ /dev/null @@ -1,29 +0,0 @@ -error: attribute should be applied to a function definition - --> $DIR/issue-54044.rs:3:1 - | -LL | #[cold] - | ^^^^^^^ -... -LL | struct Foo; - | ----------- not a function definition - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -note: the lint level is defined here - --> $DIR/issue-54044.rs:1:9 - | -LL | #![deny(unused_attributes)] - | ^^^^^^^^^^^^^^^^^ - -error: attribute should be applied to a function definition - --> $DIR/issue-54044.rs:9:5 - | -LL | #[cold] - | ^^^^^^^ -... -LL | 5; - | - not a function definition - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - -error: aborting due to 2 previous errors - diff --git a/tests/ui/issues/issue-7519-match-unit-in-arg.rs b/tests/ui/issues/issue-7519-match-unit-in-arg.rs deleted file mode 100644 index a7cea577b22..00000000000 --- a/tests/ui/issues/issue-7519-match-unit-in-arg.rs +++ /dev/null @@ -1,11 +0,0 @@ -//@ run-pass - -/* -#7519 ICE pattern matching unit in function argument -*/ - -fn foo(():()) { } - -pub fn main() { - foo(()); -} diff --git a/tests/ui/issues/issue-77919.rs b/tests/ui/issues/issue-77919.rs deleted file mode 100644 index bf603314977..00000000000 --- a/tests/ui/issues/issue-77919.rs +++ /dev/null @@ -1,13 +0,0 @@ -fn main() { - [1; >::VAL]; -} -trait TypeVal { - const VAL: T; -} -struct Five; -struct Multiply { - _n: PhantomData, //~ ERROR cannot find type `PhantomData` in this scope -} -impl TypeVal for Multiply where N: TypeVal {} -//~^ ERROR cannot find type `VAL` in this scope -//~| ERROR not all trait items implemented diff --git a/tests/ui/issues/issue-77919.stderr b/tests/ui/issues/issue-77919.stderr deleted file mode 100644 index dbbe70ff069..00000000000 --- a/tests/ui/issues/issue-77919.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0412]: cannot find type `PhantomData` in this scope - --> $DIR/issue-77919.rs:9:9 - | -LL | _n: PhantomData, - | ^^^^^^^^^^^ not found in this scope - | -help: consider importing this struct - | -LL + use std::marker::PhantomData; - | - -error[E0412]: cannot find type `VAL` in this scope - --> $DIR/issue-77919.rs:11:63 - | -LL | impl TypeVal for Multiply where N: TypeVal {} - | ^^^ not found in this scope - | -help: you might be missing a type parameter - | -LL | impl TypeVal for Multiply where N: TypeVal {} - | +++++ - -error[E0046]: not all trait items implemented, missing: `VAL` - --> $DIR/issue-77919.rs:11:1 - | -LL | const VAL: T; - | ------------ `VAL` from trait -... -LL | impl TypeVal for Multiply where N: TypeVal {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation - -error: aborting due to 3 previous errors - -Some errors have detailed explanations: E0046, E0412. -For more information about an error, try `rustc --explain E0046`. diff --git a/tests/ui/issues/issue-9918.rs b/tests/ui/issues/issue-9918.rs deleted file mode 100644 index 017e833aefb..00000000000 --- a/tests/ui/issues/issue-9918.rs +++ /dev/null @@ -1,5 +0,0 @@ -//@ run-pass - -pub fn main() { - assert_eq!((0 + 0u8) as char, '\0'); -} diff --git a/tests/ui/iterators/iterator-type-inference-sum-15673.rs b/tests/ui/iterators/iterator-type-inference-sum-15673.rs new file mode 100644 index 00000000000..aee027927f2 --- /dev/null +++ b/tests/ui/iterators/iterator-type-inference-sum-15673.rs @@ -0,0 +1,10 @@ +// https://github.com/rust-lang/rust/issues/15673 +//@ run-pass +#![allow(stable_features)] + +#![feature(iter_arith)] + +fn main() { + let x: [u64; 3] = [1, 2, 3]; + assert_eq!(6, (0..3).map(|i| x[i]).sum::()); +} diff --git a/tests/ui/linking/auxiliary/aux-25185-1.rs b/tests/ui/linking/auxiliary/aux-25185-1.rs new file mode 100644 index 00000000000..032d7d5de34 --- /dev/null +++ b/tests/ui/linking/auxiliary/aux-25185-1.rs @@ -0,0 +1,8 @@ +//@ no-prefer-dynamic + +#![crate_type = "rlib"] + +#[link(name = "rust_test_helpers", kind = "static")] +extern "C" { + pub fn rust_dbg_extern_identity_u32(u: u32) -> u32; +} diff --git a/tests/ui/linking/auxiliary/aux-25185-2.rs b/tests/ui/linking/auxiliary/aux-25185-2.rs new file mode 100644 index 00000000000..96c73f623e4 --- /dev/null +++ b/tests/ui/linking/auxiliary/aux-25185-2.rs @@ -0,0 +1,3 @@ +extern crate aux_25185_1; + +pub use aux_25185_1::rust_dbg_extern_identity_u32; diff --git a/tests/ui/linking/rlib-to-dylib-native-deps-inclusion-25185.rs b/tests/ui/linking/rlib-to-dylib-native-deps-inclusion-25185.rs new file mode 100644 index 00000000000..bbcfcb75106 --- /dev/null +++ b/tests/ui/linking/rlib-to-dylib-native-deps-inclusion-25185.rs @@ -0,0 +1,13 @@ +// https://github.com/rust-lang/rust/issues/25185 +//@ run-pass +//@ aux-build:aux-25185-1.rs +//@ aux-build:aux-25185-2.rs + +extern crate aux_25185_2; + +fn main() { + let x = unsafe { + aux_25185_2::rust_dbg_extern_identity_u32(1) + }; + assert_eq!(x, 1); +} diff --git a/tests/ui/macros/invalid-assignment-in-macro-26093.rs b/tests/ui/macros/invalid-assignment-in-macro-26093.rs new file mode 100644 index 00000000000..686a13a3eec --- /dev/null +++ b/tests/ui/macros/invalid-assignment-in-macro-26093.rs @@ -0,0 +1,13 @@ +// https://github.com/rust-lang/rust/issues/26093 +macro_rules! not_a_place { + ($thing:expr) => { + $thing = 42; + //~^ ERROR invalid left-hand side of assignment + $thing += 42; + //~^ ERROR invalid left-hand side of assignment + } +} + +fn main() { + not_a_place!(99); +} diff --git a/tests/ui/macros/invalid-assignment-in-macro-26093.stderr b/tests/ui/macros/invalid-assignment-in-macro-26093.stderr new file mode 100644 index 00000000000..99f188c7183 --- /dev/null +++ b/tests/ui/macros/invalid-assignment-in-macro-26093.stderr @@ -0,0 +1,32 @@ +error[E0070]: invalid left-hand side of assignment + --> $DIR/invalid-assignment-in-macro-26093.rs:4:16 + | +LL | $thing = 42; + | ^ +... +LL | not_a_place!(99); + | ---------------- + | | | + | | cannot assign to this expression + | in this macro invocation + | + = note: this error originates in the macro `not_a_place` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0067]: invalid left-hand side of assignment + --> $DIR/invalid-assignment-in-macro-26093.rs:6:16 + | +LL | $thing += 42; + | ^^ +... +LL | not_a_place!(99); + | ---------------- + | | | + | | cannot assign to this expression + | in this macro invocation + | + = note: this error originates in the macro `not_a_place` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0067, E0070. +For more information about an error, try `rustc --explain E0067`. diff --git a/tests/ui/pattern/unit-pattern-matching-in-function-argument-7519.rs b/tests/ui/pattern/unit-pattern-matching-in-function-argument-7519.rs new file mode 100644 index 00000000000..7bfa9ee6625 --- /dev/null +++ b/tests/ui/pattern/unit-pattern-matching-in-function-argument-7519.rs @@ -0,0 +1,12 @@ +//@ run-pass + +/* +#7519 ICE pattern matching unit in function argument +https://github.com/rust-lang/rust/issues/7519 +*/ + +fn foo(():()) { } + +pub fn main() { + foo(()); +} diff --git a/tests/ui/type-alias/missing-associated-type-in-trait-object-22434.rs b/tests/ui/type-alias/missing-associated-type-in-trait-object-22434.rs new file mode 100644 index 00000000000..35b30374c15 --- /dev/null +++ b/tests/ui/type-alias/missing-associated-type-in-trait-object-22434.rs @@ -0,0 +1,9 @@ +// https://github.com/rust-lang/rust/issues/22434 +pub trait Foo { + type A; +} + +type I<'a> = &'a (dyn Foo + 'a); +//~^ ERROR the value of the associated type `A` in `Foo` must be specified + +fn main() {} diff --git a/tests/ui/type-alias/missing-associated-type-in-trait-object-22434.stderr b/tests/ui/type-alias/missing-associated-type-in-trait-object-22434.stderr new file mode 100644 index 00000000000..73afefa5a1f --- /dev/null +++ b/tests/ui/type-alias/missing-associated-type-in-trait-object-22434.stderr @@ -0,0 +1,12 @@ +error[E0191]: the value of the associated type `A` in `Foo` must be specified + --> $DIR/missing-associated-type-in-trait-object-22434.rs:6:23 + | +LL | type A; + | ------ `A` defined here +... +LL | type I<'a> = &'a (dyn Foo + 'a); + | ^^^ help: specify the associated type: `Foo` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0191`. diff --git a/tests/ui/typeck/incorrect-self-type-in-trait-impl-48276.rs b/tests/ui/typeck/incorrect-self-type-in-trait-impl-48276.rs new file mode 100644 index 00000000000..1cff2078755 --- /dev/null +++ b/tests/ui/typeck/incorrect-self-type-in-trait-impl-48276.rs @@ -0,0 +1,34 @@ +// https://github.com/rust-lang/rust/issues/48276 +// Regression test for issue #48276 - ICE when self type does not match what is +// required by a trait and regions are involved. + +trait MyFrom { + fn from(a: A) -> Self; +} + +struct A; + +impl<'a, 'b> MyFrom for &'a str { + fn from(self: &'a Self) -> &'b str { + //~^ ERROR: method `from` has a `&self` declaration in the impl, but not in the trait + "asdf" + } +} + +struct B; + +impl From for B { + fn from(&self) -> B { + //~^ ERROR: method `from` has a `&self` declaration in the impl, but not in the trait + B + } +} + +impl From for &'static str { + fn from(&self) -> &'static str { + //~^ ERROR: method `from` has a `&self` declaration in the impl, but not in the trait + "" + } +} + +fn main(){} diff --git a/tests/ui/typeck/incorrect-self-type-in-trait-impl-48276.stderr b/tests/ui/typeck/incorrect-self-type-in-trait-impl-48276.stderr new file mode 100644 index 00000000000..124dc459237 --- /dev/null +++ b/tests/ui/typeck/incorrect-self-type-in-trait-impl-48276.stderr @@ -0,0 +1,28 @@ +error[E0185]: method `from` has a `&self` declaration in the impl, but not in the trait + --> $DIR/incorrect-self-type-in-trait-impl-48276.rs:12:5 + | +LL | fn from(a: A) -> Self; + | ---------------------- trait method declared without `&self` +... +LL | fn from(self: &'a Self) -> &'b str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&self` used in impl + +error[E0185]: method `from` has a `&self` declaration in the impl, but not in the trait + --> $DIR/incorrect-self-type-in-trait-impl-48276.rs:21:5 + | +LL | fn from(&self) -> B { + | ^^^^^^^^^^^^^^^^^^^ `&self` used in impl + | + = note: `from` from trait: `fn(T) -> Self` + +error[E0185]: method `from` has a `&self` declaration in the impl, but not in the trait + --> $DIR/incorrect-self-type-in-trait-impl-48276.rs:28:5 + | +LL | fn from(&self) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&self` used in impl + | + = note: `from` from trait: `fn(T) -> Self` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0185`. diff --git a/tests/ui/typeck/parenthesized-type-parameters-error-32995.rs b/tests/ui/typeck/parenthesized-type-parameters-error-32995.rs new file mode 100644 index 00000000000..e0c2ab5f303 --- /dev/null +++ b/tests/ui/typeck/parenthesized-type-parameters-error-32995.rs @@ -0,0 +1,14 @@ +// https://github.com/rust-lang/rust/issues/32995 +fn main() { + { fn f() {} } + //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait + + { fn f() -> impl ::std::marker()::Send { } } + //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait +} + +#[derive(Clone)] +struct X; + +impl ::std::marker()::Copy for X {} +//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait diff --git a/tests/ui/typeck/parenthesized-type-parameters-error-32995.stderr b/tests/ui/typeck/parenthesized-type-parameters-error-32995.stderr new file mode 100644 index 00000000000..590cdcdb43b --- /dev/null +++ b/tests/ui/typeck/parenthesized-type-parameters-error-32995.stderr @@ -0,0 +1,21 @@ +error[E0214]: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/parenthesized-type-parameters-error-32995.rs:3:22 + | +LL | { fn f() {} } + | ^^^^^^^^ only `Fn` traits may use parentheses + +error[E0214]: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/parenthesized-type-parameters-error-32995.rs:6:29 + | +LL | { fn f() -> impl ::std::marker()::Send { } } + | ^^^^^^^^ only `Fn` traits may use parentheses + +error[E0214]: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/parenthesized-type-parameters-error-32995.rs:13:13 + | +LL | impl ::std::marker()::Copy for X {} + | ^^^^^^^^ only `Fn` traits may use parentheses + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0214`. diff --git a/tests/ui/unboxed-closures/self-param-space-conflict-in-unboxed-closure-18685.rs b/tests/ui/unboxed-closures/self-param-space-conflict-in-unboxed-closure-18685.rs new file mode 100644 index 00000000000..38cf26c2777 --- /dev/null +++ b/tests/ui/unboxed-closures/self-param-space-conflict-in-unboxed-closure-18685.rs @@ -0,0 +1,20 @@ +// https://github.com/rust-lang/rust/issues/18685 +//@ run-pass +// Test that the self param space is not used in a conflicting +// manner by unboxed closures within a default method on a trait + +trait Tr { + fn foo(&self); + + fn bar(&self) { + (|| { self.foo() })() + } +} + +impl Tr for () { + fn foo(&self) {} +} + +fn main() { + ().bar(); +} -- cgit 1.4.1-3-g733a5