Auto merge of #129108 - matthiaskrgr:rollup-t4rjwgp, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #125970 (CommandExt::before_exec: deprecate safety in edition 2024) - #127905 (Add powerpc-unknown-linux-muslspe compile target) - #128925 (derive(SmartPointer): register helper attributes) - #128946 (Hash Ipv*Addr as an integer) - #128963 (Add possibility to generate rustdoc JSON output to stdout) - #129015 (Update books) - #129067 (Use `append` instead of `extend(drain(..))`) - #129100 (Fix dependencies cron job) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
0ba9db87e6
2
.github/workflows/dependencies.yml
vendored
2
.github/workflows/dependencies.yml
vendored
@ -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:
|
||||
|
@ -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",
|
||||
|
@ -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"
|
||||
|
@ -578,12 +578,6 @@ pub struct 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!(
|
||||
|
@ -188,6 +188,11 @@ pub fn resize_to_elem(&mut self, elem: I, fill_value: impl FnMut() -> 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.
|
||||
|
@ -726,7 +726,7 @@ fn dest_needs_borrow(place: Place<'_>) -> bool {
|
||||
|
||||
// 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
|
||||
@ -740,7 +740,7 @@ fn dest_needs_borrow(place: Place<'_>) -> bool {
|
||||
// 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,
|
||||
|
@ -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
|
||||
@ -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.
|
||||
|
@ -1561,6 +1561,7 @@ fn $module() {
|
||||
("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),
|
||||
|
@ -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
|
||||
},
|
||||
}
|
||||
}
|
@ -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) {
|
||||
|
@ -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};
|
||||
@ -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].
|
||||
@ -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
|
||||
|
@ -109,13 +109,21 @@ unsafe fn pre_exec<F>(&mut self, f: F) -> &mut process::Command
|
||||
/// 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,
|
||||
{
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 67fa536768013d9d5a13f3a06790521d511ef711
|
||||
Subproject commit 04bc1396bb857f35b5dda1d773c9571e1f253304
|
@ -1 +1 @@
|
||||
Subproject commit 5454de3d12b9ccc6375b629cf7ccda8264640aac
|
||||
Subproject commit aeeb287d41a0332c210da122bea8e0e91844ab3e
|
@ -1 +1 @@
|
||||
Subproject commit 0ebdacadbda8ce2cd8fbf93985e15af61a7ab895
|
||||
Subproject commit 6ecf95c5f2bfa0e6314dfe282bf775fd1405f7e9
|
@ -1 +1 @@
|
||||
Subproject commit 2e191814f163ee1e77e2d6094eee4dd78a289c5b
|
||||
Subproject commit 62cd0df95061ba0ac886333f5cd7f3012f149da1
|
@ -1 +1 @@
|
||||
Subproject commit 89aecb6951b77bc746da73df8c9f2b2ceaad494a
|
||||
Subproject commit 8f94061936e492159f4f6c09c0f917a7521893ff
|
@ -1 +1 @@
|
||||
Subproject commit 0c4d55cb59fe440d1a630e4e5774d043968edb3f
|
||||
Subproject commit 43d83780db545a1ed6d45773312fc578987e3968
|
@ -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)
|
||||
|
@ -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) | ✓ | |
|
||||
|
@ -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.
|
@ -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
|
||||
|
@ -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)]
|
||||
@ -548,16 +551,17 @@ fn println_condition(condition: Condition) {
|
||||
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"),
|
||||
};
|
||||
|
||||
@ -818,6 +822,7 @@ fn println_condition(condition: Condition) {
|
||||
call_locations,
|
||||
no_emit_shared: false,
|
||||
html_no_source,
|
||||
output_to_stdout,
|
||||
};
|
||||
Some((options, render_options))
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::fs::{create_dir_all, File};
|
||||
use std::io::{BufWriter, Write};
|
||||
use std::io::{stdout, BufWriter, Write};
|
||||
use std::path::PathBuf;
|
||||
use std::rc::Rc;
|
||||
|
||||
@ -37,7 +37,7 @@ pub(crate) struct JsonRenderer<'tcx> {
|
||||
/// level field of the JSON blob.
|
||||
index: Rc<RefCell<FxHashMap<types::Id, types::Item>>>,
|
||||
/// The directory where the blob will be written to.
|
||||
out_path: PathBuf,
|
||||
out_path: Option<PathBuf>,
|
||||
cache: Rc<Cache>,
|
||||
imported_items: DefIdSet,
|
||||
}
|
||||
@ -97,6 +97,20 @@ fn get_impls(&mut self, id: DefId) -> Vec<types::Id> {
|
||||
})
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
fn write<T: Write>(
|
||||
&self,
|
||||
output: types::Crate,
|
||||
mut writer: BufWriter<T>,
|
||||
path: &str,
|
||||
) -> Result<(), Error> {
|
||||
self.tcx
|
||||
.sess
|
||||
.time("rustdoc_json_serialization", || serde_json::ser::to_writer(&mut writer, &output))
|
||||
.unwrap();
|
||||
try_err!(writer.flush(), path);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
|
||||
@ -120,7 +134,7 @@ fn init(
|
||||
JsonRenderer {
|
||||
tcx,
|
||||
index: Rc::new(RefCell::new(FxHashMap::default())),
|
||||
out_path: options.output,
|
||||
out_path: if options.output_to_stdout { None } else { Some(options.output) },
|
||||
cache: Rc::new(cache),
|
||||
imported_items,
|
||||
},
|
||||
@ -264,20 +278,21 @@ fn after_krate(&mut self) -> Result<(), Error> {
|
||||
.collect(),
|
||||
format_version: types::FORMAT_VERSION,
|
||||
};
|
||||
let out_dir = self.out_path.clone();
|
||||
try_err!(create_dir_all(&out_dir), out_dir);
|
||||
if let Some(ref out_path) = self.out_path {
|
||||
let out_dir = out_path.clone();
|
||||
try_err!(create_dir_all(&out_dir), out_dir);
|
||||
|
||||
let mut p = out_dir;
|
||||
p.push(output.index.get(&output.root).unwrap().name.clone().unwrap());
|
||||
p.set_extension("json");
|
||||
let mut file = BufWriter::new(try_err!(File::create(&p), p));
|
||||
self.tcx
|
||||
.sess
|
||||
.time("rustdoc_json_serialization", || serde_json::ser::to_writer(&mut file, &output))
|
||||
.unwrap();
|
||||
try_err!(file.flush(), p);
|
||||
|
||||
Ok(())
|
||||
let mut p = out_dir;
|
||||
p.push(output.index.get(&output.root).unwrap().name.clone().unwrap());
|
||||
p.set_extension("json");
|
||||
self.write(
|
||||
output,
|
||||
BufWriter::new(try_err!(File::create(&p), p)),
|
||||
&p.display().to_string(),
|
||||
)
|
||||
} else {
|
||||
self.write(output, BufWriter::new(stdout()), "<stdout>")
|
||||
}
|
||||
}
|
||||
|
||||
fn cache(&self) -> &Cache {
|
||||
|
@ -84,3 +84,18 @@ pub fn has_suffix<P: AsRef<Path>>(path: P, suffix: &str) -> bool {
|
||||
pub fn filename_contains<P: AsRef<Path>>(path: P, needle: &str) -> bool {
|
||||
path.as_ref().file_name().is_some_and(|name| name.to_str().unwrap().contains(needle))
|
||||
}
|
||||
|
||||
/// Helper for reading entries in a given directory and its children.
|
||||
pub fn read_dir_entries_recursive<P: AsRef<Path>, F: FnMut(&Path)>(dir: P, mut callback: F) {
|
||||
fn read_dir_entries_recursive_inner<P: AsRef<Path>, F: FnMut(&Path)>(dir: P, callback: &mut F) {
|
||||
for entry in rfs::read_dir(dir) {
|
||||
let path = entry.unwrap().path();
|
||||
callback(&path);
|
||||
if path.is_dir() {
|
||||
read_dir_entries_recursive_inner(path, callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
read_dir_entries_recursive_inner(dir, &mut callback);
|
||||
}
|
||||
|
@ -303,6 +303,12 @@ dependencies = [
|
||||
"crypto-common",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "doc-comment"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
|
||||
|
||||
[[package]]
|
||||
name = "elasticlunr-rs"
|
||||
version = "3.0.2"
|
||||
@ -465,6 +471,21 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "html_parser"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f6f56db07b6612644f6f7719f8ef944f75fff9d6378fdf3d316fd32194184abd"
|
||||
dependencies = [
|
||||
"doc-comment",
|
||||
"pest",
|
||||
"pest_derive",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "humantime"
|
||||
version = "2.1.0"
|
||||
@ -680,13 +701,13 @@ name = "mdbook-trpl-listing"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"html_parser",
|
||||
"mdbook",
|
||||
"pulldown-cmark",
|
||||
"pulldown-cmark-to-cmark",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"toml 0.8.14",
|
||||
"xmlparser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1767,12 +1788,6 @@ dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xmlparser"
|
||||
version = "0.13.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "66fee0b777b0f5ac1c69bb06d361268faafa61cd4682ae064a171c16c433e9e4"
|
||||
|
||||
[[package]]
|
||||
name = "yaml-rust"
|
||||
version = "0.4.5"
|
||||
|
@ -345,6 +345,9 @@
|
||||
//@ revisions: powerpc_unknown_linux_musl
|
||||
//@ [powerpc_unknown_linux_musl] compile-flags: --target powerpc-unknown-linux-musl
|
||||
//@ [powerpc_unknown_linux_musl] needs-llvm-components: powerpc
|
||||
//@ revisions: powerpc_unknown_linux_muslspe
|
||||
//@ [powerpc_unknown_linux_muslspe] compile-flags: --target powerpc-unknown-linux-muslspe
|
||||
//@ [powerpc_unknown_linux_muslspe] needs-llvm-components: powerpc
|
||||
//@ revisions: powerpc_unknown_netbsd
|
||||
//@ [powerpc_unknown_netbsd] compile-flags: --target powerpc-unknown-netbsd
|
||||
//@ [powerpc_unknown_netbsd] needs-llvm-components: powerpc
|
||||
|
1
tests/run-make/rustdoc-output-stdout/foo.rs
Normal file
1
tests/run-make/rustdoc-output-stdout/foo.rs
Normal file
@ -0,0 +1 @@
|
||||
pub struct Foo;
|
25
tests/run-make/rustdoc-output-stdout/rmake.rs
Normal file
25
tests/run-make/rustdoc-output-stdout/rmake.rs
Normal file
@ -0,0 +1,25 @@
|
||||
// This test verifies that rustdoc `-o -` prints JSON on stdout and doesn't generate
|
||||
// a JSON file.
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use run_make_support::path_helpers::{cwd, has_extension, read_dir_entries_recursive};
|
||||
use run_make_support::rustdoc;
|
||||
|
||||
fn main() {
|
||||
// First we check that we generate the JSON in the stdout.
|
||||
rustdoc()
|
||||
.input("foo.rs")
|
||||
.output("-")
|
||||
.arg("-Zunstable-options")
|
||||
.output_format("json")
|
||||
.run()
|
||||
.assert_stdout_contains("{\"");
|
||||
|
||||
// Then we check it didn't generate any JSON file.
|
||||
read_dir_entries_recursive(cwd(), |path| {
|
||||
if path.is_file() && has_extension(path, "json") {
|
||||
panic!("Found a JSON file {path:?}");
|
||||
}
|
||||
});
|
||||
}
|
45
tests/ui/deriving/auxiliary/another-proc-macro.rs
Normal file
45
tests/ui/deriving/auxiliary/another-proc-macro.rs
Normal file
@ -0,0 +1,45 @@
|
||||
//@ force-host
|
||||
//@ no-prefer-dynamic
|
||||
|
||||
#![crate_type = "proc-macro"]
|
||||
#![feature(proc_macro_quote)]
|
||||
|
||||
extern crate proc_macro;
|
||||
|
||||
use proc_macro::{quote, TokenStream};
|
||||
|
||||
#[proc_macro_derive(AnotherMacro, attributes(pointee))]
|
||||
pub fn derive(_input: TokenStream) -> TokenStream {
|
||||
quote! {
|
||||
const _: () = {
|
||||
const ANOTHER_MACRO_DERIVED: () = ();
|
||||
};
|
||||
}
|
||||
.into()
|
||||
}
|
||||
|
||||
#[proc_macro_attribute]
|
||||
pub fn pointee(
|
||||
_attr: proc_macro::TokenStream,
|
||||
_item: proc_macro::TokenStream,
|
||||
) -> proc_macro::TokenStream {
|
||||
quote! {
|
||||
const _: () = {
|
||||
const POINTEE_MACRO_ATTR_DERIVED: () = ();
|
||||
};
|
||||
}
|
||||
.into()
|
||||
}
|
||||
|
||||
#[proc_macro_attribute]
|
||||
pub fn default(
|
||||
_attr: proc_macro::TokenStream,
|
||||
_item: proc_macro::TokenStream,
|
||||
) -> proc_macro::TokenStream {
|
||||
quote! {
|
||||
const _: () = {
|
||||
const DEFAULT_MACRO_ATTR_DERIVED: () = ();
|
||||
};
|
||||
}
|
||||
.into()
|
||||
}
|
25
tests/ui/deriving/built-in-proc-macro-scope.rs
Normal file
25
tests/ui/deriving/built-in-proc-macro-scope.rs
Normal file
@ -0,0 +1,25 @@
|
||||
//@ check-pass
|
||||
//@ aux-build: another-proc-macro.rs
|
||||
//@ compile-flags: -Zunpretty=expanded
|
||||
|
||||
#![feature(derive_smart_pointer)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate another_proc_macro;
|
||||
|
||||
use another_proc_macro::{pointee, AnotherMacro};
|
||||
|
||||
#[derive(core::marker::SmartPointer)]
|
||||
#[repr(transparent)]
|
||||
pub struct Ptr<'a, #[pointee] T: ?Sized> {
|
||||
data: &'a mut T,
|
||||
}
|
||||
|
||||
#[pointee]
|
||||
fn f() {}
|
||||
|
||||
#[derive(AnotherMacro)]
|
||||
#[pointee]
|
||||
struct MyStruct;
|
||||
|
||||
fn main() {}
|
43
tests/ui/deriving/built-in-proc-macro-scope.stdout
Normal file
43
tests/ui/deriving/built-in-proc-macro-scope.stdout
Normal file
@ -0,0 +1,43 @@
|
||||
#![feature(prelude_import)]
|
||||
#![no_std]
|
||||
//@ check-pass
|
||||
//@ aux-build: another-proc-macro.rs
|
||||
//@ compile-flags: -Zunpretty=expanded
|
||||
|
||||
#![feature(derive_smart_pointer)]
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
|
||||
#[macro_use]
|
||||
extern crate another_proc_macro;
|
||||
|
||||
use another_proc_macro::{pointee, AnotherMacro};
|
||||
|
||||
#[repr(transparent)]
|
||||
pub struct Ptr<'a, #[pointee] T: ?Sized> {
|
||||
data: &'a mut T,
|
||||
}
|
||||
#[automatically_derived]
|
||||
impl<'a, T: ?Sized + ::core::marker::Unsize<__S>, __S: ?Sized>
|
||||
::core::ops::DispatchFromDyn<Ptr<'a, __S>> for Ptr<'a, T> {
|
||||
}
|
||||
#[automatically_derived]
|
||||
impl<'a, T: ?Sized + ::core::marker::Unsize<__S>, __S: ?Sized>
|
||||
::core::ops::CoerceUnsized<Ptr<'a, __S>> for Ptr<'a, T> {
|
||||
}
|
||||
|
||||
|
||||
|
||||
const _: () =
|
||||
{
|
||||
const POINTEE_MACRO_ATTR_DERIVED: () = ();
|
||||
};
|
||||
#[pointee]
|
||||
struct MyStruct;
|
||||
const _: () =
|
||||
{
|
||||
const ANOTHER_MACRO_DERIVED: () = ();
|
||||
};
|
||||
fn main() {}
|
20
tests/ui/deriving/proc-macro-attribute-mixing.rs
Normal file
20
tests/ui/deriving/proc-macro-attribute-mixing.rs
Normal file
@ -0,0 +1,20 @@
|
||||
// This test certify that we can mix attribute macros from Rust and external proc-macros.
|
||||
// For instance, `#[derive(Default)]` uses `#[default]` and `#[derive(SmartPointer)]` uses
|
||||
// `#[pointee]`.
|
||||
// The scoping rule should allow the use of the said two attributes when external proc-macros
|
||||
// are in scope.
|
||||
|
||||
//@ check-pass
|
||||
//@ aux-build: another-proc-macro.rs
|
||||
//@ compile-flags: -Zunpretty=expanded
|
||||
|
||||
#![feature(derive_smart_pointer)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate another_proc_macro;
|
||||
|
||||
#[pointee]
|
||||
fn f() {}
|
||||
|
||||
#[default]
|
||||
fn g() {}
|
30
tests/ui/deriving/proc-macro-attribute-mixing.stdout
Normal file
30
tests/ui/deriving/proc-macro-attribute-mixing.stdout
Normal file
@ -0,0 +1,30 @@
|
||||
#![feature(prelude_import)]
|
||||
#![no_std]
|
||||
// This test certify that we can mix attribute macros from Rust and external proc-macros.
|
||||
// For instance, `#[derive(Default)]` uses `#[default]` and `#[derive(SmartPointer)]` uses
|
||||
// `#[pointee]`.
|
||||
// The scoping rule should allow the use of the said two attributes when external proc-macros
|
||||
// are in scope.
|
||||
|
||||
//@ check-pass
|
||||
//@ aux-build: another-proc-macro.rs
|
||||
//@ compile-flags: -Zunpretty=expanded
|
||||
|
||||
#![feature(derive_smart_pointer)]
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
|
||||
#[macro_use]
|
||||
extern crate another_proc_macro;
|
||||
|
||||
|
||||
const _: () =
|
||||
{
|
||||
const POINTEE_MACRO_ATTR_DERIVED: () = ();
|
||||
};
|
||||
const _: () =
|
||||
{
|
||||
const DEFAULT_MACRO_ATTR_DERIVED: () = ();
|
||||
};
|
@ -3,7 +3,6 @@
|
||||
#[derive(SmartPointer)] //~ ERROR use of unstable library feature 'derive_smart_pointer'
|
||||
#[repr(transparent)]
|
||||
struct MyPointer<'a, #[pointee] T: ?Sized> {
|
||||
//~^ ERROR the `#[pointee]` attribute is an experimental feature
|
||||
ptr: &'a T,
|
||||
}
|
||||
|
||||
|
@ -8,16 +8,6 @@ LL | #[derive(SmartPointer)]
|
||||
= help: add `#![feature(derive_smart_pointer)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the `#[pointee]` attribute is an experimental feature
|
||||
--> $DIR/feature-gate-derive-smart-pointer.rs:5:22
|
||||
|
|
||||
LL | struct MyPointer<'a, #[pointee] T: ?Sized> {
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #123430 <https://github.com/rust-lang/rust/issues/123430> for more information
|
||||
= help: add `#![feature(derive_smart_pointer)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: use of unstable library feature 'derive_smart_pointer'
|
||||
--> $DIR/feature-gate-derive-smart-pointer.rs:1:5
|
||||
|
|
||||
@ -28,6 +18,6 @@ LL | use std::marker::SmartPointer;
|
||||
= help: add `#![feature(derive_smart_pointer)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
11
tests/ui/rust-2024/unsafe-before_exec.e2024.stderr
Normal file
11
tests/ui/rust-2024/unsafe-before_exec.e2024.stderr
Normal file
@ -0,0 +1,11 @@
|
||||
error[E0133]: call to unsafe function `before_exec` is unsafe and requires unsafe block
|
||||
--> $DIR/unsafe-before_exec.rs:14:5
|
||||
|
|
||||
LL | cmd.before_exec(|| Ok(()));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
17
tests/ui/rust-2024/unsafe-before_exec.rs
Normal file
17
tests/ui/rust-2024/unsafe-before_exec.rs
Normal file
@ -0,0 +1,17 @@
|
||||
//@ revisions: e2021 e2024
|
||||
//@ only-unix
|
||||
//@[e2021] edition: 2021
|
||||
//@[e2021] check-pass
|
||||
//@[e2024] edition: 2024
|
||||
//@[e2024] compile-flags: -Zunstable-options
|
||||
|
||||
use std::process::Command;
|
||||
use std::os::unix::process::CommandExt;
|
||||
|
||||
#[allow(deprecated)]
|
||||
fn main() {
|
||||
let mut cmd = Command::new("sleep");
|
||||
cmd.before_exec(|| Ok(()));
|
||||
//[e2024]~^ ERROR call to unsafe function `before_exec` is unsafe
|
||||
drop(cmd); // we don't actually run the command.
|
||||
}
|
Loading…
Reference in New Issue
Block a user