Auto merge of #84956 - RalfJung:rollup-m70mx2n, r=RalfJung
Rollup of 11 pull requests Successful merges: - #83553 (Update `ptr` docs with regards to `ptr::addr_of!`) - #84183 (Update RELEASES.md for 1.52.0) - #84709 (Add doc alias for `chdir` to `std::env::set_current_dir`) - #84803 (Reduce duplication in `impl_dep_tracking_hash` macros) - #84808 (Account for unsatisfied bounds in E0599) - #84843 (use else if in std library ) - #84865 (rustbuild: Pass a `threads` flag that works to windows-gnu lld) - #84878 (Clarify documentation for `[T]::contains`) - #84882 (platform-support: Center the contents of the `std` and `host` columns) - #84903 (Remove `rustc_middle::mir::interpret::CheckInAllocMsg::NullPointerTest`) - #84913 (Do not ICE on invalid const param) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
bacf770f29
16 changed files with 360 additions and 121 deletions
|
@ -61,6 +61,7 @@ pub fn current_dir() -> io::Result<PathBuf> {
|
|||
/// assert!(env::set_current_dir(&root).is_ok());
|
||||
/// println!("Successfully changed working directory to {}!", root.display());
|
||||
/// ```
|
||||
#[doc(alias = "chdir")]
|
||||
#[stable(feature = "env", since = "1.0.0")]
|
||||
pub fn set_current_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
|
||||
os_imp::chdir(path.as_ref())
|
||||
|
|
|
@ -445,7 +445,27 @@ mod prim_unit {}
|
|||
/// Note that here the call to [`drop`] is for clarity - it indicates
|
||||
/// that we are done with the given value and it should be destroyed.
|
||||
///
|
||||
/// ## 3. Get it from C.
|
||||
/// ## 3. Create it using `ptr::addr_of!`
|
||||
///
|
||||
/// Instead of coercing a reference to a raw pointer, you can use the macros
|
||||
/// [`ptr::addr_of!`] (for `*const T`) and [`ptr::addr_of_mut!`] (for `*mut T`).
|
||||
/// These macros allow you to create raw pointers to fields to which you cannot
|
||||
/// create a reference (without causing undefined behaviour), such as an
|
||||
/// unaligned field. This might be necessary if packed structs or uninitialized
|
||||
/// memory is involved.
|
||||
///
|
||||
/// ```
|
||||
/// #[derive(Debug, Default, Copy, Clone)]
|
||||
/// #[repr(C, packed)]
|
||||
/// struct S {
|
||||
/// aligned: u8,
|
||||
/// unaligned: u32,
|
||||
/// }
|
||||
/// let s = S::default();
|
||||
/// let p = std::ptr::addr_of!(s.unaligned); // not allowed with coercion
|
||||
/// ```
|
||||
///
|
||||
/// ## 4. Get it from C.
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(rustc_private)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue