-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Replace 'NULL' with 'null' #84842
Replace 'NULL' with 'null' #84842
Conversation
r? @dtolnay (rust-highfive has picked a reviewer for you, use r? to override) |
@bors r+ |
📌 Commit 6679f5c has been approved by |
☀️ Test successful - checks-actions |
@@ -309,7 +309,7 @@ impl fmt::Display for UndefinedBehaviorInfo<'_> { | |||
allocation_size.bytes() | |||
), | |||
DanglingIntPointer(_, CheckInAllocMsg::NullPointerTest) => { | |||
write!(f, "NULL pointer is not allowed for this operation") | |||
write!(f, "null pointer is not allowed for this operation") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, looks like we don't have any test covering this output... I think CheckInAllocMsg::NullPointerTest
might just be a dead enum variant.
@hyd-dev any chance you could prepare a PR to remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I'll have a try!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created #84903 to remove it.
`encountered a NULL reference` -> `encountered a null reference` It's changed from "NULL" to "null" (probably by rust-lang/rust#84842) in `rustc`, and causing some test failures: https://github.com/rust-lang/miri/runs/2498333632#step:8:640
…RalfJung Remove `rustc_middle::mir::interpret::CheckInAllocMsg::NullPointerTest` Removing it per rust-lang#84842 (comment): it's a dead enum variant. Note that `PointerArithmeticTest` also seems dead: ``` $ rg -F PointerArithmeticTest -C5 compiler/rustc_middle/src/mir/interpret/error.rs 169- 170-/// Details of why a pointer had to be in-bounds. 171-#[derive(Debug, Copy, Clone, TyEncodable, TyDecodable, HashStable)] 172-pub enum CheckInAllocMsg { 173- MemoryAccessTest, 174: PointerArithmeticTest, 175- InboundsTest, 176-} 177- 178-impl fmt::Display for CheckInAllocMsg { 179- /// When this is printed as an error the context looks like this -- 182- write!( 183- f, 184- "{}", 185- match *self { 186- CheckInAllocMsg::MemoryAccessTest => "memory access", 187: CheckInAllocMsg::PointerArithmeticTest => "pointer arithmetic", 188- CheckInAllocMsg::InboundsTest => "inbounds test", 189- } 190- ) 191- } 192-} ``` Not sure if that is also desirable to be removed, however.
…RalfJung Remove `rustc_middle::mir::interpret::CheckInAllocMsg::NullPointerTest` Removing it per rust-lang#84842 (comment): it's a dead enum variant. Note that `PointerArithmeticTest` also seems dead: ``` $ rg -F PointerArithmeticTest -C5 compiler/rustc_middle/src/mir/interpret/error.rs 169- 170-/// Details of why a pointer had to be in-bounds. 171-#[derive(Debug, Copy, Clone, TyEncodable, TyDecodable, HashStable)] 172-pub enum CheckInAllocMsg { 173- MemoryAccessTest, 174: PointerArithmeticTest, 175- InboundsTest, 176-} 177- 178-impl fmt::Display for CheckInAllocMsg { 179- /// When this is printed as an error the context looks like this -- 182- write!( 183- f, 184- "{}", 185- match *self { 186- CheckInAllocMsg::MemoryAccessTest => "memory access", 187: CheckInAllocMsg::PointerArithmeticTest => "pointer arithmetic", 188- CheckInAllocMsg::InboundsTest => "inbounds test", 189- } 190- ) 191- } 192-} ``` Not sure if that is also desirable to be removed, however.
…RalfJung Remove `rustc_middle::mir::interpret::CheckInAllocMsg::NullPointerTest` Removing it per rust-lang#84842 (comment): it's a dead enum variant. Note that `PointerArithmeticTest` also seems dead: ``` $ rg -F PointerArithmeticTest -C5 compiler/rustc_middle/src/mir/interpret/error.rs 169- 170-/// Details of why a pointer had to be in-bounds. 171-#[derive(Debug, Copy, Clone, TyEncodable, TyDecodable, HashStable)] 172-pub enum CheckInAllocMsg { 173- MemoryAccessTest, 174: PointerArithmeticTest, 175- InboundsTest, 176-} 177- 178-impl fmt::Display for CheckInAllocMsg { 179- /// When this is printed as an error the context looks like this -- 182- write!( 183- f, 184- "{}", 185- match *self { 186- CheckInAllocMsg::MemoryAccessTest => "memory access", 187: CheckInAllocMsg::PointerArithmeticTest => "pointer arithmetic", 188- CheckInAllocMsg::InboundsTest => "inbounds test", 189- } 190- ) 191- } 192-} ``` Not sure if that is also desirable to be removed, however.
…, r=estebank Replace more "NULL" with "null" Error messages in THIR unsafeck still contain "NULL", make them lowercase to be consistent with MIR unsafeck (cc rust-lang#84842).
This replaces occurrences of "NULL" with "null" in docs, comments, and compiler error/lint messages. This is for the sake of consistency, as the lowercase "null" is already the dominant form in Rust. The all-caps NULL looks like the C macro (or SQL keyword), which seems out of place in a Rust context, given that NULL does not exist in the Rust language or standard library (instead having
ptr::null()
).