From 0933fbd05a96d5685a6b47e5feeeb128d7daa2bf Mon Sep 17 00:00:00 2001 From: LingMan Date: Tue, 1 Jun 2021 21:07:07 +0200 Subject: [PATCH 01/10] Use `Iterator::any` and `filter_map` instead of open-coding them --- compiler/rustc_lint/src/types.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/compiler/rustc_lint/src/types.rs b/compiler/rustc_lint/src/types.rs index 9c94bab04e98f..8e7706758b68a 100644 --- a/compiler/rustc_lint/src/types.rs +++ b/compiler/rustc_lint/src/types.rs @@ -712,15 +712,10 @@ fn ty_is_known_nonnull<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>, mode: CItemKi return false; } - for variant in &def.variants { - if let Some(field) = transparent_newtype_field(cx.tcx, variant) { - if ty_is_known_nonnull(cx, field.ty(tcx, substs), mode) { - return true; - } - } - } - - false + def.variants + .iter() + .filter_map(|variant| transparent_newtype_field(cx.tcx, variant)) + .any(|field| ty_is_known_nonnull(cx, field.ty(tcx, substs), mode)) } _ => false, } From 59b6583287eb90598af98d916aaed617b148b4a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Wed, 2 Jun 2021 00:00:00 +0000 Subject: [PATCH 02/10] Remove unused support for `VarDebugInfo` This code has been dead since changes in 68961. --- compiler/rustc_codegen_ssa/src/mir/analyze.rs | 37 ++----------------- 1 file changed, 4 insertions(+), 33 deletions(-) diff --git a/compiler/rustc_codegen_ssa/src/mir/analyze.rs b/compiler/rustc_codegen_ssa/src/mir/analyze.rs index 38e928145a816..a5aa170deced9 100644 --- a/compiler/rustc_codegen_ssa/src/mir/analyze.rs +++ b/compiler/rustc_codegen_ssa/src/mir/analyze.rs @@ -7,9 +7,7 @@ use rustc_data_structures::graph::dominators::Dominators; use rustc_index::bit_set::BitSet; use rustc_index::vec::{Idx, IndexVec}; use rustc_middle::mir::traversal; -use rustc_middle::mir::visit::{ - MutatingUseContext, NonMutatingUseContext, NonUseContext, PlaceContext, Visitor, -}; +use rustc_middle::mir::visit::{MutatingUseContext, NonMutatingUseContext, PlaceContext, Visitor}; use rustc_middle::mir::{self, Location, TerminatorKind}; use rustc_middle::ty; use rustc_middle::ty::layout::HasTyCtxt; @@ -21,7 +19,9 @@ pub fn non_ssa_locals<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( let mir = fx.mir; let mut analyzer = LocalAnalyzer::new(fx); - analyzer.visit_body(&mir); + for (bb, data) in mir.basic_blocks().iter_enumerated() { + analyzer.visit_basic_block_data(bb, data); + } for (local, decl) in mir.local_decls.iter_enumerated() { let ty = fx.monomorphize(decl.ty); @@ -142,36 +142,7 @@ impl> LocalAnalyzer<'mir, 'a, 'tcx, Bx> { if let mir::ProjectionElem::Deref = elem { // Deref projections typically only read the pointer. - // (the exception being `VarDebugInfo` contexts, handled below) base_context = PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy); - - // Indirect debuginfo requires going through memory, that only - // the debugger accesses, following our emitted DWARF pointer ops. - // - // FIXME(eddyb) Investigate the possibility of relaxing this, but - // note that `llvm.dbg.declare` *must* be used for indirect places, - // even if we start using `llvm.dbg.value` for all other cases, - // as we don't necessarily know when the value changes, but only - // where it lives in memory. - // - // It's possible `llvm.dbg.declare` could support starting from - // a pointer that doesn't point to an `alloca`, but this would - // only be useful if we know the pointer being `Deref`'d comes - // from an immutable place, and if `llvm.dbg.declare` calls - // must be at the very start of the function, then only function - // arguments could contain such pointers. - if context == PlaceContext::NonUse(NonUseContext::VarDebugInfo) { - // We use `NonUseContext::VarDebugInfo` for the base, - // which might not force the base local to memory, - // so we have to do it manually. - self.visit_local(&place_ref.local, context, location); - } - } - - // `NonUseContext::VarDebugInfo` needs to flow all the - // way down to the base local (see `visit_local`). - if context == PlaceContext::NonUse(NonUseContext::VarDebugInfo) { - base_context = context; } self.process_place(&place_base, base_context, location); From 624c693508e94de2c962a4341d843313e5837511 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Thu, 3 Jun 2021 00:00:00 +0000 Subject: [PATCH 03/10] Remove check for projections in a branch without any The else branch is taken when projection slice is empty so everything except for the call to the `visit_local` is a dead code. --- compiler/rustc_codegen_ssa/src/mir/analyze.rs | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/compiler/rustc_codegen_ssa/src/mir/analyze.rs b/compiler/rustc_codegen_ssa/src/mir/analyze.rs index a5aa170deced9..a040c3d7de147 100644 --- a/compiler/rustc_codegen_ssa/src/mir/analyze.rs +++ b/compiler/rustc_codegen_ssa/src/mir/analyze.rs @@ -157,20 +157,7 @@ impl> LocalAnalyzer<'mir, 'a, 'tcx, Bx> { ); } } else { - // FIXME this is super_place code, is repeated here to avoid cloning place or changing - // visit_place API - let mut context = context; - - if !place_ref.projection.is_empty() { - context = if context.is_mutating_use() { - PlaceContext::MutatingUse(MutatingUseContext::Projection) - } else { - PlaceContext::NonMutatingUse(NonMutatingUseContext::Projection) - }; - } - self.visit_local(&place_ref.local, context, location); - self.visit_projection(*place_ref, context, location); } } } From 3aefd77ed3a3592e0905f64921b803c89cc0fa71 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Tue, 4 May 2021 22:37:25 -0400 Subject: [PATCH 04/10] Don't run sanity checks for `x.py setup` These requirements change as soon as the command finishes running, and `setup` doesn't build anything, so the check doesn't make sense. Previously, `x.py setup` would give hard errors if `ninja` and `cmake` were not installed, even if the new profile didn't require them. --- src/bootstrap/lib.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 2960dd3df6bf4..05c72a31c7ea2 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -444,8 +444,13 @@ impl Build { build.verbose("finding compilers"); cc_detect::find(&mut build); - build.verbose("running sanity check"); - sanity::check(&mut build); + // When running `setup`, the profile is about to change, so any requirements we have now may + // be different on the next invocation. Don't check for them until the next time x.py is + // run. This is ok because `setup` never runs any build commands, so it won't fail if commands are missing. + if !matches!(build.config.cmd, Subcommand::Setup { .. }) { + build.verbose("running sanity check"); + sanity::check(&mut build); + } // If local-rust is the same major.minor as the current version, then force a // local-rebuild From 4e219e6335a04cae15a784063f8cbe021076c933 Mon Sep 17 00:00:00 2001 From: Fabian Wolff Date: Fri, 4 Jun 2021 19:48:24 +0200 Subject: [PATCH 05/10] Remove incorrect assertion in type parsing code --- compiler/rustc_parse/src/parser/ty.rs | 1 - src/test/ui/parser/issue-84148-1.rs | 4 ++++ src/test/ui/parser/issue-84148-1.stderr | 23 ++++++++++++++++++ src/test/ui/parser/issue-84148-2.rs | 4 ++++ src/test/ui/parser/issue-84148-2.stderr | 31 +++++++++++++++++++++++++ 5 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 src/test/ui/parser/issue-84148-1.rs create mode 100644 src/test/ui/parser/issue-84148-1.stderr create mode 100644 src/test/ui/parser/issue-84148-2.rs create mode 100644 src/test/ui/parser/issue-84148-2.stderr diff --git a/compiler/rustc_parse/src/parser/ty.rs b/compiler/rustc_parse/src/parser/ty.rs index 89cf2d7876e1d..de5a5632600e4 100644 --- a/compiler/rustc_parse/src/parser/ty.rs +++ b/compiler/rustc_parse/src/parser/ty.rs @@ -334,7 +334,6 @@ impl<'a> Parser<'a> { mut bounds: GenericBounds, plus: bool, ) -> PResult<'a, TyKind> { - assert_ne!(self.token, token::Question); if plus { self.eat_plus(); // `+`, or `+=` gets split and `+` is discarded bounds.append(&mut self.parse_generic_bounds(Some(self.prev_token.span))?); diff --git a/src/test/ui/parser/issue-84148-1.rs b/src/test/ui/parser/issue-84148-1.rs new file mode 100644 index 0000000000000..25f7ba4d1f88e --- /dev/null +++ b/src/test/ui/parser/issue-84148-1.rs @@ -0,0 +1,4 @@ +fn f(t:for<>t?) +//~^ ERROR: expected parameter name +//~| ERROR: expected one of +//~| ERROR: expected one of diff --git a/src/test/ui/parser/issue-84148-1.stderr b/src/test/ui/parser/issue-84148-1.stderr new file mode 100644 index 0000000000000..98506568d82c2 --- /dev/null +++ b/src/test/ui/parser/issue-84148-1.stderr @@ -0,0 +1,23 @@ +error: expected parameter name, found `?` + --> $DIR/issue-84148-1.rs:1:14 + | +LL | fn f(t:for<>t?) + | ^ expected parameter name + +error: expected one of `(`, `)`, `+`, `,`, `::`, or `<`, found `?` + --> $DIR/issue-84148-1.rs:1:14 + | +LL | fn f(t:for<>t?) + | ^ + | | + | expected one of `(`, `)`, `+`, `,`, `::`, or `<` + | help: missing `,` + +error: expected one of `->`, `;`, `where`, or `{`, found `` + --> $DIR/issue-84148-1.rs:1:15 + | +LL | fn f(t:for<>t?) + | ^ expected one of `->`, `;`, `where`, or `{` + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/parser/issue-84148-2.rs b/src/test/ui/parser/issue-84148-2.rs new file mode 100644 index 0000000000000..257a3fd67207e --- /dev/null +++ b/src/test/ui/parser/issue-84148-2.rs @@ -0,0 +1,4 @@ +// error-pattern: this file contains an unclosed delimiter +// error-pattern: expected parameter name +// error-pattern: expected one of +fn f(t:for<>t? diff --git a/src/test/ui/parser/issue-84148-2.stderr b/src/test/ui/parser/issue-84148-2.stderr new file mode 100644 index 0000000000000..6f314da436070 --- /dev/null +++ b/src/test/ui/parser/issue-84148-2.stderr @@ -0,0 +1,31 @@ +error: this file contains an unclosed delimiter + --> $DIR/issue-84148-2.rs:4:16 + | +LL | fn f(t:for<>t? + | - ^ + | | + | unclosed delimiter + +error: expected parameter name, found `?` + --> $DIR/issue-84148-2.rs:4:14 + | +LL | fn f(t:for<>t? + | ^ expected parameter name + +error: expected one of `(`, `)`, `+`, `,`, `::`, or `<`, found `?` + --> $DIR/issue-84148-2.rs:4:14 + | +LL | fn f(t:for<>t? + | ^ + | | + | expected one of `(`, `)`, `+`, `,`, `::`, or `<` + | help: missing `,` + +error: expected one of `->`, `;`, `where`, or `{`, found `` + --> $DIR/issue-84148-2.rs:4:16 + | +LL | fn f(t:for<>t? + | ^ expected one of `->`, `;`, `where`, or `{` + +error: aborting due to 4 previous errors + From 6a6a605a61dfacfa974582484236155ce041a21d Mon Sep 17 00:00:00 2001 From: Fabian Wolff Date: Fri, 4 Jun 2021 22:46:57 +0200 Subject: [PATCH 06/10] Fix handling of unmatched angle brackets in parser --- compiler/rustc_parse/src/parser/path.rs | 84 +++++++++++--------- src/test/ui/parser/issue-84104.rs | 3 + src/test/ui/parser/issue-84104.stderr | 16 ++++ src/test/ui/parser/unmatched-langle-1.rs | 9 +++ src/test/ui/parser/unmatched-langle-1.stderr | 22 +++++ src/test/ui/parser/unmatched-langle-2.rs | 15 ++++ src/test/ui/parser/unmatched-langle-2.stderr | 8 ++ 7 files changed, 120 insertions(+), 37 deletions(-) create mode 100644 src/test/ui/parser/issue-84104.rs create mode 100644 src/test/ui/parser/issue-84104.stderr create mode 100644 src/test/ui/parser/unmatched-langle-1.rs create mode 100644 src/test/ui/parser/unmatched-langle-1.stderr create mode 100644 src/test/ui/parser/unmatched-langle-2.rs create mode 100644 src/test/ui/parser/unmatched-langle-2.stderr diff --git a/compiler/rustc_parse/src/parser/path.rs b/compiler/rustc_parse/src/parser/path.rs index 9cc600d9ede02..953c6915068af 100644 --- a/compiler/rustc_parse/src/parser/path.rs +++ b/compiler/rustc_parse/src/parser/path.rs @@ -352,49 +352,59 @@ impl<'a> Parser<'a> { debug!("parse_generic_args_with_leading_angle_bracket_recovery: (snapshotting)"); match self.parse_angle_args() { Ok(args) => Ok(args), - Err(ref mut e) if is_first_invocation && self.unmatched_angle_bracket_count > 0 => { - // Cancel error from being unable to find `>`. We know the error - // must have been this due to a non-zero unmatched angle bracket - // count. - e.cancel(); - + Err(mut e) if is_first_invocation && self.unmatched_angle_bracket_count > 0 => { // Swap `self` with our backup of the parser state before attempting to parse // generic arguments. let snapshot = mem::replace(self, snapshot.unwrap()); - debug!( - "parse_generic_args_with_leading_angle_bracket_recovery: (snapshot failure) \ - snapshot.count={:?}", - snapshot.unmatched_angle_bracket_count, - ); - // Eat the unmatched angle brackets. - for _ in 0..snapshot.unmatched_angle_bracket_count { - self.eat_lt(); - } - - // Make a span over ${unmatched angle bracket count} characters. - let span = lo.with_hi(lo.lo() + BytePos(snapshot.unmatched_angle_bracket_count)); - self.struct_span_err( - span, - &format!( - "unmatched angle bracket{}", - pluralize!(snapshot.unmatched_angle_bracket_count) - ), - ) - .span_suggestion( - span, - &format!( - "remove extra angle bracket{}", - pluralize!(snapshot.unmatched_angle_bracket_count) - ), - String::new(), - Applicability::MachineApplicable, - ) - .emit(); + let all_angle_brackets = (0..snapshot.unmatched_angle_bracket_count) + .fold(true, |a, _| a && self.eat_lt()); + + if !all_angle_brackets { + // If there are other tokens in between the extraneous `<`s, we cannot simply + // suggest to remove them. This check also prevents us from accidentally ending + // up in the middle of a multibyte character (issue #84104). + let _ = mem::replace(self, snapshot); + Err(e) + } else { + // Cancel error from being unable to find `>`. We know the error + // must have been this due to a non-zero unmatched angle bracket + // count. + e.cancel(); + + debug!( + "parse_generic_args_with_leading_angle_bracket_recovery: (snapshot failure) \ + snapshot.count={:?}", + snapshot.unmatched_angle_bracket_count, + ); + + // Make a span over ${unmatched angle bracket count} characters. + // This is safe because `all_angle_brackets` ensures that there are only `<`s, + // i.e. no multibyte characters, in this range. + let span = + lo.with_hi(lo.lo() + BytePos(snapshot.unmatched_angle_bracket_count)); + self.struct_span_err( + span, + &format!( + "unmatched angle bracket{}", + pluralize!(snapshot.unmatched_angle_bracket_count) + ), + ) + .span_suggestion( + span, + &format!( + "remove extra angle bracket{}", + pluralize!(snapshot.unmatched_angle_bracket_count) + ), + String::new(), + Applicability::MachineApplicable, + ) + .emit(); - // Try again without unmatched angle bracket characters. - self.parse_angle_args() + // Try again without unmatched angle bracket characters. + self.parse_angle_args() + } } Err(e) => Err(e), } diff --git a/src/test/ui/parser/issue-84104.rs b/src/test/ui/parser/issue-84104.rs new file mode 100644 index 0000000000000..998949b94a4ba --- /dev/null +++ b/src/test/ui/parser/issue-84104.rs @@ -0,0 +1,3 @@ +// error-pattern: this file contains an unclosed delimiter +// error-pattern: expected one of +#[i=i::<ښܖ< diff --git a/src/test/ui/parser/issue-84104.stderr b/src/test/ui/parser/issue-84104.stderr new file mode 100644 index 0000000000000..aff31f2c97149 --- /dev/null +++ b/src/test/ui/parser/issue-84104.stderr @@ -0,0 +1,16 @@ +error: this file contains an unclosed delimiter + --> $DIR/issue-84104.rs:3:13 + | +LL | #[i=i::<ښܖ< + | - ^ + | | + | unclosed delimiter + +error: expected one of `>`, a const expression, lifetime, or type, found `]` + --> $DIR/issue-84104.rs:3:13 + | +LL | #[i=i::<ښܖ< + | ^ expected one of `>`, a const expression, lifetime, or type + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/parser/unmatched-langle-1.rs b/src/test/ui/parser/unmatched-langle-1.rs new file mode 100644 index 0000000000000..fdf2ae398014b --- /dev/null +++ b/src/test/ui/parser/unmatched-langle-1.rs @@ -0,0 +1,9 @@ +// Check that a suggestion is issued if there are too many `<`s in a +// generic argument list, and that the parser recovers properly. + +fn main() { + foo::<<<>(); + //~^ ERROR: unmatched angle brackets + //~| ERROR: cannot find function `foo` in this scope [E0425] + //~| ERROR: cannot find type `Ty` in this scope [E0412] +} diff --git a/src/test/ui/parser/unmatched-langle-1.stderr b/src/test/ui/parser/unmatched-langle-1.stderr new file mode 100644 index 0000000000000..c8072b4c59ad2 --- /dev/null +++ b/src/test/ui/parser/unmatched-langle-1.stderr @@ -0,0 +1,22 @@ +error: unmatched angle brackets + --> $DIR/unmatched-langle-1.rs:5:10 + | +LL | foo::<<<>(); + | ^^^ help: remove extra angle brackets + +error[E0425]: cannot find function `foo` in this scope + --> $DIR/unmatched-langle-1.rs:5:5 + | +LL | foo::<<<>(); + | ^^^ not found in this scope + +error[E0412]: cannot find type `Ty` in this scope + --> $DIR/unmatched-langle-1.rs:5:14 + | +LL | foo::<<<>(); + | ^^ not found in this scope + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0412, E0425. +For more information about an error, try `rustc --explain E0412`. diff --git a/src/test/ui/parser/unmatched-langle-2.rs b/src/test/ui/parser/unmatched-langle-2.rs new file mode 100644 index 0000000000000..8de0d7d89e4e7 --- /dev/null +++ b/src/test/ui/parser/unmatched-langle-2.rs @@ -0,0 +1,15 @@ +// When there are too many opening `<`s, the compiler would previously +// suggest nonsense if the `<`s were interspersed with other tokens: +// +// error: unmatched angle brackets +// --> unmatched-langle.rs:2:10 +// | +// 2 | foo::(); +// | ^^^ help: remove extra angle brackets +// +// This test makes sure that this is no longer happening. + +fn main() { + foo::(); + //~^ ERROR: expected `::`, found `(` +} diff --git a/src/test/ui/parser/unmatched-langle-2.stderr b/src/test/ui/parser/unmatched-langle-2.stderr new file mode 100644 index 0000000000000..773bb33d8d3f3 --- /dev/null +++ b/src/test/ui/parser/unmatched-langle-2.stderr @@ -0,0 +1,8 @@ +error: expected `::`, found `(` + --> $DIR/unmatched-langle-2.rs:13:20 + | +LL | foo::(); + | ^ expected `::` + +error: aborting due to previous error + From dc302587e2cf5105a3a864319d7e7bcb434bba20 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Tue, 23 Mar 2021 21:48:29 -0400 Subject: [PATCH 07/10] Pass --cfg=bootstrap for proc_macros or build scripts built by stage0 Cargo ignores RUSTFLAGS when building proc macro crates. However, sometimes rustc_macro needs to have conditional compilation when there are breaking changes to the `libproc_macro` API (see for example tell the difference between stage 0 and stage 1. Another alternative is to unconditionally build rustc_macros with the master libstd instead of the beta one (i.e. use `--sysroot stage0-sysroot`), but that led to strange and maddening errors: ``` error[E0460]: found possibly newer version of crate `std` which `proc_macro2` depends on --> /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/tracing-attributes-0.1.13/src/lib.rs:90:5 | 90 | use proc_macro2::TokenStream; | ^^^^^^^^^^^ | = note: perhaps that crate needs to be recompiled? = note: the following crate versions were found: crate `std`: /home/joshua/rustc2/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-b3602c301b71cc3d.rmeta crate `proc_macro2`: /home/joshua/rustc2/build/x86_64-unknown-linux-gnu/stage0-rustc/release/deps/libproc_macro2-a83c1f01610c129e.rlib ``` --- src/bootstrap/bin/rustc.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index 4b98abfb308bf..ac8bbfe102dfe 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -124,6 +124,13 @@ fn main() { cmd.arg("-C").arg("target-feature=-crt-static"); } } + + if stage == "0" { + // Cargo doesn't pass RUSTFLAGS to proc_macros: + // https://github.com/rust-lang/cargo/issues/4423 + // Set `--cfg=bootstrap` explicitly instead. + cmd.arg("--cfg=bootstrap"); + } } if let Ok(map) = env::var("RUSTC_DEBUGINFO_MAP") { From d9630848d7a4a6478108f79ae0ce6028570dc732 Mon Sep 17 00:00:00 2001 From: Deadbeef Date: Sat, 5 Jun 2021 21:10:08 +0800 Subject: [PATCH 08/10] Remove `_` from E0121 diagnostic suggestions --- compiler/rustc_typeck/src/collect/type_of.rs | 2 +- src/test/ui/error-codes/E0121.stderr | 2 +- .../issue-69396-const-no-type-in-macro.stderr | 2 +- ...typeck_type_placeholder_item.full_tait.stderr | 16 ++++++++-------- .../typeck_type_placeholder_item.min_tait.stderr | 16 ++++++++-------- .../typeck_type_placeholder_item_help.stderr | 8 ++++---- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/compiler/rustc_typeck/src/collect/type_of.rs b/compiler/rustc_typeck/src/collect/type_of.rs index 5197b620f90ba..19c35ebd011b1 100644 --- a/compiler/rustc_typeck/src/collect/type_of.rs +++ b/compiler/rustc_typeck/src/collect/type_of.rs @@ -766,7 +766,7 @@ fn infer_placeholder_type( if !ty.references_error() { diag.span_suggestion( span, - "replace `_` with the correct type", + "replace with the correct type", ty.to_string(), Applicability::MaybeIncorrect, ); diff --git a/src/test/ui/error-codes/E0121.stderr b/src/test/ui/error-codes/E0121.stderr index ad854837ae5bd..246f69558ff0d 100644 --- a/src/test/ui/error-codes/E0121.stderr +++ b/src/test/ui/error-codes/E0121.stderr @@ -14,7 +14,7 @@ LL | static BAR: _ = "test"; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `&str` + | help: replace with the correct type: `&str` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-69396-const-no-type-in-macro.stderr b/src/test/ui/issues/issue-69396-const-no-type-in-macro.stderr index 6a744812e41d1..a84c048fab967 100644 --- a/src/test/ui/issues/issue-69396-const-no-type-in-macro.stderr +++ b/src/test/ui/issues/issue-69396-const-no-type-in-macro.stderr @@ -37,7 +37,7 @@ LL | const A = "A".$fn(); | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `bool` + | help: replace with the correct type: `bool` ... LL | / suite! { LL | | len; diff --git a/src/test/ui/typeck/typeck_type_placeholder_item.full_tait.stderr b/src/test/ui/typeck/typeck_type_placeholder_item.full_tait.stderr index 75e4cb3e2d819..bd7cbd444d704 100644 --- a/src/test/ui/typeck/typeck_type_placeholder_item.full_tait.stderr +++ b/src/test/ui/typeck/typeck_type_placeholder_item.full_tait.stderr @@ -79,7 +79,7 @@ LL | static TEST3: _ = "test"; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `&str` + | help: replace with the correct type: `&str` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:19:15 @@ -88,7 +88,7 @@ LL | static TEST4: _ = 145; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `i32` + | help: replace with the correct type: `i32` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:22:15 @@ -210,7 +210,7 @@ LL | static B: _ = 42; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `i32` + | help: replace with the correct type: `i32` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:80:15 @@ -244,7 +244,7 @@ LL | static FN_TEST3: _ = "test"; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `&str` + | help: replace with the correct type: `&str` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:92:22 @@ -253,7 +253,7 @@ LL | static FN_TEST4: _ = 145; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `i32` + | help: replace with the correct type: `i32` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:95:22 @@ -435,7 +435,7 @@ LL | const _: Option<_> = map(value); | ^^^^^^^^^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `Option` + | help: replace with the correct type: `Option` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:144:31 @@ -526,7 +526,7 @@ LL | const D: _ = 42; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `i32` + | help: replace with the correct type: `i32` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:201:26 @@ -639,7 +639,7 @@ LL | const D: _ = 42; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `i32` + | help: replace with the correct type: `i32` error: aborting due to 69 previous errors; 1 warning emitted diff --git a/src/test/ui/typeck/typeck_type_placeholder_item.min_tait.stderr b/src/test/ui/typeck/typeck_type_placeholder_item.min_tait.stderr index c6758c52a914e..afd6aaf4e55ab 100644 --- a/src/test/ui/typeck/typeck_type_placeholder_item.min_tait.stderr +++ b/src/test/ui/typeck/typeck_type_placeholder_item.min_tait.stderr @@ -70,7 +70,7 @@ LL | static TEST3: _ = "test"; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `&str` + | help: replace with the correct type: `&str` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:19:15 @@ -79,7 +79,7 @@ LL | static TEST4: _ = 145; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `i32` + | help: replace with the correct type: `i32` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:22:15 @@ -201,7 +201,7 @@ LL | static B: _ = 42; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `i32` + | help: replace with the correct type: `i32` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:80:15 @@ -235,7 +235,7 @@ LL | static FN_TEST3: _ = "test"; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `&str` + | help: replace with the correct type: `&str` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:92:22 @@ -244,7 +244,7 @@ LL | static FN_TEST4: _ = 145; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `i32` + | help: replace with the correct type: `i32` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:95:22 @@ -426,7 +426,7 @@ LL | const _: Option<_> = map(value); | ^^^^^^^^^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `Option` + | help: replace with the correct type: `Option` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:144:31 @@ -517,7 +517,7 @@ LL | const D: _ = 42; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `i32` + | help: replace with the correct type: `i32` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:201:26 @@ -630,7 +630,7 @@ LL | const D: _ = 42; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `i32` + | help: replace with the correct type: `i32` error: aborting due to 69 previous errors diff --git a/src/test/ui/typeck/typeck_type_placeholder_item_help.stderr b/src/test/ui/typeck/typeck_type_placeholder_item_help.stderr index f868c8d483486..2b64df774b08f 100644 --- a/src/test/ui/typeck/typeck_type_placeholder_item_help.stderr +++ b/src/test/ui/typeck/typeck_type_placeholder_item_help.stderr @@ -14,7 +14,7 @@ LL | const TEST2: _ = 42u32; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `u32` + | help: replace with the correct type: `u32` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item_help.rs:10:14 @@ -23,7 +23,7 @@ LL | const TEST3: _ = Some(42); | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `Option` + | help: replace with the correct type: `Option` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item_help.rs:13:22 @@ -38,7 +38,7 @@ LL | const TEST5: _ = 42; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `i32` + | help: replace with the correct type: `i32` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item_help.rs:24:18 @@ -47,7 +47,7 @@ LL | const TEST6: _ = 13; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `i32` + | help: replace with the correct type: `i32` error: aborting due to 6 previous errors From c01bd560e2f87a9a960ed071213edd70f73171a8 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 5 Jun 2021 23:03:54 +0200 Subject: [PATCH 09/10] Fix display for search results --- src/librustdoc/html/static/rustdoc.css | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index d3f8a7aa67dd7..578e8ce5acbef 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -800,6 +800,8 @@ a { .search-results .result-name > span { display: inline-block; + margin: 0; + font-weight: normal; } body.blur > :not(#help) { From 31eee595cf317d5a328356232016c8504dad9292 Mon Sep 17 00:00:00 2001 From: Fabian Wolff Date: Sun, 6 Jun 2021 22:54:00 +0200 Subject: [PATCH 10/10] Fix corrected example in E0759.md --- compiler/rustc_error_codes/src/error_codes/E0759.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_error_codes/src/error_codes/E0759.md b/compiler/rustc_error_codes/src/error_codes/E0759.md index 2fe5ada257fc2..6b16a7d415aa6 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0759.md +++ b/compiler/rustc_error_codes/src/error_codes/E0759.md @@ -16,13 +16,13 @@ fn bar(x: &i32) -> Box { // error! Add `'static` requirement to fix them: -```compile_fail,E0759 +``` # use std::fmt::Debug; -fn foo(x: &i32) -> impl Debug + 'static { // ok! +fn foo(x: &'static i32) -> impl Debug + 'static { // ok! x } -fn bar(x: &i32) -> Box { // ok! +fn bar(x: &'static i32) -> Box { // ok! Box::new(x) } ```