summaryrefslogtreecommitdiffstats
path: root/tests/ui/traits/non_lifetime_binders
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:26:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:26:03 +0000
commit9918693037dce8aa4bb6f08741b6812923486c18 (patch)
tree21d2b40bec7e6a7ea664acee056eb3d08e15a1cf /tests/ui/traits/non_lifetime_binders
parentReleasing progress-linux version 1.75.0+dfsg1-5~progress7.99u1. (diff)
downloadrustc-9918693037dce8aa4bb6f08741b6812923486c18.tar.xz
rustc-9918693037dce8aa4bb6f08741b6812923486c18.zip
Merging upstream version 1.76.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/traits/non_lifetime_binders')
-rw-r--r--tests/ui/traits/non_lifetime_binders/bad-copy-cond.stderr2
-rw-r--r--tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.stderr2
-rw-r--r--tests/ui/traits/non_lifetime_binders/drop-impl-pred.no.stderr2
-rw-r--r--tests/ui/traits/non_lifetime_binders/foreach-partial-eq.stderr2
-rw-r--r--tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.stderr2
-rw-r--r--tests/ui/traits/non_lifetime_binders/missing-assoc-item.stderr2
-rw-r--r--tests/ui/traits/non_lifetime_binders/nested-apit-mentioning-outer-bound-var.stderr2
-rw-r--r--tests/ui/traits/non_lifetime_binders/on-dyn.stderr2
-rw-r--r--tests/ui/traits/non_lifetime_binders/on-ptr.stderr2
-rw-r--r--tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.bad.stderr26
-rw-r--r--tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.good.stderr26
-rw-r--r--tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.rs22
-rw-r--r--tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.rs3
-rw-r--r--tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr17
-rw-r--r--tests/ui/traits/non_lifetime_binders/universe-error1.stderr2
15 files changed, 101 insertions, 13 deletions
diff --git a/tests/ui/traits/non_lifetime_binders/bad-copy-cond.stderr b/tests/ui/traits/non_lifetime_binders/bad-copy-cond.stderr
index 07e02d47f..d5f2bfef1 100644
--- a/tests/ui/traits/non_lifetime_binders/bad-copy-cond.stderr
+++ b/tests/ui/traits/non_lifetime_binders/bad-copy-cond.stderr
@@ -19,6 +19,6 @@ note: required by a bound in `foo`
LL | fn foo() where for<T> T: Copy {}
| ^^^^ required by this bound in `foo`
-error: aborting due to previous error; 1 warning emitted
+error: aborting due to 1 previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.stderr b/tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.stderr
index d65892ec6..4e0441c1c 100644
--- a/tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.stderr
+++ b/tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.stderr
@@ -15,5 +15,5 @@ LL | for<const C: usize> [(); C]: Copy,
| |
| parameter defined here
-error: aborting due to previous error; 1 warning emitted
+error: aborting due to 1 previous error; 1 warning emitted
diff --git a/tests/ui/traits/non_lifetime_binders/drop-impl-pred.no.stderr b/tests/ui/traits/non_lifetime_binders/drop-impl-pred.no.stderr
index a985b1a6e..1f13207e3 100644
--- a/tests/ui/traits/non_lifetime_binders/drop-impl-pred.no.stderr
+++ b/tests/ui/traits/non_lifetime_binders/drop-impl-pred.no.stderr
@@ -19,6 +19,6 @@ note: the implementor must specify the same requirement
LL | struct Bar<T>(T) where T: Foo;
| ^^^^^^^^^^^^^
-error: aborting due to previous error; 1 warning emitted
+error: aborting due to 1 previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0367`.
diff --git a/tests/ui/traits/non_lifetime_binders/foreach-partial-eq.stderr b/tests/ui/traits/non_lifetime_binders/foreach-partial-eq.stderr
index da09343fb..8cf32c894 100644
--- a/tests/ui/traits/non_lifetime_binders/foreach-partial-eq.stderr
+++ b/tests/ui/traits/non_lifetime_binders/foreach-partial-eq.stderr
@@ -23,6 +23,6 @@ LL | where
LL | for<T> T: PartialEq + PartialOrd,
| ^^^^^^^^^^ required by this bound in `auto_trait`
-error: aborting due to previous error; 1 warning emitted
+error: aborting due to 1 previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.stderr b/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.stderr
index dc54e1acc..cc482887c 100644
--- a/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.stderr
+++ b/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.stderr
@@ -23,5 +23,5 @@ LL | for<T> [i32; { let _: T = todo!(); 0 }]:,
| |
| parameter defined here
-error: aborting due to previous error; 2 warnings emitted
+error: aborting due to 1 previous error; 2 warnings emitted
diff --git a/tests/ui/traits/non_lifetime_binders/missing-assoc-item.stderr b/tests/ui/traits/non_lifetime_binders/missing-assoc-item.stderr
index d98538642..eecf8e88f 100644
--- a/tests/ui/traits/non_lifetime_binders/missing-assoc-item.stderr
+++ b/tests/ui/traits/non_lifetime_binders/missing-assoc-item.stderr
@@ -18,6 +18,6 @@ help: if there were a trait named `Example` with associated type `Item` implemen
LL | for<B> <B as Example>::Item: Send,
| ~~~~~~~~~~~~~~~~~~~~
-error: aborting due to previous error; 1 warning emitted
+error: aborting due to 1 previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0223`.
diff --git a/tests/ui/traits/non_lifetime_binders/nested-apit-mentioning-outer-bound-var.stderr b/tests/ui/traits/non_lifetime_binders/nested-apit-mentioning-outer-bound-var.stderr
index 1124076c2..830446915 100644
--- a/tests/ui/traits/non_lifetime_binders/nested-apit-mentioning-outer-bound-var.stderr
+++ b/tests/ui/traits/non_lifetime_binders/nested-apit-mentioning-outer-bound-var.stderr
@@ -13,5 +13,5 @@ error: `impl Trait` can only mention type parameters from an fn or impl
LL | fn uwu(_: impl for<T> Trait<(), Assoc = impl Trait<T>>) {}
| - type parameter declared here ^
-error: aborting due to previous error; 1 warning emitted
+error: aborting due to 1 previous error; 1 warning emitted
diff --git a/tests/ui/traits/non_lifetime_binders/on-dyn.stderr b/tests/ui/traits/non_lifetime_binders/on-dyn.stderr
index 95656f999..2d330f6b1 100644
--- a/tests/ui/traits/non_lifetime_binders/on-dyn.stderr
+++ b/tests/ui/traits/non_lifetime_binders/on-dyn.stderr
@@ -13,5 +13,5 @@ error: late-bound type parameter not allowed on trait object types
LL | fn foo() -> &'static dyn for<T> Test<T> {
| ^
-error: aborting due to previous error; 1 warning emitted
+error: aborting due to 1 previous error; 1 warning emitted
diff --git a/tests/ui/traits/non_lifetime_binders/on-ptr.stderr b/tests/ui/traits/non_lifetime_binders/on-ptr.stderr
index 3b17f7697..fbd723a1b 100644
--- a/tests/ui/traits/non_lifetime_binders/on-ptr.stderr
+++ b/tests/ui/traits/non_lifetime_binders/on-ptr.stderr
@@ -13,5 +13,5 @@ error: late-bound type parameter not allowed on function pointer types
LL | fn foo() -> for<T> fn(T) {
| ^
-error: aborting due to previous error; 1 warning emitted
+error: aborting due to 1 previous error; 1 warning emitted
diff --git a/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.bad.stderr b/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.bad.stderr
new file mode 100644
index 000000000..7dd383b1e
--- /dev/null
+++ b/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.bad.stderr
@@ -0,0 +1,26 @@
+warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/placeholders-dont-outlive-static.rs:6:12
+ |
+LL | #![feature(non_lifetime_binders)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error[E0310]: the placeholder type `!1_"T"` may not live long enough
+ --> $DIR/placeholders-dont-outlive-static.rs:13:5
+ |
+LL | foo();
+ | ^^^^^
+ | |
+ | the placeholder type `!1_"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
+ |
+LL | fn bad() where !1_"T": 'static {
+ | +++++++++++++++++++++
+
+error: aborting due to 1 previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0310`.
diff --git a/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.good.stderr b/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.good.stderr
new file mode 100644
index 000000000..b4f00978a
--- /dev/null
+++ b/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.good.stderr
@@ -0,0 +1,26 @@
+warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/placeholders-dont-outlive-static.rs:6:12
+ |
+LL | #![feature(non_lifetime_binders)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error[E0310]: the placeholder type `!1_"T"` may not live long enough
+ --> $DIR/placeholders-dont-outlive-static.rs:19:5
+ |
+LL | foo();
+ | ^^^^^
+ | |
+ | the placeholder type `!1_"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
+ |
+LL | fn good() where for<T> T: 'static, !1_"T": 'static {
+ | +++++++++++++++++
+
+error: aborting due to 1 previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0310`.
diff --git a/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.rs b/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.rs
new file mode 100644
index 000000000..ae6866511
--- /dev/null
+++ b/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.rs
@@ -0,0 +1,22 @@
+// revisions: good bad
+
+//[good] known-bug: unknown
+// `for<T> T: 'static` doesn't imply itself when processing outlives obligations
+
+#![feature(non_lifetime_binders)]
+//[bad]~^ WARN the feature `non_lifetime_binders` is incomplete
+
+fn foo() where for<T> T: 'static {}
+
+#[cfg(bad)]
+fn bad() {
+ foo();
+ //[bad]~^ ERROR the placeholder type `!1_"T"` may not live long enough
+}
+
+#[cfg(good)]
+fn good() where for<T> T: 'static {
+ foo();
+}
+
+fn main() {}
diff --git a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.rs b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.rs
index 5ff7089b9..53957914e 100644
--- a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.rs
+++ b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.rs
@@ -1,10 +1,9 @@
// edition:2021
-// check-pass
+// known-bug: unknown
// Checks that test_type_match code doesn't ICE when predicates have late-bound types
#![feature(non_lifetime_binders)]
-//~^ WARN is incomplete and may not be safe to use
async fn walk2<'a, T: 'a>(_: T)
where
diff --git a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr
index 3609bed28..3a4415ed2 100644
--- a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr
+++ b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr
@@ -7,5 +7,20 @@ LL | #![feature(non_lifetime_binders)]
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
= note: `#[warn(incomplete_features)]` on by default
-warning: 1 warning emitted
+error[E0309]: the placeholder type `!1_"F"` may not live long enough
+ --> $DIR/type-match-with-late-bound.rs:11:1
+ |
+LL | async fn walk2<'a, T: 'a>(_: T)
+ | -- the placeholder type `!1_"F"` must be valid for the lifetime `'a` as defined here...
+...
+LL | {}
+ | ^^ ...so that the type `F` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
+ |
+LL | for<F> F: 'a, !1_"F": 'a
+ | ~~~~~~~~~~~~
+
+error: aborting due to 1 previous error; 1 warning emitted
+For more information about this error, try `rustc --explain E0309`.
diff --git a/tests/ui/traits/non_lifetime_binders/universe-error1.stderr b/tests/ui/traits/non_lifetime_binders/universe-error1.stderr
index bfcad72e3..ecc97e283 100644
--- a/tests/ui/traits/non_lifetime_binders/universe-error1.stderr
+++ b/tests/ui/traits/non_lifetime_binders/universe-error1.stderr
@@ -22,6 +22,6 @@ LL | where
LL | for<T> T: Other<U> {}
| ^^^^^^^^ required by this bound in `foo`
-error: aborting due to previous error; 1 warning emitted
+error: aborting due to 1 previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0277`.