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

Don't ICE on bad extern paths #17991

Merged
merged 1 commit into from
Oct 14, 2014
Merged

Don't ICE on bad extern paths #17991

merged 1 commit into from
Oct 14, 2014

Conversation

sfackler
Copy link
Member

Closes #17990

let file = match loc.filename_str() {
Some(file) => file,
None => {
sess.err(format!("extern location is not a file: {}",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this could be "location for crate {} is not a file: {}" using self.crate_name.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I formatted this error like the other ones in the closure. Should those be changed as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see. Changing them to include the crate name would make them more informative.

@sfackler
Copy link
Member Author

@huonw updated

@alexcrichton
Copy link
Member

r=me with a test added

@sfackler
Copy link
Member Author

@alexcrichton were you looking for something more than src/test/compile-fail/empty-extern-arg.rs?

@alexcrichton
Copy link
Member

Wow, I should have just kept reading, sorry about that!

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Oct 13, 2014
@bors bors merged commit 84d1cbf into rust-lang:master Oct 14, 2014
@sfackler sfackler deleted the extern-error branch November 26, 2016 05:54
lnicola pushed a commit to lnicola/rust that referenced this pull request Aug 29, 2024
… r=Veykril

fix: Don't add reference when it isn't needed for the "Extract variable" assist

I.e. don't generate `let var_name = &foo()`. Because it always irritates me when I need to fix that.

Anything that creates a new value don't need a reference. That excludes mostly field accesses and indexing.

I had a thought that we can also not generate a reference for fields and indexing as long as the type is `Copy`, but sometimes people impl `Copy` even when they don't want to copy the values (e.g. a large type), so I didn't do that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rustc failed at Option::unwrap() on None value
4 participants