Skip to content

Stop using CRATE_DEF_INDEX outside of metadata encoding. - #96142

Merged
bors merged 1 commit into
rust-lang:masterfrom
cjgillot:no-crate-def-index
Apr 19, 2022
Merged

Stop using CRATE_DEF_INDEX outside of metadata encoding.#96142
bors merged 1 commit into
rust-lang:masterfrom
cjgillot:no-crate-def-index

Conversation

@cjgillot

Copy link
Copy Markdown
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.
@cjgillotcjgillot added the C-cleanup Category: PRs that clean code up or issues documenting cleanup. label Apr 17, 2022
@rust-highfive

Copy link
Copy Markdown
Contributor

Some changes occurred in clean/types.rs.

cc @camelid

Some changes occurred in src/tools/clippy.

cc @rust-lang/clippy

@rustbotrustbot 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
Copy Markdown
Contributor

r? @petrochenkov

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

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 17, 2022
// 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
Copy Markdown
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
Copy Markdown
Contributor

@bors r+

@bors

bors commented Apr 17, 2022

Copy link
Copy Markdown
Collaborator

📌 Commit 07ee031 has been approved by petrochenkov

@borsbors 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-DPCDylan-DPC mentioned this pull request Apr 18, 2022
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-DPCDylan-DPC mentioned this pull request Apr 19, 2022
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-DPCDylan-DPC mentioned this pull request Apr 19, 2022
@Dylan-DPCDylan-DPC mentioned this pull request Apr 19, 2022
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:masterApr 19, 2022
@rustbotrustbot 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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-cleanupCategory: PRs that clean code up or issues documenting cleanup.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-rustdocRelevant 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

@cjgillot@rust-highfive@petrochenkov@bors@rustbot