librustdoc: 2024 edition! 🎊
This commit is contained in:
parent
fd17deacce
commit
00523bf7c3
10 changed files with 19 additions and 18 deletions
|
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
name = "rustdoc"
|
||||
version = "0.0.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
build = "build.rs"
|
||||
|
||||
[lib]
|
||||
|
|
|
|||
|
|
@ -48,12 +48,12 @@ impl Cfg {
|
|||
exclude: &FxHashSet<Cfg>,
|
||||
) -> Result<Option<Cfg>, InvalidCfgError> {
|
||||
match nested_cfg {
|
||||
MetaItemInner::MetaItem(ref cfg) => Cfg::parse_without(cfg, exclude),
|
||||
MetaItemInner::MetaItem(cfg) => Cfg::parse_without(cfg, exclude),
|
||||
MetaItemInner::Lit(MetaItemLit { kind: LitKind::Bool(b), .. }) => match *b {
|
||||
true => Ok(Some(Cfg::True)),
|
||||
false => Ok(Some(Cfg::False)),
|
||||
},
|
||||
MetaItemInner::Lit(ref lit) => {
|
||||
MetaItemInner::Lit(lit) => {
|
||||
Err(InvalidCfgError { msg: "unexpected literal", span: lit.span })
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -741,7 +741,7 @@ pub(crate) fn clean_generics<'tcx>(
|
|||
for p in gens.params.iter().filter(|p| !is_impl_trait(p) && !is_elided_lifetime(p)) {
|
||||
let mut p = clean_generic_param(cx, Some(gens), p);
|
||||
match &mut p.kind {
|
||||
GenericParamDefKind::Lifetime { ref mut outlives } => {
|
||||
GenericParamDefKind::Lifetime { outlives } => {
|
||||
if let Some(region_pred) = region_predicates.get_mut(&Lifetime(p.name)) {
|
||||
// We merge bounds in the `where` clause.
|
||||
for outlive in outlives.drain(..) {
|
||||
|
|
@ -2688,7 +2688,7 @@ fn filter_doc_attr_ident(ident: Symbol, is_inline: bool) -> bool {
|
|||
/// Before calling this function, make sure `normal` is a `#[doc]` attribute.
|
||||
fn filter_doc_attr(args: &mut hir::AttrArgs, is_inline: bool) {
|
||||
match args {
|
||||
hir::AttrArgs::Delimited(ref mut args) => {
|
||||
hir::AttrArgs::Delimited(args) => {
|
||||
let tokens = filter_tokens_from_list(&args.tokens, |token| {
|
||||
!matches!(
|
||||
token,
|
||||
|
|
|
|||
|
|
@ -502,7 +502,7 @@ impl Item {
|
|||
let Some(links) = cx.cache().intra_doc_links.get(&self.item_id) else { return vec![] };
|
||||
links
|
||||
.iter()
|
||||
.filter_map(|ItemLink { link: s, link_text, page_id: id, ref fragment }| {
|
||||
.filter_map(|ItemLink { link: s, link_text, page_id: id, fragment }| {
|
||||
debug!(?id);
|
||||
if let Ok((mut href, ..)) = href(*id, cx) {
|
||||
debug!(?href);
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ pub(crate) fn krate(cx: &mut DocContext<'_>) -> Crate {
|
|||
let primitives = local_crate.primitives(cx.tcx);
|
||||
let keywords = local_crate.keywords(cx.tcx);
|
||||
{
|
||||
let ItemKind::ModuleItem(ref mut m) = &mut module.inner.kind else { unreachable!() };
|
||||
let ItemKind::ModuleItem(m) = &mut module.inner.kind else { unreachable!() };
|
||||
m.items.extend(primitives.iter().map(|&(def_id, prim)| {
|
||||
Item::from_def_id_and_parts(
|
||||
def_id,
|
||||
|
|
@ -302,7 +302,7 @@ pub(crate) fn name_from_pat(p: &hir::Pat<'_>) -> Symbol {
|
|||
use rustc_hir::*;
|
||||
debug!("trying to get a name from pattern: {p:?}");
|
||||
|
||||
Symbol::intern(&match p.kind {
|
||||
Symbol::intern(&match &p.kind {
|
||||
// FIXME(never_patterns): does this make sense?
|
||||
PatKind::Wild
|
||||
| PatKind::Err(_)
|
||||
|
|
@ -313,8 +313,9 @@ pub(crate) fn name_from_pat(p: &hir::Pat<'_>) -> Symbol {
|
|||
}
|
||||
PatKind::Binding(_, _, ident, _) => return ident.name,
|
||||
PatKind::Box(p) | PatKind::Ref(p, _) | PatKind::Guard(p, _) => return name_from_pat(p),
|
||||
PatKind::TupleStruct(ref p, ..)
|
||||
| PatKind::Expr(PatExpr { kind: PatExprKind::Path(ref p), .. }) => qpath_to_string(p),
|
||||
PatKind::TupleStruct(p, ..) | PatKind::Expr(PatExpr { kind: PatExprKind::Path(p), .. }) => {
|
||||
qpath_to_string(p)
|
||||
}
|
||||
PatKind::Or(pats) => {
|
||||
fmt::from_fn(|f| pats.iter().map(|p| name_from_pat(p)).joined(" | ", f)).to_string()
|
||||
}
|
||||
|
|
@ -493,7 +494,7 @@ pub(crate) fn resolve_type(cx: &mut DocContext<'_>, path: Path) -> Type {
|
|||
pub(crate) fn synthesize_auto_trait_and_blanket_impls(
|
||||
cx: &mut DocContext<'_>,
|
||||
item_def_id: DefId,
|
||||
) -> impl Iterator<Item = Item> {
|
||||
) -> impl Iterator<Item = Item> + use<> {
|
||||
let auto_impls = cx
|
||||
.sess()
|
||||
.prof
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ impl clean::GenericParamDef {
|
|||
print_generic_bounds(bounds, cx).fmt(f)?;
|
||||
}
|
||||
|
||||
if let Some(ref ty) = default {
|
||||
if let Some(ty) = default {
|
||||
f.write_str(" = ")?;
|
||||
ty.print(cx).fmt(f)?;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -812,7 +812,7 @@ fn assoc_href_attr<'a, 'tcx>(
|
|||
}
|
||||
|
||||
let href = match link {
|
||||
AssocItemLink::Anchor(Some(ref id)) => Href::AnchorId(id),
|
||||
AssocItemLink::Anchor(Some(id)) => Href::AnchorId(id),
|
||||
AssocItemLink::Anchor(None) => Href::Anchor(item_type),
|
||||
AssocItemLink::GotoSource(did, provided_methods) => {
|
||||
// We're creating a link from the implementation of an associated item to its
|
||||
|
|
@ -1144,7 +1144,7 @@ fn render_assoc_item<'a, 'tcx>(
|
|||
cx,
|
||||
)
|
||||
.fmt(f),
|
||||
clean::RequiredAssocTypeItem(ref generics, ref bounds) => assoc_type(
|
||||
clean::RequiredAssocTypeItem(generics, bounds) => assoc_type(
|
||||
item,
|
||||
generics,
|
||||
bounds,
|
||||
|
|
@ -1154,7 +1154,7 @@ fn render_assoc_item<'a, 'tcx>(
|
|||
cx,
|
||||
)
|
||||
.fmt(f),
|
||||
clean::AssocTypeItem(ref ty, ref bounds) => assoc_type(
|
||||
clean::AssocTypeItem(ty, bounds) => assoc_type(
|
||||
item,
|
||||
&ty.generics,
|
||||
bounds,
|
||||
|
|
|
|||
|
|
@ -333,7 +333,7 @@ pub(crate) fn print_src(
|
|||
source_context: &SourceContext<'_>,
|
||||
) {
|
||||
let mut lines = s.lines().count();
|
||||
let line_info = if let SourceContext::Embedded(ref info) = source_context {
|
||||
let line_info = if let SourceContext::Embedded(info) = source_context {
|
||||
highlight::LineInfo::new_scraped(lines as u32, info.offset as u32)
|
||||
} else {
|
||||
highlight::LineInfo::new(lines as u32)
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ pub fn main() {
|
|||
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
extern "C" {
|
||||
unsafe extern "C" {
|
||||
fn _rjem_je_zone_register();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
name = "rustdoc-tool"
|
||||
version = "0.0.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
|
||||
# Cargo adds a number of paths to the dylib search path on windows, which results in
|
||||
# the wrong rustdoc being executed. To avoid the conflicting rustdocs, we name the "tool"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue