Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete some useless casts from global_allocator expansion #114528

Merged
merged 1 commit into from
Aug 6, 2023

Conversation

dtolnay
Copy link
Member

@dtolnay dtolnay commented Aug 6, 2023

These casts are from when #[global_allocator] needed to translate back and forth between *mut u8 and *mut Opaque. This should have been cleaned up as part of f6ab74b.

Difference to code generated by #[global_allocator] static ALLOCATOR: Allocator = Allocator;:

 const _: () = {
     #[rustc_std_internal_symbol]
     unsafe fn __rust_alloc(arg0: usize, arg1: usize) -> *mut u8 {
         ::core::alloc::GlobalAlloc::alloc(
             &ALLOCATOR,
             ::core::alloc::Layout::from_size_align_unchecked(arg0, arg1),
-        ) as *mut u8
+        )
     }
     #[rustc_std_internal_symbol]
     unsafe fn __rust_dealloc(arg0: *mut u8, arg1: usize, arg2: usize) -> () {
         ::core::alloc::GlobalAlloc::dealloc(
             &ALLOCATOR,
-            arg0 as *mut u8,
+            arg0,
             ::core::alloc::Layout::from_size_align_unchecked(arg1, arg2),
         )
     }
     #[rustc_std_internal_symbol]
     unsafe fn __rust_realloc(
         arg0: *mut u8,
         arg1: usize,
         arg2: usize,
         arg3: usize,
     ) -> *mut u8 {
         ::core::alloc::GlobalAlloc::realloc(
             &ALLOCATOR,
-            arg0 as *mut u8,
+            arg0,
             ::core::alloc::Layout::from_size_align_unchecked(arg1, arg2),
             arg3,
-        ) as *mut u8
+        )
     }
     #[rustc_std_internal_symbol]
     unsafe fn __rust_alloc_zeroed(arg0: usize, arg1: usize) -> *mut u8 {
         ::core::alloc::GlobalAlloc::alloc_zeroed(
             &ALLOCATOR,
             ::core::alloc::Layout::from_size_align_unchecked(arg0, arg1),
-        ) as *mut u8
+        )
     }
 };

@rustbot
Copy link
Collaborator

rustbot commented Aug 6, 2023

r? @cjgillot

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 6, 2023
@cjgillot
Copy link
Contributor

cjgillot commented Aug 6, 2023

@bors r+

@bors
Copy link
Contributor

bors commented Aug 6, 2023

📌 Commit e57a891 has been approved by cjgillot

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 6, 2023
@bors
Copy link
Contributor

bors commented Aug 6, 2023

⌛ Testing commit e57a891 with merge a339ed1...

@bors
Copy link
Contributor

bors commented Aug 6, 2023

☀️ Test successful - checks-actions
Approved by: cjgillot
Pushing a339ed1 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 6, 2023
@bors bors merged commit a339ed1 into rust-lang:master Aug 6, 2023
@rustbot rustbot added this to the 1.73.0 milestone Aug 6, 2023
@dtolnay dtolnay deleted the globalalloccast branch August 6, 2023 12:53
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a339ed1): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-3.8% [-3.8%, -3.8%] 1
Improvements ✅
(secondary)
-2.6% [-3.1%, -2.1%] 2
All ❌✅ (primary) -3.8% [-3.8%, -3.8%] 1

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
4.5% [3.9%, 5.2%] 6
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 4.5% [3.9%, 5.2%] 6

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 649.941s -> 651.351s (0.22%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants