Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
1cac5fa
Look for `python3` first on MacOS, not `py`
jyn514 Feb 13, 2025
477a2ee
std::fs: slightly reformat `remove_dir_all` error docs
jieyouxu Feb 18, 2025
2bead27
remove : from stack-protector-heuristics-effect.rs filecheck
mustartt Feb 12, 2025
2c752bc
Undeprecate env::home_dir
arlosi Feb 20, 2025
fb8c993
fix label suffix
mustartt Feb 20, 2025
bf26f24
Clarify/update comments in `BufRead::read_line`'s default body
steffahn Feb 20, 2025
f65277c
Simplify parallelization in test-float-parse
tgross35 Dec 31, 2024
762fdf6
default to `-znostart-stop-gc`
lqd Feb 26, 2025
1528cc2
`librustdoc`: 2024 edition! 🎊
yotamofek Feb 27, 2025
7d263b0
Adapt `librustdoc` to 2024 edition lifetieme capture rules
yotamofek Feb 27, 2025
396c2a8
Stop using `hash_raw_entry` in `CodegenCx::const_str`
cuviper Feb 27, 2025
ea13ff7
add exclude to config.toml
Shourya742 Feb 16, 2025
d9ceab9
add test for exclude feature
Shourya742 Feb 16, 2025
9206960
Add change info to change tracker
Shourya742 Feb 16, 2025
bd05d77
Rollup merge of #136938 - mustartt:fix-stack-protector-filecheck, r=M…
matthiaskrgr Mar 2, 2025
fed5666
Rollup merge of #136975 - jyn514:macos-x, r=Mark-Simulacrum
matthiaskrgr Mar 2, 2025
08109d3
Rollup merge of #137147 - Shourya742:2025-02-16-support-exclude-in-co…
matthiaskrgr Mar 2, 2025
335bf51
Rollup merge of #137240 - jieyouxu:remove_dir_all, r=Mark-Simulacrum
matthiaskrgr Mar 2, 2025
28917f4
Rollup merge of #137327 - arlosi:home-dir, r=Mark-Simulacrum
matthiaskrgr Mar 2, 2025
16950f4
Rollup merge of #137375 - steffahn:clarify-read_line-comment, r=Mark-…
matthiaskrgr Mar 2, 2025
20695b5
Rollup merge of #137525 - tgross35:test-float-parse-less-parallelizat…
matthiaskrgr Mar 2, 2025
de4256b
Rollup merge of #137685 - lqd:nostart-stop-gc, r=petrochenkov
matthiaskrgr Mar 2, 2025
84eab4b
Rollup merge of #137722 - yotamofek:pr/rustdoc/edition-2024, r=notriddle
matthiaskrgr Mar 2, 2025
9cade29
Rollup merge of #137741 - cuviper:const_str-raw_entry, r=Mark-Simulacrum
matthiaskrgr Mar 2, 2025
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
Prev Previous commit
Next Next commit
Adapt librustdoc to 2024 edition lifetieme capture rules
Get rid of the `Captures` hack
  • Loading branch information
yotamofek committed Feb 27, 2025
commit 7d263b0d00257a3047ecd1378aba3bc1b2f7954c
8 changes: 0 additions & 8 deletions compiler/rustc_data_structures/src/captures.rs

This file was deleted.

1 change: 0 additions & 1 deletion compiler/rustc_data_structures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ pub use rustc_index::static_assert_size;
pub mod aligned;
pub mod base_n;
pub mod binary_search_util;
pub mod captures;
pub mod fingerprint;
pub mod flat_map_in_place;
pub mod flock;
Expand Down
6 changes: 3 additions & 3 deletions src/librustdoc/clean/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,7 @@ pub(crate) struct Attributes {
}

