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

Rollup of 7 pull requests #127639

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a1ad634
Add fn allocator method to rc/sync::Weak. Relax Rc<T>/Arc<T>::allocat…
zachs18 May 10, 2024
5c46aca
document the cvt methods
the8472 Jun 22, 2024
6687a3f
use pidfd_spawn for faster process creation when pidfds are requested
the8472 Jun 22, 2024
0ce3619
document safety properties of the internal Process::new constructor
the8472 Jun 24, 2024
3e4e31b
more fine-grained feature-detection for pidfd spawning
the8472 Jun 24, 2024
ec0c755
Check that we get somewhat sane PIDs when spawning with pidfds
the8472 Jun 24, 2024
de14f1f
add test that multi-threaded panics aren't interleaved
jyn514 Jul 5, 2024
53d3e62
Stabilize const_cstr_from_ptr (CStr::from_ptr, CStr::count_bytes)
dtolnay Jul 6, 2024
3a1dd85
fix interleaved panic output
jyn514 Jul 5, 2024
55256c5
Update dist-riscv64-linux to binutils 2.40
nikic Jul 10, 2024
199eaca
Add rustdoc support for use<> in (local) RPITs
compiler-errors Jul 11, 2024
caf1457
Add rustdoc-json support for use<>
compiler-errors Jul 11, 2024
ec05c4e
Add the feature gate and target-features
sayantn Jun 23, 2024
7f1518b
Add instability attribute on private const_strlen function
dtolnay Jul 12, 2024
d4ec8e7
Rollup merge of #124980 - zachs18:rc-allocator, r=Amanieu
matthiaskrgr Jul 12, 2024
0a83111
Rollup merge of #126639 - sayantn:amx, r=Amanieu
matthiaskrgr Jul 12, 2024
1a63d8f
Rollup merge of #126827 - the8472:pidfd-spawn, r=workingjubilee
matthiaskrgr Jul 12, 2024
0ef6c86
Rollup merge of #127397 - jyn514:multi-thread-panic-hook, r=workingju…
matthiaskrgr Jul 12, 2024
ff88b54
Rollup merge of #127433 - dtolnay:conststrlen, r=workingjubilee
matthiaskrgr Jul 12, 2024
5e4ff01
Rollup merge of #127613 - nikic:riscv-update, r=cuviper
matthiaskrgr Jul 12, 2024
14e17b8
Rollup merge of #127632 - compiler-errors:precise-capturing-rustdoc, …
matthiaskrgr Jul 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions compiler/rustc_hir/src/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2708,6 +2708,13 @@ impl PreciseCapturingArg<'_> {
PreciseCapturingArg::Param(param) => param.hir_id,
}
}

pub fn name(self) -> Symbol {
match self {
PreciseCapturingArg::Lifetime(lt) => lt.ident.name,
PreciseCapturingArg::Param(param) => param.ident.name,
}
}
}

