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

Make size_of_val and min_align_of_val intrinsics unsafe #80711

Merged
merged 1 commit into from
Jan 5, 2021

Conversation

camelid
Copy link
Member

@camelid camelid commented Jan 5, 2021

Fixes #80668.

r? @oli-obk

@camelid camelid added the A-intrinsics Area: Intrinsics label Jan 5, 2021
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 5, 2021
@camelid camelid force-pushed the intrinsic-of-val-safety branch from 1bb7dd2 to abb9cf5 Compare January 5, 2021 02:38
@@ -4,6 +4,7 @@
//! types, initializing and manipulating memory.

#![stable(feature = "rust1", since = "1.0.0")]
#![cfg_attr(not(bootstrap), allow(unused-unsafe))]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because stage1 requires functions that call intrinsics to have unsafe blocks, but stage0 does not and thus triggers the unused_unsafe lint (which is denied in rust-lang/rust).

@camelid camelid force-pushed the intrinsic-of-val-safety branch from abb9cf5 to fce7c52 Compare January 5, 2021 02:39
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-9 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
   Compiling libc v0.2.79
   Compiling std v0.0.0 (/checkout/library/std)
   Compiling compiler_builtins v0.1.36
   Compiling unwind v0.0.0 (/checkout/library/unwind)
error: unnecessary `unsafe` block
    |
    |
338 |     unsafe { intrinsics::size_of_val(val) }
    |     ^^^^^^ unnecessary `unsafe` block
    |
    = note: `-D unused-unsafe` implied by `-D warnings`

error: unnecessary `unsafe` block
    |
    |
387 |     unsafe { intrinsics::size_of_val(val) }
    |     ^^^^^^ unnecessary `unsafe` block

error: unnecessary `unsafe` block
    |
    |
432 |     unsafe { intrinsics::min_align_of_val(val) }
    |     ^^^^^^ unnecessary `unsafe` block

error: unnecessary `unsafe` block
    |
    |
477 |     unsafe { intrinsics::min_align_of_val(val) }
    |     ^^^^^^ unnecessary `unsafe` block

error: unnecessary `unsafe` block
    |
    |
522 |     unsafe { intrinsics::min_align_of_val(val) }
    |     ^^^^^^ unnecessary `unsafe` block
error: aborting due to 5 previous errors

error: could not compile `core`

@camelid camelid force-pushed the intrinsic-of-val-safety branch from fce7c52 to bbf175d Compare January 5, 2021 03:24
@oli-obk
Copy link
Contributor

oli-obk commented Jan 5, 2021

@bors r+

@bors
Copy link
Contributor

bors commented Jan 5, 2021

📌 Commit bbf175d has been approved by oli-obk

@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 Jan 5, 2021
@oli-obk
Copy link
Contributor

oli-obk commented Jan 5, 2021

@bors rollup

@bors
Copy link
Contributor

bors commented Jan 5, 2021

⌛ Testing commit bbf175d with merge da305a2...

@bors
Copy link
Contributor

bors commented Jan 5, 2021

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing da305a2 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 5, 2021
@bors bors merged commit da305a2 into rust-lang:master Jan 5, 2021
@rustbot rustbot added this to the 1.51.0 milestone Jan 5, 2021
@camelid camelid deleted the intrinsic-of-val-safety branch January 6, 2021 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-intrinsics Area: Intrinsics 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

size_of_val and min_align_of_val intrinsics should be unsafe
6 participants