Fix clashing_extern_declarations stack overflow for recursive types.#75554
Fix clashing_extern_declarations stack overflow for recursive types.#75554bors merged 10 commits intorust-lang:masterfrom
Conversation
|
(rust_highfive has picked a reviewer for you, use r? to override) |
|
Could someone else review this? I don't have the capacity. |
src/librustc_lint/builtin.rs
Outdated
There was a problem hiding this comment.
while not part of this PR I would expect *const T and *mut T to be structurally equal.
To my knowledge they only differ in variance
There was a problem hiding this comment.
I see. My reasoning for having them not equal is because I want this case to clash:
mod a {
extern "C" {
fn take(_: *const S);
}
}
mod b {
extern "C" {
fn take(_: *mut S);
}
}Specifically, I want to guard against the case where take actually mutates the data underneath, but a::take is called with data that was supposed to be immutable -- a conflicting declaration of the mutability of some data should ring some alarm bells.
|
@rustbot modify labels to -S-waiting-on-author, +S-waiting-on-review |
lcnr
left a comment
There was a problem hiding this comment.
small nits, otherwise this is looking good 👍
0e28346 to
af0fb0e
Compare
|
Cool, this is good to go. @rustbot modify labels to -S-waiting-on-author, +S-waiting-on-review |
Adds a seen set to structurally_same_type to avoid recursing indefinitely when a reference or pointer member introduces a cycle in the visited types.
That cache is unlikely to be particularly useful within a single invocation of structurally_same_type, especially compared to memoizing results across _all_ invocations of that function.
af0fb0e to
bc15dd6
Compare
|
@bors try @rust-timer queue |
|
Awaiting bors try build completion |
|
⌛ Trying commit bc15dd6 with merge 6f54fb4d9fd2b0e3b6dec01b4b67bd2692cbb454... |
|
☀️ Try build successful - checks-actions, checks-azure |
|
Queued 6f54fb4d9fd2b0e3b6dec01b4b67bd2692cbb454 with parent b97e9b5, future comparison URL. |
|
Finished benchmarking try commit (6f54fb4d9fd2b0e3b6dec01b4b67bd2692cbb454): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
|
perf looks neutral to me @bors r+ rollup=always |
|
📌 Commit bc15dd6 has been approved by |
…erflow, r=lcnr Fix clashing_extern_declarations stack overflow for recursive types. Fixes rust-lang#75512. Adds a seen set to `structurally_same_type` to avoid recursing indefinitely for types which contain values of the same type through a pointer or reference.
…erflow, r=lcnr Fix clashing_extern_declarations stack overflow for recursive types. Fixes rust-lang#75512. Adds a seen set to `structurally_same_type` to avoid recursing indefinitely for types which contain values of the same type through a pointer or reference.
…erflow, r=lcnr Fix clashing_extern_declarations stack overflow for recursive types. Fixes rust-lang#75512. Adds a seen set to `structurally_same_type` to avoid recursing indefinitely for types which contain values of the same type through a pointer or reference.
…erflow, r=lcnr Fix clashing_extern_declarations stack overflow for recursive types. Fixes rust-lang#75512. Adds a seen set to `structurally_same_type` to avoid recursing indefinitely for types which contain values of the same type through a pointer or reference.
…erflow, r=lcnr Fix clashing_extern_declarations stack overflow for recursive types. Fixes rust-lang#75512. Adds a seen set to `structurally_same_type` to avoid recursing indefinitely for types which contain values of the same type through a pointer or reference.
Rollup of 9 pull requests Successful merges: - rust-lang#75038 (See also X-Link mem::{swap, take, replace}) - rust-lang#75049 (docs(marker/copy): provide example for `&T` being `Copy`) - rust-lang#75499 (Fix documentation error) - rust-lang#75554 (Fix clashing_extern_declarations stack overflow for recursive types.) - rust-lang#75646 (Move to intra doc links for keyword documentation) - rust-lang#75652 (Resolve true and false as booleans) - rust-lang#75658 (Don't emit "is not a logical operator" error outside of associative expressions) - rust-lang#75665 (Add doc examples coverage) - rust-lang#75685 (Switch to intra-doc links in /src/sys/unix/ext/*.rs) Failed merges: r? @ghost
Fixes #75512.
Adds a seen set to
structurally_same_typeto avoid recursing indefinitely for types which contain values of the same type through a pointer or reference.