impl Attributes {
pub(crate) fn lists(&self, name: Symbol) -> impl Iterator<Item = ast::MetaItemInner> + '_ {
pub(crate) fn lists(&self, name: Symbol) -> impl Iterator<Item = ast::MetaItemInner> {
hir_attr_lists(&self.other_attrs[..], name)
}

Expand Down Expand Up @@ -1864,7 +1864,7 @@ impl PrimitiveType {
.copied()
}

pub(crate) fn all_impls(tcx: TyCtxt<'_>) -> impl Iterator<Item = DefId> + '_ {
pub(crate) fn all_impls(tcx: TyCtxt<'_>) -> impl Iterator<Item = DefId> {
Self::simplified_types()
.values()
.flatten()
Expand Down Expand Up @@ -2259,7 +2259,7 @@ impl GenericArgs {
GenericArgs::Parenthesized { inputs, output } => inputs.is_empty() && output.is_none(),
}
}
pub(crate) fn constraints<'a>(&'a self) -> Box<dyn Iterator<Item = AssocItemConstraint> + 'a> {
pub(crate) fn constraints(&self) -> Box<dyn Iterator<Item = AssocItemConstraint> + '_> {
match self {
GenericArgs::AngleBracketed { constraints, .. } => {
Box::new(constraints.iter().cloned())
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/clean/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ pub(crate) fn name_from_pat(p: &hir::Pat<'_>) -> Symbol {
return Symbol::intern("()");
}
PatKind::Slice(begin, mid, end) => {
fn print_pat<'a>(pat: &'a Pat<'a>, wild: bool) -> impl Display + 'a {
fn print_pat(pat: &Pat<'_>, wild: bool) -> impl Display {
fmt::from_fn(move |f| {
if wild {
f.write_str("..")?;
Expand Down
144 changes: 45 additions & 99 deletions src/librustdoc/html/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use std::iter::{self, once};
use itertools::Either;
use rustc_abi::ExternAbi;
use rustc_attr_parsing::{ConstStability, StabilityLevel, StableSince};
use rustc_data_structures::captures::Captures;
use rustc_data_structures::fx::FxHashSet;
use rustc_hir as hir;
use rustc_hir::def::DefKind;
Expand All @@ -41,10 +40,10 @@ pub(crate) fn write_str(s: &mut String, f: fmt::Arguments<'_>) {
s.write_fmt(f).unwrap();
}

pub(crate) fn print_generic_bounds<'a, 'tcx: 'a>(
bounds: &'a [clean::GenericBound],
cx: &'a Context<'tcx>,
) -> impl Display + 'a + Captures<'tcx> {
pub(crate) fn print_generic_bounds(
bounds: &[clean::GenericBound],
cx: &Context<'_>,
) -> impl Display {
fmt::from_fn(move |f| {
let mut bounds_dup = FxHashSet::default();

Expand All @@ -57,10 +56,7 @@ pub(crate) fn print_generic_bounds<'a, 'tcx: 'a>(
}

impl clean::GenericParamDef {
pub(crate) fn print<'a, 'tcx: 'a>(
&'a self,
cx: &'a Context<'tcx>,
) -> impl Display + 'a + Captures<'tcx> {
pub(crate) fn print(&self, cx: &Context<'_>) -> impl Display {
fmt::from_fn(move |f| match &self.kind {
clean::GenericParamDefKind::Lifetime { outlives } => {
write!(f, "{}", self.name)?;
Expand Down Expand Up @@ -107,10 +103,7 @@ impl clean::GenericParamDef {
}

impl clean::Generics {
pub(crate) fn print<'a, 'tcx: 'a>(
&'a self,
cx: &'a Context<'tcx>,
) -> impl Display + 'a + Captures<'tcx> {
pub(crate) fn print(&self, cx: &Context<'_>) -> impl Display {
fmt::from_fn(move |f| {
let mut real_params = self.params.iter().filter(|p| !p.is_synthetic_param()).peekable();
if real_params.peek().is_none() {
Expand All @@ -134,10 +127,7 @@ pub(crate) enum Ending {
NoNewline,
}

fn print_where_predicate<'a, 'tcx: 'a>(
predicate: &'a clean::WherePredicate,
cx: &'a Context<'tcx>,
) -> impl Display + 'a + Captures<'tcx> {
fn print_where_predicate(predicate: &clean::WherePredicate, cx: &Context<'_>) -> impl Display {
fmt::from_fn(move |f| {
match predicate {
clean::WherePredicate::BoundPredicate { ty, bounds, bound_params } => {
Expand Down Expand Up @@ -173,12 +163,12 @@ fn print_where_predicate<'a, 'tcx: 'a>(
/// * The Generics from which to emit a where-clause.
/// * The number of spaces to indent each line with.
/// * Whether the where-clause needs to add a comma and newline after the last bound.
pub(crate) fn print_where_clause<'a, 'tcx: 'a>(
gens: &'a clean::Generics,
cx: &'a Context<'tcx>,
pub(crate) fn print_where_clause(
gens: &clean::Generics,
cx: &Context<'_>,
indent: usize,
ending: Ending,
) -> impl Display + 'a + Captures<'tcx> {
) -> impl Display {
fmt::from_fn(move |f| {
if gens.where_predicates.is_empty() {
return Ok(());
Expand Down Expand Up @@ -250,13 +240,13 @@ pub(crate) fn print_where_clause<'a, 'tcx: 'a>(
}

impl clean::Lifetime {
pub(crate) fn print(&self) -> impl Display + '_ {
pub(crate) fn print(&self) -> impl Display {
self.0.as_str()
}
}

impl clean::ConstantKind {
pub(crate) fn print(&self, tcx: TyCtxt<'_>) -> impl Display + '_ {
pub(crate) fn print(&self, tcx: TyCtxt<'_>) -> impl Display {
let expr = self.expr(tcx);
fmt::from_fn(move |f| {
if f.alternate() { f.write_str(&expr) } else { write!(f, "{}", Escape(&expr)) }
Expand All @@ -265,7 +255,7 @@ impl clean::ConstantKind {
}

impl clean::PolyTrait {
fn print<'a, 'tcx: 'a>(&'a self, cx: &'a Context<'tcx>) -> impl Display + 'a + Captures<'tcx> {
fn print(&self, cx: &Context<'_>) -> impl Display {
fmt::from_fn(move |f| {
print_higher_ranked_params_with_space(&self.generic_params, cx, "for").fmt(f)?;
self.trait_.print(cx).fmt(f)
Expand All @@ -274,10 +264,7 @@ impl clean::PolyTrait {
}

impl clean::GenericBound {
pub(crate) fn print<'a, 'tcx: 'a>(
&'a self,
cx: &'a Context<'tcx>,
) -> impl Display + 'a + Captures<'tcx> {
pub(crate) fn print(&self, cx: &Context<'_>) -> impl Display {
fmt::from_fn(move |f| match self {
clean::GenericBound::Outlives(lt) => write!(f, "{}", lt.print()),
clean::GenericBound::TraitBound(ty, modifiers) => {
Expand All @@ -304,7 +291,7 @@ impl clean::GenericBound {
}

impl clean::GenericArgs {
fn print<'a, 'tcx: 'a>(&'a self, cx: &'a Context<'tcx>) -> impl Display + 'a + Captures<'tcx> {
fn print(&self, cx: &Context<'_>) -> impl Display {
fmt::from_fn(move |f| {
match self {
clean::GenericArgs::AngleBracketed { args, constraints } => {
Expand Down Expand Up @@ -809,11 +796,11 @@ fn primitive_link_fragment(
Ok(())
}

fn tybounds<'a, 'tcx: 'a>(
bounds: &'a [clean::PolyTrait],
lt: &'a Option<clean::Lifetime>,
cx: &'a Context<'tcx>,
) -> impl Display + 'a + Captures<'tcx> {
fn tybounds(
bounds: &[clean::PolyTrait],
lt: &Option<clean::Lifetime>,
cx: &Context<'_>,
) -> impl Display {
fmt::from_fn(move |f| {
bounds.iter().map(|bound| bound.print(cx)).joined(" + ", f)?;
if let Some(lt) = lt {
Expand All @@ -825,11 +812,11 @@ fn tybounds<'a, 'tcx: 'a>(
})
}

fn print_higher_ranked_params_with_space<'a, 'tcx: 'a>(
params: &'a [clean::GenericParamDef],
cx: &'a Context<'tcx>,
fn print_higher_ranked_params_with_space(
params: &[clean::GenericParamDef],
cx: &Context<'_>,
keyword: &'static str,
) -> impl Display + 'a + Captures<'tcx> {
) -> impl Display {
fmt::from_fn(move |f| {
if !params.is_empty() {
f.write_str(keyword)?;
Expand All @@ -841,11 +828,7 @@ fn print_higher_ranked_params_with_space<'a, 'tcx: 'a>(
})
}

pub(crate) fn anchor<'a: 'cx, 'cx>(
did: DefId,
text: Symbol,
cx: &'cx Context<'a>,
) -> impl Display + Captures<'a> + 'cx {
pub(crate) fn anchor(did: DefId, text: Symbol, cx: &Context<'_>) -> impl Display {
fmt::from_fn(move |f| {
let parts = href(did, cx);
if let Ok((url, short_ty, fqp)) = parts {
Expand Down Expand Up @@ -1121,29 +1104,19 @@ fn fmt_type(
}

impl clean::Type {
pub(crate) fn print<'b, 'a: 'b, 'tcx: 'a>(
&'a self,
cx: &'a Context<'tcx>,
) -> impl Display + 'b + Captures<'tcx> {
pub(crate) fn print(&self, cx: &Context<'_>) -> impl Display {
fmt::from_fn(move |f| fmt_type(self, f, false, cx))
}
}

impl clean::Path {
pub(crate) fn print<'b, 'a: 'b, 'tcx: 'a>(
&'a self,
cx: &'a Context<'tcx>,
) -> impl Display + 'b + Captures<'tcx> {
pub(crate) fn print(&self, cx: &Context<'_>) -> impl Display {
fmt::from_fn(move |f| resolved_path(f, self.def_id(), self, false, false, cx))
}
}

impl clean::Impl {
pub(crate) fn print<'a, 'tcx: 'a>(
&'a self,
use_absolute: bool,
cx: &'a Context<'tcx>,
) -> impl Display + 'a + Captures<'tcx> {
pub(crate) fn print(&self, use_absolute: bool, cx: &Context<'_>) -> impl Display {
fmt::from_fn(move |f| {
f.write_str("impl")?;
self.generics.print(cx).fmt(f)?;
Expand Down Expand Up @@ -1182,12 +1155,12 @@ impl clean::Impl {
print_where_clause(&self.generics, cx, 0, Ending::Newline).fmt(f)
})
}
fn print_type<'a, 'tcx: 'a>(
fn print_type(
&self,
type_: &clean::Type,
f: &mut fmt::Formatter<'_>,
use_absolute: bool,
cx: &'a Context<'tcx>,
cx: &Context<'_>,
) -> Result<(), fmt::Error> {
if let clean::Type::Tuple(types) = type_
&& let [clean::Type::Generic(name)] = &types[..]
Expand Down Expand Up @@ -1258,10 +1231,7 @@ impl clean::Impl {
}

impl clean::Arguments {
pub(crate) fn print<'a, 'tcx: 'a>(
&'a self,
cx: &'a Context<'tcx>,
) -> impl Display + 'a + Captures<'tcx> {
pub(crate) fn print(&self, cx: &Context<'_>) -> impl Display {
fmt::from_fn(move |f| {
self.values
.iter()
Expand Down Expand Up @@ -1301,10 +1271,7 @@ impl Display for Indent {
}

impl clean::FnDecl {
pub(crate) fn print<'b, 'a: 'b, 'tcx: 'a>(
&'a self,
cx: &'a Context<'tcx>,
) -> impl Display + 'b + Captures<'tcx> {
pub(crate) fn print(&self, cx: &Context<'_>) -> impl Display {
fmt::from_fn(move |f| {
let ellipsis = if self.c_variadic { ", ..." } else { "" };
if f.alternate() {
Expand Down Expand Up @@ -1333,12 +1300,12 @@ impl clean::FnDecl {
/// are preserved.
/// * `indent`: The number of spaces to indent each successive line with, if line-wrapping is
/// necessary.
pub(crate) fn full_print<'a, 'tcx: 'a>(
&'a self,
pub(crate) fn full_print(
&self,
header_len: usize,
indent: usize,
cx: &'a Context<'tcx>,
) -> impl Display + 'a + Captures<'tcx> {
cx: &Context<'_>,
) -> impl Display {
fmt::from_fn(move |f| {
// First, generate the text form of the declaration, with no line wrapping, and count the bytes.
let mut counter = WriteCounter(0);
Expand Down Expand Up @@ -1420,10 +1387,7 @@ impl clean::FnDecl {
self.print_output(cx).fmt(f)
}

fn print_output<'a, 'tcx: 'a>(
&'a self,
cx: &'a Context<'tcx>,
) -> impl Display + 'a + Captures<'tcx> {
fn print_output(&self, cx: &Context<'_>) -> impl Display {
fmt::from_fn(move |f| match &self.output {
clean::Tuple(tys) if tys.is_empty() => Ok(()),
ty if f.alternate() => {
Expand All @@ -1434,10 +1398,7 @@ impl clean::FnDecl {
}
}

pub(crate) fn visibility_print_with_space<'a, 'tcx: 'a>(
item: &clean::Item,
cx: &'a Context<'tcx>,
) -> impl Display + 'a + Captures<'tcx> {
pub(crate) fn visibility_print_with_space(item: &clean::Item, cx: &Context<'_>) -> impl Display {
use std::fmt::Write as _;
let vis: Cow<'static, str> = match item.visibility(cx.tcx()) {
None => "".into(),
Expand Down Expand Up @@ -1546,10 +1507,7 @@ pub(crate) fn print_constness_with_space(
}

impl clean::Import {
pub(crate) fn print<'a, 'tcx: 'a>(
&'a self,
cx: &'a Context<'tcx>,
) -> impl Display + 'a + Captures<'tcx> {
pub(crate) fn print(&self, cx: &Context<'_>) -> impl Display {
fmt::from_fn(move |f| match self.kind {
clean::ImportKind::Simple(name) => {
if name == self.source.path.last() {
Expand All @@ -1570,10 +1528,7 @@ impl clean::Import {
}

impl clean::ImportSource {
pub(crate) fn print<'a, 'tcx: 'a>(
&'a self,
cx: &'a Context<'tcx>,
) -> impl Display + 'a + Captures<'tcx> {
pub(crate) fn print(&self, cx: &Context<'_>) -> impl Display {
fmt::from_fn(move |f| match self.did {
Some(did) => resolved_path(f, did, &self.path, true, false, cx),
_ => {
Expand All @@ -1593,10 +1548,7 @@ impl clean::ImportSource {
}

impl clean::AssocItemConstraint {
pub(crate) fn print<'a, 'tcx: 'a>(
&'a self,
cx: &'a Context<'tcx>,
) -> impl Display + 'a + Captures<'tcx> {
pub(crate) fn print(&self, cx: &Context<'_>) -> impl Display {
fmt::from_fn(move |f| {
f.write_str(self.assoc.name.as_str())?;
self.assoc.args.print(cx).fmt(f)?;
Expand Down Expand Up @@ -1627,15 +1579,12 @@ pub(crate) fn print_abi_with_space(abi: ExternAbi) -> impl Display {
})
}

pub(crate) fn print_default_space<'a>(v: bool) -> &'a str {
pub(crate) fn print_default_space(v: bool) -> &'static str {
if v { "default " } else { "" }
}

impl clean::GenericArg {
pub(crate) fn print<'a, 'tcx: 'a>(
&'a self,
cx: &'a Context<'tcx>,
) -> impl Display + 'a + Captures<'tcx> {
pub(crate) fn print(&self, cx: &Context<'_>) -> impl Display {
fmt::from_fn(move |f| match self {
clean::GenericArg::Lifetime(lt) => lt.print().fmt(f),
clean::GenericArg::Type(ty) => ty.print(cx).fmt(f),
Expand All @@ -1646,10 +1595,7 @@ impl clean::GenericArg {
}

impl clean::Term {
pub(crate) fn print<'a, 'tcx: 'a>(
&'a self,
cx: &'a Context<'tcx>,
) -> impl Display + 'a + Captures<'tcx> {
pub(crate) fn print(&self, cx: &Context<'_>) -> impl Display {
fmt::from_fn(move |f| match self {
clean::Term::Type(ty) => ty.print(cx).fmt(f),
clean::Term::Constant(ct) => ct.print(cx.tcx()).fmt(f),
Expand Down
Loading