Skip to content

Commit

Permalink
Auto merge of rust-lang#129108 - matthiaskrgr:rollup-t4rjwgp, r=matth…
Browse files Browse the repository at this point in the history
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#125970 (CommandExt::before_exec: deprecate safety in edition 2024)
 - rust-lang#127905 (Add powerpc-unknown-linux-muslspe compile target)
 - rust-lang#128925 (derive(SmartPointer): register helper attributes)
 - rust-lang#128946 (Hash Ipv*Addr as an integer)
 - rust-lang#128963 (Add possibility to generate rustdoc JSON output to stdout)
 - rust-lang#129015 (Update books)
 - rust-lang#129067 (Use `append` instead of `extend(drain(..))`)
 - rust-lang#129100 (Fix dependencies cron job)

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Aug 15, 2024
2 parents 13a5289 + e14f171 commit 0ba9db8
Show file tree
Hide file tree
Showing 38 changed files with 419 additions and 66 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
- name: cargo update rustbook
run: |
echo -e "\nrustbook dependencies:" >> cargo_update.log
cargo update --manifest-path src/tools/rustbook 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
cargo update --manifest-path src/tools/rustbook/Cargo.toml 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
- name: upload Cargo.lock artifact for use in PR
uses: actions/upload-artifact@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1775,9 +1775,9 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683"

[[package]]
name = "indexmap"
version = "2.2.6"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c"
dependencies = [
"equivalent",
"hashbrown",
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_data_structures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ bitflags = "2.4.1"
either = "1.0"
elsa = "=1.7.1"
ena = "0.14.3"
indexmap = { version = "2.0.0" }
indexmap = { version = "2.4.0" }
jobserver_crate = { version = "0.1.28", package = "jobserver" }
measureme = "11"
rustc-hash = "1.1.0"
Expand Down
6 changes: 0 additions & 6 deletions compiler/rustc_feature/src/builtin_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -578,12 +578,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
EncodeCrossCrate::No, coroutines, experimental!(coroutines)
),

// `#[pointee]` attribute to designate the pointee type in SmartPointer derive-macro
gated!(
pointee, Normal, template!(Word), ErrorFollowing,
EncodeCrossCrate::No, derive_smart_pointer, experimental!(pointee)
),

// RFC 3543
// `#[patchable_function_entry(prefix_nops = m, entry_nops = n)]`
gated!(
Expand Down
5 changes: 5 additions & 0 deletions compiler/rustc_index/src/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ impl<I: Idx, T> IndexVec<I, T> {
let min_new_len = elem.index() + 1;
self.raw.resize_with(min_new_len, fill_value);
}

#[inline]
pub fn append(&mut self, other: &mut Self) {
self.raw.append(&mut other.raw);
}
}

