From 957fa10d50787a4c6c6d8a35be5af6bd43ba1770 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Wed, 20 Aug 2025 14:02:50 -0400 Subject: Add test batch 3 --- tests/ui/abi/invalid-self-parameter-type-56806.rs | 7 ++ .../abi/invalid-self-parameter-type-56806.stderr | 12 +++ .../traits-associated-consts-ice-56870.rs | 39 ++++++++ .../duplicate-associated-type-resolution-59326.rs | 27 ++++++ .../impl-trait-member-type-resolution-57399.rs | 22 +++++ tests/ui/binop/function-comparison-errors-59488.rs | 35 +++++++ .../binop/function-comparison-errors-59488.stderr | 105 +++++++++++++++++++++ tests/ui/box/boxed-value-matching-57741.rs | 19 ++++ tests/ui/box/boxed-value-matching-57741.stderr | 25 +++++ .../dereferencing-boxed-enum-in-match-57741.fixed | 32 +++++++ .../box/dereferencing-boxed-enum-in-match-57741.rs | 32 +++++++ .../dereferencing-boxed-enum-in-match-57741.stderr | 63 +++++++++++++ .../generic-typed-nested-closures-59494.rs | 24 +++++ .../generic-typed-nested-closures-59494.stderr | 9 ++ .../mono-item-collector-default-impl-58375.rs | 25 +++++ .../trait-implementation-coherence-check-57162.rs | 8 ++ tests/ui/consts/oncecell-const-init-57781.rs | 21 +++++ .../impl-copy-function-debuginfo-58463.rs | 10 ++ .../spurious-dyn-compat-errors-58734.rs | 25 +++++ .../spurious-dyn-compat-errors-58734.stderr | 42 +++++++++ .../generic-associated-type-deref-target-56237.rs | 14 +++ .../hrtb-associated-type-leak-check-55731.rs | 53 +++++++++++ .../hrtb-associated-type-leak-check-55731.stderr | 14 +++ .../ui/imports/auxiliary/reexported-trait-56175.rs | 17 ++++ ...e-types-suggested-without-extern-crate-56175.rs | 10 ++ ...pes-suggested-without-extern-crate-56175.stderr | 46 +++++++++ tests/ui/infinite/auxiliary/aux-57271-lib.rs | 11 +++ .../mutually-recursive-infinite-types-57271.rs | 25 +++++ .../mutually-recursive-infinite-types-57271.stderr | 27 ++++++ tests/ui/issues/auxiliary/issue-56943.rs | 3 - tests/ui/issues/auxiliary/issue-57271-lib.rs | 11 --- tests/ui/issues/issue-55587.rs | 5 - tests/ui/issues/issue-55587.stderr | 11 --- tests/ui/issues/issue-55731.rs | 52 ---------- tests/ui/issues/issue-55731.stderr | 14 --- tests/ui/issues/issue-56128.rs | 15 --- tests/ui/issues/issue-56175.rs | 9 -- tests/ui/issues/issue-56175.stderr | 46 --------- tests/ui/issues/issue-56199.rs | 22 ----- tests/ui/issues/issue-56199.stderr | 30 ------ tests/ui/issues/issue-56229.rs | 35 ------- tests/ui/issues/issue-56237.rs | 13 --- tests/ui/issues/issue-56806.rs | 6 -- tests/ui/issues/issue-56806.stderr | 12 --- tests/ui/issues/issue-56835.rs | 9 -- tests/ui/issues/issue-56835.stderr | 15 --- tests/ui/issues/issue-56870.rs | 38 -------- tests/ui/issues/issue-56943.rs | 8 -- tests/ui/issues/issue-56943.stderr | 11 --- tests/ui/issues/issue-57156.rs | 23 ----- tests/ui/issues/issue-57162.rs | 7 -- tests/ui/issues/issue-57198-pass.rs | 9 -- tests/ui/issues/issue-57271.rs | 24 ----- tests/ui/issues/issue-57271.stderr | 27 ------ .../issues/issue-57399-self-return-impl-trait.rs | 22 ----- .../issue-57741-1.rs | 18 ---- .../issue-57741-1.stderr | 25 ----- .../issue-57741.fixed | 31 ------ .../issue-57741.rs | 31 ------ .../issue-57741.stderr | 63 ------------- tests/ui/issues/issue-57781.rs | 20 ---- tests/ui/issues/issue-57924.rs | 10 -- tests/ui/issues/issue-57924.stderr | 11 --- tests/ui/issues/issue-58212.rs | 15 --- .../issue-58375-monomorphize-default-impls.rs | 24 ----- tests/ui/issues/issue-58463.rs | 9 -- tests/ui/issues/issue-58712.rs | 14 --- tests/ui/issues/issue-58712.stderr | 20 ---- tests/ui/issues/issue-58734.rs | 24 ----- tests/ui/issues/issue-58734.stderr | 42 --------- tests/ui/issues/issue-58857.rs | 7 -- tests/ui/issues/issue-58857.stderr | 8 -- tests/ui/issues/issue-59020.rs | 27 ------ tests/ui/issues/issue-59326.rs | 26 ----- tests/ui/issues/issue-59488.rs | 34 ------- tests/ui/issues/issue-59488.stderr | 105 --------------------- tests/ui/issues/issue-59494.rs | 23 ----- tests/ui/issues/issue-59494.stderr | 9 -- tests/ui/issues/issue-59756.fixed | 17 ---- tests/ui/issues/issue-59756.rs | 21 ----- tests/ui/issues/issue-59756.stderr | 20 ---- .../keyword/raw-identifier-for-function-57198.rs | 10 ++ tests/ui/mismatched_types/auxiliary/aux-56943.rs | 3 + .../type-mismatch-in-extern-crate-56943.rs | 9 ++ .../type-mismatch-in-extern-crate-56943.stderr | 11 +++ .../modules/pub-use-handling-in-modules-56128.rs | 15 +++ .../ui/parser/invalid-variable-definition-55587.rs | 6 ++ .../invalid-variable-definition-55587.stderr | 11 +++ tests/ui/resolve/missing-type-in-scope-58712.rs | 15 +++ .../ui/resolve/missing-type-in-scope-58712.stderr | 20 ++++ tests/ui/std/park-timeout-wakeup-59020.rs | 28 ++++++ tests/ui/structs/invalid-self-constructor-56835.rs | 10 ++ .../structs/invalid-self-constructor-56835.stderr | 15 +++ ...ncompatible-types-in-try-expression-59756.fixed | 17 ++++ .../incompatible-types-in-try-expression-59756.rs | 22 +++++ ...compatible-types-in-try-expression-59756.stderr | 20 ++++ .../negative-bound-not-supported-58857.rs | 8 ++ .../negative-bound-not-supported-58857.stderr | 8 ++ .../generic-trait-impl-aliased-array-58212.rs | 16 ++++ .../traits/trait-object-lifetime-bounds-57156.rs | 24 +++++ .../traits/trait-objects-with-supertraits-56229.rs | 36 +++++++ ...self-constructor-type-args-not-allowed-57924.rs | 11 +++ ...-constructor-type-args-not-allowed-57924.stderr | 11 +++ .../ui/typeck/self-constructor-type-error-56199.rs | 23 +++++ .../self-constructor-type-error-56199.stderr | 30 ++++++ 105 files changed, 1178 insertions(+), 1131 deletions(-) create mode 100644 tests/ui/abi/invalid-self-parameter-type-56806.rs create mode 100644 tests/ui/abi/invalid-self-parameter-type-56806.stderr create mode 100644 tests/ui/associated-consts/traits-associated-consts-ice-56870.rs create mode 100644 tests/ui/associated-types/duplicate-associated-type-resolution-59326.rs create mode 100644 tests/ui/associated-types/impl-trait-member-type-resolution-57399.rs create mode 100644 tests/ui/binop/function-comparison-errors-59488.rs create mode 100644 tests/ui/binop/function-comparison-errors-59488.stderr create mode 100644 tests/ui/box/boxed-value-matching-57741.rs create mode 100644 tests/ui/box/boxed-value-matching-57741.stderr create mode 100644 tests/ui/box/dereferencing-boxed-enum-in-match-57741.fixed create mode 100644 tests/ui/box/dereferencing-boxed-enum-in-match-57741.rs create mode 100644 tests/ui/box/dereferencing-boxed-enum-in-match-57741.stderr create mode 100644 tests/ui/closures/generic-typed-nested-closures-59494.rs create mode 100644 tests/ui/closures/generic-typed-nested-closures-59494.stderr create mode 100644 tests/ui/codegen/mono-item-collector-default-impl-58375.rs create mode 100644 tests/ui/coherence/trait-implementation-coherence-check-57162.rs create mode 100644 tests/ui/consts/oncecell-const-init-57781.rs create mode 100644 tests/ui/debuginfo/impl-copy-function-debuginfo-58463.rs create mode 100644 tests/ui/dyn-compatibility/spurious-dyn-compat-errors-58734.rs create mode 100644 tests/ui/dyn-compatibility/spurious-dyn-compat-errors-58734.stderr create mode 100644 tests/ui/generics/generic-associated-type-deref-target-56237.rs create mode 100644 tests/ui/higher-ranked/hrtb-associated-type-leak-check-55731.rs create mode 100644 tests/ui/higher-ranked/hrtb-associated-type-leak-check-55731.stderr create mode 100644 tests/ui/imports/auxiliary/reexported-trait-56175.rs create mode 100644 tests/ui/imports/private-types-suggested-without-extern-crate-56175.rs create mode 100644 tests/ui/imports/private-types-suggested-without-extern-crate-56175.stderr create mode 100644 tests/ui/infinite/auxiliary/aux-57271-lib.rs create mode 100644 tests/ui/infinite/mutually-recursive-infinite-types-57271.rs create mode 100644 tests/ui/infinite/mutually-recursive-infinite-types-57271.stderr delete mode 100644 tests/ui/issues/auxiliary/issue-56943.rs delete mode 100644 tests/ui/issues/auxiliary/issue-57271-lib.rs delete mode 100644 tests/ui/issues/issue-55587.rs delete mode 100644 tests/ui/issues/issue-55587.stderr delete mode 100644 tests/ui/issues/issue-55731.rs delete mode 100644 tests/ui/issues/issue-55731.stderr delete mode 100644 tests/ui/issues/issue-56128.rs delete mode 100644 tests/ui/issues/issue-56175.rs delete mode 100644 tests/ui/issues/issue-56175.stderr delete mode 100644 tests/ui/issues/issue-56199.rs delete mode 100644 tests/ui/issues/issue-56199.stderr delete mode 100644 tests/ui/issues/issue-56229.rs delete mode 100644 tests/ui/issues/issue-56237.rs delete mode 100644 tests/ui/issues/issue-56806.rs delete mode 100644 tests/ui/issues/issue-56806.stderr delete mode 100644 tests/ui/issues/issue-56835.rs delete mode 100644 tests/ui/issues/issue-56835.stderr delete mode 100644 tests/ui/issues/issue-56870.rs delete mode 100644 tests/ui/issues/issue-56943.rs delete mode 100644 tests/ui/issues/issue-56943.stderr delete mode 100644 tests/ui/issues/issue-57156.rs delete mode 100644 tests/ui/issues/issue-57162.rs delete mode 100644 tests/ui/issues/issue-57198-pass.rs delete mode 100644 tests/ui/issues/issue-57271.rs delete mode 100644 tests/ui/issues/issue-57271.stderr delete mode 100644 tests/ui/issues/issue-57399-self-return-impl-trait.rs delete mode 100644 tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741-1.rs delete mode 100644 tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741-1.stderr delete mode 100644 tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.fixed delete mode 100644 tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.rs delete mode 100644 tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr delete mode 100644 tests/ui/issues/issue-57781.rs delete mode 100644 tests/ui/issues/issue-57924.rs delete mode 100644 tests/ui/issues/issue-57924.stderr delete mode 100644 tests/ui/issues/issue-58212.rs delete mode 100644 tests/ui/issues/issue-58375-monomorphize-default-impls.rs delete mode 100644 tests/ui/issues/issue-58463.rs delete mode 100644 tests/ui/issues/issue-58712.rs delete mode 100644 tests/ui/issues/issue-58712.stderr delete mode 100644 tests/ui/issues/issue-58734.rs delete mode 100644 tests/ui/issues/issue-58734.stderr delete mode 100644 tests/ui/issues/issue-58857.rs delete mode 100644 tests/ui/issues/issue-58857.stderr delete mode 100644 tests/ui/issues/issue-59020.rs delete mode 100644 tests/ui/issues/issue-59326.rs delete mode 100644 tests/ui/issues/issue-59488.rs delete mode 100644 tests/ui/issues/issue-59488.stderr delete mode 100644 tests/ui/issues/issue-59494.rs delete mode 100644 tests/ui/issues/issue-59494.stderr delete mode 100644 tests/ui/issues/issue-59756.fixed delete mode 100644 tests/ui/issues/issue-59756.rs delete mode 100644 tests/ui/issues/issue-59756.stderr create mode 100644 tests/ui/keyword/raw-identifier-for-function-57198.rs create mode 100644 tests/ui/mismatched_types/auxiliary/aux-56943.rs create mode 100644 tests/ui/mismatched_types/type-mismatch-in-extern-crate-56943.rs create mode 100644 tests/ui/mismatched_types/type-mismatch-in-extern-crate-56943.stderr create mode 100644 tests/ui/modules/pub-use-handling-in-modules-56128.rs create mode 100644 tests/ui/parser/invalid-variable-definition-55587.rs create mode 100644 tests/ui/parser/invalid-variable-definition-55587.stderr create mode 100644 tests/ui/resolve/missing-type-in-scope-58712.rs create mode 100644 tests/ui/resolve/missing-type-in-scope-58712.stderr create mode 100644 tests/ui/std/park-timeout-wakeup-59020.rs create mode 100644 tests/ui/structs/invalid-self-constructor-56835.rs create mode 100644 tests/ui/structs/invalid-self-constructor-56835.stderr create mode 100644 tests/ui/suggestions/incompatible-types-in-try-expression-59756.fixed create mode 100644 tests/ui/suggestions/incompatible-types-in-try-expression-59756.rs create mode 100644 tests/ui/suggestions/incompatible-types-in-try-expression-59756.stderr create mode 100644 tests/ui/trait-bounds/negative-bound-not-supported-58857.rs create mode 100644 tests/ui/trait-bounds/negative-bound-not-supported-58857.stderr create mode 100644 tests/ui/traits/generic-trait-impl-aliased-array-58212.rs create mode 100644 tests/ui/traits/trait-object-lifetime-bounds-57156.rs create mode 100644 tests/ui/traits/trait-objects-with-supertraits-56229.rs create mode 100644 tests/ui/typeck/self-constructor-type-args-not-allowed-57924.rs create mode 100644 tests/ui/typeck/self-constructor-type-args-not-allowed-57924.stderr create mode 100644 tests/ui/typeck/self-constructor-type-error-56199.rs create mode 100644 tests/ui/typeck/self-constructor-type-error-56199.stderr diff --git a/tests/ui/abi/invalid-self-parameter-type-56806.rs b/tests/ui/abi/invalid-self-parameter-type-56806.rs new file mode 100644 index 00000000000..60229df3005 --- /dev/null +++ b/tests/ui/abi/invalid-self-parameter-type-56806.rs @@ -0,0 +1,7 @@ +// https://github.com/rust-lang/rust/issues/56806 +pub trait Trait { + fn dyn_instead_of_self(self: Box); + //~^ ERROR invalid `self` parameter type +} + +pub fn main() {} diff --git a/tests/ui/abi/invalid-self-parameter-type-56806.stderr b/tests/ui/abi/invalid-self-parameter-type-56806.stderr new file mode 100644 index 00000000000..ac249b8f108 --- /dev/null +++ b/tests/ui/abi/invalid-self-parameter-type-56806.stderr @@ -0,0 +1,12 @@ +error[E0307]: invalid `self` parameter type: `Box<(dyn Trait + 'static)>` + --> $DIR/invalid-self-parameter-type-56806.rs:3:34 + | +LL | fn dyn_instead_of_self(self: Box); + | ^^^^^^^^^^^^^^ + | + = note: type of `self` must be `Self` or a type that dereferences to it + = help: consider changing to `self`, `&self`, `&mut self`, `self: Box`, `self: Rc`, `self: Arc`, or `self: Pin

