-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
interpret: dyn trait metadata check: equate traits in a proper way #126232
Conversation
Some changes occurred to the CTFE / Miri engine cc @rust-lang/miri |
The Miri subtree was changed cc @rust-lang/miri |
@lcnr turns out that using the trait system here is not sufficient, the test still fails with this PR... |
Ah never mind, I missed one place where we are using |
... but even if I fix that, the issue remains. These two do not seem to be considered equal:
the error is
|
This comment has been minimized.
This comment has been minimized.
5043f61
to
5578e8c
Compare
We can check that the vtable is for the right trait very early, and then just pass the type around.
5578e8c
to
18c958d
Compare
This comment has been minimized.
This comment has been minimized.
So just normalizing and then using == does not work?
|
If the types are fully concrete, then they should be structurally equal after normalizing, anonymizing bound vars, and erasing all other regions. Breaking this assumption can result in linker errors. In general, you still need to handle types whose bound vars have a different order however. While I can't think of any other causes for types to be semantically equal but not structurally rn, it still feels wrong to not use proper equality here. |
18c958d
to
44bcc8f
Compare
Makes sense. This seems to work, thanks! @rustbot ready |
44bcc8f
to
08ee703
Compare
This comment has been minimized.
This comment has been minimized.
08ee703
to
3757136
Compare
@bors r+ |
…llaumeGomez Rollup of 9 pull requests Successful merges: - rust-lang#126039 (Promote `arm64ec-pc-windows-msvc` to tier 2) - rust-lang#126075 (Remove `DebugWithInfcx` machinery) - rust-lang#126228 (Provide correct parent for nested anon const) - rust-lang#126232 (interpret: dyn trait metadata check: equate traits in a proper way) - rust-lang#126242 (Simplify provider api to improve llvm ir) - rust-lang#126294 (coverage: Replace the old span refiner with a single function) - rust-lang#126295 (No uninitalized report in a pre-returned match arm) - rust-lang#126312 (Update `rustc-perf` submodule) - rust-lang#126322 (Follow up to splitting core's PanicInfo and std's PanicInfo) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#126232 - RalfJung:dyn-trait-equality, r=oli-obk interpret: dyn trait metadata check: equate traits in a proper way Hopefully fixes rust-lang/miri#3541... unfortunately we don't have a testcase. The first commit is just a refactor without functional change. r? `@oli-obk`
Hopefully fixes rust-lang/miri#3541... unfortunately we don't have a testcase.
The first commit is just a refactor without functional change.
r? @oli-obk