From 1376c5a617be5c25655d0d7cb63e3beaa5a6e026 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:20:39 +0200 Subject: Merging upstream version 1.70.0+dfsg1. Signed-off-by: Daniel Baumann --- .../ambiguous-associated-type2.stderr | 2 +- tests/ui/associated-type-bounds/issue-104916.rs | 14 ++++++ .../ui/associated-type-bounds/issue-104916.stderr | 8 ++++ .../return-type-notation/bad-inputs-and-output.rs | 22 +++++++++ .../bad-inputs-and-output.stderr | 56 ++++++++++++++++++++++ .../return-type-notation/basic.rs | 28 +++++++++++ .../return-type-notation/basic.with.stderr | 19 ++++++++ .../return-type-notation/basic.without.stderr | 37 ++++++++++++++ .../return-type-notation/equality.rs | 16 +++++++ .../return-type-notation/equality.stderr | 25 ++++++++++ .../return-type-notation/missing.rs | 14 ++++++ .../return-type-notation/missing.stderr | 25 ++++++++++ .../return-type-notation/non-rpitit.rs | 11 +++++ .../return-type-notation/non-rpitit.stderr | 22 +++++++++ .../return-type-notation/unpretty-parenthesized.rs | 11 +++++ .../unpretty-parenthesized.stderr | 12 +++++ .../unpretty-parenthesized.stdout | 15 ++++++ 17 files changed, 336 insertions(+), 1 deletion(-) create mode 100644 tests/ui/associated-type-bounds/issue-104916.rs create mode 100644 tests/ui/associated-type-bounds/issue-104916.stderr create mode 100644 tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs create mode 100644 tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr create mode 100644 tests/ui/associated-type-bounds/return-type-notation/basic.rs create mode 100644 tests/ui/associated-type-bounds/return-type-notation/basic.with.stderr create mode 100644 tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr create mode 100644 tests/ui/associated-type-bounds/return-type-notation/equality.rs create mode 100644 tests/ui/associated-type-bounds/return-type-notation/equality.stderr create mode 100644 tests/ui/associated-type-bounds/return-type-notation/missing.rs create mode 100644 tests/ui/associated-type-bounds/return-type-notation/missing.stderr create mode 100644 tests/ui/associated-type-bounds/return-type-notation/non-rpitit.rs create mode 100644 tests/ui/associated-type-bounds/return-type-notation/non-rpitit.stderr create mode 100644 tests/ui/associated-type-bounds/return-type-notation/unpretty-parenthesized.rs create mode 100644 tests/ui/associated-type-bounds/return-type-notation/unpretty-parenthesized.stderr create mode 100644 tests/ui/associated-type-bounds/return-type-notation/unpretty-parenthesized.stdout (limited to 'tests/ui/associated-type-bounds') diff --git a/tests/ui/associated-type-bounds/ambiguous-associated-type2.stderr b/tests/ui/associated-type-bounds/ambiguous-associated-type2.stderr index 4162cdaa8..575b00e09 100644 --- a/tests/ui/associated-type-bounds/ambiguous-associated-type2.stderr +++ b/tests/ui/associated-type-bounds/ambiguous-associated-type2.stderr @@ -5,7 +5,7 @@ LL | trait Baz: Foo + Bar {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: ...which immediately requires computing the super traits of `Baz` with associated type name `Item` again -note: cycle used when computing the super traits of `Baz` +note: cycle used when computing the super predicates of `Baz` --> $DIR/ambiguous-associated-type2.rs:7:1 | LL | trait Baz: Foo + Bar {} diff --git a/tests/ui/associated-type-bounds/issue-104916.rs b/tests/ui/associated-type-bounds/issue-104916.rs new file mode 100644 index 000000000..3361fa011 --- /dev/null +++ b/tests/ui/associated-type-bounds/issue-104916.rs @@ -0,0 +1,14 @@ +#![feature(associated_type_bounds)] + +trait B { + type AssocType; +} + +fn f() +where + dyn for<'j> B:, + //~^ ERROR: associated type bounds are only allowed in where clauses and function signatures +{ +} + +fn main() {} diff --git a/tests/ui/associated-type-bounds/issue-104916.stderr b/tests/ui/associated-type-bounds/issue-104916.stderr new file mode 100644 index 000000000..35435962f --- /dev/null +++ b/tests/ui/associated-type-bounds/issue-104916.stderr @@ -0,0 +1,8 @@ +error: associated type bounds are only allowed in where clauses and function signatures, not in bounds + --> $DIR/issue-104916.rs:9:19 + | +LL | dyn for<'j> B:, + | ^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs new file mode 100644 index 000000000..79cee5517 --- /dev/null +++ b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs @@ -0,0 +1,22 @@ +// edition: 2021 + +#![feature(return_type_notation, async_fn_in_trait)] +//~^ WARN the feature `return_type_notation` is incomplete +//~| WARN the feature `async_fn_in_trait` is incomplete + +trait Trait { + async fn method() {} +} + +fn foo>() {} +//~^ ERROR argument types not allowed with return type notation +//~| ERROR associated type bounds are unstable + +fn bar (): Send>>() {} +//~^ ERROR return type not allowed with return type notation +//~| ERROR associated type bounds are unstable + +fn baz>() {} +//~^ ERROR return type notation uses `()` instead of `(..)` for elided arguments + +fn main() {} diff --git a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr new file mode 100644 index 000000000..b23e0f791 --- /dev/null +++ b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr @@ -0,0 +1,56 @@ +error: return type notation uses `()` instead of `(..)` for elided arguments + --> $DIR/bad-inputs-and-output.rs:19:24 + | +LL | fn baz>() {} + | ^^ help: remove the `..` + +error[E0658]: associated type bounds are unstable + --> $DIR/bad-inputs-and-output.rs:11:17 + | +LL | fn foo>() {} + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #52662 for more information + = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable + +error[E0658]: associated type bounds are unstable + --> $DIR/bad-inputs-and-output.rs:15:17 + | +LL | fn bar (): Send>>() {} + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #52662 for more information + = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable + +warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/bad-inputs-and-output.rs:3:12 + | +LL | #![feature(return_type_notation, async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #109417 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/bad-inputs-and-output.rs:3:34 + | +LL | #![feature(return_type_notation, async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + +error: argument types not allowed with return type notation + --> $DIR/bad-inputs-and-output.rs:11:23 + | +LL | fn foo>() {} + | ^^^^^ help: remove the input types: `()` + +error: return type not allowed with return type notation + --> $DIR/bad-inputs-and-output.rs:15:25 + | +LL | fn bar (): Send>>() {} + | ^^^^^^ help: remove the return type + +error: aborting due to 5 previous errors; 2 warnings emitted + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.rs b/tests/ui/associated-type-bounds/return-type-notation/basic.rs new file mode 100644 index 000000000..0b7530b65 --- /dev/null +++ b/tests/ui/associated-type-bounds/return-type-notation/basic.rs @@ -0,0 +1,28 @@ +// revisions: with without +// edition: 2021 +//[with] check-pass + +#![feature(return_type_notation, async_fn_in_trait)] +//~^ WARN the feature `return_type_notation` is incomplete +//~| WARN the feature `async_fn_in_trait` is incomplete + +trait Foo { + async fn method() -> Result<(), ()>; +} + +async fn foo() -> Result<(), ()> { + T::method().await?; + Ok(()) +} + +fn is_send(_: impl Send) {} + +fn test< + #[cfg(with)] T: Foo, + #[cfg(without)] T: Foo, +>() { + is_send(foo::()); + //[without]~^ ERROR future cannot be sent between threads safely +} + +fn main() {} diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.with.stderr b/tests/ui/associated-type-bounds/return-type-notation/basic.with.stderr new file mode 100644 index 000000000..722c774cb --- /dev/null +++ b/tests/ui/associated-type-bounds/return-type-notation/basic.with.stderr @@ -0,0 +1,19 @@ +warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/basic.rs:5:12 + | +LL | #![feature(return_type_notation, async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #109417 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/basic.rs:5:34 + | +LL | #![feature(return_type_notation, async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + +warning: 2 warnings emitted + diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr b/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr new file mode 100644 index 000000000..1645d8c26 --- /dev/null +++ b/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr @@ -0,0 +1,37 @@ +warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/basic.rs:5:12 + | +LL | #![feature(return_type_notation, async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #109417 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/basic.rs:5:34 + | +LL | #![feature(return_type_notation, async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + +error: future cannot be sent between threads safely + --> $DIR/basic.rs:24:13 + | +LL | is_send(foo::()); + | ^^^^^^^^^^ future returned by `foo` is not `Send` + | + = help: within `impl Future>`, the trait `Send` is not implemented for `impl Future>` +note: future is not `Send` as it awaits another future which is not `Send` + --> $DIR/basic.rs:14:5 + | +LL | T::method().await?; + | ^^^^^^^^^^^ await occurs here on type `impl Future>`, which is not `Send` +note: required by a bound in `is_send` + --> $DIR/basic.rs:18:20 + | +LL | fn is_send(_: impl Send) {} + | ^^^^ required by this bound in `is_send` + +error: aborting due to previous error; 2 warnings emitted + diff --git a/tests/ui/associated-type-bounds/return-type-notation/equality.rs b/tests/ui/associated-type-bounds/return-type-notation/equality.rs new file mode 100644 index 000000000..75f757e90 --- /dev/null +++ b/tests/ui/associated-type-bounds/return-type-notation/equality.rs @@ -0,0 +1,16 @@ +// edition: 2021 + +#![feature(return_type_notation, async_fn_in_trait)] +//~^ WARN the feature `return_type_notation` is incomplete +//~| WARN the feature `async_fn_in_trait` is incomplete + +use std::future::Future; + +trait Trait { + async fn method() {} +} + +fn test>>>() {} +//~^ ERROR return type notation is not allowed to use type equality + +fn main() {} diff --git a/tests/ui/associated-type-bounds/return-type-notation/equality.stderr b/tests/ui/associated-type-bounds/return-type-notation/equality.stderr new file mode 100644 index 000000000..c5b2e5710 --- /dev/null +++ b/tests/ui/associated-type-bounds/return-type-notation/equality.stderr @@ -0,0 +1,25 @@ +warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/equality.rs:3:12 + | +LL | #![feature(return_type_notation, async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #109417 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/equality.rs:3:34 + | +LL | #![feature(return_type_notation, async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + +error: return type notation is not allowed to use type equality + --> $DIR/equality.rs:13:18 + | +LL | fn test>>>() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error; 2 warnings emitted + diff --git a/tests/ui/associated-type-bounds/return-type-notation/missing.rs b/tests/ui/associated-type-bounds/return-type-notation/missing.rs new file mode 100644 index 000000000..7b98a5cda --- /dev/null +++ b/tests/ui/associated-type-bounds/return-type-notation/missing.rs @@ -0,0 +1,14 @@ +// edition: 2021 + +#![feature(return_type_notation, async_fn_in_trait)] +//~^ WARN the feature `return_type_notation` is incomplete +//~| WARN the feature `async_fn_in_trait` is incomplete + +trait Trait { + async fn method() {} +} + +fn bar>() {} +//~^ ERROR cannot find associated function `methid` in trait `Trait` + +fn main() {} diff --git a/tests/ui/associated-type-bounds/return-type-notation/missing.stderr b/tests/ui/associated-type-bounds/return-type-notation/missing.stderr new file mode 100644 index 000000000..34f5bda88 --- /dev/null +++ b/tests/ui/associated-type-bounds/return-type-notation/missing.stderr @@ -0,0 +1,25 @@ +warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/missing.rs:3:12 + | +LL | #![feature(return_type_notation, async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #109417 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/missing.rs:3:34 + | +LL | #![feature(return_type_notation, async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + +error: cannot find associated function `methid` in trait `Trait` + --> $DIR/missing.rs:11:17 + | +LL | fn bar>() {} + | ^^^^^^^^^^^^^^ + +error: aborting due to previous error; 2 warnings emitted + diff --git a/tests/ui/associated-type-bounds/return-type-notation/non-rpitit.rs b/tests/ui/associated-type-bounds/return-type-notation/non-rpitit.rs new file mode 100644 index 000000000..db5f6fe38 --- /dev/null +++ b/tests/ui/associated-type-bounds/return-type-notation/non-rpitit.rs @@ -0,0 +1,11 @@ +#![feature(return_type_notation)] +//~^ WARN the feature `return_type_notation` is incomplete + +trait Trait { + fn method() {} +} + +fn test>() {} +//~^ ERROR return type notation used on function that is not `async` and does not return `impl Trait` + +fn main() {} diff --git a/tests/ui/associated-type-bounds/return-type-notation/non-rpitit.stderr b/tests/ui/associated-type-bounds/return-type-notation/non-rpitit.stderr new file mode 100644 index 000000000..31b793995 --- /dev/null +++ b/tests/ui/associated-type-bounds/return-type-notation/non-rpitit.stderr @@ -0,0 +1,22 @@ +warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/non-rpitit.rs:1:12 + | +LL | #![feature(return_type_notation)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #109417 for more information + = note: `#[warn(incomplete_features)]` on by default + +error: return type notation used on function that is not `async` and does not return `impl Trait` + --> $DIR/non-rpitit.rs:8:18 + | +LL | fn method() {} + | ----------- this function must be `async` or return `impl Trait` +... +LL | fn test>() {} + | ^^^^^^^^^^^^^^ + | + = note: function returns `()`, which is not compatible with associated type return bounds + +error: aborting due to previous error; 1 warning emitted + diff --git a/tests/ui/associated-type-bounds/return-type-notation/unpretty-parenthesized.rs b/tests/ui/associated-type-bounds/return-type-notation/unpretty-parenthesized.rs new file mode 100644 index 000000000..9129f37e0 --- /dev/null +++ b/tests/ui/associated-type-bounds/return-type-notation/unpretty-parenthesized.rs @@ -0,0 +1,11 @@ +// edition: 2021 +// compile-flags: -Zunpretty=expanded + +trait Trait { + async fn method() {} +} + +fn foo>() {} +//~^ ERROR associated type bounds are unstable + +fn main() {} diff --git a/tests/ui/associated-type-bounds/return-type-notation/unpretty-parenthesized.stderr b/tests/ui/associated-type-bounds/return-type-notation/unpretty-parenthesized.stderr new file mode 100644 index 000000000..77e015b41 --- /dev/null +++ b/tests/ui/associated-type-bounds/return-type-notation/unpretty-parenthesized.stderr @@ -0,0 +1,12 @@ +error[E0658]: associated type bounds are unstable + --> $DIR/unpretty-parenthesized.rs:8:17 + | +LL | fn foo>() {} + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #52662 for more information + = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/associated-type-bounds/return-type-notation/unpretty-parenthesized.stdout b/tests/ui/associated-type-bounds/return-type-notation/unpretty-parenthesized.stdout new file mode 100644 index 000000000..b3dea8f6e --- /dev/null +++ b/tests/ui/associated-type-bounds/return-type-notation/unpretty-parenthesized.stdout @@ -0,0 +1,15 @@ +#![feature(prelude_import)] +#[prelude_import] +use std::prelude::rust_2021::*; +#[macro_use] +extern crate std; +// edition: 2021 +// compile-flags: -Zunpretty=expanded + +trait Trait { + async fn method() {} +} + +fn foo>() {} + +fn main() {} -- cgit v1.2.3