From 37216f85a1c0f1647e518c638250222d111f78aa Mon Sep 17 00:00:00 2001 From: jyn Date: Wed, 26 Jul 2023 14:43:15 -0700 Subject: [PATCH 01/12] Prevent people from assigning me as a PR reviewer --- triagebot.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/triagebot.toml b/triagebot.toml index cc26c3b3e7b94..bfc14b24d6eba 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -498,6 +498,7 @@ cc = ["@nnethercote"] [assign] warn_non_default_branch = true contributing_url = "https://rustc-dev-guide.rust-lang.org/getting-started.html" +users_on_vacation = ["jyn514"] [assign.adhoc_groups] compiler-team = [ From 4315ba64b5437b380a53d6c36971ec1625d7dd62 Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Thu, 27 Jul 2023 10:29:53 +0200 Subject: [PATCH 02/12] tests/ui/proc-macro/*: Migrate FIXMEs to check-pass proc-macros are processed early in the compiler pipeline. There is no need to involve codegen. So change to check-pass. I have also looked through each changed test and to me it is sufficiently clear that codegen is not needed for the purpose of the test. I skipped changing tests/ui/proc-macro/no-missing-docs.rs in this commit because it was not clear to me that it can be changed to check-pass. --- tests/ui/proc-macro/derive-helper-shadowed.rs | 2 +- tests/ui/proc-macro/derive-in-mod.rs | 2 +- tests/ui/proc-macro/edition-imports-2018.rs | 2 +- tests/ui/proc-macro/extern-prelude-extern-crate-proc-macro.rs | 2 +- tests/ui/proc-macro/helper-attr-blocked-by-import.rs | 2 +- tests/ui/proc-macro/issue-53481.rs | 2 +- tests/ui/proc-macro/macro-use-attr.rs | 2 +- tests/ui/proc-macro/macro-use-bang.rs | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/ui/proc-macro/derive-helper-shadowed.rs b/tests/ui/proc-macro/derive-helper-shadowed.rs index e299454e0fc73..ac14ece691846 100644 --- a/tests/ui/proc-macro/derive-helper-shadowed.rs +++ b/tests/ui/proc-macro/derive-helper-shadowed.rs @@ -1,4 +1,4 @@ -// build-pass (FIXME(62277): could be check-pass?) +// check-pass // aux-build:test-macros.rs // aux-build:derive-helper-shadowed-2.rs diff --git a/tests/ui/proc-macro/derive-in-mod.rs b/tests/ui/proc-macro/derive-in-mod.rs index 8b5d4e9d09ce3..96e9d93fe1285 100644 --- a/tests/ui/proc-macro/derive-in-mod.rs +++ b/tests/ui/proc-macro/derive-in-mod.rs @@ -1,4 +1,4 @@ -// build-pass (FIXME(62277): could be check-pass?) +// check-pass // aux-build:test-macros.rs extern crate test_macros; diff --git a/tests/ui/proc-macro/edition-imports-2018.rs b/tests/ui/proc-macro/edition-imports-2018.rs index 5a77cd4ef4f5a..7656735319872 100644 --- a/tests/ui/proc-macro/edition-imports-2018.rs +++ b/tests/ui/proc-macro/edition-imports-2018.rs @@ -1,4 +1,4 @@ -// build-pass (FIXME(62277): could be check-pass?) +// check-pass // edition:2018 // aux-build:edition-imports-2015.rs diff --git a/tests/ui/proc-macro/extern-prelude-extern-crate-proc-macro.rs b/tests/ui/proc-macro/extern-prelude-extern-crate-proc-macro.rs index a6e64e1b1b1bd..38f61c36c8c6e 100644 --- a/tests/ui/proc-macro/extern-prelude-extern-crate-proc-macro.rs +++ b/tests/ui/proc-macro/extern-prelude-extern-crate-proc-macro.rs @@ -1,4 +1,4 @@ -// build-pass (FIXME(62277): could be check-pass?) +// check-pass // edition:2018 extern crate proc_macro; diff --git a/tests/ui/proc-macro/helper-attr-blocked-by-import.rs b/tests/ui/proc-macro/helper-attr-blocked-by-import.rs index 2e20a3de6bf47..344323122dc26 100644 --- a/tests/ui/proc-macro/helper-attr-blocked-by-import.rs +++ b/tests/ui/proc-macro/helper-attr-blocked-by-import.rs @@ -1,4 +1,4 @@ -// build-pass (FIXME(62277): could be check-pass?) +// check-pass // aux-build:test-macros.rs #[macro_use(Empty)] diff --git a/tests/ui/proc-macro/issue-53481.rs b/tests/ui/proc-macro/issue-53481.rs index ae10a3baa3e3a..922e60a4c4fa1 100644 --- a/tests/ui/proc-macro/issue-53481.rs +++ b/tests/ui/proc-macro/issue-53481.rs @@ -1,4 +1,4 @@ -// build-pass (FIXME(62277): could be check-pass?) +// check-pass // aux-build:test-macros.rs #[macro_use] diff --git a/tests/ui/proc-macro/macro-use-attr.rs b/tests/ui/proc-macro/macro-use-attr.rs index b101c09ed5424..d275fb6a804f7 100644 --- a/tests/ui/proc-macro/macro-use-attr.rs +++ b/tests/ui/proc-macro/macro-use-attr.rs @@ -1,4 +1,4 @@ -// build-pass (FIXME(62277): could be check-pass?) +// check-pass // aux-build:test-macros.rs #[macro_use] diff --git a/tests/ui/proc-macro/macro-use-bang.rs b/tests/ui/proc-macro/macro-use-bang.rs index 4a0bf0b2f63ba..e3174fd446a1c 100644 --- a/tests/ui/proc-macro/macro-use-bang.rs +++ b/tests/ui/proc-macro/macro-use-bang.rs @@ -1,4 +1,4 @@ -// build-pass (FIXME(62277): could be check-pass?) +// check-pass // aux-build:test-macros.rs #[macro_use] From 66aa2efac74d2d888e64d4b36afacdb0c86d8da3 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 27 Jul 2023 14:58:42 +0200 Subject: [PATCH 03/12] Move Res check into `should_ignore_res` --- src/librustdoc/clean/mod.rs | 4 ++-- src/librustdoc/visit_ast.rs | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index d14953f1bb786..7decff5e199d7 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -41,7 +41,7 @@ use thin_vec::ThinVec; use crate::core::{self, DocContext, ImplTraitParam}; use crate::formats::item_type::ItemType; -use crate::visit_ast::Module as DocModule; +use crate::visit_ast::{should_ignore_res, Module as DocModule}; use utils::*; @@ -2679,7 +2679,7 @@ fn clean_use_statement_inner<'tcx>( cx: &mut DocContext<'tcx>, inlined_names: &mut FxHashSet<(ItemType, Symbol)>, ) -> Vec { - if let Res::Def(DefKind::Ctor(..), _) | Res::SelfCtor(..) = path.res { + if should_ignore_res(path.res) { return Vec::new(); } // We need this comparison because some imports (for std types for example) diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index 66737a0152158..cf2c6738ab408 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -100,6 +100,11 @@ pub(crate) fn inherits_doc_hidden( false } +#[inline] +pub(crate) fn should_ignore_res(res: Res) -> bool { + matches!(res, Res::Def(DefKind::Ctor(..), _) | Res::SelfCtor(..)) +} + pub(crate) struct RustdocVisitor<'a, 'tcx> { cx: &'a mut core::DocContext<'tcx>, view_item_stack: LocalDefIdSet, @@ -466,7 +471,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { for &res in &path.res { // Struct and variant constructors and proc macro stubs always show up alongside // their definitions, we've already processed them so just discard these. - if let Res::Def(DefKind::Ctor(..), _) | Res::SelfCtor(..) = res { + if should_ignore_res(res) { continue; } From 4e93b5a0931c8b9c2ff161296096bfbea9fd426d Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 27 Jul 2023 15:22:50 +0200 Subject: [PATCH 04/12] Move `inherits_doc_hidden` and `should_ignore_res` into `clean/utils.rs` --- src/librustdoc/clean/mod.rs | 2 +- src/librustdoc/clean/utils.rs | 34 ++++++++++++++++++- .../passes/check_doc_test_visibility.rs | 2 +- src/librustdoc/passes/strip_hidden.rs | 2 +- src/librustdoc/passes/stripper.rs | 2 +- src/librustdoc/visit_ast.rs | 33 +----------------- 6 files changed, 38 insertions(+), 37 deletions(-) diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 7decff5e199d7..bb7f1cd9ccb92 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -41,7 +41,7 @@ use thin_vec::ThinVec; use crate::core::{self, DocContext, ImplTraitParam}; use crate::formats::item_type::ItemType; -use crate::visit_ast::{should_ignore_res, Module as DocModule}; +use crate::visit_ast::Module as DocModule; use utils::*; diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs index df9da9e7c7fd4..06f1ba29c09d0 100644 --- a/src/librustdoc/clean/utils.rs +++ b/src/librustdoc/clean/utils.rs @@ -13,7 +13,7 @@ use rustc_ast as ast; use rustc_ast::tokenstream::TokenTree; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; -use rustc_hir::def_id::{DefId, LOCAL_CRATE}; +use rustc_hir::def_id::{DefId, LocalDefId, LOCAL_CRATE}; use rustc_middle::mir; use rustc_middle::mir::interpret::ConstValue; use rustc_middle::ty::{self, GenericArgKind, GenericArgsRef, TyCtxt}; @@ -625,3 +625,35 @@ pub(super) fn display_macro_source( } } } + +pub(crate) fn inherits_doc_hidden( + tcx: TyCtxt<'_>, + mut def_id: LocalDefId, + stop_at: Option, +) -> bool { + let hir = tcx.hir(); + while let Some(id) = tcx.opt_local_parent(def_id) { + if let Some(stop_at) = stop_at && id == stop_at { + return false; + } + def_id = id; + if tcx.is_doc_hidden(def_id.to_def_id()) { + return true; + } else if let Some(node) = hir.find_by_def_id(def_id) && + matches!( + node, + hir::Node::Item(hir::Item { kind: hir::ItemKind::Impl(_), .. }), + ) + { + // `impl` blocks stand a bit on their own: unless they have `#[doc(hidden)]` directly + // on them, they don't inherit it from the parent context. + return false; + } + } + false +} + +#[inline] +pub(crate) fn should_ignore_res(res: Res) -> bool { + matches!(res, Res::Def(DefKind::Ctor(..), _) | Res::SelfCtor(..)) +} diff --git a/src/librustdoc/passes/check_doc_test_visibility.rs b/src/librustdoc/passes/check_doc_test_visibility.rs index 011ca9a496142..e333a35e8ad29 100644 --- a/src/librustdoc/passes/check_doc_test_visibility.rs +++ b/src/librustdoc/passes/check_doc_test_visibility.rs @@ -7,11 +7,11 @@ use super::Pass; use crate::clean; +use crate::clean::utils::inherits_doc_hidden; use crate::clean::*; use crate::core::DocContext; use crate::html::markdown::{find_testable_code, ErrorCodes, Ignore, LangString}; use crate::visit::DocVisitor; -use crate::visit_ast::inherits_doc_hidden; use rustc_hir as hir; use rustc_middle::lint::LintLevelSource; use rustc_session::lint; diff --git a/src/librustdoc/passes/strip_hidden.rs b/src/librustdoc/passes/strip_hidden.rs index 7b990cd434882..81a90ed498a3b 100644 --- a/src/librustdoc/passes/strip_hidden.rs +++ b/src/librustdoc/passes/strip_hidden.rs @@ -6,11 +6,11 @@ use rustc_span::symbol::sym; use std::mem; use crate::clean; +use crate::clean::utils::inherits_doc_hidden; use crate::clean::{Item, ItemIdSet}; use crate::core::DocContext; use crate::fold::{strip_item, DocFolder}; use crate::passes::{ImplStripper, Pass}; -use crate::visit_ast::inherits_doc_hidden; pub(crate) const STRIP_HIDDEN: Pass = Pass { name: "strip-hidden", diff --git a/src/librustdoc/passes/stripper.rs b/src/librustdoc/passes/stripper.rs index a6d31534f1d1b..64a4ace5b9f8a 100644 --- a/src/librustdoc/passes/stripper.rs +++ b/src/librustdoc/passes/stripper.rs @@ -3,10 +3,10 @@ use rustc_hir::def_id::DefId; use rustc_middle::ty::{TyCtxt, Visibility}; use std::mem; +use crate::clean::utils::inherits_doc_hidden; use crate::clean::{self, Item, ItemId, ItemIdSet}; use crate::fold::{strip_item, DocFolder}; use crate::formats::cache::Cache; -use crate::visit_ast::inherits_doc_hidden; use crate::visit_lib::RustdocEffectiveVisibilities; pub(crate) struct Stripper<'a, 'tcx> { diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index cf2c6738ab408..269a42573a299 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -16,6 +16,7 @@ use rustc_span::Span; use std::mem; +use crate::clean::utils::{inherits_doc_hidden, should_ignore_res}; use crate::clean::{cfg::Cfg, reexport_chain, AttributesExt, NestedAttributesExt}; use crate::core; @@ -73,38 +74,6 @@ fn def_id_to_path(tcx: TyCtxt<'_>, did: DefId) -> Vec { std::iter::once(crate_name).chain(relative).collect() } -pub(crate) fn inherits_doc_hidden( - tcx: TyCtxt<'_>, - mut def_id: LocalDefId, - stop_at: Option, -) -> bool { - let hir = tcx.hir(); - while let Some(id) = tcx.opt_local_parent(def_id) { - if let Some(stop_at) = stop_at && id == stop_at { - return false; - } - def_id = id; - if tcx.is_doc_hidden(def_id.to_def_id()) { - return true; - } else if let Some(node) = hir.find_by_def_id(def_id) && - matches!( - node, - hir::Node::Item(hir::Item { kind: hir::ItemKind::Impl(_), .. }), - ) - { - // `impl` blocks stand a bit on their own: unless they have `#[doc(hidden)]` directly - // on them, they don't inherit it from the parent context. - return false; - } - } - false -} - -#[inline] -pub(crate) fn should_ignore_res(res: Res) -> bool { - matches!(res, Res::Def(DefKind::Ctor(..), _) | Res::SelfCtor(..)) -} - pub(crate) struct RustdocVisitor<'a, 'tcx> { cx: &'a mut core::DocContext<'tcx>, view_item_stack: LocalDefIdSet, From 37076c9b4ea70878027304af99cdaf9b75b79f57 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sun, 16 Jul 2023 23:26:02 +0000 Subject: [PATCH 05/12] Don't attempt to compute layout of type referencing error --- compiler/rustc_hir_typeck/src/intrinsicck.rs | 11 +++-------- compiler/rustc_middle/messages.ftl | 3 +++ compiler/rustc_middle/src/error.rs | 3 +++ compiler/rustc_middle/src/ty/layout.rs | 9 +++++++-- compiler/rustc_transmute/src/layout/tree.rs | 2 +- compiler/rustc_ty_utils/src/layout.rs | 15 +++++++++++++-- .../ui/layout/malformed-unsized-type-in-union.rs | 8 ++++++++ .../layout/malformed-unsized-type-in-union.stderr | 9 +++++++++ 8 files changed, 47 insertions(+), 13 deletions(-) create mode 100644 tests/ui/layout/malformed-unsized-type-in-union.rs create mode 100644 tests/ui/layout/malformed-unsized-type-in-union.stderr diff --git a/compiler/rustc_hir_typeck/src/intrinsicck.rs b/compiler/rustc_hir_typeck/src/intrinsicck.rs index 2cd18c4c3fcb4..4e65182f15806 100644 --- a/compiler/rustc_hir_typeck/src/intrinsicck.rs +++ b/compiler/rustc_hir_typeck/src/intrinsicck.rs @@ -122,14 +122,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } else { err.note(format!("source type: `{}` ({})", from, skeleton_string(from, sk_from))) .note(format!("target type: `{}` ({})", to, skeleton_string(to, sk_to))); - let mut should_delay_as_bug = false; - if let Err(LayoutError::Unknown(bad_from)) = sk_from && bad_from.references_error() { - should_delay_as_bug = true; - } - if let Err(LayoutError::Unknown(bad_to)) = sk_to && bad_to.references_error() { - should_delay_as_bug = true; - } - if should_delay_as_bug { + if let Err(LayoutError::ReferencesError(_)) = sk_from { + err.delay_as_bug(); + } else if let Err(LayoutError::ReferencesError(_)) = sk_to { err.delay_as_bug(); } } diff --git a/compiler/rustc_middle/messages.ftl b/compiler/rustc_middle/messages.ftl index bb7147ac80fbe..108a10b506beb 100644 --- a/compiler/rustc_middle/messages.ftl +++ b/compiler/rustc_middle/messages.ftl @@ -52,6 +52,9 @@ middle_drop_check_overflow = overflow while adding drop-check rules for {$ty} .note = overflowed on {$overflow_ty} +middle_layout_references_error = + the type has an unknown layout + middle_limit_invalid = `limit` must be a non-negative integer .label = {$error_str} diff --git a/compiler/rustc_middle/src/error.rs b/compiler/rustc_middle/src/error.rs index 57b2de84b47f7..b346cd4539144 100644 --- a/compiler/rustc_middle/src/error.rs +++ b/compiler/rustc_middle/src/error.rs @@ -132,6 +132,9 @@ pub enum LayoutError<'tcx> { #[diag(middle_cycle)] Cycle, + + #[diag(middle_layout_references_error)] + ReferencesError, } #[derive(Diagnostic)] diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs index 81e7dc3728ab0..93dabb973e384 100644 --- a/compiler/rustc_middle/src/ty/layout.rs +++ b/compiler/rustc_middle/src/ty/layout.rs @@ -10,7 +10,7 @@ use rustc_hir::def_id::DefId; use rustc_index::IndexVec; use rustc_session::config::OptLevel; use rustc_span::symbol::{sym, Symbol}; -use rustc_span::{Span, DUMMY_SP}; +use rustc_span::{ErrorGuaranteed, Span, DUMMY_SP}; use rustc_target::abi::call::FnAbi; use rustc_target::abi::*; use rustc_target::spec::{abi::Abi as SpecAbi, HasTargetSpec, PanicStrategy, Target}; @@ -212,6 +212,7 @@ pub enum LayoutError<'tcx> { Unknown(Ty<'tcx>), SizeOverflow(Ty<'tcx>), NormalizationFailure(Ty<'tcx>, NormalizationError<'tcx>), + ReferencesError(ErrorGuaranteed), Cycle, } @@ -224,6 +225,7 @@ impl<'tcx> LayoutError<'tcx> { SizeOverflow(_) => middle_values_too_big, NormalizationFailure(_, _) => middle_cannot_be_normalized, Cycle => middle_cycle, + ReferencesError(_) => middle_layout_references_error, } } @@ -237,6 +239,7 @@ impl<'tcx> LayoutError<'tcx> { E::NormalizationFailure { ty, failure_ty: e.get_type_for_failure() } } Cycle => E::Cycle, + ReferencesError(_) => E::ReferencesError, } } } @@ -257,6 +260,7 @@ impl<'tcx> fmt::Display for LayoutError<'tcx> { e.get_type_for_failure() ), LayoutError::Cycle => write!(f, "a cycle occurred during layout computation"), + LayoutError::ReferencesError(_) => write!(f, "the type has an unknown layout"), } } } @@ -323,7 +327,8 @@ impl<'tcx> SizeSkeleton<'tcx> { Err( e @ LayoutError::Cycle | e @ LayoutError::SizeOverflow(_) - | e @ LayoutError::NormalizationFailure(..), + | e @ LayoutError::NormalizationFailure(..) + | e @ LayoutError::ReferencesError(_), ) => return Err(e), }; diff --git a/compiler/rustc_transmute/src/layout/tree.rs b/compiler/rustc_transmute/src/layout/tree.rs index 8bd268182560a..e8ddb0a43962f 100644 --- a/compiler/rustc_transmute/src/layout/tree.rs +++ b/compiler/rustc_transmute/src/layout/tree.rs @@ -195,7 +195,7 @@ pub(crate) mod rustc { impl<'tcx> From<&LayoutError<'tcx>> for Err { fn from(err: &LayoutError<'tcx>) -> Self { match err { - LayoutError::Unknown(..) => Self::UnknownLayout, + LayoutError::Unknown(..) | LayoutError::ReferencesError(..) => Self::UnknownLayout, err => unimplemented!("{:?}", err), } } diff --git a/compiler/rustc_ty_utils/src/layout.rs b/compiler/rustc_ty_utils/src/layout.rs index b840ff184e0b7..3500c2cc37003 100644 --- a/compiler/rustc_ty_utils/src/layout.rs +++ b/compiler/rustc_ty_utils/src/layout.rs @@ -96,6 +96,13 @@ fn layout_of_uncached<'tcx>( cx: &LayoutCx<'tcx, TyCtxt<'tcx>>, ty: Ty<'tcx>, ) -> Result, &'tcx LayoutError<'tcx>> { + // Types that reference `ty::Error` pessimistically don't have a meaningful layout. + // The only side-effect of this is possibly worse diagnostics in case the layout + // was actually computable (like if the `ty::Error` showed up only in a `PhantomData`). + if let Err(guar) = ty.error_reported() { + return Err(error(cx, LayoutError::ReferencesError(guar))); + } + let tcx = cx.tcx; let param_env = cx.param_env; let dl = cx.data_layout(); @@ -564,11 +571,15 @@ fn layout_of_uncached<'tcx>( return Err(error(cx, LayoutError::Unknown(ty))); } - ty::Bound(..) | ty::GeneratorWitness(..) | ty::GeneratorWitnessMIR(..) | ty::Infer(_) => { + ty::Bound(..) + | ty::GeneratorWitness(..) + | ty::GeneratorWitnessMIR(..) + | ty::Infer(_) + | ty::Error(_) => { bug!("Layout::compute: unexpected type `{}`", ty) } - ty::Placeholder(..) | ty::Param(_) | ty::Error(_) => { + ty::Placeholder(..) | ty::Param(_) => { return Err(error(cx, LayoutError::Unknown(ty))); } }) diff --git a/tests/ui/layout/malformed-unsized-type-in-union.rs b/tests/ui/layout/malformed-unsized-type-in-union.rs new file mode 100644 index 0000000000000..5d8ec576cf01b --- /dev/null +++ b/tests/ui/layout/malformed-unsized-type-in-union.rs @@ -0,0 +1,8 @@ +// issue: 113760 + +union W { s: dyn Iterator } +//~^ ERROR cannot find type `Missing` in this scope + +static ONCE: W = todo!(); + +fn main() {} diff --git a/tests/ui/layout/malformed-unsized-type-in-union.stderr b/tests/ui/layout/malformed-unsized-type-in-union.stderr new file mode 100644 index 0000000000000..cbb8d6af38ad1 --- /dev/null +++ b/tests/ui/layout/malformed-unsized-type-in-union.stderr @@ -0,0 +1,9 @@ +error[E0412]: cannot find type `Missing` in this scope + --> $DIR/malformed-unsized-type-in-union.rs:3:34 + | +LL | union W { s: dyn Iterator } + | ^^^^^^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. From 77fa702b639f941aab7462ca6e3562f793f54fef Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Mon, 17 Jul 2023 01:03:55 +0000 Subject: [PATCH 06/12] Fix aksama template --- src/librustdoc/html/templates/type_layout.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/librustdoc/html/templates/type_layout.html b/src/librustdoc/html/templates/type_layout.html index 20e09a548058d..287cbab07d2b2 100644 --- a/src/librustdoc/html/templates/type_layout.html +++ b/src/librustdoc/html/templates/type_layout.html @@ -44,6 +44,11 @@

{# #} Note: Encountered an error during type layout; {#+ #} the type was too big. {# #}

{# #} + {% when Err(LayoutError::ReferencesError(_)) %} +

{# #} + Note: Encountered an error during type layout; {#+ #} + the type references errors. {# #} +

{# #} {% when Err(LayoutError::NormalizationFailure(_, _)) %}

{# #} Note: Encountered an error during type layout; {#+ #} From d45eb41c500e35bd4ac155b1b49e0920c746abfc Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Thu, 27 Jul 2023 18:51:44 +0000 Subject: [PATCH 07/12] Dont report CTFE errors that are due to references-error layouts --- compiler/rustc_const_eval/src/const_eval/error.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_const_eval/src/const_eval/error.rs b/compiler/rustc_const_eval/src/const_eval/error.rs index ffeff8d079aa2..d39a7e8a19250 100644 --- a/compiler/rustc_const_eval/src/const_eval/error.rs +++ b/compiler/rustc_const_eval/src/const_eval/error.rs @@ -138,7 +138,10 @@ where err_inval!(Layout(LayoutError::Unknown(_))) | err_inval!(TooGeneric) => { ErrorHandled::TooGeneric } - err_inval!(AlreadyReported(error_reported)) => ErrorHandled::Reported(error_reported), + err_inval!(AlreadyReported(guar)) => ErrorHandled::Reported(guar), + err_inval!(Layout(LayoutError::ReferencesError(guar))) => { + ErrorHandled::Reported(guar.into()) + } err_inval!(Layout(layout_error @ LayoutError::SizeOverflow(_))) => { // We must *always* hard error on these, even if the caller wants just a lint. // The `message` makes little sense here, this is a more serious error than the From 9454916c84301a2f0a6de98e6ad5374a366dab75 Mon Sep 17 00:00:00 2001 From: Raoul Strackx Date: Fri, 28 Jul 2023 13:53:28 +0200 Subject: [PATCH 08/12] Fix switch-stdout test for none unix/windows platforms --- library/std/tests/switch-stdout.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/tests/switch-stdout.rs b/library/std/tests/switch-stdout.rs index 28ce6dfccd35a..2605664d28971 100644 --- a/library/std/tests/switch-stdout.rs +++ b/library/std/tests/switch-stdout.rs @@ -1,4 +1,4 @@ -#[cfg(any(target_family = "unix", target_family = "windows"))] +#![cfg(any(target_family = "unix", target_family = "windows"))] use std::fs::File; use std::io::{Read, Write}; From 85779214c845c4e21b97e7d37d50466d49231155 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Fri, 28 Jul 2023 14:24:56 +0200 Subject: [PATCH 09/12] btree/map.rs: remove "Basic usage" text Not useful, for there is just a single example --- library/alloc/src/collections/btree/map.rs | 54 ---------------------- 1 file changed, 54 deletions(-) diff --git a/library/alloc/src/collections/btree/map.rs b/library/alloc/src/collections/btree/map.rs index ff908ec12ec86..29e9423bb436a 100644 --- a/library/alloc/src/collections/btree/map.rs +++ b/library/alloc/src/collections/btree/map.rs @@ -613,8 +613,6 @@ impl BTreeMap { /// /// # Examples /// - /// Basic usage: - /// /// ``` /// use std::collections::BTreeMap; /// @@ -636,8 +634,6 @@ impl BTreeMap { /// /// # Examples /// - /// Basic usage: - /// /// ``` /// use std::collections::BTreeMap; /// @@ -661,8 +657,6 @@ impl BTreeMap { /// /// # Examples /// - /// Basic usage: - /// /// ``` /// # #![feature(allocator_api)] /// # #![feature(btreemap_alloc)] @@ -688,8 +682,6 @@ impl BTreeMap { /// /// # Examples /// - /// Basic usage: - /// /// ``` /// use std::collections::BTreeMap; /// @@ -744,8 +736,6 @@ impl BTreeMap { /// /// # Examples /// - /// Basic usage: - /// /// ``` /// use std::collections::BTreeMap; /// @@ -830,8 +820,6 @@ impl BTreeMap { /// /// # Examples /// - /// Basic usage: - /// /// ``` /// use std::collections::BTreeMap; /// @@ -917,8 +905,6 @@ impl BTreeMap { /// /// # Examples /// - /// Basic usage: - /// /// ``` /// use std::collections::BTreeMap; /// @@ -943,8 +929,6 @@ impl BTreeMap { /// /// # Examples /// - /// Basic usage: - /// /// ``` /// use std::collections::BTreeMap; /// @@ -982,8 +966,6 @@ impl BTreeMap { /// /// # Examples /// - /// Basic usage: - /// /// ``` /// use std::collections::BTreeMap; /// @@ -1017,8 +999,6 @@ impl BTreeMap { /// /// # Examples /// - /// Basic usage: - /// /// ``` /// #![feature(map_try_insert)] /// @@ -1051,8 +1031,6 @@ impl BTreeMap { /// /// # Examples /// - /// Basic usage: - /// /// ``` /// use std::collections::BTreeMap; /// @@ -1078,8 +1056,6 @@ impl BTreeMap { /// /// # Examples /// - /// Basic usage: - /// /// ``` /// use std::collections::BTreeMap; /// @@ -1208,8 +1184,6 @@ impl BTreeMap { /// /// # Examples /// - /// Basic usage: - /// /// ``` /// use std::collections::BTreeMap; /// use std::ops::Bound::Included; @@ -1251,8 +1225,6 @@ impl BTreeMap { /// /// # Examples /// - /// Basic usage: - /// /// ``` /// use std::collections::BTreeMap; /// @@ -1283,8 +1255,6 @@ impl BTreeMap { /// /// # Examples /// - /// Basic usage: - /// /// ``` /// use std::collections::BTreeMap; /// @@ -1336,8 +1306,6 @@ impl BTreeMap { /// /// # Examples /// - /// Basic usage: - /// /// ``` /// use std::collections::BTreeMap; /// @@ -2388,8 +2356,6 @@ impl BTreeMap { /// /// # Examples /// - /// Basic usage: - /// /// ``` /// use std::collections::BTreeMap; /// @@ -2420,8 +2386,6 @@ impl BTreeMap { /// /// # Examples /// - /// Basic usage: - /// /// ``` /// use std::collections::BTreeMap; /// @@ -2453,8 +2417,6 @@ impl BTreeMap { /// /// # Examples /// - /// Basic usage: - /// /// ``` /// use std::collections::BTreeMap; /// @@ -2474,8 +2436,6 @@ impl BTreeMap { /// /// # Examples /// - /// Basic usage: - /// /// ``` /// use std::collections::BTreeMap; /// @@ -2495,8 +2455,6 @@ impl BTreeMap { /// /// # Examples /// - /// Basic usage: - /// /// ``` /// use std::collections::BTreeMap; /// @@ -2521,8 +2479,6 @@ impl BTreeMap { /// /// # Examples /// - /// Basic usage: - /// /// ``` /// use std::collections::BTreeMap; /// @@ -2546,8 +2502,6 @@ impl BTreeMap { /// /// # Examples /// - /// Basic usage: - /// /// ``` /// use std::collections::BTreeMap; /// @@ -2578,8 +2532,6 @@ impl BTreeMap { /// /// # Examples /// - /// Basic usage: - /// /// ``` /// #![feature(btree_cursors)] /// @@ -2619,8 +2571,6 @@ impl BTreeMap { /// /// # Examples /// - /// Basic usage: - /// /// ``` /// #![feature(btree_cursors)] /// @@ -2673,8 +2623,6 @@ impl BTreeMap { /// /// # Examples /// - /// Basic usage: - /// /// ``` /// #![feature(btree_cursors)] /// @@ -2714,8 +2662,6 @@ impl BTreeMap { /// /// # Examples /// - /// Basic usage: - /// /// ``` /// #![feature(btree_cursors)] /// From 0457eda673b5b27f4740ff3b50bf90c8f2870e2d Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Fri, 28 Jul 2023 14:46:17 +0200 Subject: [PATCH 10/12] doc: replace wrong punctuation mark --- library/core/src/borrow.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/borrow.rs b/library/core/src/borrow.rs index efc9ada3891a0..bc026d0a44634 100644 --- a/library/core/src/borrow.rs +++ b/library/core/src/borrow.rs @@ -22,7 +22,7 @@ /// Types express that they can be borrowed as some type `T` by implementing /// `Borrow`, providing a reference to a `T` in the trait’s /// [`borrow`] method. A type is free to borrow as several different types. -/// If it wishes to mutably borrow as the type – allowing the underlying data +/// If it wishes to mutably borrow as the type, allowing the underlying data /// to be modified, it can additionally implement [`BorrowMut`]. /// /// Further, when providing implementations for additional traits, it needs From 8548689af21e916b17fa96b00d742717c3c51a5e Mon Sep 17 00:00:00 2001 From: Raoul Strackx Date: Fri, 28 Jul 2023 14:17:35 +0200 Subject: [PATCH 11/12] Fix issue_15149 test for the SGX target --- library/std/tests/process_spawning.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/std/tests/process_spawning.rs b/library/std/tests/process_spawning.rs index 52e5b55fb9d44..46dc9ff00bd0d 100644 --- a/library/std/tests/process_spawning.rs +++ b/library/std/tests/process_spawning.rs @@ -1,3 +1,5 @@ +#![cfg(not(target_env="sgx"))] + use std::env; use std::fs; use std::process; From 65f311d8ecf1a748de4baa9840ecf79f024547a0 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 27 Jul 2023 15:39:13 +0200 Subject: [PATCH 12/12] Group `write` calls when possible and use new format args --- src/librustdoc/html/render/mod.rs | 160 ++++++++++++++++-------------- 1 file changed, 84 insertions(+), 76 deletions(-) diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 4d029407afa49..4142d8087de57 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -268,7 +268,7 @@ impl AllTypes { fn append(&mut self, item_name: String, item_type: &ItemType) { let mut url: Vec<_> = item_name.split("::").skip(1).collect(); if let Some(name) = url.pop() { - let new_url = format!("{}/{}.{}.html", url.join("/"), item_type, name); + let new_url = format!("{}/{item_type}.{name}.html", url.join("/")); url.push(name); let name = url.join("::"); match *item_type { @@ -385,16 +385,17 @@ impl AllTypes { fn scrape_examples_help(shared: &SharedContext<'_>) -> String { let mut content = SCRAPE_EXAMPLES_HELP_MD.to_owned(); content.push_str(&format!( - "## More information\n\n\ - If you want more information about this feature, please read the [corresponding chapter in the Rustdoc book]({}/rustdoc/scraped-examples.html).", - DOC_RUST_LANG_ORG_CHANNEL)); + "## More information\n\n\ + If you want more information about this feature, please read the [corresponding chapter in \ + the Rustdoc book]({DOC_RUST_LANG_ORG_CHANNEL}/rustdoc/scraped-examples.html)." + )); let mut ids = IdMap::default(); format!( "

\ -

About scraped examples

\ -
\ -
{}
", +

About scraped examples

\ + \ +
{}
", Markdown { content: &content, links: &[], @@ -473,7 +474,7 @@ fn document_short<'a, 'cx: 'a>( MarkdownSummaryLine(&s, &item.links(cx)).into_string_with_has_more_content(); if has_more_content { - let link = format!(r#" Read more"#, assoc_href_attr(item, link, cx)); + let link = format!(" Read more", assoc_href_attr(item, link, cx)); if let Some(idx) = summary_html.rfind("

") { summary_html.insert_str(idx, &link); @@ -482,7 +483,7 @@ fn document_short<'a, 'cx: 'a>( } } - write!(f, "
{}
", summary_html)?; + write!(f, "
{summary_html}
")?; } Ok(()) }) @@ -517,9 +518,9 @@ fn document_full_inner<'a, 'cx: 'a>( write!( f, "
\ - \ + \ Expand description\ - {}
", + {}", render_markdown(cx, &s, item.links(cx), heading_offset) )?; } else { @@ -701,8 +702,8 @@ fn assoc_href_attr(it: &clean::Item, link: AssocItemLink<'_>, cx: &Context<'_>) let item_type = it.type_(); let href = match link { - AssocItemLink::Anchor(Some(ref id)) => Some(format!("#{}", id)), - AssocItemLink::Anchor(None) => Some(format!("#{}.{}", item_type, name)), + AssocItemLink::Anchor(Some(ref id)) => Some(format!("#{id}")), + AssocItemLink::Anchor(None) => Some(format!("#{item_type}.{name}")), AssocItemLink::GotoSource(did, provided_methods) => { // We're creating a link from the implementation of an associated item to its // declaration in the trait declaration. @@ -722,7 +723,7 @@ fn assoc_href_attr(it: &clean::Item, link: AssocItemLink<'_>, cx: &Context<'_>) }; match href(did.expect_def_id(), cx) { - Ok((url, ..)) => Some(format!("{}#{}.{}", url, item_type, name)), + Ok((url, ..)) => Some(format!("{url}#{item_type}.{name}")), // The link is broken since it points to an external crate that wasn't documented. // Do not create any link in such case. This is better than falling back to a // dummy anchor like `#{item_type}.{name}` representing the `id` of *this* impl item @@ -735,14 +736,14 @@ fn assoc_href_attr(it: &clean::Item, link: AssocItemLink<'_>, cx: &Context<'_>) // In this scenario, the actual `id` of this impl item would be // `#{item_type}.{name}-{n}` for some number `n` (a disambiguator). Err(HrefError::DocumentationNotBuilt) => None, - Err(_) => Some(format!("#{}.{}", item_type, name)), + Err(_) => Some(format!("#{item_type}.{name}")), } } }; // If there is no `href` for the reason explained above, simply do not render it which is valid: // https://html.spec.whatwg.org/multipage/links.html#links-created-by-a-and-area-elements - href.map(|href| format!(" href=\"{}\"", href)).unwrap_or_default() + href.map(|href| format!(" href=\"{href}\"")).unwrap_or_default() } fn assoc_const( @@ -765,7 +766,7 @@ fn assoc_const( ty = ty.print(cx), ); if let Some(default) = default { - write!(w, " = "); + w.write_str(" = "); // FIXME: `.value()` uses `clean::utils::format_integer_with_underscore_sep` under the // hood which adds noisy underscores and a type suffix to number literals. @@ -907,39 +908,41 @@ fn render_stability_since_raw_with_extra( if let Some(ver) = stable_version { stability.push_str(ver.as_str()); - title.push_str(&format!("Stable since Rust version {}", ver)); + title.push_str(&format!("Stable since Rust version {ver}")); } let const_title_and_stability = match const_stability { Some(ConstStability { level: StabilityLevel::Stable { since, .. }, .. }) if Some(since) != containing_const_ver => { - Some((format!("const since {}", since), format!("const: {}", since))) + Some((format!("const since {since}"), format!("const: {since}"))) } Some(ConstStability { level: StabilityLevel::Unstable { issue, .. }, feature, .. }) => { let unstable = if let Some(n) = issue { format!( - r#"unstable"#, - n, feature + "unstable" ) } else { String::from("unstable") }; - Some((String::from("const unstable"), format!("const: {}", unstable))) + Some((String::from("const unstable"), format!("const: {unstable}"))) } _ => None, }; if let Some((const_title, const_stability)) = const_title_and_stability { if !title.is_empty() { - title.push_str(&format!(", {}", const_title)); + title.push_str(&format!(", {const_title}")); } else { title.push_str(&const_title); } if !stability.is_empty() { - stability.push_str(&format!(" ({})", const_stability)); + stability.push_str(&format!(" ({const_stability})")); } else { stability.push_str(&const_stability); } @@ -1085,7 +1088,7 @@ pub(crate) fn render_all_impls( let impls = impls.into_inner(); if !impls.is_empty() { write_impl_section_heading(&mut w, "Trait Implementations", "trait-implementations"); - write!(w, "
{}
", impls).unwrap(); + write!(w, "
{impls}
").unwrap(); } if !synthetic.is_empty() { @@ -1183,10 +1186,13 @@ fn render_assoc_items_inner( ); } if !impls_buf.is_empty() { - write!(w, "{}", tmp_buf.into_inner()).unwrap(); - write!(w, "
").unwrap(); - write!(w, "{}", impls_buf.into_inner()).unwrap(); - w.write_str("
").unwrap(); + write!( + w, + "{}
{}
", + tmp_buf.into_inner(), + impls_buf.into_inner() + ) + .unwrap(); } } @@ -1386,7 +1392,7 @@ fn notable_traits_decl(ty: &clean::Type, cx: &Context<'_>) -> (String, String) { } } if out.is_empty() { - write!(&mut out, "",); + out.write_str(""); } (format!("{:#}", ty.print(cx)), out.into_inner()) @@ -1532,25 +1538,25 @@ fn render_impl( let toggled = !doc_buffer.is_empty(); if toggled { let method_toggle_class = if item_type.is_method() { " method-toggle" } else { "" }; - write!(w, "
", method_toggle_class); + write!(w, "
"); } match &*item.kind { clean::MethodItem(..) | clean::TyMethodItem(_) => { // Only render when the method is not static or we allow static methods if render_method_item { - let id = cx.derive_id(format!("{}.{}", item_type, name)); + let id = cx.derive_id(format!("{item_type}.{name}")); let source_id = trait_ .and_then(|trait_| { trait_.items.iter().find(|item| { item.name.map(|n| n.as_str().eq(name.as_str())).unwrap_or(false) }) }) - .map(|item| format!("{}.{}", item.type_(), name)); - write!(w, "
", id, item_type, in_trait_class,); + .map(|item| format!("{}.{name}", item.type_())); + write!(w, "
"); render_rightside(w, cx, item, containing_item, render_mode); if trait_.is_some() { // Anchors are only used on trait impls. - write!(w, "§", id); + write!(w, "§"); } w.write_str("

"); render_assoc_item( @@ -1561,18 +1567,17 @@ fn render_impl( cx, render_mode, ); - w.write_str("

"); - w.write_str("
"); + w.write_str("
"); } } kind @ (clean::TyAssocConstItem(ty) | clean::AssocConstItem(ty, _)) => { - let source_id = format!("{}.{}", item_type, name); + let source_id = format!("{item_type}.{name}"); let id = cx.derive_id(source_id.clone()); - write!(w, "
", id, item_type, in_trait_class); + write!(w, "
"); render_rightside(w, cx, item, containing_item, render_mode); if trait_.is_some() { // Anchors are only used on trait impls. - write!(w, "§", id); + write!(w, "§"); } w.write_str("

"); assoc_const( @@ -1588,16 +1593,15 @@ fn render_impl( "", cx, ); - w.write_str("

"); - w.write_str("
"); + w.write_str("
"); } clean::TyAssocTypeItem(generics, bounds) => { - let source_id = format!("{}.{}", item_type, name); + let source_id = format!("{item_type}.{name}"); let id = cx.derive_id(source_id.clone()); - write!(w, "
", id, item_type, in_trait_class); + write!(w, "
"); if trait_.is_some() { // Anchors are only used on trait impls. - write!(w, "§", id); + write!(w, "§"); } w.write_str("

"); assoc_type( @@ -1610,16 +1614,15 @@ fn render_impl( 0, cx, ); - w.write_str("

"); - w.write_str("
"); + w.write_str("
"); } clean::AssocTypeItem(tydef, _bounds) => { - let source_id = format!("{}.{}", item_type, name); + let source_id = format!("{item_type}.{name}"); let id = cx.derive_id(source_id.clone()); - write!(w, "
", id, item_type, in_trait_class); + write!(w, "
"); if trait_.is_some() { // Anchors are only used on trait impls. - write!(w, "§", id); + write!(w, "§"); } w.write_str("

"); assoc_type( @@ -1632,8 +1635,7 @@ fn render_impl( 0, cx, ); - w.write_str("

"); - w.write_str("
"); + w.write_str("
"); } clean::StrippedItem(..) => return, _ => panic!("can't make docs for trait item with name {:?}", item.name), @@ -1736,10 +1738,10 @@ fn render_impl( close_tags.insert_str(0, "
"); write!( w, - "
", + "
\ + ", if rendering_params.toggle_open_by_default { " open" } else { "" } ); - write!(w, "") } render_impl_summary( w, @@ -1752,15 +1754,15 @@ fn render_impl( aliases, ); if toggled { - write!(w, "") + w.write_str(""); } if let Some(ref dox) = i.impl_item.opt_doc_value() { if trait_.is_none() && i.inner_impl().items.is_empty() { w.write_str( "
\ -
This impl block contains no items.
\ -
", +
This impl block contains no items.
\ + ", ); } write!( @@ -1819,11 +1821,11 @@ fn render_rightside( const_stable_since, if has_src_ref { "" } else { " rightside" }, ); - if let Some(l) = src_href { + if let Some(link) = src_href { if has_stability { - write!(rightside, " · source", l) + write!(rightside, " · source") } else { - write!(rightside, "source", l) + write!(rightside, "source") } } if has_stability && has_src_ref { @@ -1852,10 +1854,13 @@ pub(crate) fn render_impl_summary( } else { format!(" data-aliases=\"{}\"", aliases.join(",")) }; - write!(w, "
", id, aliases); + write!(w, "
"); render_rightside(w, cx, &i.impl_item, containing_item, RenderMode::Normal); - write!(w, "§", id); - write!(w, "

"); + write!( + w, + "§\ +

" + ); if let Some(use_absolute) = use_absolute { write!(w, "{}", inner_impl.print(use_absolute, cx)); @@ -1880,15 +1885,16 @@ pub(crate) fn render_impl_summary( } else { write!(w, "{}", inner_impl.print(false, cx)); } - write!(w, "

"); + w.write_str(""); let is_trait = inner_impl.trait_.is_some(); if is_trait { if let Some(portability) = portability(&i.impl_item, Some(parent)) { write!( w, - "
{}
", - portability + "\ +
{portability}
\ +
", ); } } @@ -1941,7 +1947,7 @@ pub(crate) fn small_url_encode(s: String) -> String { // consistent with itself when encoding them. st += "+"; } else { - write!(st, "%{:02X}", b).unwrap(); + write!(st, "%{b:02X}").unwrap(); } // Invariant: if the current byte is not at the start of a multi-byte character, // we need to get down here so that when the next turn of the loop comes around, @@ -2256,7 +2262,7 @@ fn render_call_locations(mut w: W, cx: &mut Context<'_>, item: &c format!("lines {}-{}", line_lo + 1, line_hi + 1), ) }; - let url = format!("{}{}#{}", cx.root_path(), call_data.url, anchor); + let url = format!("{}{}#{anchor}", cx.root_path(), call_data.url); (url, title) }; @@ -2266,7 +2272,7 @@ fn render_call_locations(mut w: W, cx: &mut Context<'_>, item: &c Ok(contents) => contents, Err(err) => { let span = item.span(tcx).map_or(rustc_span::DUMMY_SP, |span| span.inner()); - tcx.sess.span_err(span, format!("failed to read file {}: {}", path.display(), err)); + tcx.sess.span_err(span, format!("failed to read file {}: {err}", path.display())); return false; } }; @@ -2325,7 +2331,7 @@ fn render_call_locations(mut w: W, cx: &mut Context<'_>, item: &c .unwrap(); if line_ranges.len() > 1 { - write!(w, r#" "#) + w.write_str(r#" "#) .unwrap(); } @@ -2361,7 +2367,7 @@ fn render_call_locations(mut w: W, cx: &mut Context<'_>, item: &c highlight::DecorationInfo(decoration_info), sources::SourceContext::Embedded { offset: line_min, needs_expansion }, ); - write!(w, "").unwrap(); + w.write_str("").unwrap(); true }; @@ -2428,8 +2434,10 @@ fn render_call_locations(mut w: W, cx: &mut Context<'_>, item: &c // For the remaining examples, generate a
    containing links to the source files. if it.peek().is_some() { - write!(w, r#"").unwrap(); } - write!(w, "
").unwrap(); + w.write_str("
").unwrap(); } - write!(w, "").unwrap(); + w.write_str("").unwrap(); }