Skip to content

Commit

Permalink
Auto merge of #128165 - saethlin:optimize-clone-shims, r=compiler-errors
Browse files Browse the repository at this point in the history
Let InstCombine remove Clone shims inside Clone shims

The Clone shims that we generate tend to recurse into other Clone shims, which gets very silly very quickly. Here's our current state: https://godbolt.org/z/E69YeY8eq

So I've added InstSimplify to the shims optimization passes, and improved `is_trivially_pure_clone_copy` so that it can delete those calls inside the shim. This makes the shim way smaller because most of its size is the required ceremony for unwinding.

This change also completely breaks the UI test added for rust-lang/rust#104870. With this PR, that program ICEs in MIR type checking because `is_trivially_pure_clone_copy` and the trait solver disagree on whether `*mut u8` is `Copy`. And adding the requisite `Copy` impl to make them agree makes the test not generate any diagnostics. Considering that I spent most of my time on this PR fixing `#![no_core]` tests, I would prefer to just delete this one. The maintenance burden of `#![no_core]` is uniquely high because when they break they tend to break in very confusing ways.

try-job: x86_64-mingw
bors committed Jul 26, 2024
2 parents 2c3b70d + 09ab530 commit c434ad5
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit c434ad5

Please sign in to comment.