-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Bug report #40773
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
Comments
A smaller example: trait IterExtensions {}
impl<T> IterExtensions for Iterator<Item = T>
where Self::Item: PartialEq {}
fn main() {} On Rust Playground, this ICE only for stable.
Backtrace:
|
This was fixed in #39939 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
fn main() {
let vec_str = vec!["a", "b", "c"];
println!("vec_str: {:?}", vec_str.iter().foo("b").unwrap());
println!("vec_str: {:?} again", vec_str.iter().foo("b").unwrap());
println!();
/* let vec_int = vec![1, 2, 3];
println!("vec_int: {:?}", vec_int.iter().foo(2).unwrap());
println!("vec_int: {:?} again", vec_int.iter().foo(2).unwrap());
println!();
let arr_int = [1, 2, 3];
println!("arr_int: {:?}", arr_int.iter().foo(2).unwrap());
println!("arr_int: {:?} again", arr_int.iter().foo(2).unwrap());
println!();
*/
// println!("Iter: {:?}", std::env::args().foo("./out".to_string()));
// println!("Iter: {:?} again", std::env::args().foo("./out".to_string()));
}
trait IterExtensions where Self: Iterator {
fn foo(&self, param: &str) -> OptionSelf::Item;
}
impl IterExtensions for Iterator<Item = T> where T: Iterator<Item = T>,
Self::Item: PartialEq {
fn foo(&self, param: &str) -> OptionSelf::Item {
self.skip_while(|elem| *elem != ¶m)
.next()
}
}
/*trait IterExtensions: Iterator {
fn foo(self, param: T) -> OptionSelf::Item
where Self: Iterator + Sized,
for<'a> Self::Item: PartialEq<&'a T> {
foo(self, param)
}
}
impl<T: ?Sized> IterExtensions for T where T: Iterator {}
fn foo<I, T>(iter: I, param: T) -> Option<I::Item>
where I: Iterator,
for<'a> I::Item: PartialEq<&'a T> {
iter.skip_while(|elem| *elem != ¶m)
.next()
}
*/
rustc 1.16.0 (30cf806 2017-03-10)
error:
Self
type is used before it's determined--> :26:43
|
26 | Self::Item: PartialEq {
| ^^^^^^^^^^
error: internal compiler error: /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/librustc/ty/mod.rs:1849: No def'n found for DefId { krate: CrateNum(0), node: DefIndex(9) => rust_out/4089d7c8b778d88cec885baf7b69e6df-exe::{{impl}}[0] } in tcx.impl_trait_refs
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
thread 'rustc' panicked at 'Box', /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/librustc_errors/lib.rs:416
note: Run with
RUST_BACKTRACE=1
for a backtrace.Compilation failed.
The text was updated successfully, but these errors were encountered: