Skip to content

Rollup of 11 pull requests #142099

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

Merged
merged 25 commits into from
Jun 6, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
925e761
Ensure stack in `ThirBuildCx::mirror_exprs`
cuviper Jun 4, 2025
af2a85b
Ensure stack in `Parser::parse_ty`
cuviper Jun 4, 2025
64df9e3
compiler: Document the offset invariant of `OperandValue::Pair`
workingjubilee Jun 4, 2025
51acc57
canon_abi: make to_erased_extern_abi just a detail in formatting
RalfJung Jun 5, 2025
1e49ad3
Clean `rustc_attr_parsing` documentation
xizheyin Jun 5, 2025
79fbc38
doc: Fix inverted meaning in E0783.md
maflcko Jun 5, 2025
fd3da4b
Replace some `Option<Span>` with `Span` and use DUMMY_SP instead of None
oli-obk Jun 4, 2025
fde8a8d
Optimize `Seek::stream_len` impl for `File`
tbu- May 13, 2024
4b1e28b
Clarify description of `Seek::stream_len`
tbu- Jan 9, 2025
7b8f519
add myself to rotation
jdonszelmann Jun 5, 2025
9770f9b
cleaned up some tests
Kivooeo Jun 3, 2025
911d4a0
Rename `should_show_cast` to `should_fully_qualify`
fmease Jun 5, 2025
95bf127
Support middle::ty assoc const eq predicates again
fmease Jun 5, 2025
46ce08e
Fix AIX build
thaliaarchi Jun 5, 2025
c141cbf
Rollup merge of #125087 - tbu-:pr_file_stream_len, r=ChrisDenton
matthiaskrgr Jun 5, 2025
5e140db
Rollup merge of #141982 - Kivooeo:tf5, r=jieyouxu
matthiaskrgr Jun 5, 2025
c1d1f7a
Rollup merge of #142012 - oli-obk:no-optional-spans, r=fee1-dead
matthiaskrgr Jun 5, 2025
29954af
Rollup merge of #142044 - workingjubilee:document-operandvalue-pair, …
matthiaskrgr Jun 5, 2025
324681b
Rollup merge of #142047 - cuviper:s390x-stack, r=oli-obk
matthiaskrgr Jun 5, 2025
7420ae8
Rollup merge of #142058 - xizheyin:rustc-attr-parsing, r=jdonszelmann
matthiaskrgr Jun 5, 2025
2f7de4f
Rollup merge of #142067 - RalfJung:abi-map-to-str, r=workingjubilee
matthiaskrgr Jun 5, 2025
ed7d1f9
Rollup merge of #142072 - maflcko:patch-1, r=aDotInTheVoid
matthiaskrgr Jun 5, 2025
defec9f
Rollup merge of #142084 - jdonszelmann:add-review-rotation, r=BoxyUwU
matthiaskrgr Jun 5, 2025
9c89555
Rollup merge of #142091 - thaliaarchi:aix-getenv, r=workingjubilee
matthiaskrgr Jun 5, 2025
e12572f
Rollup merge of #142092 - fmease:rustdoc-alias-terms, r=GuillaumeGomez
matthiaskrgr Jun 5, 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 should_show_cast to should_fully_qualify
  • Loading branch information
fmease committed Jun 5, 2025
commit 911d4a0c06bad14c8320344175a82451d26cbdaf
23 changes: 12 additions & 11 deletions src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,16 +503,16 @@ fn clean_projection<'tcx>(
} else {
self_type.def_id(&cx.cache)
};
let should_show_cast = compute_should_show_cast(self_def_id, &trait_, &self_type);
let should_fully_qualify = should_fully_qualify_path(self_def_id, &trait_, &self_type);
Type::QPath(Box::new(QPathData {
assoc: projection_to_path_segment(ty, cx),
should_show_cast,
should_fully_qualify,
self_type,
trait_: Some(trait_),
}))
}

fn compute_should_show_cast(self_def_id: Option<DefId>, trait_: &Path, self_type: &Type) -> bool {
fn should_fully_qualify_path(self_def_id: Option<DefId>, trait_: &Path, self_type: &Type) -> bool {
!trait_.segments.is_empty()
&& self_def_id
.zip(Some(trait_.def_id()))
Expand Down Expand Up @@ -1695,10 +1695,11 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type
register_res(cx, trait_.res);
let self_def_id = DefId::local(qself.hir_id.owner.def_id.local_def_index);
let self_type = clean_ty(qself, cx);
let should_show_cast = compute_should_show_cast(Some(self_def_id), &trait_, &self_type);
let should_fully_qualify =
should_fully_qualify_path(Some(self_def_id), &trait_, &self_type);
Type::QPath(Box::new(QPathData {
assoc: clean_path_segment(p.segments.last().expect("segments were empty"), cx),
should_show_cast,
should_fully_qualify,
self_type,
trait_: Some(trait_),
}))
Expand All @@ -1707,16 +1708,16 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type
let ty = lower_ty(cx.tcx, hir_ty);
let self_type = clean_ty(qself, cx);

let (trait_, should_show_cast) = match ty.kind() {
let (trait_, should_fully_qualify) = match ty.kind() {
ty::Alias(ty::Projection, proj) => {
let res = Res::Def(DefKind::Trait, proj.trait_ref(cx.tcx).def_id);
let trait_ = clean_path(&hir::Path { span, res, segments: &[] }, cx);
register_res(cx, trait_.res);
let self_def_id = res.opt_def_id();
let should_show_cast =
compute_should_show_cast(self_def_id, &trait_, &self_type);
let should_fully_qualify =
should_fully_qualify_path(self_def_id, &trait_, &self_type);

(Some(trait_), should_show_cast)
(Some(trait_), should_fully_qualify)
}
ty::Alias(ty::Inherent, _) => (None, false),
// Rustdoc handles `ty::Error`s by turning them into `Type::Infer`s.
Expand All @@ -1726,7 +1727,7 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type

Type::QPath(Box::new(QPathData {
assoc: clean_path_segment(segment, cx),
should_show_cast,
should_fully_qualify,
self_type,
trait_,
}))
Expand Down Expand Up @@ -2207,7 +2208,7 @@ pub(crate) fn clean_middle_ty<'tcx>(
constraints: Default::default(),
},
},
should_show_cast: false,
should_fully_qualify: false,
self_type,
trait_: None,
}))
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/clean/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1746,7 +1746,7 @@ pub(crate) struct QPathData {
pub assoc: PathSegment,
pub self_type: Type,
/// FIXME: compute this field on demand.
pub should_show_cast: bool,
pub should_fully_qualify: bool,
pub trait_: Option<Path>,
}

Expand Down
6 changes: 3 additions & 3 deletions src/librustdoc/html/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1023,22 +1023,22 @@ fn fmt_type(
ref assoc,
ref self_type,
ref trait_,
should_show_cast,
should_fully_qualify,
}) => {
// FIXME(inherent_associated_types): Once we support non-ADT self-types (#106719),
// we need to surround them with angle brackets in some cases (e.g. `<dyn …>::P`).

if f.alternate() {
if let Some(trait_) = trait_
&& should_show_cast
&& should_fully_qualify
{
write!(f, "<{:#} as {:#}>::", self_type.print(cx), trait_.print(cx))?
} else {
write!(f, "{:#}::", self_type.print(cx))?
}
} else {
if let Some(trait_) = trait_
&& should_show_cast
&& should_fully_qualify
{
write!(f, "&lt;{} as {}&gt;::", self_type.print(cx), trait_.print(cx))?
} else {
Expand Down