From b5d8361909e9e30a11227aa773099c293a5dca55 Mon Sep 17 00:00:00 2001 From: jyn Date: Tue, 19 Dec 2023 12:39:58 -0500 Subject: [PATCH 1/2] rename to verbose-internals --- compiler/rustc_driver_impl/src/pretty.rs | 2 +- compiler/rustc_hir_typeck/src/expr.rs | 4 ++-- .../rustc_infer/src/infer/error_reporting/mod.rs | 6 +++--- .../rustc_infer/src/traits/structural_impls.rs | 2 +- compiler/rustc_interface/src/tests.rs | 2 +- compiler/rustc_middle/src/mir/pretty.rs | 16 ++++++++++++---- compiler/rustc_middle/src/traits/mod.rs | 2 +- compiler/rustc_middle/src/ty/generics.rs | 4 ++-- compiler/rustc_middle/src/ty/print/pretty.rs | 6 +++--- compiler/rustc_query_impl/src/plumbing.rs | 7 +++++-- compiler/rustc_session/src/options.rs | 4 ++-- compiler/rustc_session/src/session.rs | 4 ++-- compiler/rustc_symbol_mangling/src/legacy.rs | 4 ++-- src/doc/rustc/src/command-line-arguments.md | 2 +- tests/mir-opt/nll/named_lifetimes_basic.rs | 2 +- tests/mir-opt/nll/region_subtyping_basic.rs | 2 +- tests/ui/associated-types/substs-ppaux.rs | 2 +- .../closure-print-generic-trim-off-verbose-2.rs | 2 +- .../print/closure-print-generic-verbose-1.rs | 2 +- .../print/closure-print-generic-verbose-2.rs | 2 +- tests/ui/closures/print/closure-print-verbose.rs | 2 +- .../coroutine/print/coroutine-print-verbose-1.rs | 2 +- .../coroutine/print/coroutine-print-verbose-2.rs | 2 +- .../coroutine/print/coroutine-print-verbose-3.rs | 2 +- .../signature-error-reporting-under-verbose.rs | 2 +- .../ui/impl-trait/erased-regions-in-hidden-ty.rs | 2 +- tests/ui/issues/issue-13482-2.rs | 2 +- .../escape-argument-callee.rs | 2 +- .../nll/closure-requirements/escape-argument.rs | 2 +- .../closure-requirements/escape-upvar-nested.rs | 2 +- .../nll/closure-requirements/escape-upvar-ref.rs | 2 +- .../propagate-approximated-fail-no-postdom.rs | 2 +- .../propagate-approximated-ref.rs | 2 +- ...d-shorter-to-static-comparing-against-free.rs | 2 +- ...te-approximated-shorter-to-static-no-bound.rs | 2 +- ...approximated-shorter-to-static-wrong-bound.rs | 2 +- .../propagate-approximated-val.rs | 2 +- .../propagate-despite-same-free-region.rs | 2 +- ...agate-fail-to-approximate-longer-no-bounds.rs | 2 +- ...te-fail-to-approximate-longer-wrong-bounds.rs | 2 +- .../propagate-from-trait-match.rs | 2 +- .../region-lbr-anon-does-not-outlive-static.rs | 2 +- .../region-lbr-named-does-not-outlive-static.rs | 2 +- .../region-lbr1-does-not-outlive-ebr2.rs | 2 +- ...r1-does-outlive-lbr2-because-implied-bound.rs | 2 +- .../return-wrong-bound-region.rs | 2 +- tests/ui/nll/ty-outlives/impl-trait-captures.rs | 2 +- tests/ui/nll/ty-outlives/impl-trait-outlives.rs | 2 +- .../nll/ty-outlives/projection-implied-bounds.rs | 2 +- .../ty-outlives/projection-no-regions-closure.rs | 2 +- .../nll/ty-outlives/projection-no-regions-fn.rs | 2 +- .../ty-outlives/projection-one-region-closure.rs | 2 +- .../projection-one-region-trait-bound-closure.rs | 2 +- ...tion-one-region-trait-bound-static-closure.rs | 2 +- .../projection-two-region-trait-bound-closure.rs | 2 +- .../ty-param-closure-approximate-lower-bound.rs | 2 +- ...ty-param-closure-outlives-from-return-type.rs | 2 +- ...y-param-closure-outlives-from-where-clause.rs | 2 +- .../nll/ty-outlives/ty-param-implied-bounds.rs | 2 +- .../user-annotations/dump-adt-brace-struct.rs | 2 +- tests/ui/nll/user-annotations/dump-fn-method.rs | 2 +- tests/ui/symbol-names/types.rs | 2 +- tests/ui/symbol-names/verbose.rs | 4 ++-- tests/ui/type/issue-94187-verbose-type-name.rs | 4 ++-- tests/ui/where-clauses/higher-ranked-fn-type.rs | 2 +- 65 files changed, 91 insertions(+), 80 deletions(-) diff --git a/compiler/rustc_driver_impl/src/pretty.rs b/compiler/rustc_driver_impl/src/pretty.rs index 7cd63bc6422c3..e5a7d5501151a 100644 --- a/compiler/rustc_driver_impl/src/pretty.rs +++ b/compiler/rustc_driver_impl/src/pretty.rs @@ -146,7 +146,7 @@ impl<'a> pprust_ast::PpAnn for AstHygieneAnn<'a> { } pprust_ast::AnnNode::Crate(_) => { s.s.hardbreak(); - let verbose = self.sess.verbose(); + let verbose = self.sess.verbose_internals(); s.synth_comment(rustc_span::hygiene::debug_hygiene_data(verbose)); s.s.hardbreak_if_not_bol(); } diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs index 7bd2c3f8b6b74..e4c4e7d0372ee 100644 --- a/compiler/rustc_hir_typeck/src/expr.rs +++ b/compiler/rustc_hir_typeck/src/expr.rs @@ -187,8 +187,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { expected: Expectation<'tcx>, args: &'tcx [hir::Expr<'tcx>], ) -> Ty<'tcx> { - if self.tcx().sess.verbose() { - // make this code only run with -Zverbose because it is probably slow + if self.tcx().sess.verbose_internals() { + // make this code only run with -Zverbose-internals because it is probably slow if let Ok(lint_str) = self.tcx.sess.source_map().span_to_snippet(expr.span) { if !lint_str.contains('\n') { debug!("expr text: {lint_str}"); diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs index c118c405c2092..a799a008a822f 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs @@ -1323,7 +1323,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { let num_display_types = consts_offset - regions_len; for (i, (ta1, ta2)) in type_arguments.take(num_display_types).enumerate() { let i = i + regions_len; - if ta1 == ta2 && !self.tcx.sess.verbose() { + if ta1 == ta2 && !self.tcx.sess.verbose_internals() { values.0.push_normal("_"); values.1.push_normal("_"); } else { @@ -1337,7 +1337,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { let const_arguments = sub1.consts().zip(sub2.consts()); for (i, (ca1, ca2)) in const_arguments.enumerate() { let i = i + consts_offset; - if ca1 == ca2 && !self.tcx.sess.verbose() { + if ca1 == ca2 && !self.tcx.sess.verbose_internals() { values.0.push_normal("_"); values.1.push_normal("_"); } else { @@ -1507,7 +1507,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { (ty::FnPtr(sig1), ty::FnPtr(sig2)) => self.cmp_fn_sig(sig1, sig2), _ => { - if t1 == t2 && !self.tcx.sess.verbose() { + if t1 == t2 && !self.tcx.sess.verbose_internals() { // The two types are the same, elide and don't highlight. (DiagnosticStyledString::normal("_"), DiagnosticStyledString::normal("_")) } else { diff --git a/compiler/rustc_infer/src/traits/structural_impls.rs b/compiler/rustc_infer/src/traits/structural_impls.rs index 8a7c59da09ebb..51c06c8970b16 100644 --- a/compiler/rustc_infer/src/traits/structural_impls.rs +++ b/compiler/rustc_infer/src/traits/structural_impls.rs @@ -17,7 +17,7 @@ impl<'tcx, T: fmt::Debug> fmt::Debug for Normalized<'tcx, T> { impl<'tcx, O: fmt::Debug> fmt::Debug for traits::Obligation<'tcx, O> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - if ty::tls::with(|tcx| tcx.sess.verbose()) { + if ty::tls::with(|tcx| tcx.sess.verbose_internals()) { write!( f, "Obligation(predicate={:?}, cause={:?}, param_env={:?}, depth={})", diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index 04a7714d4137e..c4a1f3a0e510b 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -714,7 +714,7 @@ fn test_unstable_options_tracking_hash() { untracked!(unpretty, Some("expanded".to_string())); untracked!(unstable_options, true); untracked!(validate_mir, true); - untracked!(verbose, true); + untracked!(verbose_internals, true); untracked!(write_long_types_to_disk, false); // tidy-alphabetical-end diff --git a/compiler/rustc_middle/src/mir/pretty.rs b/compiler/rustc_middle/src/mir/pretty.rs index 071c6a75583d4..b995f622388b1 100644 --- a/compiler/rustc_middle/src/mir/pretty.rs +++ b/compiler/rustc_middle/src/mir/pretty.rs @@ -627,7 +627,11 @@ where w, "{:A$} // {}{}", indented_body, - if tcx.sess.verbose() { format!("{current_location:?}: ") } else { String::new() }, + if tcx.sess.verbose_internals() { + format!("{current_location:?}: ") + } else { + String::new() + }, comment(tcx, statement.source_info), A = ALIGN, )?; @@ -652,7 +656,11 @@ where w, "{:A$} // {}{}", indented_terminator, - if tcx.sess.verbose() { format!("{current_location:?}: ") } else { String::new() }, + if tcx.sess.verbose_internals() { + format!("{current_location:?}: ") + } else { + String::new() + }, comment(tcx, data.terminator().source_info), A = ALIGN, )?; @@ -943,7 +951,7 @@ impl<'tcx> Debug for Rvalue<'tcx> { // When printing regions, add trailing space if necessary. let print_region = ty::tls::with(|tcx| { - tcx.sess.verbose() || tcx.sess.opts.unstable_opts.identify_regions + tcx.sess.verbose_internals() || tcx.sess.opts.unstable_opts.identify_regions }); let region = if print_region { let mut region = region.to_string(); @@ -1668,7 +1676,7 @@ fn pretty_print_const_value_tcx<'tcx>( ) -> fmt::Result { use crate::ty::print::PrettyPrinter; - if tcx.sess.verbose() { + if tcx.sess.verbose_internals() { fmt.write_str(&format!("ConstValue({ct:?}: {ty})"))?; return Ok(()); } diff --git a/compiler/rustc_middle/src/traits/mod.rs b/compiler/rustc_middle/src/traits/mod.rs index 5d0187a859833..4376d891c4191 100644 --- a/compiler/rustc_middle/src/traits/mod.rs +++ b/compiler/rustc_middle/src/traits/mod.rs @@ -177,7 +177,7 @@ impl<'tcx> ObligationCause<'tcx> { // NOTE(flaper87): As of now, it keeps track of the whole error // chain. Ideally, we should have a way to configure this either - // by using -Z verbose or just a CLI argument. + // by using -Z verbose-internals or just a CLI argument. self.code = variant(DerivedObligationCause { parent_trait_pred, parent_code: self.code }).into(); self diff --git a/compiler/rustc_middle/src/ty/generics.rs b/compiler/rustc_middle/src/ty/generics.rs index c3699b114c411..4821ae3f08735 100644 --- a/compiler/rustc_middle/src/ty/generics.rs +++ b/compiler/rustc_middle/src/ty/generics.rs @@ -326,7 +326,7 @@ impl<'tcx> Generics { own_params.start = 1; } - let verbose = tcx.sess.verbose(); + let verbose = tcx.sess.verbose_internals(); // Filter the default arguments. // @@ -342,7 +342,7 @@ impl<'tcx> Generics { param.default_value(tcx).is_some_and(|default| { default.instantiate(tcx, args) == args[param.index as usize] }) - // filter out trailing effect params, if we're not in `-Zverbose`. + // filter out trailing effect params, if we're not in `-Zverbose-internals`. || (!verbose && matches!(param.kind, GenericParamDefKind::Const { is_host_effect: true, .. })) }) .count(); diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 8e045397b0ffa..4d27e3f74d47e 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -744,7 +744,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write { // only affect certain debug messages (e.g. messages printed // from `rustc_middle::ty` during the computation of `tcx.predicates_of`), // and should have no effect on any compiler output. - // [Unless `-Zverbose` is used, e.g. in the output of + // [Unless `-Zverbose-internals` is used, e.g. in the output of // `tests/ui/nll/ty-outlives/impl-trait-captures.rs`, for // example.] if self.should_print_verbose() { @@ -829,7 +829,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write { } ty::CoroutineWitness(did, args) => { p!(write("{{")); - if !self.tcx().sess.verbose() { + if !self.tcx().sess.verbose_internals() { p!("coroutine witness"); // FIXME(eddyb) should use `def_span`. if let Some(did) = did.as_local() { @@ -1698,7 +1698,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write { } fn should_print_verbose(&self) -> bool { - self.tcx().sess.verbose() + self.tcx().sess.verbose_internals() } } diff --git a/compiler/rustc_query_impl/src/plumbing.rs b/compiler/rustc_query_impl/src/plumbing.rs index acd3d71e63683..9c859ba77460a 100644 --- a/compiler/rustc_query_impl/src/plumbing.rs +++ b/compiler/rustc_query_impl/src/plumbing.rs @@ -315,8 +315,11 @@ pub(crate) fn create_query_frame< ty::print::with_forced_impl_filename_line!(do_describe(tcx, key)) ) ); - let description = - if tcx.sess.verbose() { format!("{description} [{name:?}]") } else { description }; + let description = if tcx.sess.verbose_internals() { + format!("{description} [{name:?}]") + } else { + description + }; let span = if kind == dep_graph::dep_kinds::def_span || with_no_queries() { // The `def_span` query is used to calculate `default_span`, // so exit to avoid infinite recursion. diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 06b554e8e63b1..a0e713a3d9dbb 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -1989,8 +1989,8 @@ written to standard error output)"), "use legacy .ctors section for initializers rather than .init_array"), validate_mir: bool = (false, parse_bool, [UNTRACKED], "validate MIR after each transformation"), - #[rustc_lint_opt_deny_field_access("use `Session::verbose` instead of this field")] - verbose: bool = (false, parse_bool, [UNTRACKED], + #[rustc_lint_opt_deny_field_access("use `Session::verbose_internals` instead of this field")] + verbose_internals: bool = (false, parse_bool, [UNTRACKED], "in general, enable more debug printouts (default: no)"), #[rustc_lint_opt_deny_field_access("use `Session::verify_llvm_ir` instead of this field")] verify_llvm_ir: bool = (false, parse_bool, [TRACKED], diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 7f168572f7da6..3112ad300fd21 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -974,8 +974,8 @@ impl Session { // JUSTIFICATION: defn of the suggested wrapper fns #[allow(rustc::bad_opt_access)] impl Session { - pub fn verbose(&self) -> bool { - self.opts.unstable_opts.verbose + pub fn verbose_internals(&self) -> bool { + self.opts.unstable_opts.verbose_internals } pub fn print_llvm_stats(&self) -> bool { diff --git a/compiler/rustc_symbol_mangling/src/legacy.rs b/compiler/rustc_symbol_mangling/src/legacy.rs index 0178ff53b24a3..a273a4121466d 100644 --- a/compiler/rustc_symbol_mangling/src/legacy.rs +++ b/compiler/rustc_symbol_mangling/src/legacy.rs @@ -214,7 +214,7 @@ impl<'tcx> Printer<'tcx> for SymbolPrinter<'tcx> { | ty::Coroutine(def_id, args, _) => self.print_def_path(def_id, args), // The `pretty_print_type` formatting of array size depends on - // -Zverbose flag, so we cannot reuse it here. + // -Zverbose-internals flag, so we cannot reuse it here. ty::Array(ty, size) => { self.write_str("[")?; self.print_type(ty)?; @@ -255,7 +255,7 @@ impl<'tcx> Printer<'tcx> for SymbolPrinter<'tcx> { // only print integers match (ct.kind(), ct.ty().kind()) { (ty::ConstKind::Value(ty::ValTree::Leaf(scalar)), ty::Int(_) | ty::Uint(_)) => { - // The `pretty_print_const` formatting depends on -Zverbose + // The `pretty_print_const` formatting depends on -Zverbose-internals // flag, so we cannot reuse it here. let signed = matches!(ct.ty().kind(), ty::Int(_)); write!( diff --git a/src/doc/rustc/src/command-line-arguments.md b/src/doc/rustc/src/command-line-arguments.md index 4d32897cc14c7..5e02453e23667 100644 --- a/src/doc/rustc/src/command-line-arguments.md +++ b/src/doc/rustc/src/command-line-arguments.md @@ -343,7 +343,7 @@ _Note:_ The order of these lint level arguments is taken into account, see [lint ## `-Z`: set unstable options This flag will allow you to set unstable options of rustc. In order to set multiple options, -the -Z flag can be used multiple times. For example: `rustc -Z verbose -Z time-passes`. +the -Z flag can be used multiple times. For example: `rustc -Z verbose-internals -Z time-passes`. Specifying options with -Z is only available on nightly. To view all available options run: `rustc -Z help`, or see [The Unstable Book](../unstable-book/index.html). diff --git a/tests/mir-opt/nll/named_lifetimes_basic.rs b/tests/mir-opt/nll/named_lifetimes_basic.rs index 5a9312de284c1..5b6cc421ab88d 100644 --- a/tests/mir-opt/nll/named_lifetimes_basic.rs +++ b/tests/mir-opt/nll/named_lifetimes_basic.rs @@ -4,7 +4,7 @@ // suitable variables and that we setup the outlives relationship // between R0 and R1 properly. -// compile-flags: -Zverbose +// compile-flags: -Zverbose-internals // ^^^^^^^^^ force compiler to dump more region information #![allow(warnings)] diff --git a/tests/mir-opt/nll/region_subtyping_basic.rs b/tests/mir-opt/nll/region_subtyping_basic.rs index 83f756acdc3c7..0d3139a0ffd05 100644 --- a/tests/mir-opt/nll/region_subtyping_basic.rs +++ b/tests/mir-opt/nll/region_subtyping_basic.rs @@ -3,7 +3,7 @@ // in the type of `p` includes the points after `&v[0]` up to (but not // including) the call to `use_x`. The `else` branch is not included. -// compile-flags:-Zverbose +// compile-flags:-Zverbose-internals // ^^^^^^^^^ force compiler to dump more region information #![allow(warnings)] diff --git a/tests/ui/associated-types/substs-ppaux.rs b/tests/ui/associated-types/substs-ppaux.rs index 66cd94d7a1b37..db6e7a4cf051f 100644 --- a/tests/ui/associated-types/substs-ppaux.rs +++ b/tests/ui/associated-types/substs-ppaux.rs @@ -1,7 +1,7 @@ // // revisions: verbose normal // -//[verbose] compile-flags: -Z verbose +//[verbose] compile-flags: -Z verbose-internals trait Foo<'b, 'c, S=u32> { fn bar<'a, T>() where T: 'a {} diff --git a/tests/ui/closures/print/closure-print-generic-trim-off-verbose-2.rs b/tests/ui/closures/print/closure-print-generic-trim-off-verbose-2.rs index 07bf8fe4c0076..b6c7659bc724c 100644 --- a/tests/ui/closures/print/closure-print-generic-trim-off-verbose-2.rs +++ b/tests/ui/closures/print/closure-print-generic-trim-off-verbose-2.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrim-diagnostic-paths=off -Zverbose +// compile-flags: -Ztrim-diagnostic-paths=off -Zverbose-internals mod mod1 { pub fn f(t: T) diff --git a/tests/ui/closures/print/closure-print-generic-verbose-1.rs b/tests/ui/closures/print/closure-print-generic-verbose-1.rs index 67d37f1c59b40..6c631fabaa25d 100644 --- a/tests/ui/closures/print/closure-print-generic-verbose-1.rs +++ b/tests/ui/closures/print/closure-print-generic-verbose-1.rs @@ -1,4 +1,4 @@ -// compile-flags: -Zverbose +// compile-flags: -Zverbose-internals fn to_fn_once(f: F) -> F { f } diff --git a/tests/ui/closures/print/closure-print-generic-verbose-2.rs b/tests/ui/closures/print/closure-print-generic-verbose-2.rs index f460fedffb7fb..dcf7fb2865ccc 100644 --- a/tests/ui/closures/print/closure-print-generic-verbose-2.rs +++ b/tests/ui/closures/print/closure-print-generic-verbose-2.rs @@ -1,4 +1,4 @@ -// compile-flags: -Zverbose +// compile-flags: -Zverbose-internals mod mod1 { pub fn f(t: T) diff --git a/tests/ui/closures/print/closure-print-verbose.rs b/tests/ui/closures/print/closure-print-verbose.rs index 4b0438a91ed2e..76fe5471a601e 100644 --- a/tests/ui/closures/print/closure-print-verbose.rs +++ b/tests/ui/closures/print/closure-print-verbose.rs @@ -1,4 +1,4 @@ -// compile-flags: -Zverbose +// compile-flags: -Zverbose-internals // Same as closure-coerce-fn-1.rs diff --git a/tests/ui/coroutine/print/coroutine-print-verbose-1.rs b/tests/ui/coroutine/print/coroutine-print-verbose-1.rs index c47d7572ca77b..f0094aa694bb5 100644 --- a/tests/ui/coroutine/print/coroutine-print-verbose-1.rs +++ b/tests/ui/coroutine/print/coroutine-print-verbose-1.rs @@ -1,4 +1,4 @@ -// compile-flags: -Zverbose +// compile-flags: -Zverbose-internals // Same as: tests/ui/coroutine/issue-68112.stderr diff --git a/tests/ui/coroutine/print/coroutine-print-verbose-2.rs b/tests/ui/coroutine/print/coroutine-print-verbose-2.rs index c65c33cb4bacb..390bfc542b7ec 100644 --- a/tests/ui/coroutine/print/coroutine-print-verbose-2.rs +++ b/tests/ui/coroutine/print/coroutine-print-verbose-2.rs @@ -1,4 +1,4 @@ -// compile-flags: -Zverbose +// compile-flags: -Zverbose-internals // Same as test/ui/coroutine/not-send-sync.rs #![feature(coroutines)] diff --git a/tests/ui/coroutine/print/coroutine-print-verbose-3.rs b/tests/ui/coroutine/print/coroutine-print-verbose-3.rs index 3e4bb6281768a..49b54a4cd5b06 100644 --- a/tests/ui/coroutine/print/coroutine-print-verbose-3.rs +++ b/tests/ui/coroutine/print/coroutine-print-verbose-3.rs @@ -1,4 +1,4 @@ -// compile-flags: -Zverbose +// compile-flags: -Zverbose-internals #![feature(coroutines, coroutine_trait)] diff --git a/tests/ui/fn/signature-error-reporting-under-verbose.rs b/tests/ui/fn/signature-error-reporting-under-verbose.rs index d00cbd8a0f242..d28c8530d58ad 100644 --- a/tests/ui/fn/signature-error-reporting-under-verbose.rs +++ b/tests/ui/fn/signature-error-reporting-under-verbose.rs @@ -1,4 +1,4 @@ -// compile-flags: -Zverbose +// compile-flags: -Zverbose-internals fn foo(_: i32, _: i32) {} diff --git a/tests/ui/impl-trait/erased-regions-in-hidden-ty.rs b/tests/ui/impl-trait/erased-regions-in-hidden-ty.rs index b1f36fc247fe1..0458b56f95f7f 100644 --- a/tests/ui/impl-trait/erased-regions-in-hidden-ty.rs +++ b/tests/ui/impl-trait/erased-regions-in-hidden-ty.rs @@ -1,5 +1,5 @@ // revisions: current next -// compile-flags: -Zverbose +// compile-flags: -Zverbose-internals //[next] compile-flags: -Znext-solver // normalize-stderr-test "DefId\([^\)]+\)" -> "DefId(..)" diff --git a/tests/ui/issues/issue-13482-2.rs b/tests/ui/issues/issue-13482-2.rs index bbcb954afcc8c..b5b81dea73e8b 100644 --- a/tests/ui/issues/issue-13482-2.rs +++ b/tests/ui/issues/issue-13482-2.rs @@ -1,4 +1,4 @@ -// compile-flags:-Z verbose +// compile-flags:-Z verbose-internals fn main() { let x = [1,2]; diff --git a/tests/ui/nll/closure-requirements/escape-argument-callee.rs b/tests/ui/nll/closure-requirements/escape-argument-callee.rs index 3aea511b05696..d643a1b2a0d75 100644 --- a/tests/ui/nll/closure-requirements/escape-argument-callee.rs +++ b/tests/ui/nll/closure-requirements/escape-argument-callee.rs @@ -12,7 +12,7 @@ // that appear free in its type (hence, we see it before the closure's // "external requirements" report). -// compile-flags:-Zverbose +// compile-flags:-Zverbose-internals #![feature(rustc_attrs)] diff --git a/tests/ui/nll/closure-requirements/escape-argument.rs b/tests/ui/nll/closure-requirements/escape-argument.rs index 066cd436016c7..7b1e6e9c820a4 100644 --- a/tests/ui/nll/closure-requirements/escape-argument.rs +++ b/tests/ui/nll/closure-requirements/escape-argument.rs @@ -12,7 +12,7 @@ // basically checking that the MIR type checker correctly enforces the // closure signature. -// compile-flags:-Zverbose +// compile-flags:-Zverbose-internals #![feature(rustc_attrs)] diff --git a/tests/ui/nll/closure-requirements/escape-upvar-nested.rs b/tests/ui/nll/closure-requirements/escape-upvar-nested.rs index 765a3cf961c59..b104bc2479e8d 100644 --- a/tests/ui/nll/closure-requirements/escape-upvar-nested.rs +++ b/tests/ui/nll/closure-requirements/escape-upvar-nested.rs @@ -5,7 +5,7 @@ // // except that the closure does so via a second closure. -// compile-flags:-Zverbose +// compile-flags:-Zverbose-internals #![feature(rustc_attrs)] diff --git a/tests/ui/nll/closure-requirements/escape-upvar-ref.rs b/tests/ui/nll/closure-requirements/escape-upvar-ref.rs index 0a562a0a1bcff..97c2d7dc291fb 100644 --- a/tests/ui/nll/closure-requirements/escape-upvar-ref.rs +++ b/tests/ui/nll/closure-requirements/escape-upvar-ref.rs @@ -9,7 +9,7 @@ // `'b`. This relationship is propagated to the closure creator, // which reports an error. -// compile-flags:-Zverbose +// compile-flags:-Zverbose-internals #![feature(rustc_attrs)] diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.rs b/tests/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.rs index 35a864b885138..31f537d19d295 100644 --- a/tests/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.rs +++ b/tests/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.rs @@ -1,7 +1,7 @@ // Test where we fail to approximate due to demanding a postdom // relationship between our upper bounds. -// compile-flags:-Zverbose +// compile-flags:-Zverbose-internals #![feature(rustc_attrs)] diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-ref.rs b/tests/ui/nll/closure-requirements/propagate-approximated-ref.rs index 7291c6e9749b2..295b9cb77551d 100644 --- a/tests/ui/nll/closure-requirements/propagate-approximated-ref.rs +++ b/tests/ui/nll/closure-requirements/propagate-approximated-ref.rs @@ -12,7 +12,7 @@ // Note: the use of `Cell` here is to introduce invariance. One less // variable. -// compile-flags:-Zverbose +// compile-flags:-Zverbose-internals #![feature(rustc_attrs)] diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.rs b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.rs index afe6f10a52f08..e27a7d591e789 100644 --- a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.rs +++ b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.rs @@ -2,7 +2,7 @@ // where `'x` is bound in closure type but `'a` is free. This forces // us to approximate `'x` one way or the other. -// compile-flags:-Zverbose +// compile-flags:-Zverbose-internals #![feature(rustc_attrs)] diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.rs b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.rs index 3722090754b3e..f11dc769a03dc 100644 --- a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.rs +++ b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.rs @@ -3,7 +3,7 @@ // because `'y` is higher-ranked but we know of no relations to other // regions. Note that `'static` shows up in the stderr output as `'0`. -// compile-flags:-Zverbose +// compile-flags:-Zverbose-internals #![feature(rustc_attrs)] diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.rs b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.rs index 9898777c72749..5e5aa3a3cce74 100644 --- a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.rs +++ b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.rs @@ -4,7 +4,7 @@ // relations to other regions. Note that `'static` shows up in the // stderr output as `'0`. -// compile-flags:-Zverbose +// compile-flags:-Zverbose-internals #![feature(rustc_attrs)] diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-val.rs b/tests/ui/nll/closure-requirements/propagate-approximated-val.rs index 5bb5eea991bb4..83cb37516deb4 100644 --- a/tests/ui/nll/closure-requirements/propagate-approximated-val.rs +++ b/tests/ui/nll/closure-requirements/propagate-approximated-val.rs @@ -5,7 +5,7 @@ // relationships. In the 'main' variant, there are a number of // anonymous regions as well. -// compile-flags:-Zverbose +// compile-flags:-Zverbose-internals #![feature(rustc_attrs)] diff --git a/tests/ui/nll/closure-requirements/propagate-despite-same-free-region.rs b/tests/ui/nll/closure-requirements/propagate-despite-same-free-region.rs index 704a026d29b79..5a25e29816d74 100644 --- a/tests/ui/nll/closure-requirements/propagate-despite-same-free-region.rs +++ b/tests/ui/nll/closure-requirements/propagate-despite-same-free-region.rs @@ -3,7 +3,7 @@ // need to propagate; but in fact we do because identity of free // regions is erased. -// compile-flags:-Zverbose +// compile-flags:-Zverbose-internals // check-pass #![feature(rustc_attrs)] diff --git a/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.rs b/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.rs index dcd05d7fa2ce2..0fb57d47d2d1c 100644 --- a/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.rs +++ b/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.rs @@ -7,7 +7,7 @@ // as it knows of no relationships between `'x` and any // non-higher-ranked regions. -// compile-flags:-Zverbose +// compile-flags:-Zverbose-internals #![feature(rustc_attrs)] diff --git a/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.rs b/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.rs index 98be92d1cd638..3bdd923543efc 100644 --- a/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.rs +++ b/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.rs @@ -7,7 +7,7 @@ // as it only knows of regions that `'x` is outlived by, and none that // `'x` outlives. -// compile-flags:-Zverbose +// compile-flags:-Zverbose-internals #![feature(rustc_attrs)] diff --git a/tests/ui/nll/closure-requirements/propagate-from-trait-match.rs b/tests/ui/nll/closure-requirements/propagate-from-trait-match.rs index cda781d8e2637..5fe2f46ee79e9 100644 --- a/tests/ui/nll/closure-requirements/propagate-from-trait-match.rs +++ b/tests/ui/nll/closure-requirements/propagate-from-trait-match.rs @@ -4,7 +4,7 @@ // the same `'a` for which it implements `Trait`, which can only be the `'a` // from the function definition. -// compile-flags:-Zverbose +// compile-flags:-Zverbose-internals #![feature(rustc_attrs)] #![allow(dead_code)] diff --git a/tests/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.rs b/tests/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.rs index 8147da09d4391..6e7db4578a079 100644 --- a/tests/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.rs +++ b/tests/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.rs @@ -3,7 +3,7 @@ // a variety of errors from the older, AST-based machinery (notably // borrowck), and then we get the NLL error at the end. -// compile-flags:-Zverbose +// compile-flags:-Zverbose-internals fn foo(x: &u32) -> &'static u32 { &*x diff --git a/tests/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.rs b/tests/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.rs index 4acd2fc92f3a3..c1b9e249c09c4 100644 --- a/tests/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.rs +++ b/tests/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.rs @@ -3,7 +3,7 @@ // a variety of errors from the older, AST-based machinery (notably // borrowck), and then we get the NLL error at the end. -// compile-flags:-Zverbose +// compile-flags:-Zverbose-internals fn foo<'a>(x: &'a u32) -> &'static u32 { &*x diff --git a/tests/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.rs b/tests/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.rs index 06e96be80d5a5..1d31c9cb5a5d4 100644 --- a/tests/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.rs +++ b/tests/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.rs @@ -3,7 +3,7 @@ // a variety of errors from the older, AST-based machinery (notably // borrowck), and then we get the NLL error at the end. -// compile-flags:-Zverbose +// compile-flags:-Zverbose-internals fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> &'b u32 { &*x diff --git a/tests/ui/nll/closure-requirements/region-lbr1-does-outlive-lbr2-because-implied-bound.rs b/tests/ui/nll/closure-requirements/region-lbr1-does-outlive-lbr2-because-implied-bound.rs index 014959fdbd479..4e57fef167a95 100644 --- a/tests/ui/nll/closure-requirements/region-lbr1-does-outlive-lbr2-because-implied-bound.rs +++ b/tests/ui/nll/closure-requirements/region-lbr1-does-outlive-lbr2-because-implied-bound.rs @@ -2,7 +2,7 @@ // report an error because of the (implied) bound that `'b: 'a`. // check-pass -// compile-flags:-Zverbose +// compile-flags:-Zverbose-internals fn foo<'a, 'b>(x: &'a &'b u32) -> &'a u32 { &**x diff --git a/tests/ui/nll/closure-requirements/return-wrong-bound-region.rs b/tests/ui/nll/closure-requirements/return-wrong-bound-region.rs index e34a3f6f2cbda..0277715b59073 100644 --- a/tests/ui/nll/closure-requirements/return-wrong-bound-region.rs +++ b/tests/ui/nll/closure-requirements/return-wrong-bound-region.rs @@ -2,7 +2,7 @@ // the first, but actually returns the second. This should fail within // the closure. -// compile-flags:-Zverbose +// compile-flags:-Zverbose-internals #![feature(rustc_attrs)] diff --git a/tests/ui/nll/ty-outlives/impl-trait-captures.rs b/tests/ui/nll/ty-outlives/impl-trait-captures.rs index 67b31b8bcd4f5..faab2cf8bcbea 100644 --- a/tests/ui/nll/ty-outlives/impl-trait-captures.rs +++ b/tests/ui/nll/ty-outlives/impl-trait-captures.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zverbose +// compile-flags:-Zverbose-internals #![allow(warnings)] diff --git a/tests/ui/nll/ty-outlives/impl-trait-outlives.rs b/tests/ui/nll/ty-outlives/impl-trait-outlives.rs index 68ccb51fcd0fb..2c2eb703a153a 100644 --- a/tests/ui/nll/ty-outlives/impl-trait-outlives.rs +++ b/tests/ui/nll/ty-outlives/impl-trait-outlives.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zverbose +// compile-flags:-Zverbose-internals #![allow(warnings)] diff --git a/tests/ui/nll/ty-outlives/projection-implied-bounds.rs b/tests/ui/nll/ty-outlives/projection-implied-bounds.rs index e1dac08240906..59854fe6d8af2 100644 --- a/tests/ui/nll/ty-outlives/projection-implied-bounds.rs +++ b/tests/ui/nll/ty-outlives/projection-implied-bounds.rs @@ -1,7 +1,7 @@ // Test that we can deduce when projections like `T::Item` outlive the // function body. Test that this does not imply that `T: 'a` holds. -// compile-flags:-Zverbose +// compile-flags:-Zverbose-internals use std::cell::Cell; diff --git a/tests/ui/nll/ty-outlives/projection-no-regions-closure.rs b/tests/ui/nll/ty-outlives/projection-no-regions-closure.rs index 2d9c008c75924..f908381d4ac07 100644 --- a/tests/ui/nll/ty-outlives/projection-no-regions-closure.rs +++ b/tests/ui/nll/ty-outlives/projection-no-regions-closure.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zverbose +// compile-flags:-Zverbose-internals // Tests closures that propagate an outlives relationship to their // creator where the subject is a projection with no regions (` "h[HASH]" #![feature(never_type)] diff --git a/tests/ui/symbol-names/verbose.rs b/tests/ui/symbol-names/verbose.rs index e00c592b6d276..2aa43e8762741 100644 --- a/tests/ui/symbol-names/verbose.rs +++ b/tests/ui/symbol-names/verbose.rs @@ -1,10 +1,10 @@ -// Regression test for issue #57596, where -Zverbose flag unintentionally +// Regression test for issue #57596, where -Zverbose-internals flag unintentionally // affected produced symbols making it impossible to link between crates // with a different value of the flag (for symbols involving generic // arguments equal to defaults of their respective parameters). // // build-pass -// compile-flags: -Zverbose +// compile-flags: -Zverbose-internals pub fn error(msg: String) -> Box { msg.into() diff --git a/tests/ui/type/issue-94187-verbose-type-name.rs b/tests/ui/type/issue-94187-verbose-type-name.rs index 3713a32eb1183..7c765d6d8104a 100644 --- a/tests/ui/type/issue-94187-verbose-type-name.rs +++ b/tests/ui/type/issue-94187-verbose-type-name.rs @@ -1,8 +1,8 @@ -// Check to insure that the output of `std::any::type_name` does not change based on `-Zverbose` +// Ensure the output of `std::any::type_name` does not change based on `-Zverbose-internals` // run-pass // edition: 2018 // revisions: normal verbose -// [verbose]compile-flags:-Zverbose +// [verbose]compile-flags:-Zverbose-internals --verbose use std::any::type_name; diff --git a/tests/ui/where-clauses/higher-ranked-fn-type.rs b/tests/ui/where-clauses/higher-ranked-fn-type.rs index c19e75eb7bfc8..5d7308b6c1cdc 100644 --- a/tests/ui/where-clauses/higher-ranked-fn-type.rs +++ b/tests/ui/where-clauses/higher-ranked-fn-type.rs @@ -1,5 +1,5 @@ // revisions: quiet verbose -// [verbose]compile-flags: -Zverbose +// [verbose]compile-flags: -Zverbose-internals #![allow(unused_parens)] From cb6d033316bdc2a1c5c1c0e04b297fbbb81eafca Mon Sep 17 00:00:00 2001 From: jyn Date: Tue, 19 Dec 2023 13:24:05 -0500 Subject: [PATCH 2/2] don't elide shared parts of types in diagnostics when `--verbose` is passed this also changes some parts of lifetime printing, which previously were not gated behind `-Z verbose` --- .../src/infer/error_reporting/mod.rs | 42 ++++++++++--------- compiler/rustc_session/src/config.rs | 4 ++ compiler/rustc_session/src/options.rs | 2 + tests/mir-opt/nll/named_lifetimes_basic.rs | 2 +- tests/mir-opt/nll/region_subtyping_basic.rs | 2 +- tests/ui/type/verbose.normal.stderr | 14 +++++++ tests/ui/type/verbose.rs | 13 ++++++ tests/ui/type/verbose.verbose.stderr | 14 +++++++ 8 files changed, 72 insertions(+), 21 deletions(-) create mode 100644 tests/ui/type/verbose.normal.stderr create mode 100644 tests/ui/type/verbose.rs create mode 100644 tests/ui/type/verbose.verbose.stderr diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs index a799a008a822f..85a842df966c6 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs @@ -1206,6 +1206,23 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { s.push_highlighted(mutbl.prefix_str()); } + fn maybe_highlight( + t1: T, + t2: T, + (buf1, buf2): &mut (DiagnosticStyledString, DiagnosticStyledString), + tcx: TyCtxt<'_>, + ) { + let highlight = t1 != t2; + let (t1, t2) = if highlight || tcx.sess.opts.verbose { + (t1.to_string(), t2.to_string()) + } else { + // The two types are the same, elide and don't highlight. + ("_".into(), "_".into()) + }; + buf1.push(t1, highlight); + buf2.push(t2, highlight); + } + fn cmp_ty_refs<'tcx>( r1: ty::Region<'tcx>, mut1: hir::Mutability, @@ -1302,7 +1319,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { if lifetimes.0 != lifetimes.1 { values.0.push_highlighted(l1); values.1.push_highlighted(l2); - } else if lifetimes.0.is_bound() { + } else if lifetimes.0.is_bound() || self.tcx.sess.opts.verbose { values.0.push_normal(l1); values.1.push_normal(l2); } else { @@ -1323,7 +1340,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { let num_display_types = consts_offset - regions_len; for (i, (ta1, ta2)) in type_arguments.take(num_display_types).enumerate() { let i = i + regions_len; - if ta1 == ta2 && !self.tcx.sess.verbose_internals() { + if ta1 == ta2 && !self.tcx.sess.opts.verbose { values.0.push_normal("_"); values.1.push_normal("_"); } else { @@ -1337,13 +1354,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { let const_arguments = sub1.consts().zip(sub2.consts()); for (i, (ca1, ca2)) in const_arguments.enumerate() { let i = i + consts_offset; - if ca1 == ca2 && !self.tcx.sess.verbose_internals() { - values.0.push_normal("_"); - values.1.push_normal("_"); - } else { - values.0.push_highlighted(ca1.to_string()); - values.1.push_highlighted(ca2.to_string()); - } + maybe_highlight(ca1, ca2, &mut values, self.tcx); self.push_comma(&mut values.0, &mut values.1, len, i); } @@ -1507,16 +1518,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { (ty::FnPtr(sig1), ty::FnPtr(sig2)) => self.cmp_fn_sig(sig1, sig2), _ => { - if t1 == t2 && !self.tcx.sess.verbose_internals() { - // The two types are the same, elide and don't highlight. - (DiagnosticStyledString::normal("_"), DiagnosticStyledString::normal("_")) - } else { - // We couldn't find anything in common, highlight everything. - ( - DiagnosticStyledString::highlighted(t1.to_string()), - DiagnosticStyledString::highlighted(t2.to_string()), - ) - } + let mut strs = (DiagnosticStyledString::new(), DiagnosticStyledString::new()); + maybe_highlight(t1, t2, &mut strs, self.tcx); + strs } } } diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 0c21e4eb43e78..ddccbc23627a6 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -1116,6 +1116,7 @@ impl Default for Options { working_dir: RealFileName::LocalPath(std::env::current_dir().unwrap()), color: ColorConfig::Auto, logical_env: FxIndexMap::default(), + verbose: false, } } } @@ -2916,6 +2917,8 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M RealFileName::LocalPath(path.into_owned()) }; + let verbose = matches.opt_present("verbose") || unstable_opts.verbose_internals; + Options { assert_incr_state, crate_types, @@ -2957,6 +2960,7 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M working_dir, color, logical_env, + verbose, } } diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index a0e713a3d9dbb..61996d9b672ab 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -223,6 +223,8 @@ top_level_options!( /// The (potentially remapped) working directory working_dir: RealFileName [TRACKED], color: ColorConfig [UNTRACKED], + + verbose: bool [UNTRACKED], } ); diff --git a/tests/mir-opt/nll/named_lifetimes_basic.rs b/tests/mir-opt/nll/named_lifetimes_basic.rs index 5b6cc421ab88d..bb22ce0ed9550 100644 --- a/tests/mir-opt/nll/named_lifetimes_basic.rs +++ b/tests/mir-opt/nll/named_lifetimes_basic.rs @@ -5,7 +5,7 @@ // between R0 and R1 properly. // compile-flags: -Zverbose-internals -// ^^^^^^^^^ force compiler to dump more region information +// ^^^^^^^^^^^^^^^^^^^ force compiler to dump more region information #![allow(warnings)] diff --git a/tests/mir-opt/nll/region_subtyping_basic.rs b/tests/mir-opt/nll/region_subtyping_basic.rs index 0d3139a0ffd05..940f8d173444a 100644 --- a/tests/mir-opt/nll/region_subtyping_basic.rs +++ b/tests/mir-opt/nll/region_subtyping_basic.rs @@ -4,7 +4,7 @@ // including) the call to `use_x`. The `else` branch is not included. // compile-flags:-Zverbose-internals -// ^^^^^^^^^ force compiler to dump more region information +// ^^^^^^^^^^^^^^^^^^^ force compiler to dump more region information #![allow(warnings)] diff --git a/tests/ui/type/verbose.normal.stderr b/tests/ui/type/verbose.normal.stderr new file mode 100644 index 0000000000000..6cb2640333642 --- /dev/null +++ b/tests/ui/type/verbose.normal.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/verbose.rs:7:28 + | +LL | let _: Foo = Foo:: { x: 0, y: 0 }; + | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Foo`, found `Foo` + | | + | expected due to this + | + = note: expected struct `Foo` + found struct `Foo` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/type/verbose.rs b/tests/ui/type/verbose.rs new file mode 100644 index 0000000000000..4ebd5cdccfcf9 --- /dev/null +++ b/tests/ui/type/verbose.rs @@ -0,0 +1,13 @@ +// revisions:verbose normal +// [verbose]compile-flags:--verbose +#![crate_type = "lib"] + +struct Foo { x: T, y: U } +fn bar() { + let _: Foo = Foo:: { x: 0, y: 0 }; + //~^ ERROR mismatched types + //[verbose]~| NOTE expected struct `Foo` + //[normal]~| NOTE expected struct `Foo` + //~| NOTE expected `Foo` + //~| NOTE expected due to this +} diff --git a/tests/ui/type/verbose.verbose.stderr b/tests/ui/type/verbose.verbose.stderr new file mode 100644 index 0000000000000..7cc7a16cdb169 --- /dev/null +++ b/tests/ui/type/verbose.verbose.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/verbose.rs:7:28 + | +LL | let _: Foo = Foo:: { x: 0, y: 0 }; + | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Foo`, found `Foo` + | | + | expected due to this + | + = note: expected struct `Foo` + found struct `Foo` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`.