` (where P is one of the previous types except `Self`) + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0307`. diff --git a/tests/ui/associated-consts/traits-associated-consts-ice-56870.rs b/tests/ui/associated-consts/traits-associated-consts-ice-56870.rs new file mode 100644 index 00000000000..0c5a2b84773 --- /dev/null +++ b/tests/ui/associated-consts/traits-associated-consts-ice-56870.rs @@ -0,0 +1,39 @@ +// https://github.com/rust-lang/rust/issues/56870 +//@ build-pass +// Regression test for #56870: Internal compiler error (traits & associated consts) + +use std::fmt::Debug; + +pub trait Foo { + const FOO: *const u8; +} + +impl Foo for dyn Debug { + const FOO: *const u8 = ::fmt as *const u8; +} + +pub trait Bar { + const BAR: *const u8; +} + +pub trait Baz { + type Data: Debug; +} + +pub struct BarStruct(S); + +impl Bar for BarStruct { + const BAR: *const u8 = ::Data>>::FOO; +} + +struct AnotherStruct; +#[derive(Debug)] +struct SomeStruct; + +impl Baz for AnotherStruct { + type Data = SomeStruct; +} + +fn main() { + let _x = as Bar>::BAR; +} diff --git a/tests/ui/associated-types/duplicate-associated-type-resolution-59326.rs b/tests/ui/associated-types/duplicate-associated-type-resolution-59326.rs new file mode 100644 index 00000000000..0439e229e14 --- /dev/null +++ b/tests/ui/associated-types/duplicate-associated-type-resolution-59326.rs @@ -0,0 +1,27 @@ +// https://github.com/rust-lang/rust/issues/59326 +//@ check-pass +trait Service { + type S; +} + +trait Framing { + type F; +} + +impl Framing for () { + type F = (); +} + +trait HttpService: Service {} + +type BoxService = Box>; + +fn build_server BoxService>(_: F) {} + +fn make_server() -> Box> { + unimplemented!() +} + +fn main() { + build_server(|| make_server()) +} diff --git a/tests/ui/associated-types/impl-trait-member-type-resolution-57399.rs b/tests/ui/associated-types/impl-trait-member-type-resolution-57399.rs new file mode 100644 index 00000000000..3342dd0631a --- /dev/null +++ b/tests/ui/associated-types/impl-trait-member-type-resolution-57399.rs @@ -0,0 +1,22 @@ +// https://github.com/rust-lang/rust/issues/57399 +//@ check-pass + +trait T { + type T; +} + +impl T for i32 { + type T = u32; +} + +struct S { + a: A, +} + +impl From for S<::T> { + fn from(a: u32) -> Self { + Self { a } + } +} + +fn main() {} diff --git a/tests/ui/binop/function-comparison-errors-59488.rs b/tests/ui/binop/function-comparison-errors-59488.rs new file mode 100644 index 00000000000..8ded781ef95 --- /dev/null +++ b/tests/ui/binop/function-comparison-errors-59488.rs @@ -0,0 +1,35 @@ +// https://github.com/rust-lang/rust/issues/59488 +fn foo() -> i32 { + 42 +} + +fn bar(a: i64) -> i64 { + 43 +} + +enum Foo { + Bar(usize), +} + +fn main() { + foo > 12; + //~^ ERROR binary operation `>` cannot be applied to type `fn() -> i32 {foo}` [E0369] + //~| ERROR mismatched types [E0308] + + bar > 13; + //~^ ERROR binary operation `>` cannot be applied to type `fn(i64) -> i64 {bar}` [E0369] + //~| ERROR mismatched types [E0308] + + foo > foo; + //~^ ERROR binary operation `>` cannot be applied to type `fn() -> i32 {foo}` [E0369] + + foo > bar; + //~^ ERROR binary operation `>` cannot be applied to type `fn() -> i32 {foo}` [E0369] + //~| ERROR mismatched types [E0308] + + let i = Foo::Bar; + assert_eq!(Foo::Bar, i); + //~^ ERROR binary operation `==` cannot be applied to type `fn(usize) -> Foo {Foo::Bar}` [E0369] + //~| ERROR `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug` [E0277] + //~| ERROR `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug` [E0277] +} diff --git a/tests/ui/binop/function-comparison-errors-59488.stderr b/tests/ui/binop/function-comparison-errors-59488.stderr new file mode 100644 index 00000000000..615458bc45b --- /dev/null +++ b/tests/ui/binop/function-comparison-errors-59488.stderr @@ -0,0 +1,105 @@ +error[E0369]: binary operation `>` cannot be applied to type `fn() -> i32 {foo}` + --> $DIR/function-comparison-errors-59488.rs:15:9 + | +LL | foo > 12; + | --- ^ -- {integer} + | | + | fn() -> i32 {foo} + | +help: use parentheses to call this function + | +LL | foo() > 12; + | ++ + +error[E0308]: mismatched types + --> $DIR/function-comparison-errors-59488.rs:15:11 + | +LL | foo > 12; + | ^^ expected fn item, found `i32` + | + = note: expected fn item `fn() -> i32 {foo}` + found type `i32` + +error[E0369]: binary operation `>` cannot be applied to type `fn(i64) -> i64 {bar}` + --> $DIR/function-comparison-errors-59488.rs:19:9 + | +LL | bar > 13; + | --- ^ -- {integer} + | | + | fn(i64) -> i64 {bar} + | +help: use parentheses to call this function + | +LL | bar(/* i64 */) > 13; + | +++++++++++ + +error[E0308]: mismatched types + --> $DIR/function-comparison-errors-59488.rs:19:11 + | +LL | bar > 13; + | ^^ expected fn item, found `i64` + | + = note: expected fn item `fn(i64) -> i64 {bar}` + found type `i64` + +error[E0369]: binary operation `>` cannot be applied to type `fn() -> i32 {foo}` + --> $DIR/function-comparison-errors-59488.rs:23:9 + | +LL | foo > foo; + | --- ^ --- fn() -> i32 {foo} + | | + | fn() -> i32 {foo} + | +help: use parentheses to call these + | +LL | foo() > foo(); + | ++ ++ + +error[E0369]: binary operation `>` cannot be applied to type `fn() -> i32 {foo}` + --> $DIR/function-comparison-errors-59488.rs:26:9 + | +LL | foo > bar; + | --- ^ --- fn(i64) -> i64 {bar} + | | + | fn() -> i32 {foo} + +error[E0308]: mismatched types + --> $DIR/function-comparison-errors-59488.rs:26:11 + | +LL | foo > bar; + | ^^^ expected fn item, found a different fn item + | + = note: expected fn item `fn() -> i32 {foo}` + found fn item `fn(i64) -> i64 {bar}` + +error[E0369]: binary operation `==` cannot be applied to type `fn(usize) -> Foo {Foo::Bar}` + --> $DIR/function-comparison-errors-59488.rs:31:5 + | +LL | assert_eq!(Foo::Bar, i); + | ^^^^^^^^^^^^^^^^^^^^^^^ + | | + | fn(usize) -> Foo {Foo::Bar} + | fn(usize) -> Foo {Foo::Bar} + | + = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug` + --> $DIR/function-comparison-errors-59488.rs:31:5 + | +LL | assert_eq!(Foo::Bar, i); + | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for fn item `fn(usize) -> Foo {Foo::Bar}` + | + = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug` + --> $DIR/function-comparison-errors-59488.rs:31:5 + | +LL | assert_eq!(Foo::Bar, i); + | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for fn item `fn(usize) -> Foo {Foo::Bar}` + | + = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 10 previous errors + +Some errors have detailed explanations: E0277, E0308, E0369. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/box/boxed-value-matching-57741.rs b/tests/ui/box/boxed-value-matching-57741.rs new file mode 100644 index 00000000000..7e2f089dad8 --- /dev/null +++ b/tests/ui/box/boxed-value-matching-57741.rs @@ -0,0 +1,19 @@ +// https://github.com/rust-lang/rust/issues/57741 +#![allow(warnings)] + +// This tests that the `help: consider dereferencing the boxed value` suggestion isn't made +// because the box doesn't deref to the type of the arm. + +enum S { + A { a: usize }, + B { b: usize }, +} + +fn main() { + let x = Box::new(3u32); + let y = match x { + S::A { a } | S::B { b: a } => a, + //~^ ERROR mismatched types [E0308] + //~^^ ERROR mismatched types [E0308] + }; +} diff --git a/tests/ui/box/boxed-value-matching-57741.stderr b/tests/ui/box/boxed-value-matching-57741.stderr new file mode 100644 index 00000000000..33d7a6759ad --- /dev/null +++ b/tests/ui/box/boxed-value-matching-57741.stderr @@ -0,0 +1,25 @@ +error[E0308]: mismatched types + --> $DIR/boxed-value-matching-57741.rs:15:9 + | +LL | let y = match x { + | - this expression has type `Box` +LL | S::A { a } | S::B { b: a } => a, + | ^^^^^^^^^^ expected `Box`, found `S` + | + = note: expected struct `Box` + found enum `S` + +error[E0308]: mismatched types + --> $DIR/boxed-value-matching-57741.rs:15:22 + | +LL | let y = match x { + | - this expression has type `Box` +LL | S::A { a } | S::B { b: a } => a, + | ^^^^^^^^^^^^^ expected `Box`, found `S` + | + = note: expected struct `Box` + found enum `S` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/box/dereferencing-boxed-enum-in-match-57741.fixed b/tests/ui/box/dereferencing-boxed-enum-in-match-57741.fixed new file mode 100644 index 00000000000..ee796b56272 --- /dev/null +++ b/tests/ui/box/dereferencing-boxed-enum-in-match-57741.fixed @@ -0,0 +1,32 @@ +// https://github.com/rust-lang/rust/issues/57741 +//@ run-rustfix + +#![allow(warnings)] + +// This tests that the `help: consider dereferencing the boxed value` suggestion is made and works. + +enum S { + A { a: usize }, + B { b: usize }, +} + +enum T { + A(usize), + B(usize), +} + +fn main() { + let x = Box::new(T::A(3)); + let y = match *x { + T::A(a) | T::B(a) => a, + //~^ ERROR mismatched types [E0308] + //~^^ ERROR mismatched types [E0308] + }; + + let x = Box::new(S::A { a: 3 }); + let y = match *x { + S::A { a } | S::B { b: a } => a, + //~^ ERROR mismatched types [E0308] + //~^^ ERROR mismatched types [E0308] + }; +} diff --git a/tests/ui/box/dereferencing-boxed-enum-in-match-57741.rs b/tests/ui/box/dereferencing-boxed-enum-in-match-57741.rs new file mode 100644 index 00000000000..3a45a8b56ff --- /dev/null +++ b/tests/ui/box/dereferencing-boxed-enum-in-match-57741.rs @@ -0,0 +1,32 @@ +// https://github.com/rust-lang/rust/issues/57741 +//@ run-rustfix + +#![allow(warnings)] + +// This tests that the `help: consider dereferencing the boxed value` suggestion is made and works. + +enum S { + A { a: usize }, + B { b: usize }, +} + +enum T { + A(usize), + B(usize), +} + +fn main() { + let x = Box::new(T::A(3)); + let y = match x { + T::A(a) | T::B(a) => a, + //~^ ERROR mismatched types [E0308] + //~^^ ERROR mismatched types [E0308] + }; + + let x = Box::new(S::A { a: 3 }); + let y = match x { + S::A { a } | S::B { b: a } => a, + //~^ ERROR mismatched types [E0308] + //~^^ ERROR mismatched types [E0308] + }; +} diff --git a/tests/ui/box/dereferencing-boxed-enum-in-match-57741.stderr b/tests/ui/box/dereferencing-boxed-enum-in-match-57741.stderr new file mode 100644 index 00000000000..c07387b21bd --- /dev/null +++ b/tests/ui/box/dereferencing-boxed-enum-in-match-57741.stderr @@ -0,0 +1,63 @@ +error[E0308]: mismatched types + --> $DIR/dereferencing-boxed-enum-in-match-57741.rs:21:9 + | +LL | let y = match x { + | - this expression has type `Box` +LL | T::A(a) | T::B(a) => a, + | ^^^^^^^ expected `Box`, found `T` + | + = note: expected struct `Box` + found enum `T` +help: consider dereferencing the boxed value + | +LL | let y = match *x { + | + + +error[E0308]: mismatched types + --> $DIR/dereferencing-boxed-enum-in-match-57741.rs:21:19 + | +LL | let y = match x { + | - this expression has type `Box` +LL | T::A(a) | T::B(a) => a, + | ^^^^^^^ expected `Box`, found `T` + | + = note: expected struct `Box` + found enum `T` +help: consider dereferencing the boxed value + | +LL | let y = match *x { + | + + +error[E0308]: mismatched types + --> $DIR/dereferencing-boxed-enum-in-match-57741.rs:28:9 + | +LL | let y = match x { + | - this expression has type `Box` +LL | S::A { a } | S::B { b: a } => a, + | ^^^^^^^^^^ expected `Box`, found `S` + | + = note: expected struct `Box` + found enum `S` +help: consider dereferencing the boxed value + | +LL | let y = match *x { + | + + +error[E0308]: mismatched types + --> $DIR/dereferencing-boxed-enum-in-match-57741.rs:28:22 + | +LL | let y = match x { + | - this expression has type `Box` +LL | S::A { a } | S::B { b: a } => a, + | ^^^^^^^^^^^^^ expected `Box`, found `S` + | + = note: expected struct `Box` + found enum `S` +help: consider dereferencing the boxed value + | +LL | let y = match *x { + | + + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/closures/generic-typed-nested-closures-59494.rs b/tests/ui/closures/generic-typed-nested-closures-59494.rs new file mode 100644 index 00000000000..04d7b00ff7f --- /dev/null +++ b/tests/ui/closures/generic-typed-nested-closures-59494.rs @@ -0,0 +1,24 @@ +// https://github.com/rust-lang/rust/issues/59494 +fn t7p(f: impl Fn(B) -> C, g: impl Fn(A) -> B) -> impl Fn(A) -> C { + move |a: A| -> C { f(g(a)) } +} + +fn t8n(f: impl Fn(A) -> B, g: impl Fn(A) -> C) -> impl Fn(A) -> (B, C) +where + A: Copy, +{ + move |a: A| -> (B, C) { + let b = a; + let fa = f(a); + let ga = g(b); + (fa, ga) + } +} + +fn main() { + let f = |(_, _)| {}; + let g = |(a, _)| a; + let t7 = |env| |a| |b| t7p(f, g)(((env, a), b)); + //~^ ERROR mismatched types + let t8 = t8n(t7, t7p(f, g)); +} diff --git a/tests/ui/closures/generic-typed-nested-closures-59494.stderr b/tests/ui/closures/generic-typed-nested-closures-59494.stderr new file mode 100644 index 00000000000..9706fea82a3 --- /dev/null +++ b/tests/ui/closures/generic-typed-nested-closures-59494.stderr @@ -0,0 +1,9 @@ +error[E0308]: mismatched types + --> $DIR/generic-typed-nested-closures-59494.rs:21:40 + | +LL | let t7 = |env| |a| |b| t7p(f, g)(((env, a), b)); + | ^^^ cyclic type of infinite size + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/codegen/mono-item-collector-default-impl-58375.rs b/tests/ui/codegen/mono-item-collector-default-impl-58375.rs new file mode 100644 index 00000000000..f00e79e0dc5 --- /dev/null +++ b/tests/ui/codegen/mono-item-collector-default-impl-58375.rs @@ -0,0 +1,25 @@ +// https://github.com/rust-lang/rust/issues/58375 +// Make sure that the mono-item collector does not crash when trying to +// instantiate a default impl for DecodeUtf16<::Item> +// See https://github.com/rust-lang/rust/issues/58375 + +//@ build-pass +//@ compile-flags:-C link-dead-code + +#![crate_type = "rlib"] + +pub struct DecodeUtf16(I); + +pub trait Arbitrary { + fn arbitrary() {} +} + +pub trait A { + type Item; +} + +impl A for u8 { + type Item = char; +} + +impl Arbitrary for DecodeUtf16<::Item> {} diff --git a/tests/ui/coherence/trait-implementation-coherence-check-57162.rs b/tests/ui/coherence/trait-implementation-coherence-check-57162.rs new file mode 100644 index 00000000000..a57e827ca8b --- /dev/null +++ b/tests/ui/coherence/trait-implementation-coherence-check-57162.rs @@ -0,0 +1,8 @@ +// https://github.com/rust-lang/rust/issues/57162 +//@ check-pass + +trait Foo {} +impl Foo for dyn Send {} + +impl Foo for T {} +fn main() {} diff --git a/tests/ui/consts/oncecell-const-init-57781.rs b/tests/ui/consts/oncecell-const-init-57781.rs new file mode 100644 index 00000000000..27426ef2549 --- /dev/null +++ b/tests/ui/consts/oncecell-const-init-57781.rs @@ -0,0 +1,21 @@ +// https://github.com/rust-lang/rust/issues/57781 +//@ run-pass + +use std::cell::UnsafeCell; +use std::collections::HashMap; + +struct OnceCell { + _value: UnsafeCell>, +} + +impl OnceCell { + const INIT: OnceCell = OnceCell { + _value: UnsafeCell::new(None), + }; +} + +pub fn crash() { + let _ = OnceCell::>::INIT; +} + +fn main() {} diff --git a/tests/ui/debuginfo/impl-copy-function-debuginfo-58463.rs b/tests/ui/debuginfo/impl-copy-function-debuginfo-58463.rs new file mode 100644 index 00000000000..72388c36ce4 --- /dev/null +++ b/tests/ui/debuginfo/impl-copy-function-debuginfo-58463.rs @@ -0,0 +1,10 @@ +// https://github.com/rust-lang/rust/issues/58463 +//@ run-pass +//@ compile-flags:-C debuginfo=2 + +fn foo() -> impl Copy { + foo +} +fn main() { + foo(); +} diff --git a/tests/ui/dyn-compatibility/spurious-dyn-compat-errors-58734.rs b/tests/ui/dyn-compatibility/spurious-dyn-compat-errors-58734.rs new file mode 100644 index 00000000000..3e9ebb497a2 --- /dev/null +++ b/tests/ui/dyn-compatibility/spurious-dyn-compat-errors-58734.rs @@ -0,0 +1,25 @@ +// https://github.com/rust-lang/rust/issues/58734 +trait Trait { + fn exists(self) -> (); + + fn dyn_incompatible() -> Self; +} + +impl Trait for () { + fn exists(self) -> () { + } + + fn dyn_incompatible() -> Self { + () + } +} + +fn main() { + // dyn-compatible or not, this call is OK + Trait::exists(()); + // no dyn-compatibility error + Trait::nonexistent(()); + //~^ WARN trait objects without an explicit `dyn` are deprecated + //~| WARN this is accepted in the current edition + //~| ERROR the trait `Trait` is not dyn compatible +} diff --git a/tests/ui/dyn-compatibility/spurious-dyn-compat-errors-58734.stderr b/tests/ui/dyn-compatibility/spurious-dyn-compat-errors-58734.stderr new file mode 100644 index 00000000000..140461283f3 --- /dev/null +++ b/tests/ui/dyn-compatibility/spurious-dyn-compat-errors-58734.stderr @@ -0,0 +1,42 @@ +warning: trait objects without an explicit `dyn` are deprecated + --> $DIR/spurious-dyn-compat-errors-58734.rs:21:5 + | +LL | Trait::nonexistent(()); + | ^^^^^ + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see + = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default +help: if this is a dyn-compatible trait, use `dyn` + | +LL | ::nonexistent(()); + | ++++ + + +error[E0038]: the trait `Trait` is not dyn compatible + --> $DIR/spurious-dyn-compat-errors-58734.rs:21:5 + | +LL | Trait::nonexistent(()); + | ^^^^^ `Trait` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit + --> $DIR/spurious-dyn-compat-errors-58734.rs:5:8 + | +LL | trait Trait { + | ----- this trait is not dyn compatible... +... +LL | fn dyn_incompatible() -> Self; + | ^^^^^^^^^^^^^^^^ ...because associated function `dyn_incompatible` has no `self` parameter + = help: only type `()` implements `Trait`; consider using it directly instead. +help: consider turning `dyn_incompatible` into a method by giving it a `&self` argument + | +LL | fn dyn_incompatible(&self) -> Self; + | +++++ +help: alternatively, consider constraining `dyn_incompatible` so it does not apply to trait objects + | +LL | fn dyn_incompatible() -> Self where Self: Sized; + | +++++++++++++++++ + +error: aborting due to 1 previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/generics/generic-associated-type-deref-target-56237.rs b/tests/ui/generics/generic-associated-type-deref-target-56237.rs new file mode 100644 index 00000000000..2050ca377e8 --- /dev/null +++ b/tests/ui/generics/generic-associated-type-deref-target-56237.rs @@ -0,0 +1,14 @@ +// https://github.com/rust-lang/rust/issues/56237 +//@ run-pass + +use std::ops::Deref; + +fn foo