/// `IndexVec` is often used as a map, so it provides some map-like APIs.
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_mir_transform/src/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ impl<'tcx> Inliner<'tcx> {

// Insert all of the (mapped) parts of the callee body into the caller.
caller_body.local_decls.extend(callee_body.drain_vars_and_temps());
caller_body.source_scopes.extend(&mut callee_body.source_scopes.drain(..));
caller_body.source_scopes.append(&mut callee_body.source_scopes);
if self
.tcx
.sess
Expand All @@ -740,7 +740,7 @@ impl<'tcx> Inliner<'tcx> {
// still getting consistent results from the mir-opt tests.
caller_body.var_debug_info.append(&mut callee_body.var_debug_info);
}
caller_body.basic_blocks_mut().extend(callee_body.basic_blocks_mut().drain(..));
caller_body.basic_blocks_mut().append(callee_body.basic_blocks_mut());

caller_body[callsite.block].terminator = Some(Terminator {
source_info: callsite.source_info,
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_monomorphize/src/partitioning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ fn merge_codegen_units<'tcx>(
// Move the items from `cgu_src` to `cgu_dst`. Some of them may be
// duplicate inlined items, in which case the destination CGU is
// unaffected. Recalculate size estimates afterwards.
cgu_dst.items_mut().extend(cgu_src.items_mut().drain(..));
cgu_dst.items_mut().append(cgu_src.items_mut());
cgu_dst.compute_size_estimate();

// Record that `cgu_dst` now contains all the stuff that was in
Expand Down Expand Up @@ -410,7 +410,7 @@ fn merge_codegen_units<'tcx>(
// Move the items from `smallest` to `second_smallest`. Some of them
// may be duplicate inlined items, in which case the destination CGU is
// unaffected. Recalculate size estimates afterwards.
second_smallest.items_mut().extend(smallest.items_mut().drain(..));
second_smallest.items_mut().append(smallest.items_mut());
second_smallest.compute_size_estimate();

// Don't update `cgu_contents`, that's only for incremental builds.
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1561,6 +1561,7 @@ supported_targets! {
("powerpc-unknown-linux-gnu", powerpc_unknown_linux_gnu),
("powerpc-unknown-linux-gnuspe", powerpc_unknown_linux_gnuspe),
("powerpc-unknown-linux-musl", powerpc_unknown_linux_musl),
("powerpc-unknown-linux-muslspe", powerpc_unknown_linux_muslspe),
("powerpc64-ibm-aix", powerpc64_ibm_aix),
("powerpc64-unknown-linux-gnu", powerpc64_unknown_linux_gnu),
("powerpc64-unknown-linux-musl", powerpc64_unknown_linux_musl),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
use crate::abi::Endian;
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};

pub fn target() -> Target {
let mut base = base::linux_musl::opts();
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-mspe"]);
base.max_atomic_width = Some(32);
base.stack_probes = StackProbeType::Inline;

Target {
llvm_target: "powerpc-unknown-linux-muslspe".into(),
metadata: crate::spec::TargetMetadata {
description: Some("PowerPC SPE Linux with musl".into()),
tier: Some(3),
host_tools: Some(false),
std: Some(true),
},
pointer_width: 32,
data_layout: "E-m:e-p:32:32-Fn32-i64:64-n32".into(),
arch: "powerpc".into(),
options: TargetOptions {
abi: "spe".into(),
endian: Endian::Big,
mcount: "_mcount".into(),
..base
},
}
}
2 changes: 1 addition & 1 deletion library/core/src/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,7 @@ pub trait FnPtr: Copy + Clone {
}

/// Derive macro generating impls of traits related to smart pointers.
#[rustc_builtin_macro]
#[rustc_builtin_macro(SmartPointer, attributes(pointee))]
#[allow_internal_unstable(dispatch_from_dyn, coerce_unsized, unsize)]
#[unstable(feature = "derive_smart_pointer", issue = "123430")]
pub macro SmartPointer($item:item) {
Expand Down
25 changes: 23 additions & 2 deletions library/core/src/net/ip_addr.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use super::display_buffer::DisplayBuffer;
use crate::cmp::Ordering;
use crate::fmt::{self, Write};
use crate::hash::{Hash, Hasher};
use crate::iter;
use crate::mem::transmute;
use crate::ops::{BitAnd, BitAndAssign, BitOr, BitOrAssign, Not};
Expand Down Expand Up @@ -67,12 +68,22 @@ pub enum IpAddr {
/// assert!("0000000.0.0.0".parse::<Ipv4Addr>().is_err()); // first octet is a zero in octal
/// assert!("0xcb.0x0.0x71.0x00".parse::<Ipv4Addr>().is_err()); // all octets are in hex
/// ```
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
#[derive(Copy, Clone, PartialEq, Eq)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Ipv4Addr {
octets: [u8; 4],
}

#[stable(feature = "rust1", since = "1.0.0")]
impl Hash for Ipv4Addr {
fn hash<H: Hasher>(&self, state: &mut H) {
// Hashers are often more efficient at hashing a fixed-width integer
// than a bytestring, so convert before hashing. We don't use to_bits()
// here as that may involve a byteswap which is unnecessary.
u32::from_ne_bytes(self.octets).hash(state);
}
}

/// An IPv6 address.
///
/// IPv6 addresses are defined as 128-bit integers in [IETF RFC 4291].
Expand Down Expand Up @@ -149,12 +160,22 @@ pub struct Ipv4Addr {
/// assert_eq!("::1".parse(), Ok(localhost));
/// assert_eq!(localhost.is_loopback(), true);
/// ```
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
#[derive(Copy, Clone, PartialEq, Eq)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Ipv6Addr {
octets: [u8; 16],
}

#[stable(feature = "rust1", since = "1.0.0")]
impl Hash for Ipv6Addr {
fn hash<H: Hasher>(&self, state: &mut H) {
// Hashers are often more efficient at hashing a fixed-width integer
// than a bytestring, so convert before hashing. We don't use to_bits()
// here as that may involve unnecessary byteswaps.
u128::from_ne_bytes(self.octets).hash(state);
}
}

/// Scope of an [IPv6 multicast address] as defined in [IETF RFC 7346 section 2].
///
/// # Stability Guarantees
Expand Down
14 changes: 11 additions & 3 deletions library/std/src/os/unix/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,21 @@ pub trait CommandExt: Sealed {
/// Schedules a closure to be run just before the `exec` function is
/// invoked.
///
/// This method is stable and usable, but it should be unsafe. To fix
/// that, it got deprecated in favor of the unsafe [`pre_exec`].
/// `before_exec` used to be a safe method, but it needs to be unsafe since the closure may only
/// perform operations that are *async-signal-safe*. Hence it got deprecated in favor of the
/// unsafe [`pre_exec`]. Meanwhile, Rust gained the ability to make an existing safe method
/// fully unsafe in a new edition, which is how `before_exec` became `unsafe`. It still also
/// remains deprecated; `pre_exec` should be used instead.
///
/// [`pre_exec`]: CommandExt::pre_exec
#[stable(feature = "process_exec", since = "1.15.0")]
#[deprecated(since = "1.37.0", note = "should be unsafe, use `pre_exec` instead")]
fn before_exec<F>(&mut self, f: F) -> &mut process::Command
#[cfg_attr(bootstrap, rustc_deprecated_safe_2024)]
#[cfg_attr(
not(bootstrap),
rustc_deprecated_safe_2024(audit_that = "the closure is async-signal-safe")
)]
unsafe fn before_exec<F>(&mut self, f: F) -> &mut process::Command
where
F: FnMut() -> io::Result<()> + Send + Sync + 'static,
{
Expand Down
2 changes: 1 addition & 1 deletion src/doc/nomicon
2 changes: 1 addition & 1 deletion src/doc/rust-by-example
1 change: 1 addition & 0 deletions src/doc/rustc/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
- [mipsisa\*r6\*-unknown-linux-gnu\*](platform-support/mips-release-6.md)
- [nvptx64-nvidia-cuda](platform-support/nvptx64-nvidia-cuda.md)
- [powerpc-unknown-openbsd](platform-support/powerpc-unknown-openbsd.md)
- [powerpc-unknown-linux-muslspe](platform-support/powerpc-unknown-linux-muslspe.md)
- [powerpc64-ibm-aix](platform-support/aix.md)
- [riscv32im-risc0-zkvm-elf](platform-support/riscv32im-risc0-zkvm-elf.md)
- [riscv32imac-unknown-xous-elf](platform-support/riscv32imac-unknown-xous-elf.md)
Expand Down
1 change: 1 addition & 0 deletions src/doc/rustc/src/platform-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ target | std | host | notes
`msp430-none-elf` | * | | 16-bit MSP430 microcontrollers
`powerpc-unknown-linux-gnuspe` | ✓ | | PowerPC SPE Linux
`powerpc-unknown-linux-musl` | ? | | PowerPC Linux with musl 1.2.3
[`powerpc-unknown-linux-muslspe`](platform-support/powerpc-unknown-linux-muslspe.md) | ? | | PowerPC SPE Linux
[`powerpc-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | NetBSD 32-bit powerpc systems
[`powerpc-unknown-openbsd`](platform-support/powerpc-unknown-openbsd.md) | * | |
[`powerpc-wrs-vxworks-spe`](platform-support/vxworks.md) | ✓ | |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# powerpc-unknown-linux-muslspe

**Tier: 3**

This target is very similar to already existing ones like `powerpc_unknown_linux_musl` and `powerpc_unknown_linux_gnuspe`.
This one has PowerPC SPE support for musl. Unfortunately, the last supported gcc version with PowerPC SPE is 8.4.0.

## Target maintainers

- [@BKPepe](https://github.com/BKPepe)

## Requirements

This target is cross-compiled. There is no support for `std`. There is no
default allocator, but it's possible to use `alloc` by supplying an allocator.

This target generated binaries in the ELF format.

## Building the target

This target was tested and used within the `OpenWrt` build system for CZ.NIC Turris 1.x routers using Freescale P2020.

## Building Rust programs

Rust does not yet ship pre-compiled artifacts for this target. To compile for
this target, you will either need to build Rust with the target enabled (see
"Building the target" above), or build your own copy of `core` by using
`build-std` or similar.

## Testing

This is a cross-compiled target and there is no support to run rustc test suite.
3 changes: 3 additions & 0 deletions src/doc/rustdoc/src/unstable-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,9 @@ pub fn no_documentation() {}

Note that the third item is the crate root, which in this case is undocumented.

If you want the JSON output to be displayed on `stdout` instead of having a file generated, you can
use `-o -`.

### `-w`/`--output-format`: output format

`--output-format json` emits documentation in the experimental
Expand Down
15 changes: 10 additions & 5 deletions src/librustdoc/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ pub(crate) struct RenderOptions {
pub(crate) no_emit_shared: bool,
/// If `true`, HTML source code pages won't be generated.
pub(crate) html_no_source: bool,
/// This field is only used for the JSON output. If it's set to true, no file will be created
/// and content will be displayed in stdout directly.
pub(crate) output_to_stdout: bool,
}

#[derive(Copy, Clone, Debug, PartialEq, Eq)]
Expand Down Expand Up @@ -548,16 +551,17 @@ impl Options {
dcx.fatal("the `--test` flag must be passed to enable `--no-run`");
}

let mut output_to_stdout = false;
let test_builder_wrappers =
matches.opt_strs("test-builder-wrapper").iter().map(PathBuf::from).collect();
let out_dir = matches.opt_str("out-dir").map(|s| PathBuf::from(&s));
let output = matches.opt_str("output").map(|s| PathBuf::from(&s));
let output = match (out_dir, output) {
let output = match (matches.opt_str("out-dir"), matches.opt_str("output")) {
(Some(_), Some(_)) => {
dcx.fatal("cannot use both 'out-dir' and 'output' at once");
}
(Some(out_dir), None) => out_dir,
(None, Some(output)) => output,
(Some(out_dir), None) | (None, Some(out_dir)) => {
output_to_stdout = out_dir == "-";
PathBuf::from(out_dir)
}
(None, None) => PathBuf::from("doc"),
};

Expand Down Expand Up @@ -818,6 +822,7 @@ impl Options {
call_locations,
no_emit_shared: false,
html_no_source,
output_to_stdout,
};
Some((options, render_options))
}
Expand Down
Loading

0 comments on commit 0ba9db8

Please sign in to comment.