Skip to content

regression: mismatched types (invalid pointer cast for trait objects) #128889

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
BoxyUwU opened this issue Aug 9, 2024 · 8 comments
Closed

regression: mismatched types (invalid pointer cast for trait objects) #128889

BoxyUwU opened this issue Aug 9, 2024 · 8 comments
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@BoxyUwU
Copy link
Member

BoxyUwU commented Aug 9, 2024

[INFO] [stdout] error[E0308]: mismatched types
[INFO] [stdout]   --> src/untyped.rs:26:11
[INFO] [stdout]    |
[INFO] [stdout] 26 |         &*(self.pointer as *const dyn Fn(&ServiceProvider) -> T)
[INFO] [stdout]    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `(&ServiceProvider,)`
[INFO] [stdout]    |
[INFO] [stdout]    = note: expected trait object `dyn Fn()`
[INFO] [stdout]               found trait object `dyn for<'a> Fn(&'a ServiceProvider) -> T`

#120248 (comment) I believe is accepted breakage? cc @WaffleLapkin

@BoxyUwU BoxyUwU added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. regression-from-stable-to-beta Performance or correctness regression from stable to beta. labels Aug 9, 2024
@rustbot rustbot added I-prioritize Issue: Indicates that prioritization has been requested for this issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Aug 9, 2024
@BoxyUwU BoxyUwU removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 9, 2024
@compiler-errors
Copy link
Member

Yeah, this is known breakage I think. Or if it wasn't uncovered by the crater, I totally think we should reject it.

@WaffleLapkin
Copy link
Member

I agree, all of this looks like code we intended to break.

The errors are unfortunately opaque though, I imagine users would have hard time figuring them out :(

@WaffleLapkin WaffleLapkin closed this as not planned Won't fix, can't repro, duplicate, stale Aug 10, 2024
@VorpalBlade
Copy link

@WaffleLapkin shouldn't this be turned into a diagnostic issue rather than closed if the error is subpar (which it looks like it is to me as well)?

@WaffleLapkin
Copy link
Member

@VorpalBlade diagnostic issue should be opened, but I have no spoons for that. Turning issues into issues for other topics is generally confusing, opening new issues is better.

@apiraino
Copy link
Contributor

@VorpalBlade if you have capacity, please feel free to open such issue about diagnostic (backlinking this one). Thanks!

@VorpalBlade
Copy link

I have the capacity, but I don't have any idea what the diagnostic should be. I don't understand the current error message.

@riking
Copy link

riking commented Sep 5, 2024

The error is that someone's trying to smuggle Fns of several different argument sets through a single variable of type *const dyn Fn() (no arguments) without a transmute.

@WaffleLapkin
Copy link
Member

@apiraino @VorpalBlade I've opened #130030 to track the diagnostic issue.

@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Oct 9, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

7 participants