-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Tidying up UI tests [6/N] #149443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Tidying up UI tests [6/N] #149443
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //! Tests that a struct with a `next` method but without the `Iterator` trait | ||
| //! implementation yields an error in a `for` loop. | ||
|
|
||
| struct MyStruct { | ||
| x: isize, | ||
| y: isize, | ||
| } | ||
|
|
||
| impl MyStruct { | ||
| fn next(&mut self) -> Option<isize> { | ||
| Some(self.x) | ||
| } | ||
| } | ||
|
|
||
| pub fn main() { | ||
| let mut bogus = MyStruct { x: 1, y: 2 }; | ||
| for x in bogus { | ||
| //~^ ERROR `MyStruct` is not an iterator | ||
| drop(x); | ||
| } | ||
| } |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| //! Tests that dereferencing a Box<dyn Iterator> in a for loop correctly yields an error, | ||
| //! as the unsized trait object does not implement IntoIterator. | ||
| //! regression test for <https://github.com/rust-lang/rust/issues/20605> | ||
| //@ revisions: current next | ||
| //@ ignore-compare-mode-next-solver (explicit revisions) | ||
| //@[next] compile-flags: -Znext-solver | ||
|
|
||
| fn changer<'a>(mut things: Box<dyn Iterator<Item = &'a mut u8>>) { | ||
| for item in *things { | ||
| //~^ ERROR `dyn Iterator<Item = &'a mut u8>` is not an iterator | ||
| *item = 0 | ||
| } | ||
| } | ||
|
|
||
| fn main() {} | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since there was only one test in the trait-object directory (and it wasn't in README.md), I moved it to traits/object. |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a quastion.
Can it be considered the same as
for-loop-while/iter-from-mac-call.rsandtraits/dyn-iterator-deref-in-for-loop?When this test was first added, there were no special flags. 3a62590
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like it's fine to consider them as the same test, because this two functions are basically the same, you maybe could remove this f1 function and keep
traits/dyn-iterator-deref-in-for-loop