Uh oh!
There was an error while loading. Please reload this page.
Improperctypes refactor2.2 - #155359
Conversation
This comment has been minimized.
This comment has been minimized.
a439f4d to
fa0fcc6Comparepetrochenkov
commented
Apr 16, 2026
petrochenkov
commented
Apr 17, 2026
rustbot
commented
Apr 17, 2026
Reminder, once the PR becomes ready for a review, use |
fa0fcc6 to
b2f3002Comparerustbot
commented
Apr 17, 2026
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
niacdoial
commented
Apr 17, 2026
can't believe I let this amount of time pass between tests being OK and this... |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This PR moves code around and changes that code in the same commit, this makes it hard to see what's going on.
@rustbot author |
Uh oh!
There was an error while loading. Please reload this page.
Another interal change that shouldn't impact rustc users. The goal (of this commit and a few afterwards) is to break apart the gigantic visit_type function into more managable and easily-editable bits that focus on specific parts of FFI safety. For now, we break the code specific to enums one side, and structs/unions on the other, into separate visit_? methods
Another interal change that shouldn't impact rustc users. the list of simpler type-based decisions made by `visit_type` are reordered and are given better documentation.
Another interal change that shouldn't impact rustc users. This time, regroup into `visit_indirections` the code dealing with the FFI safety of Boxes, Refs and RawPtrs.
103a8d0 to
1180e38Compareniacdoial
commented
Apr 21, 2026
@rustbot ready |
Uh oh!
There was an error while loading. Please reload this page.
petrochenkov
commented
Apr 21, 2026
Thanks! |
Another interal change that shouldn't impact rustc users. Code called outside of `visit_type` (and callees) is moved inside, by adding new types to properly track the state of a type visitation. - OuterTyKind tracks the knowledge of the type "directly outside of" the one being visited (if we are visiting a struct's field, an array's element, etc) - RootUseFlags tracks the knowledge of how the "original type being visited" is used: static variable, function argument/return, etc.
1180e38 to
7bb9851Comparepetrochenkov
commented
Apr 21, 2026
@bors r+ |
…uwer Rollup of 4 pull requests Successful merges: - #152611 (Modify error message of importing inherent associated items when `#[feature(import_trait_associated_functions)]` is enabled) - #155359 (Improperctypes refactor2.2) - #155036 (Store a PathBuf rather than SerializedModule for cached modules) - #155554 (add warning message when using x fix)
Uh oh!
There was an error while loading. Please reload this page.
Rollup merge of #155359 - niacdoial:improperctypes-refactor2.2, r=petrochenkov Improperctypes refactor2.2 This is "part 2/3 of 2/3 of 1/2" of the original pull request #134697 (refactor plus overhaul of the ImproperCTypes family of lints) (all pulls of this series of pulls are supersets of the previous pulls.) previous pull: #155358 next pull: #146273 This commit splits the lint's `visit_type` function into multiple functions that focus on specific things: - visit_indirection (references, boxes, raw pointers) - visit_variant_fields (the list of fields of a struct, enum variant, or union) - visit_enum - visit_struct_or_union - visit_type (most "easy" decisions such as labeling `char` unsafe are here) since, during these visits, we often move from an "outer type" to an "inner type" (structs, arrays, pointers, etc...), two structs have been added to track the current state of a visit: - VisitorState tracks the state related to the "original type" being checked (function argument/return, static variable) - OuterTyData tracks the data related to the type "immediately outer to the current visited type" r? petrochenkov (because you asked me to)
This is "part 2/3 of 2/3 of 1/2" of the original pull request #134697 (refactor plus overhaul of the ImproperCTypes family of lints)
(all pulls of this series of pulls are supersets of the previous pulls.)
previous pull: #155358
next pull: #146273
This commit splits the lint's
visit_typefunction into multiple functions that focus on specific things:charunsafe are here)since, during these visits, we often move from an "outer type" to an "inner type" (structs, arrays, pointers, etc...),
two structs have been added to track the current state of a visit:
r? petrochenkov (because you asked me to)