about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-07-12 00:25:45 +0000
committerbors <bors@rust-lang.org>2022-07-12 00:25:45 +0000
commitb3f4c3119957aa0a250cab08ab586b7a9a680ef1 (patch)
treee05cfc3eadb48f6b95e1ab524efb4a701b9bd4ae
parent8a3325496f89373cb1631a944539ff38d0966fe8 (diff)
parentc05e27776416f211ccf0f163f5e1deddf8fd87b7 (diff)
downloadrust-b3f4c3119957aa0a250cab08ab586b7a9a680ef1.tar.gz
rust-b3f4c3119957aa0a250cab08ab586b7a9a680ef1.zip
Auto merge of #99165 - matthiaskrgr:rollup-rqpelfa, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #97210 (Support `-A`, `-W`, `-D` and `-F` when running `./x.py clippy`)
 - #99055 (Fix rustdoc help options)
 - #99075 (Fix duplicated type annotation suggestion)
 - #99124 (Fix sized check ICE in asm check)
 - #99142 (fix(doctest): treat fatal parse errors as incomplete attributes)
 - #99145 (Don't rerun the build script for the compiler each time on non-windows platforms)
 - #99146 (Do not error during method probe on `Sized` predicates for types that aren't the method receiver)
 - #99161 (compiletest: trim edition before passing as flag)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
-rw-r--r--compiler/rustc/build.rs3
-rw-r--r--compiler/rustc_errors/src/diagnostic.rs8
-rw-r--r--compiler/rustc_errors/src/diagnostic_builder.rs1
-rw-r--r--compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs3
-rw-r--r--compiler/rustc_typeck/src/check/intrinsicck.rs34
-rw-r--r--compiler/rustc_typeck/src/check/method/confirm.rs26
-rw-r--r--compiler/rustc_typeck/src/check/method/mod.rs5
-rw-r--r--src/bootstrap/check.rs18
-rw-r--r--src/bootstrap/flags.rs17
-rw-r--r--src/librustdoc/config.rs22
-rw-r--r--src/librustdoc/doctest.rs73
-rw-r--r--src/test/rustdoc-ui/c-help.rs4
-rw-r--r--src/test/rustdoc-ui/c-help.stdout51
-rw-r--r--src/test/rustdoc-ui/doctest-multiline-crate-attribute.rs10
-rw-r--r--src/test/rustdoc-ui/doctest-multiline-crate-attribute.stdout6
-rw-r--r--src/test/rustdoc-ui/z-help.rs4
-rw-r--r--src/test/rustdoc-ui/z-help.stdout195
-rw-r--r--src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr2
-rw-r--r--src/test/ui/asm/issue-99122-2.rs21
-rw-r--r--src/test/ui/asm/issue-99122.rs13
-rw-r--r--src/test/ui/asm/issue-99122.stderr11
-rw-r--r--src/test/ui/async-await/async-await.rs2
-rw-r--r--src/test/ui/inference/erase-type-params-in-label.stderr8
-rw-r--r--src/test/ui/inference/issue-71732.stderr4
-rw-r--r--src/test/ui/issues/issue-35976.stderr5
-rw-r--r--src/test/ui/methods/issues/issue-61525.rs20
-rw-r--r--src/test/ui/methods/issues/issue-61525.stderr39
-rw-r--r--src/test/ui/traits/issue-77982.stderr4
-rw-r--r--src/test/ui/traits/multidispatch-convert-ambig-dest.stderr4
-rw-r--r--src/test/ui/type/type-annotation-needed.stderr4
-rw-r--r--src/tools/compiletest/src/header.rs2
31 files changed, 516 insertions, 103 deletions
diff --git a/compiler/rustc/build.rs b/compiler/rustc/build.rs
index 24c06c0ddbf..39cf3e094c8 100644
--- a/compiler/rustc/build.rs
+++ b/compiler/rustc/build.rs
@@ -5,6 +5,9 @@ fn main() {
     let target_env = env::var("CARGO_CFG_TARGET_ENV");
     if Ok("windows") == target_os.as_deref() && Ok("msvc") == target_env.as_deref() {
         set_windows_exe_options();
+    } else {
+        // Avoid rerunning the build script every time.
+        println!("cargo:rerun-if-changed=build.rs");
     }
 }
 
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs
index 9429ad1a897..da321c45875 100644
--- a/compiler/rustc_errors/src/diagnostic.rs
+++ b/compiler/rustc_errors/src/diagnostic.rs
@@ -614,6 +614,14 @@ impl Diagnostic {
         self
     }
 
