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

document that the null pointer has the 0 address #116988

Merged
merged 1 commit into from
Nov 6, 2023
Merged

Conversation

RalfJung
Copy link
Member

Fixes #116895

Will need t-lang FCP, but I think this is fairly uncontroversial -- there's probably already tons of code out there that relies on this.

@rustbot
Copy link
Collaborator

rustbot commented Oct 20, 2023

r? @thomcc

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

@RalfJung RalfJung added T-lang Relevant to the language team, which will review and decide on the PR/issue. I-lang-nominated Nominated for discussion during a lang team meeting. labels Oct 20, 2023
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 20, 2023
@RalfJung RalfJung removed the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Oct 20, 2023
@scottmcm
Copy link
Member

Notably these functions only work on T: Thin, so I think this is also an unavoidable consequence of other things that we've previously guaranteed around Option<NonNull<T>>.

@rfcbot fcp merge

@rfcbot
Copy link

rfcbot commented Oct 21, 2023

Team member @scottmcm has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns.
See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Oct 21, 2023
@scottmcm scottmcm removed the I-lang-nominated Nominated for discussion during a lang team meeting. label Oct 21, 2023
@traviscross
Copy link
Contributor

@rustbot labels +I-lang-nominated

I'm going to nominate even though FCP has been proposed so that this comes up at least once in the meeting.

@rustbot rustbot added the I-lang-nominated Nominated for discussion during a lang team meeting. label Oct 24, 2023
@nikomatsakis
Copy link
Contributor

@rfcbot reviewed

@tmandry
Copy link
Member

tmandry commented Oct 24, 2023

@traviscross Doesn't our agenda generator include proposed FCPs already?

We already have quite a long list of nominated issues; I don't think nominating every newly proposed FCP is helping with that.

(edit: I am specifically pushing back on nominating for the purpose of getting eyes and checkboxes on the FCP. If your goal is to spark a discussion within the lang team meeting, then nominating is good for that.)

@tmandry
Copy link
Member

tmandry commented Oct 24, 2023

From #116895 (comment) it sounds like you've already considered the implications for provenance. With those aside I think we should go ahead and commit to this.

@rfcbot reviewed

@rfcbot rfcbot added the final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. label Oct 24, 2023
@rfcbot
Copy link

rfcbot commented Oct 24, 2023

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot rfcbot removed the proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. label Oct 24, 2023
@RalfJung
Copy link
Member Author

Yeah, the good thing is that nobody expects to be able to load from a null ptr so provenance basically does not matter.

@scottmcm
Copy link
Member

Yes, all p-FCPs are included in the meeting in the section that starts with

Proposed FCPs

Check your boxes!

So I interpreted the nomination here as "please p-fcp merge this", which is why I removed nomination after doing that.

Checking boxes is generally something that should be done asynchronously via the https://rfcbot.rs/ list, so that the synchronous time in triage can be spent on things with specific questions in the nomination.

@joshtriplett
Copy link
Member

This is not a blocker for this issue, but could we please get a comment somewhere appropriate that says what code should do in the rare case where it has memory mapped at 0 and needs to write to it? (e.g. low-level hardware programming, or weird userspace programming situations that need the zero page mapped.) We should identify what function will allow such a write without complaint, and point people to that.

@scottmcm scottmcm removed the I-lang-nominated Nominated for discussion during a lang team meeting. label Oct 25, 2023
@RalfJung
Copy link
Member Author

RalfJung commented Oct 25, 2023 via email

@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Nov 3, 2023
@rfcbot
Copy link

rfcbot commented Nov 3, 2023

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

This will be merged soon.

@RalfJung
Copy link
Member Author

RalfJung commented Nov 4, 2023

@thomcc this should be ready to land then :)

Copy link
Member

@WaffleLapkin WaffleLapkin left a comment

Choose a reason for hiding this comment

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

Since this is only a documentation change and the semantic was approved by T-lang, I'll go ahead and merge this. Feel free to r- if you think that a T-libs review is required.

