summaryrefslogtreecommitdiffstats
path: root/tests/ui/wf
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:39 +0000
commit1376c5a617be5c25655d0d7cb63e3beaa5a6e026 (patch)
tree3bb8d61aee02bc7a15eab3f36e3b921afc2075d0 /tests/ui/wf
parentReleasing progress-linux version 1.69.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.tar.xz
rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.zip
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/wf')
-rw-r--r--tests/ui/wf/hir-wf-check-erase-regions.rs4
-rw-r--r--tests/ui/wf/hir-wf-check-erase-regions.stderr16
-rw-r--r--tests/ui/wf/issue-110157.rs12
-rw-r--r--tests/ui/wf/issue-110157.stderr32
-rw-r--r--tests/ui/wf/wf-const-type.stderr3
-rw-r--r--tests/ui/wf/wf-static-type.stderr3
6 files changed, 58 insertions, 12 deletions
diff --git a/tests/ui/wf/hir-wf-check-erase-regions.rs b/tests/ui/wf/hir-wf-check-erase-regions.rs
index 2b4b480df..3855f2c35 100644
--- a/tests/ui/wf/hir-wf-check-erase-regions.rs
+++ b/tests/ui/wf/hir-wf-check-erase-regions.rs
@@ -4,10 +4,10 @@
pub struct Table<T, const N: usize>([Option<T>; N]);
impl<'a, T, const N: usize> IntoIterator for &'a Table<T, N> {
- type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>; //~ ERROR `&T` is not an iterator
+ type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>; //~ ERROR `&'a T` is not an iterator
type Item = &'a T;
- fn into_iter(self) -> Self::IntoIter { //~ ERROR `&T` is not an iterator
+ fn into_iter(self) -> Self::IntoIter { //~ ERROR `&'a T` is not an iterator
unimplemented!()
}
}
diff --git a/tests/ui/wf/hir-wf-check-erase-regions.stderr b/tests/ui/wf/hir-wf-check-erase-regions.stderr
index 7bc19dd2e..2843983c7 100644
--- a/tests/ui/wf/hir-wf-check-erase-regions.stderr
+++ b/tests/ui/wf/hir-wf-check-erase-regions.stderr
@@ -1,24 +1,24 @@
-error[E0277]: `&T` is not an iterator
+error[E0277]: `&'a T` is not an iterator
--> $DIR/hir-wf-check-erase-regions.rs:7:21
|
LL | type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&T` is not an iterator
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&'a T` is not an iterator
|
- = help: the trait `Iterator` is not implemented for `&T`
+ = help: the trait `Iterator` is not implemented for `&'a T`
= help: the trait `Iterator` is implemented for `&mut I`
- = note: required for `&T` to implement `IntoIterator`
+ = note: required for `&'a T` to implement `IntoIterator`
note: required by a bound in `Flatten`
--> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL
-error[E0277]: `&T` is not an iterator
+error[E0277]: `&'a T` is not an iterator
--> $DIR/hir-wf-check-erase-regions.rs:10:27
|
LL | fn into_iter(self) -> Self::IntoIter {
- | ^^^^^^^^^^^^^^ `&T` is not an iterator
+ | ^^^^^^^^^^^^^^ `&'a T` is not an iterator
|
- = help: the trait `Iterator` is not implemented for `&T`
+ = help: the trait `Iterator` is not implemented for `&'a T`
= help: the trait `Iterator` is implemented for `&mut I`
- = note: required for `&T` to implement `IntoIterator`
+ = note: required for `&'a T` to implement `IntoIterator`
note: required by a bound in `Flatten`
--> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL
diff --git a/tests/ui/wf/issue-110157.rs b/tests/ui/wf/issue-110157.rs
new file mode 100644
index 000000000..43a8ce72f
--- /dev/null
+++ b/tests/ui/wf/issue-110157.rs
@@ -0,0 +1,12 @@
+struct NeedsDropTypes<'tcx, F>(std::marker::PhantomData<&'tcx F>);
+
+impl<'tcx, F, I> Iterator for NeedsDropTypes<'tcx, F>
+//~^ ERROR type annotations needed
+where
+ F: Fn(&Missing) -> Result<I, ()>,
+ //~^ ERROR cannot find type `Missing` in this scope
+ I: Iterator<Item = Missing>,
+ //~^ ERROR cannot find type `Missing` in this scope
+{}
+
+fn main() {}
diff --git a/tests/ui/wf/issue-110157.stderr b/tests/ui/wf/issue-110157.stderr
new file mode 100644
index 000000000..91d801e94
--- /dev/null
+++ b/tests/ui/wf/issue-110157.stderr
@@ -0,0 +1,32 @@
+error[E0412]: cannot find type `Missing` in this scope
+ --> $DIR/issue-110157.rs:6:12
+ |
+LL | F: Fn(&Missing) -> Result<I, ()>,
+ | ^^^^^^^ not found in this scope
+
+error[E0412]: cannot find type `Missing` in this scope
+ --> $DIR/issue-110157.rs:8:24
+ |
+LL | I: Iterator<Item = Missing>,
+ | ^^^^^^^ not found in this scope
+
+error[E0283]: type annotations needed
+ --> $DIR/issue-110157.rs:3:31
+ |
+LL | impl<'tcx, F, I> Iterator for NeedsDropTypes<'tcx, F>
+ | ^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `I`
+ |
+ = note: cannot satisfy `_: Iterator`
+note: required for `NeedsDropTypes<'tcx, F>` to implement `Iterator`
+ --> $DIR/issue-110157.rs:3:18
+ |
+LL | impl<'tcx, F, I> Iterator for NeedsDropTypes<'tcx, F>
+ | ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | I: Iterator<Item = Missing>,
+ | ------------------------ unsatisfied trait bound introduced here
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0283, E0412.
+For more information about an error, try `rustc --explain E0283`.
diff --git a/tests/ui/wf/wf-const-type.stderr b/tests/ui/wf/wf-const-type.stderr
index 85938364e..617969720 100644
--- a/tests/ui/wf/wf-const-type.stderr
+++ b/tests/ui/wf/wf-const-type.stderr
@@ -12,7 +12,8 @@ LL | struct IsCopy<T:Copy> { t: T }
| ^^^^ required by this bound in `IsCopy`
help: consider annotating `NotCopy` with `#[derive(Copy)]`
|
-LL | #[derive(Copy)]
+LL + #[derive(Copy)]
+LL | struct NotCopy;
|
error: aborting due to previous error
diff --git a/tests/ui/wf/wf-static-type.stderr b/tests/ui/wf/wf-static-type.stderr
index 16c6124b6..bb5a57834 100644
--- a/tests/ui/wf/wf-static-type.stderr
+++ b/tests/ui/wf/wf-static-type.stderr
@@ -12,7 +12,8 @@ LL | struct IsCopy<T:Copy> { t: T }
| ^^^^ required by this bound in `IsCopy`
help: consider annotating `NotCopy` with `#[derive(Copy)]`
|
-LL | #[derive(Copy)]
+LL + #[derive(Copy)]
+LL | struct NotCopy;
|
error: aborting due to previous error