-
Notifications
You must be signed in to change notification settings - Fork 13k
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
CFI: Fix encode_ty: unexpected Param(B/#1) #111697
Conversation
r? @davidtwco (rustbot has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
Fixes rust-lang#111510 and complements rust-lang#106547 by adding support for encoding type parameters and also by transforming trait objects' traits into their identities before emitting type checks.
0ff3d0b
to
f067935
Compare
let mut s = String::from("u5param"); | ||
compress(dict, DictKey::Ty(ty, TyQ::None), &mut s); | ||
typeid.push_str(&s); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without -Zpolymorphize
this shouldn't happen unless a monomorphization is missing I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for this is when transforming the concrete self into a reference to a trait object before emitting type metadata identifiers for trait methods (in predefine_fn), the trait resolved from the method is the identity trait (i.e., early bound), and this is also necessary for trait objects with generic type parameters (see Trait3 in tests).
Unless there is a way to bind the traits at that time, we'll need to work with identity traits (i.e., early bound) and add support for encoding early bound types both when emitting type metadata identifiers for trait methods and when emitting type checks.
r? @bjorn3 |
I'm not entirely confident that the @bors r+ |
☀️ Test successful - checks-actions |
Finished benchmarking commit (d77014a): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 644.164s -> 644.012s (-0.02%) |
Fixes #111510 and complements #106547 by adding support for encoding type parameters and also by transforming trait objects' traits into their identities before emitting type checks.