From 9835e2ae736235810b4ea1c162ca5e65c547e770 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 18 May 2024 04:49:50 +0200 Subject: Merging upstream version 1.71.1+dfsg1. Signed-off-by: Daniel Baumann --- .../return-type-notation/issue-110963-early.rs | 48 +++++++++++++++++++++ .../return-type-notation/issue-110963-early.stderr | 37 ++++++++++++++++ .../return-type-notation/issue-110963-late.rs | 49 ++++++++++++++++++++++ .../return-type-notation/issue-110963-late.stderr | 11 +++++ .../super-method-bound-ambig.rs | 32 ++++++++++++++ .../super-method-bound-ambig.stderr | 19 +++++++++ .../return-type-notation/super-method-bound.rs | 25 +++++++++++ .../return-type-notation/super-method-bound.stderr | 11 +++++ .../return-type-notation/supertrait-bound.rs | 11 +++++ .../return-type-notation/supertrait-bound.stderr | 11 +++++ 10 files changed, 254 insertions(+) create mode 100644 tests/ui/async-await/return-type-notation/issue-110963-early.rs create mode 100644 tests/ui/async-await/return-type-notation/issue-110963-early.stderr create mode 100644 tests/ui/async-await/return-type-notation/issue-110963-late.rs create mode 100644 tests/ui/async-await/return-type-notation/issue-110963-late.stderr create mode 100644 tests/ui/async-await/return-type-notation/super-method-bound-ambig.rs create mode 100644 tests/ui/async-await/return-type-notation/super-method-bound-ambig.stderr create mode 100644 tests/ui/async-await/return-type-notation/super-method-bound.rs create mode 100644 tests/ui/async-await/return-type-notation/super-method-bound.stderr create mode 100644 tests/ui/async-await/return-type-notation/supertrait-bound.rs create mode 100644 tests/ui/async-await/return-type-notation/supertrait-bound.stderr (limited to 'tests/ui/async-await/return-type-notation') diff --git a/tests/ui/async-await/return-type-notation/issue-110963-early.rs b/tests/ui/async-await/return-type-notation/issue-110963-early.rs new file mode 100644 index 000000000..0ecbca5c1 --- /dev/null +++ b/tests/ui/async-await/return-type-notation/issue-110963-early.rs @@ -0,0 +1,48 @@ +// edition: 2021 +// known-bug: #110963 + +#![feature(return_type_notation)] +#![feature(async_fn_in_trait)] + +trait HealthCheck { + async fn check<'a: 'a>(&'a mut self) -> bool; +} + +async fn do_health_check_par(hc: HC) +where + HC: HealthCheck + Send + 'static, +{ + spawn(async move { + let mut hc = hc; + if !hc.check().await { + log_health_check_failure().await; + } + }); +} + +async fn log_health_check_failure() {} + +fn main() {} + +// Fake tokio spawn + +use std::future::Future; +use std::pin::Pin; +use std::task::{Context, Poll}; + +fn spawn(future: F) -> JoinHandle +where + F: Future + Send + 'static, + F::Output: Send + 'static, +{ + loop {} +} + +struct JoinHandle; + +impl Future for JoinHandle { + type Output = (); + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + loop {} + } +} diff --git a/tests/ui/async-await/return-type-notation/issue-110963-early.stderr b/tests/ui/async-await/return-type-notation/issue-110963-early.stderr new file mode 100644 index 000000000..33e22dec3 --- /dev/null +++ b/tests/ui/async-await/return-type-notation/issue-110963-early.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/issue-110963-early.rs:4:12 + | +LL | #![feature(return_type_notation)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #109417 for more information + = note: `#[warn(incomplete_features)]` on by default + +error: higher-ranked lifetime error + --> $DIR/issue-110963-early.rs:15:5 + | +LL | / spawn(async move { +LL | | let mut hc = hc; +LL | | if !hc.check().await { +LL | | log_health_check_failure().await; +LL | | } +LL | | }); + | |______^ + | + = note: could not prove `[async block@$DIR/issue-110963-early.rs:15:11: 20:6]: Send` + +error: higher-ranked lifetime error + --> $DIR/issue-110963-early.rs:15:5 + | +LL | / spawn(async move { +LL | | let mut hc = hc; +LL | | if !hc.check().await { +LL | | log_health_check_failure().await; +LL | | } +LL | | }); + | |______^ + | + = note: could not prove `[async block@$DIR/issue-110963-early.rs:15:11: 20:6]: Send` + +error: aborting due to 2 previous errors; 1 warning emitted + diff --git a/tests/ui/async-await/return-type-notation/issue-110963-late.rs b/tests/ui/async-await/return-type-notation/issue-110963-late.rs new file mode 100644 index 000000000..17b5d775d --- /dev/null +++ b/tests/ui/async-await/return-type-notation/issue-110963-late.rs @@ -0,0 +1,49 @@ +// edition: 2021 +// check-pass + +#![feature(return_type_notation)] +//~^ WARN the feature `return_type_notation` is incomplete +#![feature(async_fn_in_trait)] + +trait HealthCheck { + async fn check(&mut self) -> bool; +} + +async fn do_health_check_par(hc: HC) +where + HC: HealthCheck + Send + 'static, +{ + spawn(async move { + let mut hc = hc; + if !hc.check().await { + log_health_check_failure().await; + } + }); +} + +async fn log_health_check_failure() {} + +fn main() {} + +// Fake tokio spawn + +use std::future::Future; +use std::pin::Pin; +use std::task::{Context, Poll}; + +fn spawn(future: F) -> JoinHandle +where + F: Future + Send + 'static, + F::Output: Send + 'static, +{ + loop {} +} + +struct JoinHandle; + +impl Future for JoinHandle { + type Output = (); + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + loop {} + } +} diff --git a/tests/ui/async-await/return-type-notation/issue-110963-late.stderr b/tests/ui/async-await/return-type-notation/issue-110963-late.stderr new file mode 100644 index 000000000..9c6966537 --- /dev/null +++ b/tests/ui/async-await/return-type-notation/issue-110963-late.stderr @@ -0,0 +1,11 @@ +warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/issue-110963-late.rs:4:12 + | +LL | #![feature(return_type_notation)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #109417 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/async-await/return-type-notation/super-method-bound-ambig.rs b/tests/ui/async-await/return-type-notation/super-method-bound-ambig.rs new file mode 100644 index 000000000..028e526b5 --- /dev/null +++ b/tests/ui/async-await/return-type-notation/super-method-bound-ambig.rs @@ -0,0 +1,32 @@ +// edition:2021 + +#![feature(async_fn_in_trait, return_type_notation)] +//~^ WARN the feature `return_type_notation` is incomplete + +trait Super1<'a> { + async fn test(); +} +impl Super1<'_> for () { + async fn test() {} +} + +trait Super2 { + async fn test(); +} +impl Super2 for () { + async fn test() {} +} + +trait Foo: for<'a> Super1<'a> + Super2 {} +impl Foo for () {} + +fn test() +where + T: Foo, + //~^ ERROR ambiguous associated function `test` for `Foo` +{ +} + +fn main() { + test::<()>(); +} diff --git a/tests/ui/async-await/return-type-notation/super-method-bound-ambig.stderr b/tests/ui/async-await/return-type-notation/super-method-bound-ambig.stderr new file mode 100644 index 000000000..5bc8dbde4 --- /dev/null +++ b/tests/ui/async-await/return-type-notation/super-method-bound-ambig.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/super-method-bound-ambig.rs:3:31 + | +LL | #![feature(async_fn_in_trait, return_type_notation)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #109417 for more information + = note: `#[warn(incomplete_features)]` on by default + +error: ambiguous associated function `test` for `Foo` + --> $DIR/super-method-bound-ambig.rs:25:12 + | +LL | T: Foo, + | ^^^^^^^^^^^^ + | + = note: `test` is declared in two supertraits: `Super2` and `Super1<'a>` + +error: aborting due to previous error; 1 warning emitted + diff --git a/tests/ui/async-await/return-type-notation/super-method-bound.rs b/tests/ui/async-await/return-type-notation/super-method-bound.rs new file mode 100644 index 000000000..58ea3578d --- /dev/null +++ b/tests/ui/async-await/return-type-notation/super-method-bound.rs @@ -0,0 +1,25 @@ +// edition:2021 +// check-pass + +#![feature(async_fn_in_trait, return_type_notation)] +//~^ WARN the feature `return_type_notation` is incomplete + +trait Super<'a> { + async fn test(); +} +impl Super<'_> for () { + async fn test() {} +} + +trait Foo: for<'a> Super<'a> {} +impl Foo for () {} + +fn test() +where + T: Foo, +{ +} + +fn main() { + test::<()>(); +} diff --git a/tests/ui/async-await/return-type-notation/super-method-bound.stderr b/tests/ui/async-await/return-type-notation/super-method-bound.stderr new file mode 100644 index 000000000..ac0668d3c --- /dev/null +++ b/tests/ui/async-await/return-type-notation/super-method-bound.stderr @@ -0,0 +1,11 @@ +warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/super-method-bound.rs:4:31 + | +LL | #![feature(async_fn_in_trait, return_type_notation)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #109417 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/async-await/return-type-notation/supertrait-bound.rs b/tests/ui/async-await/return-type-notation/supertrait-bound.rs new file mode 100644 index 000000000..19bcfe304 --- /dev/null +++ b/tests/ui/async-await/return-type-notation/supertrait-bound.rs @@ -0,0 +1,11 @@ +// check-pass + +#![feature(return_position_impl_trait_in_trait, return_type_notation)] +//~^ WARN the feature `return_type_notation` is incomplete and may not be safe to use + +trait IntFactory { + fn stream(&self) -> impl Iterator; +} +trait SendIntFactory: IntFactory + Send {} + +fn main() {} diff --git a/tests/ui/async-await/return-type-notation/supertrait-bound.stderr b/tests/ui/async-await/return-type-notation/supertrait-bound.stderr new file mode 100644 index 000000000..c8cec4946 --- /dev/null +++ b/tests/ui/async-await/return-type-notation/supertrait-bound.stderr @@ -0,0 +1,11 @@ +warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/supertrait-bound.rs:3:49 + | +LL | #![feature(return_position_impl_trait_in_trait, return_type_notation)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #109417 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + -- cgit v1.2.3