(_value:

::Target) +where + P: Deref, +

::Target: Sized, +{} + +fn main() { + foo::>(2); +} diff --git a/tests/ui/higher-ranked/hrtb-associated-type-leak-check-55731.rs b/tests/ui/higher-ranked/hrtb-associated-type-leak-check-55731.rs new file mode 100644 index 00000000000..978abd9fcf5 --- /dev/null +++ b/tests/ui/higher-ranked/hrtb-associated-type-leak-check-55731.rs @@ -0,0 +1,53 @@ +// https://github.com/rust-lang/rust/issues/55731 +use std::marker::PhantomData; + +trait DistributedIterator { + fn reduce(self) + where + Self: Sized, + { + unreachable!() + } +} + +trait DistributedIteratorMulti { + type Item; +} + +struct Connect(PhantomData); +impl DistributedIteratorMulti<&'a ()>> DistributedIterator for Connect where {} + +struct Cloned(PhantomData); +impl<'a, Source> DistributedIteratorMulti<&'a Source> for Cloned<&'a Source> { + type Item = (); +} + +struct Map { + i: I, + f: F, +} +impl, F, Source> DistributedIteratorMulti for Map +where + F: A<>::Item>, +{ + type Item = (); +} + +trait A {} + +struct X; +impl A<()> for X {} + +fn multi(_reducer: I) +where + I: for<'a> DistributedIteratorMulti<&'a ()>, +{ + DistributedIterator::reduce(Connect::(PhantomData)) +} + +fn main() { + multi(Map { //~ ERROR implementation of `DistributedIteratorMulti` is not general enough + i: Cloned(PhantomData), + f: X, + }); +} diff --git a/tests/ui/higher-ranked/hrtb-associated-type-leak-check-55731.stderr b/tests/ui/higher-ranked/hrtb-associated-type-leak-check-55731.stderr new file mode 100644 index 00000000000..40ac1d9d041 --- /dev/null +++ b/tests/ui/higher-ranked/hrtb-associated-type-leak-check-55731.stderr @@ -0,0 +1,14 @@ +error: implementation of `DistributedIteratorMulti` is not general enough + --> $DIR/hrtb-associated-type-leak-check-55731.rs:49:5 + | +LL | / multi(Map { +LL | | i: Cloned(PhantomData), +LL | | f: X, +LL | | }); + | |______^ implementation of `DistributedIteratorMulti` is not general enough + | + = note: `DistributedIteratorMulti<&'0 ()>` would have to be implemented for the type `Cloned<&()>`, for any lifetime `'0`... + = note: ...but `DistributedIteratorMulti<&'1 ()>` is actually implemented for the type `Cloned<&'1 ()>`, for some specific lifetime `'1` + +error: aborting due to 1 previous error + diff --git a/tests/ui/imports/auxiliary/reexported-trait-56175.rs b/tests/ui/imports/auxiliary/reexported-trait-56175.rs new file mode 100644 index 00000000000..51a991bef59 --- /dev/null +++ b/tests/ui/imports/auxiliary/reexported-trait-56175.rs @@ -0,0 +1,17 @@ +mod private { + pub trait Trait { + fn trait_method(&self) { + } + } + pub trait TraitB { + fn trait_method_b(&self) { + } + } +} + +pub struct FooStruct; +pub use crate::private::Trait; +impl crate::private::Trait for FooStruct {} + +pub use crate::private::TraitB as TraitBRename; +impl crate::private::TraitB for FooStruct {} diff --git a/tests/ui/imports/private-types-suggested-without-extern-crate-56175.rs b/tests/ui/imports/private-types-suggested-without-extern-crate-56175.rs new file mode 100644 index 00000000000..ce001edad1b --- /dev/null +++ b/tests/ui/imports/private-types-suggested-without-extern-crate-56175.rs @@ -0,0 +1,10 @@ +// https://github.com/rust-lang/rust/issues/56175 +//@ edition:2018 +//@ aux-crate:reexported_trait=reexported-trait-56175.rs + +fn main() { + reexported_trait::FooStruct.trait_method(); + //~^ ERROR + reexported_trait::FooStruct.trait_method_b(); + //~^ ERROR +} diff --git a/tests/ui/imports/private-types-suggested-without-extern-crate-56175.stderr b/tests/ui/imports/private-types-suggested-without-extern-crate-56175.stderr new file mode 100644 index 00000000000..1e8285c80ac --- /dev/null +++ b/tests/ui/imports/private-types-suggested-without-extern-crate-56175.stderr @@ -0,0 +1,46 @@ +error[E0599]: no method named `trait_method` found for struct `FooStruct` in the current scope + --> $DIR/private-types-suggested-without-extern-crate-56175.rs:6:33 + | +LL | reexported_trait::FooStruct.trait_method(); + | ^^^^^^^^^^^^ + | + ::: $DIR/auxiliary/reexported-trait-56175.rs:3:12 + | +LL | fn trait_method(&self) { + | ------------ the method is available for `FooStruct` here + | + = help: items from traits can only be used if the trait is in scope +help: trait `Trait` which provides `trait_method` is implemented but not in scope; perhaps you want to import it + | +LL + use reexported_trait_56175::Trait; + | +help: there is a method `trait_method_b` with a similar name + | +LL | reexported_trait::FooStruct.trait_method_b(); + | ++ + +error[E0599]: no method named `trait_method_b` found for struct `FooStruct` in the current scope + --> $DIR/private-types-suggested-without-extern-crate-56175.rs:8:33 + | +LL | reexported_trait::FooStruct.trait_method_b(); + | ^^^^^^^^^^^^^^ + | + ::: $DIR/auxiliary/reexported-trait-56175.rs:7:12 + | +LL | fn trait_method_b(&self) { + | -------------- the method is available for `FooStruct` here + | + = help: items from traits can only be used if the trait is in scope +help: trait `TraitB` which provides `trait_method_b` is implemented but not in scope; perhaps you want to import it + | +LL + use reexported_trait_56175::TraitBRename; + | +help: there is a method `trait_method` with a similar name + | +LL - reexported_trait::FooStruct.trait_method_b(); +LL + reexported_trait::FooStruct.trait_method(); + | + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/infinite/auxiliary/aux-57271-lib.rs b/tests/ui/infinite/auxiliary/aux-57271-lib.rs new file mode 100644 index 00000000000..ff625668a9d --- /dev/null +++ b/tests/ui/infinite/auxiliary/aux-57271-lib.rs @@ -0,0 +1,11 @@ +#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)] +pub enum BaseType { + Byte, + Char, + Double, + Float, + Int, + Long, + Short, + Boolean, +} diff --git a/tests/ui/infinite/mutually-recursive-infinite-types-57271.rs b/tests/ui/infinite/mutually-recursive-infinite-types-57271.rs new file mode 100644 index 00000000000..cb20770b486 --- /dev/null +++ b/tests/ui/infinite/mutually-recursive-infinite-types-57271.rs @@ -0,0 +1,25 @@ +// https://github.com/rust-lang/rust/issues/57271 +//@ aux-build:aux-57271-lib.rs + +extern crate aux_57271_lib; + +use aux_57271_lib::BaseType; + +pub enum ObjectType { //~ ERROR recursive types `ObjectType` and `TypeSignature` have infinite size + Class(ClassTypeSignature), + Array(TypeSignature), + TypeVariable(()), +} + +pub struct ClassTypeSignature { + pub package: (), + pub class: (), + pub inner: (), +} + +pub enum TypeSignature { + Base(BaseType), + Object(ObjectType), +} + +fn main() {} diff --git a/tests/ui/infinite/mutually-recursive-infinite-types-57271.stderr b/tests/ui/infinite/mutually-recursive-infinite-types-57271.stderr new file mode 100644 index 00000000000..8bf1b470062 --- /dev/null +++ b/tests/ui/infinite/mutually-recursive-infinite-types-57271.stderr @@ -0,0 +1,27 @@ +error[E0072]: recursive types `ObjectType` and `TypeSignature` have infinite size + --> $DIR/mutually-recursive-infinite-types-57271.rs:8:1 + | +LL | pub enum ObjectType { + | ^^^^^^^^^^^^^^^^^^^ +LL | Class(ClassTypeSignature), +LL | Array(TypeSignature), + | ------------- recursive without indirection +... +LL | pub enum TypeSignature { + | ^^^^^^^^^^^^^^^^^^^^^^ +LL | Base(BaseType), +LL | Object(ObjectType), + | ---------- recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle + | +LL ~ Array(Box), +LL | TypeVariable(()), +... +LL | Base(BaseType), +LL ~ Object(Box), + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0072`. diff --git a/tests/ui/issues/auxiliary/issue-56943.rs b/tests/ui/issues/auxiliary/issue-56943.rs deleted file mode 100644 index 65b9beb91f9..00000000000 --- a/tests/ui/issues/auxiliary/issue-56943.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub struct S; -mod m { pub struct S; } -pub use crate::m::S as S2; diff --git a/tests/ui/issues/auxiliary/issue-57271-lib.rs b/tests/ui/issues/auxiliary/issue-57271-lib.rs deleted file mode 100644 index ff625668a9d..00000000000 --- a/tests/ui/issues/auxiliary/issue-57271-lib.rs +++ /dev/null @@ -1,11 +0,0 @@ -#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)] -pub enum BaseType { - Byte, - Char, - Double, - Float, - Int, - Long, - Short, - Boolean, -} diff --git a/tests/ui/issues/issue-55587.rs b/tests/ui/issues/issue-55587.rs deleted file mode 100644 index d9100cf555b..00000000000 --- a/tests/ui/issues/issue-55587.rs +++ /dev/null @@ -1,5 +0,0 @@ -use std::path::Path; - -fn main() { - let Path::new(); //~ ERROR expected tuple struct or tuple variant -} diff --git a/tests/ui/issues/issue-55587.stderr b/tests/ui/issues/issue-55587.stderr deleted file mode 100644 index 7a5d0e28100..00000000000 --- a/tests/ui/issues/issue-55587.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0164]: expected tuple struct or tuple variant, found associated function `Path::new` - --> $DIR/issue-55587.rs:4:9 - | -LL | let Path::new(); - | ^^^^^^^^^^^ `fn` calls are not allowed in patterns - | - = help: for more information, visit https://doc.rust-lang.org/book/ch19-00-patterns.html - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0164`. diff --git a/tests/ui/issues/issue-55731.rs b/tests/ui/issues/issue-55731.rs deleted file mode 100644 index 7b4f4e2cd3b..00000000000 --- a/tests/ui/issues/issue-55731.rs +++ /dev/null @@ -1,52 +0,0 @@ -use std::marker::PhantomData; - -trait DistributedIterator { - fn reduce(self) - where - Self: Sized, - { - unreachable!() - } -} - -trait DistributedIteratorMulti { - type Item; -} - -struct Connect(PhantomData); -impl DistributedIteratorMulti<&'a ()>> DistributedIterator for Connect where {} - -struct Cloned(PhantomData); -impl<'a, Source> DistributedIteratorMulti<&'a Source> for Cloned<&'a Source> { - type Item = (); -} - -struct Map { - i: I, - f: F, -} -impl, F, Source> DistributedIteratorMulti for Map -where - F: A<>::Item>, -{ - type Item = (); -} - -trait A {} - -struct X; -impl A<()> for X {} - -fn multi(_reducer: I) -where - I: for<'a> DistributedIteratorMulti<&'a ()>, -{ - DistributedIterator::reduce(Connect::(PhantomData)) -} - -fn main() { - multi(Map { //~ ERROR implementation of `DistributedIteratorMulti` is not general enough - i: Cloned(PhantomData), - f: X, - }); -} diff --git a/tests/ui/issues/issue-55731.stderr b/tests/ui/issues/issue-55731.stderr deleted file mode 100644 index 2c38041642d..00000000000 --- a/tests/ui/issues/issue-55731.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: implementation of `DistributedIteratorMulti` is not general enough - --> $DIR/issue-55731.rs:48:5 - | -LL | / multi(Map { -LL | | i: Cloned(PhantomData), -LL | | f: X, -LL | | }); - | |______^ implementation of `DistributedIteratorMulti` is not general enough - | - = note: `DistributedIteratorMulti<&'0 ()>` would have to be implemented for the type `Cloned<&()>`, for any lifetime `'0`... - = note: ...but `DistributedIteratorMulti<&'1 ()>` is actually implemented for the type `Cloned<&'1 ()>`, for some specific lifetime `'1` - -error: aborting due to 1 previous error - diff --git a/tests/ui/issues/issue-56128.rs b/tests/ui/issues/issue-56128.rs deleted file mode 100644 index cc170f60250..00000000000 --- a/tests/ui/issues/issue-56128.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Regression test for #56128. When this `pub(super) use...` gets -// exploded in the HIR, we were not handling ids correctly. -// -//@ check-pass - -mod bar { - pub(super) use self::baz::{x, y}; - - mod baz { - pub fn x() { } - pub fn y() { } - } -} - -fn main() { } diff --git a/tests/ui/issues/issue-56175.rs b/tests/ui/issues/issue-56175.rs deleted file mode 100644 index daffe806a90..00000000000 --- a/tests/ui/issues/issue-56175.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ edition:2018 -//@ aux-crate:reexported_trait=reexported-trait.rs - -fn main() { - reexported_trait::FooStruct.trait_method(); - //~^ ERROR - reexported_trait::FooStruct.trait_method_b(); - //~^ ERROR -} diff --git a/tests/ui/issues/issue-56175.stderr b/tests/ui/issues/issue-56175.stderr deleted file mode 100644 index df4cd6ce8a7..00000000000 --- a/tests/ui/issues/issue-56175.stderr +++ /dev/null @@ -1,46 +0,0 @@ -error[E0599]: no method named `trait_method` found for struct `FooStruct` in the current scope - --> $DIR/issue-56175.rs:5:33 - | -LL | reexported_trait::FooStruct.trait_method(); - | ^^^^^^^^^^^^ - | - ::: $DIR/auxiliary/reexported-trait.rs:3:12 - | -LL | fn trait_method(&self) { - | ------------ the method is available for `FooStruct` here - | - = help: items from traits can only be used if the trait is in scope -help: trait `Trait` which provides `trait_method` is implemented but not in scope; perhaps you want to import it - | -LL + use reexported_trait::Trait; - | -help: there is a method `trait_method_b` with a similar name - | -LL | reexported_trait::FooStruct.trait_method_b(); - | ++ - -error[E0599]: no method named `trait_method_b` found for struct `FooStruct` in the current scope - --> $DIR/issue-56175.rs:7:33 - | -LL | reexported_trait::FooStruct.trait_method_b(); - | ^^^^^^^^^^^^^^ - | - ::: $DIR/auxiliary/reexported-trait.rs:7:12 - | -LL | fn trait_method_b(&self) { - | -------------- the method is available for `FooStruct` here - | - = help: items from traits can only be used if the trait is in scope -help: trait `TraitB` which provides `trait_method_b` is implemented but not in scope; perhaps you want to import it - | -LL + use reexported_trait::TraitBRename; - | -help: there is a method `trait_method` with a similar name - | -LL - reexported_trait::FooStruct.trait_method_b(); -LL + reexported_trait::FooStruct.trait_method(); - | - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-56199.rs b/tests/ui/issues/issue-56199.rs deleted file mode 100644 index ba11582a9d5..00000000000 --- a/tests/ui/issues/issue-56199.rs +++ /dev/null @@ -1,22 +0,0 @@ -enum Foo {} -struct Bar {} - -impl Foo { - fn foo() { - let _ = Self; - //~^ ERROR the `Self` constructor can only be used with tuple or unit structs - let _ = Self(); - //~^ ERROR the `Self` constructor can only be used with tuple or unit structs - } -} - -impl Bar { - fn bar() { - let _ = Self; - //~^ ERROR the `Self` constructor can only be used with tuple or unit structs - let _ = Self(); - //~^ ERROR the `Self` constructor can only be used with tuple or unit structs - } -} - -fn main() {} diff --git a/tests/ui/issues/issue-56199.stderr b/tests/ui/issues/issue-56199.stderr deleted file mode 100644 index eb6d7005979..00000000000 --- a/tests/ui/issues/issue-56199.stderr +++ /dev/null @@ -1,30 +0,0 @@ -error: the `Self` constructor can only be used with tuple or unit structs - --> $DIR/issue-56199.rs:6:17 - | -LL | let _ = Self; - | ^^^^ - | - = help: did you mean to use one of the enum's variants? - -error: the `Self` constructor can only be used with tuple or unit structs - --> $DIR/issue-56199.rs:8:17 - | -LL | let _ = Self(); - | ^^^^^^ - | - = help: did you mean to use one of the enum's variants? - -error: the `Self` constructor can only be used with tuple or unit structs - --> $DIR/issue-56199.rs:15:17 - | -LL | let _ = Self; - | ^^^^ help: use curly brackets: `Self { /* fields */ }` - -error: the `Self` constructor can only be used with tuple or unit structs - --> $DIR/issue-56199.rs:17:17 - | -LL | let _ = Self(); - | ^^^^^^ help: use curly brackets: `Self { /* fields */ }` - -error: aborting due to 4 previous errors - diff --git a/tests/ui/issues/issue-56229.rs b/tests/ui/issues/issue-56229.rs deleted file mode 100644 index 1c6dd72ed2d..00000000000 --- a/tests/ui/issues/issue-56229.rs +++ /dev/null @@ -1,35 +0,0 @@ -//@ check-pass - -trait Mirror { - type Other; -} - -#[derive(Debug)] -struct Even(usize); -struct Odd; - -impl Mirror for Even { - type Other = Odd; -} - -impl Mirror for Odd { - type Other = Even; -} - -trait Dyn: AsRef<::Other> {} - -impl Dyn for Even {} - -impl AsRef for Even { - fn as_ref(&self) -> &Even { - self - } -} - -fn code(d: &dyn Dyn) -> &T::Other { - d.as_ref() -} - -fn main() { - println!("{:?}", code(&Even(22))); -} diff --git a/tests/ui/issues/issue-56237.rs b/tests/ui/issues/issue-56237.rs deleted file mode 100644 index 3c0a235f3ec..00000000000 --- a/tests/ui/issues/issue-56237.rs +++ /dev/null @@ -1,13 +0,0 @@ -//@ run-pass - -use std::ops::Deref; - -fn foo

