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

Stop using CRATE_DEF_INDEX outside of metadata encoding. #96142

Merged
merged 1 commit into from
Apr 19, 2022

Conversation

cjgillot
Copy link
Contributor

CRATE_DEF_ID and CrateNum::as_def_id are almost always what we want. We should not manipulate raw DefIndex outside of metadata encoding.

`CRATE_DEF_ID` and `CrateNum::as_def_id` are almost always what we want.
@cjgillot cjgillot added the C-cleanup Category: PRs that clean code up or issues documenting cleanup. label Apr 17, 2022
@rust-highfive
Copy link
Collaborator

Some changes occurred in clean/types.rs.

cc @camelid

Some changes occurred in src/tools/clippy.

cc @rust-lang/clippy

@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Apr 17, 2022
@rust-highfive
Copy link
Collaborator

r? @petrochenkov

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 17, 2022
@@ -316,7 +303,7 @@ fn upstream_monomorphizations_provider(
// If there are multiple monomorphizations available,
// we select one deterministically.
let other_cnum = *e.get();
if cnum_stable_ids[other_cnum] > cnum_stable_ids[cnum] {
if tcx.stable_crate_id(other_cnum) > tcx.stable_crate_id(cnum) {
Copy link
Contributor

Choose a reason for hiding this comment

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

As I understand this is a different order than used previously, but it's still deterministic so it's ok.

@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Apr 17, 2022

📌 Commit 07ee031 has been approved by petrochenkov

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 17, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 18, 2022
…ochenkov

Stop using CRATE_DEF_INDEX outside of metadata encoding.

`CRATE_DEF_ID` and `CrateNum::as_def_id` are almost always what we want.  We should not manipulate raw `DefIndex` outside of metadata encoding.
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 19, 2022
…ochenkov

Stop using CRATE_DEF_INDEX outside of metadata encoding.

`CRATE_DEF_ID` and `CrateNum::as_def_id` are almost always what we want.  We should not manipulate raw `DefIndex` outside of metadata encoding.
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 19, 2022
…ochenkov

Stop using CRATE_DEF_INDEX outside of metadata encoding.

`CRATE_DEF_ID` and `CrateNum::as_def_id` are almost always what we want.  We should not manipulate raw `DefIndex` outside of metadata encoding.
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 19, 2022
Rollup of 6 pull requests

Successful merges:

 - rust-lang#94493 (Improved diagnostic on failure to meet send bound on future in a foreign crate)
 - rust-lang#95809 (Fix typo in bootstrap.py)
 - rust-lang#96086 (Remove `--extern-location` and all associated code)
 - rust-lang#96089 (`alloc`: make `vec!` unavailable under `no_global_oom_handling`)
 - rust-lang#96122 (Fix an invalid error for a suggestion to add a slice in pattern-matching)
 - rust-lang#96142 (Stop using CRATE_DEF_INDEX outside of metadata encoding.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 9fad214 into rust-lang:master Apr 19, 2022
@rustbot rustbot added this to the 1.62.0 milestone Apr 19, 2022
@cjgillot cjgillot deleted the no-crate-def-index branch April 19, 2022 20:00
flip1995 pushed a commit to flip1995/rust that referenced this pull request Apr 21, 2022
…ochenkov

Stop using CRATE_DEF_INDEX outside of metadata encoding.

`CRATE_DEF_ID` and `CrateNum::as_def_id` are almost always what we want.  We should not manipulate raw `DefIndex` outside of metadata encoding.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants