Skip to content

Improve wording for external crate resolution error #77379

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/src/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
}
_ => {
if !ident.is_path_segment_keyword() {
format!("no `{}` external crate", ident)
format!("no external crate `{}`", ident)
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 considered changing it to "no external crate named", but I didn't want to be wordy. What do you think?

Suggested change
format!("no external crate `{}`", ident)
format!("no external crate named `{}`", ident)

Copy link
Member

Choose a reason for hiding this comment

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

I think that the PR's current wording is fine, but I don't feel strongly - either is an improvement.

} else {
// HACK(eddyb) this shows up for `self` & `super`, which
// should work instead - for now keep the same error message.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0432]: unresolved import `ycrate`
--> $DIR/non-existent-3.rs:3:5
|
LL | use ycrate;
| ^^^^^^ no `ycrate` external crate
| ^^^^^^ no external crate `ycrate`

error: aborting due to previous error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0432]: unresolved import `alloc`
--> $DIR/not-allowed.rs:5:5
|
LL | use alloc;
| ^^^^^ no `alloc` external crate
| ^^^^^ no external crate `alloc`

error: aborting due to previous error

Expand Down