Skip to content

Rollup of 11 pull requests #127665

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 29 commits into from
Jul 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
31851d4
Add `-Zdump-mir-exclude-alloc-bytes`
cuviper Jun 14, 2024
1a05cb2
Use `-Zdump-mir-exclude-alloc-bytes` in some mir-opt tests
cuviper Jun 14, 2024
7c3673f
Bless mir-opt for excluded alloc bytes
cuviper Jun 14, 2024
fe5581d
Fix import suggestion ice
chenyukang Jul 4, 2024
87856c4
add lint for inline asm labels that look like binary
asquared31415 Jun 24, 2024
a3ef94e
Fire unsafe_code lint on unsafe extern blocks
spastorino Jul 9, 2024
03bee1e
Suggest using precise capturing for hidden type that captures region
compiler-errors Jul 11, 2024
42653c0
Make it translatable too
compiler-errors Jul 11, 2024
2c8bbee
Remove fully_normalize
compiler-errors Jul 11, 2024
843f5dd
Add rustdoc support for use<> in (local) RPITs
compiler-errors Jul 11, 2024
bd135e4
Add rustdoc-json support for use<>
compiler-errors Jul 11, 2024
cef8a04
rewrite extra-filename-with-temp-outputs to rmake
Oneirical Jul 4, 2024
c6cdbe6
rewrite and rename issue-85019-moved-src-dir to rmake
Oneirical Jul 4, 2024
f768db6
rewrite and rename issue-83045 to rmake
Oneirical Jul 5, 2024
87c7a42
rewrite rustc-macro-dep-files to rmake
Oneirical Jul 5, 2024
fe76650
rewrite env-dep-info to rmake
Oneirical Jul 5, 2024
2772f89
Rename the internal `const_strlen` to just `strlen`
tgross35 Jul 12, 2024
1fd0311
Added the `xop` target feature and `xop_target_feature` gate
sayantn Jul 12, 2024
5d56572
Rollup merge of #126502 - cuviper:dump-mir-exclude-alloc-bytes, r=est…
workingjubilee Jul 12, 2024
fc0136e
Rollup merge of #126922 - asquared31415:asm_binary_label, r=estebank
workingjubilee Jul 12, 2024
a6a7129
Rollup merge of #127209 - sayantn:xop, r=Amanieu
workingjubilee Jul 12, 2024
afb2fbf
Rollup merge of #127310 - chenyukang:yukang-fix-suggest-import-ice, r…
workingjubilee Jul 12, 2024
6cdef05
Rollup merge of #127338 - Oneirical:ready-your-arbatests, r=jieyouxu
workingjubilee Jul 12, 2024
38c314e
Rollup merge of #127381 - Oneirical:testalt-consciousness, r=jieyouxu
workingjubilee Jul 12, 2024
2e0591b
Rollup merge of #127535 - spastorino:unsafe_code-unsafe_extern_blocks…
workingjubilee Jul 12, 2024
20cf4eb
Rollup merge of #127619 - compiler-errors:precise-capturing-better-su…
workingjubilee Jul 12, 2024
4bfc106
Rollup merge of #127631 - compiler-errors:yeet-fully-norm, r=lcnr
workingjubilee Jul 12, 2024
c0d9499
Rollup merge of #127632 - compiler-errors:precise-capturing-rustdoc, …
workingjubilee Jul 12, 2024
8f8734c
Rollup merge of #127660 - tgross35:const_strlen-rename, r=dtolnay
workingjubilee 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
Prev Previous commit
Next Next commit
Add rustdoc support for use<> in (local) RPITs
  • Loading branch information
compiler-errors committed Jul 12, 2024
commit 843f5dd93b3edc65034eb8b9e16673c2bf8e28f2
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
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<")?;
} else {
f.write_str("use&lt;")?;
}
for (i, arg) in args.iter().enumerate() {
if i > 0 {
write!(f, ", ")?;
}
arg.fmt(f)?;
}
if f.alternate() { f.write_str(">") } else { f.write_str("&gt;") }
}
})
}
}
Expand Down
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 {}