We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I tried to use the conservative impl trait to let me return an iterator over &str. I used the following code:
struct Parent { children: Option<Vec<String>> } impl Parent { pub fn children() -> impl Iterator<Item=&str> { self.children.unwrap_or(Vec::new()).iter() } }
I expected an iterator to be returned, but I got this odd error and a message asking me to submit a bug.
error: internal compiler error: src/librustc_typeck/check/mod.rs:670: escaping regions in predicate Obligation(predicate=Binder(ProjectionPredicate(ProjectionTy { substs: Slice([_]), item_def_id: DefId(2/0:1695 ~ core[b72a]::iter[0]::iterator[0]::Iterator[0]::Item[0]) }, &str)),depth=0) --> lib.rs:36:31 | 36 | pub fn children(&self) -> impl Iterator<Item=&str> | ^^^^^^^^^^^^^^^^^^^^^^^^ note: the compiler unexpectedly panicked. this is a bug. note: rustc 1.24.0-nightly (5a2465e2b 2017-12-06) running on x86_64-apple-darwin thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:448:8 note: Run with `RUST_BACKTRACE=1` for a backtrace.
The text was updated successfully, but these errors were encountered:
Duplicate of #43396, I believe. (Closing in favor of that bug.)
Sorry, something went wrong.
impl Trait
No branches or pull requests
I tried to use the conservative impl trait to let me return an iterator over &str. I used the following code:
I expected an iterator to be returned, but I got this odd error and a message asking me to submit a bug.
The text was updated successfully, but these errors were encountered: