Skip to content

Rollup of 9 pull requests #141561

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

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5ce4d0d
Refresh of #94678
Mallets Mar 20, 2025
03aef02
Use IPv6 addresses in hop_limit_v6 docs
Mallets Mar 20, 2025
5ace46a
Update tracking issue to 139166
Mallets Mar 31, 2025
25fb525
Update docs according to PR review
Mallets Mar 31, 2025
6657c75
Fix unused_variables
Mallets Apr 16, 2025
9a0c856
Specify that split_ascii_whitespace uses the same definition as is_as…
SimonSapin May 12, 2025
8f0522d
Fix confusing WTF surrogate safety docs
teor2345 May 12, 2025
e139d26
Introduce some typedefs to improve readability.
nnethercote May 1, 2025
5b808b7
Simplify `Accepts`.
nnethercote May 1, 2025
1525f54
Fix up some comments.
nnethercote May 1, 2025
354b1cb
Avoid `rustc_span::` qualifiers.
nnethercote May 19, 2025
ec5e841
ci: move PR job x86_64-gnu-tools to codebuild
marcoieni May 24, 2025
6d47489
improve the `std::fs::create_dir_all` docs related to atomicity
fluiderson May 23, 2025
c299e29
Implement normalize lexically
ChrisDenton Dec 23, 2024
5f857a9
Rename `clean::Enum::variants` method into `non_stripped_variants`
GuillaumeGomez May 9, 2025
560aec1
Unify rendering of type aliases without ADT items
GuillaumeGomez May 9, 2025
4194745
Split `Item::attributes` method into three
GuillaumeGomez May 9, 2025
eb9f054
Rename the `document_*` argument/field into `is_type_alias`
GuillaumeGomez May 9, 2025
4f3dd7b
Tweak attribute rendering depending on wether or not it is a type alias
GuillaumeGomez May 9, 2025
2b292d1
Add regression test for #140739
GuillaumeGomez May 9, 2025
3646a09
Improve code
GuillaumeGomez May 21, 2025
ec97b0f
Update to new API
GuillaumeGomez May 25, 2025
cf9ac0e
const-check: stop recommending the use of rustc_allow_const_fn_unstable
RalfJung May 25, 2025
532ed65
Rollup merge of #134696 - ChrisDenton:normalize-lexically, r=workingj…
jhpratt May 25, 2025
5d2ead3
Rollup merge of #138744 - Mallets:set_ipv6_sock_hop_limit, r=dtolnay
jhpratt May 25, 2025
e2beb96
Rollup merge of #140539 - nnethercote:simplify-attribute_groups, r=jd…
jhpratt May 25, 2025
49add8e
Rollup merge of #140863 - GuillaumeGomez:cleanup-tyalias-render, r=lo…
jhpratt May 25, 2025
905d011
Rollup merge of #140936 - teor2345:wtf-surrogate-docs, r=workingjubilee
jhpratt May 25, 2025
25e04e0
Rollup merge of #140952 - SimonSapin:ascii_whitespace_definition, r=d…
jhpratt May 25, 2025
7dc2213
Rollup merge of #141472 - fluiderson:dev, r=workingjubilee
jhpratt May 25, 2025
5796f12
Rollup merge of #141502 - marcoieni:x86_64-gnu-tools-codebuild, r=Kobzol
jhpratt May 25, 2025
8fcd1a7
Rollup merge of #141559 - RalfJung:less-rustc_allow_const_fn_unstable…
jhpratt May 25, 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
Rename the document_* argument/field into is_type_alias
  • Loading branch information
GuillaumeGomez committed May 25, 2025
commit eb9f05481be266598527ba9b5eb890cc56555733
22 changes: 11 additions & 11 deletions src/librustdoc/html/render/print_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1287,15 +1287,15 @@ fn item_type_alias(cx: &Context<'_>, it: &clean::Item, t: &clean::TypeAlias) ->
is_non_exhaustive: *is_non_exhaustive,
def_id: enum_def_id,
}
.render_into(cx, it, false, w)?;
.render_into(cx, it, true, w)?;
}
clean::TypeAliasInnerType::Union { fields } => {
ItemUnion { cx, it, fields, generics: &t.generics, document_union: false }
ItemUnion { cx, it, fields, generics: &t.generics, is_type_alias: true }
.render_into(w)?;
}
clean::TypeAliasInnerType::Struct { ctor_kind, fields } => {
DisplayStruct { ctor_kind: *ctor_kind, generics: &t.generics, fields }
.render_into(cx, it, false, w)?;
.render_into(cx, it, true, w)?;
}
}
} else {
Expand Down Expand Up @@ -1416,7 +1416,7 @@ item_template!(
it: &'a clean::Item,
fields: &'a [clean::Item],
generics: &'a clean::Generics,
document_union: bool,
is_type_alias: bool,
},
methods = [document, document_type_layout, render_attributes_in_pre, render_assoc_items]
);
Expand Down Expand Up @@ -1453,7 +1453,7 @@ impl<'a, 'cx: 'a> ItemUnion<'a, 'cx> {

fn item_union(cx: &Context<'_>, it: &clean::Item, s: &clean::Union) -> impl fmt::Display {
fmt::from_fn(|w| {
ItemUnion { cx, it, fields: &s.fields, generics: &s.generics, document_union: true }
ItemUnion { cx, it, fields: &s.fields, generics: &s.generics, is_type_alias: false }
.render_into(w)
.unwrap();
Ok(())
Expand Down Expand Up @@ -1494,7 +1494,7 @@ impl<'a> DisplayEnum<'a> {
self,
cx: &Context<'_>,
it: &clean::Item,
document_enum: bool,
is_type_alias: bool,
w: &mut W,
) -> fmt::Result {
let variants_count = self.variants.iter().filter(|i| !i.is_stripped()).count();
Expand All @@ -1521,7 +1521,7 @@ impl<'a> DisplayEnum<'a> {
)
})?;

if document_enum {
if !is_type_alias {
write!(w, "{}", document(cx, it, None, HeadingOffset::H2))?;
}

Expand All @@ -1546,7 +1546,7 @@ fn item_enum(cx: &Context<'_>, it: &clean::Item, e: &clean::Enum) -> impl fmt::D
is_non_exhaustive: it.is_non_exhaustive(),
def_id: it.def_id().unwrap(),
}
.render_into(cx, it, true, w)
.render_into(cx, it, false, w)
})
}

Expand Down Expand Up @@ -1945,7 +1945,7 @@ impl<'a> DisplayStruct<'a> {
self,
cx: &Context<'_>,
it: &clean::Item,
document_struct: bool,
is_type_alias: bool,
w: &mut W,
) -> fmt::Result {
wrap_item(w, |w| {
Expand All @@ -1957,7 +1957,7 @@ impl<'a> DisplayStruct<'a> {
)
})?;

if document_struct {
if !is_type_alias {
write!(w, "{}", document(cx, it, None, HeadingOffset::H2))?;
}

Expand All @@ -1975,7 +1975,7 @@ impl<'a> DisplayStruct<'a> {
fn item_struct(cx: &Context<'_>, it: &clean::Item, s: &clean::Struct) -> impl fmt::Display {
fmt::from_fn(|w| {
DisplayStruct { ctor_kind: s.ctor_kind, generics: &s.generics, fields: s.fields.as_slice() }
.render_into(cx, it, true, w)
.render_into(cx, it, false, w)
})
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/templates/item_union.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{ self.render_attributes_in_pre()|safe }}
{{ self.render_union()|safe }}
</code></pre>
{% if self.document_union %}
{% if !self.is_type_alias %}
{{ self.document()|safe }}
{% endif %}
{% if self.fields_iter().peek().is_some() %}
Expand Down