Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 22ce603

Browse files
committedJul 26, 2024
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/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#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
2 parents a152820 + 92c0ad7 commit 22ce603

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed
 

‎rtstartup/rsbegin.rs

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ trait Copy {}
2929
#[lang = "freeze"]
3030
auto trait Freeze {}
3131

32+
impl<T: ?Sized> Copy for *mut T {}
33+
3234
#[lang = "drop_in_place"]
3335
#[inline]
3436
#[allow(unconditional_recursion)]

‎rtstartup/rsend.rs

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ trait Copy {}
1717
#[lang = "freeze"]
1818
auto trait Freeze {}
1919

20+
impl<T: ?Sized> Copy for *mut T {}
21+
2022
#[lang = "drop_in_place"]
2123
#[inline]
2224
#[allow(unconditional_recursion)]

0 commit comments

Comments
 (0)
Failed to load comments.