+    /// Clear any existing suggestions.
+    pub fn clear_suggestions(&mut self) -> &mut Self {
+        if let Ok(suggestions) = &mut self.suggestions {
+            suggestions.clear();
+        }
+        self
+    }
+
     /// Helper for pushing to `self.suggestions`, if available (not disable).
     fn push_suggestion(&mut self, suggestion: CodeSuggestion) {
         if let Ok(suggestions) = &mut self.suggestions {
diff --git a/compiler/rustc_errors/src/diagnostic_builder.rs b/compiler/rustc_errors/src/diagnostic_builder.rs
index c3341fd68f4..99ac6a3546e 100644
--- a/compiler/rustc_errors/src/diagnostic_builder.rs
+++ b/compiler/rustc_errors/src/diagnostic_builder.rs
@@ -461,6 +461,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
     forward!(pub fn set_is_lint(&mut self,) -> &mut Self);
 
     forward!(pub fn disable_suggestions(&mut self,) -> &mut Self);
+    forward!(pub fn clear_suggestions(&mut self,) -> &mut Self);
 
     forward!(pub fn multipart_suggestion(
         &mut self,
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
index 34f4a9f7902..8d7c6b26ba1 100644
--- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
@@ -2094,6 +2094,9 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
                         //    |
                         //    = note: cannot satisfy `_: Tt`
 
+                        // Clear any more general suggestions in favor of our specific one
+                        err.clear_suggestions();
+
                         err.span_suggestion_verbose(
                             span.shrink_to_hi(),
                             &format!(
diff --git a/compiler/rustc_typeck/src/check/intrinsicck.rs b/compiler/rustc_typeck/src/check/intrinsicck.rs
index cc91f2431e0..a5add1e9a8a 100644
--- a/compiler/rustc_typeck/src/check/intrinsicck.rs
+++ b/compiler/rustc_typeck/src/check/intrinsicck.rs
@@ -4,7 +4,7 @@ use rustc_errors::struct_span_err;
 use rustc_hir as hir;
 use rustc_index::vec::Idx;
 use rustc_middle::ty::layout::{LayoutError, SizeSkeleton};
-use rustc_middle::ty::{self, Article, FloatTy, InferTy, IntTy, Ty, TyCtxt, TypeVisitable, UintTy};
+use rustc_middle::ty::{self, Article, FloatTy, IntTy, Ty, TyCtxt, TypeVisitable, UintTy};
 use rustc_session::lint;
 use rustc_span::{Span, Symbol, DUMMY_SP};
 use rustc_target::abi::{Pointer, VariantIdx};
@@ -99,8 +99,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         err.emit();
     }
 
+    // FIXME(compiler-errors): This could use `<$ty as Pointee>::Metadata == ()`
     fn is_thin_ptr_ty(&self, ty: Ty<'tcx>) -> bool {
-        if ty.is_sized(self.tcx.at(DUMMY_SP), self.param_env) {
+        // Type still may have region variables, but `Sized` does not depend
+        // on those, so just erase them before querying.
+        if self.tcx.erase_regions(ty).is_sized(self.tcx.at(DUMMY_SP), self.param_env) {
             return true;
         }
         if let ty::Foreign(..) = ty.kind() {
@@ -128,30 +131,23 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             64 => InlineAsmType::I64,
             _ => unreachable!(),
         };
+
+        // Expect types to be fully resolved, no const or type variables.
+        if ty.has_infer_types_or_consts() {
+            assert!(self.is_tainted_by_errors());
+            return None;
+        }
+
         let asm_ty = match *ty.kind() {
             // `!` is allowed for input but not for output (issue #87802)
             ty::Never if is_input => return None,
             ty::Error(_) => return None,
             ty::Int(IntTy::I8) | ty::Uint(UintTy::U8) => Some(InlineAsmType::I8),
             ty::Int(IntTy::I16) | ty::Uint(UintTy::U16) => Some(InlineAsmType::I16),
-            // Somewhat of a hack: fallback in the presence of errors does not actually
-            // fall back to i32, but to ty::Error. For integer inference variables this
-            // means that they don't get any fallback and stay as `{integer}`.
-            // Since compilation can't succeed anyway, it's fine to use this to avoid printing
-            // "cannot use value of type `{integer}`", even though that would absolutely
-            // work due due i32 fallback if the current function had no other errors.
-            ty::Infer(InferTy::IntVar(_)) => {
-                assert!(self.is_tainted_by_errors());
-                Some(InlineAsmType::I32)
-            }
             ty::Int(IntTy::I32) | ty::Uint(UintTy::U32) => Some(InlineAsmType::I32),
             ty::Int(IntTy::I64) | ty::Uint(UintTy::U64) => Some(InlineAsmType::I64),
             ty::Int(IntTy::I128) | ty::Uint(UintTy::U128) => Some(InlineAsmType::I128),
             ty::Int(IntTy::Isize) | ty::Uint(UintTy::Usize) => Some(asm_ty_isize),
-            ty::Infer(InferTy::FloatVar(_)) => {
-                assert!(self.is_tainted_by_errors());
-                Some(InlineAsmType::F32)
-            }
             ty::Float(FloatTy::F32) => Some(InlineAsmType::F32),
             ty::Float(FloatTy::F64) => Some(InlineAsmType::F64),
             ty::FnPtr(_) => Some(asm_ty_isize),
@@ -191,6 +187,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                     _ => None,
                 }
             }
+            ty::Infer(_) => unreachable!(),
             _ => None,
         };
         let Some(asm_ty) = asm_ty else {
@@ -204,11 +201,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             return None;
         };
 
-        if ty.has_infer_types_or_consts() {
-            assert!(self.is_tainted_by_errors());
-            return None;
-        }
-
         // Check that the type implements Copy. The only case where this can
         // possibly fail is for SIMD types which don't #[derive(Copy)].
         if !self.infcx.type_is_copy_modulo_regions(self.param_env, ty, DUMMY_SP) {
diff --git a/compiler/rustc_typeck/src/check/method/confirm.rs b/compiler/rustc_typeck/src/check/method/confirm.rs
index d8cdc9275f4..b14f3d6de4e 100644
--- a/compiler/rustc_typeck/src/check/method/confirm.rs
+++ b/compiler/rustc_typeck/src/check/method/confirm.rs
@@ -81,11 +81,25 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
         let rcvr_substs = self.fresh_receiver_substs(self_ty, &pick);
         let all_substs = self.instantiate_method_substs(&pick, segment, rcvr_substs);
 
-        debug!("all_substs={:?}", all_substs);
+        debug!("rcvr_substs={rcvr_substs:?}, all_substs={all_substs:?}");
 
         // Create the final signature for the method, replacing late-bound regions.
         let (method_sig, method_predicates) = self.instantiate_method_sig(&pick, all_substs);
 
+        // If there is a `Self: Sized` bound and `Self` is a trait object, it is possible that
+        // something which derefs to `Self` actually implements the trait and the caller
+        // wanted to make a static dispatch on it but forgot to import the trait.
+        // See test `src/test/ui/issue-35976.rs`.
+        //
+        // In that case, we'll error anyway, but we'll also re-run the search with all traits
+        // in scope, and if we find another method which can be used, we'll output an
+        // appropriate hint suggesting to import the trait.
+        let filler_substs = rcvr_substs
+            .extend_to(self.tcx, pick.item.def_id, |def, _| self.tcx.mk_param_from_def(def));
+        let illegal_sized_bound = self.predicates_require_illegal_sized_bound(
+            &self.tcx.predicates_of(pick.item.def_id).instantiate(self.tcx, filler_substs),
+        );
+
         // Unify the (adjusted) self type with what the method expects.
         //
         // SUBTLE: if we want good error messages, because of "guessing" while matching
@@ -106,16 +120,6 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
         // Make sure nobody calls `drop()` explicitly.
         self.enforce_illegal_method_limitations(&pick);
 
-        // If there is a `Self: Sized` bound and `Self` is a trait object, it is possible that
-        // something which derefs to `Self` actually implements the trait and the caller
-        // wanted to make a static dispatch on it but forgot to import the trait.
-        // See test `src/test/ui/issue-35976.rs`.
-        //
-        // In that case, we'll error anyway, but we'll also re-run the search with all traits
-        // in scope, and if we find another method which can be used, we'll output an
-        // appropriate hint suggesting to import the trait.
-        let illegal_sized_bound = self.predicates_require_illegal_sized_bound(&method_predicates);
-
         // Add any trait/regions obligations specified on the method's type parameters.
         // We won't add these if we encountered an illegal sized bound, so that we can use
         // a custom error in that case.
diff --git a/compiler/rustc_typeck/src/check/method/mod.rs b/compiler/rustc_typeck/src/check/method/mod.rs
index e29f0275bf4..c0b3a23fde4 100644
--- a/compiler/rustc_typeck/src/check/method/mod.rs
+++ b/compiler/rustc_typeck/src/check/method/mod.rs
@@ -20,8 +20,8 @@ use rustc_hir::def_id::DefId;
 use rustc_infer::infer::{self, InferOk};
 use rustc_middle::ty::subst::Subst;
 use rustc_middle::ty::subst::{InternalSubsts, SubstsRef};
-use rustc_middle::ty::GenericParamDefKind;
 use rustc_middle::ty::{self, ToPredicate, Ty, TypeVisitable};
+use rustc_middle::ty::{DefIdTree, GenericParamDefKind};
 use rustc_span::symbol::Ident;
 use rustc_span::Span;
 use rustc_trait_selection::traits;
@@ -221,7 +221,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             }
 
             // We probe again, taking all traits into account (not only those in scope).
-            let candidates = match self.lookup_probe(
+            let mut candidates = match self.lookup_probe(
                 span,
                 segment.ident,
                 self_ty,
@@ -243,6 +243,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                     .collect(),
                 _ => Vec::new(),
             };
+            candidates.retain(|candidate| *candidate != self.tcx.parent(result.callee.def_id));
 
             return Err(IllegalSizedBound(candidates, needs_mut, span));
         }
diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs
index 4985b054678..9196b78c513 100644
--- a/src/bootstrap/check.rs
+++ b/src/bootstrap/check.rs
@@ -20,7 +20,15 @@ fn args(builder: &Builder<'_>) -> Vec<String> {
         arr.iter().copied().map(String::from)
     }
 
-    if let Subcommand::Clippy { fix, .. } = builder.config.cmd {
+    if let Subcommand::Clippy {
+        fix,
+        clippy_lint_allow,
+        clippy_lint_deny,
+        clippy_lint_warn,
+        clippy_lint_forbid,
+        ..
+    } = &builder.config.cmd
+    {
         // disable the most spammy clippy lints
         let ignored_lints = vec![
             "many_single_char_names", // there are a lot in stdarch
@@ -32,7 +40,7 @@ fn args(builder: &Builder<'_>) -> Vec<String> {
             "wrong_self_convention",
         ];
         let mut args = vec![];
-        if fix {
+        if *fix {
             #[rustfmt::skip]
             args.extend(strings(&[
                 "--fix", "-Zunstable-options",
@@ -44,6 +52,12 @@ fn args(builder: &Builder<'_>) -> Vec<String> {
         }
         args.extend(strings(&["--", "--cap-lints", "warn"]));
         args.extend(ignored_lints.iter().map(|lint| format!("-Aclippy::{}", lint)));
+        let mut clippy_lint_levels: Vec<String> = Vec::new();
+        clippy_lint_allow.iter().for_each(|v| clippy_lint_levels.push(format!("-A{}", v)));
+        clippy_lint_deny.iter().for_each(|v| clippy_lint_levels.push(format!("-D{}", v)));
+        clippy_lint_warn.iter().for_each(|v| clippy_lint_levels.push(format!("-W{}", v)));
+        clippy_lint_forbid.iter().for_each(|v| clippy_lint_levels.push(format!("-F{}", v)));
+        args.extend(clippy_lint_levels);
         args
     } else {
         vec![]
diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs
index eec19ab4fc9..1822c2936b7 100644
--- a/src/bootstrap/flags.rs
+++ b/src/bootstrap/flags.rs
@@ -91,6 +91,10 @@ pub enum Subcommand {
     Clippy {
         fix: bool,
         paths: Vec<PathBuf>,
+        clippy_lint_allow: Vec<String>,
+        clippy_lint_deny: Vec<String>,
+        clippy_lint_warn: Vec<String>,
+        clippy_lint_forbid: Vec<String>,
     },
     Fix {
         paths: Vec<PathBuf>,
@@ -246,6 +250,10 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`",
         opts.optopt("", "rust-profile-use", "use PGO profile for rustc build", "PROFILE");
         opts.optflag("", "llvm-profile-generate", "generate PGO profile with llvm built for rustc");
         opts.optopt("", "llvm-profile-use", "use PGO profile for llvm build", "PROFILE");
+        opts.optmulti("A", "", "allow certain clippy lints", "OPT");
+        opts.optmulti("D", "", "deny certain clippy lints", "OPT");
+        opts.optmulti("W", "", "warn about certain clippy lints", "OPT");
+        opts.optmulti("F", "", "forbid certain clippy lints", "OPT");
 
         // We can't use getopt to parse the options until we have completed specifying which
         // options are valid, but under the current implementation, some options are conditional on
@@ -544,7 +552,14 @@ Arguments:
                 }
                 Subcommand::Check { paths }
             }
-            Kind::Clippy => Subcommand::Clippy { paths, fix: matches.opt_present("fix") },
+            Kind::Clippy => Subcommand::Clippy {
+                paths,
+                fix: matches.opt_present("fix"),
+                clippy_lint_allow: matches.opt_strs("A"),
+                clippy_lint_warn: matches.opt_strs("W"),
+                clippy_lint_deny: matches.opt_strs("D"),
+                clippy_lint_forbid: matches.opt_strs("F"),
+            },
             Kind::Fix => Subcommand::Fix { paths },
             Kind::Test => Subcommand::Test {
                 paths,
diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs
index 272188f8299..1f30c7006f5 100644
--- a/src/librustdoc/config.rs
+++ b/src/librustdoc/config.rs
@@ -329,6 +329,17 @@ impl Options {
             return Err(0);
         }
 
+        let z_flags = matches.opt_strs("Z");
+        if z_flags.iter().any(|x| *x == "help") {
+            print_flag_list("-Z", config::DB_OPTIONS);
+            return Err(0);
+        }
+        let c_flags = matches.opt_strs("C");
+        if c_flags.iter().any(|x| *x == "help") {
+            print_flag_list("-C", config::CG_OPTIONS);
+            return Err(0);
+        }
+
         let color = config::parse_color(matches);
         let config::JsonConfig { json_rendered, json_unused_externs, .. } =
             config::parse_json(matches);
@@ -343,17 +354,6 @@ impl Options {
         // check for deprecated options
         check_deprecated_options(matches, &diag);
 
-        let z_flags = matches.opt_strs("Z");
-        if z_flags.iter().any(|x| *x == "help") {
-            print_flag_list("-Z", config::DB_OPTIONS);
-            return Err(0);
-        }
-        let c_flags = matches.opt_strs("C");
-        if c_flags.iter().any(|x| *x == "help") {
-            print_flag_list("-C", config::CG_OPTIONS);
-            return Err(0);
-        }
-
         if matches.opt_strs("passes") == ["list"] {
             println!("Available passes for running rustdoc:");
             for pass in passes::PASSES {
diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs
index 509c4253f0f..39ec6a60856 100644
--- a/src/librustdoc/doctest.rs
+++ b/src/librustdoc/doctest.rs
@@ -726,31 +726,58 @@ fn check_if_attr_is_complete(source: &str, edition: Edition) -> bool {
         // Empty content so nothing to check in here...
         return true;
     }
-    rustc_span::create_session_if_not_set_then(edition, |_| {
-        let filename = FileName::anon_source_code(source);
-        let sess = ParseSess::with_silent_emitter(None);
-        let mut parser = match maybe_new_parser_from_source_str(&sess, filename, source.to_owned())
-        {
-            Ok(p) => p,
-            Err(_) => {
-                debug!("Cannot build a parser to check mod attr so skipping...");
-                return true;
+    rustc_driver::catch_fatal_errors(|| {
+        rustc_span::create_session_if_not_set_then(edition, |_| {
+            use rustc_errors::emitter::EmitterWriter;
+            use rustc_errors::Handler;
+            use rustc_span::source_map::FilePathMapping;
+
+            let filename = FileName::anon_source_code(source);
+            // Any errors in parsing should also appear when the doctest is compiled for real, so just
+            // send all the errors that librustc_ast emits directly into a `Sink` instead of stderr.
+            let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+            let fallback_bundle =
+                rustc_errors::fallback_fluent_bundle(rustc_errors::DEFAULT_LOCALE_RESOURCES, false);
+
+            let emitter = EmitterWriter::new(
+                box io::sink(),
+                None,
+                None,
+                fallback_bundle,
+                false,
+                false,
+                false,
+                None,
+                false,
+            );
+
+            let handler = Handler::with_emitter(false, None, box emitter);
+            let sess = ParseSess::with_span_handler(handler, sm);
+            let mut parser =
+                match maybe_new_parser_from_source_str(&sess, filename, source.to_owned()) {
+                    Ok(p) => p,
+                    Err(_) => {
+                        debug!("Cannot build a parser to check mod attr so skipping...");
+                        return true;
+                    }
+                };
+            // If a parsing error happened, it's very likely that the attribute is incomplete.
+            if let Err(e) = parser.parse_attribute(InnerAttrPolicy::Permitted) {
+                e.cancel();
+                return false;
             }
-        };
-        // If a parsing error happened, it's very likely that the attribute is incomplete.
-        if parser.parse_attribute(InnerAttrPolicy::Permitted).is_err() {
-            return false;
-        }
-        // We now check if there is an unclosed delimiter for the attribute. To do so, we look at
-        // the `unclosed_delims` and see if the opening square bracket was closed.
-        parser
-            .unclosed_delims()
-            .get(0)
-            .map(|unclosed| {
-                unclosed.unclosed_span.map(|s| s.lo()).unwrap_or(BytePos(0)) != BytePos(2)
-            })
-            .unwrap_or(true)
+            // We now check if there is an unclosed delimiter for the attribute. To do so, we look at
+            // the `unclosed_delims` and see if the opening square bracket was closed.
+            parser
+                .unclosed_delims()
+                .get(0)
+                .map(|unclosed| {
+                    unclosed.unclosed_span.map(|s| s.lo()).unwrap_or(BytePos(0)) != BytePos(2)
+                })
+                .unwrap_or(true)
+        })
     })
+    .unwrap_or(false)
 }
 
 fn partition_source(s: &str, edition: Edition) -> (String, String, String) {
diff --git a/src/test/rustdoc-ui/c-help.rs b/src/test/rustdoc-ui/c-help.rs
new file mode 100644
index 00000000000..f63e8b08ecd
--- /dev/null
+++ b/src/test/rustdoc-ui/c-help.rs
@@ -0,0 +1,4 @@
+// check-pass
+// compile-flags: -Chelp
+
+pub struct Foo;
diff --git a/src/test/rustdoc-ui/c-help.stdout b/src/test/rustdoc-ui/c-help.stdout
new file mode 100644
index 00000000000..75b2e2a2a43
--- /dev/null
+++ b/src/test/rustdoc-ui/c-help.stdout
@@ -0,0 +1,51 @@
+    -C                       ar=val -- this option is deprecated and does nothing
+    -C               code-model=val -- choose the code model to use (`rustc --print code-models` for details)
+    -C            codegen-units=val -- divide crate into N units to optimize in parallel
+    -C       control-flow-guard=val -- use Windows Control Flow Guard (default: no)
+    -C         debug-assertions=val -- explicitly enable the `cfg(debug_assertions)` directive
+    -C                debuginfo=val -- debug info emission level (0 = no debug info, 1 = line tables only, 2 = full debug info with variable and type information; default: 0)
+    -C default-linker-libraries=val -- allow the linker to link its default libraries (default: no)
+    -C            embed-bitcode=val -- emit bitcode in rlibs (default: yes)
+    -C           extra-filename=val -- extra data to put in each output filename
+    -C     force-frame-pointers=val -- force use of the frame pointers
+    -C      force-unwind-tables=val -- force use of unwind tables
+    -C              incremental=val -- enable incremental compilation
+    -C         inline-threshold=val -- set the threshold for inlining a function
+    -C      instrument-coverage=val -- instrument the generated code to support LLVM source-based code coverage reports (note, the compiler build config must include `profiler = true`); implies `-C symbol-mangling-version=v0`. Optional values are:
+        `=all` (implicit value)
+        `=except-unused-generics`
+        `=except-unused-functions`
+        `=off` (default)
+    -C                 link-arg=val -- a single extra argument to append to the linker invocation (can be used several times)
+    -C                link-args=val -- extra arguments to append to the linker invocation (space separated)
+    -C           link-dead-code=val -- keep dead code at link time (useful for code coverage) (default: no)
+    -C      link-self-contained=val -- control whether to link Rust provided C objects/libraries or rely
+        on C toolchain installed in the system
+    -C                   linker=val -- system linker to link outputs with
+    -C            linker-flavor=val -- linker flavor
+    -C        linker-plugin-lto=val -- generate build artifacts that are compatible with linker-based LTO
+    -C                llvm-args=val -- a list of arguments to pass to LLVM (space separated)
+    -C                      lto=val -- perform LLVM link-time optimizations
+    -C                 metadata=val -- metadata to mangle symbol names with
+    -C    no-prepopulate-passes=val -- give an empty list of passes to the pass manager
+    -C               no-redzone=val -- disable the use of the redzone
+    -C           no-stack-check=val -- this option is deprecated and does nothing
+    -C       no-vectorize-loops=val -- disable loop vectorization optimization passes
+    -C         no-vectorize-slp=val -- disable LLVM's SLP vectorization pass
+    -C                opt-level=val -- optimization level (0-3, s, or z; default: 0)
+    -C          overflow-checks=val -- use overflow checks for integer arithmetic
+    -C                    panic=val -- panic strategy to compile crate with
+    -C                   passes=val -- a list of extra LLVM passes to run (space separated)
+    -C           prefer-dynamic=val -- prefer dynamic linking to static linking (default: no)
+    -C         profile-generate=val -- compile the program with profiling instrumentation
+    -C              profile-use=val -- use the given `.profdata` file for profile-guided optimization
+    -C         relocation-model=val -- control generation of position-independent code (PIC) (`rustc --print relocation-models` for details)
+    -C                   remark=val -- print remarks for these optimization passes (space separated, or "all")
+    -C                    rpath=val -- set rpath values in libs/exes (default: no)
+    -C               save-temps=val -- save all temporary output files during compilation (default: no)
+    -C               soft-float=val -- use soft float ABI (*eabihf targets only) (default: no)
+    -C          split-debuginfo=val -- how to handle split-debuginfo, a platform-specific option
+    -C                    strip=val -- tell the linker which information to strip (`none` (default), `debuginfo` or `symbols`)
+    -C  symbol-mangling-version=val -- which mangling version to use for symbol names ('legacy' (default) or 'v0')
+    -C               target-cpu=val -- select target processor (`rustc --print target-cpus` for details)
+    -C           target-feature=val -- target specific attributes. (`rustc --print target-features` for details). This feature is unsafe.
diff --git a/src/test/rustdoc-ui/doctest-multiline-crate-attribute.rs b/src/test/rustdoc-ui/doctest-multiline-crate-attribute.rs
new file mode 100644
index 00000000000..a30472ac56b
--- /dev/null
+++ b/src/test/rustdoc-ui/doctest-multiline-crate-attribute.rs
@@ -0,0 +1,10 @@
+// compile-flags:--test --test-args=--test-threads=1
+// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
+// check-pass
+
+/// ```
+/// #![deprecated(since = "5.2", note = "foo was rarely used. \
+///    Users should instead use bar")]
+/// ```
+pub fn f() {}
diff --git a/src/test/rustdoc-ui/doctest-multiline-crate-attribute.stdout b/src/test/rustdoc-ui/doctest-multiline-crate-attribute.stdout
new file mode 100644
index 00000000000..07a4f657dea
--- /dev/null
+++ b/src/test/rustdoc-ui/doctest-multiline-crate-attribute.stdout
@@ -0,0 +1,6 @@
+
+running 1 test
+test $DIR/doctest-multiline-crate-attribute.rs - f (line 6) ... ok
+
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
+
diff --git a/src/test/rustdoc-ui/z-help.rs b/src/test/rustdoc-ui/z-help.rs
new file mode 100644
index 00000000000..036c68c272b
--- /dev/null
+++ b/src/test/rustdoc-ui/z-help.rs
@@ -0,0 +1,4 @@
+// check-pass
+// compile-flags: -Zhelp
+
+pub struct Foo;
diff --git a/src/test/rustdoc-ui/z-help.stdout b/src/test/rustdoc-ui/z-help.stdout
new file mode 100644
index 00000000000..7296b35788a
--- /dev/null
+++ b/src/test/rustdoc-ui/z-help.stdout
@@ -0,0 +1,195 @@
+    -Z                          allow-features=val -- only allow the listed language features to be enabled in code (space separated)
+    -Z                       always-encode-mir=val -- encode MIR of all functions into the crate metadata (default: no)
+    -Z               assume-incomplete-release=val -- make cfg(version) treat the current version as incomplete (default: no)
+    -Z                            asm-comments=val -- generate comments into the assembly (may change behavior) (default: no)
+    -Z                       assert-incr-state=val -- assert that the incremental cache is in given state: either `loaded` or `not-loaded`.
+    -Z                      binary-dep-depinfo=val -- include artifacts (sysroot, crate dependencies) used during compilation in dep-info (default: no)
+    -Z                       branch-protection=val -- set options for branch target identification and pointer authentication on AArch64
+    -Z                           cf-protection=val -- instrument control-flow architecture protection
+    -Z               cgu-partitioning-strategy=val -- the codegen unit partitioning strategy to use
+    -Z                                   chalk=val -- enable the experimental Chalk-based trait solving engine
+    -Z                         codegen-backend=val -- the backend to use
+    -Z                             combine-cgu=val -- combine CGUs into a single one
+    -Z                              crate-attr=val -- inject the given attribute in the crate
+    -Z                debug-info-for-profiling=val -- emit discriminators and other data necessary for AutoFDO
+    -Z                            debug-macros=val -- emit line numbers debug info inside macros (default: no)
+    -Z                 deduplicate-diagnostics=val -- deduplicate identical diagnostics (default: yes)
+    -Z                  dep-info-omit-d-target=val -- in dep-info output, omit targets for tracking dependencies of the dep-info files themselves (default: no)
+    -Z                               dep-tasks=val -- print tasks that execute and the color their dep node gets (requires debug build) (default: no)
+    -Z                                 dlltool=val -- import library generation tool (windows-gnu only)
+    -Z                 dont-buffer-diagnostics=val -- emit diagnostics rather than buffering (breaks NLL error downgrading, sorting) (default: no)
+    -Z                           drop-tracking=val -- enables drop tracking in generators (default: no)
+    -Z                        dual-proc-macros=val -- load proc macros for both target and host, but only link to the target (default: no)
+    -Z                          dump-dep-graph=val -- dump the dependency graph to $RUST_DEP_GRAPH (default: /tmp/dep_graph.gv) (default: no)
+    -Z                  dump-drop-tracking-cfg=val -- dump drop-tracking control-flow graph as a `.dot` file (default: no)
+    -Z                                dump-mir=val -- dump MIR state to file.
+        `val` is used to select which passes and functions to dump. For example:
+        `all` matches all passes and functions,
+        `foo` matches all passes for functions whose name contains 'foo',
+        `foo & ConstProp` only the 'ConstProp' pass for function names containing 'foo',
+        `foo | bar` all passes for function names containing 'foo' or 'bar'.
+    -Z                       dump-mir-dataflow=val -- in addition to `.mir` files, create graphviz `.dot` files with dataflow results (default: no)
+    -Z                            dump-mir-dir=val -- the directory the MIR is dumped into (default: `mir_dump`)
+    -Z            dump-mir-exclude-pass-number=val -- exclude the pass number when dumping MIR (used in tests) (default: no)
+    -Z                       dump-mir-graphviz=val -- in addition to `.mir` files, create graphviz `.dot` files (and with `-Z instrument-coverage`, also create a `.dot` file for the MIR-derived coverage graph) (default: no)
+    -Z                       dump-mir-spanview=val -- in addition to `.mir` files, create `.html` files to view spans for all `statement`s (including terminators), only `terminator` spans, or computed `block` spans (one span encompassing a block's terminator and all statements). If `-Z instrument-coverage` is also enabled, create an additional `.html` file showing the computed coverage spans.
+    -Z                           dwarf-version=val -- version of DWARF debug information to emit (default: 2 or 4, depending on platform)
+    -Z                        emit-stack-sizes=val -- emit a section containing stack size metadata (default: no)
+    -Z                             fewer-names=val -- reduce memory use by retaining fewer names within compilation artifacts (LLVM-IR) (default: no)
+    -Z              force-unstable-if-unmarked=val -- force all crates to be `rustc_private` unstable (default: no)
+    -Z                                    fuel=val -- set the optimization fuel quota for a crate
+    -Z                       function-sections=val -- whether each function should go in its own section
+    -Z                    future-incompat-test=val -- forces all lints to be future incompatible, used for internal testing (default: no)
+    -Z                                  gcc-ld=val -- implementation of ld used by cc
+    -Z                      graphviz-dark-mode=val -- use dark-themed colors in graphviz output (default: no)
+    -Z                           graphviz-font=val -- use the given `fontname` in graphviz output; can be overridden by setting environment variable `RUSTC_GRAPHVIZ_FONT` (default: `Courier, monospace`)
+    -Z                               hir-stats=val -- print some statistics about AST and HIR (default: no)
+    -Z                human-readable-cgu-names=val -- generate human-readable, predictable names for codegen units (default: no)
+    -Z                        identify-regions=val -- display unnamed regions as `'<id>`, using a non-ident unique id (default: no)
+    -Z                incremental-ignore-spans=val -- ignore spans during ICH computation -- used for testing (default: no)
+    -Z                        incremental-info=val -- print high-level information about incremental reuse (or the lack thereof) (default: no)
+    -Z              incremental-relative-spans=val -- hash spans relative to their parent item for incr. comp. (default: no)
+    -Z                  incremental-verify-ich=val -- verify incr. comp. hashes of green query instances (default: no)
+    -Z                              inline-mir=val -- enable MIR inlining (default: no)
+    -Z                    inline-mir-threshold=val -- a default MIR inlining threshold (default: 50)
+    -Z               inline-mir-hint-threshold=val -- inlining threshold for functions with inline hint (default: 100)
+    -Z                      inline-in-all-cgus=val -- control whether `#[inline]` functions are in all CGUs
+    -Z                             input-stats=val -- gather statistics about the input (default: no)
+    -Z                     instrument-coverage=val -- instrument the generated code to support LLVM source-based code coverage reports (note, the compiler build config must include `profiler = true`); implies `-C symbol-mangling-version=v0`. Optional values are:
+        `=all` (implicit value)
+        `=except-unused-generics`
+        `=except-unused-functions`
+        `=off` (default)
+    -Z                       instrument-mcount=val -- insert function instrument code for mcount-based tracing (default: no)
+    -Z                       keep-hygiene-data=val -- keep hygiene data after analysis (default: no)
+    -Z                   link-native-libraries=val -- link native libraries in the linker invocation (default: yes)
+    -Z                               link-only=val -- link the `.rlink` file generated by `-Z no-link` (default: no)
+    -Z                            llvm-plugins=val -- a list LLVM plugins to enable (space separated)
+    -Z                         llvm-time-trace=val -- generate JSON tracing data file from LLVM data (default: no)
+    -Z                         location-detail=val -- comma separated list of location details to be tracked when using caller_location valid options are `file`, `line`, and `column` (default: all)
+    -Z                                      ls=val -- list the symbols defined by a library crate (default: no)
+    -Z                         macro-backtrace=val -- show macro backtraces (default: no)
+    -Z                         merge-functions=val -- control the operation of the MergeFunctions LLVM pass, taking the same values as the target option of the same name
+    -Z                              meta-stats=val -- gather metadata statistics (default: no)
+    -Z                          mir-emit-retag=val -- emit Retagging MIR statements, interpreted e.g., by miri; implies -Zmir-opt-level=0 (default: no)
+    -Z                       mir-enable-passes=val -- use like `-Zmir-enable-passes=+DestProp,-InstCombine`. Forces the specified passes to be enabled, overriding all other checks. Passes that are not specified are enabled or disabled by other flags as usual.
+    -Z                           mir-opt-level=val -- MIR optimization level (0-4; default: 1 in non optimized builds and 2 in optimized builds)
+    -Z                         move-size-limit=val -- the size at which the `large_assignments` lint starts to be emitted
+    -Z                         mutable-noalias=val -- emit noalias metadata for mutable references (default: yes)
+    -Z                   new-llvm-pass-manager=val -- use new LLVM pass manager (default: no)
+    -Z                               nll-facts=val -- dump facts from NLL analysis into side files (default: no)
+    -Z                           nll-facts-dir=val -- the directory the NLL facts are dumped into (default: `nll-facts`)
+    -Z                             no-analysis=val -- parse and expand the source, but run no analysis
+    -Z                              no-codegen=val -- run all passes except codegen; no output
+    -Z              no-generate-arange-section=val -- omit DWARF address ranges that give faster lookups
+    -Z                     no-interleave-lints=val -- execute lints separately; allows benchmarking individual lints
+    -Z                           no-leak-check=val -- disable the 'leak check' for subtyping; unsound, but useful for tests
+    -Z                                 no-link=val -- compile without linking
+    -Z                        no-parallel-llvm=val -- run LLVM in non-parallel mode (while keeping codegen-units and ThinLTO)
+    -Z                 no-unique-section-names=val -- do not use unique names for text and data sections when -Z function-sections is used
+    -Z                     no-profiler-runtime=val -- prevent automatic injection of the profiler_builtins crate
+    -Z                          normalize-docs=val -- normalize associated items in rustdoc when generating documentation
+    -Z                                     oom=val -- panic strategy for out-of-memory handling
+    -Z                  osx-rpath-install-name=val -- pass `-install_name @rpath/...` to the macOS linker (default: no)
+    -Z                        diagnostic-width=val -- set the current output width for diagnostic truncation
+    -Z                       panic-abort-tests=val -- support compiling tests with panic=abort (default: no)
+    -Z                           panic-in-drop=val -- panic strategy for panics in drops
+    -Z                              parse-only=val -- parse only; do not compile, assemble, or link (default: no)
+    -Z                              perf-stats=val -- print some performance-related statistics (default: no)
+    -Z pick-stable-methods-before-any-unstable=val -- try to pick stable methods first before picking any unstable methods (default: yes)
+    -Z                                     plt=val -- whether to use the PLT when calling into shared libraries;
+        only has effect for PIC code on systems with ELF binaries
+        (default: PLT is disabled if full relro is enabled)
+    -Z                                polonius=val -- enable polonius-based borrow-checker (default: no)
+    -Z                            polymorphize=val -- perform polymorphization analysis
+    -Z                            pre-link-arg=val -- a single extra argument to prepend the linker invocation (can be used several times)
+    -Z                           pre-link-args=val -- extra arguments to prepend to the linker invocation (space separated)
+    -Z           precise-enum-drop-elaboration=val -- use a more precise version of drop elaboration for matches on enums (default: yes). This results in better codegen, but has caused miscompilations on some tier 2 platforms. See #77382 and #74551.
+    -Z                              print-fuel=val -- make rustc print the total optimization fuel used by a crate
+    -Z                       print-llvm-passes=val -- print the LLVM optimization passes being run (default: no)
+    -Z                        print-mono-items=val -- print the result of the monomorphization collection pass
+    -Z                        print-type-sizes=val -- print layout information for each type encountered (default: no)
+    -Z                    proc-macro-backtrace=val -- show backtraces for panics during proc-macro execution (default: no)
+    -Z                                 profile=val -- insert profiling code (default: no)
+    -Z                        profile-closures=val -- profile size of closures
+    -Z                            profile-emit=val -- file path to emit profiling data at runtime when using 'profile' (default based on relative source path)
+    -Z                        profiler-runtime=val -- name of the profiler runtime crate to automatically inject (default: `profiler_builtins`)
+    -Z                      profile-sample-use=val -- use the given `.prof` file for sampled profile-guided optimization (also known as AutoFDO)
+    -Z                         query-dep-graph=val -- enable queries of the dependency graph for regression testing (default: no)
+    -Z                        randomize-layout=val -- randomize the layout of types (default: no)
+    -Z                             layout-seed=val -- seed layout randomization
+    -Z                   relax-elf-relocations=val -- whether ELF relocations can be relaxed
+    -Z                             relro-level=val -- choose which RELRO level to use
+    -Z                        remap-cwd-prefix=val -- remap paths under the current working directory to this path prefix
+    -Z         simulate-remapped-rust-src-base=val -- simulate the effect of remap-debuginfo = true at bootstrapping by remapping path to rust's source base directory. only meant for testing purposes
+    -Z                     report-delayed-bugs=val -- immediately print bugs registered with `delay_span_bug` (default: no)
+    -Z                               sanitizer=val -- use a sanitizer
+    -Z          sanitizer-memory-track-origins=val -- enable origins tracking in MemorySanitizer
+    -Z                       sanitizer-recover=val -- enable recovery for selected sanitizers
+    -Z                  saturating-float-casts=val -- make float->int casts UB-free: numbers outside the integer type's range are clipped to the max/min integer respectively, and NaN is mapped to 0 (default: yes)
+    -Z                           save-analysis=val -- write syntax and type analysis (in JSON format) information, in addition to normal output (default: no)
+    -Z                            self-profile=val -- run the self profiler and output the raw event data
+    -Z                     self-profile-events=val -- specify the events recorded by the self profiler;
+        for example: `-Z self-profile-events=default,query-keys`
+        all options: none, all, default, generic-activity, query-provider, query-cache-hit
+                     query-blocked, incr-cache-load, incr-result-hashing, query-keys, function-args, args, llvm, artifact-sizes
+    -Z                    self-profile-counter=val -- counter used by the self profiler (default: `wall-time`), one of:
+        `wall-time` (monotonic clock, i.e. `std::time::Instant`)
+        `instructions:u` (retired instructions, userspace-only)
+        `instructions-minus-irqs:u` (subtracting hardware interrupt counts for extra accuracy)
+    -Z                          share-generics=val -- make the current crate share its generic instantiations
+    -Z                               show-span=val -- show spans for compiler debugging (expr|pat|ty)
+    -Z                              span-debug=val -- forward proc_macro::Span's `Debug` impl to `Span`
+    -Z                       span-free-formats=val -- exclude spans when debug-printing compiler state (default: no)
+    -Z                      src-hash-algorithm=val -- hash algorithm of source files in debug info (`md5`, `sha1`, or `sha256`)
+    -Z                         stack-protector=val -- control stack smash protection strategy (`rustc --print stack-protector-strategies` for details)
+    -Z                      strict-init-checks=val -- control if mem::uninitialized and mem::zeroed panic on more UB
+    -Z                                   strip=val -- tell the linker which information to strip (`none` (default), `debuginfo` or `symbols`)
+    -Z                        split-dwarf-kind=val -- split dwarf variant (only if -Csplit-debuginfo is enabled and on relevant platform)
+        (default: `split`)
+
+        `split`: sections which do not require relocation are written into a DWARF object (`.dwo`)
+                 file which is ignored by the linker
+        `single`: sections which do not require relocation are written into object file but ignored
+                  by the linker
+    -Z                    split-dwarf-inlining=val -- provide minimal debug info in the object/executable to facilitate online symbolication/stack traces in the absence of .dwo/.dwp files when using Split DWARF
+    -Z                 symbol-mangling-version=val -- which mangling version to use for symbol names ('legacy' (default) or 'v0')
+    -Z                                   teach=val -- show extended diagnostic help (default: no)
+    -Z                               temps-dir=val -- the directory the intermediate files are written to
+    -Z                          translate-lang=val -- language identifier for diagnostic output
+    -Z                translate-additional-ftl=val -- additional fluent translation to preferentially use (for testing translation)
+    -Z        translate-directionality-markers=val -- emit directionality isolation markers in translated diagnostics
+    -Z                                tune-cpu=val -- select processor to schedule for (`rustc --print target-cpus` for details)
+    -Z                                 thinlto=val -- enable ThinLTO when possible
+    -Z                           thir-unsafeck=val -- use the THIR unsafety checker (default: no)
+    -Z                                 threads=val -- use a thread pool with N threads
+    -Z                                    time=val -- measure time of rustc processes (default: no)
+    -Z                        time-llvm-passes=val -- measure time of each LLVM pass (default: no)
+    -Z                             time-passes=val -- measure time of each rustc pass (default: no)
+    -Z                               tls-model=val -- choose the TLS model to use (`rustc --print tls-models` for details)
+    -Z                            trace-macros=val -- for every macro invocation, print its name and arguments (default: no)
+    -Z   translate-remapped-path-to-local-path=val -- translate remapped paths into local paths when possible (default: yes)
+    -Z                        trap-unreachable=val -- generate trap instructions for unreachable intrinsics (default: use target setting, usually yes)
+    -Z                        treat-err-as-bug=val -- treat error number `val` that occurs as bug
+    -Z                   trim-diagnostic-paths=val -- in diagnostics, use heuristics to shorten paths referring to items
+    -Z                              ui-testing=val -- emit compiler diagnostics in a form suitable for UI testing (default: no)
+    -Z            uninit-const-chunk-threshold=val -- allow generating const initializers with mixed init/uninit chunks, and set the maximum number of chunks for which this is allowed (default: 16)
+    -Z          unleash-the-miri-inside-of-you=val -- take the brakes off const evaluation. NOTE: this is unsound (default: no)
+    -Z                                unpretty=val -- present the input source, unstable (and less-pretty) variants;
+        `normal`, `identified`,
+        `expanded`, `expanded,identified`,
+        `expanded,hygiene` (with internal representations),
+        `ast-tree` (raw AST before expansion),
+        `ast-tree,expanded` (raw AST after expansion),
+        `hir` (the HIR), `hir,identified`,
+        `hir,typed` (HIR with types for each node),
+        `hir-tree` (dump the raw HIR),
+        `mir` (the MIR), or `mir-cfg` (graphviz formatted MIR)
+    -Z                        unsound-mir-opts=val -- enable unsound and buggy MIR optimizations (default: no)
+    -Z                        unstable-options=val -- adds unstable command line options to rustc interface (default: no)
+    -Z                       use-ctors-section=val -- use legacy .ctors section for initializers rather than .init_array
+    -Z                            validate-mir=val -- validate MIR after each transformation
+    -Z                                 verbose=val -- in general, enable more debug printouts (default: no)
+    -Z                          verify-llvm-ir=val -- verify LLVM IR (default: no)
+    -Z            virtual-function-elimination=val -- enables dead virtual function elimination optimization. Requires `-Clto[=[fat,yes]]`
+    -Z                         wasi-exec-model=val -- whether to build a wasi command or reactor
diff --git a/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr b/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr
index 98c22af387e..e282884289d 100644
--- a/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr
+++ b/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr
@@ -411,7 +411,7 @@ LL | #[derive(SessionDiagnostic)]
    |
    = help: normalized in stderr
 note: required by a bound in `DiagnosticBuilder::<'a, G>::set_arg`
-  --> $COMPILER_DIR/rustc_errors/src/diagnostic_builder.rs:538:19
+  --> $COMPILER_DIR/rustc_errors/src/diagnostic_builder.rs:539:19
    |
 LL |         arg: impl IntoDiagnosticArg,
    |                   ^^^^^^^^^^^^^^^^^ required by this bound in `DiagnosticBuilder::<'a, G>::set_arg`
diff --git a/src/test/ui/asm/issue-99122-2.rs b/src/test/ui/asm/issue-99122-2.rs
new file mode 100644
index 00000000000..cfb9fd90a55
--- /dev/null
+++ b/src/test/ui/asm/issue-99122-2.rs
@@ -0,0 +1,21 @@
+// check-pass
+// needs-asm-support
+// only-x86_64
+
+// This demonstrates why we need to erase regions before sized check in intrinsicck
+
+struct NoCopy;
+
+struct Wrap<'a, T, Tail: ?Sized>(&'a T, Tail);
+
+pub unsafe fn test() {
+    let i = NoCopy;
+    let j = Wrap(&i, ());
+    let pointer = &j as *const _;
+    core::arch::asm!(
+        "nop",
+        in("eax") pointer,
+    );
+}
+
+fn main() {}
diff --git a/src/test/ui/asm/issue-99122.rs b/src/test/ui/asm/issue-99122.rs
new file mode 100644
index 00000000000..744a563d3d1
--- /dev/null
+++ b/src/test/ui/asm/issue-99122.rs
@@ -0,0 +1,13 @@
+// needs-asm-support
+// only-x86_64
+
+pub unsafe fn test() {
+    let pointer = 1u32 as *const _;
+    //~^ ERROR cannot cast to a pointer of an unknown kind
+    core::arch::asm!(
+        "nop",
+        in("eax") pointer,
+    );
+}
+
+fn main() {}
diff --git a/src/test/ui/asm/issue-99122.stderr b/src/test/ui/asm/issue-99122.stderr
new file mode 100644
index 00000000000..2758a4ac437
--- /dev/null
+++ b/src/test/ui/asm/issue-99122.stderr
@@ -0,0 +1,11 @@
+error[E0641]: cannot cast to a pointer of an unknown kind
+  --> $DIR/issue-99122.rs:5:27
+   |
+LL |     let pointer = 1u32 as *const _;
+   |                           ^^^^^^^^ needs more type information
+   |
+   = note: the type information given here is insufficient to check whether the pointer cast is valid
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0641`.
diff --git a/src/test/ui/async-await/async-await.rs b/src/test/ui/async-await/async-await.rs
index 3d22025bf28..9cabf16f8bb 100644
--- a/src/test/ui/async-await/async-await.rs
+++ b/src/test/ui/async-await/async-await.rs
@@ -6,7 +6,7 @@
 
 #![allow(unused)]
 
-// edition:2018
+// edition: 2018
 // aux-build:arc_wake.rs
 
 extern crate arc_wake;
diff --git a/src/test/ui/inference/erase-type-params-in-label.stderr b/src/test/ui/inference/erase-type-params-in-label.stderr
index 7bb281802d2..5c52e7bcfab 100644
--- a/src/test/ui/inference/erase-type-params-in-label.stderr
+++ b/src/test/ui/inference/erase-type-params-in-label.stderr
@@ -10,10 +10,6 @@ note: required by a bound in `foo`
    |
 LL | fn foo<T, K, W: Default, Z: Default>(t: T, k: K) -> Foo<T, K, W, Z> {
    |                 ^^^^^^^ required by this bound in `foo`
-help: consider giving `foo` an explicit type, where the type for type parameter `W` is specified
-   |
-LL |     let foo: Foo<i32, &str, W, Z> = foo(1, "");
-   |            ++++++++++++++++++++++
 help: consider specifying the type arguments in the function call
    |
 LL |     let foo = foo::<T, K, W, Z>(1, "");
@@ -31,10 +27,6 @@ note: required by a bound in `bar`
    |
 LL | fn bar<T, K, Z: Default>(t: T, k: K) -> Bar<T, K, Z> {
    |                 ^^^^^^^ required by this bound in `bar`
-help: consider giving `bar` an explicit type, where the type for type parameter `Z` is specified
-   |
-LL |     let bar: Bar<i32, &str, Z> = bar(1, "");
-   |            +++++++++++++++++++
 help: consider specifying the type arguments in the function call
    |
 LL |     let bar = bar::<T, K, Z>(1, "");
diff --git a/src/test/ui/inference/issue-71732.stderr b/src/test/ui/inference/issue-71732.stderr
index db153d38aaa..04673a375cf 100644
--- a/src/test/ui/inference/issue-71732.stderr
+++ b/src/test/ui/inference/issue-71732.stderr
@@ -13,10 +13,6 @@ note: required by a bound in `HashMap::<K, V, S>::get`
    |
 LL |         K: Borrow<Q>,
    |            ^^^^^^^^^ required by this bound in `HashMap::<K, V, S>::get`
-help: consider specifying the generic argument
-   |
-LL |         .get::<Q>(&"key".into())
-   |             +++++
 help: consider specifying the type argument in the function call
    |
 LL |         .get::<Q>(&"key".into())
diff --git a/src/test/ui/issues/issue-35976.stderr b/src/test/ui/issues/issue-35976.stderr
index f9b9b7dbd34..fe16f97b9d0 100644
--- a/src/test/ui/issues/issue-35976.stderr
+++ b/src/test/ui/issues/issue-35976.stderr
@@ -6,11 +6,6 @@ LL |         fn wait(&self) where Self: Sized;
 ...
 LL |     arg.wait();
    |         ^^^^
-   |
-help: another candidate was found in the following trait, perhaps add a `use` for it:
-   |
-LL | use private::Future;
-   |
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/methods/issues/issue-61525.rs b/src/test/ui/methods/issues/issue-61525.rs
new file mode 100644
index 00000000000..c5ca0326e43
--- /dev/null
+++ b/src/test/ui/methods/issues/issue-61525.rs
@@ -0,0 +1,20 @@
+pub trait Example {
+    fn query<Q>(self, q: Q);
+}
+
+impl Example for i32 {
+    fn query<Q>(self, _: Q) {
+        unimplemented!()
+    }
+}
+
+mod nested {
+    use super::Example;
+    fn example() {
+        1.query::<dyn ToString>("")
+        //~^ ERROR the size for values of type `dyn ToString` cannot be known at compilation time
+        //~| ERROR mismatched types
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/methods/issues/issue-61525.stderr b/src/test/ui/methods/issues/issue-61525.stderr
new file mode 100644
index 00000000000..aec968d7c44
--- /dev/null
+++ b/src/test/ui/methods/issues/issue-61525.stderr
@@ -0,0 +1,39 @@
+error[E0277]: the size for values of type `dyn ToString` cannot be known at compilation time
+  --> $DIR/issue-61525.rs:14:33
+   |
+LL |         1.query::<dyn ToString>("")
+   |           -----                 ^^ doesn't have a size known at compile-time
+   |           |
+   |           required by a bound introduced by this call
+   |
+   = help: the trait `Sized` is not implemented for `dyn ToString`
+note: required by a bound in `Example::query`
+  --> $DIR/issue-61525.rs:2:14
+   |
+LL |     fn query<Q>(self, q: Q);
+   |              ^ required by this bound in `Example::query`
+help: consider relaxing the implicit `Sized` restriction
+   |
+LL |     fn query<Q: ?Sized>(self, q: Q);
+   |               ++++++++
+
+error[E0308]: mismatched types
+  --> $DIR/issue-61525.rs:14:33
+   |
+LL |         1.query::<dyn ToString>("")
+   |           --------------------- ^^ expected trait object `dyn ToString`, found `&str`
+   |           |
+   |           arguments to this function are incorrect
+   |
+   = note: expected trait object `dyn ToString`
+                 found reference `&'static str`
+note: associated function defined here
+  --> $DIR/issue-61525.rs:2:8
+   |
+LL |     fn query<Q>(self, q: Q);
+   |        ^^^^^
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0277, E0308.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/ui/traits/issue-77982.stderr b/src/test/ui/traits/issue-77982.stderr
index a2d23c4e9df..2b832e27c52 100644
--- a/src/test/ui/traits/issue-77982.stderr
+++ b/src/test/ui/traits/issue-77982.stderr
@@ -13,10 +13,6 @@ note: required by a bound in `HashMap::<K, V, S>::get`
    |
 LL |         K: Borrow<Q>,
    |            ^^^^^^^^^ required by this bound in `HashMap::<K, V, S>::get`
-help: consider specifying the generic argument
-   |
-LL |     opts.get::<Q>(opt.as_ref());
-   |             +++++
 help: consider specifying the type argument in the function call
    |
 LL |     opts.get::<Q>(opt.as_ref());
diff --git a/src/test/ui/traits/multidispatch-convert-ambig-dest.stderr b/src/test/ui/traits/multidispatch-convert-ambig-dest.stderr
index 25f8d538377..cbec3593421 100644
--- a/src/test/ui/traits/multidispatch-convert-ambig-dest.stderr
+++ b/src/test/ui/traits/multidispatch-convert-ambig-dest.stderr
@@ -30,10 +30,6 @@ LL | fn test<T,U>(_: T, _: U)
    |    ---- required by a bound in this
 LL | where T : Convert<U>
    |           ^^^^^^^^^^ required by this bound in `test`
-help: consider specifying the generic arguments
-   |
-LL |     test::<i32, U>(22, std::default::Default::default());
-   |         ++++++++++
 help: consider specifying the type arguments in the function call
    |
 LL |     test::<T, U>(22, std::default::Default::default());
diff --git a/src/test/ui/type/type-annotation-needed.stderr b/src/test/ui/type/type-annotation-needed.stderr
index 7d7890c8b80..4af4c22f751 100644
--- a/src/test/ui/type/type-annotation-needed.stderr
+++ b/src/test/ui/type/type-annotation-needed.stderr
@@ -10,10 +10,6 @@ note: required by a bound in `foo`
    |
 LL | fn foo<T: Into<String>>(x: i32) {}
    |           ^^^^^^^^^^^^ required by this bound in `foo`
-help: consider specifying the generic argument
-   |
-LL |     foo::<T>(42);
-   |        +++++
 help: consider specifying the type argument in the function call
    |
 LL |     foo::<T>(42);
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs
index 7cf4a88c470..21d68586171 100644
--- a/src/tools/compiletest/src/header.rs
+++ b/src/tools/compiletest/src/header.rs
@@ -294,7 +294,7 @@ impl TestProps {
                 }
 
                 if let Some(edition) = config.parse_edition(ln) {
-                    self.compile_flags.push(format!("--edition={}", edition));
+                    self.compile_flags.push(format!("--edition={}", edition.trim()));
                     has_edition = true;
                 }