-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
added more context for duplicate lang item errors (fixes #60561) #64678
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @matthewjasper (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Changing rust/src/librustc/middle/cstore.rs Line 132 in 8e4d0ac
|
@matthewjasper thanks a lot! I tried to preserve what |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you squash your commits?
4af63be
to
acf8053
Compare
@matthewjasper I squashed the commits. |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Where possible, the error message includes the name of the crate that brought in the crate with duplicate lang items (which helps with debugging). This information is passed on from cstore using the `extern_crate` query.
acf8053
to
ac9aed5
Compare
@bors r+ |
📌 Commit ac9aed5 has been approved by |
…asper added more context for duplicate lang item errors (fixes rust-lang#60561) Some more information about rust-lang#60561 -- these errors are pretty common when one works in restrictive environments with `no_std` or customized `std`, but they don't provide much context for debugging, as any transitive dependency could have brought in `std` crate. With that, currently, one needs to use something like `cargo tree` and investigate transitive dependencies one by one. It'll be more helpful to know at least the crate that uses `std` (which `cargo tree` doesn't show) to pin down this investigation when debugging. I'm not sure what the best way to get this context is inside rustc internals (I'm new to them). I found that `all_crate_nums` query returns the crates in some dependency order, so printing out the name of the preceding crate seems to do the trick. But I welcome suggestions if this can be done in a better way.
Rollup of 10 pull requests Successful merges: - #64131 (data_structures: Add deterministic FxHashMap and FxHashSet wrappers) - #64387 (Fix redundant semicolon lint interaction with proc macro attributes) - #64678 (added more context for duplicate lang item errors (fixes #60561)) - #64763 (Add E0734 and its long explanation) - #64793 (Fix format macro expansions spans to be macro-generated) - #64837 (Improve wording in documentation of MaybeUninit) - #64852 (Print ParamTy span when accessing a field (#52082)) - #64875 (Upgrade async/await to "used" keywords.) - #64876 (Fix typo in intrinsics op safety) - #64880 (Slice docs: fix typo) Failed merges: r? @ghost
Some more information about #60561 -- these errors are pretty common when one works in restrictive environments with
no_std
or customizedstd
, but they don't provide much context for debugging, as any transitive dependency could have brought instd
crate. With that, currently, one needs to use something likecargo tree
and investigate transitive dependencies one by one.It'll be more helpful to know at least the crate that uses
std
(whichcargo tree
doesn't show) to pin down this investigation when debugging.I'm not sure what the best way to get this context is inside rustc internals (I'm new to them). I found that
all_crate_nums
query returns the crates in some dependency order, so printing out the name of the preceding crate seems to do the trick. But I welcome suggestions if this can be done in a better way.