/// We need to have a [`Node`] for the [`HirId`] that we attach the type/const param
Expand Down
2 changes: 2 additions & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ ignore = [
"/tests/rustdoc-ui/", # Some have syntax errors, some are whitespace-sensitive.
"/tests/ui/", # Some have syntax errors, some are whitespace-sensitive.
"/tests/ui-fulldeps/", # Some are whitespace-sensitive (e.g. `// ~ERROR` comments).
# #[cfg(bootstrap)] so that t-release sees this when they search for it
"/tests/rustdoc-json/impl-trait-precise-capturing.rs",

# Do not format submodules.
# FIXME: sync submodule list with tidy/bootstrap/etc
Expand Down
5 changes: 3 additions & 2 deletions src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,9 @@ fn clean_generic_bound<'tcx>(

GenericBound::TraitBound(clean_poly_trait_ref(t, cx), modifier)
}
// FIXME(precise_capturing): Implement rustdoc support
hir::GenericBound::Use(..) => return None,
hir::GenericBound::Use(args, ..) => {
GenericBound::Use(args.iter().map(|arg| arg.name()).collect())
}
})
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/clean/simplify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub(crate) fn merge_bounds(
!bounds.iter_mut().any(|b| {
let trait_ref = match *b {
clean::GenericBound::TraitBound(ref mut tr, _) => tr,
clean::GenericBound::Outlives(..) => return false,
clean::GenericBound::Outlives(..) | clean::GenericBound::Use(_) => return false,
};
// If this QPath's trait `trait_did` is the same as, or a supertrait
// of, the bound's trait `did` then we can keep going, otherwise
Expand Down
2 changes: 2 additions & 0 deletions src/librustdoc/clean/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1244,6 +1244,8 @@ impl Eq for Attributes {}
pub(crate) enum GenericBound {
TraitBound(PolyTrait, hir::TraitBoundModifier),
Outlives(Lifetime),
/// `use<'a, T>` precise-capturing bound syntax
Use(Vec<Symbol>),
}

impl GenericBound {
Expand Down
14 changes: 14 additions & 0 deletions src/librustdoc/html/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,20 @@ impl clean::GenericBound {
})?;
ty.print(cx).fmt(f)
}
clean::GenericBound::Use(args) => {
if f.alternate() {
f.write_str("use&lt;")?;
} else {
f.write_str("use<")?;
}
for (i, arg) in args.iter().enumerate() {
if i > 0 {
write!(f, ", ")?;
}
arg.fmt(f)?;
}
if f.alternate() { f.write_str("&gt;") } else { f.write_str(">") }
}
})
}
}
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/json/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ impl FromWithTcx<clean::GenericBound> for GenericBound {
}
}
Outlives(lifetime) => GenericBound::Outlives(convert_lifetime(lifetime)),
Use(args) => GenericBound::Use(args.into_iter().map(|arg| arg.to_string()).collect()),
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/rustdoc-json-types/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use serde::{Deserialize, Serialize};
use std::path::PathBuf;

/// rustdoc format-version.
pub const FORMAT_VERSION: u32 = 31;
pub const FORMAT_VERSION: u32 = 32;

/// A `Crate` is the root of the emitted JSON blob. It contains all type/documentation information
/// about the language items in the local crate, as well as info about external items to allow
Expand Down Expand Up @@ -538,6 +538,8 @@ pub enum GenericBound {
modifier: TraitBoundModifier,
},
Outlives(String),
/// `use<'a, T>` precise-capturing bound syntax
Use(Vec<String>),
}

#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
Expand Down
1 change: 1 addition & 0 deletions src/tools/jsondoclint/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ impl<'a> Validator<'a> {
generic_params.iter().for_each(|gpd| self.check_generic_param_def(gpd));
}
GenericBound::Outlives(_) => {}
GenericBound::Use(_) => {}
}
}

Expand Down
6 changes: 6 additions & 0 deletions tests/rustdoc-json/impl-trait-precise-capturing.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#![feature(precise_capturing)]

// @is "$.index[*][?(@.name=='hello')].inner.function.decl.output.impl_trait[1].use[0]" \"\'a\"
// @is "$.index[*][?(@.name=='hello')].inner.function.decl.output.impl_trait[1].use[1]" \"T\"
// @is "$.index[*][?(@.name=='hello')].inner.function.decl.output.impl_trait[1].use[2]" \"N\"
pub fn hello<'a, T, const N: usize>() -> impl Sized + use<'a, T, N> {}
14 changes: 14 additions & 0 deletions tests/rustdoc/impl-trait-precise-capturing.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#![crate_name = "foo"]
#![feature(precise_capturing)]

//@ has foo/fn.two.html '//section[@id="main-content"]//pre' "-> impl Sized + use<'b, 'a>"
pub fn two<'a, 'b, 'c>() -> impl Sized + use<'b, 'a /* no 'c */> {}

//@ has foo/fn.params.html '//section[@id="main-content"]//pre' "-> impl Sized + use<'a, T, N>"
pub fn params<'a, T, const N: usize>() -> impl Sized + use<'a, T, N> {}

//@ has foo/fn.none.html '//section[@id="main-content"]//pre' "-> impl Sized + use<>"
pub fn none() -> impl Sized + use<> {}

//@ has foo/fn.first.html '//section[@id="main-content"]//pre' "-> impl use<> + Sized"
pub fn first() -> impl use<> + Sized {}
Loading