summaryrefslogtreecommitdiffstats
path: root/tests/ui/impl-trait
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /tests/ui/impl-trait
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/impl-trait')
-rw-r--r--tests/ui/impl-trait/alias-liveness/rpit-hidden-erased-unsoundness.rs25
-rw-r--r--tests/ui/impl-trait/alias-liveness/rpit-hidden-erased-unsoundness.stderr18
-rw-r--r--tests/ui/impl-trait/alias-liveness/rpit-hide-lifetime-for-swap.rs32
-rw-r--r--tests/ui/impl-trait/alias-liveness/rpit-hide-lifetime-for-swap.stderr18
-rw-r--r--tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.rs28
-rw-r--r--tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.stderr13
-rw-r--r--tests/ui/impl-trait/arg-position-impl-trait-too-long.stderr2
-rw-r--r--tests/ui/impl-trait/async_scope_creep.rs13
-rw-r--r--tests/ui/impl-trait/auto-trait-coherence.next.stderr (renamed from tests/ui/impl-trait/auto-trait.stderr)2
-rw-r--r--tests/ui/impl-trait/auto-trait-coherence.old.stderr12
-rw-r--r--tests/ui/impl-trait/auto-trait-coherence.rs (renamed from tests/ui/impl-trait/auto-trait.rs)3
-rw-r--r--tests/ui/impl-trait/auto-trait-leak.rs2
-rw-r--r--tests/ui/impl-trait/auto-trait-leak.stderr68
-rw-r--r--tests/ui/impl-trait/bivariant-lifetime-liveness.rs15
-rw-r--r--tests/ui/impl-trait/bounds_regression.rs10
-rw-r--r--tests/ui/impl-trait/cross-return-site-inference.rs4
-rw-r--r--tests/ui/impl-trait/cross-return-site-inference.stderr27
-rw-r--r--tests/ui/impl-trait/erased-regions-in-hidden-ty.current.stderr14
-rw-r--r--tests/ui/impl-trait/erased-regions-in-hidden-ty.next.stderr14
-rw-r--r--tests/ui/impl-trait/erased-regions-in-hidden-ty.rs23
-rw-r--r--tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/anonymize-binders-for-refine.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/assumed-wf-bounds-in-impl.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/async-and-ret-ref.rs11
-rw-r--r--tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr14
-rw-r--r--tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr4
-rw-r--r--tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr4
-rw-r--r--tests/ui/impl-trait/in-trait/box-coerce-span-in-default.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.stderr4
-rw-r--r--tests/ui/impl-trait/in-trait/deep-match-works.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/deep-match.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/deep-match.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/default-body-type-err-2.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/default-body-type-err.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/default-body-type-err.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/default-body-with-rpit.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/default-body.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/default-method-binder-shifting.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/default-method-constraint.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/doesnt-satisfy.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr4
-rw-r--r--tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/early.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/encode.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/foreign-dyn-error.stderr1
-rw-r--r--tests/ui/impl-trait/in-trait/gat-outlives.rs17
-rw-r--r--tests/ui/impl-trait/in-trait/gat-outlives.stderr24
-rw-r--r--tests/ui/impl-trait/in-trait/generics-mismatch.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/generics-mismatch.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/issue-102140.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/issue-102140.stderr6
-rw-r--r--tests/ui/impl-trait/in-trait/issue-102301.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/issue-102571.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/issue-102571.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/lifetime-in-associated-trait-bound.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr6
-rw-r--r--tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr4
-rw-r--r--tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr4
-rw-r--r--tests/ui/impl-trait/in-trait/method-signature-matches.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/method-signature-matches.too_few.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/method-signature-matches.too_many.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/nested-rpitit-bounds.rs11
-rw-r--r--tests/ui/impl-trait/in-trait/nested-rpitit.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/object-safety-sized.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/object-safety.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/object-safety.stderr20
-rw-r--r--tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/opaque-in-impl.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/opaque-variances.rs14
-rw-r--r--tests/ui/impl-trait/in-trait/outlives-in-nested-rpit.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/refine.rs12
-rw-r--r--tests/ui/impl-trait/in-trait/refine.stderr14
-rw-r--r--tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr4
-rw-r--r--tests/ui/impl-trait/in-trait/reveal.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr4
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr4
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/sibling-function-constraint.rs21
-rw-r--r--tests/ui/impl-trait/in-trait/sibling-function-constraint.stderr17
-rw-r--r--tests/ui/impl-trait/in-trait/signature-mismatch.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/specialization-broken.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/specialization-broken.stderr10
-rw-r--r--tests/ui/impl-trait/in-trait/specialization-substs-remap.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/success.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/suggest-missing-item.fixed5
-rw-r--r--tests/ui/impl-trait/in-trait/suggest-missing-item.rs5
-rw-r--r--tests/ui/impl-trait/in-trait/suggest-missing-item.stderr6
-rw-r--r--tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/unconstrained-lt.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/unconstrained-lt.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/variance.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/variances-of-gat.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/wf-bounds.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/wf-bounds.stderr12
-rw-r--r--tests/ui/impl-trait/in-trait/where-clause.rs1
-rw-r--r--tests/ui/impl-trait/issue-55872-2.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-54600.rs2
-rw-r--r--tests/ui/impl-trait/issues/issue-54600.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-54840.rs2
-rw-r--r--tests/ui/impl-trait/issues/issue-54840.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-58504.rs10
-rw-r--r--tests/ui/impl-trait/issues/issue-58504.stderr4
-rw-r--r--tests/ui/impl-trait/issues/issue-58956.rs4
-rw-r--r--tests/ui/impl-trait/issues/issue-58956.stderr4
-rw-r--r--tests/ui/impl-trait/issues/issue-62742.stderr5
-rw-r--r--tests/ui/impl-trait/issues/issue-70971.rs2
-rw-r--r--tests/ui/impl-trait/issues/issue-70971.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-79099.rs2
-rw-r--r--tests/ui/impl-trait/issues/issue-79099.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.rs4
-rw-r--r--tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.stderr4
-rw-r--r--tests/ui/impl-trait/issues/issue-84073.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-84919.rs2
-rw-r--r--tests/ui/impl-trait/issues/issue-84919.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-86642.rs2
-rw-r--r--tests/ui/impl-trait/issues/issue-86642.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-87295.rs2
-rw-r--r--tests/ui/impl-trait/issues/issue-87295.stderr2
-rw-r--r--tests/ui/impl-trait/lifetimes.rs4
-rw-r--r--tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr7
-rw-r--r--tests/ui/impl-trait/negative-reasoning.stderr2
-rw-r--r--tests/ui/impl-trait/nested-return-type2-tait2.rs4
-rw-r--r--tests/ui/impl-trait/nested-return-type2-tait2.stderr23
-rw-r--r--tests/ui/impl-trait/nested-return-type2-tait3.rs4
-rw-r--r--tests/ui/impl-trait/nested-return-type2-tait3.stderr25
-rw-r--r--tests/ui/impl-trait/nested_impl_trait.rs2
-rw-r--r--tests/ui/impl-trait/nested_impl_trait.stderr2
-rw-r--r--tests/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr6
-rw-r--r--tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr6
-rw-r--r--tests/ui/impl-trait/recursive-coroutine.rs (renamed from tests/ui/impl-trait/recursive-generator.rs)10
-rw-r--r--tests/ui/impl-trait/recursive-coroutine.stderr (renamed from tests/ui/impl-trait/recursive-generator.stderr)6
-rw-r--r--tests/ui/impl-trait/recursive-impl-trait-type-indirect.rs14
-rw-r--r--tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr16
-rw-r--r--tests/ui/impl-trait/static-lifetime-return-position-impl-trait.rs2
-rw-r--r--tests/ui/impl-trait/type_parameters_captured.stderr7
-rw-r--r--tests/ui/impl-trait/unactionable_diagnostic.fixed2
-rw-r--r--tests/ui/impl-trait/unactionable_diagnostic.rs2
-rw-r--r--tests/ui/impl-trait/unactionable_diagnostic.stderr5
-rw-r--r--tests/ui/impl-trait/universal-mismatched-type.stderr2
-rw-r--r--tests/ui/impl-trait/where-allowed-2.stderr6
-rw-r--r--tests/ui/impl-trait/where-allowed.rs79
-rw-r--r--tests/ui/impl-trait/where-allowed.stderr146
155 files changed, 709 insertions, 457 deletions
diff --git a/tests/ui/impl-trait/alias-liveness/rpit-hidden-erased-unsoundness.rs b/tests/ui/impl-trait/alias-liveness/rpit-hidden-erased-unsoundness.rs
new file mode 100644
index 000000000..6863a3c73
--- /dev/null
+++ b/tests/ui/impl-trait/alias-liveness/rpit-hidden-erased-unsoundness.rs
@@ -0,0 +1,25 @@
+// This test should never pass!
+
+#![feature(type_alias_impl_trait)]
+
+trait Captures<'a> {}
+impl<T> Captures<'_> for T {}
+
+struct MyTy<'a, 'b>(Option<*mut &'a &'b ()>);
+unsafe impl Send for MyTy<'_, 'static> {}
+
+fn step1<'a, 'b: 'a>() -> impl Sized + Captures<'b> + 'a {
+ MyTy::<'a, 'b>(None)
+}
+
+fn step2<'a, 'b: 'a>() -> impl Sized + 'a {
+ step1::<'a, 'b>()
+ //~^ ERROR hidden type for `impl Sized + 'a` captures lifetime that does not appear in bounds
+}
+
+fn step3<'a, 'b: 'a>() -> impl Send + 'a {
+ step2::<'a, 'b>()
+ // This should not be Send unless `'b: 'static`
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/alias-liveness/rpit-hidden-erased-unsoundness.stderr b/tests/ui/impl-trait/alias-liveness/rpit-hidden-erased-unsoundness.stderr
new file mode 100644
index 000000000..168a5aa18
--- /dev/null
+++ b/tests/ui/impl-trait/alias-liveness/rpit-hidden-erased-unsoundness.stderr
@@ -0,0 +1,18 @@
+error[E0700]: hidden type for `impl Sized + 'a` captures lifetime that does not appear in bounds
+ --> $DIR/rpit-hidden-erased-unsoundness.rs:16:5
+ |
+LL | fn step2<'a, 'b: 'a>() -> impl Sized + 'a {
+ | -- --------------- opaque type defined here
+ | |
+ | hidden type `impl Captures<'b> + 'a` captures the lifetime `'b` as defined here
+LL | step1::<'a, 'b>()
+ | ^^^^^^^^^^^^^^^^^
+ |
+help: to declare that `impl Sized + 'a` captures `'b`, you can add an explicit `'b` lifetime bound
+ |
+LL | fn step2<'a, 'b: 'a>() -> impl Sized + 'a + 'b {
+ | ++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0700`.
diff --git a/tests/ui/impl-trait/alias-liveness/rpit-hide-lifetime-for-swap.rs b/tests/ui/impl-trait/alias-liveness/rpit-hide-lifetime-for-swap.rs
new file mode 100644
index 000000000..4de2ffbb8
--- /dev/null
+++ b/tests/ui/impl-trait/alias-liveness/rpit-hide-lifetime-for-swap.rs
@@ -0,0 +1,32 @@
+// This test should never pass!
+
+use std::cell::RefCell;
+use std::rc::Rc;
+
+trait Swap: Sized {
+ fn swap(self, other: Self);
+}
+
+impl<T> Swap for Rc<RefCell<T>> {
+ fn swap(self, other: Self) {
+ <RefCell<T>>::swap(&self, &other);
+ }
+}
+
+fn hide<'a, 'b: 'a, T: 'static>(x: Rc<RefCell<&'b T>>) -> impl Swap + 'a {
+ x
+ //~^ ERROR hidden type for `impl Swap + 'a` captures lifetime that does not appear in bounds
+}
+
+fn dangle() -> &'static [i32; 3] {
+ let long = Rc::new(RefCell::new(&[4, 5, 6]));
+ let x = [1, 2, 3];
+ let short = Rc::new(RefCell::new(&x));
+ hide(long.clone()).swap(hide(short));
+ let res: &'static [i32; 3] = *long.borrow();
+ res
+}
+
+fn main() {
+ println!("{:?}", dangle());
+}
diff --git a/tests/ui/impl-trait/alias-liveness/rpit-hide-lifetime-for-swap.stderr b/tests/ui/impl-trait/alias-liveness/rpit-hide-lifetime-for-swap.stderr
new file mode 100644
index 000000000..cabba4baf
--- /dev/null
+++ b/tests/ui/impl-trait/alias-liveness/rpit-hide-lifetime-for-swap.stderr
@@ -0,0 +1,18 @@
+error[E0700]: hidden type for `impl Swap + 'a` captures lifetime that does not appear in bounds
+ --> $DIR/rpit-hide-lifetime-for-swap.rs:17:5
+ |
+LL | fn hide<'a, 'b: 'a, T: 'static>(x: Rc<RefCell<&'b T>>) -> impl Swap + 'a {
+ | -- -------------- opaque type defined here
+ | |
+ | hidden type `Rc<RefCell<&'b T>>` captures the lifetime `'b` as defined here
+LL | x
+ | ^
+ |
+help: to declare that `impl Swap + 'a` captures `'b`, you can add an explicit `'b` lifetime bound
+ |
+LL | fn hide<'a, 'b: 'a, T: 'static>(x: Rc<RefCell<&'b T>>) -> impl Swap + 'a + 'b {
+ | ++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0700`.
diff --git a/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.rs b/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.rs
new file mode 100644
index 000000000..40efd941e
--- /dev/null
+++ b/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.rs
@@ -0,0 +1,28 @@
+// This test should never pass!
+
+#![feature(type_alias_impl_trait)]
+
+trait Captures<'a> {}
+impl<T> Captures<'_> for T {}
+
+struct MyTy<'a, 'b>(Option<*mut &'a &'b ()>);
+unsafe impl Send for MyTy<'_, 'static> {}
+
+fn step1<'a, 'b: 'a>() -> impl Sized + Captures<'b> + 'a {
+ MyTy::<'a, 'b>(None)
+}
+
+mod tait {
+ type Tait<'a> = impl Sized + 'a;
+ pub(super) fn step2<'a, 'b: 'a>() -> Tait<'a> {
+ super::step1::<'a, 'b>()
+ //~^ ERROR hidden type for `Tait<'a>` captures lifetime that does not appear in bounds
+ }
+}
+
+fn step3<'a, 'b: 'a>() -> impl Send + 'a {
+ tait::step2::<'a, 'b>()
+ // This should not be Send unless `'b: 'static`
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.stderr b/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.stderr
new file mode 100644
index 000000000..baeec6d58
--- /dev/null
+++ b/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.stderr
@@ -0,0 +1,13 @@
+error[E0700]: hidden type for `Tait<'a>` captures lifetime that does not appear in bounds
+ --> $DIR/tait-hidden-erased-unsoundness.rs:18:9
+ |
+LL | type Tait<'a> = impl Sized + 'a;
+ | --------------- opaque type defined here
+LL | pub(super) fn step2<'a, 'b: 'a>() -> Tait<'a> {
+ | -- hidden type `impl Captures<'b> + 'a` captures the lifetime `'b` as defined here
+LL | super::step1::<'a, 'b>()
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0700`.
diff --git a/tests/ui/impl-trait/arg-position-impl-trait-too-long.stderr b/tests/ui/impl-trait/arg-position-impl-trait-too-long.stderr
index 40446a3d3..d5086c7bc 100644
--- a/tests/ui/impl-trait/arg-position-impl-trait-too-long.stderr
+++ b/tests/ui/impl-trait/arg-position-impl-trait-too-long.stderr
@@ -7,7 +7,7 @@ LL | | &mut Header,
LL | | &mut [EntryMetadata],
LL | | &mut [Entry<C::EncodedKey, C::EncodedValue>]
LL | | ) -> R,
- | |__________- this type parameter
+ | |__________- expected this type parameter
LL | ) {
LL | let () = y;
| ^^ - this expression has type `impl FnOnce(&mut Header, &mut [EntryMetadata], &mut [Entry<C::EncodedKey, C::EncodedValue>]) -> R`
diff --git a/tests/ui/impl-trait/async_scope_creep.rs b/tests/ui/impl-trait/async_scope_creep.rs
index 7a9d64d33..60975439a 100644
--- a/tests/ui/impl-trait/async_scope_creep.rs
+++ b/tests/ui/impl-trait/async_scope_creep.rs
@@ -1,6 +1,7 @@
#![feature(type_alias_impl_trait)]
// edition:2021
// check-pass
+// revisions: tait rpit
struct Pending {}
@@ -12,17 +13,25 @@ impl AsyncRead for i32 {}
type PendingReader<'a> = impl AsyncRead + 'a;
-type OpeningReadFuture<'a> =
- impl std::future::Future<Output = Result<PendingReader<'a>, CantOpen>>;
+#[cfg(tait)]
+type OpeningReadFuture<'a> = impl std::future::Future<Output = Result<PendingReader<'a>, CantOpen>>;
impl Pending {
async fn read(&mut self) -> Result<impl AsyncRead + '_, CantOpen> {
Ok(42)
}
+ #[cfg(tait)]
fn read_fut(&mut self) -> OpeningReadFuture<'_> {
self.read()
}
+
+ #[cfg(rpit)]
+ fn read_fut(
+ &mut self,
+ ) -> impl std::future::Future<Output = Result<PendingReader<'_>, CantOpen>> {
+ self.read()
+ }
}
fn main() {}
diff --git a/tests/ui/impl-trait/auto-trait.stderr b/tests/ui/impl-trait/auto-trait-coherence.next.stderr
index 81009413c..7833ac688 100644
--- a/tests/ui/impl-trait/auto-trait.stderr
+++ b/tests/ui/impl-trait/auto-trait-coherence.next.stderr
@@ -1,5 +1,5 @@
error[E0119]: conflicting implementations of trait `AnotherTrait` for type `D<OpaqueType>`
- --> $DIR/auto-trait.rs:21:1
+ --> $DIR/auto-trait-coherence.rs:24:1
|
LL | impl<T: Send> AnotherTrait for T {}
| -------------------------------- first implementation here
diff --git a/tests/ui/impl-trait/auto-trait-coherence.old.stderr b/tests/ui/impl-trait/auto-trait-coherence.old.stderr
new file mode 100644
index 000000000..7833ac688
--- /dev/null
+++ b/tests/ui/impl-trait/auto-trait-coherence.old.stderr
@@ -0,0 +1,12 @@
+error[E0119]: conflicting implementations of trait `AnotherTrait` for type `D<OpaqueType>`
+ --> $DIR/auto-trait-coherence.rs:24:1
+ |
+LL | impl<T: Send> AnotherTrait for T {}
+ | -------------------------------- first implementation here
+...
+LL | impl AnotherTrait for D<OpaqueType> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<OpaqueType>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/tests/ui/impl-trait/auto-trait.rs b/tests/ui/impl-trait/auto-trait-coherence.rs
index 35994e4a5..a5cd01a87 100644
--- a/tests/ui/impl-trait/auto-trait.rs
+++ b/tests/ui/impl-trait/auto-trait-coherence.rs
@@ -1,3 +1,6 @@
+// revisions: old next
+//[next] compile-flags: -Ztrait-solver=next
+
// Tests that type alias impls traits do not leak auto-traits for
// the purposes of coherence checking
#![feature(type_alias_impl_trait)]
diff --git a/tests/ui/impl-trait/auto-trait-leak.rs b/tests/ui/impl-trait/auto-trait-leak.rs
index 1f90292f4..de4f523c2 100644
--- a/tests/ui/impl-trait/auto-trait-leak.rs
+++ b/tests/ui/impl-trait/auto-trait-leak.rs
@@ -9,8 +9,6 @@ fn main() {}
// independently resolved and only require the concrete
// return type, which can't depend on the obligation.
fn cycle1() -> impl Clone {
- //~^ ERROR cycle detected
- //~| ERROR cycle detected
send(cycle2().clone());
Rc::new(Cell::new(5))
diff --git a/tests/ui/impl-trait/auto-trait-leak.stderr b/tests/ui/impl-trait/auto-trait-leak.stderr
index 62341f6de..28643ec03 100644
--- a/tests/ui/impl-trait/auto-trait-leak.stderr
+++ b/tests/ui/impl-trait/auto-trait-leak.stderr
@@ -1,66 +1,5 @@
-error[E0391]: cycle detected when computing type of opaque `cycle1::{opaque#0}`
- --> $DIR/auto-trait-leak.rs:11:16
- |
-LL | fn cycle1() -> impl Clone {
- | ^^^^^^^^^^
- |
-note: ...which requires type-checking `cycle1`...
- --> $DIR/auto-trait-leak.rs:14:5
- |
-LL | send(cycle2().clone());
- | ^^^^
- = note: ...which requires evaluating trait selection obligation `cycle2::{opaque#0}: core::marker::Send`...
-note: ...which requires computing type of opaque `cycle2::{opaque#0}`...
- --> $DIR/auto-trait-leak.rs:19:16
- |
-LL | fn cycle2() -> impl Clone {
- | ^^^^^^^^^^
-note: ...which requires type-checking `cycle2`...
- --> $DIR/auto-trait-leak.rs:20:5
- |
-LL | send(cycle1().clone());
- | ^^^^
- = note: ...which requires evaluating trait selection obligation `cycle1::{opaque#0}: core::marker::Send`...
- = note: ...which again requires computing type of opaque `cycle1::{opaque#0}`, completing the cycle
-note: cycle used when computing type of `cycle1::{opaque#0}`
- --> $DIR/auto-trait-leak.rs:11:16
- |
-LL | fn cycle1() -> impl Clone {
- | ^^^^^^^^^^
- = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-
-error[E0391]: cycle detected when computing type of opaque `cycle1::{opaque#0}`
- --> $DIR/auto-trait-leak.rs:11:16
- |
-LL | fn cycle1() -> impl Clone {
- | ^^^^^^^^^^
- |
-note: ...which requires type-checking `cycle1`...
- --> $DIR/auto-trait-leak.rs:14:5
- |
-LL | send(cycle2().clone());
- | ^^^^
- = note: ...which requires evaluating trait selection obligation `cycle2::{opaque#0}: core::marker::Send`...
-note: ...which requires computing type of opaque `cycle2::{opaque#0}`...
- --> $DIR/auto-trait-leak.rs:19:16
- |
-LL | fn cycle2() -> impl Clone {
- | ^^^^^^^^^^
-note: ...which requires type-checking `cycle2`...
- --> $DIR/auto-trait-leak.rs:19:1
- |
-LL | fn cycle2() -> impl Clone {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: ...which again requires computing type of opaque `cycle1::{opaque#0}`, completing the cycle
-note: cycle used when computing type of `cycle1::{opaque#0}`
- --> $DIR/auto-trait-leak.rs:11:16
- |
-LL | fn cycle1() -> impl Clone {
- | ^^^^^^^^^^
- = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-
error: cannot check whether the hidden type of opaque type satisfies auto traits
- --> $DIR/auto-trait-leak.rs:20:10
+ --> $DIR/auto-trait-leak.rs:18:10
|
LL | send(cycle1().clone());
| ---- ^^^^^^^^^^^^^^^^
@@ -73,7 +12,7 @@ note: opaque type is declared here
LL | fn cycle1() -> impl Clone {
| ^^^^^^^^^^
note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
- --> $DIR/auto-trait-leak.rs:19:4
+ --> $DIR/auto-trait-leak.rs:17:4
|
LL | fn cycle2() -> impl Clone {
| ^^^^^^
@@ -83,6 +22,5 @@ note: required by a bound in `send`
LL | fn send<T: Send>(_: T) {}
| ^^^^ required by this bound in `send`
-error: aborting due to 3 previous errors
+error: aborting due to previous error
-For more information about this error, try `rustc --explain E0391`.
diff --git a/tests/ui/impl-trait/bivariant-lifetime-liveness.rs b/tests/ui/impl-trait/bivariant-lifetime-liveness.rs
new file mode 100644
index 000000000..fe99fe3f3
--- /dev/null
+++ b/tests/ui/impl-trait/bivariant-lifetime-liveness.rs
@@ -0,0 +1,15 @@
+// check-pass
+// issue: 116794
+
+// Uncaptured lifetimes should not be required to be live.
+
+struct Invariant<T>(*mut T);
+
+fn opaque<'a: 'a>(_: &'a str) -> Invariant<impl Sized> {
+ Invariant(&mut ())
+}
+
+fn main() {
+ let x = opaque(&String::new());
+ drop(x);
+}
diff --git a/tests/ui/impl-trait/bounds_regression.rs b/tests/ui/impl-trait/bounds_regression.rs
index 31fc46203..f32d83c0c 100644
--- a/tests/ui/impl-trait/bounds_regression.rs
+++ b/tests/ui/impl-trait/bounds_regression.rs
@@ -1,6 +1,6 @@
// run-pass
-pub trait FakeGenerator {
+pub trait FakeCoroutine {
type Yield;
type Return;
}
@@ -9,15 +9,15 @@ pub trait FakeFuture {
type Output;
}
-pub fn future_from_generator<
- T: FakeGenerator<Yield = ()>
+pub fn future_from_coroutine<
+ T: FakeCoroutine<Yield = ()>
>(x: T) -> impl FakeFuture<Output = T::Return> {
GenFuture(x)
}
-struct GenFuture<T: FakeGenerator<Yield = ()>>(#[allow(unused_tuple_struct_fields)] T);
+struct GenFuture<T: FakeCoroutine<Yield = ()>>(#[allow(unused_tuple_struct_fields)] T);
-impl<T: FakeGenerator<Yield = ()>> FakeFuture for GenFuture<T> {
+impl<T: FakeCoroutine<Yield = ()>> FakeFuture for GenFuture<T> {
type Output = T::Return;
}
diff --git a/tests/ui/impl-trait/cross-return-site-inference.rs b/tests/ui/impl-trait/cross-return-site-inference.rs
index 00aed2ad9..e1071b08c 100644
--- a/tests/ui/impl-trait/cross-return-site-inference.rs
+++ b/tests/ui/impl-trait/cross-return-site-inference.rs
@@ -36,13 +36,13 @@ fn muh() -> Result<(), impl std::fmt::Debug> {
fn muh2() -> Result<(), impl std::fmt::Debug> {
return Err(From::from("foo"));
- //~^ ERROR type annotations needed
+ //~^ ERROR cannot call associated function on trait
Ok(())
}
fn muh3() -> Result<(), impl std::fmt::Debug> {
Err(From::from("foo"))
- //~^ ERROR type annotations needed
+ //~^ ERROR cannot call associated function on trait
}
fn main() {}
diff --git a/tests/ui/impl-trait/cross-return-site-inference.stderr b/tests/ui/impl-trait/cross-return-site-inference.stderr
index 766614e9e..8ee3e9abf 100644
--- a/tests/ui/impl-trait/cross-return-site-inference.stderr
+++ b/tests/ui/impl-trait/cross-return-site-inference.stderr
@@ -9,28 +9,29 @@ help: consider specifying the generic arguments
LL | Ok::<(), E>(())
| +++++++++
-error[E0282]: type annotations needed
- --> $DIR/cross-return-site-inference.rs:38:12
+error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
+ --> $DIR/cross-return-site-inference.rs:38:16
|
LL | return Err(From::from("foo"));
- | ^^^ cannot infer type of the type parameter `E` declared on the enum `Result`
+ | ^^^^^^^^^^ cannot call associated function of trait
|
-help: consider specifying the generic arguments
+help: use a fully-qualified path to a specific available implementation
|
-LL | return Err::<(), E>(From::from("foo"));
- | +++++++++
+LL | return Err(</* self type */ as From>::from("foo"));
+ | +++++++++++++++++++ +
-error[E0282]: type annotations needed
- --> $DIR/cross-return-site-inference.rs:44:5
+error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
+ --> $DIR/cross-return-site-inference.rs:44:9
|
LL | Err(From::from("foo"))
- | ^^^ cannot infer type of the type parameter `E` declared on the enum `Result`
+ | ^^^^^^^^^^ cannot call associated function of trait
|
-help: consider specifying the generic arguments
+help: use a fully-qualified path to a specific available implementation
|
-LL | Err::<(), E>(From::from("foo"))
- | +++++++++
+LL | Err(</* self type */ as From>::from("foo"))
+ | +++++++++++++++++++ +
error: aborting due to 3 previous errors
-For more information about this error, try `rustc --explain E0282`.
+Some errors have detailed explanations: E0282, E0790.
+For more information about an error, try `rustc --explain E0282`.
diff --git a/tests/ui/impl-trait/erased-regions-in-hidden-ty.current.stderr b/tests/ui/impl-trait/erased-regions-in-hidden-ty.current.stderr
new file mode 100644
index 000000000..84b61dc50
--- /dev/null
+++ b/tests/ui/impl-trait/erased-regions-in-hidden-ty.current.stderr
@@ -0,0 +1,14 @@
+error: {foo<ReEarlyBound(DefId(..), 0, 'a)>::{closure#0} closure_kind_ty=i8 closure_sig_as_fn_ptr_ty=extern "rust-call" fn(()) upvar_tys=()}
+ --> $DIR/erased-regions-in-hidden-ty.rs:11:36
+ |
+LL | fn foo<'a: 'a>(x: &'a Vec<i32>) -> impl Fn() + 'static {
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: Opaque(DefId(..), [ReErased])
+ --> $DIR/erased-regions-in-hidden-ty.rs:17:13
+ |
+LL | fn bar() -> impl Fn() + 'static {
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/impl-trait/erased-regions-in-hidden-ty.next.stderr b/tests/ui/impl-trait/erased-regions-in-hidden-ty.next.stderr
new file mode 100644
index 000000000..84b61dc50
--- /dev/null
+++ b/tests/ui/impl-trait/erased-regions-in-hidden-ty.next.stderr
@@ -0,0 +1,14 @@
+error: {foo<ReEarlyBound(DefId(..), 0, 'a)>::{closure#0} closure_kind_ty=i8 closure_sig_as_fn_ptr_ty=extern "rust-call" fn(()) upvar_tys=()}
+ --> $DIR/erased-regions-in-hidden-ty.rs:11:36
+ |
+LL | fn foo<'a: 'a>(x: &'a Vec<i32>) -> impl Fn() + 'static {
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: Opaque(DefId(..), [ReErased])
+ --> $DIR/erased-regions-in-hidden-ty.rs:17:13
+ |
+LL | fn bar() -> impl Fn() + 'static {
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/impl-trait/erased-regions-in-hidden-ty.rs b/tests/ui/impl-trait/erased-regions-in-hidden-ty.rs
new file mode 100644
index 000000000..698123a93
--- /dev/null
+++ b/tests/ui/impl-trait/erased-regions-in-hidden-ty.rs
@@ -0,0 +1,23 @@
+// revisions: current next
+// compile-flags: -Zverbose
+//[next] compile-flags: -Ztrait-solver=next
+// normalize-stderr-test "DefId\([^\)]+\)" -> "DefId(..)"
+
+#![feature(rustc_attrs)]
+#![rustc_hidden_type_of_opaques]
+
+// Make sure that the compiler can handle `ReErased` in the hidden type of an opaque.
+
+fn foo<'a: 'a>(x: &'a Vec<i32>) -> impl Fn() + 'static {
+//~^ ERROR 0, 'a)>::{closure#0} closure_kind_ty=i8 closure_sig_as_fn_ptr_ty=extern "rust-call" fn(()) upvar_tys=()}
+// Can't write whole type because of lack of path sanitization
+ || ()
+}
+
+fn bar() -> impl Fn() + 'static {
+//~^ ERROR , [ReErased])
+// Can't write whole type because of lack of path sanitization
+ foo(&vec![])
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr b/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr
index fad0b812d..d3c2d5d5b 100644
--- a/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr
+++ b/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr
@@ -20,6 +20,7 @@ LL | fn ice() -> impl AsRef<Fn(&())> {
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | fn ice() -> impl AsRef<dyn Fn(&())> {
@@ -33,6 +34,7 @@ LL | fn ice() -> impl AsRef<Fn(&())> {
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | fn ice() -> impl AsRef<dyn Fn(&())> {
diff --git a/tests/ui/impl-trait/in-trait/anonymize-binders-for-refine.rs b/tests/ui/impl-trait/in-trait/anonymize-binders-for-refine.rs
index e62662f2f..09fbef2ec 100644
--- a/tests/ui/impl-trait/in-trait/anonymize-binders-for-refine.rs
+++ b/tests/ui/impl-trait/in-trait/anonymize-binders-for-refine.rs
@@ -1,7 +1,6 @@
// compile-flags: --crate-type=lib
// check-pass
-#![feature(return_position_impl_trait_in_trait)]
#![deny(refining_impl_trait)]
pub trait Tr<T> {
diff --git a/tests/ui/impl-trait/in-trait/assumed-wf-bounds-in-impl.rs b/tests/ui/impl-trait/in-trait/assumed-wf-bounds-in-impl.rs
index 2a61c5cc8..afb9992de 100644
--- a/tests/ui/impl-trait/in-trait/assumed-wf-bounds-in-impl.rs
+++ b/tests/ui/impl-trait/in-trait/assumed-wf-bounds-in-impl.rs
@@ -2,13 +2,13 @@
// edition: 2021
// issue: 113796
-#![feature(async_fn_in_trait)]
trait AsyncLendingIterator {
type Item<'a>
where
Self: 'a;
+ #[allow(async_fn_in_trait)]
async fn next(&mut self) -> Option<Self::Item<'_>>;
}
diff --git a/tests/ui/impl-trait/in-trait/async-and-ret-ref.rs b/tests/ui/impl-trait/in-trait/async-and-ret-ref.rs
new file mode 100644
index 000000000..af6ffe833
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/async-and-ret-ref.rs
@@ -0,0 +1,11 @@
+// edition:2021
+// https://github.com/rust-lang/rust/issues/117547
+
+trait T {}
+
+trait MyTrait {
+ async fn foo() -> &'static impl T;
+ //~^ ERROR the associated type `<Self as MyTrait>::{opaque#0}` may not live long enough
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr b/tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr
new file mode 100644
index 000000000..7c9028a8c
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr
@@ -0,0 +1,14 @@
+error[E0310]: the associated type `<Self as MyTrait>::{opaque#0}` may not live long enough
+ --> $DIR/async-and-ret-ref.rs:7:5
+ |
+LL | async fn foo() -> &'static impl T;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | the associated type `<Self as MyTrait>::{opaque#0}` must be valid for the static lifetime...
+ | ...so that the reference type `&'static impl T` does not outlive the data it points at
+ |
+ = help: consider adding an explicit lifetime bound `<Self as MyTrait>::{opaque#0}: 'static`...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0310`.
diff --git a/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs b/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs
index 6e9940211..a213994ff 100644
--- a/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs
+++ b/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs
@@ -1,4 +1,4 @@
-#![feature(return_position_impl_trait_in_trait, lint_reasons)]
+#![feature(lint_reasons)]
use std::ops::Deref;
diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.rs b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.rs
index 3a93dfee5..41d5f0f64 100644
--- a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.rs
+++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.rs
@@ -1,6 +1,5 @@
// issue: 114146
-#![feature(return_position_impl_trait_in_trait)]
trait Foo {
fn bar<'other: 'a>() -> impl Sized + 'a {}
diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr
index 3a1f8f908..b0832eb33 100644
--- a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr
+++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr
@@ -1,5 +1,5 @@
error[E0261]: use of undeclared lifetime name `'a`
- --> $DIR/bad-item-bound-within-rpitit-2.rs:6:20
+ --> $DIR/bad-item-bound-within-rpitit-2.rs:5:20
|
LL | fn bar<'other: 'a>() -> impl Sized + 'a {}
| ^^ undeclared lifetime
@@ -14,7 +14,7 @@ LL | trait Foo<'a> {
| ++++
error[E0261]: use of undeclared lifetime name `'a`
- --> $DIR/bad-item-bound-within-rpitit-2.rs:6:42
+ --> $DIR/bad-item-bound-within-rpitit-2.rs:5:42
|
LL | fn bar<'other: 'a>() -> impl Sized + 'a {}
| ^^ undeclared lifetime
diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs
index fbbbb8585..5ddc97f1a 100644
--- a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs
+++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs
@@ -1,6 +1,5 @@
// issue: 114145
-#![feature(return_position_impl_trait_in_trait)]
pub trait Iterable {
type Item<'a>
diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr
index a5fb338ea..324eaa37a 100644
--- a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr
+++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr
@@ -1,5 +1,5 @@
error[E0276]: impl has stricter requirements than trait
- --> $DIR/bad-item-bound-within-rpitit.rs:16:13
+ --> $DIR/bad-item-bound-within-rpitit.rs:15:13
|
LL | type Item<'a>
| ------------- definition of `Item` from trait
@@ -13,7 +13,7 @@ LL | where Self: 'b;
| ~~~~~~~~~~~~~~
warning: impl trait in impl method signature does not match trait method signature
- --> $DIR/bad-item-bound-within-rpitit.rs:19:28
+ --> $DIR/bad-item-bound-within-rpitit.rs:18:28
|
LL | fn iter(&self) -> impl '_ + Iterator<Item = Self::Item<'_>>;
| ----------------------------------------- return type from trait method defined here
diff --git a/tests/ui/impl-trait/in-trait/box-coerce-span-in-default.rs b/tests/ui/impl-trait/in-trait/box-coerce-span-in-default.rs
index f5ee4690f..87eb7beb1 100644
--- a/tests/ui/impl-trait/in-trait/box-coerce-span-in-default.rs
+++ b/tests/ui/impl-trait/in-trait/box-coerce-span-in-default.rs
@@ -1,6 +1,5 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait)]
struct TestA {}
struct TestB {}
diff --git a/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.rs b/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.rs
index 742537ffc..2845b401b 100644
--- a/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.rs
+++ b/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.rs
@@ -1,5 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-
struct Wrapper<G: Send>(G);
trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.stderr b/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.stderr
index dee87d082..1570b2ecd 100644
--- a/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.stderr
+++ b/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.stderr
@@ -1,12 +1,12 @@
error[E0277]: `impl Sized` cannot be sent between threads safely
- --> $DIR/check-wf-on-non-defaulted-rpitit.rs:6:17
+ --> $DIR/check-wf-on-non-defaulted-rpitit.rs:4:17
|
LL | fn bar() -> Wrapper<impl Sized>;
| ^^^^^^^^^^^^^^^^^^^ `impl Sized` cannot be sent between threads safely
|
= help: the trait `Send` is not implemented for `impl Sized`
note: required by a bound in `Wrapper`
- --> $DIR/check-wf-on-non-defaulted-rpitit.rs:3:19
+ --> $DIR/check-wf-on-non-defaulted-rpitit.rs:1:19
|
LL | struct Wrapper<G: Send>(G);
| ^^^^ required by this bound in `Wrapper`
diff --git a/tests/ui/impl-trait/in-trait/deep-match-works.rs b/tests/ui/impl-trait/in-trait/deep-match-works.rs
index fc290f11f..8c9927438 100644
--- a/tests/ui/impl-trait/in-trait/deep-match-works.rs
+++ b/tests/ui/impl-trait/in-trait/deep-match-works.rs
@@ -1,6 +1,6 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait, lint_reasons)]
+#![feature(lint_reasons)]
#![allow(incomplete_features)]
pub struct Wrapper<T>(T);
diff --git a/tests/ui/impl-trait/in-trait/deep-match.rs b/tests/ui/impl-trait/in-trait/deep-match.rs
index 0cae88f34..82eac7760 100644
--- a/tests/ui/impl-trait/in-trait/deep-match.rs
+++ b/tests/ui/impl-trait/in-trait/deep-match.rs
@@ -1,6 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
struct Wrapper<T>(T);
trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/deep-match.stderr b/tests/ui/impl-trait/in-trait/deep-match.stderr
index f0ad3c16e..a658d8fa0 100644
--- a/tests/ui/impl-trait/in-trait/deep-match.stderr
+++ b/tests/ui/impl-trait/in-trait/deep-match.stderr
@@ -1,5 +1,5 @@
error[E0053]: method `bar` has an incompatible return type for trait
- --> $DIR/deep-match.rs:11:17
+ --> $DIR/deep-match.rs:8:17
|
LL | fn bar() -> i32 {
| ^^^
diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err-2.rs b/tests/ui/impl-trait/in-trait/default-body-type-err-2.rs
index 45ae2b8ad..29bcbe16d 100644
--- a/tests/ui/impl-trait/in-trait/default-body-type-err-2.rs
+++ b/tests/ui/impl-trait/in-trait/default-body-type-err-2.rs
@@ -1,7 +1,6 @@
// edition:2021
#![allow(incomplete_features)]
-#![feature(async_fn_in_trait)]
pub trait Foo {
async fn woopsie_async(&self) -> String {
diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr b/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr
index cc3bdf0e5..fcace10cd 100644
--- a/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr
+++ b/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
- --> $DIR/default-body-type-err-2.rs:8:9
+ --> $DIR/default-body-type-err-2.rs:7:9
|
LL | 42
| ^^- help: try using a conversion method: `.to_string()`
diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err.rs b/tests/ui/impl-trait/in-trait/default-body-type-err.rs
index ac9baf91c..ac7a50a36 100644
--- a/tests/ui/impl-trait/in-trait/default-body-type-err.rs
+++ b/tests/ui/impl-trait/in-trait/default-body-type-err.rs
@@ -1,6 +1,3 @@
-#![allow(incomplete_features)]
-#![feature(return_position_impl_trait_in_trait)]
-
use std::ops::Deref;
pub trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err.stderr b/tests/ui/impl-trait/in-trait/default-body-type-err.stderr
index 4742eb37d..596ff1011 100644
--- a/tests/ui/impl-trait/in-trait/default-body-type-err.stderr
+++ b/tests/ui/impl-trait/in-trait/default-body-type-err.stderr
@@ -1,5 +1,5 @@
error[E0271]: type mismatch resolving `<&i32 as Deref>::Target == String`
- --> $DIR/default-body-type-err.rs:7:22
+ --> $DIR/default-body-type-err.rs:4:22
|
LL | fn lol(&self) -> impl Deref<Target = String> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `String`
diff --git a/tests/ui/impl-trait/in-trait/default-body-with-rpit.rs b/tests/ui/impl-trait/in-trait/default-body-with-rpit.rs
index 25133214d..1d1f55508 100644
--- a/tests/ui/impl-trait/in-trait/default-body-with-rpit.rs
+++ b/tests/ui/impl-trait/in-trait/default-body-with-rpit.rs
@@ -1,12 +1,12 @@
// edition:2021
// check-pass
-#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
use std::fmt::Debug;
trait Foo {
+ #[allow(async_fn_in_trait)]
async fn baz(&self) -> impl Debug {
""
}
diff --git a/tests/ui/impl-trait/in-trait/default-body.rs b/tests/ui/impl-trait/in-trait/default-body.rs
index b0baf5bb1..ff70f1e23 100644
--- a/tests/ui/impl-trait/in-trait/default-body.rs
+++ b/tests/ui/impl-trait/in-trait/default-body.rs
@@ -1,12 +1,12 @@
// check-pass
// edition:2021
-#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
use std::fmt::Debug;
trait Foo {
+ #[allow(async_fn_in_trait)]
async fn baz(&self) -> &str {
""
}
diff --git a/tests/ui/impl-trait/in-trait/default-method-binder-shifting.rs b/tests/ui/impl-trait/in-trait/default-method-binder-shifting.rs
index 817a4d7db..ca41eb8bc 100644
--- a/tests/ui/impl-trait/in-trait/default-method-binder-shifting.rs
+++ b/tests/ui/impl-trait/in-trait/default-method-binder-shifting.rs
@@ -1,6 +1,5 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait)]
trait Trait {
type Type;
diff --git a/tests/ui/impl-trait/in-trait/default-method-constraint.rs b/tests/ui/impl-trait/in-trait/default-method-constraint.rs
index 28d76241f..8ab2e2797 100644
--- a/tests/ui/impl-trait/in-trait/default-method-constraint.rs
+++ b/tests/ui/impl-trait/in-trait/default-method-constraint.rs
@@ -2,7 +2,6 @@
// This didn't work in the previous default RPITIT method hack attempt
-#![feature(return_position_impl_trait_in_trait)]
trait Foo {
fn bar(x: bool) -> impl Sized {
diff --git a/tests/ui/impl-trait/in-trait/doesnt-satisfy.rs b/tests/ui/impl-trait/in-trait/doesnt-satisfy.rs
index bb4e0d44f..0ac60918b 100644
--- a/tests/ui/impl-trait/in-trait/doesnt-satisfy.rs
+++ b/tests/ui/impl-trait/in-trait/doesnt-satisfy.rs
@@ -1,6 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
trait Foo {
fn bar() -> impl std::fmt::Display;
}
diff --git a/tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr b/tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr
index 7c56ffa10..cd45c6a9c 100644
--- a/tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr
+++ b/tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr
@@ -1,5 +1,5 @@
error[E0277]: `()` doesn't implement `std::fmt::Display`
- --> $DIR/doesnt-satisfy.rs:9:17
+ --> $DIR/doesnt-satisfy.rs:6:17
|
LL | fn bar() -> () {}
| ^^ `()` cannot be formatted with the default formatter
@@ -7,7 +7,7 @@ LL | fn bar() -> () {}
= help: the trait `std::fmt::Display` is not implemented for `()`
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
note: required by a bound in `Foo::{opaque#0}`
- --> $DIR/doesnt-satisfy.rs:5:22
+ --> $DIR/doesnt-satisfy.rs:2:22
|
LL | fn bar() -> impl std::fmt::Display;
| ^^^^^^^^^^^^^^^^^ required by this bound in `Foo::{opaque#0}`
diff --git a/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs b/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs
index 4719d5d3c..fe0f011b6 100644
--- a/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs
+++ b/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs
@@ -1,5 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-
trait MyTrait {
fn foo(&self) -> impl Sized;
fn bar(&self) -> impl Sized;
diff --git a/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.stderr b/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.stderr
index 66ee142cc..830e663da 100644
--- a/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.stderr
+++ b/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.stderr
@@ -1,5 +1,5 @@
error[E0046]: not all trait items implemented, missing: `foo`
- --> $DIR/dont-project-to-rpitit-with-no-value.rs:8:1
+ --> $DIR/dont-project-to-rpitit-with-no-value.rs:6:1
|
LL | fn foo(&self) -> impl Sized;
| ---------------------------- `foo` from trait
diff --git a/tests/ui/impl-trait/in-trait/early.rs b/tests/ui/impl-trait/in-trait/early.rs
index 9c1c2b503..c4996674d 100644
--- a/tests/ui/impl-trait/in-trait/early.rs
+++ b/tests/ui/impl-trait/in-trait/early.rs
@@ -1,10 +1,10 @@
// check-pass
// edition:2021
-#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
pub trait Foo {
+ #[allow(async_fn_in_trait)]
async fn bar<'a: 'a>(&'a mut self);
}
diff --git a/tests/ui/impl-trait/in-trait/encode.rs b/tests/ui/impl-trait/in-trait/encode.rs
index efb9f6498..4df26b0f2 100644
--- a/tests/ui/impl-trait/in-trait/encode.rs
+++ b/tests/ui/impl-trait/in-trait/encode.rs
@@ -1,7 +1,6 @@
// build-pass
// compile-flags: --crate-type=lib
-#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/foreign-dyn-error.stderr b/tests/ui/impl-trait/in-trait/foreign-dyn-error.stderr
index bfb2be8cb..f29ec95d5 100644
--- a/tests/ui/impl-trait/in-trait/foreign-dyn-error.stderr
+++ b/tests/ui/impl-trait/in-trait/foreign-dyn-error.stderr
@@ -9,6 +9,7 @@ note: for a trait to be "object safe" it needs to allow building a vtable to all
|
LL | fn bar(self) -> impl Deref<Target = impl Sized>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait cannot be made into an object because method `bar` references an `impl Trait` type in its return type
+ = help: only type `rpitit::Foreign` implements the trait, consider using it directly instead
error: aborting due to previous error
diff --git a/tests/ui/impl-trait/in-trait/gat-outlives.rs b/tests/ui/impl-trait/in-trait/gat-outlives.rs
new file mode 100644
index 000000000..83dd6cfce
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/gat-outlives.rs
@@ -0,0 +1,17 @@
+// edition: 2021
+
+use std::future::Future;
+
+trait Trait {
+ type Gat<'a>;
+ //~^ ERROR missing required bound on `Gat`
+ async fn foo(&self) -> Self::Gat<'_>;
+}
+
+trait Trait2 {
+ type Gat<'a>;
+ //~^ ERROR missing required bound on `Gat`
+ async fn foo(&self) -> impl Future<Output = Self::Gat<'_>>;
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/gat-outlives.stderr b/tests/ui/impl-trait/in-trait/gat-outlives.stderr
new file mode 100644
index 000000000..8ec4b0ab2
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/gat-outlives.stderr
@@ -0,0 +1,24 @@
+error: missing required bound on `Gat`
+ --> $DIR/gat-outlives.rs:6:5
+ |
+LL | type Gat<'a>;
+ | ^^^^^^^^^^^^-
+ | |
+ | help: add the required where clause: `where Self: 'a`
+ |
+ = note: this bound is currently required to ensure that impls have maximum flexibility
+ = note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information
+
+error: missing required bound on `Gat`
+ --> $DIR/gat-outlives.rs:12:5
+ |
+LL | type Gat<'a>;
+ | ^^^^^^^^^^^^-
+ | |
+ | help: add the required where clause: `where Self: 'a`
+ |
+ = note: this bound is currently required to ensure that impls have maximum flexibility
+ = note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/impl-trait/in-trait/generics-mismatch.rs b/tests/ui/impl-trait/in-trait/generics-mismatch.rs
index cc0fc720e..3ea31cc93 100644
--- a/tests/ui/impl-trait/in-trait/generics-mismatch.rs
+++ b/tests/ui/impl-trait/in-trait/generics-mismatch.rs
@@ -1,6 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
struct U;
trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/generics-mismatch.stderr b/tests/ui/impl-trait/in-trait/generics-mismatch.stderr
index cd42683e0..043dbc8db 100644
--- a/tests/ui/impl-trait/in-trait/generics-mismatch.stderr
+++ b/tests/ui/impl-trait/in-trait/generics-mismatch.stderr
@@ -1,5 +1,5 @@
error[E0049]: method `bar` has 1 type parameter but its trait declaration has 0 type parameters
- --> $DIR/generics-mismatch.rs:11:12
+ --> $DIR/generics-mismatch.rs:8:12
|
LL | fn bar(&self) -> impl Sized;
| - expected 0 type parameters
diff --git a/tests/ui/impl-trait/in-trait/issue-102140.rs b/tests/ui/impl-trait/in-trait/issue-102140.rs
index be1e012ac..796001848 100644
--- a/tests/ui/impl-trait/in-trait/issue-102140.rs
+++ b/tests/ui/impl-trait/in-trait/issue-102140.rs
@@ -1,6 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
trait Marker {}
impl Marker for u32 {}
diff --git a/tests/ui/impl-trait/in-trait/issue-102140.stderr b/tests/ui/impl-trait/in-trait/issue-102140.stderr
index 18bb63745..9cd2cdfd1 100644
--- a/tests/ui/impl-trait/in-trait/issue-102140.stderr
+++ b/tests/ui/impl-trait/in-trait/issue-102140.stderr
@@ -1,5 +1,5 @@
error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied
- --> $DIR/issue-102140.rs:23:22
+ --> $DIR/issue-102140.rs:20:22
|
LL | MyTrait::foo(&self)
| ------------ ^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait`
@@ -13,7 +13,7 @@ LL + MyTrait::foo(self)
|
error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied
- --> $DIR/issue-102140.rs:23:9
+ --> $DIR/issue-102140.rs:20:9
|
LL | MyTrait::foo(&self)
| ^^^^^^^^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait`
@@ -21,7 +21,7 @@ LL | MyTrait::foo(&self)
= help: the trait `MyTrait` is implemented for `Outer`
error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied
- --> $DIR/issue-102140.rs:23:9
+ --> $DIR/issue-102140.rs:20:9
|
LL | MyTrait::foo(&self)
| ^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait`
diff --git a/tests/ui/impl-trait/in-trait/issue-102301.rs b/tests/ui/impl-trait/in-trait/issue-102301.rs
index a93714a65..600a21b07 100644
--- a/tests/ui/impl-trait/in-trait/issue-102301.rs
+++ b/tests/ui/impl-trait/in-trait/issue-102301.rs
@@ -1,6 +1,5 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
trait Foo<T> {
diff --git a/tests/ui/impl-trait/in-trait/issue-102571.rs b/tests/ui/impl-trait/in-trait/issue-102571.rs
index ccb53031c..4fa3fdd31 100644
--- a/tests/ui/impl-trait/in-trait/issue-102571.rs
+++ b/tests/ui/impl-trait/in-trait/issue-102571.rs
@@ -1,6 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
use std::fmt::Display;
use std::ops::Deref;
diff --git a/tests/ui/impl-trait/in-trait/issue-102571.stderr b/tests/ui/impl-trait/in-trait/issue-102571.stderr
index 594b9ae9c..872988faf 100644
--- a/tests/ui/impl-trait/in-trait/issue-102571.stderr
+++ b/tests/ui/impl-trait/in-trait/issue-102571.stderr
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
- --> $DIR/issue-102571.rs:12:9
+ --> $DIR/issue-102571.rs:9:9
|
LL | let () = t.bar();
| ^^ ------- this expression has type `impl Deref<Target = impl std::fmt::Display + ?Sized>`
diff --git a/tests/ui/impl-trait/in-trait/lifetime-in-associated-trait-bound.rs b/tests/ui/impl-trait/in-trait/lifetime-in-associated-trait-bound.rs
index 49d36d6c9..4073ef8ac 100644
--- a/tests/ui/impl-trait/in-trait/lifetime-in-associated-trait-bound.rs
+++ b/tests/ui/impl-trait/in-trait/lifetime-in-associated-trait-bound.rs
@@ -1,6 +1,6 @@
// check-pass
-#![feature(associated_type_bounds, return_position_impl_trait_in_trait)]
+#![feature(associated_type_bounds)]
trait Trait {
type Type;
diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr
index 239c4b35c..874a1b95a 100644
--- a/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr
+++ b/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr
@@ -1,15 +1,15 @@
error[E0053]: method `early` has an incompatible type for trait
- --> $DIR/method-signature-matches.rs:58:27
+ --> $DIR/method-signature-matches.rs:57:27
|
LL | fn early<'late, T>(_: &'late ()) {}
| - ^^^^^^^^^
| | |
| | expected type parameter `T`, found `()`
| | help: change the parameter type to match the trait: `&T`
- | this type parameter
+ | expected this type parameter
|
note: type in trait
- --> $DIR/method-signature-matches.rs:53:28
+ --> $DIR/method-signature-matches.rs:52:28
|
LL | fn early<'early, T>(x: &'early T) -> impl Sized;
| ^^^^^^^^^
diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr
index d3183b92e..e0bd1cc4f 100644
--- a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr
+++ b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr
@@ -1,5 +1,5 @@
error[E0053]: method `owo` has an incompatible type for trait
- --> $DIR/method-signature-matches.rs:14:15
+ --> $DIR/method-signature-matches.rs:13:15
|
LL | fn owo(_: u8) {}
| ^^
@@ -8,7 +8,7 @@ LL | fn owo(_: u8) {}
| help: change the parameter type to match the trait: `()`
|
note: type in trait
- --> $DIR/method-signature-matches.rs:9:15
+ --> $DIR/method-signature-matches.rs:8:15
|
LL | fn owo(x: ()) -> impl Sized;
| ^^
diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr
index 80fda1c9f..096e96c85 100644
--- a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr
+++ b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr
@@ -1,5 +1,5 @@
error[E0053]: method `owo` has an incompatible type for trait
- --> $DIR/method-signature-matches.rs:25:21
+ --> $DIR/method-signature-matches.rs:24:21
|
LL | async fn owo(_: u8) {}
| ^^
@@ -8,7 +8,7 @@ LL | async fn owo(_: u8) {}
| help: change the parameter type to match the trait: `()`
|
note: type in trait
- --> $DIR/method-signature-matches.rs:20:21
+ --> $DIR/method-signature-matches.rs:19:21
|
LL | async fn owo(x: ()) {}
| ^^
diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.rs b/tests/ui/impl-trait/in-trait/method-signature-matches.rs
index 294f93b30..99ace66fa 100644
--- a/tests/ui/impl-trait/in-trait/method-signature-matches.rs
+++ b/tests/ui/impl-trait/in-trait/method-signature-matches.rs
@@ -1,7 +1,6 @@
// edition: 2021
// revisions: mismatch mismatch_async too_many too_few lt
-#![feature(return_position_impl_trait_in_trait, async_fn_in_trait)]
#![allow(incomplete_features)]
#[cfg(mismatch)]
diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.too_few.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.too_few.stderr
index 24bcfeb74..96eff1a58 100644
--- a/tests/ui/impl-trait/in-trait/method-signature-matches.too_few.stderr
+++ b/tests/ui/impl-trait/in-trait/method-signature-matches.too_few.stderr
@@ -1,5 +1,5 @@
error[E0050]: method `come_on_a_little_more_effort` has 0 parameters but the declaration in trait `TooLittle::come_on_a_little_more_effort` has 3
- --> $DIR/method-signature-matches.rs:47:5
+ --> $DIR/method-signature-matches.rs:46:5
|
LL | fn come_on_a_little_more_effort(_: (), _: (), _: ()) -> impl Sized;
| ---------------- trait requires 3 parameters
diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.too_many.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.too_many.stderr
index 616cbd290..0fc847051 100644
--- a/tests/ui/impl-trait/in-trait/method-signature-matches.too_many.stderr
+++ b/tests/ui/impl-trait/in-trait/method-signature-matches.too_many.stderr
@@ -1,5 +1,5 @@
error[E0050]: method `calm_down_please` has 3 parameters but the declaration in trait `TooMuch::calm_down_please` has 0
- --> $DIR/method-signature-matches.rs:36:28
+ --> $DIR/method-signature-matches.rs:35:28
|
LL | fn calm_down_please() -> impl Sized;
| ------------------------------------ trait requires 0 parameters
diff --git a/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.rs b/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.rs
index abc845d3a..6088dcc61 100644
--- a/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.rs
+++ b/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.rs
@@ -1,5 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-
trait Iterable {
type Item<'a>
where
diff --git a/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.stderr b/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.stderr
index 0d74c0b69..1fd678a1f 100644
--- a/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.stderr
+++ b/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.stderr
@@ -1,5 +1,5 @@
error[E0261]: use of undeclared lifetime name `'missing`
- --> $DIR/missing-lt-outlives-in-rpitit-114274.rs:8:55
+ --> $DIR/missing-lt-outlives-in-rpitit-114274.rs:6:55
|
LL | fn iter(&self) -> impl Iterator<Item = Self::Item<'missing>>;
| ^^^^^^^^ undeclared lifetime
diff --git a/tests/ui/impl-trait/in-trait/nested-rpitit-bounds.rs b/tests/ui/impl-trait/in-trait/nested-rpitit-bounds.rs
new file mode 100644
index 000000000..b97fd7d1f
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/nested-rpitit-bounds.rs
@@ -0,0 +1,11 @@
+// check-pass
+
+use std::ops::Deref;
+
+trait Foo {
+ fn foo() -> impl Deref<Target = impl Deref<Target = impl Sized>> {
+ &&()
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/nested-rpitit.rs b/tests/ui/impl-trait/in-trait/nested-rpitit.rs
index 58ba1acaf..58b79c991 100644
--- a/tests/ui/impl-trait/in-trait/nested-rpitit.rs
+++ b/tests/ui/impl-trait/in-trait/nested-rpitit.rs
@@ -1,6 +1,6 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait, lint_reasons)]
+#![feature(lint_reasons)]
#![allow(incomplete_features)]
use std::fmt::Display;
diff --git a/tests/ui/impl-trait/in-trait/object-safety-sized.rs b/tests/ui/impl-trait/in-trait/object-safety-sized.rs
index f221cfbb1..35afe80c9 100644
--- a/tests/ui/impl-trait/in-trait/object-safety-sized.rs
+++ b/tests/ui/impl-trait/in-trait/object-safety-sized.rs
@@ -2,7 +2,6 @@
// revisions: current next
//[next] compile-flags: -Ztrait-solver=next
-#![feature(return_position_impl_trait_in_trait)]
fn main() {
let vec: Vec<Box<dyn Trait>> = Vec::new();
diff --git a/tests/ui/impl-trait/in-trait/object-safety.rs b/tests/ui/impl-trait/in-trait/object-safety.rs
index d1c9fba4e..5cca4ad83 100644
--- a/tests/ui/impl-trait/in-trait/object-safety.rs
+++ b/tests/ui/impl-trait/in-trait/object-safety.rs
@@ -1,6 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
use std::fmt::Debug;
trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/object-safety.stderr b/tests/ui/impl-trait/in-trait/object-safety.stderr
index 0170dc5d0..a7be0516c 100644
--- a/tests/ui/impl-trait/in-trait/object-safety.stderr
+++ b/tests/ui/impl-trait/in-trait/object-safety.stderr
@@ -1,62 +1,66 @@
error[E0038]: the trait `Foo` cannot be made into an object
- --> $DIR/object-safety.rs:17:33
+ --> $DIR/object-safety.rs:14:33
|
LL | let i = Box::new(42_u32) as Box<dyn Foo>;
| ^^^^^^^^^^^^ `Foo` cannot be made into an object
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
- --> $DIR/object-safety.rs:7:22
+ --> $DIR/object-safety.rs:4:22
|
LL | trait Foo {
| --- this trait cannot be made into an object...
LL | fn baz(&self) -> impl Debug;
| ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type
= help: consider moving `baz` to another trait
+ = help: only type `u32` implements the trait, consider using it directly instead
error[E0038]: the trait `Foo` cannot be made into an object
- --> $DIR/object-safety.rs:20:15
+ --> $DIR/object-safety.rs:17:15
|
LL | let s = i.baz();
| ^^^ `Foo` cannot be made into an object
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
- --> $DIR/object-safety.rs:7:22
+ --> $DIR/object-safety.rs:4:22
|
LL | trait Foo {
| --- this trait cannot be made into an object...
LL | fn baz(&self) -> impl Debug;
| ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type
= help: consider moving `baz` to another trait
+ = help: only type `u32` implements the trait, consider using it directly instead
error[E0038]: the trait `Foo` cannot be made into an object
- --> $DIR/object-safety.rs:20:13
+ --> $DIR/object-safety.rs:17:13
|
LL | let s = i.baz();
| ^^^^^^^ `Foo` cannot be made into an object
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
- --> $DIR/object-safety.rs:7:22
+ --> $DIR/object-safety.rs:4:22
|
LL | trait Foo {
| --- this trait cannot be made into an object...
LL | fn baz(&self) -> impl Debug;
| ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type
= help: consider moving `baz` to another trait
+ = help: only type `u32` implements the trait, consider using it directly instead
error[E0038]: the trait `Foo` cannot be made into an object
- --> $DIR/object-safety.rs:17:13
+ --> $DIR/object-safety.rs:14:13
|
LL | let i = Box::new(42_u32) as Box<dyn Foo>;
| ^^^^^^^^^^^^^^^^ `Foo` cannot be made into an object
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
- --> $DIR/object-safety.rs:7:22
+ --> $DIR/object-safety.rs:4:22
|
LL | trait Foo {
| --- this trait cannot be made into an object...
LL | fn baz(&self) -> impl Debug;
| ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type
= help: consider moving `baz` to another trait
+ = help: only type `u32` implements the trait, consider using it directly instead
= note: required for the cast from `Box<u32>` to `Box<dyn Foo>`
error: aborting due to 4 previous errors
diff --git a/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs b/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs
index 3ac264e8e..1f18bb3b7 100644
--- a/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs
+++ b/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs
@@ -1,6 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
use std::fmt::Display;
trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr b/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr
index 15edda483..e260762d8 100644
--- a/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr
+++ b/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
- --> $DIR/opaque-in-impl-is-opaque.rs:17:19
+ --> $DIR/opaque-in-impl-is-opaque.rs:14:19
|
LL | fn bar(&self) -> impl Display {
| ------------ the found opaque type
diff --git a/tests/ui/impl-trait/in-trait/opaque-in-impl.rs b/tests/ui/impl-trait/in-trait/opaque-in-impl.rs
index 2e0662969..3edd588a1 100644
--- a/tests/ui/impl-trait/in-trait/opaque-in-impl.rs
+++ b/tests/ui/impl-trait/in-trait/opaque-in-impl.rs
@@ -1,6 +1,5 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
use std::fmt::Debug;
diff --git a/tests/ui/impl-trait/in-trait/opaque-variances.rs b/tests/ui/impl-trait/in-trait/opaque-variances.rs
new file mode 100644
index 000000000..60bfab0de
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/opaque-variances.rs
@@ -0,0 +1,14 @@
+// check-pass
+// compile-flags: -Ztrait-solver=next
+
+fn foo<'a: 'a>(x: &'a Vec<i32>) -> impl Sized {
+ ()
+}
+
+fn main() {
+ // in NLL, we want to make sure that the `'a` subst of `foo` does not get
+ // related between `x` and the RHS of the assignment. That would require
+ // that the temp is live for the lifetime of the variable `x`, which of
+ // course is not necessary since `'a` is not captured by the RPIT.
+ let x = foo(&Vec::new());
+}
diff --git a/tests/ui/impl-trait/in-trait/outlives-in-nested-rpit.rs b/tests/ui/impl-trait/in-trait/outlives-in-nested-rpit.rs
index 6330242ce..317ff7fe8 100644
--- a/tests/ui/impl-trait/in-trait/outlives-in-nested-rpit.rs
+++ b/tests/ui/impl-trait/in-trait/outlives-in-nested-rpit.rs
@@ -1,6 +1,5 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait)]
trait Foo {
fn early<'a, T: 'a>(x: &'a T) -> impl Iterator<Item = impl Into<&'a T>>;
diff --git a/tests/ui/impl-trait/in-trait/refine.rs b/tests/ui/impl-trait/in-trait/refine.rs
index a91f9b3e7..100e6da06 100644
--- a/tests/ui/impl-trait/in-trait/refine.rs
+++ b/tests/ui/impl-trait/in-trait/refine.rs
@@ -1,4 +1,3 @@
-#![feature(return_position_impl_trait_in_trait, async_fn_in_trait)]
#![deny(refining_impl_trait)]
pub trait Foo {
@@ -45,4 +44,15 @@ impl Late for D {
//~^ ERROR impl method signature does not match trait method signature
}
+mod unreachable {
+ pub trait UnreachablePub {
+ fn bar() -> impl Sized;
+ }
+
+ struct E;
+ impl UnreachablePub for E {
+ fn bar() {}
+ }
+}
+
fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/refine.stderr b/tests/ui/impl-trait/in-trait/refine.stderr
index 29aa08e25..96a9bc059 100644
--- a/tests/ui/impl-trait/in-trait/refine.stderr
+++ b/tests/ui/impl-trait/in-trait/refine.stderr
@@ -1,5 +1,5 @@
error: impl trait in impl method signature does not match trait method signature
- --> $DIR/refine.rs:10:22
+ --> $DIR/refine.rs:9:22
|
LL | fn bar() -> impl Sized;
| ---------- return type from trait method defined here
@@ -9,7 +9,7 @@ LL | fn bar() -> impl Copy {}
|
= note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate
note: the lint level is defined here
- --> $DIR/refine.rs:2:9
+ --> $DIR/refine.rs:1:9
|
LL | #![deny(refining_impl_trait)]
| ^^^^^^^^^^^^^^^^^^^
@@ -19,7 +19,7 @@ LL | fn bar() -> impl Sized {}
| ~~~~~~~~~~
error: impl trait in impl method signature does not match trait method signature
- --> $DIR/refine.rs:16:5
+ --> $DIR/refine.rs:15:5
|
LL | fn bar() -> impl Sized;
| ---------- return type from trait method defined here
@@ -30,11 +30,11 @@ LL | fn bar() {}
= note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate
help: replace the return type so that it matches the trait
|
-LL | fn bar() -> impl Sized {}
- | +++++++++++++
+LL | fn bar()-> impl Sized {}
+ | +++++++++++++
error: impl trait in impl method signature does not match trait method signature
- --> $DIR/refine.rs:22:17
+ --> $DIR/refine.rs:21:17
|
LL | fn bar() -> impl Sized;
| ---------- return type from trait method defined here
@@ -49,7 +49,7 @@ LL | fn bar() -> impl Sized {}
| ~~~~~~~~~~
error: impl trait in impl method signature does not match trait method signature
- --> $DIR/refine.rs:44:27
+ --> $DIR/refine.rs:43:27
|
LL | fn bar<'a>(&'a self) -> impl Sized + 'a;
| --------------- return type from trait method defined here
diff --git a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.rs b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.rs
index 5d9a224cc..ad73b12fe 100644
--- a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.rs
+++ b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.rs
@@ -1,5 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-
trait Foo<T> {
fn foo<F2>(self) -> impl Foo<T>;
}
diff --git a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr
index 668fc6cbe..181d6a284 100644
--- a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr
+++ b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr
@@ -1,12 +1,12 @@
error[E0277]: the trait bound `impl Foo<u8>: Foo<char>` is not satisfied
- --> $DIR/return-dont-satisfy-bounds.rs:10:34
+ --> $DIR/return-dont-satisfy-bounds.rs:8:34
|
LL | fn foo<F2: Foo<u8>>(self) -> impl Foo<u8> {
| ^^^^^^^^^^^^ the trait `Foo<char>` is not implemented for `impl Foo<u8>`
|
= help: the trait `Foo<char>` is implemented for `Bar`
note: required by a bound in `Foo::{opaque#0}`
- --> $DIR/return-dont-satisfy-bounds.rs:4:30
+ --> $DIR/return-dont-satisfy-bounds.rs:2:30
|
LL | fn foo<F2>(self) -> impl Foo<T>;
| ^^^^^^ required by this bound in `Foo::{opaque#0}`
diff --git a/tests/ui/impl-trait/in-trait/reveal.rs b/tests/ui/impl-trait/in-trait/reveal.rs
index b1b46d75b..cc78ce8fe 100644
--- a/tests/ui/impl-trait/in-trait/reveal.rs
+++ b/tests/ui/impl-trait/in-trait/reveal.rs
@@ -1,6 +1,6 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait, lint_reasons)]
+#![feature(lint_reasons)]
#![allow(incomplete_features)]
pub trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.rs b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.rs
index 5e14a7f8e..37b0b2297 100644
--- a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.rs
+++ b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.rs
@@ -1,5 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-
trait Extend {
fn extend<'a: 'a>(_: &'a str) -> (impl Sized + 'a, &'static str);
}
diff --git a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr
index 1d947310e..afc59cc5b 100644
--- a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr
+++ b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr
@@ -1,12 +1,12 @@
error[E0491]: in type `&'static &'a ()`, reference has a longer lifetime than the data it references
- --> $DIR/rpitit-hidden-types-self-implied-wf-via-param.rs:8:38
+ --> $DIR/rpitit-hidden-types-self-implied-wf-via-param.rs:6:38
|
LL | fn extend<'a: 'a>(s: &'a str) -> (Option<&'static &'a ()>, &'static str)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the pointer is valid for the static lifetime
note: but the referenced data is only valid for the lifetime `'a` as defined here
- --> $DIR/rpitit-hidden-types-self-implied-wf-via-param.rs:8:15
+ --> $DIR/rpitit-hidden-types-self-implied-wf-via-param.rs:6:15
|
LL | fn extend<'a: 'a>(s: &'a str) -> (Option<&'static &'a ()>, &'static str)
| ^^
diff --git a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.rs b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.rs
index c1885af4e..bacd50077 100644
--- a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.rs
+++ b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.rs
@@ -1,5 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-
trait Extend {
fn extend(_: &str) -> (impl Sized + '_, &'static str);
}
diff --git a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr
index 7b63e72ac..7e1a8f083 100644
--- a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr
+++ b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr
@@ -1,12 +1,12 @@
error[E0491]: in type `&'static &()`, reference has a longer lifetime than the data it references
- --> $DIR/rpitit-hidden-types-self-implied-wf.rs:8:27
+ --> $DIR/rpitit-hidden-types-self-implied-wf.rs:6:27
|
LL | fn extend(s: &str) -> (Option<&'static &'_ ()>, &'static str) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the pointer is valid for the static lifetime
note: but the referenced data is only valid for the anonymous lifetime defined here
- --> $DIR/rpitit-hidden-types-self-implied-wf.rs:8:18
+ --> $DIR/rpitit-hidden-types-self-implied-wf.rs:6:18
|
LL | fn extend(s: &str) -> (Option<&'static &'_ ()>, &'static str) {
| ^^^^
diff --git a/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs b/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs
index 44a2b4303..b9fe8d8bf 100644
--- a/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs
+++ b/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs
@@ -1,6 +1,6 @@
// issue: 113903
-#![feature(return_position_impl_trait_in_trait, lint_reasons)]
+#![feature(lint_reasons)]
use std::ops::Deref;
diff --git a/tests/ui/impl-trait/in-trait/sibling-function-constraint.rs b/tests/ui/impl-trait/in-trait/sibling-function-constraint.rs
new file mode 100644
index 000000000..fe162e6cf
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/sibling-function-constraint.rs
@@ -0,0 +1,21 @@
+// Checks that a sibling function (i.e. `foo`) cannot constrain
+// an RPITIT from another function (`bar`).
+
+trait Trait {
+ fn foo();
+
+ fn bar() -> impl Sized;
+}
+
+impl Trait for () {
+ fn foo() {
+ let _: String = Self::bar();
+ //~^ ERROR mismatched types
+ }
+
+ fn bar() -> impl Sized {
+ loop {}
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/sibling-function-constraint.stderr b/tests/ui/impl-trait/in-trait/sibling-function-constraint.stderr
new file mode 100644
index 000000000..729963a81
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/sibling-function-constraint.stderr
@@ -0,0 +1,17 @@
+error[E0308]: mismatched types
+ --> $DIR/sibling-function-constraint.rs:12:25
+ |
+LL | let _: String = Self::bar();
+ | ------ ^^^^^^^^^^^ expected `String`, found opaque type
+ | |
+ | expected due to this
+...
+LL | fn bar() -> impl Sized {
+ | ---------- the found opaque type
+ |
+ = note: expected struct `String`
+ found opaque type `impl Sized`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/impl-trait/in-trait/signature-mismatch.rs b/tests/ui/impl-trait/in-trait/signature-mismatch.rs
index 685c0f06e..d85ee5fc7 100644
--- a/tests/ui/impl-trait/in-trait/signature-mismatch.rs
+++ b/tests/ui/impl-trait/in-trait/signature-mismatch.rs
@@ -2,7 +2,7 @@
// revisions: success failure
//[success] check-pass
-#![feature(return_position_impl_trait_in_trait, lint_reasons)]
+#![feature(lint_reasons)]
use std::future::Future;
diff --git a/tests/ui/impl-trait/in-trait/specialization-broken.rs b/tests/ui/impl-trait/in-trait/specialization-broken.rs
index 2fcffdf3f..a06cd814f 100644
--- a/tests/ui/impl-trait/in-trait/specialization-broken.rs
+++ b/tests/ui/impl-trait/in-trait/specialization-broken.rs
@@ -2,7 +2,6 @@
// But we fixed an ICE anyways.
#![feature(specialization)]
-#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/specialization-broken.stderr b/tests/ui/impl-trait/in-trait/specialization-broken.stderr
index dc621d6b8..25c0adedd 100644
--- a/tests/ui/impl-trait/in-trait/specialization-broken.stderr
+++ b/tests/ui/impl-trait/in-trait/specialization-broken.stderr
@@ -1,8 +1,8 @@
error[E0053]: method `bar` has an incompatible type for trait
- --> $DIR/specialization-broken.rs:16:22
+ --> $DIR/specialization-broken.rs:15:22
|
LL | default impl<U> Foo for U
- | - this type parameter
+ | - found this type parameter
...
LL | fn bar(&self) -> U {
| ^
@@ -11,7 +11,7 @@ LL | fn bar(&self) -> U {
| help: change the output type to match the trait: `impl Sized`
|
note: type in trait
- --> $DIR/specialization-broken.rs:9:22
+ --> $DIR/specialization-broken.rs:8:22
|
LL | fn bar(&self) -> impl Sized;
| ^^^^^^^^^^
@@ -19,12 +19,12 @@ LL | fn bar(&self) -> impl Sized;
found signature `fn(&U) -> U`
error: method with return-position `impl Trait` in trait cannot be specialized
- --> $DIR/specialization-broken.rs:16:5
+ --> $DIR/specialization-broken.rs:15:5
|
LL | fn bar(&self) -> U {
| ^^^^^^^^^^^^^^^^^^
|
- = note: specialization behaves in inconsistent and surprising ways with `#![feature(return_position_impl_trait_in_trait)]`, and for now is disallowed
+ = note: specialization behaves in inconsistent and surprising ways with return position `impl Trait` in traits, and for now is disallowed
error: aborting due to 2 previous errors
diff --git a/tests/ui/impl-trait/in-trait/specialization-substs-remap.rs b/tests/ui/impl-trait/in-trait/specialization-substs-remap.rs
index 41fc28588..053866327 100644
--- a/tests/ui/impl-trait/in-trait/specialization-substs-remap.rs
+++ b/tests/ui/impl-trait/in-trait/specialization-substs-remap.rs
@@ -1,7 +1,7 @@
// check-pass
#![feature(specialization)]
-#![feature(return_position_impl_trait_in_trait, lint_reasons)]
+#![feature(lint_reasons)]
#![allow(incomplete_features)]
pub trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/success.rs b/tests/ui/impl-trait/in-trait/success.rs
index 7d415ea17..eb2349feb 100644
--- a/tests/ui/impl-trait/in-trait/success.rs
+++ b/tests/ui/impl-trait/in-trait/success.rs
@@ -1,6 +1,6 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait, lint_reasons)]
+#![feature(lint_reasons)]
#![allow(incomplete_features)]
use std::fmt::Display;
diff --git a/tests/ui/impl-trait/in-trait/suggest-missing-item.fixed b/tests/ui/impl-trait/in-trait/suggest-missing-item.fixed
index d9f775a6c..8dc8e045d 100644
--- a/tests/ui/impl-trait/in-trait/suggest-missing-item.fixed
+++ b/tests/ui/impl-trait/in-trait/suggest-missing-item.fixed
@@ -1,15 +1,16 @@
// edition:2021
// run-rustfix
-#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
-
trait Trait {
+ #[allow(async_fn_in_trait)]
async fn foo();
+ #[allow(async_fn_in_trait)]
async fn bar() -> i32;
fn test(&self) -> impl Sized + '_;
+ #[allow(async_fn_in_trait)]
async fn baz(&self) -> &i32;
}
diff --git a/tests/ui/impl-trait/in-trait/suggest-missing-item.rs b/tests/ui/impl-trait/in-trait/suggest-missing-item.rs
index 26979b514..30b04d87b 100644
--- a/tests/ui/impl-trait/in-trait/suggest-missing-item.rs
+++ b/tests/ui/impl-trait/in-trait/suggest-missing-item.rs
@@ -1,15 +1,16 @@
// edition:2021
// run-rustfix
-#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
-
trait Trait {
+ #[allow(async_fn_in_trait)]
async fn foo();
+ #[allow(async_fn_in_trait)]
async fn bar() -> i32;
fn test(&self) -> impl Sized + '_;
+ #[allow(async_fn_in_trait)]
async fn baz(&self) -> &i32;
}
diff --git a/tests/ui/impl-trait/in-trait/suggest-missing-item.stderr b/tests/ui/impl-trait/in-trait/suggest-missing-item.stderr
index 44f98896e..cec94e39a 100644
--- a/tests/ui/impl-trait/in-trait/suggest-missing-item.stderr
+++ b/tests/ui/impl-trait/in-trait/suggest-missing-item.stderr
@@ -1,15 +1,15 @@
error[E0046]: not all trait items implemented, missing: `foo`, `bar`, `test`, `baz`
- --> $DIR/suggest-missing-item.rs:18:1
+ --> $DIR/suggest-missing-item.rs:19:1
|
LL | async fn foo();
| --------------- `foo` from trait
-LL |
+...
LL | async fn bar() -> i32;
| ---------------------- `bar` from trait
LL |
LL | fn test(&self) -> impl Sized + '_;
| ---------------------------------- `test` from trait
-LL |
+...
LL | async fn baz(&self) -> &i32;
| ---------------------------- `baz` from trait
...
diff --git a/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.rs b/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.rs
index 0bbe50ea6..d9fac0238 100644
--- a/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.rs
+++ b/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.rs
@@ -1,6 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
struct S;
trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.stderr b/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.stderr
index 8ff54cad9..2836e9c78 100644
--- a/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.stderr
+++ b/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.stderr
@@ -1,5 +1,5 @@
error[E0049]: method `bar` has 0 type parameters but its trait declaration has 1 type parameter
- --> $DIR/trait-more-generics-than-impl.rs:11:11
+ --> $DIR/trait-more-generics-than-impl.rs:8:11
|
LL | fn bar<T>() -> impl Sized;
| - expected 1 type parameter
diff --git a/tests/ui/impl-trait/in-trait/unconstrained-lt.rs b/tests/ui/impl-trait/in-trait/unconstrained-lt.rs
index 07c8606f9..ff3753de5 100644
--- a/tests/ui/impl-trait/in-trait/unconstrained-lt.rs
+++ b/tests/ui/impl-trait/in-trait/unconstrained-lt.rs
@@ -1,5 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-
trait Foo {
fn test() -> impl Sized;
}
diff --git a/tests/ui/impl-trait/in-trait/unconstrained-lt.stderr b/tests/ui/impl-trait/in-trait/unconstrained-lt.stderr
index cfce35567..61a0f8454 100644
--- a/tests/ui/impl-trait/in-trait/unconstrained-lt.stderr
+++ b/tests/ui/impl-trait/in-trait/unconstrained-lt.stderr
@@ -1,5 +1,5 @@
error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
- --> $DIR/unconstrained-lt.rs:7:6
+ --> $DIR/unconstrained-lt.rs:5:6
|
LL | impl<'a, T> Foo for T {
| ^^ unconstrained lifetime parameter
diff --git a/tests/ui/impl-trait/in-trait/variance.rs b/tests/ui/impl-trait/in-trait/variance.rs
index f8e4ab88c..65565dcc2 100644
--- a/tests/ui/impl-trait/in-trait/variance.rs
+++ b/tests/ui/impl-trait/in-trait/variance.rs
@@ -1,4 +1,4 @@
-#![feature(rustc_attrs, return_position_impl_trait_in_trait)]
+#![feature(rustc_attrs)]
#![allow(internal_features)]
#![rustc_variance_of_opaques]
diff --git a/tests/ui/impl-trait/in-trait/variances-of-gat.rs b/tests/ui/impl-trait/in-trait/variances-of-gat.rs
index 0d19e1ff4..aabb6f830 100644
--- a/tests/ui/impl-trait/in-trait/variances-of-gat.rs
+++ b/tests/ui/impl-trait/in-trait/variances-of-gat.rs
@@ -1,6 +1,5 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait)]
trait Foo {}
diff --git a/tests/ui/impl-trait/in-trait/wf-bounds.rs b/tests/ui/impl-trait/in-trait/wf-bounds.rs
index ee873f94b..f1e372b19 100644
--- a/tests/ui/impl-trait/in-trait/wf-bounds.rs
+++ b/tests/ui/impl-trait/in-trait/wf-bounds.rs
@@ -1,6 +1,5 @@
// issue #101663
-#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
use std::fmt::Display;
diff --git a/tests/ui/impl-trait/in-trait/wf-bounds.stderr b/tests/ui/impl-trait/in-trait/wf-bounds.stderr
index 4d60b1330..c20df9b40 100644
--- a/tests/ui/impl-trait/in-trait/wf-bounds.stderr
+++ b/tests/ui/impl-trait/in-trait/wf-bounds.stderr
@@ -1,5 +1,5 @@
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
- --> $DIR/wf-bounds.rs:15:22
+ --> $DIR/wf-bounds.rs:14:22
|
LL | fn nya() -> impl Wf<Vec<[u8]>>;
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
@@ -9,14 +9,14 @@ note: required by a bound in `Vec`
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
- --> $DIR/wf-bounds.rs:18:23
+ --> $DIR/wf-bounds.rs:17:23
|
LL | fn nya2() -> impl Wf<[u8]>;
| ^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
note: required by a bound in `Wf`
- --> $DIR/wf-bounds.rs:8:10
+ --> $DIR/wf-bounds.rs:7:10
|
LL | trait Wf<T> {
| ^ required by this bound in `Wf`
@@ -26,7 +26,7 @@ LL | trait Wf<T: ?Sized> {
| ++++++++
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
- --> $DIR/wf-bounds.rs:21:44
+ --> $DIR/wf-bounds.rs:20:44
|
LL | fn nya3() -> impl Wf<(), Output = impl Wf<Vec<[u8]>>>;
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
@@ -36,14 +36,14 @@ note: required by a bound in `Vec`
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
error[E0277]: `T` doesn't implement `std::fmt::Display`
- --> $DIR/wf-bounds.rs:24:26
+ --> $DIR/wf-bounds.rs:23:26
|
LL | fn nya4<T>() -> impl Wf<NeedsDisplay<T>>;
| ^^^^^^^^^^^^^^^^^^^ `T` cannot be formatted with the default formatter
|
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
note: required by a bound in `NeedsDisplay`
- --> $DIR/wf-bounds.rs:12:24
+ --> $DIR/wf-bounds.rs:11:24
|
LL | struct NeedsDisplay<T: Display>(T);
| ^^^^^^^ required by this bound in `NeedsDisplay`
diff --git a/tests/ui/impl-trait/in-trait/where-clause.rs b/tests/ui/impl-trait/in-trait/where-clause.rs
index 87bac519c..f7f4980b7 100644
--- a/tests/ui/impl-trait/in-trait/where-clause.rs
+++ b/tests/ui/impl-trait/in-trait/where-clause.rs
@@ -1,7 +1,6 @@
// check-pass
// edition: 2021
-#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
use std::fmt::Debug;
diff --git a/tests/ui/impl-trait/issue-55872-2.stderr b/tests/ui/impl-trait/issue-55872-2.stderr
index 3e70f1cf8..b5b7f293a 100644
--- a/tests/ui/impl-trait/issue-55872-2.stderr
+++ b/tests/ui/impl-trait/issue-55872-2.stderr
@@ -9,6 +9,8 @@ error: type parameter `T` is part of concrete type but not used in parameter lis
|
LL | async {}
| ^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/impl-trait/issues/issue-54600.rs b/tests/ui/impl-trait/issues/issue-54600.rs
index 3024fedf7..ccf276701 100644
--- a/tests/ui/impl-trait/issues/issue-54600.rs
+++ b/tests/ui/impl-trait/issues/issue-54600.rs
@@ -2,6 +2,6 @@ use std::fmt::Debug;
fn main() {
let x: Option<impl Debug> = Some(44_u32);
- //~^ `impl Trait` only allowed in function and inherent method return types
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
println!("{:?}", x);
}
diff --git a/tests/ui/impl-trait/issues/issue-54600.stderr b/tests/ui/impl-trait/issues/issue-54600.stderr
index 7ef063af9..9a8e3675b 100644
--- a/tests/ui/impl-trait/issues/issue-54600.stderr
+++ b/tests/ui/impl-trait/issues/issue-54600.stderr
@@ -1,4 +1,4 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
--> $DIR/issue-54600.rs:4:19
|
LL | let x: Option<impl Debug> = Some(44_u32);
diff --git a/tests/ui/impl-trait/issues/issue-54840.rs b/tests/ui/impl-trait/issues/issue-54840.rs
index 8f1e0ece0..910d23f1d 100644
--- a/tests/ui/impl-trait/issues/issue-54840.rs
+++ b/tests/ui/impl-trait/issues/issue-54840.rs
@@ -3,5 +3,5 @@ use std::ops::Add;
fn main() {
let i: i32 = 0;
let j: &impl Add = &i;
- //~^ `impl Trait` only allowed in function and inherent method return types
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
}
diff --git a/tests/ui/impl-trait/issues/issue-54840.stderr b/tests/ui/impl-trait/issues/issue-54840.stderr
index 1d1316f0e..67cabf449 100644
--- a/tests/ui/impl-trait/issues/issue-54840.stderr
+++ b/tests/ui/impl-trait/issues/issue-54840.stderr
@@ -1,4 +1,4 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
--> $DIR/issue-54840.rs:5:13
|
LL | let j: &impl Add = &i;
diff --git a/tests/ui/impl-trait/issues/issue-58504.rs b/tests/ui/impl-trait/issues/issue-58504.rs
index e5865d0df..03b51ae92 100644
--- a/tests/ui/impl-trait/issues/issue-58504.rs
+++ b/tests/ui/impl-trait/issues/issue-58504.rs
@@ -1,12 +1,12 @@
-#![feature(generators, generator_trait, never_type)]
+#![feature(coroutines, coroutine_trait, never_type)]
-use std::ops::Generator;
+use std::ops::Coroutine;
-fn mk_gen() -> impl Generator<Return=!, Yield=()> {
+fn mk_gen() -> impl Coroutine<Return=!, Yield=()> {
|| { loop { yield; } }
}
fn main() {
- let gens: [impl Generator<Return=!, Yield=()>;2] = [ mk_gen(), mk_gen() ];
- //~^ `impl Trait` only allowed in function and inherent method return types
+ let gens: [impl Coroutine<Return=!, Yield=()>;2] = [ mk_gen(), mk_gen() ];
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
}
diff --git a/tests/ui/impl-trait/issues/issue-58504.stderr b/tests/ui/impl-trait/issues/issue-58504.stderr
index 26ec2a4f9..49376f559 100644
--- a/tests/ui/impl-trait/issues/issue-58504.stderr
+++ b/tests/ui/impl-trait/issues/issue-58504.stderr
@@ -1,7 +1,7 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
--> $DIR/issue-58504.rs:10:16
|
-LL | let gens: [impl Generator<Return=!, Yield=()>;2] = [ mk_gen(), mk_gen() ];
+LL | let gens: [impl Coroutine<Return=!, Yield=()>;2] = [ mk_gen(), mk_gen() ];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/impl-trait/issues/issue-58956.rs b/tests/ui/impl-trait/issues/issue-58956.rs
index 68cfcd9ba..5d5566860 100644
--- a/tests/ui/impl-trait/issues/issue-58956.rs
+++ b/tests/ui/impl-trait/issues/issue-58956.rs
@@ -5,9 +5,9 @@ impl Lam for B {}
pub struct Wrap<T>(T);
const _A: impl Lam = {
- //~^ `impl Trait` only allowed in function and inherent method return types
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
let x: Wrap<impl Lam> = Wrap(B);
- //~^ `impl Trait` only allowed in function and inherent method return types
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
x.0
};
diff --git a/tests/ui/impl-trait/issues/issue-58956.stderr b/tests/ui/impl-trait/issues/issue-58956.stderr
index 2b4d0abdf..5ee33352a 100644
--- a/tests/ui/impl-trait/issues/issue-58956.stderr
+++ b/tests/ui/impl-trait/issues/issue-58956.stderr
@@ -1,10 +1,10 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in const types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in const types
--> $DIR/issue-58956.rs:7:11
|
LL | const _A: impl Lam = {
| ^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
--> $DIR/issue-58956.rs:9:17
|
LL | let x: Wrap<impl Lam> = Wrap(B);
diff --git a/tests/ui/impl-trait/issues/issue-62742.stderr b/tests/ui/impl-trait/issues/issue-62742.stderr
index d872291c8..8d969e8e0 100644
--- a/tests/ui/impl-trait/issues/issue-62742.stderr
+++ b/tests/ui/impl-trait/issues/issue-62742.stderr
@@ -4,7 +4,7 @@ error[E0277]: the trait bound `RawImpl<_>: Raw<_>` is not satisfied
LL | WrongImpl::foo(0i32);
| ^^^^^^^^^ the trait `Raw<_>` is not implemented for `RawImpl<_>`
|
- = help: the trait `Raw<[T]>` is implemented for `RawImpl<T>`
+ = help: the trait `Raw<[_]>` is implemented for `RawImpl<_>`
note: required by a bound in `SafeImpl`
--> $DIR/issue-62742.rs:26:35
|
@@ -42,7 +42,8 @@ error[E0277]: the trait bound `RawImpl<()>: Raw<()>` is not satisfied
LL | WrongImpl::<()>::foo(0i32);
| ^^^^^^^^^^^^^^^ the trait `Raw<()>` is not implemented for `RawImpl<()>`
|
- = help: the trait `Raw<[T]>` is implemented for `RawImpl<T>`
+ = help: the trait `Raw<[()]>` is implemented for `RawImpl<()>`
+ = help: for that trait implementation, expected `[()]`, found `()`
note: required by a bound in `SafeImpl`
--> $DIR/issue-62742.rs:26:35
|
diff --git a/tests/ui/impl-trait/issues/issue-70971.rs b/tests/ui/impl-trait/issues/issue-70971.rs
index f8ae18bac..c24259a71 100644
--- a/tests/ui/impl-trait/issues/issue-70971.rs
+++ b/tests/ui/impl-trait/issues/issue-70971.rs
@@ -1,4 +1,4 @@
fn main() {
let x : (impl Copy,) = (true,);
- //~^ `impl Trait` only allowed in function and inherent method return types
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
}
diff --git a/tests/ui/impl-trait/issues/issue-70971.stderr b/tests/ui/impl-trait/issues/issue-70971.stderr
index d066256bf..5609f8b9b 100644
--- a/tests/ui/impl-trait/issues/issue-70971.stderr
+++ b/tests/ui/impl-trait/issues/issue-70971.stderr
@@ -1,4 +1,4 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
--> $DIR/issue-70971.rs:2:14
|
LL | let x : (impl Copy,) = (true,);
diff --git a/tests/ui/impl-trait/issues/issue-79099.rs b/tests/ui/impl-trait/issues/issue-79099.rs
index da53594f3..22c66491c 100644
--- a/tests/ui/impl-trait/issues/issue-79099.rs
+++ b/tests/ui/impl-trait/issues/issue-79099.rs
@@ -1,7 +1,7 @@
struct Bug {
V1: [(); {
let f: impl core::future::Future<Output = u8> = async { 1 };
- //~^ `impl Trait` only allowed in function and inherent method return types
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
//~| expected identifier
1
}],
diff --git a/tests/ui/impl-trait/issues/issue-79099.stderr b/tests/ui/impl-trait/issues/issue-79099.stderr
index 580250a62..82fc03c61 100644
--- a/tests/ui/impl-trait/issues/issue-79099.stderr
+++ b/tests/ui/impl-trait/issues/issue-79099.stderr
@@ -9,7 +9,7 @@ LL | let f: impl core::future::Future<Output = u8> = async { 1 };
= help: pass `--edition 2021` to `rustc`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
--> $DIR/issue-79099.rs:3:16
|
LL | let f: impl core::future::Future<Output = u8> = async { 1 };
diff --git a/tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.rs b/tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.rs
index 344f35952..3224145bf 100644
--- a/tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.rs
+++ b/tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.rs
@@ -1,8 +1,8 @@
struct Foo<T = impl Copy>(T);
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
type Result<T, E = impl std::error::Error> = std::result::Result<T, E>;
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// should not cause ICE
fn x() -> Foo {
diff --git a/tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.stderr b/tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.stderr
index 656bd0470..56be4577d 100644
--- a/tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.stderr
+++ b/tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.stderr
@@ -1,10 +1,10 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
--> $DIR/issue-83929-impl-trait-in-generic-default.rs:1:16
|
LL | struct Foo<T = impl Copy>(T);
| ^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
--> $DIR/issue-83929-impl-trait-in-generic-default.rs:4:20
|
LL | type Result<T, E = impl std::error::Error> = std::result::Result<T, E>;
diff --git a/tests/ui/impl-trait/issues/issue-84073.stderr b/tests/ui/impl-trait/issues/issue-84073.stderr
index 3c39aa6ce..b4be16ff0 100644
--- a/tests/ui/impl-trait/issues/issue-84073.stderr
+++ b/tests/ui/impl-trait/issues/issue-84073.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `RaceBuilder<T, Never<T>>`
--> $DIR/issue-84073.rs:32:16
|
LL | Race::new(|race| race.when());
- | ^^^^
+ | ^^^^ ---- type must be known at this point
|
help: consider giving this closure parameter an explicit type, where the type for type parameter `T` is specified
|
diff --git a/tests/ui/impl-trait/issues/issue-84919.rs b/tests/ui/impl-trait/issues/issue-84919.rs
index a0b73743a..77d27d7c0 100644
--- a/tests/ui/impl-trait/issues/issue-84919.rs
+++ b/tests/ui/impl-trait/issues/issue-84919.rs
@@ -3,7 +3,7 @@ impl Trait for () {}
fn foo<'a: 'a>() {
let _x: impl Trait = ();
- //~^ `impl Trait` only allowed in function and inherent method return types
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
}
fn main() {}
diff --git a/tests/ui/impl-trait/issues/issue-84919.stderr b/tests/ui/impl-trait/issues/issue-84919.stderr
index 36010fdef..20b131b8b 100644
--- a/tests/ui/impl-trait/issues/issue-84919.stderr
+++ b/tests/ui/impl-trait/issues/issue-84919.stderr
@@ -1,4 +1,4 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
--> $DIR/issue-84919.rs:5:13
|
LL | let _x: impl Trait = ();
diff --git a/tests/ui/impl-trait/issues/issue-86642.rs b/tests/ui/impl-trait/issues/issue-86642.rs
index e6e957714..49f8944ac 100644
--- a/tests/ui/impl-trait/issues/issue-86642.rs
+++ b/tests/ui/impl-trait/issues/issue-86642.rs
@@ -1,5 +1,5 @@
static x: impl Fn(&str) -> Result<&str, ()> = move |source| {
- //~^ `impl Trait` only allowed in function and inherent method return types
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
let res = (move |source| Ok(source))(source);
let res = res.or((move |source| Ok(source))(source));
res
diff --git a/tests/ui/impl-trait/issues/issue-86642.stderr b/tests/ui/impl-trait/issues/issue-86642.stderr
index b6f8a54f3..6d3be3fff 100644
--- a/tests/ui/impl-trait/issues/issue-86642.stderr
+++ b/tests/ui/impl-trait/issues/issue-86642.stderr
@@ -1,4 +1,4 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in const types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in const types
--> $DIR/issue-86642.rs:1:11
|
LL | static x: impl Fn(&str) -> Result<&str, ()> = move |source| {
diff --git a/tests/ui/impl-trait/issues/issue-87295.rs b/tests/ui/impl-trait/issues/issue-87295.rs
index aeb8f8332..eb44020ac 100644
--- a/tests/ui/impl-trait/issues/issue-87295.rs
+++ b/tests/ui/impl-trait/issues/issue-87295.rs
@@ -14,5 +14,5 @@ impl<F> Struct<F> {
fn main() {
let _do_not_waste: Struct<impl Trait<Output = i32>> = Struct::new(());
- //~^ `impl Trait` only allowed in function and inherent method return types
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
}
diff --git a/tests/ui/impl-trait/issues/issue-87295.stderr b/tests/ui/impl-trait/issues/issue-87295.stderr
index ec59b719c..3fe4ee73c 100644
--- a/tests/ui/impl-trait/issues/issue-87295.stderr
+++ b/tests/ui/impl-trait/issues/issue-87295.stderr
@@ -1,4 +1,4 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
--> $DIR/issue-87295.rs:16:31
|
LL | let _do_not_waste: Struct<impl Trait<Output = i32>> = Struct::new(());
diff --git a/tests/ui/impl-trait/lifetimes.rs b/tests/ui/impl-trait/lifetimes.rs
index 9a9843375..f853117a9 100644
--- a/tests/ui/impl-trait/lifetimes.rs
+++ b/tests/ui/impl-trait/lifetimes.rs
@@ -1,7 +1,7 @@
// run-pass
#![allow(warnings)]
-#![feature(generators)]
+#![feature(coroutines)]
use std::fmt::Debug;
@@ -114,7 +114,7 @@ impl<'unnecessary_lifetime> MyVec {
self.0.iter().flat_map(|inner_vec| inner_vec.iter())
}
- fn generator_doesnt_capture_unnecessary_lifetime<'s: 's>() -> impl Sized {
+ fn coroutine_doesnt_capture_unnecessary_lifetime<'s: 's>() -> impl Sized {
|| yield
}
}
diff --git a/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr b/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr
index 33b48b1e9..c60fe08c5 100644
--- a/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr
+++ b/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr
@@ -117,9 +117,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/must_outlive_least_region_or_bound.rs:43:5
|
LL | x
- | ^ ...so that the type `T` will meet its required lifetime bounds
+ | ^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn ty_param_wont_outlive_static<T:Debug + 'static>(x: T) -> impl Debug + 'static {
| +++++++++
diff --git a/tests/ui/impl-trait/negative-reasoning.stderr b/tests/ui/impl-trait/negative-reasoning.stderr
index 6b8cc9e73..ddce5e7ec 100644
--- a/tests/ui/impl-trait/negative-reasoning.stderr
+++ b/tests/ui/impl-trait/negative-reasoning.stderr
@@ -7,7 +7,7 @@ LL | impl<T: std::fmt::Debug> AnotherTrait for T {}
LL | impl AnotherTrait for D<OpaqueType> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<OpaqueType>`
|
- = note: upstream crates may add a new impl of trait `std::fmt::Debug` for type `OpaqueType` in future versions
+ = note: upstream crates may add a new impl of trait `std::marker::FnPtr` for type `OpaqueType` in future versions
error: aborting due to previous error
diff --git a/tests/ui/impl-trait/nested-return-type2-tait2.rs b/tests/ui/impl-trait/nested-return-type2-tait2.rs
index af8e06630..b7fee1d91 100644
--- a/tests/ui/impl-trait/nested-return-type2-tait2.rs
+++ b/tests/ui/impl-trait/nested-return-type2-tait2.rs
@@ -1,3 +1,5 @@
+// check-pass
+
#![feature(type_alias_impl_trait)]
trait Duh {}
@@ -17,6 +19,7 @@ impl<R: Duh, F: FnMut() -> R> Trait for F {
type Sendable = impl Send;
type Traitable = impl Trait<Assoc = Sendable>;
+//~^ WARN opaque type `Traitable` does not satisfy its associated type bounds
// The `impl Send` here is then later compared against the inference var
// created, causing the inference var to be set to `impl Send` instead of
@@ -25,7 +28,6 @@ type Traitable = impl Trait<Assoc = Sendable>;
// type does not implement `Duh`, even if its hidden type does. So we error out.
fn foo() -> Traitable {
|| 42
- //~^ ERROR `Sendable: Duh` is not satisfied
}
fn main() {
diff --git a/tests/ui/impl-trait/nested-return-type2-tait2.stderr b/tests/ui/impl-trait/nested-return-type2-tait2.stderr
index 125262b96..790e339c8 100644
--- a/tests/ui/impl-trait/nested-return-type2-tait2.stderr
+++ b/tests/ui/impl-trait/nested-return-type2-tait2.stderr
@@ -1,18 +1,13 @@
-error[E0277]: the trait bound `Sendable: Duh` is not satisfied
- --> $DIR/nested-return-type2-tait2.rs:27:5
+warning: opaque type `Traitable` does not satisfy its associated type bounds
+ --> $DIR/nested-return-type2-tait2.rs:21:29
|
-LL | || 42
- | ^^^^^ the trait `Duh` is not implemented for `Sendable`
+LL | type Assoc: Duh;
+ | --- this associated type bound is unsatisfied for `Sendable`
+...
+LL | type Traitable = impl Trait<Assoc = Sendable>;
+ | ^^^^^^^^^^^^^^^^
|
- = help: the trait `Duh` is implemented for `i32`
-note: required for `{closure@$DIR/nested-return-type2-tait2.rs:27:5: 27:7}` to implement `Trait`
- --> $DIR/nested-return-type2-tait2.rs:14:31
- |
-LL | impl<R: Duh, F: FnMut() -> R> Trait for F {
- | --- ^^^^^ ^
- | |
- | unsatisfied trait bound introduced here
+ = note: `#[warn(opaque_hidden_inferred_bound)]` on by default
-error: aborting due to previous error
+warning: 1 warning emitted
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/impl-trait/nested-return-type2-tait3.rs b/tests/ui/impl-trait/nested-return-type2-tait3.rs
index 74fd8a9dd..eed5c271f 100644
--- a/tests/ui/impl-trait/nested-return-type2-tait3.rs
+++ b/tests/ui/impl-trait/nested-return-type2-tait3.rs
@@ -1,3 +1,5 @@
+// check-pass
+
#![feature(type_alias_impl_trait)]
trait Duh {}
@@ -16,6 +18,7 @@ impl<R: Duh, F: FnMut() -> R> Trait for F {
}
type Traitable = impl Trait<Assoc = impl Send>;
+//~^ WARN opaque type `Traitable` does not satisfy its associated type bounds
// The `impl Send` here is then later compared against the inference var
// created, causing the inference var to be set to `impl Send` instead of
@@ -24,7 +27,6 @@ type Traitable = impl Trait<Assoc = impl Send>;
// type does not implement `Duh`, even if its hidden type does. So we error out.
fn foo() -> Traitable {
|| 42
- //~^ ERROR `impl Send: Duh` is not satisfied
}
fn main() {
diff --git a/tests/ui/impl-trait/nested-return-type2-tait3.stderr b/tests/ui/impl-trait/nested-return-type2-tait3.stderr
index c2332b6e4..72aa51a23 100644
--- a/tests/ui/impl-trait/nested-return-type2-tait3.stderr
+++ b/tests/ui/impl-trait/nested-return-type2-tait3.stderr
@@ -1,18 +1,17 @@
-error[E0277]: the trait bound `impl Send: Duh` is not satisfied
- --> $DIR/nested-return-type2-tait3.rs:26:5
+warning: opaque type `Traitable` does not satisfy its associated type bounds
+ --> $DIR/nested-return-type2-tait3.rs:20:29
|
-LL | || 42
- | ^^^^^ the trait `Duh` is not implemented for `impl Send`
+LL | type Assoc: Duh;
+ | --- this associated type bound is unsatisfied for `impl Send`
+...
+LL | type Traitable = impl Trait<Assoc = impl Send>;
+ | ^^^^^^^^^^^^^^^^^
|
- = help: the trait `Duh` is implemented for `i32`
-note: required for `{closure@$DIR/nested-return-type2-tait3.rs:26:5: 26:7}` to implement `Trait`
- --> $DIR/nested-return-type2-tait3.rs:14:31
+ = note: `#[warn(opaque_hidden_inferred_bound)]` on by default
+help: add this bound
|
-LL | impl<R: Duh, F: FnMut() -> R> Trait for F {
- | --- ^^^^^ ^
- | |
- | unsatisfied trait bound introduced here
+LL | type Traitable = impl Trait<Assoc = impl Send + Duh>;
+ | +++++
-error: aborting due to previous error
+warning: 1 warning emitted
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/impl-trait/nested_impl_trait.rs b/tests/ui/impl-trait/nested_impl_trait.rs
index e95fab3b6..c036b9e36 100644
--- a/tests/ui/impl-trait/nested_impl_trait.rs
+++ b/tests/ui/impl-trait/nested_impl_trait.rs
@@ -9,7 +9,7 @@ fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }
fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {}
//~^ ERROR nested `impl Trait` is not allowed
-//~| `impl Trait` only allowed in function and inherent method return types
+//~| `impl Trait` only allowed in function and inherent method argument and return types
fn bad_in_arg_position(_: impl Into<impl Debug>) { }
//~^ ERROR nested `impl Trait` is not allowed
diff --git a/tests/ui/impl-trait/nested_impl_trait.stderr b/tests/ui/impl-trait/nested_impl_trait.stderr
index ffe84b8e8..f1cafd958 100644
--- a/tests/ui/impl-trait/nested_impl_trait.stderr
+++ b/tests/ui/impl-trait/nested_impl_trait.stderr
@@ -34,7 +34,7 @@ LL | fn bad(x: impl Into<u32>) -> impl Into<impl Debug> { x }
| | nested `impl Trait` here
| outer `impl Trait`
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer return types
--> $DIR/nested_impl_trait.rs:10:32
|
LL | fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {}
diff --git a/tests/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr b/tests/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr
index 687dbe65e..37c96d9bc 100644
--- a/tests/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr
+++ b/tests/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr
@@ -11,6 +11,9 @@ LL | trait NotObjectSafe {
| ------------- this trait cannot be made into an object...
LL | fn foo() -> Self;
| ^^^ ...because associated function `foo` has no `self` parameter
+ = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `NotObjectSafe` for this new enum and using it instead:
+ A
+ B
help: consider turning `foo` into a method by giving it a `&self` argument
|
LL | fn foo(&self) -> Self;
@@ -33,6 +36,9 @@ LL | trait NotObjectSafe {
| ------------- this trait cannot be made into an object...
LL | fn foo() -> Self;
| ^^^ ...because associated function `foo` has no `self` parameter
+ = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `NotObjectSafe` for this new enum and using it instead:
+ A
+ B
help: consider turning `foo` into a method by giving it a `&self` argument
|
LL | fn foo(&self) -> Self;
diff --git a/tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr b/tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr
index ee4343b11..234780534 100644
--- a/tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr
+++ b/tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr
@@ -1,9 +1,11 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
--> $DIR/opaque-cast-field-access-in-future.rs:22:17
|
LL | fn run() -> Foo<impl Future<Output = ()>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
+ |
+ = note: cannot satisfy `_: Future`
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/impl-trait/recursive-generator.rs b/tests/ui/impl-trait/recursive-coroutine.rs
index 000af70c4..6351cef95 100644
--- a/tests/ui/impl-trait/recursive-generator.rs
+++ b/tests/ui/impl-trait/recursive-coroutine.rs
@@ -1,16 +1,16 @@
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::{Generator, GeneratorState};
+use std::ops::{Coroutine, CoroutineState};
-fn foo() -> impl Generator<Yield = (), Return = ()> {
+fn foo() -> impl Coroutine<Yield = (), Return = ()> {
//~^ ERROR cannot resolve opaque type
//~| NOTE recursive opaque type
//~| NOTE in this expansion of desugaring of
|| {
let mut gen = Box::pin(foo());
- //~^ NOTE generator captures itself here
+ //~^ NOTE coroutine captures itself here
let mut r = gen.as_mut().resume(());
- while let GeneratorState::Yielded(v) = r {
+ while let CoroutineState::Yielded(v) = r {
yield v;
r = gen.as_mut().resume(());
}
diff --git a/tests/ui/impl-trait/recursive-generator.stderr b/tests/ui/impl-trait/recursive-coroutine.stderr
index 86e193d95..d36a58a86 100644
--- a/tests/ui/impl-trait/recursive-generator.stderr
+++ b/tests/ui/impl-trait/recursive-coroutine.stderr
@@ -1,11 +1,11 @@
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-generator.rs:5:13
+ --> $DIR/recursive-coroutine.rs:5:13
|
-LL | fn foo() -> impl Generator<Yield = (), Return = ()> {
+LL | fn foo() -> impl Coroutine<Yield = (), Return = ()> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ recursive opaque type
...
LL | let mut gen = Box::pin(foo());
- | ------- generator captures itself here
+ | ------- coroutine captures itself here
error: aborting due to previous error
diff --git a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.rs b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.rs
index ffc0cd9d1..8331eec90 100644
--- a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.rs
+++ b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.rs
@@ -1,7 +1,7 @@
// Test that impl trait does not allow creating recursive types that are
// otherwise forbidden.
-#![feature(generators)]
+#![feature(coroutines)]
#![allow(unconditional_recursion)]
fn option(i: i32) -> impl Sized {
@@ -50,14 +50,14 @@ fn closure_sig() -> impl Sized {
|| closure_sig()
}
-fn generator_sig() -> impl Sized {
+fn coroutine_sig() -> impl Sized {
//~^ ERROR
- || generator_sig()
+ || coroutine_sig()
}
-fn generator_capture() -> impl Sized {
+fn coroutine_capture() -> impl Sized {
//~^ ERROR
- let x = generator_capture();
+ let x = coroutine_capture();
move || {
yield;
x;
@@ -69,10 +69,10 @@ fn substs_change<T: 'static>() -> impl Sized {
(substs_change::<&T>(),)
}
-fn generator_hold() -> impl Sized {
+fn coroutine_hold() -> impl Sized {
//~^ ERROR
move || {
- let x = generator_hold();
+ let x = coroutine_hold();
yield;
x;
}
diff --git a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr
index 1d919fb52..8e9aa8ad0 100644
--- a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr
+++ b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr
@@ -81,24 +81,24 @@ LL | || closure_sig()
error[E0720]: cannot resolve opaque type
--> $DIR/recursive-impl-trait-type-indirect.rs:53:23
|
-LL | fn generator_sig() -> impl Sized {
+LL | fn coroutine_sig() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
LL |
-LL | || generator_sig()
+LL | || coroutine_sig()
| ------------------ returning here with type `{closure@$DIR/recursive-impl-trait-type-indirect.rs:55:5: 55:7}`
error[E0720]: cannot resolve opaque type
--> $DIR/recursive-impl-trait-type-indirect.rs:58:27
|
-LL | fn generator_capture() -> impl Sized {
+LL | fn coroutine_capture() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
...
LL | / move || {
LL | | yield;
LL | | x;
- | | - generator captures itself here
+ | | - coroutine captures itself here
LL | | }
- | |_____- returning here with type `{generator@$DIR/recursive-impl-trait-type-indirect.rs:61:5: 61:12}`
+ | |_____- returning here with type `{coroutine@$DIR/recursive-impl-trait-type-indirect.rs:61:5: 61:12}`
error[E0720]: cannot resolve opaque type
--> $DIR/recursive-impl-trait-type-indirect.rs:67:35
@@ -112,11 +112,11 @@ LL | (substs_change::<&T>(),)
error[E0720]: cannot resolve opaque type
--> $DIR/recursive-impl-trait-type-indirect.rs:72:24
|
-LL | fn generator_hold() -> impl Sized {
+LL | fn coroutine_hold() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
...
-LL | let x = generator_hold();
- | - generator captures itself here
+LL | let x = coroutine_hold();
+ | - coroutine captures itself here
error[E0720]: cannot resolve opaque type
--> $DIR/recursive-impl-trait-type-indirect.rs:86:26
diff --git a/tests/ui/impl-trait/static-lifetime-return-position-impl-trait.rs b/tests/ui/impl-trait/static-lifetime-return-position-impl-trait.rs
index 98dbaf036..91a0e0d48 100644
--- a/tests/ui/impl-trait/static-lifetime-return-position-impl-trait.rs
+++ b/tests/ui/impl-trait/static-lifetime-return-position-impl-trait.rs
@@ -1,7 +1,7 @@
// check-pass
#![allow(incomplete_features)]
-#![feature(adt_const_params, return_position_impl_trait_in_trait)]
+#![feature(adt_const_params)]
pub struct Element;
diff --git a/tests/ui/impl-trait/type_parameters_captured.stderr b/tests/ui/impl-trait/type_parameters_captured.stderr
index fb502cfdd..46859296f 100644
--- a/tests/ui/impl-trait/type_parameters_captured.stderr
+++ b/tests/ui/impl-trait/type_parameters_captured.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/type_parameters_captured.rs:8:5
|
LL | x
- | ^ ...so that the type `T` will meet its required lifetime bounds
+ | ^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn foo<T: 'static>(x: T) -> impl Any + 'static {
| +++++++++
diff --git a/tests/ui/impl-trait/unactionable_diagnostic.fixed b/tests/ui/impl-trait/unactionable_diagnostic.fixed
index 6c2505177..d446512ff 100644
--- a/tests/ui/impl-trait/unactionable_diagnostic.fixed
+++ b/tests/ui/impl-trait/unactionable_diagnostic.fixed
@@ -14,7 +14,7 @@ fn foo<'x, P>(
}
pub fn bar<'t, T: 't>(
- //~^ HELP: consider adding an explicit lifetime bound...
+ //~^ HELP: consider adding an explicit lifetime bound
post: T,
x: &'t Foo,
) -> &'t impl Trait {
diff --git a/tests/ui/impl-trait/unactionable_diagnostic.rs b/tests/ui/impl-trait/unactionable_diagnostic.rs
index bce35cbdd..76b9a62ca 100644
--- a/tests/ui/impl-trait/unactionable_diagnostic.rs
+++ b/tests/ui/impl-trait/unactionable_diagnostic.rs
@@ -14,7 +14,7 @@ fn foo<'x, P>(
}
pub fn bar<'t, T>(
- //~^ HELP: consider adding an explicit lifetime bound...
+ //~^ HELP: consider adding an explicit lifetime bound
post: T,
x: &'t Foo,
) -> &'t impl Trait {
diff --git a/tests/ui/impl-trait/unactionable_diagnostic.stderr b/tests/ui/impl-trait/unactionable_diagnostic.stderr
index a32004cda..4df7f45c3 100644
--- a/tests/ui/impl-trait/unactionable_diagnostic.stderr
+++ b/tests/ui/impl-trait/unactionable_diagnostic.stderr
@@ -1,10 +1,13 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/unactionable_diagnostic.rs:21:5
|
+LL | pub fn bar<'t, T>(
+ | -- the parameter type `T` must be valid for the lifetime `'t` as defined here...
+...
LL | foo(post, x)
| ^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | pub fn bar<'t, T: 't>(
| ++++
diff --git a/tests/ui/impl-trait/universal-mismatched-type.stderr b/tests/ui/impl-trait/universal-mismatched-type.stderr
index a56e542d8..82e0f2396 100644
--- a/tests/ui/impl-trait/universal-mismatched-type.stderr
+++ b/tests/ui/impl-trait/universal-mismatched-type.stderr
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | fn foo(x: impl Debug) -> String {
| ---------- ------ expected `String` because of return type
| |
- | this type parameter
+ | found this type parameter
LL | x
| ^ expected `String`, found type parameter `impl Debug`
|
diff --git a/tests/ui/impl-trait/where-allowed-2.stderr b/tests/ui/impl-trait/where-allowed-2.stderr
index 2b328c01c..b3765ac1a 100644
--- a/tests/ui/impl-trait/where-allowed-2.stderr
+++ b/tests/ui/impl-trait/where-allowed-2.stderr
@@ -1,9 +1,11 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
--> $DIR/where-allowed-2.rs:3:30
|
LL | fn in_adt_in_return() -> Vec<impl Debug> { panic!() }
| ^^^^^^^^^^ cannot infer type
+ |
+ = note: cannot satisfy `_: Debug`
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/impl-trait/where-allowed.rs b/tests/ui/impl-trait/where-allowed.rs
index 509d27166..158dc5ab9 100644
--- a/tests/ui/impl-trait/where-allowed.rs
+++ b/tests/ui/impl-trait/where-allowed.rs
@@ -16,47 +16,47 @@ fn in_adt_in_parameters(_: Vec<impl Debug>) { panic!() }
// Disallowed
fn in_fn_parameter_in_parameters(_: fn(impl Debug)) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
fn in_fn_return_in_parameters(_: fn() -> impl Debug) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
fn in_fn_parameter_in_return() -> fn(impl Debug) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
fn in_fn_return_in_return() -> fn() -> impl Debug { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
fn in_dyn_Fn_parameter_in_parameters(_: &dyn Fn(impl Debug)) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
fn in_dyn_Fn_return_in_parameters(_: &dyn Fn() -> impl Debug) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
fn in_dyn_Fn_parameter_in_return() -> &'static dyn Fn(impl Debug) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Allowed
fn in_dyn_Fn_return_in_return() -> &'static dyn Fn() -> impl Debug { panic!() }
// Disallowed
fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
//~^^ ERROR nested `impl Trait` is not allowed
// Disallowed
fn in_impl_Fn_return_in_parameters(_: &impl Fn() -> impl Debug) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
//~| ERROR nested `impl Trait` is not allowed
// Allowed
@@ -64,11 +64,11 @@ fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { panic!()
// Disallowed
fn in_Fn_parameter_in_generics<F: Fn(impl Debug)> (_: F) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
fn in_Fn_return_in_generics<F: Fn() -> impl Debug> (_: F) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Allowed
@@ -81,22 +81,22 @@ fn in_impl_Trait_in_return() -> impl IntoIterator<Item = impl IntoIterator> {
// Disallowed
struct InBraceStructField { x: impl Debug }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
struct InAdtInBraceStructField { x: Vec<impl Debug> }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
struct InTupleStructField(impl Debug);
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
enum InEnum {
InBraceVariant { x: impl Debug },
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
InTupleVariant(impl Debug),
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
}
// Allowed
@@ -104,10 +104,9 @@ trait InTraitDefnParameters {
fn in_parameters(_: impl Debug);
}
-// Disallowed
+// Allowed
trait InTraitDefnReturn {
fn in_return() -> impl Debug;
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
}
// Allowed and disallowed in trait impls
@@ -124,7 +123,7 @@ impl DummyTrait for () {
// Allowed
fn in_trait_impl_return() -> impl Debug { () }
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ // Allowed
}
// Allowed
@@ -137,10 +136,10 @@ impl DummyType {
// Disallowed
extern "C" {
fn in_foreign_parameters(_: impl Debug);
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
fn in_foreign_return() -> impl Debug;
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
}
// Allowed
@@ -156,97 +155,97 @@ type InTypeAlias<R> = impl Debug;
//~^ ERROR `impl Trait` in type aliases is unstable
type InReturnInTypeAlias<R> = fn() -> impl Debug;
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
//~| ERROR `impl Trait` in type aliases is unstable
// Disallowed in impl headers
impl PartialEq<impl Debug> for () {
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
}
// Disallowed in impl headers
impl PartialEq<()> for impl Debug {
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
}
// Disallowed in inherent impls
impl impl Debug {
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
}
// Disallowed in inherent impls
struct InInherentImplAdt<T> { t: T }
impl InInherentImplAdt<impl Debug> {
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
}
// Disallowed in where clauses
fn in_fn_where_clause()
where impl Debug: Debug
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
{
}
// Disallowed in where clauses
fn in_adt_in_fn_where_clause()
where Vec<impl Debug>: Debug
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
{
}
// Disallowed
fn in_trait_parameter_in_fn_where_clause<T>()
where T: PartialEq<impl Debug>
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
{
}
// Disallowed
fn in_Fn_parameter_in_fn_where_clause<T>()
where T: Fn(impl Debug)
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
{
}
// Disallowed
fn in_Fn_return_in_fn_where_clause<T>()
where T: Fn() -> impl Debug
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
{
}
// Disallowed
struct InStructGenericParamDefault<T = impl Debug>(T);
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
enum InEnumGenericParamDefault<T = impl Debug> { Variant(T) }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
trait InTraitGenericParamDefault<T = impl Debug> {}
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
type InTypeAliasGenericParamDefault<T = impl Debug> = T;
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
impl <T = impl Debug> T {}
//~^ ERROR defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
//~| WARNING this was previously accepted by the compiler but is being phased out
-//~| ERROR `impl Trait` only allowed in function and inherent method return types
+//~| ERROR `impl Trait` only allowed in function and inherent method argument and return types
//~| ERROR no nominal type found
// Disallowed
fn in_method_generic_param_default<T = impl Debug>(_: T) {}
//~^ ERROR defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
//~| WARNING this was previously accepted by the compiler but is being phased out
-//~| ERROR `impl Trait` only allowed in function and inherent method return types
+//~| ERROR `impl Trait` only allowed in function and inherent method argument and return types
fn main() {
let _in_local_variable: impl Fn() = || {};
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
let _in_return_in_local_variable = || -> impl Fn() { || {} };
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
}
diff --git a/tests/ui/impl-trait/where-allowed.stderr b/tests/ui/impl-trait/where-allowed.stderr
index 3e2934379..2d8895030 100644
--- a/tests/ui/impl-trait/where-allowed.stderr
+++ b/tests/ui/impl-trait/where-allowed.stderr
@@ -17,7 +17,7 @@ LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic
| outer `impl Trait`
error[E0658]: `impl Trait` in associated types is unstable
- --> $DIR/where-allowed.rs:120:16
+ --> $DIR/where-allowed.rs:119:16
|
LL | type Out = impl Debug;
| ^^^^^^^^^^
@@ -26,7 +26,7 @@ LL | type Out = impl Debug;
= help: add `#![feature(impl_trait_in_assoc_type)]` to the crate attributes to enable
error[E0658]: `impl Trait` in type aliases is unstable
- --> $DIR/where-allowed.rs:155:23
+ --> $DIR/where-allowed.rs:154:23
|
LL | type InTypeAlias<R> = impl Debug;
| ^^^^^^^^^^
@@ -35,7 +35,7 @@ LL | type InTypeAlias<R> = impl Debug;
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
error[E0658]: `impl Trait` in type aliases is unstable
- --> $DIR/where-allowed.rs:158:39
+ --> $DIR/where-allowed.rs:157:39
|
LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
| ^^^^^^^^^^
@@ -43,248 +43,230 @@ LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer params
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer params
--> $DIR/where-allowed.rs:18:40
|
LL | fn in_fn_parameter_in_parameters(_: fn(impl Debug)) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer return types
--> $DIR/where-allowed.rs:22:42
|
LL | fn in_fn_return_in_parameters(_: fn() -> impl Debug) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer params
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer params
--> $DIR/where-allowed.rs:26:38
|
LL | fn in_fn_parameter_in_return() -> fn(impl Debug) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer return types
--> $DIR/where-allowed.rs:30:40
|
LL | fn in_fn_return_in_return() -> fn() -> impl Debug { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
--> $DIR/where-allowed.rs:34:49
|
LL | fn in_dyn_Fn_parameter_in_parameters(_: &dyn Fn(impl Debug)) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return types
--> $DIR/where-allowed.rs:38:51
|
LL | fn in_dyn_Fn_return_in_parameters(_: &dyn Fn() -> impl Debug) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
--> $DIR/where-allowed.rs:42:55
|
LL | fn in_dyn_Fn_parameter_in_return() -> &'static dyn Fn(impl Debug) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
--> $DIR/where-allowed.rs:49:51
|
LL | fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return types
--> $DIR/where-allowed.rs:54:53
|
LL | fn in_impl_Fn_return_in_parameters(_: &impl Fn() -> impl Debug) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
--> $DIR/where-allowed.rs:58:57
|
LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
--> $DIR/where-allowed.rs:66:38
|
LL | fn in_Fn_parameter_in_generics<F: Fn(impl Debug)> (_: F) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return types
--> $DIR/where-allowed.rs:70:40
|
LL | fn in_Fn_return_in_generics<F: Fn() -> impl Debug> (_: F) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in field types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in field types
--> $DIR/where-allowed.rs:83:32
|
LL | struct InBraceStructField { x: impl Debug }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in field types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in field types
--> $DIR/where-allowed.rs:87:41
|
LL | struct InAdtInBraceStructField { x: Vec<impl Debug> }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in field types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in field types
--> $DIR/where-allowed.rs:91:27
|
LL | struct InTupleStructField(impl Debug);
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in field types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in field types
--> $DIR/where-allowed.rs:96:25
|
LL | InBraceVariant { x: impl Debug },
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in field types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in field types
--> $DIR/where-allowed.rs:98:20
|
LL | InTupleVariant(impl Debug),
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return types
- --> $DIR/where-allowed.rs:109:23
- |
-LL | fn in_return() -> impl Debug;
- | ^^^^^^^^^^
- |
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
-
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
- --> $DIR/where-allowed.rs:126:34
- |
-LL | fn in_trait_impl_return() -> impl Debug { () }
- | ^^^^^^^^^^
- |
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
-
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `extern fn` params
- --> $DIR/where-allowed.rs:139:33
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `extern fn` params
+ --> $DIR/where-allowed.rs:138:33
|
LL | fn in_foreign_parameters(_: impl Debug);
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `extern fn` return types
- --> $DIR/where-allowed.rs:142:31
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `extern fn` return types
+ --> $DIR/where-allowed.rs:141:31
|
LL | fn in_foreign_return() -> impl Debug;
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return types
- --> $DIR/where-allowed.rs:158:39
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer return types
+ --> $DIR/where-allowed.rs:157:39
|
LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in traits
- --> $DIR/where-allowed.rs:163:16
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in traits
+ --> $DIR/where-allowed.rs:162:16
|
LL | impl PartialEq<impl Debug> for () {
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in impl headers
- --> $DIR/where-allowed.rs:168:24
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in impl headers
+ --> $DIR/where-allowed.rs:167:24
|
LL | impl PartialEq<()> for impl Debug {
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in impl headers
- --> $DIR/where-allowed.rs:173:6
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in impl headers
+ --> $DIR/where-allowed.rs:172:6
|
LL | impl impl Debug {
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in impl headers
- --> $DIR/where-allowed.rs:179:24
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in impl headers
+ --> $DIR/where-allowed.rs:178:24
|
LL | impl InInherentImplAdt<impl Debug> {
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in bounds
- --> $DIR/where-allowed.rs:185:11
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in bounds
+ --> $DIR/where-allowed.rs:184:11
|
LL | where impl Debug: Debug
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in bounds
- --> $DIR/where-allowed.rs:192:15
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in bounds
+ --> $DIR/where-allowed.rs:191:15
|
LL | where Vec<impl Debug>: Debug
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in bounds
- --> $DIR/where-allowed.rs:199:24
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in bounds
+ --> $DIR/where-allowed.rs:198:24
|
LL | where T: PartialEq<impl Debug>
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params
- --> $DIR/where-allowed.rs:206:17
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
+ --> $DIR/where-allowed.rs:205:17
|
LL | where T: Fn(impl Debug)
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return types
- --> $DIR/where-allowed.rs:213:22
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return types
+ --> $DIR/where-allowed.rs:212:22
|
LL | where T: Fn() -> impl Debug
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
- --> $DIR/where-allowed.rs:219:40
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
+ --> $DIR/where-allowed.rs:218:40
|
LL | struct InStructGenericParamDefault<T = impl Debug>(T);
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
- --> $DIR/where-allowed.rs:223:36
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
+ --> $DIR/where-allowed.rs:222:36
|
LL | enum InEnumGenericParamDefault<T = impl Debug> { Variant(T) }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
- --> $DIR/where-allowed.rs:227:38
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
+ --> $DIR/where-allowed.rs:226:38
|
LL | trait InTraitGenericParamDefault<T = impl Debug> {}
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
- --> $DIR/where-allowed.rs:231:41
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
+ --> $DIR/where-allowed.rs:230:41
|
LL | type InTypeAliasGenericParamDefault<T = impl Debug> = T;
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
- --> $DIR/where-allowed.rs:235:11
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
+ --> $DIR/where-allowed.rs:234:11
|
LL | impl <T = impl Debug> T {}
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
- --> $DIR/where-allowed.rs:242:40
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
+ --> $DIR/where-allowed.rs:241:40
|
LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
- --> $DIR/where-allowed.rs:248:29
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
+ --> $DIR/where-allowed.rs:247:29
|
LL | let _in_local_variable: impl Fn() = || {};
| ^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in closure return types
- --> $DIR/where-allowed.rs:250:46
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in closure return types
+ --> $DIR/where-allowed.rs:249:46
|
LL | let _in_return_in_local_variable = || -> impl Fn() { || {} };
| ^^^^^^^^^
error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
- --> $DIR/where-allowed.rs:235:7
+ --> $DIR/where-allowed.rs:234:7
|
LL | impl <T = impl Debug> T {}
| ^^^^^^^^^^^^^^
@@ -294,7 +276,7 @@ LL | impl <T = impl Debug> T {}
= note: `#[deny(invalid_type_param_default)]` on by default
error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
- --> $DIR/where-allowed.rs:242:36
+ --> $DIR/where-allowed.rs:241:36
|
LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
| ^^^^^^^^^^^^^^
@@ -303,14 +285,14 @@ LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
= note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
error[E0118]: no nominal type found for inherent implementation
- --> $DIR/where-allowed.rs:235:1
+ --> $DIR/where-allowed.rs:234:1
|
LL | impl <T = impl Debug> T {}
| ^^^^^^^^^^^^^^^^^^^^^^^ impl requires a nominal type
|
= note: either implement a trait on it or create a newtype to wrap it instead
-error: aborting due to 47 previous errors
+error: aborting due to 45 previous errors
Some errors have detailed explanations: E0118, E0562, E0658, E0666.
For more information about an error, try `rustc --explain E0118`.