@WaffleLapkin
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Nov 6, 2023

📌 Commit 98d54da has been approved by WaffleLapkin

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 Nov 6, 2023
@bors
Copy link
Contributor

bors commented Nov 6, 2023

⌛ Testing commit 98d54da with merge b049093...

@bors
Copy link
Contributor

bors commented Nov 6, 2023

☀️ Test successful - checks-actions
Approved by: WaffleLapkin
Pushing b049093 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 6, 2023
@bors bors merged commit b049093 into rust-lang:master Nov 6, 2023
12 checks passed
@rustbot rustbot added this to the 1.75.0 milestone Nov 6, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (b049093): 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.9% [0.4%, 2.0%] 6
Regressions ❌
(secondary)
4.2% [4.2%, 4.2%] 1
Improvements ✅
(primary)
-0.5% [-0.5%, -0.5%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.6% [-0.5%, 2.0%] 8

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)
0.6% [0.6%, 0.6%] 2
Regressions ❌
(secondary)
0.8% [0.8%, 0.8%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.6% [0.6%, 0.6%] 2

Binary size

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

Bootstrap: 662.908s -> 662.932s (0.00%)
Artifact size: 308.97 MiB -> 308.95 MiB (-0.01%)

@RalfJung RalfJung deleted the null branch November 7, 2023 06:45
bors-ferrocene bot added a commit to ferrocene/ferrocene that referenced this pull request Nov 7, 2023
89: Automated pull from upstream `master` r=Dajamante a=github-actions[bot]


This PR pulls the following changes from the upstream repository:

* rust-lang/rust#117006
* rust-lang/rust#117511
* rust-lang/rust#117641
  * rust-lang/rust#117637
  * rust-lang/rust#117631
  * rust-lang/rust#117516
  * rust-lang/rust#117190
* rust-lang/rust#117292
* rust-lang/rust#117603
* rust-lang/rust#116988
* rust-lang/rust#117630
  * rust-lang/rust#117615
  * rust-lang/rust#117613
  * rust-lang/rust#117592
* rust-lang/rust#117578
* rust-lang/rust#117435
* rust-lang/rust#117607



90: bump serde and serde_derive r=tshepang a=Dajamante

Trying to get around the failure seen in #86 

Co-authored-by: Ralf Jung <post@ralfj.de>
Co-authored-by: Esteban Küber <esteban@kuber.com.ar>
Co-authored-by: SparrowLii <liyuan179@huawei.com>
Co-authored-by: Matthias Krüger <matthias.krueger@famsik.de>
Co-authored-by: Gurinder Singh <frederick.the.fool@gmail.com>
Co-authored-by: Michael Goulet <michael@errs.io>
Co-authored-by: Thom Chiovoloni <thom@shift.click>
Co-authored-by: klensy <klensy@users.noreply.github.com>
Co-authored-by: Jack Huey <31162821+jackh726@users.noreply.github.com>
Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
Co-authored-by: bors <bors@rust-lang.org>
Co-authored-by: Sven Marnach <sven@mozilla.com>
Co-authored-by: Rémy Rakic <remy.rakic+github@gmail.com>
Co-authored-by: aissata <aimaiga2@gmail.com>
@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Nov 9, 2023
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Mar 3, 2024
Pkgsrc changes:
 * Adjust patches and cargo checksums to new versions.
 * For an external LLVM, set dependency of llvm >= 16, in accordance
   with the upstream changes.
 * Mark that on NetBSD we now need >= 9.0, so 8.x is no longer supported.
 * On NetBSD/sparc64 10.x, we now need GCC 12 to build the embedded
   LLVM, which is version 17; apparently GCC 10.4 or 10.5 mis-compiles it,
   resulting in an illegal instruction fault during the build.
   Ref. rust-lang/rust#117231

Upstream changes:

Version 1.75.0 (2023-12-28)
==========================

- [Stabilize `async fn` and return-position `impl Trait` in traits.]
  (rust-lang/rust#115822)
- [Allow function pointer signatures containing `&mut T` in `const` contexts.]
  (rust-lang/rust#116015)
- [Match `usize`/`isize` exhaustively with half-open ranges.]
  (rust-lang/rust#116692)
- [Guarantee that `char` has the same size and alignment as `u32`.]
  (rust-lang/rust#116894)
- [Document that the null pointer has the 0 address.]
  (rust-lang/rust#116988)
- [Allow partially moved values in `match`.]
  (rust-lang/rust#103208)
- [Add notes about non-compliant FP behavior on 32bit x86 targets.]
  (rust-lang/rust#113053)
- [Stabilize ratified RISC-V target features.]
  (rust-lang/rust#116485)

Compiler
--------

- [Rework negative coherence to properly consider impls that only
  partly overlap.] (rust-lang/rust#112875)
- [Bump `COINDUCTIVE_OVERLAP_IN_COHERENCE` to deny, and warn in dependencies.]
  (rust-lang/rust#116493)
- [Consider alias bounds when computing liveness in NLL.]
  (rust-lang/rust#116733)
- [Add the V (vector) extension to the `riscv64-linux-android` target spec.]
  (rust-lang/rust#116618)
- [Automatically enable cross-crate inlining for small functions]
  (rust-lang/rust#116505)
- Add several new tier 3 targets:
    - [`csky-unknown-linux-gnuabiv2hf`]
      (rust-lang/rust#117049)
    - [`i586-unknown-netbsd`]
      (rust-lang/rust#117170)
    - [`mipsel-unknown-netbsd`]
      (rust-lang/rust#117356)

Refer to Rust's [platform support page][platform-support-doc]
for more information on Rust's tiered platform support.

Libraries
---------

- [Override `Waker::clone_from` to avoid cloning `Waker`s unnecessarily.]
  (rust-lang/rust#96979)
- [Implement `BufRead` for `VecDeque<u8>`.]
  (rust-lang/rust#110604)
- [Implement `FusedIterator` for `DecodeUtf16` when the inner iterator does.]
  (rust-lang/rust#110729)
- [Implement `Not, Bit{And,Or}{,Assign}` for IP addresses.]
  (rust-lang/rust#113747)
- [Implement `Default` for `ExitCode`.]
  (rust-lang/rust#114589)
- [Guarantee representation of None in NPO]
  (rust-lang/rust#115333)
- [Document when atomic loads are guaranteed read-only.]
  (rust-lang/rust#115577)
- [Broaden the consequences of recursive TLS initialization.]
  (rust-lang/rust#116172)
- [Windows: Support sub-millisecond sleep.]
  (rust-lang/rust#116461)
- [Fix generic bound of `str::SplitInclusive`'s `DoubleEndedIterator` impl]
  (rust-lang/rust#100806)
- [Fix exit status / wait status on non-Unix `cfg(unix)` platforms.]
  (rust-lang/rust#115108)

Stabilized APIs
---------------

- [`Atomic*::from_ptr`]
  (https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicUsize.html#method.from_ptr)
- [`FileTimes`]
  (https://doc.rust-lang.org/stable/std/fs/struct.FileTimes.html)
- [`FileTimesExt`]
  (https://doc.rust-lang.org/stable/std/os/windows/fs/trait.FileTimesExt.html)
- [`File::set_modified`]
  (https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.set_modified)
- [`File::set_times`]
  (https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.set_times)
- [`IpAddr::to_canonical`]
  (https://doc.rust-lang.org/stable/core/net/enum.IpAddr.html#method.to_canonical)
- [`Ipv6Addr::to_canonical`]
  (https://doc.rust-lang.org/stable/core/net/struct.Ipv6Addr.html#method.to_canonical)
- [`Option::as_slice`]
  (https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.as_slice)
- [`Option::as_mut_slice`]
  (https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.as_mut_slice)
- [`pointer::byte_add`]
  (https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.byte_add)
- [`pointer::byte_offset`]
  (https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.byte_offset)
- [`pointer::byte_offset_from`]
  (https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.byte_offset_from)
- [`pointer::byte_sub`]
  (https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.byte_sub)
- [`pointer::wrapping_byte_add`]
  (https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.wrapping_byte_add)
- [`pointer::wrapping_byte_offset`]
  (https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.wrapping_byte_offset)
- [`pointer::wrapping_byte_sub`]
  (https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.wrapping_byte_sub)

These APIs are now stable in const contexts:

- [`Ipv6Addr::to_ipv4_mapped`]
  (https://doc.rust-lang.org/stable/core/net/struct.Ipv6Addr.html#method.to_ipv4_mapped)
- [`MaybeUninit::assume_init_read`]
  (https://doc.rust-lang.org/stable/core/mem/union.MaybeUninit.html#method.assume_init_read)
- [`MaybeUninit::zeroed`]
  (https://doc.rust-lang.org/stable/core/mem/union.MaybeUninit.html#method.zeroed)
- [`mem::discriminant`]
  (https://doc.rust-lang.org/stable/core/mem/fn.discriminant.html)
- [`mem::zeroed`]
  (https://doc.rust-lang.org/stable/core/mem/fn.zeroed.html)

Cargo
-----

- [Add new packages to `[workspace.members]` automatically.]
  (rust-lang/cargo#12779)
- [Allow version-less `Cargo.toml` manifests.]
  (rust-lang/cargo#12786)
- [Make browser links out of HTML file paths.]
  (rust-lang/cargo#12889)

Rustdoc
-------

- [Accept less invalid Rust in rustdoc.]
  (rust-lang/rust#117450)
- [Document lack of object safety on affected traits.]
  (rust-lang/rust#113241)
- [Hide `#[repr(transparent)]` if it isn't part of the public ABI.]
  (rust-lang/rust#115439)
- [Show enum discriminant if it is a C-like variant.]
  (rust-lang/rust#116142)

Compatibility Notes
-------------------

- [FreeBSD targets now require at least version 12.]
  (rust-lang/rust#114521)
- [Formally demote tier 2 MIPS targets to tier 3.]
  (rust-lang/rust#115238)
- [Make misalignment a hard error in `const` contexts.]
  (rust-lang/rust#115524)
- [Fix detecting references to packed unsized fields.]
  (rust-lang/rust#115583)
- [Remove support for compiler plugins.]
  (rust-lang/rust#116412)
celinval added a commit to celinval/rust-dev that referenced this pull request Jun 4, 2024
Update Rust toolchain from nightly-2023-11-06 to nightly-2023-11-07
without any other source changes.
This is an automatically generated pull request. If any of the CI checks
fail, manual intervention is required. In such a case, review the
changes at https://github.com/rust-lang/rust from
rust-lang@fee5518
up to
rust-lang@189d6c7.
The log for this commit range is:
rust-lang@189d6c71f3 Auto merge of
rust-lang#117641 - matthiaskrgr:rollup-f9c12td, r=matthiaskrgr
rust-lang@9efe60b1eb Rollup merge of
rust-lang#117637 - lqd:trivial-bounds-with-binder-vars, r=compiler-errors
rust-lang@2a1f8bccee Rollup merge of
rust-lang#117631 - smarnach:error-request-doc-fix, r=ChrisDenton
rust-lang@8a34fea835 Rollup merge of
rust-lang#117516 - matthiaskrgr:test_effects_113375_oob, r=fee1-dead
rust-lang@1683df7d3b Rollup merge of
rust-lang#117190 - matthiaskrgr:test_effects_113381, r=fee1-dead
rust-lang@fb61292105 Auto merge of
rust-lang#117292 - estebank:issue-80446, r=davidtwco
rust-lang@4b7aacaa4f Silence redundant
error on typo resulting on binop
rust-lang@aea82b268a Auto merge of
rust-lang#117603 - HKalbasi:make-feature-additive, r=Nilstrieb
rust-lang@58351ae03f add test for trivial
bound not holding in `soa-derive`
rust-lang@2beca157c9 check binders with
bound vars for global bounds that don't hold
rust-lang@b049093560 Auto merge of
rust-lang#116988 - RalfJung:null, r=WaffleLapkin
rust-lang@e1fcecb1b9 Auto merge of
rust-lang#117630 - matthiaskrgr:rollup-v0d5p3f, r=matthiaskrgr
rust-lang@3a096e96fa Documentation
cleanup for core::error::Request.
rust-lang@b88d62e222 Rollup merge of
rust-lang#117615 - bjorn3:misc_changes, r=davidtwco
rust-lang@ec35c03143 Rollup merge of
rust-lang#117613 - jackh726:vacation, r=compiler-errors
rust-lang@60dca87cff Rollup merge of
rust-lang#117592 - thomcc:env-span-wrong, r=davidtwco
rust-lang@6bf2fb3679 Auto merge of
rust-lang#117578 - compiler-errors:derive-encode-in-rustc_type_ir, r=davidtwco
rust-lang@f9b644636f Auto merge of
rust-lang#117435 - SparrowLii:nightly_parallel, r=oli-obk,davidtwco
rust-lang@fcca978aa0 Auto merge of
rust-lang#117607 - klensy:clang-17.0.4, r=Mark-Simulacrum
rust-lang@152a4e90d1 Auto merge of
rust-lang#117585 - dnbln:feat/move-kw-span, r=cjgillot
rust-lang@f2a40e99ff use portable
AtomicU64 for powerPC and MIPS
rust-lang@7a892ab8d8 Auto merge of
rust-lang#117576 - the8472:fix-io-copy-vec, r=Mark-Simulacrum
rust-lang@c8a25eddfe Make the randomize
feature of rustc_abi additive
rust-lang@ec29a02071 Update doc comment
for CodegenBackend::link
rust-lang@ba82056a14 Use the actual
computed crate name for -Zprint-vtable-sizes
rust-lang@1a1b10fa63 Don't steal the
parse query when using --pretty
rust-lang@6e33e89337 Remove from vacation
and compiler review group
rust-lang@38ff91c453 bump clang version
for dist-x86_64-linux from 17.0.2 to 17.0.4
rust-lang@86fca873ba Use the correct span
when emitting the `env!` result
rust-lang@c077147200 fix clippy author
and failing test
rust-lang@876f698790 Add the
vis.visit_capture_by() in noop_visit_expr
rust-lang@54ce0346c0 add `fn
visit_capture_by` to MutVisitor and fix pprust-expr-roundtrip.rs
rust-lang@df85b28b72 fixes for rustfmt +
ast visitor
rust-lang@a6b41aa6ba fmt
rust-lang@241a654c07 Fix remaining uses
of `CaptureBy::Value`
rust-lang@8de489918b feat(hir): Store the
`Span` of the `move` keyword
rust-lang@bee7b5889e Derive
TyEncodable/TyDecodable implementations that are parameterized over
interner
rust-lang@78aa5e511c detect EOF earlier
rust-lang@8d8f06b277 avoid excessive
initialization when copying to a Vec
rust-lang@666cad9a5f add test for rust-lang#113375
rust-lang@384f7382ba add test for rust-lang#113381
rust-lang@248dd14fa5 update
config.example.toml
rust-lang@bf5fb7614b update bootstrap
change history
rust-lang@ab8101d019 enable parallel
rustc in nightly builds
rust-lang@231f93524d Detect misparsed
binop caused by missing semi
rust-lang@98d54da1ee document that the
null pointer has the 0 address

---------

Co-authored-by: celinval <celinval@users.noreply.github.com>
Co-authored-by: Zyad Hassan <zyadh@amazon.com>
Co-authored-by: Zyad Hassan <88045115+zhassan-aws@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. 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-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document that null is 0