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

Ensure RPITITs are created before def-id freezing #122523

Merged
merged 1 commit into from Mar 15, 2024

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Mar 15, 2024

From the test:

// `ty::Error` in a trait ref will silence any missing item errors, but will also
// prevent the `associated_items` query from being called before def ids are frozen.

Essentially, the code that checks that impls have all their items (check_impl_items_against_trait) is also (implicitly) responsible for fetching the associated_items query before, but since we early return here:

// If the trait reference itself is erroneous (so the compilation is going
// to fail), skip checking the items here -- the `impl_item` table in `tcx`
// isn't populated for such impls.
if trait_ref.references_error() {
return;
}

...that means that this never happens for trait refs that reference errors.

Fixes #122518
r? oli-obk

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 15, 2024
@oli-obk
Copy link
Contributor

oli-obk commented Mar 15, 2024

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Mar 15, 2024

📌 Commit 571f945 has been approved by oli-obk

It is now in the queue for this repository.

@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 Mar 15, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 15, 2024
…types, r=oli-obk

Ensure RPITITs are created before def-id freezing

From the test:

```rust
// `ty::Error` in a trait ref will silence any missing item errors, but will also
// prevent the `associated_items` query from being called before def ids are frozen.
```

Essentially, the code that checks that `impl`s have all their items (`check_impl_items_against_trait`) is also (implicitly) responsible for fetching the `associated_items` query before, but since we early return here:
https://github.com/rust-lang/rust/blob/c2901f543577af99b9cb708f5c0d28525eb7f08f/compiler/rustc_hir_analysis/src/check/check.rs#L732-L737
...that means that this never happens for trait refs that reference errors.

Fixes rust-lang#122518
r? oli-obk
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 15, 2024
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#121885 (Move generic `NonZero` `rustc_layout_scalar_valid_range_start` attribute to inner type.)
 - rust-lang#122471 (preserve span when evaluating mir::ConstOperand)
 - rust-lang#122515 (Pass the correct DefId when suggesting writing the aliased Self type out)
 - rust-lang#122523 (Ensure RPITITs are created before def-id freezing)
 - rust-lang#122527 (Clean up AstConv)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 15, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#121207 (Add `-Z external-clangrt`)
 - rust-lang#122174 (diagnostics: suggest `Clone` bounds when noop `clone()`)
 - rust-lang#122471 (preserve span when evaluating mir::ConstOperand)
 - rust-lang#122515 (Pass the correct DefId when suggesting writing the aliased Self type out)
 - rust-lang#122523 (Ensure RPITITs are created before def-id freezing)
 - rust-lang#122526 (Docs for `thir::ExprKind::Use` and `thir::ExprKind::Let`)
 - rust-lang#122527 (Clean up AstConv)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit ee940f8 into rust-lang:master Mar 15, 2024
11 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Mar 15, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 15, 2024
Rollup merge of rust-lang#122523 - compiler-errors:ensure-associated-types, r=oli-obk

Ensure RPITITs are created before def-id freezing

From the test:

```rust
// `ty::Error` in a trait ref will silence any missing item errors, but will also
// prevent the `associated_items` query from being called before def ids are frozen.
```

Essentially, the code that checks that `impl`s have all their items (`check_impl_items_against_trait`) is also (implicitly) responsible for fetching the `associated_items` query before, but since we early return here:
https://github.com/rust-lang/rust/blob/c2901f543577af99b9cb708f5c0d28525eb7f08f/compiler/rustc_hir_analysis/src/check/check.rs#L732-L737
...that means that this never happens for trait refs that reference errors.

Fixes rust-lang#122518
r? oli-obk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE: still mutable
4 participants