Auto merge of #128165 - saethlin:optimize-clone-shims, r=compiler-errors · model-checking/verify-rust-std@22ce603 (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Commit 22ce603

Auto merge of rust-lang#128165 - saethlin:optimize-clone-shims, r=compiler-errors

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/E69YeY8eqSo 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#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

File tree

2 files changed

lines changed

2 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -29,6 +29,8 @@ trait Copy {}
29 29 #[lang = "freeze"]
30 30 auto trait Freeze {}
31 31
32 +impl<T: ?Sized> Copy for *mut T {}
33 +
32 34 #[lang = "drop_in_place"]
33 35 #[inline]
34 36 #[allow(unconditional_recursion)]
Original file line number Diff line number Diff line change
@@ -17,6 +17,8 @@ trait Copy {}
17 17 #[lang = "freeze"]
18 18 auto trait Freeze {}
19 19
20 +impl<T: ?Sized> Copy for *mut T {}
21 +
20 22 #[lang = "drop_in_place"]
21 23 #[inline]
22 24 #[allow(unconditional_recursion)]