(_value:

::Target) -where - P: Deref, -

::Target: Sized, -{} - -fn main() { - foo::>(2); -} diff --git a/tests/ui/issues/issue-56806.rs b/tests/ui/issues/issue-56806.rs deleted file mode 100644 index b1dac26d65a..00000000000 --- a/tests/ui/issues/issue-56806.rs +++ /dev/null @@ -1,6 +0,0 @@ -pub trait Trait { - fn dyn_instead_of_self(self: Box); - //~^ ERROR invalid `self` parameter type -} - -pub fn main() {} diff --git a/tests/ui/issues/issue-56806.stderr b/tests/ui/issues/issue-56806.stderr deleted file mode 100644 index ec50d863758..00000000000 --- a/tests/ui/issues/issue-56806.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0307]: invalid `self` parameter type: `Box<(dyn Trait + 'static)>` - --> $DIR/issue-56806.rs:2:34 - | -LL | fn dyn_instead_of_self(self: Box); - | ^^^^^^^^^^^^^^ - | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box`, `self: Rc`, `self: Arc`, or `self: Pin

` (where P is one of the previous types except `Self`) - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0307`. diff --git a/tests/ui/issues/issue-56835.rs b/tests/ui/issues/issue-56835.rs deleted file mode 100644 index 7132d15ee5f..00000000000 --- a/tests/ui/issues/issue-56835.rs +++ /dev/null @@ -1,9 +0,0 @@ -pub struct Foo {} - -impl Foo { - fn bar(Self(foo): Self) {} - //~^ ERROR the `Self` constructor can only be used with tuple or unit structs - //~^^ ERROR expected tuple struct or tuple variant, found self constructor `Self` [E0164] -} - -fn main() {} diff --git a/tests/ui/issues/issue-56835.stderr b/tests/ui/issues/issue-56835.stderr deleted file mode 100644 index e949ae7b324..00000000000 --- a/tests/ui/issues/issue-56835.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error: the `Self` constructor can only be used with tuple or unit structs - --> $DIR/issue-56835.rs:4:12 - | -LL | fn bar(Self(foo): Self) {} - | ^^^^^^^^^ help: use curly brackets: `Self { /* fields */ }` - -error[E0164]: expected tuple struct or tuple variant, found self constructor `Self` - --> $DIR/issue-56835.rs:4:12 - | -LL | fn bar(Self(foo): Self) {} - | ^^^^^^^^^ not a tuple struct or tuple variant - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0164`. diff --git a/tests/ui/issues/issue-56870.rs b/tests/ui/issues/issue-56870.rs deleted file mode 100644 index fc6deedd029..00000000000 --- a/tests/ui/issues/issue-56870.rs +++ /dev/null @@ -1,38 +0,0 @@ -//@ build-pass -// Regression test for #56870: Internal compiler error (traits & associated consts) - -use std::fmt::Debug; - -pub trait Foo { - const FOO: *const u8; -} - -impl Foo for dyn Debug { - const FOO: *const u8 = ::fmt as *const u8; -} - -pub trait Bar { - const BAR: *const u8; -} - -pub trait Baz { - type Data: Debug; -} - -pub struct BarStruct(S); - -impl Bar for BarStruct { - const BAR: *const u8 = ::Data>>::FOO; -} - -struct AnotherStruct; -#[derive(Debug)] -struct SomeStruct; - -impl Baz for AnotherStruct { - type Data = SomeStruct; -} - -fn main() { - let _x = as Bar>::BAR; -} diff --git a/tests/ui/issues/issue-56943.rs b/tests/ui/issues/issue-56943.rs deleted file mode 100644 index 9664567ec9e..00000000000 --- a/tests/ui/issues/issue-56943.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ aux-build:issue-56943.rs - -extern crate issue_56943; - -fn main() { - let _: issue_56943::S = issue_56943::S2; - //~^ ERROR mismatched types [E0308] -} diff --git a/tests/ui/issues/issue-56943.stderr b/tests/ui/issues/issue-56943.stderr deleted file mode 100644 index 60a2e92dc71..00000000000 --- a/tests/ui/issues/issue-56943.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/issue-56943.rs:6:29 - | -LL | let _: issue_56943::S = issue_56943::S2; - | -------------- ^^^^^^^^^^^^^^^ expected `S`, found `S2` - | | - | expected due to this - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-57156.rs b/tests/ui/issues/issue-57156.rs deleted file mode 100644 index 12251509abd..00000000000 --- a/tests/ui/issues/issue-57156.rs +++ /dev/null @@ -1,23 +0,0 @@ -//@ check-pass - -trait Foo { - type Output; -} - -trait Bar<'a, T>: for<'s> Foo<&'s T, Output=bool> { - fn cb(&self) -> Box>; -} - -impl<'s> Foo<&'s ()> for () { - type Output = bool; -} - -impl<'a> Bar<'a, ()> for () { - fn cb(&self) -> Box> { - Box::new(*self) - } -} - -fn main() { - let _t = ().cb(); -} diff --git a/tests/ui/issues/issue-57162.rs b/tests/ui/issues/issue-57162.rs deleted file mode 100644 index 5e62d0eb010..00000000000 --- a/tests/ui/issues/issue-57162.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@ check-pass - -trait Foo {} -impl Foo for dyn Send {} - -impl Foo for T {} -fn main() {} diff --git a/tests/ui/issues/issue-57198-pass.rs b/tests/ui/issues/issue-57198-pass.rs deleted file mode 100644 index 06f30603c31..00000000000 --- a/tests/ui/issues/issue-57198-pass.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ run-pass - -mod m { - pub fn r#for() {} -} - -fn main() { - m::r#for(); -} diff --git a/tests/ui/issues/issue-57271.rs b/tests/ui/issues/issue-57271.rs deleted file mode 100644 index 20d081ecb3c..00000000000 --- a/tests/ui/issues/issue-57271.rs +++ /dev/null @@ -1,24 +0,0 @@ -//@ aux-build:issue-57271-lib.rs - -extern crate issue_57271_lib; - -use issue_57271_lib::BaseType; - -pub enum ObjectType { //~ ERROR recursive types `ObjectType` and `TypeSignature` have infinite size - Class(ClassTypeSignature), - Array(TypeSignature), - TypeVariable(()), -} - -pub struct ClassTypeSignature { - pub package: (), - pub class: (), - pub inner: (), -} - -pub enum TypeSignature { - Base(BaseType), - Object(ObjectType), -} - -fn main() {} diff --git a/tests/ui/issues/issue-57271.stderr b/tests/ui/issues/issue-57271.stderr deleted file mode 100644 index a61419c61d7..00000000000 --- a/tests/ui/issues/issue-57271.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0072]: recursive types `ObjectType` and `TypeSignature` have infinite size - --> $DIR/issue-57271.rs:7:1 - | -LL | pub enum ObjectType { - | ^^^^^^^^^^^^^^^^^^^ -LL | Class(ClassTypeSignature), -LL | Array(TypeSignature), - | ------------- recursive without indirection -... -LL | pub enum TypeSignature { - | ^^^^^^^^^^^^^^^^^^^^^^ -LL | Base(BaseType), -LL | Object(ObjectType), - | ---------- recursive without indirection - | -help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle - | -LL ~ Array(Box), -LL | TypeVariable(()), -... -LL | Base(BaseType), -LL ~ Object(Box), - | - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0072`. diff --git a/tests/ui/issues/issue-57399-self-return-impl-trait.rs b/tests/ui/issues/issue-57399-self-return-impl-trait.rs deleted file mode 100644 index bcf1b18a9ff..00000000000 --- a/tests/ui/issues/issue-57399-self-return-impl-trait.rs +++ /dev/null @@ -1,22 +0,0 @@ -//@ check-pass - -trait T { - type T; -} - -impl T for i32 { - type T = u32; -} - -struct S { - a: A, -} - - -impl From for S<::T> { - fn from(a: u32) -> Self { - Self { a } - } -} - -fn main() {} diff --git a/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741-1.rs b/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741-1.rs deleted file mode 100644 index d0aae23b2fc..00000000000 --- a/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741-1.rs +++ /dev/null @@ -1,18 +0,0 @@ -#![allow(warnings)] - -// This tests that the `help: consider dereferencing the boxed value` suggestion isn't made -// because the box doesn't deref to the type of the arm. - -enum S { - A { a: usize }, - B { b: usize }, -} - -fn main() { - let x = Box::new(3u32); - let y = match x { - S::A { a } | S::B { b: a } => a, - //~^ ERROR mismatched types [E0308] - //~^^ ERROR mismatched types [E0308] - }; -} diff --git a/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741-1.stderr b/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741-1.stderr deleted file mode 100644 index 76f03bab6d1..00000000000 --- a/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741-1.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/issue-57741-1.rs:14:9 - | -LL | let y = match x { - | - this expression has type `Box` -LL | S::A { a } | S::B { b: a } => a, - | ^^^^^^^^^^ expected `Box`, found `S` - | - = note: expected struct `Box` - found enum `S` - -error[E0308]: mismatched types - --> $DIR/issue-57741-1.rs:14:22 - | -LL | let y = match x { - | - this expression has type `Box` -LL | S::A { a } | S::B { b: a } => a, - | ^^^^^^^^^^^^^ expected `Box`, found `S` - | - = note: expected struct `Box` - found enum `S` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.fixed b/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.fixed deleted file mode 100644 index 1823f0d3d4c..00000000000 --- a/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.fixed +++ /dev/null @@ -1,31 +0,0 @@ -//@ run-rustfix - -#![allow(warnings)] - -// This tests that the `help: consider dereferencing the boxed value` suggestion is made and works. - -enum S { - A { a: usize }, - B { b: usize }, -} - -enum T { - A(usize), - B(usize), -} - -fn main() { - let x = Box::new(T::A(3)); - let y = match *x { - T::A(a) | T::B(a) => a, - //~^ ERROR mismatched types [E0308] - //~^^ ERROR mismatched types [E0308] - }; - - let x = Box::new(S::A { a: 3 }); - let y = match *x { - S::A { a } | S::B { b: a } => a, - //~^ ERROR mismatched types [E0308] - //~^^ ERROR mismatched types [E0308] - }; -} diff --git a/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.rs b/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.rs deleted file mode 100644 index 47ab91177e0..00000000000 --- a/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.rs +++ /dev/null @@ -1,31 +0,0 @@ -//@ run-rustfix - -#![allow(warnings)] - -// This tests that the `help: consider dereferencing the boxed value` suggestion is made and works. - -enum S { - A { a: usize }, - B { b: usize }, -} - -enum T { - A(usize), - B(usize), -} - -fn main() { - let x = Box::new(T::A(3)); - let y = match x { - T::A(a) | T::B(a) => a, - //~^ ERROR mismatched types [E0308] - //~^^ ERROR mismatched types [E0308] - }; - - let x = Box::new(S::A { a: 3 }); - let y = match x { - S::A { a } | S::B { b: a } => a, - //~^ ERROR mismatched types [E0308] - //~^^ ERROR mismatched types [E0308] - }; -} diff --git a/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr b/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr deleted file mode 100644 index 62d83a54614..00000000000 --- a/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr +++ /dev/null @@ -1,63 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/issue-57741.rs:20:9 - | -LL | let y = match x { - | - this expression has type `Box` -LL | T::A(a) | T::B(a) => a, - | ^^^^^^^ expected `Box`, found `T` - | - = note: expected struct `Box` - found enum `T` -help: consider dereferencing the boxed value - | -LL | let y = match *x { - | + - -error[E0308]: mismatched types - --> $DIR/issue-57741.rs:20:19 - | -LL | let y = match x { - | - this expression has type `Box` -LL | T::A(a) | T::B(a) => a, - | ^^^^^^^ expected `Box`, found `T` - | - = note: expected struct `Box` - found enum `T` -help: consider dereferencing the boxed value - | -LL | let y = match *x { - | + - -error[E0308]: mismatched types - --> $DIR/issue-57741.rs:27:9 - | -LL | let y = match x { - | - this expression has type `Box` -LL | S::A { a } | S::B { b: a } => a, - | ^^^^^^^^^^ expected `Box`, found `S` - | - = note: expected struct `Box` - found enum `S` -help: consider dereferencing the boxed value - | -LL | let y = match *x { - | + - -error[E0308]: mismatched types - --> $DIR/issue-57741.rs:27:22 - | -LL | let y = match x { - | - this expression has type `Box` -LL | S::A { a } | S::B { b: a } => a, - | ^^^^^^^^^^^^^ expected `Box`, found `S` - | - = note: expected struct `Box` - found enum `S` -help: consider dereferencing the boxed value - | -LL | let y = match *x { - | + - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-57781.rs b/tests/ui/issues/issue-57781.rs deleted file mode 100644 index 7f0d2eda9bb..00000000000 --- a/tests/ui/issues/issue-57781.rs +++ /dev/null @@ -1,20 +0,0 @@ -//@ run-pass - -use std::cell::UnsafeCell; -use std::collections::HashMap; - -struct OnceCell { - _value: UnsafeCell>, -} - -impl OnceCell { - const INIT: OnceCell = OnceCell { - _value: UnsafeCell::new(None), - }; -} - -pub fn crash() { - let _ = OnceCell::>::INIT; -} - -fn main() {} diff --git a/tests/ui/issues/issue-57924.rs b/tests/ui/issues/issue-57924.rs deleted file mode 100644 index 8846912a8ff..00000000000 --- a/tests/ui/issues/issue-57924.rs +++ /dev/null @@ -1,10 +0,0 @@ -pub struct Gcm(E); - -impl Gcm { - pub fn crash(e: E) -> Self { - Self::(e) - //~^ ERROR type arguments are not allowed on self constructor - } -} - -fn main() {} diff --git a/tests/ui/issues/issue-57924.stderr b/tests/ui/issues/issue-57924.stderr deleted file mode 100644 index 40435fd0f0a..00000000000 --- a/tests/ui/issues/issue-57924.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0109]: type arguments are not allowed on self constructor - --> $DIR/issue-57924.rs:5:16 - | -LL | Self::(e) - | ---- ^ type argument not allowed - | | - | not allowed on self constructor - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0109`. diff --git a/tests/ui/issues/issue-58212.rs b/tests/ui/issues/issue-58212.rs deleted file mode 100644 index f266db603bf..00000000000 --- a/tests/ui/issues/issue-58212.rs +++ /dev/null @@ -1,15 +0,0 @@ -//@ check-pass - -trait FromUnchecked { - fn from_unchecked(); -} - -impl FromUnchecked for [u8; 1] { - fn from_unchecked() { - let mut array: Self = [0; 1]; - let _ptr = &mut array as *mut [u8] as *mut u8; - } -} - -fn main() { -} diff --git a/tests/ui/issues/issue-58375-monomorphize-default-impls.rs b/tests/ui/issues/issue-58375-monomorphize-default-impls.rs deleted file mode 100644 index 769a1176edd..00000000000 --- a/tests/ui/issues/issue-58375-monomorphize-default-impls.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Make sure that the mono-item collector does not crash when trying to -// instantiate a default impl for DecodeUtf16<::Item> -// See https://github.com/rust-lang/rust/issues/58375 - -//@ build-pass -//@ compile-flags:-C link-dead-code - -#![crate_type = "rlib"] - -pub struct DecodeUtf16(I); - -pub trait Arbitrary { - fn arbitrary() {} -} - -pub trait A { - type Item; -} - -impl A for u8 { - type Item = char; -} - -impl Arbitrary for DecodeUtf16<::Item> {} diff --git a/tests/ui/issues/issue-58463.rs b/tests/ui/issues/issue-58463.rs deleted file mode 100644 index 6e4b909bc38..00000000000 --- a/tests/ui/issues/issue-58463.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ run-pass -//@ compile-flags:-C debuginfo=2 - -fn foo() -> impl Copy { - foo -} -fn main() { - foo(); -} diff --git a/tests/ui/issues/issue-58712.rs b/tests/ui/issues/issue-58712.rs deleted file mode 100644 index 930bec6889b..00000000000 --- a/tests/ui/issues/issue-58712.rs +++ /dev/null @@ -1,14 +0,0 @@ -struct AddrVec { - h: H, - a: A, -} - -impl AddrVec { - //~^ ERROR cannot find type `DeviceId` in this scope - pub fn device(&self) -> DeviceId { - //~^ ERROR cannot find type `DeviceId` in this scope - self.tail() - } -} - -fn main() {} diff --git a/tests/ui/issues/issue-58712.stderr b/tests/ui/issues/issue-58712.stderr deleted file mode 100644 index f4bd4d1e826..00000000000 --- a/tests/ui/issues/issue-58712.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0412]: cannot find type `DeviceId` in this scope - --> $DIR/issue-58712.rs:6:20 - | -LL | impl AddrVec { - | ^^^^^^^^ not found in this scope - | -help: you might be missing a type parameter - | -LL | impl AddrVec { - | ++++++++++ - -error[E0412]: cannot find type `DeviceId` in this scope - --> $DIR/issue-58712.rs:8:29 - | -LL | pub fn device(&self) -> DeviceId { - | ^^^^^^^^ not found in this scope - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/issues/issue-58734.rs b/tests/ui/issues/issue-58734.rs deleted file mode 100644 index e5b371f5530..00000000000 --- a/tests/ui/issues/issue-58734.rs +++ /dev/null @@ -1,24 +0,0 @@ -trait Trait { - fn exists(self) -> (); - - fn dyn_incompatible() -> Self; -} - -impl Trait for () { - fn exists(self) -> () { - } - - fn dyn_incompatible() -> Self { - () - } -} - -fn main() { - // dyn-compatible or not, this call is OK - Trait::exists(()); - // no dyn-compatibility error - Trait::nonexistent(()); - //~^ WARN trait objects without an explicit `dyn` are deprecated - //~| WARN this is accepted in the current edition - //~| ERROR the trait `Trait` is not dyn compatible -} diff --git a/tests/ui/issues/issue-58734.stderr b/tests/ui/issues/issue-58734.stderr deleted file mode 100644 index 2336a94f150..00000000000 --- a/tests/ui/issues/issue-58734.stderr +++ /dev/null @@ -1,42 +0,0 @@ -warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/issue-58734.rs:20:5 - | -LL | Trait::nonexistent(()); - | ^^^^^ - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see - = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default -help: if this is a dyn-compatible trait, use `dyn` - | -LL | ::nonexistent(()); - | ++++ + - -error[E0038]: the trait `Trait` is not dyn compatible - --> $DIR/issue-58734.rs:20:5 - | -LL | Trait::nonexistent(()); - | ^^^^^ `Trait` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit - --> $DIR/issue-58734.rs:4:8 - | -LL | trait Trait { - | ----- this trait is not dyn compatible... -... -LL | fn dyn_incompatible() -> Self; - | ^^^^^^^^^^^^^^^^ ...because associated function `dyn_incompatible` has no `self` parameter - = help: only type `()` implements `Trait`; consider using it directly instead. -help: consider turning `dyn_incompatible` into a method by giving it a `&self` argument - | -LL | fn dyn_incompatible(&self) -> Self; - | +++++ -help: alternatively, consider constraining `dyn_incompatible` so it does not apply to trait objects - | -LL | fn dyn_incompatible() -> Self where Self: Sized; - | +++++++++++++++++ - -error: aborting due to 1 previous error; 1 warning emitted - -For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/issues/issue-58857.rs b/tests/ui/issues/issue-58857.rs deleted file mode 100644 index 4350d7e5b40..00000000000 --- a/tests/ui/issues/issue-58857.rs +++ /dev/null @@ -1,7 +0,0 @@ -struct Conj {a : A} -trait Valid {} - -impl Conj{} -//~^ ERROR negative bounds are not supported - -fn main() {} diff --git a/tests/ui/issues/issue-58857.stderr b/tests/ui/issues/issue-58857.stderr deleted file mode 100644 index ac70bc725e2..00000000000 --- a/tests/ui/issues/issue-58857.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: negative bounds are not supported - --> $DIR/issue-58857.rs:4:9 - | -LL | impl Conj{} - | ^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/issues/issue-59020.rs b/tests/ui/issues/issue-59020.rs deleted file mode 100644 index 2a34ba52b88..00000000000 --- a/tests/ui/issues/issue-59020.rs +++ /dev/null @@ -1,27 +0,0 @@ -//@ edition:2018 -//@ run-pass -//@ needs-threads - -use std::thread; -use std::time::Duration; - -fn main() { - let t1 = thread::spawn(|| { - let sleep = Duration::new(0,100_000); - for _ in 0..100 { - println!("Parking1"); - thread::park_timeout(sleep); - } - }); - - let t2 = thread::spawn(|| { - let sleep = Duration::new(0,100_000); - for _ in 0..100 { - println!("Parking2"); - thread::park_timeout(sleep); - } - }); - - t1.join().expect("Couldn't join thread 1"); - t2.join().expect("Couldn't join thread 2"); -} diff --git a/tests/ui/issues/issue-59326.rs b/tests/ui/issues/issue-59326.rs deleted file mode 100644 index e9634ad9fd8..00000000000 --- a/tests/ui/issues/issue-59326.rs +++ /dev/null @@ -1,26 +0,0 @@ -//@ check-pass -trait Service { - type S; -} - -trait Framing { - type F; -} - -impl Framing for () { - type F = (); -} - -trait HttpService: Service {} - -type BoxService = Box>; - -fn build_server BoxService>(_: F) {} - -fn make_server() -> Box> { - unimplemented!() -} - -fn main() { - build_server(|| make_server()) -} diff --git a/tests/ui/issues/issue-59488.rs b/tests/ui/issues/issue-59488.rs deleted file mode 100644 index 384501e3e5d..00000000000 --- a/tests/ui/issues/issue-59488.rs +++ /dev/null @@ -1,34 +0,0 @@ -fn foo() -> i32 { - 42 -} - -fn bar(a: i64) -> i64 { - 43 -} - -enum Foo { - Bar(usize), -} - -fn main() { - foo > 12; - //~^ ERROR binary operation `>` cannot be applied to type `fn() -> i32 {foo}` [E0369] - //~| ERROR mismatched types [E0308] - - bar > 13; - //~^ ERROR binary operation `>` cannot be applied to type `fn(i64) -> i64 {bar}` [E0369] - //~| ERROR mismatched types [E0308] - - foo > foo; - //~^ ERROR binary operation `>` cannot be applied to type `fn() -> i32 {foo}` [E0369] - - foo > bar; - //~^ ERROR binary operation `>` cannot be applied to type `fn() -> i32 {foo}` [E0369] - //~| ERROR mismatched types [E0308] - - let i = Foo::Bar; - assert_eq!(Foo::Bar, i); - //~^ ERROR binary operation `==` cannot be applied to type `fn(usize) -> Foo {Foo::Bar}` [E0369] - //~| ERROR `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug` [E0277] - //~| ERROR `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug` [E0277] -} diff --git a/tests/ui/issues/issue-59488.stderr b/tests/ui/issues/issue-59488.stderr deleted file mode 100644 index b6611ad63a8..00000000000 --- a/tests/ui/issues/issue-59488.stderr +++ /dev/null @@ -1,105 +0,0 @@ -error[E0369]: binary operation `>` cannot be applied to type `fn() -> i32 {foo}` - --> $DIR/issue-59488.rs:14:9 - | -LL | foo > 12; - | --- ^ -- {integer} - | | - | fn() -> i32 {foo} - | -help: use parentheses to call this function - | -LL | foo() > 12; - | ++ - -error[E0308]: mismatched types - --> $DIR/issue-59488.rs:14:11 - | -LL | foo > 12; - | ^^ expected fn item, found `i32` - | - = note: expected fn item `fn() -> i32 {foo}` - found type `i32` - -error[E0369]: binary operation `>` cannot be applied to type `fn(i64) -> i64 {bar}` - --> $DIR/issue-59488.rs:18:9 - | -LL | bar > 13; - | --- ^ -- {integer} - | | - | fn(i64) -> i64 {bar} - | -help: use parentheses to call this function - | -LL | bar(/* i64 */) > 13; - | +++++++++++ - -error[E0308]: mismatched types - --> $DIR/issue-59488.rs:18:11 - | -LL | bar > 13; - | ^^ expected fn item, found `i64` - | - = note: expected fn item `fn(i64) -> i64 {bar}` - found type `i64` - -error[E0369]: binary operation `>` cannot be applied to type `fn() -> i32 {foo}` - --> $DIR/issue-59488.rs:22:9 - | -LL | foo > foo; - | --- ^ --- fn() -> i32 {foo} - | | - | fn() -> i32 {foo} - | -help: use parentheses to call these - | -LL | foo() > foo(); - | ++ ++ - -error[E0369]: binary operation `>` cannot be applied to type `fn() -> i32 {foo}` - --> $DIR/issue-59488.rs:25:9 - | -LL | foo > bar; - | --- ^ --- fn(i64) -> i64 {bar} - | | - | fn() -> i32 {foo} - -error[E0308]: mismatched types - --> $DIR/issue-59488.rs:25:11 - | -LL | foo > bar; - | ^^^ expected fn item, found a different fn item - | - = note: expected fn item `fn() -> i32 {foo}` - found fn item `fn(i64) -> i64 {bar}` - -error[E0369]: binary operation `==` cannot be applied to type `fn(usize) -> Foo {Foo::Bar}` - --> $DIR/issue-59488.rs:30:5 - | -LL | assert_eq!(Foo::Bar, i); - | ^^^^^^^^^^^^^^^^^^^^^^^ - | | - | fn(usize) -> Foo {Foo::Bar} - | fn(usize) -> Foo {Foo::Bar} - | - = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug` - --> $DIR/issue-59488.rs:30:5 - | -LL | assert_eq!(Foo::Bar, i); - | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for fn item `fn(usize) -> Foo {Foo::Bar}` - | - = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug` - --> $DIR/issue-59488.rs:30:5 - | -LL | assert_eq!(Foo::Bar, i); - | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for fn item `fn(usize) -> Foo {Foo::Bar}` - | - = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 10 previous errors - -Some errors have detailed explanations: E0277, E0308, E0369. -For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-59494.rs b/tests/ui/issues/issue-59494.rs deleted file mode 100644 index b4d50bd4ce7..00000000000 --- a/tests/ui/issues/issue-59494.rs +++ /dev/null @@ -1,23 +0,0 @@ -fn t7p(f: impl Fn(B) -> C, g: impl Fn(A) -> B) -> impl Fn(A) -> C { - move |a: A| -> C { f(g(a)) } -} - -fn t8n(f: impl Fn(A) -> B, g: impl Fn(A) -> C) -> impl Fn(A) -> (B, C) -where - A: Copy, -{ - move |a: A| -> (B, C) { - let b = a; - let fa = f(a); - let ga = g(b); - (fa, ga) - } -} - -fn main() { - let f = |(_, _)| {}; - let g = |(a, _)| a; - let t7 = |env| |a| |b| t7p(f, g)(((env, a), b)); - //~^ ERROR mismatched types - let t8 = t8n(t7, t7p(f, g)); -} diff --git a/tests/ui/issues/issue-59494.stderr b/tests/ui/issues/issue-59494.stderr deleted file mode 100644 index 33d3e48c1aa..00000000000 --- a/tests/ui/issues/issue-59494.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/issue-59494.rs:20:40 - | -LL | let t7 = |env| |a| |b| t7p(f, g)(((env, a), b)); - | ^^^ cyclic type of infinite size - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-59756.fixed b/tests/ui/issues/issue-59756.fixed deleted file mode 100644 index 954ba917626..00000000000 --- a/tests/ui/issues/issue-59756.fixed +++ /dev/null @@ -1,17 +0,0 @@ -//@ run-rustfix - -#![allow(warnings)] - -struct A; -struct B; - -fn foo() -> Result { - Ok(A) -} - -fn bar() -> Result { - foo() - //~^ ERROR try expression alternatives have incompatible types [E0308] -} - -fn main() {} diff --git a/tests/ui/issues/issue-59756.rs b/tests/ui/issues/issue-59756.rs deleted file mode 100644 index de349f43f46..00000000000 --- a/tests/ui/issues/issue-59756.rs +++ /dev/null @@ -1,21 +0,0 @@ -//@ run-rustfix -//@ ignore-test (rustfix needs multiple suggestions) -// -// FIXME: Re-enable this test once we support choosing -// between multiple mutually exclusive suggestions for the same span - -#![allow(warnings)] - -struct A; -struct B; - -fn foo() -> Result { - Ok(A) -} - -fn bar() -> Result { - foo()? - //~^ ERROR try expression alternatives have incompatible types [E0308] -} - -fn main() {} diff --git a/tests/ui/issues/issue-59756.stderr b/tests/ui/issues/issue-59756.stderr deleted file mode 100644 index 27c07fecd5b..00000000000 --- a/tests/ui/issues/issue-59756.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0308]: try expression alternatives have incompatible types - --> $DIR/issue-59756.rs:13:5 - | -LL | foo()? - | ^^^^^^ expected enum `std::result::Result`, found struct `A` - | - = note: expected enum `std::result::Result` - found struct `A` -help: try removing this `?` - | -LL | foo() - | -- -help: try using a variant of the expected enum - | -LL | Ok(foo()?) - | - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/keyword/raw-identifier-for-function-57198.rs b/tests/ui/keyword/raw-identifier-for-function-57198.rs new file mode 100644 index 00000000000..41a0cbf4619 --- /dev/null +++ b/tests/ui/keyword/raw-identifier-for-function-57198.rs @@ -0,0 +1,10 @@ +// https://github.com/rust-lang/rust/issues/57198 +//@ run-pass + +mod m { + pub fn r#for() {} +} + +fn main() { + m::r#for(); +} diff --git a/tests/ui/mismatched_types/auxiliary/aux-56943.rs b/tests/ui/mismatched_types/auxiliary/aux-56943.rs new file mode 100644 index 00000000000..65b9beb91f9 --- /dev/null +++ b/tests/ui/mismatched_types/auxiliary/aux-56943.rs @@ -0,0 +1,3 @@ +pub struct S; +mod m { pub struct S; } +pub use crate::m::S as S2; diff --git a/tests/ui/mismatched_types/type-mismatch-in-extern-crate-56943.rs b/tests/ui/mismatched_types/type-mismatch-in-extern-crate-56943.rs new file mode 100644 index 00000000000..9970b27c847 --- /dev/null +++ b/tests/ui/mismatched_types/type-mismatch-in-extern-crate-56943.rs @@ -0,0 +1,9 @@ +// https://github.com/rust-lang/rust/issues/56943 +//@ aux-build:aux-56943.rs + +extern crate aux_56943; + +fn main() { + let _: aux_56943::S = aux_56943::S2; + //~^ ERROR mismatched types [E0308] +} diff --git a/tests/ui/mismatched_types/type-mismatch-in-extern-crate-56943.stderr b/tests/ui/mismatched_types/type-mismatch-in-extern-crate-56943.stderr new file mode 100644 index 00000000000..2315267701d --- /dev/null +++ b/tests/ui/mismatched_types/type-mismatch-in-extern-crate-56943.stderr @@ -0,0 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/type-mismatch-in-extern-crate-56943.rs:7:27 + | +LL | let _: aux_56943::S = aux_56943::S2; + | ------------ ^^^^^^^^^^^^^ expected `S`, found `S2` + | | + | expected due to this + +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-handling-in-modules-56128.rs b/tests/ui/modules/pub-use-handling-in-modules-56128.rs new file mode 100644 index 00000000000..cc170f60250 --- /dev/null +++ b/tests/ui/modules/pub-use-handling-in-modules-56128.rs @@ -0,0 +1,15 @@ +// Regression test for #56128. When this `pub(super) use...` gets +// exploded in the HIR, we were not handling ids correctly. +// +//@ check-pass + +mod bar { + pub(super) use self::baz::{x, y}; + + mod baz { + pub fn x() { } + pub fn y() { } + } +} + +fn main() { } diff --git a/tests/ui/parser/invalid-variable-definition-55587.rs b/tests/ui/parser/invalid-variable-definition-55587.rs new file mode 100644 index 00000000000..f2c7c0a8e6c --- /dev/null +++ b/tests/ui/parser/invalid-variable-definition-55587.rs @@ -0,0 +1,6 @@ +// https://github.com/rust-lang/rust/issues/55587 +use std::path::Path; + +fn main() { + let Path::new(); //~ ERROR expected tuple struct or tuple variant +} diff --git a/tests/ui/parser/invalid-variable-definition-55587.stderr b/tests/ui/parser/invalid-variable-definition-55587.stderr new file mode 100644 index 00000000000..08c951582e3 --- /dev/null +++ b/tests/ui/parser/invalid-variable-definition-55587.stderr @@ -0,0 +1,11 @@ +error[E0164]: expected tuple struct or tuple variant, found associated function `Path::new` + --> $DIR/invalid-variable-definition-55587.rs:5:9 + | +LL | let Path::new(); + | ^^^^^^^^^^^ `fn` calls are not allowed in patterns + | + = help: for more information, visit https://doc.rust-lang.org/book/ch19-00-patterns.html + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0164`. diff --git a/tests/ui/resolve/missing-type-in-scope-58712.rs b/tests/ui/resolve/missing-type-in-scope-58712.rs new file mode 100644 index 00000000000..b9ff74e426d --- /dev/null +++ b/tests/ui/resolve/missing-type-in-scope-58712.rs @@ -0,0 +1,15 @@ +// https://github.com/rust-lang/rust/issues/58712 +struct AddrVec { + h: H, + a: A, +} + +impl AddrVec { + //~^ ERROR cannot find type `DeviceId` in this scope + pub fn device(&self) -> DeviceId { + //~^ ERROR cannot find type `DeviceId` in this scope + self.tail() + } +} + +fn main() {} diff --git a/tests/ui/resolve/missing-type-in-scope-58712.stderr b/tests/ui/resolve/missing-type-in-scope-58712.stderr new file mode 100644 index 00000000000..d7e06eee856 --- /dev/null +++ b/tests/ui/resolve/missing-type-in-scope-58712.stderr @@ -0,0 +1,20 @@ +error[E0412]: cannot find type `DeviceId` in this scope + --> $DIR/missing-type-in-scope-58712.rs:7:20 + | +LL | impl AddrVec { + | ^^^^^^^^ not found in this scope + | +help: you might be missing a type parameter + | +LL | impl AddrVec { + | ++++++++++ + +error[E0412]: cannot find type `DeviceId` in this scope + --> $DIR/missing-type-in-scope-58712.rs:9:29 + | +LL | pub fn device(&self) -> DeviceId { + | ^^^^^^^^ not found in this scope + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/std/park-timeout-wakeup-59020.rs b/tests/ui/std/park-timeout-wakeup-59020.rs new file mode 100644 index 00000000000..af530bb586c --- /dev/null +++ b/tests/ui/std/park-timeout-wakeup-59020.rs @@ -0,0 +1,28 @@ +// https://github.com/rust-lang/rust/issues/59020 +//@ edition:2018 +//@ run-pass +//@ needs-threads + +use std::thread; +use std::time::Duration; + +fn main() { + let t1 = thread::spawn(|| { + let sleep = Duration::new(0,100_000); + for _ in 0..100 { + println!("Parking1"); + thread::park_timeout(sleep); + } + }); + + let t2 = thread::spawn(|| { + let sleep = Duration::new(0,100_000); + for _ in 0..100 { + println!("Parking2"); + thread::park_timeout(sleep); + } + }); + + t1.join().expect("Couldn't join thread 1"); + t2.join().expect("Couldn't join thread 2"); +} diff --git a/tests/ui/structs/invalid-self-constructor-56835.rs b/tests/ui/structs/invalid-self-constructor-56835.rs new file mode 100644 index 00000000000..fd8763443f0 --- /dev/null +++ b/tests/ui/structs/invalid-self-constructor-56835.rs @@ -0,0 +1,10 @@ +// https://github.com/rust-lang/rust/issues/56835 +pub struct Foo {} + +impl Foo { + fn bar(Self(foo): Self) {} + //~^ ERROR the `Self` constructor can only be used with tuple or unit structs + //~^^ ERROR expected tuple struct or tuple variant, found self constructor `Self` [E0164] +} + +fn main() {} diff --git a/tests/ui/structs/invalid-self-constructor-56835.stderr b/tests/ui/structs/invalid-self-constructor-56835.stderr new file mode 100644 index 00000000000..045781ec42b --- /dev/null +++ b/tests/ui/structs/invalid-self-constructor-56835.stderr @@ -0,0 +1,15 @@ +error: the `Self` constructor can only be used with tuple or unit structs + --> $DIR/invalid-self-constructor-56835.rs:5:12 + | +LL | fn bar(Self(foo): Self) {} + | ^^^^^^^^^ help: use curly brackets: `Self { /* fields */ }` + +error[E0164]: expected tuple struct or tuple variant, found self constructor `Self` + --> $DIR/invalid-self-constructor-56835.rs:5:12 + | +LL | fn bar(Self(foo): Self) {} + | ^^^^^^^^^ not a tuple struct or tuple variant + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0164`. diff --git a/tests/ui/suggestions/incompatible-types-in-try-expression-59756.fixed b/tests/ui/suggestions/incompatible-types-in-try-expression-59756.fixed new file mode 100644 index 00000000000..954ba917626 --- /dev/null +++ b/tests/ui/suggestions/incompatible-types-in-try-expression-59756.fixed @@ -0,0 +1,17 @@ +//@ run-rustfix + +#![allow(warnings)] + +struct A; +struct B; + +fn foo() -> Result { + Ok(A) +} + +fn bar() -> Result { + foo() + //~^ ERROR try expression alternatives have incompatible types [E0308] +} + +fn main() {} diff --git a/tests/ui/suggestions/incompatible-types-in-try-expression-59756.rs b/tests/ui/suggestions/incompatible-types-in-try-expression-59756.rs new file mode 100644 index 00000000000..570aa7d373b --- /dev/null +++ b/tests/ui/suggestions/incompatible-types-in-try-expression-59756.rs @@ -0,0 +1,22 @@ +// https://github.com/rust-lang/rust/issues/59756 +//@ run-rustfix +//@ ignore-test (rustfix needs multiple suggestions) +// +// FIXME: Re-enable this test once we support choosing +// between multiple mutually exclusive suggestions for the same span + +#![allow(warnings)] + +struct A; +struct B; + +fn foo() -> Result { + Ok(A) +} + +fn bar() -> Result { + foo()? + //~^ ERROR try expression alternatives have incompatible types [E0308] +} + +fn main() {} diff --git a/tests/ui/suggestions/incompatible-types-in-try-expression-59756.stderr b/tests/ui/suggestions/incompatible-types-in-try-expression-59756.stderr new file mode 100644 index 00000000000..7182109b5a0 --- /dev/null +++ b/tests/ui/suggestions/incompatible-types-in-try-expression-59756.stderr @@ -0,0 +1,20 @@ +error[E0308]: try expression alternatives have incompatible types + --> $DIR/incompatible-types-in-try-expression-59756.rs:13:5 + | +LL | foo()? + | ^^^^^^ expected enum `std::result::Result`, found struct `A` + | + = note: expected enum `std::result::Result` + found struct `A` +help: try removing this `?` + | +LL | foo() + | -- +help: try using a variant of the expected enum + | +LL | Ok(foo()?) + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/trait-bounds/negative-bound-not-supported-58857.rs b/tests/ui/trait-bounds/negative-bound-not-supported-58857.rs new file mode 100644 index 00000000000..0a0b70a216b --- /dev/null +++ b/tests/ui/trait-bounds/negative-bound-not-supported-58857.rs @@ -0,0 +1,8 @@ +// https://github.com/rust-lang/rust/issues/58857 +struct Conj {a : A} +trait Valid {} + +impl Conj{} +//~^ ERROR negative bounds are not supported + +fn main() {} diff --git a/tests/ui/trait-bounds/negative-bound-not-supported-58857.stderr b/tests/ui/trait-bounds/negative-bound-not-supported-58857.stderr new file mode 100644 index 00000000000..05347a891b4 --- /dev/null +++ b/tests/ui/trait-bounds/negative-bound-not-supported-58857.stderr @@ -0,0 +1,8 @@ +error: negative bounds are not supported + --> $DIR/negative-bound-not-supported-58857.rs:5:9 + | +LL | impl Conj{} + | ^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/traits/generic-trait-impl-aliased-array-58212.rs b/tests/ui/traits/generic-trait-impl-aliased-array-58212.rs new file mode 100644 index 00000000000..a71194ba806 --- /dev/null +++ b/tests/ui/traits/generic-trait-impl-aliased-array-58212.rs @@ -0,0 +1,16 @@ +// https://github.com/rust-lang/rust/issues/58212 +//@ check-pass + +trait FromUnchecked { + fn from_unchecked(); +} + +impl FromUnchecked for [u8; 1] { + fn from_unchecked() { + let mut array: Self = [0; 1]; + let _ptr = &mut array as *mut [u8] as *mut u8; + } +} + +fn main() { +} diff --git a/tests/ui/traits/trait-object-lifetime-bounds-57156.rs b/tests/ui/traits/trait-object-lifetime-bounds-57156.rs new file mode 100644 index 00000000000..8f5bef7fe13 --- /dev/null +++ b/tests/ui/traits/trait-object-lifetime-bounds-57156.rs @@ -0,0 +1,24 @@ +// https://github.com/rust-lang/rust/issues/57156 +//@ check-pass + +trait Foo { + type Output; +} + +trait Bar<'a, T>: for<'s> Foo<&'s T, Output=bool> { + fn cb(&self) -> Box>; +} + +impl<'s> Foo<&'s ()> for () { + type Output = bool; +} + +impl<'a> Bar<'a, ()> for () { + fn cb(&self) -> Box> { + Box::new(*self) + } +} + +fn main() { + let _t = ().cb(); +} diff --git a/tests/ui/traits/trait-objects-with-supertraits-56229.rs b/tests/ui/traits/trait-objects-with-supertraits-56229.rs new file mode 100644 index 00000000000..27cae968a6a --- /dev/null +++ b/tests/ui/traits/trait-objects-with-supertraits-56229.rs @@ -0,0 +1,36 @@ +// https://github.com/rust-lang/rust/issues/56229 +//@ check-pass + +trait Mirror { + type Other; +} + +#[derive(Debug)] +struct Even(usize); +struct Odd; + +impl Mirror for Even { + type Other = Odd; +} + +impl Mirror for Odd { + type Other = Even; +} + +trait Dyn: AsRef<::Other> {} + +impl Dyn for Even {} + +impl AsRef for Even { + fn as_ref(&self) -> &Even { + self + } +} + +fn code(d: &dyn Dyn) -> &T::Other { + d.as_ref() +} + +fn main() { + println!("{:?}", code(&Even(22))); +} diff --git a/tests/ui/typeck/self-constructor-type-args-not-allowed-57924.rs b/tests/ui/typeck/self-constructor-type-args-not-allowed-57924.rs new file mode 100644 index 00000000000..2b3b11c3f38 --- /dev/null +++ b/tests/ui/typeck/self-constructor-type-args-not-allowed-57924.rs @@ -0,0 +1,11 @@ +// https://github.com/rust-lang/rust/issues/57924 +pub struct Gcm(E); + +impl Gcm { + pub fn crash(e: E) -> Self { + Self::(e) + //~^ ERROR type arguments are not allowed on self constructor + } +} + +fn main() {} diff --git a/tests/ui/typeck/self-constructor-type-args-not-allowed-57924.stderr b/tests/ui/typeck/self-constructor-type-args-not-allowed-57924.stderr new file mode 100644 index 00000000000..b5be5b39eb8 --- /dev/null +++ b/tests/ui/typeck/self-constructor-type-args-not-allowed-57924.stderr @@ -0,0 +1,11 @@ +error[E0109]: type arguments are not allowed on self constructor + --> $DIR/self-constructor-type-args-not-allowed-57924.rs:6:16 + | +LL | Self::(e) + | ---- ^ type argument not allowed + | | + | not allowed on self constructor + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0109`. diff --git a/tests/ui/typeck/self-constructor-type-error-56199.rs b/tests/ui/typeck/self-constructor-type-error-56199.rs new file mode 100644 index 00000000000..b08d6918980 --- /dev/null +++ b/tests/ui/typeck/self-constructor-type-error-56199.rs @@ -0,0 +1,23 @@ +// https://github.com/rust-lang/rust/issues/56199 +enum Foo {} +struct Bar {} + +impl Foo { + fn foo() { + let _ = Self; + //~^ ERROR the `Self` constructor can only be used with tuple or unit structs + let _ = Self(); + //~^ ERROR the `Self` constructor can only be used with tuple or unit structs + } +} + +impl Bar { + fn bar() { + let _ = Self; + //~^ ERROR the `Self` constructor can only be used with tuple or unit structs + let _ = Self(); + //~^ ERROR the `Self` constructor can only be used with tuple or unit structs + } +} + +fn main() {} diff --git a/tests/ui/typeck/self-constructor-type-error-56199.stderr b/tests/ui/typeck/self-constructor-type-error-56199.stderr new file mode 100644 index 00000000000..6e9d0fcd90c --- /dev/null +++ b/tests/ui/typeck/self-constructor-type-error-56199.stderr @@ -0,0 +1,30 @@ +error: the `Self` constructor can only be used with tuple or unit structs + --> $DIR/self-constructor-type-error-56199.rs:7:17 + | +LL | let _ = Self; + | ^^^^ + | + = help: did you mean to use one of the enum's variants? + +error: the `Self` constructor can only be used with tuple or unit structs + --> $DIR/self-constructor-type-error-56199.rs:9:17 + | +LL | let _ = Self(); + | ^^^^^^ + | + = help: did you mean to use one of the enum's variants? + +error: the `Self` constructor can only be used with tuple or unit structs + --> $DIR/self-constructor-type-error-56199.rs:16:17 + | +LL | let _ = Self; + | ^^^^ help: use curly brackets: `Self { /* fields */ }` + +error: the `Self` constructor can only be used with tuple or unit structs + --> $DIR/self-constructor-type-error-56199.rs:18:17 + | +LL | let _ = Self(); + | ^^^^^^ help: use curly brackets: `Self { /* fields */ }` + +error: aborting due to 4 previous errors + -- cgit 1.4.1-3-g733a5