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

Normalize struct tail properly for dyn ptr-to-ptr casting in new solver #128712

Merged
merged 3 commits into from
Aug 13, 2024

Conversation

compiler-errors
Copy link
Member

Realized that the new solver didn't handle ptr-to-ptr casting correctly.

r? lcnr

Built on #128694

@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 Aug 5, 2024
@compiler-errors compiler-errors changed the title Normalize struct tail properly for dyn ptr-to-ptr casting Normalize struct tail properly for dyn ptr-to-ptr casting in new solver Aug 5, 2024
@compiler-errors compiler-errors added the WG-trait-system-refactor The Rustc Trait System Refactor Initiative label Aug 5, 2024
if self.infcx.next_trait_solver() {
let body = self.body;
let param_env = self.param_env;
self.fully_perform_op(
Copy link
Member Author

Choose a reason for hiding this comment

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

This is incredibly gross, to the point that it kinda feels unnecessary? 🤔 But I really don't know how to simplify it, given the way that we need to wrap this in a type op and struct_tail doesn't have a fallible normalize fn...

@bors
Copy link
Contributor

bors commented Aug 6, 2024

☔ The latest upstream changes (presumably #128707) made this pull request unmergeable. Please resolve the merge conflicts.

@@ -226,7 +226,7 @@ pub(super) fn op_to_const<'tcx>(
let pointee_ty = imm.layout.ty.builtin_deref(false).unwrap(); // `false` = no raw ptrs
debug_assert!(
matches!(
ecx.tcx.struct_tail_without_normalization(pointee_ty).kind(),
ecx.tcx.struct_tail_for_codegen(pointee_ty, ecx.param_env).kind(),
Copy link
Member Author

Choose a reason for hiding this comment

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

Can't actually create a test for this, since we only allow matching on arrays and str (not tails), and I don't know how to trigger this outside of MIR match lowering.

@lcnr
Copy link
Contributor

lcnr commented Aug 12, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Aug 12, 2024

📌 Commit f15997f has been approved by lcnr

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 Aug 12, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 12, 2024
…, r=lcnr

Normalize struct tail properly for `dyn` ptr-to-ptr casting in new solver

Realized that the new solver didn't handle ptr-to-ptr casting correctly.

r? lcnr

Built on rust-lang#128694
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 12, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#128712 (Normalize struct tail properly for `dyn` ptr-to-ptr casting in new solver)
 - rust-lang#128878 (Slightly refactor `Flags` in bootstrap)
 - rust-lang#128886 (Get rid of some `#[allow(rustc::untranslatable_diagnostic)]`)
 - rust-lang#128912 (Store `do_not_recommend`-ness in impl header)
 - rust-lang#128936 (Support reading thin archives in ArArchiveBuilder)
 - rust-lang#128937 (Fix warnings in rmake tests on `x86_64-unknown-linux-gnu`)
 - rust-lang#128978 (Use `assert_matches` around the compiler more)

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

Rollup of 7 pull requests

Successful merges:

 - rust-lang#128712 (Normalize struct tail properly for `dyn` ptr-to-ptr casting in new solver)
 - rust-lang#128878 (Slightly refactor `Flags` in bootstrap)
 - rust-lang#128886 (Get rid of some `#[allow(rustc::untranslatable_diagnostic)]`)
 - rust-lang#128912 (Store `do_not_recommend`-ness in impl header)
 - rust-lang#128936 (Support reading thin archives in ArArchiveBuilder)
 - rust-lang#128937 (Fix warnings in rmake tests on `x86_64-unknown-linux-gnu`)
 - rust-lang#128978 (Use `assert_matches` around the compiler more)

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 12, 2024
…, r=lcnr

Normalize struct tail properly for `dyn` ptr-to-ptr casting in new solver

Realized that the new solver didn't handle ptr-to-ptr casting correctly.

r? lcnr

Built on rust-lang#128694
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 12, 2024
…, r=lcnr

Normalize struct tail properly for `dyn` ptr-to-ptr casting in new solver

Realized that the new solver didn't handle ptr-to-ptr casting correctly.

r? lcnr

Built on rust-lang#128694
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 12, 2024
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#128712 (Normalize struct tail properly for `dyn` ptr-to-ptr casting in new solver)
 - rust-lang#128861 (Rework MIR inlining debuginfo so function parameters show up in debuggers.)
 - rust-lang#128912 (Store `do_not_recommend`-ness in impl header)
 - rust-lang#129000 (bootstrap: clear miri ui-test deps when miri sysroot gets rebuilt)
 - rust-lang#129013 (Remove unused script from run-make tests)
 - rust-lang#129017 (Replace `std::fmt:FormatterFn` with `std::fmt::from_fn`)

Failed merges:

 - rust-lang#128935 (More work on `zstd` compression)

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

Rollup of 5 pull requests

Successful merges:

 - rust-lang#128712 (Normalize struct tail properly for `dyn` ptr-to-ptr casting in new solver)
 - rust-lang#128912 (Store `do_not_recommend`-ness in impl header)
 - rust-lang#129000 (bootstrap: clear miri ui-test deps when miri sysroot gets rebuilt)
 - rust-lang#129013 (Remove unused script from run-make tests)
 - rust-lang#129017 (Replace `std::fmt:FormatterFn` with `std::fmt::from_fn`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 4c49418 into rust-lang:master Aug 13, 2024
6 checks passed
@rustbot rustbot added this to the 1.82.0 milestone Aug 13, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Aug 13, 2024
Rollup merge of rust-lang#128712 - compiler-errors:normalize-borrowck, r=lcnr

Normalize struct tail properly for `dyn` ptr-to-ptr casting in new solver

Realized that the new solver didn't handle ptr-to-ptr casting correctly.

r? lcnr

Built on rust-lang#128694
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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants