Skip to content
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

Internal compiler error passing an iterator as a parameter. #10467

Closed
dradtke opened this issue Nov 13, 2013 · 5 comments
Closed

Internal compiler error passing an iterator as a parameter. #10467

dradtke opened this issue Nov 13, 2013 · 5 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@dradtke
Copy link

dradtke commented Nov 13, 2013

While practicing my Rust skills by writing a version of GNU cat, I ran into an error that told me to report the results here. The file and the error are included in this gist:

https://gist.github.com/dradtke/7458284

The error only occurs when I try to have cat_files accept an Iterator. If I refactor the code so that it accepts a borrowed pointer to an owned vector of owned strings, then it works.

@alexcrichton
Copy link
Member

What version of the compiler were you running this with? If you updated to the most recent version of master, I think that you'll probably see a better error (not certain, just a guess from looking at the program)

@huonw
Copy link
Member

huonw commented Nov 13, 2013

With rustc 0.9-pre (825b127 2013-11-12 18:56:13 -0800), I see

10467.rs:5:4: 5:13 error: internal compiler error: Cannot relate bound region: ReLateBound(6, BrNamed(syntax::ast::DefId{crate: 0, node: 20}, self)) <= ReInfer(70)
This message reflects a bug in the Rust compiler. 
We would appreciate a bug report: https://github.com/mozilla/rust/wiki/HOWTO-submit-a-Rust-bug-report
10467.rs:5     cat_files(&args.iter().skip(1));
               ^~~~~~~~~
task 'rustc' failed at 'explicit failure', /home/huon/rust/src/libsyntax/diagnostic.rs:75
task '<main>' failed at 'explicit failure', /home/huon/rust/src/librustc/lib.rs:396

when running on the reduced

fn cat_files<'self, T: Iterator<&'self ~str>>(_: &T) {}

fn main() {
    let args = [~"foo"];
    cat_files(&args.iter().skip(1));
}

It's the same error message as #10391, but appears to be a possibly different cause.

@nikomatsakis
Copy link
Contributor

cc me. I've been negligent and not looked at #10391 yet, I'll see if I can peel off some time today to look at both of these.

@nikomatsakis
Copy link
Contributor

This is in fact a dup of #5121

@nikomatsakis
Copy link
Contributor

In particular we don't (yet) support a function like:

fn cat_files<'self, T: Iterator<&'self ~str>>(_: &T) {}

because 'self appears within the trait bound for T.

flip1995 pushed a commit to flip1995/rust that referenced this issue Mar 10, 2023
Add `let_with_type_underscore` lint

Fixes rust-lang#10463
changelog: [`let_with_type_underscore`]: Add the lint.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

4 participants