-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Trait objects missing #[track_caller]
shims
#74764
Comments
this causes a segfault on stable: use std::ops::Index;
fn main() {
let vec = vec![1];
let handler: &dyn Index<usize, Output = i32> = &vec;
handler.index(2);
} results in
Luckily |
Oof! I'm looking at the existing tests and I realize what we missed. We test direct calls to tracked trait methods and we test indirect calls to tracked trait functions (i.e. no receivers), but we don't test indirect calls of trait methods with receivers. |
My immediate suspicion is that trait object vtables aren't going through the reification path we added to |
#[track_caller]
shims?#[track_caller]
shims
Thanks to @eddyb for confirming this doesn't seem to affect self-by-val. |
Assigning |
Fix #[track_caller] shims for trait objects. We were missing an Instance::resolve_for_fn_ptr in resolve_for_vtable. Closes rust-lang#74764.
We were missing an Instance::resolve_for_fn_ptr in resolve_for_vtable. Closes rust-lang#74764.
test track_caller on trait objects Adds a Miri-side test for rust-lang/rust#74764.
test track_caller on trait objects Adds a Miri-side test for rust-lang/rust#74764.
We were missing an Instance::resolve_for_fn_ptr in resolve_for_vtable. Closes rust-lang#74764.
After reducing a repro of a potential track_caller bug from @yaahc, I get a segfault from this code:
This repros for me on my up-to-date checkout as well as for the current beta compiler. I'm not sure whether that makes this a regression from stable to beta, since it's an apparent bug in an API which is first stabilizing in this release.
cc @eddyb
The text was updated successfully, but these errors were encountered: