diff options
| author | Ralf Jung <post@ralfj.de> | 2024-02-14 19:08:48 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-02-14 19:08:48 +0100 |
| commit | 7a086ac8875b45adee3d2cff0f024205eb568d8d (patch) | |
| tree | 138995ac33229aa6af4c1e84d891314800d71afa /src | |
| parent | 6539a64d73849176ff327b28a55d7d6787f293ef (diff) | |
| parent | 533e3f0a840cc7d803c508a9732f411ef8682188 (diff) | |
Merge from rustc
Diffstat (limited to 'src')
26 files changed, 137 insertions, 96 deletions
diff --git a/src/bootstrap/src/core/build_steps/llvm.rs b/src/bootstrap/src/core/build_steps/llvm.rs index afbbbb5bd26..836ac3de94d 100644 --- a/src/bootstrap/src/core/build_steps/llvm.rs +++ b/src/bootstrap/src/core/build_steps/llvm.rs @@ -412,9 +412,7 @@ impl Step for Llvm { } if target.is_msvc() { - cfg.define("LLVM_USE_CRT_DEBUG", "MT"); - cfg.define("LLVM_USE_CRT_RELEASE", "MT"); - cfg.define("LLVM_USE_CRT_RELWITHDEBINFO", "MT"); + cfg.define("CMAKE_MSVC_RUNTIME_LIBRARY", "MultiThreaded"); cfg.static_crt(true); } diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs index 36f9ee6aff6..0e9a9791fb2 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs @@ -86,6 +86,7 @@ const EXTRA_CHECK_CFGS: &[(Option<Mode>, &str, Option<&[&'static str]>)] = &[ (Some(Mode::Std), "no_global_oom_handling", None), (Some(Mode::Std), "no_rc", None), (Some(Mode::Std), "no_sync", None), + (Some(Mode::Std), "netbsd10", None), (Some(Mode::Std), "backtrace_in_libstd", None), /* Extra values not defined in the built-in targets yet, but used in std */ (Some(Mode::Std), "target_env", Some(&["libnx"])), diff --git a/src/ci/docker/host-x86_64/dist-various-1/Dockerfile b/src/ci/docker/host-x86_64/dist-various-1/Dockerfile index ea185cd582c..09fbbac466c 100644 --- a/src/ci/docker/host-x86_64/dist-various-1/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-various-1/Dockerfile @@ -134,6 +134,8 @@ ENV CFLAGS_armv5te_unknown_linux_musleabi="-march=armv5te -marm -mfloat-abi=soft CFLAGS_riscv32imc_unknown_none_elf=-march=rv32imc -mabi=ilp32 \ CC_riscv32imac_unknown_none_elf=riscv32-unknown-elf-gcc \ CFLAGS_riscv32imac_unknown_none_elf=-march=rv32imac -mabi=ilp32 \ + CC_riscv32imafc_unknown_none_elf=riscv32-unknown-elf-gcc \ + CFLAGS_riscv32imafc_unknown_none_elf=-march=rv32imafc -mabi=ilp32 \ CC_riscv64imac_unknown_none_elf=riscv64-unknown-elf-gcc \ CFLAGS_riscv64imac_unknown_none_elf=-march=rv64imac -mabi=lp64 \ CC_riscv64gc_unknown_none_elf=riscv64-unknown-elf-gcc \ diff --git a/src/ci/docker/host-x86_64/test-various/Dockerfile b/src/ci/docker/host-x86_64/test-various/Dockerfile index 4fe66014c17..3fcf12dd9f2 100644 --- a/src/ci/docker/host-x86_64/test-various/Dockerfile +++ b/src/ci/docker/host-x86_64/test-various/Dockerfile @@ -59,6 +59,7 @@ ENV WASM_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $WASM_T tests/codegen \ tests/assembly \ library/core +ENV CC_wasm32_unknown_unknown=clang-11 ENV NVPTX_TARGETS=nvptx64-nvidia-cuda ENV NVPTX_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $NVPTX_TARGETS \ diff --git a/src/ci/docker/host-x86_64/test-various/uefi_qemu_test/Cargo.lock b/src/ci/docker/host-x86_64/test-various/uefi_qemu_test/Cargo.lock index e983edf205c..a579ea965f2 100644 --- a/src/ci/docker/host-x86_64/test-various/uefi_qemu_test/Cargo.lock +++ b/src/ci/docker/host-x86_64/test-various/uefi_qemu_test/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "r-efi" -version = "4.2.0" +version = "4.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "575fc2d9b3da54adbdfaddf6eca48fec256d977c8630a1750b8991347d1ac911" +checksum = "0e244f96e03a3067f9e521d3167bd42657594cb8588c8d3a2db01545dc1af2e0" [[package]] name = "uefi_qemu_test" diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-integration/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-integration/Dockerfile index bec1c897337..c8c754914aa 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-integration/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-integration/Dockerfile @@ -3,6 +3,7 @@ FROM ubuntu:22.04 ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ + clang-15 \ g++ \ make \ ninja-build \ @@ -46,6 +47,9 @@ ENV TARGETS=x86_64-fuchsia ENV TARGETS=$TARGETS,x86_64-unknown-linux-gnu ENV TARGETS=$TARGETS,wasm32-unknown-unknown +# Fuchsia clang does not have wasm target enabled, use system clang. +ENV CC_wasm32_unknown_unknown=clang-15 + COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/doc/rustdoc/src/write-documentation/linking-to-items-by-name.md b/src/doc/rustdoc/src/write-documentation/linking-to-items-by-name.md index 72157b5cd9b..f7a749744e0 100644 --- a/src/doc/rustdoc/src/write-documentation/linking-to-items-by-name.md +++ b/src/doc/rustdoc/src/write-documentation/linking-to-items-by-name.md @@ -151,3 +151,21 @@ will be given, even if the link fails to resolve. For example, any link containi characters will be ignored. [#72243]: https://github.com/rust-lang/rust/issues/72243 + +## What happens in case an intra-doc link cannot be generated + +In some cases (items behind a `cfg` for example), an intra-doc link cannot be generated to item. +There are different ways to create a link in markdown, and depending on the one you use, it will +render differently in this case: + +```md +1. [a] +2. [b][c] +3. [d](e) +4. [f] + +[f]: g +``` + +`1.` and `2.` will will be displayed as is in the rendered documentation (ie, `[a]` and `[b][c]`) +whereas `3.` and `4.` will be replaced by a link targetting `e` for `[d](e)` and `g` for `[f]`. diff --git a/src/doc/rustdoc/src/write-documentation/re-exports.md b/src/doc/rustdoc/src/write-documentation/re-exports.md index 8ce059cc29c..34688545c74 100644 --- a/src/doc/rustdoc/src/write-documentation/re-exports.md +++ b/src/doc/rustdoc/src/write-documentation/re-exports.md @@ -170,3 +170,32 @@ There are a few attributes which are not inlined though: All other attributes are inherited when inlined, so that the documentation matches the behavior if the inlined item was directly defined at the spot where it's shown. + +These rules also apply if the item is inlined with a glob re-export: + +```rust,ignore (inline) +mod private_mod { + /// First + #[cfg(a)] + pub struct InPrivate; +} + +#[cfg(c)] +pub use self::private_mod::*; +``` + +Otherwise, the attributes displayed will be from the re-exported item and the attributes on the +re-export itself will be ignored: + +```rust,ignore (inline) +mod private_mod { + /// First + #[cfg(a)] + pub struct InPrivate; +} + +#[cfg(c)] +pub use self::private_mod::InPrivate; +``` + +In the above case, `cfg(c)` will not be displayed in the docs. diff --git a/src/doc/unstable-book/book.toml b/src/doc/unstable-book/book.toml index 0cd56d09404..cef93760b33 100644 --- a/src/doc/unstable-book/book.toml +++ b/src/doc/unstable-book/book.toml @@ -4,3 +4,4 @@ author = "The Rust Community" [output.html] git-repository-url = "https://github.com/rust-lang/rust/tree/master/src/doc/unstable-book" +edit-url-template = "https://github.com/rust-lang/rust/edit/master/src/doc/unstable-book/{path}" diff --git a/src/doc/unstable-book/src/compiler-flags/check-cfg.md b/src/doc/unstable-book/src/compiler-flags/check-cfg.md index bf83f6ad7c5..13027eeaf4f 100644 --- a/src/doc/unstable-book/src/compiler-flags/check-cfg.md +++ b/src/doc/unstable-book/src/compiler-flags/check-cfg.md @@ -77,10 +77,11 @@ Those well known names and values follows the same stability as what they refer Well known names and values checking is always enabled as long as at least one `--check-cfg` argument is present. -As of `2024-01-09T`, the list of known names is as follows: +As of `2024-02-15T`, the list of known names is as follows: <!--- See CheckCfg::fill_well_known in compiler/rustc_session/src/config.rs --> + - `clippy` - `debug_assertions` - `doc` - `doctest` diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index f4527d1e55e..fa8e667753b 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -254,16 +254,14 @@ fn clean_poly_trait_ref_with_bindings<'tcx>( } fn clean_lifetime<'tcx>(lifetime: &hir::Lifetime, cx: &mut DocContext<'tcx>) -> Lifetime { - let def = cx.tcx.named_bound_var(lifetime.hir_id); if let Some( - rbv::ResolvedArg::EarlyBound(node_id) - | rbv::ResolvedArg::LateBound(_, _, node_id) - | rbv::ResolvedArg::Free(_, node_id), - ) = def + rbv::ResolvedArg::EarlyBound(did) + | rbv::ResolvedArg::LateBound(_, _, did) + | rbv::ResolvedArg::Free(_, did), + ) = cx.tcx.named_bound_var(lifetime.hir_id) + && let Some(lt) = cx.args.get(&did).and_then(|arg| arg.as_lt()) { - if let Some(lt) = cx.args.get(&node_id).and_then(|p| p.as_lt()).cloned() { - return lt; - } + return lt.clone(); } Lifetime(lifetime.ident.name) } @@ -1791,12 +1789,12 @@ fn maybe_expand_private_type_alias<'tcx>( _ => None, }); if let Some(lt) = lifetime { - let cleaned = if !lt.is_anonymous() { + let lt = if !lt.is_anonymous() { clean_lifetime(lt, cx) } else { Lifetime::elided() }; - args.insert(param.def_id.to_def_id(), InstantiationParam::Lifetime(cleaned)); + args.insert(param.def_id.to_def_id(), GenericArg::Lifetime(lt)); } indices.lifetimes += 1; } @@ -1805,44 +1803,20 @@ fn maybe_expand_private_type_alias<'tcx>( let type_ = generic_args.args.iter().find_map(|arg| match arg { hir::GenericArg::Type(ty) => { if indices.types == j { - return Some(ty); + return Some(*ty); } j += 1; None } _ => None, }); - if let Some(ty) = type_ { - args.insert( - param.def_id.to_def_id(), - InstantiationParam::Type(clean_ty(ty, cx)), - ); - } else if let Some(default) = *default { - args.insert( - param.def_id.to_def_id(), - InstantiationParam::Type(clean_ty(default, cx)), - ); + if let Some(ty) = type_.or(*default) { + args.insert(param.def_id.to_def_id(), GenericArg::Type(clean_ty(ty, cx))); } indices.types += 1; } - hir::GenericParamKind::Const { .. } => { - let mut j = 0; - let const_ = generic_args.args.iter().find_map(|arg| match arg { - hir::GenericArg::Const(ct) => { - if indices.consts == j { - return Some(ct); - } - j += 1; - None - } - _ => None, - }); - if let Some(_) = const_ { - args.insert(param.def_id.to_def_id(), InstantiationParam::Constant); - } - // FIXME(const_generics_defaults) - indices.consts += 1; - } + // FIXME(#82852): Instantiate const parameters. + hir::GenericParamKind::Const { .. } => {} } } @@ -2736,7 +2710,7 @@ fn add_without_unwanted_attributes<'hir>( if ident == sym::doc { filter_doc_attr(normal, is_inline); attrs.push((Cow::Owned(attr), import_parent)); - } else if ident != sym::cfg { + } else if is_inline || ident != sym::cfg { // If it's not a `cfg()` attribute, we keep it. attrs.push((Cow::Owned(attr), import_parent)); } diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 96b4d1a45f6..cee1b25591d 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -2228,6 +2228,16 @@ pub(crate) enum GenericArg { Infer, } +impl GenericArg { + pub(crate) fn as_lt(&self) -> Option<&Lifetime> { + if let Self::Lifetime(lt) = self { Some(lt) } else { None } + } + + pub(crate) fn as_ty(&self) -> Option<&Type> { + if let Self::Type(ty) = self { Some(ty) } else { None } + } +} + #[derive(Clone, PartialEq, Eq, Debug, Hash)] pub(crate) enum GenericArgs { AngleBracketed { args: Box<[GenericArg]>, bindings: ThinVec<TypeBinding> }, @@ -2530,35 +2540,6 @@ pub(crate) enum TypeBindingKind { Constraint { bounds: Vec<GenericBound> }, } -/// The type, lifetime, or constant that a private type alias's parameter should be -/// replaced with when expanding a use of that type alias. -/// -/// For example: -/// -/// ``` -/// type PrivAlias<T> = Vec<T>; -/// -/// pub fn public_fn() -> PrivAlias<i32> { vec![] } -/// ``` -/// -/// `public_fn`'s docs will show it as returning `Vec<i32>`, since `PrivAlias` is private. -/// [`InstantiationParam`] is used to record that `T` should be mapped to `i32`. -pub(crate) enum InstantiationParam { - Type(Type), - Lifetime(Lifetime), - Constant, -} - -impl InstantiationParam { - pub(crate) fn as_ty(&self) -> Option<&Type> { - if let Self::Type(ty) = self { Some(ty) } else { None } - } - - pub(crate) fn as_lt(&self) -> Option<&Lifetime> { - if let Self::Lifetime(lt) = self { Some(lt) } else { None } - } -} - // Some nodes are used a lot. Make sure they don't unintentionally get bigger. #[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] mod size_asserts { diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 28ccda39e4d..efad5a8d808 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -44,10 +44,13 @@ pub(crate) struct DocContext<'tcx> { /// Used while populating `external_traits` to ensure we don't process the same trait twice at /// the same time. pub(crate) active_extern_traits: DefIdSet, - // The current set of parameter instantiations, - // for expanding type aliases at the HIR level: - /// Table `DefId` of type, lifetime, or const parameter -> instantiated type, lifetime, or const - pub(crate) args: DefIdMap<clean::InstantiationParam>, + /// The current set of parameter instantiations for expanding type aliases at the HIR level. + /// + /// Maps from the `DefId` of a lifetime or type parameter to the + /// generic argument it's currently instantiated to in this context. + // FIXME(#82852): We don't record const params since we don't visit const exprs at all and + // therefore wouldn't use the corresp. generic arg anyway. Add support for them. + pub(crate) args: DefIdMap<clean::GenericArg>, pub(crate) current_type_aliases: DefIdMap<usize>, /// Table synthetic type parameter for `impl Trait` in argument position -> bounds pub(crate) impl_trait_bounds: FxHashMap<ImplTraitParam, Vec<clean::GenericBound>>, @@ -87,7 +90,7 @@ impl<'tcx> DocContext<'tcx> { /// the generic parameters for a type alias' RHS. pub(crate) fn enter_alias<F, R>( &mut self, - args: DefIdMap<clean::InstantiationParam>, + args: DefIdMap<clean::GenericArg>, def_id: DefId, f: F, ) -> R diff --git a/src/llvm-project b/src/llvm-project -Subproject 700fbf978e6c5bb297d12963206f7487722de48 +Subproject 9ea7f739f257b049a65deeb1f2455bb2ea021cf diff --git a/src/tools/cargo b/src/tools/cargo -Subproject ccc84ccec4b7340eb916aefda1cb3e2fe17d8e7 +Subproject fc1d58fd0531a57a6b942a14cdcdbcb82ece16f diff --git a/src/tools/clippy/clippy_lints/src/copies.rs b/src/tools/clippy/clippy_lints/src/copies.rs index bd07c19a2d8..247048bbc49 100644 --- a/src/tools/clippy/clippy_lints/src/copies.rs +++ b/src/tools/clippy/clippy_lints/src/copies.rs @@ -511,7 +511,8 @@ fn scan_block_for_eq<'tcx>( for stmt in &stmts[stmts.len() - init..=stmts.len() - offset] { if let StmtKind::Local(l) = stmt.kind { l.pat.each_binding_or_first(&mut |_, id, _, _| { - eq.locals.remove(&id); + // FIXME(rust/#120456) - is `swap_remove` correct? + eq.locals.swap_remove(&id); }); } } diff --git a/src/tools/clippy/clippy_lints/src/escape.rs b/src/tools/clippy/clippy_lints/src/escape.rs index 064bac2e7dc..8857cb8e382 100644 --- a/src/tools/clippy/clippy_lints/src/escape.rs +++ b/src/tools/clippy/clippy_lints/src/escape.rs @@ -138,7 +138,8 @@ impl<'a, 'tcx> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> { fn consume(&mut self, cmt: &PlaceWithHirId<'tcx>, _: HirId) { if cmt.place.projections.is_empty() { if let PlaceBase::Local(lid) = cmt.place.base { - self.set.remove(&lid); + // FIXME(rust/#120456) - is `swap_remove` correct? + self.set.swap_remove(&lid); } } } @@ -146,7 +147,8 @@ impl<'a, 'tcx> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> { fn borrow(&mut self, cmt: &PlaceWithHirId<'tcx>, _: HirId, _: ty::BorrowKind) { if cmt.place.projections.is_empty() { if let PlaceBase::Local(lid) = cmt.place.base { - self.set.remove(&lid); + // FIXME(rust/#120456) - is `swap_remove` correct? + self.set.swap_remove(&lid); } } } diff --git a/src/tools/clippy/clippy_lints/src/index_refutable_slice.rs b/src/tools/clippy/clippy_lints/src/index_refutable_slice.rs index 51b4f26b6d1..41e9d5b1c2e 100644 --- a/src/tools/clippy/clippy_lints/src/index_refutable_slice.rs +++ b/src/tools/clippy/clippy_lints/src/index_refutable_slice.rs @@ -106,7 +106,8 @@ fn find_slice_values(cx: &LateContext<'_>, pat: &hir::Pat<'_>) -> FxIndexMap<hir } if sub_pat.is_some() { removed_pat.insert(value_hir_id); - slices.remove(&value_hir_id); + // FIXME(rust/#120456) - is `swap_remove` correct? + slices.swap_remove(&value_hir_id); return; } @@ -259,7 +260,8 @@ impl<'a, 'tcx> Visitor<'tcx> for SliceIndexLintingVisitor<'a, 'tcx> { } // The slice was used for something other than indexing - self.slice_lint_info.remove(&local_id); + // FIXME(rust/#120456) - is `swap_remove` correct? + self.slice_lint_info.swap_remove(&local_id); } intravisit::walk_expr(self, expr); } diff --git a/src/tools/clippy/clippy_lints/src/matches/match_same_arms.rs b/src/tools/clippy/clippy_lints/src/matches/match_same_arms.rs index d645e6c6c05..6595658b769 100644 --- a/src/tools/clippy/clippy_lints/src/matches/match_same_arms.rs +++ b/src/tools/clippy/clippy_lints/src/matches/match_same_arms.rs @@ -415,6 +415,7 @@ fn pat_contains_local(pat: &Pat<'_>, id: HirId) -> bool { /// Returns true if all the bindings in the `Pat` are in `ids` and vice versa fn bindings_eq(pat: &Pat<'_>, mut ids: HirIdSet) -> bool { let mut result = true; - pat.each_binding_or_first(&mut |_, id, _, _| result &= ids.remove(&id)); + // FIXME(rust/#120456) - is `swap_remove` correct? + pat.each_binding_or_first(&mut |_, id, _, _| result &= ids.swap_remove(&id)); result && ids.is_empty() } diff --git a/src/tools/clippy/clippy_lints/src/needless_pass_by_ref_mut.rs b/src/tools/clippy/clippy_lints/src/needless_pass_by_ref_mut.rs index 149d440ecac..710ecd745f8 100644 --- a/src/tools/clippy/clippy_lints/src/needless_pass_by_ref_mut.rs +++ b/src/tools/clippy/clippy_lints/src/needless_pass_by_ref_mut.rs @@ -382,7 +382,8 @@ impl<'tcx> euv::Delegate<'tcx> for MutablyUsedVariablesCtxt<'tcx> { self.add_mutably_used_var(*vid); } self.prev_bind = None; - self.prev_move_to_closure.remove(vid); + // FIXME(rust/#120456) - is `swap_remove` correct? + self.prev_move_to_closure.swap_remove(vid); } } diff --git a/src/tools/clippy/clippy_lints/src/no_effect.rs b/src/tools/clippy/clippy_lints/src/no_effect.rs index 580160efeb7..6a5555ca383 100644 --- a/src/tools/clippy/clippy_lints/src/no_effect.rs +++ b/src/tools/clippy/clippy_lints/src/no_effect.rs @@ -98,7 +98,8 @@ impl<'tcx> LateLintPass<'tcx> for NoEffect { fn check_block_post(&mut self, cx: &LateContext<'tcx>, _: &'tcx rustc_hir::Block<'tcx>) { for hir_id in self.local_bindings.pop().unwrap() { - if let Some(span) = self.underscore_bindings.remove(&hir_id) { + // FIXME(rust/#120456) - is `swap_remove` correct? + if let Some(span) = self.underscore_bindings.swap_remove(&hir_id) { span_lint_hir( cx, NO_EFFECT_UNDERSCORE_BINDING, @@ -112,7 +113,8 @@ impl<'tcx> LateLintPass<'tcx> for NoEffect { fn check_expr(&mut self, _: &LateContext<'tcx>, expr: &'tcx rustc_hir::Expr<'tcx>) { if let Some(def_id) = path_to_local(expr) { - self.underscore_bindings.remove(&def_id); + // FIXME(rust/#120456) - is `swap_remove` correct? + self.underscore_bindings.swap_remove(&def_id); } } } diff --git a/src/tools/clippy/clippy_lints/src/only_used_in_recursion.rs b/src/tools/clippy/clippy_lints/src/only_used_in_recursion.rs index ae14016f482..a568392ecc4 100644 --- a/src/tools/clippy/clippy_lints/src/only_used_in_recursion.rs +++ b/src/tools/clippy/clippy_lints/src/only_used_in_recursion.rs @@ -153,7 +153,8 @@ impl Params { param.uses = Vec::new(); let key = (param.fn_id, param.idx); self.by_fn.remove(&key); - self.by_id.remove(&id); + // FIXME(rust/#120456) - is `swap_remove` correct? + self.by_id.swap_remove(&id); } } diff --git a/src/tools/rustfmt/src/types.rs b/src/tools/rustfmt/src/types.rs index aaef80f4aef..4cd8e6a703e 100644 --- a/src/tools/rustfmt/src/types.rs +++ b/src/tools/rustfmt/src/types.rs @@ -537,18 +537,29 @@ impl Rewrite for ast::Lifetime { impl Rewrite for ast::GenericBound { fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option<String> { match *self { - ast::GenericBound::Trait(ref poly_trait_ref, modifiers) => { + ast::GenericBound::Trait( + ref poly_trait_ref, + ast::TraitBoundModifiers { + constness, + asyncness, + polarity, + }, + ) => { let snippet = context.snippet(self.span()); let has_paren = snippet.starts_with('(') && snippet.ends_with(')'); - let mut constness = modifiers.constness.as_str().to_string(); + let mut constness = constness.as_str().to_string(); if !constness.is_empty() { constness.push(' '); } - let polarity = modifiers.polarity.as_str(); + let mut asyncness = asyncness.as_str().to_string(); + if !asyncness.is_empty() { + asyncness.push(' '); + } + let polarity = polarity.as_str(); let shape = shape.offset_left(constness.len() + polarity.len())?; poly_trait_ref .rewrite(context, shape) - .map(|s| format!("{constness}{polarity}{s}")) + .map(|s| format!("{constness}{asyncness}{polarity}{s}")) .map(|s| if has_paren { format!("({})", s) } else { s }) } ast::GenericBound::Outlives(ref lifetime) => lifetime.rewrite(context, shape), diff --git a/src/tools/rustfmt/tests/target/asyncness.rs b/src/tools/rustfmt/tests/target/asyncness.rs new file mode 100644 index 00000000000..d91ac960499 --- /dev/null +++ b/src/tools/rustfmt/tests/target/asyncness.rs @@ -0,0 +1,3 @@ +// rustfmt-edition: 2018 + +fn foo() -> impl async Fn() {} diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index acb70328ba2..d4642deb2c6 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -13,8 +13,10 @@ const LICENSES: &[&str] = &[ "0BSD OR MIT OR Apache-2.0", // adler license "0BSD", "Apache-2.0 / MIT", + "Apache-2.0 OR ISC OR MIT", "Apache-2.0 OR MIT", "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT", // wasi license + "Apache-2.0", "Apache-2.0/MIT", "BSD-2-Clause OR Apache-2.0 OR MIT", // zerocopy "ISC", @@ -217,6 +219,7 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[ "darling_core", "darling_macro", "datafrog", + "deranged", "derivative", "derive_more", "derive_setters", @@ -258,7 +261,6 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[ "indexmap", "intl-memoizer", "intl_pluralrules", - "is-terminal", "itertools", "itoa", "jemalloc-sys", @@ -278,6 +280,7 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[ "memoffset", "miniz_oxide", "nu-ansi-term", + "num-conv", "num_cpus", "object", "odht", @@ -290,6 +293,7 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[ "pin-project-lite", "polonius-engine", "portable-atomic", // dependency for platforms doesn't support `AtomicU64` in std + "powerfmt", "ppv-lite86", "proc-macro-hack", "proc-macro2", diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index 03f8a701627..1dbd221fde5 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -14,7 +14,7 @@ use std::path::{Path, PathBuf}; // #73494. const ENTRY_LIMIT: usize = 900; // FIXME: The following limits should be reduced eventually. -const ISSUES_ENTRY_LIMIT: usize = 1794; +const ISSUES_ENTRY_LIMIT: usize = 1781; const ROOT_ENTRY_LIMIT: usize = 870; const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[ |
