-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Restrict sysroot crate imports to those defined in this repo. #143548
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
base: master
Are you sure you want to change the base?
Conversation
Some changes occurred in compiler/rustc_codegen_ssa Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 Some changes occurred in src/tools/clippy cc @rust-lang/clippy Some changes occurred in src/tools/compiletest cc @jieyouxu Some changes occurred in src/tools/rustfmt cc @rust-lang/rustfmt Some changes occurred in compiler/rustc_attr_data_structures Some changes occurred in compiler/rustc_attr_parsing Some changes occurred in compiler/rustc_codegen_gcc The Miri subtree was changed cc @rust-lang/miri Some changes occurred in exhaustiveness checking cc @Nadrieril Some changes occurred in compiler/rustc_sanitizers cc @rcvalle
|
8e8dd82
to
c613bce
Compare
The Miri subtree was changed cc @rust-lang/miri Some changes occurred in src/tools/clippy cc @rust-lang/clippy Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 Some changes occurred in src/tools/rustfmt cc @rust-lang/rustfmt Some changes occurred in compiler/rustc_codegen_gcc |
This comment has been minimized.
This comment has been minimized.
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.
The Miri changes LGTM, except the ones in the vendored file where only the header at the top should be edited.
I'm fine with having these Miri changes here, seems easier to do this centrally than coordinate half a dozen PRs.
Do you think it is feasible to add an internal lint that rejects |
@oli-obk I'll look into this. How does testing work for sub-trees? Would each sub-tree need its own copy of the lint, or do the subtree repos have some way to run rust-wide lints? |
"internal" lints live in rustc like normal lints, but are gated behind a nightly-only flag. Miri enables them in their CI, I don't know if |
We have a list of internal lints that rustc has and enables everywhere. We'd have to limit it to crates with |
Not sure what you mean about restricting it, the lints need |
Ah right, my bad |
a79cac5
to
12fe444
Compare
This comment has been minimized.
This comment has been minimized.
12fe444
to
3565a59
Compare
I've updated the PR and added a lint, so I think this is ready to go. There is one problem which is that the lint is an internal rustc lint and so is not automatically applied to all of the tool crates which it should be. It will be necessary to opt-in to rustc internal lints in each of the tools. Clippy already opts in, and possibly Miri? But other tool crates will have to opt-in. |
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.
The cg_gcc part looks good to me.
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.
cg_clif changes LGTM
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.
Miri changes LGTM.
@Diggsey any updates on this ? thanks |
3565a59
to
a46cea6
Compare
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This comment has been minimized.
This comment has been minimized.
a46cea6
to
3134842
Compare
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
@Dylan-DPC I've rebased and implemented @oli-obk's requested changes. |
This comment has been minimized.
This comment has been minimized.
It's common to import dependencies from the sysroot via `extern crate` rather than use an explicit cargo dependency, when it's necessary to use the same dependency version as used by rustc itself. However, this is dangerous for crates.io crates, since rustc may not pull in the dependency on some targets, or may pull in multiple versions. In both cases, the `extern crate` fails to resolve. To address this, re-export all such dependencies from the appropriate `rustc_*` crates, and use this alias from crates which would otherwise need to use `extern crate`.
3134842
to
787bcca
Compare
It's common to import dependencies from the sysroot via
extern crate
rather than use an explicit cargo dependency, when it's necessary to use the same dependency version as used by rustc itself. However, this is dangerous for crates.io crates, since rustc may not pull in the dependency on some targets, or may pull in multiple versions. In both cases, theextern crate
fails to resolve.To address this, re-export all such dependencies from the appropriate
rustc_*
crates, and use this alias from crates which would otherwise need to useextern crate
.See #143492 for an example of the kind of issue that can occur.