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

Perform imports from thiserror through absolute path #368

Merged
merged 1 commit into from
Nov 6, 2024
Merged

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Nov 6, 2024

The previous way this was written could have its meaning changed by the presence of a module or type called thiserror, which is different from the crate thiserror. The new expansion refers unambiguously to a crate.

Before:

#[derive(::thiserror::Error, Debug)]
#[error("{0}")]
pub struct Error(i32);

mod thiserror {}
error[E0432]: unresolved import `thiserror`
 --> src/main.rs:1:10
  |
1 | #[derive(::thiserror::Error, Debug)]
  |          ^^^^^^^^^^^^^^^^^^ could not find `__private` in `thiserror`
  |
  = note: this error originates in the derive macro `::thiserror::Error` (in Nightly builds, run with -Z macro-backtrace for more info)

After: compiles successfully.

@dtolnay dtolnay merged commit 12b8c27 into master Nov 6, 2024
19 checks passed
@dtolnay dtolnay deleted the usethiserror branch November 6, 2024 00:14
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.

1 participant