diff options
Diffstat (limited to 'src')
133 files changed, 729 insertions, 1216 deletions
diff --git a/src/bootstrap/bin/rustdoc.rs b/src/bootstrap/bin/rustdoc.rs index cba17c8e608..e4396d53016 100644 --- a/src/bootstrap/bin/rustdoc.rs +++ b/src/bootstrap/bin/rustdoc.rs @@ -41,7 +41,12 @@ fn main() { cmd.arg(arg); } if env::var_os("RUSTDOC_FUSE_LD_LLD").is_some() { - cmd.arg("-Clink-args=-fuse-ld=lld"); + cmd.arg("-Clink-arg=-fuse-ld=lld"); + if cfg!(windows) { + cmd.arg("-Clink-arg=-Wl,/threads:1"); + } else { + cmd.arg("-Clink-arg=-Wl,--threads=1"); + } } // Needed to be able to run all rustdoc tests. diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 06f8bf89dae..bc499fdba59 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -1142,6 +1142,7 @@ impl<'a> Builder<'a> { } if self.is_fuse_ld_lld(compiler.host) { cargo.env("RUSTC_HOST_FUSE_LD_LLD", "1"); + cargo.env("RUSTDOC_FUSE_LD_LLD", "1"); } if let Some(target_linker) = self.linker(target) { @@ -1151,6 +1152,9 @@ impl<'a> Builder<'a> { if self.is_fuse_ld_lld(target) { rustflags.arg("-Clink-args=-fuse-ld=lld"); } + self.lld_flags(target).for_each(|flag| { + rustdocflags.arg(&flag); + }); if !(["build", "check", "clippy", "fix", "rustc"].contains(&cmd)) && want_rustdoc { cargo.env("RUSTDOC_LIBDIR", self.rustc_libdir(compiler)); diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index ed311e273b1..112a6ea9398 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -1108,6 +1108,13 @@ impl Step for Assemble { let src_exe = exe("lld", target_compiler.host); let dst_exe = exe("rust-lld", target_compiler.host); builder.copy(&lld_install.join("bin").join(&src_exe), &libdir_bin.join(&dst_exe)); + // for `-Z gcc-ld=lld` + let gcc_ld_dir = libdir_bin.join("gcc-ld"); + t!(fs::create_dir(&gcc_ld_dir)); + builder.copy( + &lld_install.join("bin").join(&src_exe), + &gcc_ld_dir.join(exe("ld", target_compiler.host)), + ); } // Similarly, copy `llvm-dwp` into libdir for Split DWARF. Only copy it when the LLVM diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index aee3c8324bc..71ed0af4a7c 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -402,6 +402,10 @@ impl Step for Rustc { if builder.config.lld_enabled { let exe = exe("rust-lld", compiler.host); builder.copy(&src_dir.join(&exe), &dst_dir.join(&exe)); + // for `-Z gcc-ld=lld` + let gcc_lld_dir = dst_dir.join("gcc-ld"); + t!(fs::create_dir(&gcc_lld_dir)); + builder.copy(&src_dir.join(&exe), &gcc_lld_dir.join(&exe)); } // Copy over llvm-dwp if it's there diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 21c7dd11d24..347236c655a 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -923,6 +923,21 @@ impl Build { self.config.use_lld && !target.contains("msvc") } + fn lld_flags(&self, target: TargetSelection) -> impl Iterator<Item = String> { + let mut options = [None, None]; + + if self.config.use_lld { + if self.is_fuse_ld_lld(target) { + options[0] = Some("-Clink-arg=-fuse-ld=lld".to_string()); + } + + let threads = if target.contains("windows") { "/threads:1" } else { "--threads=1" }; + options[1] = Some(format!("-Clink-arg=-Wl,{}", threads)); + } + + std::array::IntoIter::new(options).flatten() + } + /// Returns if this target should statically link the C runtime, if specified fn crt_static(&self, target: TargetSelection) -> Option<bool> { if target.contains("pc-windows-msvc") { diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index cc7c143d474..fe4666effe6 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1131,19 +1131,6 @@ struct Compiletest { compare_mode: Option<&'static str>, } -impl Compiletest { - fn add_lld_flags(builder: &Builder<'_>, target: TargetSelection, flags: &mut Vec<String>) { - if builder.config.use_lld { - if builder.is_fuse_ld_lld(target) { - flags.push("-Clink-arg=-fuse-ld=lld".to_string()); - } - - let threads = if target.contains("windows") { "/threads:1" } else { "--threads=1" }; - flags.push(format!("-Clink-arg=-Wl,{}", threads)); - } - } -} - impl Step for Compiletest { type Output = (); @@ -1280,7 +1267,6 @@ note: if you're sure you want to do this, please open an issue as to why. In the } } flags.push(format!("-Cdebuginfo={}", builder.config.rust_debuginfo_level_tests)); - flags.push("-Zunstable-options".to_string()); flags.push(builder.config.cmd.rustc_args().join(" ")); if let Some(linker) = builder.linker(target) { @@ -1289,12 +1275,12 @@ note: if you're sure you want to do this, please open an issue as to why. In the let mut hostflags = flags.clone(); hostflags.push(format!("-Lnative={}", builder.test_helpers_out(compiler.host).display())); - Self::add_lld_flags(builder, compiler.host, &mut hostflags); + hostflags.extend(builder.lld_flags(compiler.host)); cmd.arg("--host-rustcflags").arg(hostflags.join(" ")); let mut targetflags = flags; targetflags.push(format!("-Lnative={}", builder.test_helpers_out(target).display())); - Self::add_lld_flags(builder, target, &mut targetflags); + targetflags.extend(builder.lld_flags(target)); cmd.arg("--target-rustcflags").arg(targetflags.join(" ")); cmd.arg("--docck-python").arg(builder.python()); @@ -1517,6 +1503,8 @@ note: if you're sure you want to do this, please open an issue as to why. In the cmd.env("BOOTSTRAP_CARGO", &builder.initial_cargo); + cmd.arg("--channel").arg(&builder.config.channel); + builder.ci_env.force_coloring_in_ci(&mut cmd); builder.info(&format!( diff --git a/src/ci/docker/run.sh b/src/ci/docker/run.sh index c2ff62e7481..3a47076722c 100755 --- a/src/ci/docker/run.sh +++ b/src/ci/docker/run.sh @@ -235,6 +235,7 @@ docker \ --env TOOLSTATE_REPO_ACCESS_TOKEN \ --env TOOLSTATE_REPO \ --env TOOLSTATE_PUBLISH \ + --env RUST_CI_OVERRIDE_RELEASE_CHANNEL \ --env CI_JOB_NAME="${CI_JOB_NAME-$IMAGE}" \ --init \ --rm \ diff --git a/src/ci/github-actions/ci.yml b/src/ci/github-actions/ci.yml index 343091cb779..e704071e401 100644 --- a/src/ci/github-actions/ci.yml +++ b/src/ci/github-actions/ci.yml @@ -407,6 +407,17 @@ jobs: - name: x86_64-gnu <<: *job-linux-xl + # This job ensures commits landing on nightly still pass the full + # test suite on the stable channel. There are some UI tests that + # depend on the channel being built (for example if they include the + # channel name on the output), and this builder prevents landing + # changes that would result in broken builds after a promotion. + - name: x86_64-gnu-stable + env: + IMAGE: x86_64-gnu + RUST_CI_OVERRIDE_RELEASE_CHANNEL: stable + <<: *job-linux-xl + - name: x86_64-gnu-aux <<: *job-linux-xl diff --git a/src/ci/run.sh b/src/ci/run.sh index 35f80a935c6..c5e225c7cd1 100755 --- a/src/ci/run.sh +++ b/src/ci/run.sh @@ -65,7 +65,11 @@ fi # Always set the release channel for bootstrap; this is normally not important (i.e., only dist # builds would seem to matter) but in practice bootstrap wants to know whether we're targeting # master, beta, or stable with a build to determine whether to run some checks (notably toolstate). -export RUST_RELEASE_CHANNEL="$(cat "${ci_dir}/channel")" +if [[ -z "${RUST_CI_OVERRIDE_RELEASE_CHANNEL+x}" ]]; then + export RUST_RELEASE_CHANNEL="$(cat "${ci_dir}/channel")" +else + export RUST_RELEASE_CHANNEL="${RUST_CI_OVERRIDE_RELEASE_CHANNEL}" +fi RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --release-channel=$RUST_RELEASE_CHANNEL" if [ "$DEPLOY$DEPLOY_ALT" = "1" ]; then diff --git a/src/doc/unstable-book/src/language-features/more-qualified-paths.md b/src/doc/unstable-book/src/language-features/more-qualified-paths.md new file mode 100644 index 00000000000..857af577a6c --- /dev/null +++ b/src/doc/unstable-book/src/language-features/more-qualified-paths.md @@ -0,0 +1,29 @@ +# `more_qualified_paths` + +The `more_qualified_paths` feature can be used in order to enable the +use of qualified paths in patterns. + +## Example + +```rust +#![feature(more_qualified_paths)] + +fn main() { + // destructure through a qualified path + let <Foo as A>::Assoc { br } = StructStruct { br: 2 }; +} + +struct StructStruct { + br: i8, +} + +struct Foo; + +trait A { + type Assoc; +} + +impl A for Foo { + type Assoc = StructStruct; +} +``` diff --git a/src/test/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir b/src/test/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir index 42b95b5c68c..296a459b99f 100644 --- a/src/test/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir +++ b/src/test/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir @@ -85,13 +85,13 @@ yields () bb8 (cleanup): { StorageDead(_10); // scope 2 at $DIR/generator-storage-dead-unwind.rs:27:15: 27:16 StorageDead(_9); // scope 2 at $DIR/generator-storage-dead-unwind.rs:27:16: 27:17 - goto -> bb10; // scope 2 at $DIR/generator-storage-dead-unwind.rs:1:1: 1:1 + goto -> bb10; // scope 2 at no-location } bb9 (cleanup): { StorageDead(_8); // scope 2 at $DIR/generator-storage-dead-unwind.rs:26:15: 26:16 StorageDead(_7); // scope 2 at $DIR/generator-storage-dead-unwind.rs:26:16: 26:17 - goto -> bb10; // scope 2 at $DIR/generator-storage-dead-unwind.rs:1:1: 1:1 + goto -> bb10; // scope 2 at no-location } bb10 (cleanup): { diff --git a/src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir b/src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir index 99c7ac8d5b7..db88f77bb63 100644 --- a/src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir +++ b/src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir @@ -43,7 +43,7 @@ fn main() -> () { _6 = const 1_i32; // scope 0 at $DIR/loop_test.rs:14:17: 14:18 FakeRead(ForLet(None), _6); // scope 0 at $DIR/loop_test.rs:14:13: 14:14 StorageDead(_6); // scope 0 at $DIR/loop_test.rs:16:5: 16:6 - goto -> bb3; // scope 0 at $DIR/loop_test.rs:1:1: 1:1 + goto -> bb3; // scope 0 at no-location } bb5 (cleanup): { diff --git a/src/test/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff b/src/test/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff index 3395cbfbdfb..feb25035ee0 100644 --- a/src/test/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff +++ b/src/test/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff @@ -94,8 +94,8 @@ _0 = const 3_i32; // scope 0 at $DIR/match-arm-scopes.rs:15:59: 15:60 StorageDead(_10); // scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73 StorageDead(_9); // scope 0 at $DIR/match-arm-scopes.rs:15:77: 15:78 -- goto -> bb23; // scope 0 at $DIR/match-arm-scopes.rs:1:1: 1:1 -+ goto -> bb20; // scope 0 at $DIR/match-arm-scopes.rs:1:1: 1:1 +- goto -> bb23; // scope 0 at no-location ++ goto -> bb20; // scope 0 at no-location } - bb10: { @@ -150,8 +150,8 @@ _0 = const 3_i32; // scope 0 at $DIR/match-arm-scopes.rs:15:59: 15:60 StorageDead(_13); // scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73 StorageDead(_12); // scope 0 at $DIR/match-arm-scopes.rs:15:77: 15:78 -- goto -> bb23; // scope 0 at $DIR/match-arm-scopes.rs:1:1: 1:1 -+ goto -> bb20; // scope 0 at $DIR/match-arm-scopes.rs:1:1: 1:1 +- goto -> bb23; // scope 0 at no-location ++ goto -> bb20; // scope 0 at no-location } - bb15: { diff --git a/src/test/mir-opt/while_storage.while_loop.PreCodegen.after.mir b/src/test/mir-opt/while_storage.while_loop.PreCodegen.after.mir index b91aae054de..bf9c2d138a0 100644 --- a/src/test/mir-opt/while_storage.while_loop.PreCodegen.after.mir +++ b/src/test/mir-opt/while_storage.while_loop.PreCodegen.after.mir @@ -40,7 +40,7 @@ fn while_loop(_1: bool) -> () { bb4: { StorageDead(_4); // scope 0 at $DIR/while-storage.rs:13:9: 13:10 - goto -> bb6; // scope 0 at $DIR/while-storage.rs:1:1: 1:1 + goto -> bb6; // scope 0 at no-location } bb5: { diff --git a/src/test/run-make/issue-71519/Makefile b/src/test/run-make/issue-71519/Makefile new file mode 100644 index 00000000000..636665ec1d0 --- /dev/null +++ b/src/test/run-make/issue-71519/Makefile @@ -0,0 +1,6 @@ +-include ../../run-make-fulldeps/tools.mk + +# needs-rust-lld +all: + RUSTC_LOG=rustc_codegen_ssa::back::link=info $(RUSTC) -Z gcc-ld=lld -C link-args=-Wl,-v main.rs 2> $(TMPDIR)/output.txt + $(CGREP) -e "^LLD [0-9]+\.[0-9]+\.[0-9]+" < $(TMPDIR)/output.txt diff --git a/src/test/run-make/issue-71519/main.rs b/src/test/run-make/issue-71519/main.rs new file mode 100644 index 00000000000..f8d09e89753 --- /dev/null +++ b/src/test/run-make/issue-71519/main.rs @@ -0,0 +1,4 @@ +// test linking using cc with rust-lld injected into search path as ld +// see rust-lang/rust#71519 for more info + +fn main() {} diff --git a/src/test/rustdoc-ui/run-directory.rs b/src/test/rustdoc-ui/run-directory.rs index 78431c0e80b..0d432c1e699 100644 --- a/src/test/rustdoc-ui/run-directory.rs +++ b/src/test/rustdoc-ui/run-directory.rs @@ -2,8 +2,8 @@ // revisions: correct incorrect // check-pass -// [correct]compile-flags:--test --test-run-directory={{src-base}} -// [incorrect]compile-flags:--test --test-run-directory={{src-base}}/coverage +// [correct]compile-flags:--test --test-run-directory={{src-base}} -Zunstable-options +// [incorrect]compile-flags:--test --test-run-directory={{src-base}}/coverage -Zunstable-options // normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR" // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" diff --git a/src/test/rustdoc-ui/wasm-safe.rs b/src/test/rustdoc-ui/wasm-safe.rs index 80b15ace0ee..ba971342b46 100644 --- a/src/test/rustdoc-ui/wasm-safe.rs +++ b/src/test/rustdoc-ui/wasm-safe.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(wasm_target_feature)] - #[cfg(any(target_arch = "wasm32", doc))] #[target_feature(enable = "simd128")] pub fn foo() {} diff --git a/src/test/rustdoc/intra-doc/field.rs b/src/test/rustdoc/intra-doc/field.rs index c67c40a77ed..00114348924 100644 --- a/src/test/rustdoc/intra-doc/field.rs +++ b/src/test/rustdoc/intra-doc/field.rs @@ -1,4 +1,4 @@ -// @has field/index.html '//a[@href="https://doc.rust-lang.org/nightly/core/ops/range/struct.Range.html#structfield.start"]' 'start' -// @has field/index.html '//a[@href="https://doc.rust-lang.org/nightly/std/io/error/enum.ErrorKind.html#variant.NotFound"]' 'not_found' +// @has field/index.html '//a[@href="{{channel}}/core/ops/range/struct.Range.html#structfield.start"]' 'start' +// @has field/index.html '//a[@href="{{channel}}/std/io/error/enum.ErrorKind.html#variant.NotFound"]' 'not_found' //! [start][std::ops::Range::start] //! [not_found][std::io::ErrorKind::NotFound] diff --git a/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref_self.rs b/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref_self.rs index f58446d5592..25f6490aa35 100644 --- a/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref_self.rs +++ b/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref_self.rs @@ -1,3 +1,4 @@ +// compile-flags: -Z unstable-options // NOTE: This test doesn't actually require `fulldeps` // so we could instead use it as an `ui` test. // diff --git a/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref_self.stderr b/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref_self.stderr index b846b30f4ed..15a06e721dd 100644 --- a/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref_self.stderr +++ b/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref_self.stderr @@ -1,17 +1,17 @@ error: passing `TyCtxt<'tcx>` by reference - --> $DIR/pass_ty_by_ref_self.rs:17:15 + --> $DIR/pass_ty_by_ref_self.rs:18:15 | LL | fn by_ref(&self) {} | ^^^^^ help: try passing by value: `TyCtxt<'tcx>` | note: the lint level is defined here - --> $DIR/pass_ty_by_ref_self.rs:7:9 + --> $DIR/pass_ty_by_ref_self.rs:8:9 | LL | #![deny(rustc::ty_pass_by_reference)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: passing `Ty<'tcx>` by reference - --> $DIR/pass_ty_by_ref_self.rs:30:21 + --> $DIR/pass_ty_by_ref_self.rs:31:21 | LL | fn by_ref(self: &Ty<'tcx>) {} | ^^^^^^^^^ help: try passing by value: `Ty<'tcx>` diff --git a/src/test/ui-fulldeps/pprust-expr-roundtrip.rs b/src/test/ui-fulldeps/pprust-expr-roundtrip.rs index ac2d29c9caf..091c834eccf 100644 --- a/src/test/ui-fulldeps/pprust-expr-roundtrip.rs +++ b/src/test/ui-fulldeps/pprust-expr-roundtrip.rs @@ -19,45 +19,35 @@ #![feature(rustc_private)] +extern crate rustc_ast; extern crate rustc_ast_pretty; extern crate rustc_data_structures; -extern crate rustc_ast; extern crate rustc_parse; extern crate rustc_session; extern crate rustc_span; +use rustc_ast::mut_visit::{self, visit_clobber, MutVisitor}; +use rustc_ast::ptr::P; +use rustc_ast::*; use rustc_ast_pretty::pprust; use rustc_data_structures::thin_vec::ThinVec; use rustc_parse::new_parser_from_source_str; use rustc_session::parse::ParseSess; -use rustc_span::source_map::{Spanned, DUMMY_SP, FileName}; use rustc_span::source_map::FilePathMapping; +use rustc_span::source_map::{FileName, Spanned, DUMMY_SP}; use rustc_span::symbol::Ident; -use rustc_ast::*; -use rustc_ast::mut_visit::{self, MutVisitor, visit_clobber}; -use rustc_ast::ptr::P; fn parse_expr(ps: &ParseSess, src: &str) -> Option<P<Expr>> { let src_as_string = src.to_string(); - let mut p = new_parser_from_source_str( - ps, - FileName::Custom(src_as_string.clone()), - src_as_string, - ); + let mut p = + new_parser_from_source_str(ps, FileName::Custom(src_as_string.clone()), src_as_string); p.parse_expr().map_err(|mut e| e.cancel()).ok() } - // Helper functions for building exprs fn expr(kind: ExprKind) -> P<Expr> { - P(Expr { - id: DUMMY_NODE_ID, - kind, - span: DUMMY_SP, - attrs: ThinVec::new(), - tokens: None - }) + P(Expr { id: DUMMY_NODE_ID, kind, span: DUMMY_SP, attrs: ThinVec::new(), tokens: None }) } fn make_x() -> P<Expr> { @@ -83,11 +73,13 @@ fn iter_exprs(depth: usize, f: &mut dyn FnMut(P<Expr>)) { 1 => iter_exprs(depth - 1, &mut |e| g(ExprKind::Call(e, vec![]))), 2 => { let seg = PathSegment::from_ident(Ident::from_str("x")); - iter_exprs(depth - 1, &mut |e| g(ExprKind::MethodCall( - seg.clone(), vec![e, make_x()], DUMMY_SP))); - iter_exprs(depth - 1, &mut |e| g(ExprKind::MethodCall( - seg.clone(), vec![make_x(), e], DUMMY_SP))); - }, + iter_exprs(depth - 1, &mut |e| { + g(ExprKind::MethodCall(seg.clone(), vec![e, make_x()], DUMMY_SP)) + }); + iter_exprs(depth - 1, &mut |e| { + g(ExprKind::MethodCall(seg.clone(), vec![make_x(), e], DUMMY_SP)) + }); + } 3..=8 => { let op = Spanned { span: DUMMY_SP, @@ -99,14 +91,14 @@ fn iter_exprs(depth: usize, f: &mut dyn FnMut(P<Expr>)) { 7 => BinOpKind::Or, 8 => BinOpKind::Lt, _ => unreachable!(), - } + }, }; iter_exprs(depth - 1, &mut |e| g(ExprKind::Binary(op, e, make_x()))); iter_exprs(depth - 1, &mut |e| g(ExprKind::Binary(op, make_x(), e))); - }, + } 9 => { iter_exprs(depth - 1, &mut |e| g(ExprKind::Unary(UnOp::Deref, e))); - }, + } 10 => { let block = P(Block { stmts: Vec::new(), @@ -116,67 +108,66 @@ fn iter_exprs(depth: usize, f: &mut dyn FnMut(P<Expr>)) { tokens: None, }); iter_exprs(depth - 1, &mut |e| g(ExprKind::If(e, block.clone(), None))); - }, + } 11 => { - let decl = P(FnDecl { - inputs: vec![], - output: FnRetTy::Default(DUMMY_SP), + let decl = P(FnDecl { inputs: vec![], output: FnRetTy::Default(DUMMY_SP) }); + iter_exprs(depth - 1, &mut |e| { + g(ExprKind::Closure( + CaptureBy::Value, + Async::No, + Movability::Movable, + decl.clone(), + e, + DUMMY_SP, + )) }); - iter_exprs(depth - 1, &mut |e| g( - ExprKind::Closure(CaptureBy::Value, - Async::No, - Movability::Movable, - decl.clone(), - e, - DUMMY_SP))); - }, + } 12 => { iter_exprs(depth - 1, &mut |e| g(ExprKind::Assign(e, make_x(), DUMMY_SP))); iter_exprs(depth - 1, &mut |e| g(ExprKind::Assign(make_x(), e, DUMMY_SP))); - }, + } 13 => { iter_exprs(depth - 1, &mut |e| g(ExprKind::Field(e, Ident::from_str("f")))); - }, + } 14 => { - iter_exprs(depth - 1, &mut |e| g(ExprKind::Range( - Some(e), Some(make_x()), RangeLimits::HalfOpen))); - iter_exprs(depth - 1, &mut |e| g(ExprKind::Range( - Some(make_x()), Some(e), RangeLimits::HalfOpen))); - }, + iter_exprs(depth - 1, &mut |e| { + g(ExprKind::Range(Some(e), Some(make_x()), RangeLimits::HalfOpen)) + }); + iter_exprs(depth - 1, &mut |e| { + g(ExprKind::Range(Some(make_x()), Some(e), RangeLimits::HalfOpen)) + }); + } 15 => { - iter_exprs( - depth - 1, - &mut |e| g(ExprKind::AddrOf(BorrowKind::Ref, Mutability::Not, e)), - ); - }, + iter_exprs(depth - 1, &mut |e| { + g(ExprKind::AddrOf(BorrowKind::Ref, Mutability::Not, e)) + }); + } 16 => { g(ExprKind::Ret(None)); iter_exprs(depth - 1, &mut |e| g(ExprKind::Ret(Some(e)))); - }, + } 17 => { let path = Path::from_ident(Ident::from_str("S")); g(ExprKind::Struct(P(StructExpr { - path, fields: vec![], rest: StructRest::Base(make_x()) + qself: None, + path, + fields: vec![], + rest: StructRest::Base(make_x()), }))); - }, + } 18 => { iter_exprs(depth - 1, &mut |e| g(ExprKind::Try(e))); - }, + } 19 => { - let pat = P(Pat { - id: DUMMY_NODE_ID, - kind: PatKind::Wild, - span: DUMMY_SP, - tokens: None, - }); + let pat = + P(Pat { id: DUMMY_NODE_ID, kind: PatKind::Wild, span: DUMMY_SP, tokens: None }); iter_exprs(depth - 1, &mut |e| g(ExprKind::Let(pat.clone(), e))) - }, + } _ => panic!("bad counter value in iter_exprs"), } } } - // Folders for manipulating the placement of `Paren` nodes. See below for why this is needed. /// `MutVisitor` that removes all `ExprKind::Paren` nodes. @@ -192,7 +183,6 @@ impl MutVisitor for RemoveParens { } } - /// `MutVisitor` that inserts `ExprKind::Paren` nodes around every `Expr`. struct AddParens; @@ -205,7 +195,7 @@ impl MutVisitor for AddParens { kind: ExprKind::Paren(e), span: DUMMY_SP, attrs: ThinVec::new(), - tokens: None + tokens: None, }) }); } @@ -238,9 +228,12 @@ fn run() { RemoveParens.visit_expr(&mut parsed); AddParens.visit_expr(&mut parsed); let text2 = pprust::expr_to_string(&parsed); - assert!(text1 == text2, - "exprs are not equal:\n e = {:?}\n parsed = {:?}", - text1, text2); + assert!( + text1 == text2, + "exprs are not equal:\n e = {:?}\n parsed = {:?}", + text1, + text2 + ); } }); } diff --git a/src/test/ui-fulldeps/session-derive-errors.rs b/src/test/ui-fulldeps/session-derive-errors.rs index 7967b32a4a4..140aaad3b38 100644 --- a/src/test/ui-fulldeps/session-derive-errors.rs +++ b/src/test/ui-fulldeps/session-derive-errors.rs @@ -1,6 +1,12 @@ // check-fail // Tests error conditions for specifying diagnostics using #[derive(SessionDiagnostic)] +// The proc_macro2 crate handles spans differently when on beta/stable release rather than nightly, +// changing the output of this test. Since SessionDiagnostic is strictly internal to the compiler +// the test is just ignored on stable and beta: +// ignore-beta +// ignore-stable + #![feature(rustc_private)] #![crate_type = "lib"] diff --git a/src/test/ui-fulldeps/session-derive-errors.stderr b/src/test/ui-fulldeps/session-derive-errors.stderr index c6c3765b80d..2f1debe25b7 100644 --- a/src/test/ui-fulldeps/session-derive-errors.stderr +++ b/src/test/ui-fulldeps/session-derive-errors.stderr @@ -1,5 +1,5 @@ error: `#[derive(SessionDiagnostic)]` can only be used on structs - --> $DIR/session-derive-errors.rs:28:1 + --> $DIR/session-derive-errors.rs:34:1 | LL | / #[error = "E0123"] LL | | @@ -10,31 +10,31 @@ LL | | } | |_^ error: `#[label = ...]` is not a valid SessionDiagnostic struct attribute - --> $DIR/session-derive-errors.rs:37:1 + --> $DIR/session-derive-errors.rs:43:1 | LL | #[label = "This is in the wrong place"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `#[suggestion = ...]` is not a valid SessionDiagnostic field attribute - --> $DIR/session-derive-errors.rs:44:5 + --> $DIR/session-derive-errors.rs:50:5 | LL | #[suggestion = "this is the wrong kind of attribute"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `error` specified multiple times - --> $DIR/session-derive-errors.rs:52:11 + --> $DIR/session-derive-errors.rs:58:11 | LL | #[error = "E0456"] | ^^^^^^^ error: `lint` specified when `error` was already specified - --> $DIR/session-derive-errors.rs:58:10 + --> $DIR/session-derive-errors.rs:64:10 | LL | #[lint = "some_useful_lint"] | ^^^^^^^^^^^^^^^^^^ error: `code` not specified - --> $DIR/session-derive-errors.rs:67:1 + --> $DIR/session-derive-errors.rs:73:1 | LL | struct ErrorCodeNotProvided {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -42,19 +42,19 @@ LL | struct ErrorCodeNotProvided {} = help: use the [code = "..."] attribute to set this diagnostic's error code error: the `#[message = "..."]` attribute can only be applied to fields of type Span - --> $DIR/session-derive-errors.rs:95:5 + --> $DIR/session-derive-errors.rs:101:5 | LL | #[message = "this message is applied to a String field"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `name` doesn't refer to a field on this type - --> $DIR/session-derive-errors.rs:102:1 + --> $DIR/session-derive-errors.rs:108:1 | LL | #[message = "This error has a field, and references {name}"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: invalid format string: expected `'}'` but string was terminated - --> $DIR/session-derive-errors.rs:110:1 + --> $DIR/session-derive-errors.rs:116:1 | LL | #[error = "E0123"] | - because of this opening brace @@ -65,7 +65,7 @@ LL | #[message = "This is missing a closing brace: {name"] = note: this error originates in the derive macro `SessionDiagnostic` (in Nightly builds, run with -Z macro-backtrace for more info) error: invalid format string: unmatched `}` found - --> $DIR/session-derive-errors.rs:119:1 + --> $DIR/session-derive-errors.rs:125:1 | LL | #[message = "This is missing an opening brace: name}"] | ^ unmatched `}` in format string @@ -74,25 +74,25 @@ LL | #[message = "This is missing an opening brace: name}"] = note: this error originates in the derive macro `SessionDiagnostic` (in Nightly builds, run with -Z macro-backtrace for more info) error: The `#[label = ...]` attribute can only be applied to fields of type Span - --> $DIR/session-derive-errors.rs:138:5 + --> $DIR/session-derive-errors.rs:144:5 | LL | #[label = "See here"] | ^^^^^^^^^^^^^^^^^^^^^ error: `nonsense` is not a valid key for `#[suggestion(...)]` - --> $DIR/session-derive-errors.rs:163:18 + --> $DIR/session-derive-errors.rs:169:18 | LL | #[suggestion(nonsense = "This is nonsense")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `msg` is not a valid key for `#[suggestion(...)]` - --> $DIR/session-derive-errors.rs:171:18 + --> $DIR/session-derive-errors.rs:177:18 | LL | #[suggestion(msg = "This is a suggestion")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing suggestion message - --> $DIR/session-derive-errors.rs:179:7 + --> $DIR/session-derive-errors.rs:185:7 | LL | #[suggestion(code = "This is suggested code")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -100,7 +100,7 @@ LL | #[suggestion(code = "This is suggested code")] = help: provide a suggestion message using #[suggestion(message = "...")] error: wrong field type for suggestion - --> $DIR/session-derive-errors.rs:194:5 + --> $DIR/session-derive-errors.rs:200:5 | LL | / #[suggestion(message = "This is a message", code = "This is suggested code")] LL | | @@ -110,7 +110,7 @@ LL | | suggestion: Applicability, = help: #[suggestion(...)] should be applied to fields of type Span or (Span, Applicability) error: type of field annotated with `#[suggestion(...)]` contains more than one Span - --> $DIR/session-derive-errors.rs:209:5 + --> $DIR/session-derive-errors.rs:215:5 | LL | / #[suggestion(message = "This is a message", code = "This is suggested code")] LL | | @@ -118,7 +118,7 @@ LL | | suggestion: (Span, Span, Applicability), | |___________________________________________^ error: type of field annotated with `#[suggestion(...)]` contains more than one Applicability - --> $DIR/session-derive-errors.rs:217:5 + --> $DIR/session-derive-errors.rs:223:5 | LL | / #[suggestion(message = "This is a message", code = "This is suggested code")] LL | | @@ -126,7 +126,7 @@ LL | | suggestion: (Applicability, Applicability, Span), | |____________________________________________________^ error: invalid annotation list `#[label(...)]` - --> $DIR/session-derive-errors.rs:225:7 + --> $DIR/session-derive-errors.rs:231:7 | LL | #[label("wrong kind of annotation for label")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/annotate-snippet/missing-type.rs b/src/test/ui/annotate-snippet/missing-type.rs index d0814a9537d..b0d8b5fbaf2 100644 --- a/src/test/ui/annotate-snippet/missing-type.rs +++ b/src/test/ui/annotate-snippet/missing-type.rs @@ -1,4 +1,4 @@ -// compile-flags: --error-format human-annotate-rs +// compile-flags: --error-format human-annotate-rs -Z unstable-options pub fn main() { let x: Iter; //~ ERROR cannot find type `Iter` in this scope diff --git a/src/test/ui/annotate-snippet/multispan.rs b/src/test/ui/annotate-snippet/multispan.rs index 325252d7716..69d7e1a9d11 100644 --- a/src/test/ui/annotate-snippet/multispan.rs +++ b/src/test/ui/annotate-snippet/multispan.rs @@ -1,5 +1,5 @@ // aux-build:multispan.rs -// compile-flags: --error-format human-annotate-rs +// compile-flags: --error-format human-annotate-rs -Z unstable-options #![feature(proc_macro_hygiene)] diff --git a/src/test/ui/associated-types/associated-type-destructuring-assignment.rs b/src/test/ui/associated-types/associated-type-destructuring-assignment.rs new file mode 100644 index 00000000000..fea7c7a383f --- /dev/null +++ b/src/test/ui/associated-types/associated-type-destructuring-assignment.rs @@ -0,0 +1,11 @@ +// check-pass + +#![feature(destructuring_assignment)] +#![feature(more_qualified_paths)] + +enum E { V() } + +fn main() { + <E>::V() = E::V(); // OK, destructuring assignment + <E>::V {} = E::V(); // OK, destructuring assignment +} diff --git a/src/test/ui/associated-types/associated-type-macro.rs b/src/test/ui/associated-types/associated-type-macro.rs new file mode 100644 index 00000000000..22b5bca4010 --- /dev/null +++ b/src/test/ui/associated-types/associated-type-macro.rs @@ -0,0 +1,4 @@ +fn main() { + #[cfg(FALSE)] + <() as module>::mac!(); //~ ERROR macros cannot use qualified paths +} diff --git a/src/test/ui/associated-types/associated-type-macro.stderr b/src/test/ui/associated-types/associated-type-macro.stderr new file mode 100644 index 00000000000..6a4cf99c474 --- /dev/null +++ b/src/test/ui/associated-types/associated-type-macro.stderr @@ -0,0 +1,8 @@ +error: macros cannot use qualified paths + --> $DIR/associated-type-macro.rs:3:5 + | +LL | <() as module>::mac!(); + | ^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/associated-types/associated-type-struct-construction.rs b/src/test/ui/associated-types/associated-type-struct-construction.rs new file mode 100644 index 00000000000..f8f8048fb71 --- /dev/null +++ b/src/test/ui/associated-types/associated-type-struct-construction.rs @@ -0,0 +1,24 @@ +// Make sure that users can construct structs through associated types +// in both expressions and patterns + +#![feature(more_qualified_paths)] + +// check-pass +fn main() { + let <Foo as A>::Assoc { br } = <Foo as A>::Assoc { br: 2 }; + assert!(br == 2); +} + +struct StructStruct { + br: i8, +} + +struct Foo; + +trait A { + type Assoc; +} + +impl A for Foo { + type Assoc = StructStruct; +} diff --git a/src/test/ui/associated-types/associated-type-tuple-struct-construction.rs b/src/test/ui/associated-types/associated-type-tuple-struct-construction.rs new file mode 100644 index 00000000000..d5809ecd55d --- /dev/null +++ b/src/test/ui/associated-types/associated-type-tuple-struct-construction.rs @@ -0,0 +1,24 @@ +// Users cannot yet construct structs through associated types +// in both expressions and patterns + +#![feature(more_qualified_paths)] + +fn main() { + let <Foo as A>::Assoc(n) = <Foo as A>::Assoc(2); + //~^ ERROR expected method or associated constant, found associated type + //~| ERROR expected method or associated constant, found associated type + assert!(n == 2); +} + +struct TupleStruct(i8); + +struct Foo; + + +trait A { + type Assoc; +} + +impl A for Foo { + type Assoc = TupleStruct; +} diff --git a/src/test/ui/associated-types/associated-type-tuple-struct-construction.stderr b/src/test/ui/associated-types/associated-type-tuple-struct-construction.stderr new file mode 100644 index 00000000000..bca7deeb512 --- /dev/null +++ b/src/test/ui/associated-types/associated-type-tuple-struct-construction.stderr @@ -0,0 +1,19 @@ +error[E0575]: expected method or associated constant, found associated type `A::Assoc` + --> $DIR/associated-type-tuple-struct-construction.rs:7:32 + | +LL | let <Foo as A>::Assoc(n) = <Foo as A>::Assoc(2); + | ^^^^^^^^^^^^^^^^^ + | + = note: can't use a type alias as a constructor + +error[E0575]: expected method or associated constant, found associated type `A::Assoc` + --> $DIR/associated-type-tuple-struct-construction.rs:7:9 + | +LL | let <Foo as A>::Assoc(n) = <Foo as A>::Assoc(2); + | ^^^^^^^^^^^^^^^^^ + | + = note: can't use a type alias as a constructor + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0575`. diff --git a/src/test/ui/borrowck/issue-85765.rs b/src/test/ui/borrowck/issue-85765.rs new file mode 100644 index 00000000000..b82e0298158 --- /dev/null +++ b/src/test/ui/borrowck/issue-85765.rs @@ -0,0 +1,8 @@ +fn main() { + let mut test = Vec::new(); + let rofl: &Vec<Vec<i32>> = &mut test; + //~^ HELP consider changing this to be a mutable reference + rofl.push(Vec::new()); + //~^ ERROR cannot borrow `*rofl` as mutable, as it is behind a `&` reference + //~| NOTE `rofl` is a `&` reference, so the data it refers to cannot be borrowed as mutable +} diff --git a/src/test/ui/borrowck/issue-85765.stderr b/src/test/ui/borrowck/issue-85765.stderr new file mode 100644 index 00000000000..863c2e8eccc --- /dev/null +++ b/src/test/ui/borrowck/issue-85765.stderr @@ -0,0 +1,12 @@ +error[E0596]: cannot borrow `*rofl` as mutable, as it is behind a `&` reference + --> $DIR/issue-85765.rs:5:5 + | +LL | let rofl: &Vec<Vec<i32>> = &mut test; + | ---- help: consider changing this to be a mutable reference: `&mut Vec<Vec<i32>>` +LL | +LL | rofl.push(Vec::new()); + | ^^^^ `rofl` is a `&` reference, so the data it refers to cannot be borrowed as mutable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0596`. diff --git a/src/test/ui/const-generics/defaults/intermixed-lifetime.min.stderr b/src/test/ui/const-generics/defaults/intermixed-lifetime.min.stderr index 985e7b655ec..29d835e36c6 100644 --- a/src/test/ui/const-generics/defaults/intermixed-lifetime.min.stderr +++ b/src/test/ui/const-generics/defaults/intermixed-lifetime.min.stderr @@ -2,13 +2,13 @@ error: lifetime parameters must be declared prior to const parameters --> $DIR/intermixed-lifetime.rs:7:28 | LL | struct Foo<const N: usize, 'a, T = u32>(&'a (), T); - | -----------------^^---------- help: reorder the parameters: lifetimes, then types, then consts: `<'a, const N: usize, T = u32>` + | -----------------^^---------- help: reorder the parameters: lifetimes, then consts and types: `<'a, const N: usize, T = u32>` error: lifetime parameters must be declared prior to type parameters --> $DIR/intermixed-lifetime.rs:10:37 | LL | struct Bar<const N: usize, T = u32, 'a>(&'a (), T); - | --------------------------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, const N: usize, T = u32>` + | --------------------------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, const N: usize, T = u32>` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/defaults/mismatch.full.stderr b/src/test/ui/const-generics/defaults/mismatch.full.stderr index be4f364d8ee..4aa8401ab22 100644 --- a/src/test/ui/const-generics/defaults/mismatch.full.stderr +++ b/src/test/ui/const-generics/defaults/mismatch.full.stderr @@ -5,9 +5,12 @@ LL | let e: Example::<13> = (); | ------------- ^^ expected struct `Example`, found `()` | | | expected due to this + | + = note: expected struct `Example` + found unit type `()` error[E0308]: mismatched types - --> $DIR/mismatch.rs:14:34 + --> $DIR/mismatch.rs:15:34 | LL | let e: Example2::<u32, 13> = (); | ------------------- ^^ expected struct `Example2`, found `()` @@ -18,7 +21,7 @@ LL | let e: Example2::<u32, 13> = (); found unit type `()` error[E0308]: mismatched types - --> $DIR/mismatch.rs:16:34 + --> $DIR/mismatch.rs:18:34 | LL | let e: Example3::<13, u32> = (); | ------------------- ^^ expected struct `Example3`, found `()` @@ -29,7 +32,7 @@ LL | let e: Example3::<13, u32> = (); found unit type `()` error[E0308]: mismatched types - --> $DIR/mismatch.rs:18:28 + --> $DIR/mismatch.rs:21:28 | LL | let e: Example3::<7> = (); | ------------- ^^ expected struct `Example3`, found `()` @@ -40,12 +43,15 @@ LL | let e: Example3::<7> = (); found unit type `()` error[E0308]: mismatched types - --> $DIR/mismatch.rs:22:28 + --> $DIR/mismatch.rs:24:28 | LL | let e: Example4::<7> = (); | ------------- ^^ expected struct `Example4`, found `()` | | | expected due to this + | + = note: expected struct `Example4<7_usize>` + found unit type `()` error: aborting due to 5 previous errors diff --git a/src/test/ui/const-generics/defaults/mismatch.min.stderr b/src/test/ui/const-generics/defaults/mismatch.min.stderr index be4f364d8ee..4aa8401ab22 100644 --- a/src/test/ui/const-generics/defaults/mismatch.min.stderr +++ b/src/test/ui/const-generics/defaults/mismatch.min.stderr @@ -5,9 +5,12 @@ LL | let e: Example::<13> = (); | ------------- ^^ expected struct `Example`, found `()` | | | expected due to this + | + = note: expected struct `Example` + found unit type `()` error[E0308]: mismatched types - --> $DIR/mismatch.rs:14:34 + --> $DIR/mismatch.rs:15:34 | LL | let e: Example2::<u32, 13> = (); | ------------------- ^^ expected struct `Example2`, found `()` @@ -18,7 +21,7 @@ LL | let e: Example2::<u32, 13> = (); found unit type `()` error[E0308]: mismatched types - --> $DIR/mismatch.rs:16:34 + --> $DIR/mismatch.rs:18:34 | LL | let e: Example3::<13, u32> = (); | ------------------- ^^ expected struct `Example3`, found `()` @@ -29,7 +32,7 @@ LL | let e: Example3::<13, u32> = (); found unit type `()` error[E0308]: mismatched types - --> $DIR/mismatch.rs:18:28 + --> $DIR/mismatch.rs:21:28 | LL | let e: Example3::<7> = (); | ------------- ^^ expected struct `Example3`, found `()` @@ -40,12 +43,15 @@ LL | let e: Example3::<7> = (); found unit type `()` error[E0308]: mismatched types - --> $DIR/mismatch.rs:22:28 + --> $DIR/mismatch.rs:24:28 | LL | let e: Example4::<7> = (); | ------------- ^^ expected struct `Example4`, found `()` | | | expected due to this + | + = note: expected struct `Example4<7_usize>` + found unit type `()` error: aborting due to 5 previous errors diff --git a/src/test/ui/const-generics/defaults/mismatch.rs b/src/test/ui/const-generics/defaults/mismatch.rs index 68a640c0a08..9d9a8793aaa 100644 --- a/src/test/ui/const-generics/defaults/mismatch.rs +++ b/src/test/ui/const-generics/defaults/mismatch.rs @@ -11,14 +11,17 @@ pub struct Example4<const N: usize=13, const M: usize=4>; fn main() { let e: Example::<13> = (); //~^ Error: mismatched types + //~| expected struct `Example` let e: Example2::<u32, 13> = (); //~^ Error: mismatched types + //~| expected struct `Example2` let e: Example3::<13, u32> = (); //~^ Error: mismatched types + //~| expected struct `Example3` let e: Example3::<7> = (); //~^ Error: mismatched types - // FIXME(const_generics_defaults): There should be a note for the error below, but it is - // missing. + //~| expected struct `Example3<7_usize>` let e: Example4::<7> = (); //~^ Error: mismatched types + //~| expected struct `Example4<7_usize>` } diff --git a/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.rs b/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.rs new file mode 100644 index 00000000000..933eacb312d --- /dev/null +++ b/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.rs @@ -0,0 +1,5 @@ +#![feature(const_generics_defaults)] +struct Foo<const M: usize = 10, 'a>(&'a u32); +//~^ Error lifetime parameters must be declared prior to const parameters + +fn main() {} diff --git a/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.stderr b/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.stderr new file mode 100644 index 00000000000..f50653fe9a1 --- /dev/null +++ b/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.stderr @@ -0,0 +1,8 @@ +error: lifetime parameters must be declared prior to const parameters + --> $DIR/param-order-err-pretty-prints-default.rs:2:33 + | +LL | struct Foo<const M: usize = 10, 'a>(&'a u32); + | ----------------------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, const M: usize = 10>` + +error: aborting due to previous error + diff --git a/src/test/ui/const-ptr/out_of_bounds_read.rs b/src/test/ui/const-ptr/out_of_bounds_read.rs deleted file mode 100644 index 183aa9e5122..00000000000 --- a/src/test/ui/const-ptr/out_of_bounds_read.rs +++ /dev/null @@ -1,16 +0,0 @@ -// error-pattern: any use of this value will cause an error - -#![feature(const_ptr_read)] -#![feature(const_ptr_offset)] - -fn main() { - use std::ptr; - - const DATA: [u32; 1] = [42]; - - const PAST_END_PTR: *const u32 = unsafe { DATA.as_ptr().add(1) }; - - const _READ: u32 = unsafe { ptr::read(PAST_END_PTR) }; - const _CONST_READ: u32 = unsafe { PAST_END_PTR.read() }; - const _MUT_READ: u32 = unsafe { (PAST_END_PTR as *mut u32).read() }; -} diff --git a/src/test/ui/const-ptr/out_of_bounds_read.stderr b/src/test/ui/const-ptr/out_of_bounds_read.stderr deleted file mode 100644 index 6c4092e3e5c..00000000000 --- a/src/test/ui/const-ptr/out_of_bounds_read.stderr +++ /dev/null @@ -1,59 +0,0 @@ -error: any use of this value will cause an error - --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL - | -LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | memory access failed: pointer must be in-bounds at offset 8, but is outside bounds of alloc6 which has size 4 - | inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - | inside `_READ` at $DIR/out_of_bounds_read.rs:13:33 - | - ::: $DIR/out_of_bounds_read.rs:13:5 - | -LL | const _READ: u32 = unsafe { ptr::read(PAST_END_PTR) }; - | ------------------------------------------------------ - | - = note: `#[deny(const_err)]` on by default - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> - -error: any use of this value will cause an error - --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL - | -LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | memory access failed: pointer must be in-bounds at offset 8, but is outside bounds of alloc6 which has size 4 - | inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - | inside `ptr::const_ptr::<impl *const u32>::read` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | inside `_CONST_READ` at $DIR/out_of_bounds_read.rs:14:39 - | - ::: $DIR/out_of_bounds_read.rs:14:5 - | -LL | const _CONST_READ: u32 = unsafe { PAST_END_PTR.read() }; - | -------------------------------------------------------- - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> - -error: any use of this value will cause an error - --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL - | -LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | memory access failed: pointer must be in-bounds at offset 8, but is outside bounds of alloc6 which has size 4 - | inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - | inside `ptr::mut_ptr::<impl *mut u32>::read` at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - | inside `_MUT_READ` at $DIR/out_of_bounds_read.rs:15:37 - | - ::: $DIR/out_of_bounds_read.rs:15:5 - | -LL | const _MUT_READ: u32 = unsafe { (PAST_END_PTR as *mut u32).read() }; - | -------------------------------------------------------------------- - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> - -error: aborting due to 3 previous errors - diff --git a/src/test/ui/consts/const-needs_drop-monomorphic.rs b/src/test/ui/consts/const-needs_drop-monomorphic.rs new file mode 100644 index 00000000000..9f66e3cfa23 --- /dev/null +++ b/src/test/ui/consts/const-needs_drop-monomorphic.rs @@ -0,0 +1,17 @@ +// Check that evaluation of needs_drop<T> fails when T is not monomorphic. +#![feature(const_generics)] +#![allow(const_evaluatable_unchecked)] +#![allow(incomplete_features)] + +struct Bool<const B: bool> {} +impl Bool<true> { + fn assert() {} +} +fn f<T>() { + Bool::<{ std::mem::needs_drop::<T>() }>::assert(); + //~^ ERROR no function or associated item named `assert` found + //~| ERROR constant expression depends on a generic parameter +} +fn main() { + f::<u32>(); +} diff --git a/src/test/ui/consts/const-needs_drop-monomorphic.stderr b/src/test/ui/consts/const-needs_drop-monomorphic.stderr new file mode 100644 index 00000000000..0770d06e15b --- /dev/null +++ b/src/test/ui/consts/const-needs_drop-monomorphic.stderr @@ -0,0 +1,20 @@ +error[E0599]: no function or associated item named `assert` found for struct `Bool<{ std::mem::needs_drop::<T>() }>` in the current scope + --> $DIR/const-needs_drop-monomorphic.rs:11:46 + | +LL | struct Bool<const B: bool> {} + | -------------------------- function or associated item `assert` not found for this +... +LL | Bool::<{ std::mem::needs_drop::<T>() }>::assert(); + | ^^^^^^ function or associated item cannot be called on `Bool<{ std::mem::needs_drop::<T>() }>` due to unsatisfied trait bounds + +error: constant expression depends on a generic parameter + --> $DIR/const-needs_drop-monomorphic.rs:11:5 + | +LL | Bool::<{ std::mem::needs_drop::<T>() }>::assert(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this may fail depending on what value the parameter takes + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/consts/copy-intrinsic.rs b/src/test/ui/consts/copy-intrinsic.rs deleted file mode 100644 index 9dc595f37fa..00000000000 --- a/src/test/ui/consts/copy-intrinsic.rs +++ /dev/null @@ -1,45 +0,0 @@ -// ignore-tidy-linelength -#![feature(const_mut_refs, const_intrinsic_copy, const_ptr_offset)] -use std::{ptr, mem}; - -const COPY_ZERO: () = unsafe { - // Since we are not copying anything, this should be allowed. - let src = (); - let mut dst = (); - ptr::copy_nonoverlapping(&src as *const _ as *const i32, &mut dst as *mut _ as *mut i32, 0); -}; - -const COPY_OOB_1: () = unsafe { - let mut x = 0i32; - let dangle = (&mut x as *mut i32).wrapping_add(10); - // Even if the first ptr is an int ptr and this is a ZST copy, we should detect dangling 2nd ptrs. - ptr::copy_nonoverlapping(0x100 as *const i32, dangle, 0); //~ ERROR any use of this value will cause an error - //~| memory access failed: pointer must be in-bounds - //~| previously accepted -}; -const COPY_OOB_2: () = unsafe { - let x = 0i32; - let dangle = (&x as *const i32).wrapping_add(10); - // Even if the second ptr is an int ptr and this is a ZST copy, we should detect dangling 1st ptrs. - ptr::copy_nonoverlapping(dangle, 0x100 as *mut i32, 0); //~ ERROR any use of this value will cause an error - //~| memory access failed: pointer must be in-bounds - //~| previously accepted -}; - -const COPY_SIZE_OVERFLOW: () = unsafe { - let x = 0; - let mut y = 0; - ptr::copy(&x, &mut y, 1usize << (mem::size_of::<usize>() * 8 - 1)); //~ ERROR any use of this value will cause an error - //~| overflow computing total size of `copy` - //~| previously accepted -}; -const COPY_NONOVERLAPPING_SIZE_OVERFLOW: () = unsafe { - let x = 0; - let mut y = 0; - ptr::copy_nonoverlapping(&x, &mut y, 1usize << (mem::size_of::<usize>() * 8 - 1)); //~ ERROR any use of this value will cause an error - //~| overflow computing total size of `copy_nonoverlapping` - //~| previously accepted -}; - -fn main() { -} diff --git a/src/test/ui/consts/copy-intrinsic.stderr b/src/test/ui/consts/copy-intrinsic.stderr deleted file mode 100644 index 2736cdeac69..00000000000 --- a/src/test/ui/consts/copy-intrinsic.stderr +++ /dev/null @@ -1,69 +0,0 @@ -error: any use of this value will cause an error - --> $DIR/copy-intrinsic.rs:16:5 - | -LL | / const COPY_OOB_1: () = unsafe { -LL | | let mut x = 0i32; -LL | | let dangle = (&mut x as *mut i32).wrapping_add(10); -LL | | // Even if the first ptr is an int ptr and this is a ZST copy, we should detect dangling 2nd ptrs. -LL | | ptr::copy_nonoverlapping(0x100 as *const i32, dangle, 0); - | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: pointer must be in-bounds at offset 40, but is outside bounds of alloc4 which has size 4 -LL | | -LL | | -LL | | }; - | |__- - | - = note: `#[deny(const_err)]` on by default - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> - -error: any use of this value will cause an error - --> $DIR/copy-intrinsic.rs:24:5 - | -LL | / const COPY_OOB_2: () = unsafe { -LL | | let x = 0i32; -LL | | let dangle = (&x as *const i32).wrapping_add(10); -LL | | // Even if the second ptr is an int ptr and this is a ZST copy, we should detect dangling 1st ptrs. -LL | | ptr::copy_nonoverlapping(dangle, 0x100 as *mut i32, 0); - | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: pointer must be in-bounds at offset 40, but is outside bounds of alloc6 which has size 4 -LL | | -LL | | -LL | | }; - | |__- - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> - -error: any use of this value will cause an error - --> $DIR/copy-intrinsic.rs:32:5 - | -LL | / const COPY_SIZE_OVERFLOW: () = unsafe { -LL | | let x = 0; -LL | | let mut y = 0; -LL | | ptr::copy(&x, &mut y, 1usize << (mem::size_of::<usize>() * 8 - 1)); - | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflow computing total size of `copy` -LL | | -LL | | -LL | | }; - | |__- - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> - -error: any use of this value will cause an error - --> $DIR/copy-intrinsic.rs:39:5 - | -LL | / const COPY_NONOVERLAPPING_SIZE_OVERFLOW: () = unsafe { -LL | | let x = 0; -LL | | let mut y = 0; -LL | | ptr::copy_nonoverlapping(&x, &mut y, 1usize << (mem::size_of::<usize>() * 8 - 1)); - | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflow computing total size of `copy_nonoverlapping` -LL | | -LL | | -LL | | }; - | |__- - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> - -error: aborting due to 4 previous errors - diff --git a/src/test/ui/deduplicate-diagnostics.duplicate.stderr b/src/test/ui/deduplicate-diagnostics.duplicate.stderr index 3b100b59995..cd4700c7a7c 100644 --- a/src/test/ui/deduplicate-diagnostics.duplicate.stderr +++ b/src/test/ui/deduplicate-diagnostics.duplicate.stderr @@ -22,12 +22,6 @@ error[E0452]: malformed lint attribute input LL | #[deny("literal")] | ^^^^^^^^^ bad attribute argument -error[E0452]: malformed lint attribute input - --> $DIR/deduplicate-diagnostics.rs:8:8 - | -LL | #[deny("literal")] - | ^^^^^^^^^ bad attribute argument - -error: aborting due to 5 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0452`. diff --git a/src/test/ui/deduplicate-diagnostics.rs b/src/test/ui/deduplicate-diagnostics.rs index c5d41ff2fda..7d1c4f5f838 100644 --- a/src/test/ui/deduplicate-diagnostics.rs +++ b/src/test/ui/deduplicate-diagnostics.rs @@ -7,5 +7,4 @@ struct S; #[deny("literal")] //~ ERROR malformed lint attribute input //[duplicate]~| ERROR malformed lint attribute input - //[duplicate]~| ERROR malformed lint attribute input fn main() {} diff --git a/src/test/ui/error-codes/E0452.rs b/src/test/ui/error-codes/E0452.rs index 4e5a6c93014..5066cd99be9 100644 --- a/src/test/ui/error-codes/E0452.rs +++ b/src/test/ui/error-codes/E0452.rs @@ -2,7 +2,5 @@ //~| ERROR E0452 //~| ERROR E0452 //~| ERROR E0452 - //~| ERROR E0452 - //~| ERROR E0452 fn main() { } diff --git a/src/test/ui/error-codes/E0452.stderr b/src/test/ui/error-codes/E0452.stderr index 30c11e3274e..f67b740ffe2 100644 --- a/src/test/ui/error-codes/E0452.stderr +++ b/src/test/ui/error-codes/E0452.stderr @@ -22,18 +22,6 @@ error[E0452]: malformed lint attribute input LL | #![allow(foo = "")] | ^^^^^^^^ bad attribute argument -error[E0452]: malformed lint attribute input - --> $DIR/E0452.rs:1:10 - | -LL | #![allow(foo = "")] - | ^^^^^^^^ bad attribute argument - -error[E0452]: malformed lint attribute input - --> $DIR/E0452.rs:1:10 - | -LL | #![allow(foo = "")] - | ^^^^^^^^ bad attribute argument - -error: aborting due to 6 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0452`. diff --git a/src/test/ui/error-codes/E0453.rs b/src/test/ui/error-codes/E0453.rs index 6fa8dd9717f..ca9573c5b46 100644 --- a/src/test/ui/error-codes/E0453.rs +++ b/src/test/ui/error-codes/E0453.rs @@ -3,6 +3,5 @@ #[allow(non_snake_case)] //~^ ERROR allow(non_snake_case) incompatible //~| ERROR allow(non_snake_case) incompatible -//~| ERROR allow(non_snake_case) incompatible fn main() { } diff --git a/src/test/ui/error-codes/E0453.stderr b/src/test/ui/error-codes/E0453.stderr index 21c43cc052e..6d60dc84c21 100644 --- a/src/test/ui/error-codes/E0453.stderr +++ b/src/test/ui/error-codes/E0453.stderr @@ -16,15 +16,6 @@ LL | LL | #[allow(non_snake_case)] | ^^^^^^^^^^^^^^ overruled by previous forbid -error[E0453]: allow(non_snake_case) incompatible with previous forbid - --> $DIR/E0453.rs:3:9 - | -LL | #![forbid(non_snake_case)] - | -------------- `forbid` level set here -LL | -LL | #[allow(non_snake_case)] - | ^^^^^^^^^^^^^^ overruled by previous forbid - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0453`. diff --git a/src/test/ui/error-codes/E0602.stderr b/src/test/ui/error-codes/E0602.stderr index 70137cb1662..2b372263345 100644 --- a/src/test/ui/error-codes/E0602.stderr +++ b/src/test/ui/error-codes/E0602.stderr @@ -6,10 +6,6 @@ error[E0602]: unknown lint: `bogus` | = note: requested on the command line with `-D bogus` -error[E0602]: unknown lint: `bogus` - | - = note: requested on the command line with `-D bogus` - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0602`. diff --git a/src/test/ui/feature-gates/feature-gate-lint-reasons.rs b/src/test/ui/feature-gates/feature-gate-lint-reasons.rs index b124e9b2f4d..7756074e235 100644 --- a/src/test/ui/feature-gates/feature-gate-lint-reasons.rs +++ b/src/test/ui/feature-gates/feature-gate-lint-reasons.rs @@ -1,6 +1,5 @@ #![warn(nonstandard_style, reason = "the standard should be respected")] //~^ ERROR lint reasons are experimental //~| ERROR lint reasons are experimental -//~| ERROR lint reasons are experimental fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-lint-reasons.stderr b/src/test/ui/feature-gates/feature-gate-lint-reasons.stderr index a7d5ea6b937..12793c7a28f 100644 --- a/src/test/ui/feature-gates/feature-gate-lint-reasons.stderr +++ b/src/test/ui/feature-gates/feature-gate-lint-reasons.stderr @@ -16,15 +16,6 @@ LL | #![warn(nonstandard_style, reason = "the standard should be respected")] = note: see issue #54503 <https://github.com/rust-lang/rust/issues/54503> for more information = help: add `#![feature(lint_reasons)]` to the crate attributes to enable -error[E0658]: lint reasons are experimental - --> $DIR/feature-gate-lint-reasons.rs:1:28 - | -LL | #![warn(nonstandard_style, reason = "the standard should be respected")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #54503 <https://github.com/rust-lang/rust/issues/54503> for more information - = help: add `#![feature(lint_reasons)]` to the crate attributes to enable - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-more-qualified-paths.rs b/src/test/ui/feature-gates/feature-gate-more-qualified-paths.rs new file mode 100644 index 00000000000..2e05acbfa17 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-more-qualified-paths.rs @@ -0,0 +1,27 @@ +fn main() { + // destructure through a qualified path + let <Foo as A>::Assoc { br } = StructStruct { br: 2 }; + //~^ ERROR usage of qualified paths in this context is experimental + let _ = <Foo as A>::Assoc { br: 2 }; + //~^ ERROR usage of qualified paths in this context is experimental + let <E>::V(..) = E::V(0); + //~^ ERROR usage of qualified paths in this context is experimental +} + +struct StructStruct { + br: i8, +} + +struct Foo; + +trait A { + type Assoc; +} + +impl A for Foo { + type Assoc = StructStruct; +} + +enum E { + V(u8) +} diff --git a/src/test/ui/feature-gates/feature-gate-more-qualified-paths.stderr b/src/test/ui/feature-gates/feature-gate-more-qualified-paths.stderr new file mode 100644 index 00000000000..b49cc40800f --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-more-qualified-paths.stderr @@ -0,0 +1,30 @@ +error[E0658]: usage of qualified paths in this context is experimental + --> $DIR/feature-gate-more-qualified-paths.rs:3:9 + | +LL | let <Foo as A>::Assoc { br } = StructStruct { br: 2 }; + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #80080 <https://github.com/rust-lang/rust/issues/80080> for more information + = help: add `#![feature(more_qualified_paths)]` to the crate attributes to enable + +error[E0658]: usage of qualified paths in this context is experimental + --> $DIR/feature-gate-more-qualified-paths.rs:5:13 + | +LL | let _ = <Foo as A>::Assoc { br: 2 }; + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #80080 <https://github.com/rust-lang/rust/issues/80080> for more information + = help: add `#![feature(more_qualified_paths)]` to the crate attributes to enable + +error[E0658]: usage of qualified paths in this context is experimental + --> $DIR/feature-gate-more-qualified-paths.rs:7:9 + | +LL | let <E>::V(..) = E::V(0); + | ^^^^^^ + | + = note: see issue #80080 <https://github.com/rust-lang/rust/issues/80080> for more information + = help: add `#![feature(more_qualified_paths)]` to the crate attributes to enable + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/intrinsics/issue-84297-reifying-copy.rs b/src/test/ui/intrinsics/issue-84297-reifying-copy.rs new file mode 100644 index 00000000000..08ba9ce7ecb --- /dev/null +++ b/src/test/ui/intrinsics/issue-84297-reifying-copy.rs @@ -0,0 +1,9 @@ +// check-pass + +fn main() { + let _unused = if true { + core::ptr::copy::<i32> + } else { + core::ptr::copy_nonoverlapping::<i32> + }; +} diff --git a/src/test/ui/lint/crate_level_only_lint.rs b/src/test/ui/lint/crate_level_only_lint.rs index d9673faa214..38c5487183c 100644 --- a/src/test/ui/lint/crate_level_only_lint.rs +++ b/src/test/ui/lint/crate_level_only_lint.rs @@ -4,12 +4,10 @@ mod foo { #![allow(uncommon_codepoints)] //~^ ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes] //~| ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes] -//~| ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes] #[allow(uncommon_codepoints)] //~^ ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes] //~| ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes] -//~| ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes] const BAR: f64 = 0.000001; } @@ -17,6 +15,5 @@ const BAR: f64 = 0.000001; #[allow(uncommon_codepoints)] //~^ ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes] //~| ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes] -//~| ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes] fn main() { } diff --git a/src/test/ui/lint/crate_level_only_lint.stderr b/src/test/ui/lint/crate_level_only_lint.stderr index 8fb06df2a48..83bea0412ff 100644 --- a/src/test/ui/lint/crate_level_only_lint.stderr +++ b/src/test/ui/lint/crate_level_only_lint.stderr @@ -11,13 +11,13 @@ LL | #![deny(uncommon_codepoints, unused_attributes)] | ^^^^^^^^^^^^^^^^^ error: allow(uncommon_codepoints) is ignored unless specified at crate level - --> $DIR/crate_level_only_lint.rs:9:9 + --> $DIR/crate_level_only_lint.rs:8:9 | LL | #[allow(uncommon_codepoints)] | ^^^^^^^^^^^^^^^^^^^ error: allow(uncommon_codepoints) is ignored unless specified at crate level - --> $DIR/crate_level_only_lint.rs:17:9 + --> $DIR/crate_level_only_lint.rs:15:9 | LL | #[allow(uncommon_codepoints)] | ^^^^^^^^^^^^^^^^^^^ @@ -29,34 +29,16 @@ LL | #![allow(uncommon_codepoints)] | ^^^^^^^^^^^^^^^^^^^ error: allow(uncommon_codepoints) is ignored unless specified at crate level - --> $DIR/crate_level_only_lint.rs:9:9 + --> $DIR/crate_level_only_lint.rs:8:9 | LL | #[allow(uncommon_codepoints)] | ^^^^^^^^^^^^^^^^^^^ error: allow(uncommon_codepoints) is ignored unless specified at crate level - --> $DIR/crate_level_only_lint.rs:17:9 + --> $DIR/crate_level_only_lint.rs:15:9 | LL | #[allow(uncommon_codepoints)] | ^^^^^^^^^^^^^^^^^^^ -error: allow(uncommon_codepoints) is ignored unless specified at crate level - --> $DIR/crate_level_only_lint.rs:4:10 - | -LL | #![allow(uncommon_codepoints)] - | ^^^^^^^^^^^^^^^^^^^ - -error: allow(uncommon_codepoints) is ignored unless specified at crate level - --> $DIR/crate_level_only_lint.rs:9:9 - | -LL | #[allow(uncommon_codepoints)] - | ^^^^^^^^^^^^^^^^^^^ - -error: allow(uncommon_codepoints) is ignored unless specified at crate level - --> $DIR/crate_level_only_lint.rs:17:9 - | -LL | #[allow(uncommon_codepoints)] - | ^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 9 previous errors +error: aborting due to 6 previous errors diff --git a/src/test/ui/lint/forbid-group-group-2.rs b/src/test/ui/lint/forbid-group-group-2.rs index b12fd72da74..7d8a3981814 100644 --- a/src/test/ui/lint/forbid-group-group-2.rs +++ b/src/test/ui/lint/forbid-group-group-2.rs @@ -17,10 +17,4 @@ //~| WARNING previously accepted by the compiler //~| ERROR incompatible with previous //~| WARNING previously accepted by the compiler -//~| ERROR incompatible with previous -//~| WARNING previously accepted by the compiler -//~| ERROR incompatible with previous -//~| WARNING previously accepted by the compiler -//~| ERROR incompatible with previous -//~| WARNING previously accepted by the compiler fn main() {} diff --git a/src/test/ui/lint/forbid-group-group-2.stderr b/src/test/ui/lint/forbid-group-group-2.stderr index 214e949c11a..d8c09e6526a 100644 --- a/src/test/ui/lint/forbid-group-group-2.stderr +++ b/src/test/ui/lint/forbid-group-group-2.stderr @@ -75,41 +75,5 @@ LL | #[allow(nonstandard_style)] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670> -error: allow(nonstandard_style) incompatible with previous forbid - --> $DIR/forbid-group-group-2.rs:7:9 - | -LL | #![forbid(warnings)] - | -------- `forbid` level set here -... -LL | #[allow(nonstandard_style)] - | ^^^^^^^^^^^^^^^^^ overruled by previous forbid - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670> - -error: allow(nonstandard_style) incompatible with previous forbid - --> $DIR/forbid-group-group-2.rs:7:9 - | -LL | #![forbid(warnings)] - | -------- `forbid` level set here -... -LL | #[allow(nonstandard_style)] - | ^^^^^^^^^^^^^^^^^ overruled by previous forbid - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670> - -error: allow(nonstandard_style) incompatible with previous forbid - --> $DIR/forbid-group-group-2.rs:7:9 - | -LL | #![forbid(warnings)] - | -------- `forbid` level set here -... -LL | #[allow(nonstandard_style)] - | ^^^^^^^^^^^^^^^^^ overruled by previous forbid - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670> - -error: aborting due to 9 previous errors +error: aborting due to 6 previous errors diff --git a/src/test/ui/lint/forbid-group-member.rs b/src/test/ui/lint/forbid-group-member.rs index 6f1b2e9f668..664edeaa8b4 100644 --- a/src/test/ui/lint/forbid-group-member.rs +++ b/src/test/ui/lint/forbid-group-member.rs @@ -12,8 +12,6 @@ //~| WARNING previously accepted //~| WARNING incompatible with previous forbid //~| WARNING previously accepted -//~| WARNING incompatible with previous forbid -//~| WARNING previously accepted fn main() { let a: (); } diff --git a/src/test/ui/lint/forbid-group-member.stderr b/src/test/ui/lint/forbid-group-member.stderr index c818d7ff606..72772a42bed 100644 --- a/src/test/ui/lint/forbid-group-member.stderr +++ b/src/test/ui/lint/forbid-group-member.stderr @@ -35,17 +35,5 @@ LL | #[allow(unused_variables)] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670> -warning: allow(unused_variables) incompatible with previous forbid - --> $DIR/forbid-group-member.rs:8:9 - | -LL | #![forbid(unused)] - | ------ `forbid` level set here -LL | -LL | #[allow(unused_variables)] - | ^^^^^^^^^^^^^^^^ overruled by previous forbid - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670> - -warning: 4 warnings emitted +warning: 3 warnings emitted diff --git a/src/test/ui/lint/forbid-member-group.rs b/src/test/ui/lint/forbid-member-group.rs index 3279029a9cb..e2f76825a2d 100644 --- a/src/test/ui/lint/forbid-member-group.rs +++ b/src/test/ui/lint/forbid-member-group.rs @@ -6,7 +6,6 @@ #[allow(unused)] //~^ ERROR incompatible with previous forbid //~| ERROR incompatible with previous forbid -//~| ERROR incompatible with previous forbid fn main() { let a: (); } diff --git a/src/test/ui/lint/forbid-member-group.stderr b/src/test/ui/lint/forbid-member-group.stderr index 1d8ab4d5edb..39700af4d59 100644 --- a/src/test/ui/lint/forbid-member-group.stderr +++ b/src/test/ui/lint/forbid-member-group.stderr @@ -16,15 +16,6 @@ LL | LL | #[allow(unused)] | ^^^^^^ overruled by previous forbid -error[E0453]: allow(unused) incompatible with previous forbid - --> $DIR/forbid-member-group.rs:6:9 - | -LL | #![forbid(unused_variables)] - | ---------------- `forbid` level set here -LL | -LL | #[allow(unused)] - | ^^^^^^ overruled by previous forbid - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0453`. diff --git a/src/test/ui/lint/force-warn/force-allowed-by-default-lint.rs b/src/test/ui/lint/force-warn/force-allowed-by-default-lint.rs index d4a5056ddf3..0a3e20b4f7d 100644 --- a/src/test/ui/lint/force-warn/force-allowed-by-default-lint.rs +++ b/src/test/ui/lint/force-warn/force-allowed-by-default-lint.rs @@ -1,4 +1,4 @@ -// compile-flags: --force-warns elided_lifetimes_in_paths +// compile-flags: --force-warns elided_lifetimes_in_paths -Zunstable-options // check-pass struct Foo<'a> { diff --git a/src/test/ui/lint/force-warn/force-allowed-deny-by-default-lint.rs b/src/test/ui/lint/force-warn/force-allowed-deny-by-default-lint.rs index afd2d6ec322..0abc4913726 100644 --- a/src/test/ui/lint/force-warn/force-allowed-deny-by-default-lint.rs +++ b/src/test/ui/lint/force-warn/force-allowed-deny-by-default-lint.rs @@ -1,4 +1,4 @@ -// compile-flags: --force-warns const_err +// compile-flags: --force-warns const_err -Zunstable-options // check-pass #![allow(const_err)] diff --git a/src/test/ui/lint/force-warn/force-allowed-warning.rs b/src/test/ui/lint/force-warn/force-allowed-warning.rs index 5c83c525e38..bac0e4f8f8e 100644 --- a/src/test/ui/lint/force-warn/force-allowed-warning.rs +++ b/src/test/ui/lint/force-warn/force-allowed-warning.rs @@ -1,4 +1,4 @@ -// compile-flags: --force-warns dead_code +// compile-flags: --force-warns dead_code -Zunstable-options // check-pass #![allow(dead_code)] diff --git a/src/test/ui/lint/force-warn/force-deny-by-default-lint.rs b/src/test/ui/lint/force-warn/force-deny-by-default-lint.rs index 4f267f085d5..e721760ab2d 100644 --- a/src/test/ui/lint/force-warn/force-deny-by-default-lint.rs +++ b/src/test/ui/lint/force-warn/force-deny-by-default-lint.rs @@ -1,4 +1,4 @@ -// compile-flags: --force-warns const_err +// compile-flags: --force-warns const_err -Zunstable-options // check-pass const C: i32 = 1 / 0; diff --git a/src/test/ui/lint/force-warn/force-lint-allow-all-warnings.rs b/src/test/ui/lint/force-warn/force-lint-allow-all-warnings.rs index 5501faa437a..0dc1ce28ac4 100644 --- a/src/test/ui/lint/force-warn/force-lint-allow-all-warnings.rs +++ b/src/test/ui/lint/force-warn/force-lint-allow-all-warnings.rs @@ -1,4 +1,4 @@ -// compile-flags: --force-warns dead_code +// compile-flags: --force-warns dead_code -Zunstable-options // check-pass #![allow(warnings)] diff --git a/src/test/ui/lint/force-warn/force-lint-group-allow-all-warnings.rs b/src/test/ui/lint/force-warn/force-lint-group-allow-all-warnings.rs index 9009971f0cf..4f637c7fefa 100644 --- a/src/test/ui/lint/force-warn/force-lint-group-allow-all-warnings.rs +++ b/src/test/ui/lint/force-warn/force-lint-group-allow-all-warnings.rs @@ -1,4 +1,4 @@ -// compile-flags: --force-warns nonstandard_style +// compile-flags: --force-warns nonstandard_style -Zunstable-options // check-pass #![allow(warnings)] diff --git a/src/test/ui/lint/force-warn/force-lint-in-allowed-group.rs b/src/test/ui/lint/force-warn/force-lint-in-allowed-group.rs index b68b979ca11..bb2f394aef3 100644 --- a/src/test/ui/lint/force-warn/force-lint-in-allowed-group.rs +++ b/src/test/ui/lint/force-warn/force-lint-in-allowed-group.rs @@ -1,4 +1,4 @@ -// compile-flags: --force-warns bare_trait_objects +// compile-flags: --force-warns bare_trait_objects -Zunstable-options // check-pass #![allow(rust_2018_idioms)] diff --git a/src/test/ui/lint/force-warn/force-warn-group-allow-warning.rs b/src/test/ui/lint/force-warn/force-warn-group-allow-warning.rs index 357a79b383d..fd029a3d55c 100644 --- a/src/test/ui/lint/force-warn/force-warn-group-allow-warning.rs +++ b/src/test/ui/lint/force-warn/force-warn-group-allow-warning.rs @@ -1,4 +1,4 @@ -// compile-flags: --force-warns rust_2018_idioms +// compile-flags: --force-warns rust_2018_idioms -Zunstable-options // check-pass #![allow(bare_trait_objects)] diff --git a/src/test/ui/lint/force-warn/force-warn-group.rs b/src/test/ui/lint/force-warn/force-warn-group.rs index a4615df42de..c97eeabbd4e 100644 --- a/src/test/ui/lint/force-warn/force-warn-group.rs +++ b/src/test/ui/lint/force-warn/force-warn-group.rs @@ -1,4 +1,4 @@ -// compile-flags: --force-warns rust_2018_idioms +// compile-flags: --force-warns rust_2018_idioms -Zunstable-options // check-pass #![allow(rust_2018_idioms)] diff --git a/src/test/ui/lint/issue-80988.rs b/src/test/ui/lint/issue-80988.rs index 16a041928db..1e116206f7b 100644 --- a/src/test/ui/lint/issue-80988.rs +++ b/src/test/ui/lint/issue-80988.rs @@ -11,6 +11,4 @@ //~| WARNING being phased out //~| WARNING incompatible with previous forbid //~| WARNING being phased out -//~| WARNING incompatible with previous forbid -//~| WARNING being phased out fn main() {} diff --git a/src/test/ui/lint/issue-80988.stderr b/src/test/ui/lint/issue-80988.stderr index 4cae11f97c0..deee267d0c6 100644 --- a/src/test/ui/lint/issue-80988.stderr +++ b/src/test/ui/lint/issue-80988.stderr @@ -35,17 +35,5 @@ LL | #[deny(warnings)] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670> -warning: deny(warnings) incompatible with previous forbid - --> $DIR/issue-80988.rs:7:8 - | -LL | #![forbid(warnings)] - | -------- `forbid` level set here -LL | -LL | #[deny(warnings)] - | ^^^^^^^^ overruled by previous forbid - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670> - -warning: 4 warnings emitted +warning: 3 warnings emitted diff --git a/src/test/ui/lint/issue-83477.rs b/src/test/ui/lint/issue-83477.rs index 0eba52acfa3..ab62f0c8b8c 100644 --- a/src/test/ui/lint/issue-83477.rs +++ b/src/test/ui/lint/issue-83477.rs @@ -1,3 +1,4 @@ +// compile-flags: -Zunstable-options // check-pass #![warn(rustc::internal)] diff --git a/src/test/ui/lint/issue-83477.stderr b/src/test/ui/lint/issue-83477.stderr index dbe0c9e0130..028890f3623 100644 --- a/src/test/ui/lint/issue-83477.stderr +++ b/src/test/ui/lint/issue-83477.stderr @@ -1,5 +1,5 @@ warning: unknown lint: `rustc::foo::bar::default_hash_types` - --> $DIR/issue-83477.rs:4:9 + --> $DIR/issue-83477.rs:5:9 | LL | #[allow(rustc::foo::bar::default_hash_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `rustc::default_hash_types` @@ -7,19 +7,19 @@ LL | #[allow(rustc::foo::bar::default_hash_types)] = note: `#[warn(unknown_lints)]` on by default warning: unknown lint: `rustc::foo::default_hash_types` - --> $DIR/issue-83477.rs:8:9 + --> $DIR/issue-83477.rs:9:9 | LL | #[allow(rustc::foo::default_hash_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `rustc::default_hash_types` warning: Prefer FxHashMap over HashMap, it has better performance - --> $DIR/issue-83477.rs:13:31 + --> $DIR/issue-83477.rs:14:31 | LL | let _ = std::collections::HashMap::<String, String>::new(); | ^^^^^^^ help: use: `FxHashMap` | note: the lint level is defined here - --> $DIR/issue-83477.rs:2:9 + --> $DIR/issue-83477.rs:3:9 | LL | #![warn(rustc::internal)] | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-forbid-attr.rs b/src/test/ui/lint/lint-forbid-attr.rs index 13ebb6dccd8..6d4cfd83424 100644 --- a/src/test/ui/lint/lint-forbid-attr.rs +++ b/src/test/ui/lint/lint-forbid-attr.rs @@ -3,6 +3,5 @@ #[allow(deprecated)] //~^ ERROR allow(deprecated) incompatible //~| ERROR allow(deprecated) incompatible -//~| ERROR allow(deprecated) incompatible fn main() { } diff --git a/src/test/ui/lint/lint-forbid-attr.stderr b/src/test/ui/lint/lint-forbid-attr.stderr index cb0b25d1115..48228c5dfdd 100644 --- a/src/test/ui/lint/lint-forbid-attr.stderr +++ b/src/test/ui/lint/lint-forbid-attr.stderr @@ -16,15 +16,6 @@ LL | LL | #[allow(deprecated)] | ^^^^^^^^^^ overruled by previous forbid -error[E0453]: allow(deprecated) incompatible with previous forbid - --> $DIR/lint-forbid-attr.rs:3:9 - | -LL | #![forbid(deprecated)] - | ---------- `forbid` level set here -LL | -LL | #[allow(deprecated)] - | ^^^^^^^^^^ overruled by previous forbid - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0453`. diff --git a/src/test/ui/lint/lint-forbid-cmdline.rs b/src/test/ui/lint/lint-forbid-cmdline.rs index 38bb8d29d3f..5246ccb57a6 100644 --- a/src/test/ui/lint/lint-forbid-cmdline.rs +++ b/src/test/ui/lint/lint-forbid-cmdline.rs @@ -2,6 +2,5 @@ #[allow(deprecated)] //~ ERROR allow(deprecated) incompatible //~| ERROR allow(deprecated) incompatible - //~| ERROR allow(deprecated) incompatible fn main() { } diff --git a/src/test/ui/lint/lint-forbid-cmdline.stderr b/src/test/ui/lint/lint-forbid-cmdline.stderr index 5b1b015c4dd..0a92e58c04a 100644 --- a/src/test/ui/lint/lint-forbid-cmdline.stderr +++ b/src/test/ui/lint/lint-forbid-cmdline.stderr @@ -14,14 +14,6 @@ LL | #[allow(deprecated)] | = note: `forbid` lint level was set on command line -error[E0453]: allow(deprecated) incompatible with previous forbid - --> $DIR/lint-forbid-cmdline.rs:3:9 - | -LL | #[allow(deprecated)] - | ^^^^^^^^^^ overruled by previous forbid - | - = note: `forbid` lint level was set on command line - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0453`. diff --git a/src/test/ui/lint/lint-malformed.rs b/src/test/ui/lint/lint-malformed.rs index cf5570753d8..188e702f98b 100644 --- a/src/test/ui/lint/lint-malformed.rs +++ b/src/test/ui/lint/lint-malformed.rs @@ -3,6 +3,4 @@ //~| ERROR malformed lint attribute //~| ERROR malformed lint attribute //~| ERROR malformed lint attribute - //~| ERROR malformed lint attribute - //~| ERROR malformed lint attribute fn main() { } diff --git a/src/test/ui/lint/lint-malformed.stderr b/src/test/ui/lint/lint-malformed.stderr index 6dc8d498444..b3a41a786c1 100644 --- a/src/test/ui/lint/lint-malformed.stderr +++ b/src/test/ui/lint/lint-malformed.stderr @@ -28,18 +28,6 @@ error[E0452]: malformed lint attribute input LL | #![allow(bar = "baz")] | ^^^^^^^^^^^ bad attribute argument -error[E0452]: malformed lint attribute input - --> $DIR/lint-malformed.rs:2:10 - | -LL | #![allow(bar = "baz")] - | ^^^^^^^^^^^ bad attribute argument - -error[E0452]: malformed lint attribute input - --> $DIR/lint-malformed.rs:2:10 - | -LL | #![allow(bar = "baz")] - | ^^^^^^^^^^^ bad attribute argument - -error: aborting due to 7 previous errors +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0452`. diff --git a/src/test/ui/lint/lint-removed-cmdline.stderr b/src/test/ui/lint/lint-removed-cmdline.stderr index fc2ba92479c..9be532ef234 100644 --- a/src/test/ui/lint/lint-removed-cmdline.stderr +++ b/src/test/ui/lint/lint-removed-cmdline.stderr @@ -10,10 +10,6 @@ warning: lint `raw_pointer_derive` has been removed: using derive with raw point | = note: requested on the command line with `-D raw_pointer_derive` -warning: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok - | - = note: requested on the command line with `-D raw_pointer_derive` - error: unused variable: `unused` --> $DIR/lint-removed-cmdline.rs:12:17 | @@ -27,5 +23,5 @@ LL | #[deny(warnings)] | ^^^^^^^^ = note: `#[deny(unused_variables)]` implied by `#[deny(warnings)]` -error: aborting due to previous error; 4 warnings emitted +error: aborting due to previous error; 3 warnings emitted diff --git a/src/test/ui/lint/lint-renamed-cmdline.stderr b/src/test/ui/lint/lint-renamed-cmdline.stderr index 1c37a5baa6d..8dfd61ac927 100644 --- a/src/test/ui/lint/lint-renamed-cmdline.stderr +++ b/src/test/ui/lint/lint-renamed-cmdline.stderr @@ -10,10 +10,6 @@ warning: lint `bare_trait_object` has been renamed to `bare_trait_objects` | = note: requested on the command line with `-D bare_trait_object` -warning: lint `bare_trait_object` has been renamed to `bare_trait_objects` - | - = note: requested on the command line with `-D bare_trait_object` - error: unused variable: `unused` --> $DIR/lint-renamed-cmdline.rs:8:17 | @@ -27,5 +23,5 @@ LL | #[deny(unused)] | ^^^^^^ = note: `#[deny(unused_variables)]` implied by `#[deny(unused)]` -error: aborting due to previous error; 4 warnings emitted +error: aborting due to previous error; 3 warnings emitted diff --git a/src/test/ui/lint/lint-unexported-no-mangle.stderr b/src/test/ui/lint/lint-unexported-no-mangle.stderr index 66d64e8937a..a11ee769c7c 100644 --- a/src/test/ui/lint/lint-unexported-no-mangle.stderr +++ b/src/test/ui/lint/lint-unexported-no-mangle.stderr @@ -22,14 +22,6 @@ warning: lint `private_no_mangle_statics` has been removed: no longer a warning, | = note: requested on the command line with `-F private_no_mangle_statics` -warning: lint `private_no_mangle_fns` has been removed: no longer a warning, `#[no_mangle]` functions always exported - | - = note: requested on the command line with `-F private_no_mangle_fns` - -warning: lint `private_no_mangle_statics` has been removed: no longer a warning, `#[no_mangle]` statics always exported - | - = note: requested on the command line with `-F private_no_mangle_statics` - error: const items should never be `#[no_mangle]` --> $DIR/lint-unexported-no-mangle.rs:9:1 | @@ -48,5 +40,5 @@ LL | pub const PUB_FOO: u64 = 1; | | | help: try a static value: `pub static` -error: aborting due to 2 previous errors; 8 warnings emitted +error: aborting due to 2 previous errors; 6 warnings emitted diff --git a/src/test/ui/lint/lint-unknown-lint-cmdline.stderr b/src/test/ui/lint/lint-unknown-lint-cmdline.stderr index 27e7ee7fc03..3855d552792 100644 --- a/src/test/ui/lint/lint-unknown-lint-cmdline.stderr +++ b/src/test/ui/lint/lint-unknown-lint-cmdline.stderr @@ -16,15 +16,6 @@ error[E0602]: unknown lint: `dead_cod` = help: did you mean: `dead_code` = note: requested on the command line with `-D dead_cod` -error[E0602]: unknown lint: `bogus` - | - = note: requested on the command line with `-D bogus` - -error[E0602]: unknown lint: `dead_cod` - | - = help: did you mean: `dead_code` - = note: requested on the command line with `-D dead_cod` - -error: aborting due to 6 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0602`. diff --git a/src/test/ui/lint/reasons-erroneous.rs b/src/test/ui/lint/reasons-erroneous.rs index 03cf0679fce..cd693ae166c 100644 --- a/src/test/ui/lint/reasons-erroneous.rs +++ b/src/test/ui/lint/reasons-erroneous.rs @@ -3,15 +3,11 @@ #![warn(absolute_paths_not_starting_with_crate, reason = 0)] //~^ ERROR malformed lint attribute //~| ERROR malformed lint attribute -//~| ERROR malformed lint attribute -//~| NOTE reason must be a string literal //~| NOTE reason must be a string literal //~| NOTE reason must be a string literal #![warn(anonymous_parameters, reason = b"consider these, for we have condemned them")] //~^ ERROR malformed lint attribute //~| ERROR malformed lint attribute -//~| ERROR malformed lint attribute -//~| NOTE reason must be a string literal //~| NOTE reason must be a string literal //~| NOTE reason must be a string literal #![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")] @@ -19,10 +15,6 @@ //~| ERROR malformed lint attribute //~| ERROR malformed lint attribute //~| ERROR malformed lint attribute -//~| ERROR malformed lint attribute -//~| ERROR malformed lint attribute -//~| NOTE bad attribute argument -//~| NOTE bad attribute argument //~| NOTE bad attribute argument //~| NOTE bad attribute argument //~| NOTE bad attribute argument @@ -32,10 +24,6 @@ //~| ERROR malformed lint attribute //~| ERROR malformed lint attribute //~| ERROR malformed lint attribute -//~| ERROR malformed lint attribute -//~| ERROR malformed lint attribute -//~| NOTE bad attribute argument -//~| NOTE bad attribute argument //~| NOTE bad attribute argument //~| NOTE bad attribute argument //~| NOTE bad attribute argument @@ -45,10 +33,6 @@ //~| ERROR malformed lint attribute //~| ERROR malformed lint attribute //~| ERROR malformed lint attribute -//~| ERROR malformed lint attribute -//~| ERROR malformed lint attribute -//~| NOTE bad attribute argument -//~| NOTE bad attribute argument //~| NOTE bad attribute argument //~| NOTE bad attribute argument //~| NOTE bad attribute argument @@ -56,15 +40,11 @@ #![warn(ellipsis_inclusive_range_patterns, reason = "born barren", reason = "a freak growth")] //~^ ERROR malformed lint attribute //~| ERROR malformed lint attribute -//~| ERROR malformed lint attribute -//~| NOTE reason in lint attribute must come last //~| NOTE reason in lint attribute must come last //~| NOTE reason in lint attribute must come last #![warn(keyword_idents, reason = "root in rubble", macro_use_extern_crate)] //~^ ERROR malformed lint attribute //~| ERROR malformed lint attribute -//~| ERROR malformed lint attribute -//~| NOTE reason in lint attribute must come last //~| NOTE reason in lint attribute must come last //~| NOTE reason in lint attribute must come last #![warn(missing_copy_implementations, reason)] diff --git a/src/test/ui/lint/reasons-erroneous.stderr b/src/test/ui/lint/reasons-erroneous.stderr index d7926b73cee..f65ca08694d 100644 --- a/src/test/ui/lint/reasons-erroneous.stderr +++ b/src/test/ui/lint/reasons-erroneous.stderr @@ -5,61 +5,61 @@ LL | #![warn(absolute_paths_not_starting_with_crate, reason = 0)] | ^ reason must be a string literal error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:10:40 + --> $DIR/reasons-erroneous.rs:8:40 | LL | #![warn(anonymous_parameters, reason = b"consider these, for we have condemned them")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reason must be a string literal error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:17:29 + --> $DIR/reasons-erroneous.rs:13:29 | LL | #![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:17:29 + --> $DIR/reasons-erroneous.rs:13:29 | LL | #![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:30:23 + --> $DIR/reasons-erroneous.rs:22:23 | LL | #![warn(box_pointers, blerp = "or in league with robbers have reversed the signposts")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:30:23 + --> $DIR/reasons-erroneous.rs:22:23 | LL | #![warn(box_pointers, blerp = "or in league with robbers have reversed the signposts")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:43:36 + --> $DIR/reasons-erroneous.rs:31:36 | LL | #![warn(elided_lifetimes_in_paths, reason("disrespectful to ancestors", "irresponsible to heirs"))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:43:36 + --> $DIR/reasons-erroneous.rs:31:36 | LL | #![warn(elided_lifetimes_in_paths, reason("disrespectful to ancestors", "irresponsible to heirs"))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:56:44 + --> $DIR/reasons-erroneous.rs:40:44 | LL | #![warn(ellipsis_inclusive_range_patterns, reason = "born barren", reason = "a freak growth")] | ^^^^^^^^^^^^^^^^^^^^^^ reason in lint attribute must come last error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:63:25 + --> $DIR/reasons-erroneous.rs:45:25 | LL | #![warn(keyword_idents, reason = "root in rubble", macro_use_extern_crate)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ reason in lint attribute must come last warning: unknown lint: `reason` - --> $DIR/reasons-erroneous.rs:70:39 + --> $DIR/reasons-erroneous.rs:50:39 | LL | #![warn(missing_copy_implementations, reason)] | ^^^^^^ @@ -73,119 +73,59 @@ LL | #![warn(absolute_paths_not_starting_with_crate, reason = 0)] | ^ reason must be a string literal error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:10:40 + --> $DIR/reasons-erroneous.rs:8:40 | LL | #![warn(anonymous_parameters, reason = b"consider these, for we have condemned them")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reason must be a string literal error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:17:29 + --> $DIR/reasons-erroneous.rs:13:29 | LL | #![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:17:29 + --> $DIR/reasons-erroneous.rs:13:29 | LL | #![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:30:23 + --> $DIR/reasons-erroneous.rs:22:23 | LL | #![warn(box_pointers, blerp = "or in league with robbers have reversed the signposts")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:30:23 + --> $DIR/reasons-erroneous.rs:22:23 | LL | #![warn(box_pointers, blerp = "or in league with robbers have reversed the signposts")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:43:36 + --> $DIR/reasons-erroneous.rs:31:36 | LL | #![warn(elided_lifetimes_in_paths, reason("disrespectful to ancestors", "irresponsible to heirs"))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:43:36 + --> $DIR/reasons-erroneous.rs:31:36 | LL | #![warn(elided_lifetimes_in_paths, reason("disrespectful to ancestors", "irresponsible to heirs"))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:56:44 + --> $DIR/reasons-erroneous.rs:40:44 | LL | #![warn(ellipsis_inclusive_range_patterns, reason = "born barren", reason = "a freak growth")] | ^^^^^^^^^^^^^^^^^^^^^^ reason in lint attribute must come last error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:63:25 + --> $DIR/reasons-erroneous.rs:45:25 | LL | #![warn(keyword_idents, reason = "root in rubble", macro_use_extern_crate)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ reason in lint attribute must come last -error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:3:58 - | -LL | #![warn(absolute_paths_not_starting_with_crate, reason = 0)] - | ^ reason must be a string literal - -error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:10:40 - | -LL | #![warn(anonymous_parameters, reason = b"consider these, for we have condemned them")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reason must be a string literal - -error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:17:29 - | -LL | #![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument - -error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:17:29 - | -LL | #![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument - -error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:30:23 - | -LL | #![warn(box_pointers, blerp = "or in league with robbers have reversed the signposts")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument - -error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:30:23 - | -LL | #![warn(box_pointers, blerp = "or in league with robbers have reversed the signposts")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument - -error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:43:36 - | -LL | #![warn(elided_lifetimes_in_paths, reason("disrespectful to ancestors", "irresponsible to heirs"))] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument - -error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:43:36 - | -LL | #![warn(elided_lifetimes_in_paths, reason("disrespectful to ancestors", "irresponsible to heirs"))] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument - -error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:56:44 - | -LL | #![warn(ellipsis_inclusive_range_patterns, reason = "born barren", reason = "a freak growth")] - | ^^^^^^^^^^^^^^^^^^^^^^ reason in lint attribute must come last - -error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:63:25 - | -LL | #![warn(keyword_idents, reason = "root in rubble", macro_use_extern_crate)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ reason in lint attribute must come last - -error: aborting due to 30 previous errors; 1 warning emitted +error: aborting due to 20 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0452`. diff --git a/src/test/ui/lint/register-tool-lint.rs b/src/test/ui/lint/register-tool-lint.rs index 0ba5a37b167..17d3afbf6e2 100644 --- a/src/test/ui/lint/register-tool-lint.rs +++ b/src/test/ui/lint/register-tool-lint.rs @@ -7,5 +7,3 @@ //~| HELP add `#![register_tool(abc)]` //~| ERROR unknown tool name `abc` //~| HELP add `#![register_tool(abc)]` -//~| ERROR unknown tool name `abc` -//~| HELP add `#![register_tool(abc)]` diff --git a/src/test/ui/lint/register-tool-lint.stderr b/src/test/ui/lint/register-tool-lint.stderr index 750c74cec1e..842d845ff7c 100644 --- a/src/test/ui/lint/register-tool-lint.stderr +++ b/src/test/ui/lint/register-tool-lint.stderr @@ -14,14 +14,6 @@ LL | #![warn(abc::my_lint)] | = help: add `#![register_tool(abc)]` to the crate root -error[E0710]: unknown tool name `abc` found in scoped lint: `abc::my_lint` - --> $DIR/register-tool-lint.rs:5:9 - | -LL | #![warn(abc::my_lint)] - | ^^^ - | - = help: add `#![register_tool(abc)]` to the crate root - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0710`. diff --git a/src/test/ui/lint/use_suggestion_json.stderr b/src/test/ui/lint/use_suggestion_json.stderr index 21342e2ef37..d17514303ab 100644 --- a/src/test/ui/lint/use_suggestion_json.stderr +++ b/src/test/ui/lint/use_suggestion_json.stderr @@ -1,420 +1,3 @@ -{ - "message": "cannot find type `Iter` in this scope", - "code": { - "code": "E0412", - "explanation": "A used type name is not in scope. +{"message":"`--error-format=pretty-json` is unstable","code":null,"level":"error","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[38;5;9merror\u001b[0m\u001b[0m\u001b[1m: `--error-format=pretty-json` is unstable\u001b[0m -Erroneous code examples: - -```compile_fail,E0412 -impl Something {} // error: type name `Something` is not in scope - -// or: - -trait Foo { - fn bar(N); // error: type name `N` is not in scope -} - -// or: - -fn foo(x: T) {} // type name `T` is not in scope -``` - -To fix this error, please verify you didn't misspell the type name, you did -declare it or imported it into the scope. Examples: - -``` -struct Something; - -impl Something {} // ok! - -// or: - -trait Foo { - type N; - - fn bar(_: Self::N); // ok! -} - -// or: - -fn foo<T>(x: T) {} // ok! -``` - -Another case that causes this error is when a type is imported into a parent -module. To fix this, you can follow the suggestion and use File directly or -`use super::File;` which will import the types from the parent namespace. An -example that causes this error is below: - -```compile_fail,E0412 -use std::fs::File; - -mod foo { - fn some_function(f: File) {} -} -``` - -``` -use std::fs::File; - -mod foo { - // either - use super::File; - // or - // use std::fs::File; - fn foo(f: File) {} -} -# fn main() {} // don't insert it for us; that'll break imports -``` -" - }, - "level": "error", - "spans": [ - { - "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 541, - "byte_end": 545, - "line_start": 12, - "line_end": 12, - "column_start": 12, - "column_end": 16, - "is_primary": true, - "text": [ - { - "text": " let x: Iter;", - "highlight_start": 12, - "highlight_end": 16 - } - ], - "label": "not found in this scope", - "suggested_replacement": null, - "suggestion_applicability": null, - "expansion": null - } - ], - "children": [ - { - "message": "consider importing one of these items", - "code": null, - "level": "help", - "spans": [ - { - "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 518, - "byte_end": 518, - "line_start": 11, - "line_end": 11, - "column_start": 1, - "column_end": 1, - "is_primary": true, - "text": [ - { - "text": "fn main() {", - "highlight_start": 1, - "highlight_end": 1 - } - ], - "label": null, - "suggested_replacement": "use std::collections::binary_heap::Iter; - -", - "suggestion_applicability": "Unspecified", - "expansion": null - }, - { - "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 518, - "byte_end": 518, - "line_start": 11, - "line_end": 11, - "column_start": 1, - "column_end": 1, - "is_primary": true, - "text": [ - { - "text": "fn main() {", - "highlight_start": 1, - "highlight_end": 1 - } - ], - "label": null, - "suggested_replacement": "use std::collections::btree_map::Iter; - -", - "suggestion_applicability": "Unspecified", - "expansion": null - }, - { - "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 518, - "byte_end": 518, - "line_start": 11, - "line_end": 11, - "column_start": 1, - "column_end": 1, - "is_primary": true, - "text": [ - { - "text": "fn main() {", - "highlight_start": 1, - "highlight_end": 1 - } - ], - "label": null, - "suggested_replacement": "use std::collections::btree_set::Iter; - -", - "suggestion_applicability": "Unspecified", - "expansion": null - }, - { - "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 518, - "byte_end": 518, - "line_start": 11, - "line_end": 11, - "column_start": 1, - "column_end": 1, - "is_primary": true, - "text": [ - { - "text": "fn main() {", - "highlight_start": 1, - "highlight_end": 1 - } - ], - "label": null, - "suggested_replacement": "use std::collections::hash_map::Iter; - -", - "suggestion_applicability": "Unspecified", - "expansion": null - }, - { - "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 518, - "byte_end": 518, - "line_start": 11, - "line_end": 11, - "column_start": 1, - "column_end": 1, - "is_primary": true, - "text": [ - { - "text": "fn main() {", - "highlight_start": 1, - "highlight_end": 1 - } - ], - "label": null, - "suggested_replacement": "use std::collections::hash_set::Iter; - -", - "suggestion_applicability": "Unspecified", - "expansion": null - }, - { - "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 518, - "byte_end": 518, - "line_start": 11, - "line_end": 11, - "column_start": 1, - "column_end": 1, - "is_primary": true, - "text": [ - { - "text": "fn main() {", - "highlight_start": 1, - "highlight_end": 1 - } - ], - "label": null, - "suggested_replacement": "use std::collections::linked_list::Iter; - -", - "suggestion_applicability": "Unspecified", - "expansion": null - }, - { - "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 518, - "byte_end": 518, - "line_start": 11, - "line_end": 11, - "column_start": 1, - "column_end": 1, - "is_primary": true, - "text": [ - { - "text": "fn main() {", - "highlight_start": 1, - "highlight_end": 1 - } - ], - "label": null, - "suggested_replacement": "use std::collections::vec_deque::Iter; - -", - "suggestion_applicability": "Unspecified", - "expansion": null - }, - { - "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 518, - "byte_end": 518, - "line_start": 11, - "line_end": 11, - "column_start": 1, - "column_end": 1, - "is_primary": true, - "text": [ - { - "text": "fn main() {", - "highlight_start": 1, - "highlight_end": 1 - } - ], - "label": null, - "suggested_replacement": "use std::option::Iter; - -", - "suggestion_applicability": "Unspecified", - "expansion": null - }, - { - "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 518, - "byte_end": 518, - "line_start": 11, - "line_end": 11, - "column_start": 1, - "column_end": 1, - "is_primary": true, - "text": [ - { - "text": "fn main() {", - "highlight_start": 1, - "highlight_end": 1 - } - ], - "label": null, - "suggested_replacement": "use std::path::Iter; - -", - "suggestion_applicability": "Unspecified", - "expansion": null - }, - { - "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 518, - "byte_end": 518, - "line_start": 11, - "line_end": 11, - "column_start": 1, - "column_end": 1, - "is_primary": true, - "text": [ - { - "text": "fn main() {", - "highlight_start": 1, - "highlight_end": 1 - } - ], - "label": null, - "suggested_replacement": "use std::result::Iter; - -", - "suggestion_applicability": "Unspecified", - "expansion": null - }, - { - "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 518, - "byte_end": 518, - "line_start": 11, - "line_end": 11, - "column_start": 1, - "column_end": 1, - "is_primary": true, - "text": [ - { - "text": "fn main() {", - "highlight_start": 1, - "highlight_end": 1 - } - ], - "label": null, - "suggested_replacement": "use std::slice::Iter; - -", - "suggestion_applicability": "Unspecified", - "expansion": null - }, - { - "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 518, - "byte_end": 518, - "line_start": 11, - "line_end": 11, - "column_start": 1, - "column_end": 1, - "is_primary": true, - "text": [ - { - "text": "fn main() {", - "highlight_start": 1, - "highlight_end": 1 - } - ], - "label": null, - "suggested_replacement": "use std::sync::mpsc::Iter; - -", - "suggestion_applicability": "Unspecified", - "expansion": null - } - ], - "children": [], - "rendered": null - } - ], - "rendered": "\u001b[0m\u001b[1m\u001b[38;5;9merror[E0412]\u001b[0m\u001b[0m\u001b[1m: cannot find type `Iter` in this scope\u001b[0m -\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0m$DIR/use_suggestion_json.rs:12:12\u001b[0m -\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m -\u001b[0m\u001b[1m\u001b[38;5;12mLL\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m let x: Iter;\u001b[0m -\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9m^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9mnot found in this scope\u001b[0m -\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m -\u001b[0m\u001b[1m\u001b[38;5;14mhelp\u001b[0m\u001b[0m: consider importing one of these items\u001b[0m -\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m -\u001b[0m\u001b[1m\u001b[38;5;12mLL\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0muse std::collections::binary_heap::Iter;\u001b[0m -\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m -\u001b[0m\u001b[1m\u001b[38;5;12mLL\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0muse std::collections::btree_map::Iter;\u001b[0m -\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m -\u001b[0m\u001b[1m\u001b[38;5;12mLL\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0muse std::collections::btree_set::Iter;\u001b[0m -\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m -\u001b[0m\u001b[1m\u001b[38;5;12mLL\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0muse std::collections::hash_map::Iter;\u001b[0m -\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m -\u001b[0m and 8 other candidates\u001b[0m - -" -} -{ - "message": "aborting due to previous error", - "code": null, - "level": "error", - "spans": [], - "children": [], - "rendered": "\u001b[0m\u001b[1m\u001b[38;5;9merror\u001b[0m\u001b[0m\u001b[1m: aborting due to previous error\u001b[0m - -" -} -{ - "message": "For more information about this error, try `rustc --explain E0412`.", - "code": null, - "level": "failure-note", - "spans": [], - "children": [], - "rendered": "\u001b[0m\u001b[1mFor more information about this error, try `rustc --explain E0412`.\u001b[0m -" -} +"} diff --git a/src/test/ui/parser/brace-after-qualified-path-in-match.rs b/src/test/ui/parser/brace-after-qualified-path-in-match.rs deleted file mode 100644 index f4152086162..00000000000 --- a/src/test/ui/parser/brace-after-qualified-path-in-match.rs +++ /dev/null @@ -1,7 +0,0 @@ -fn main() { - match 10 { - <T as Trait>::Type{key: value} => (), - //~^ ERROR unexpected `{` after qualified path - _ => (), - } -} diff --git a/src/test/ui/parser/brace-after-qualified-path-in-match.stderr b/src/test/ui/parser/brace-after-qualified-path-in-match.stderr deleted file mode 100644 index d6fdf353f07..00000000000 --- a/src/test/ui/parser/brace-after-qualified-path-in-match.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: unexpected `{` after qualified path - --> $DIR/brace-after-qualified-path-in-match.rs:3:27 - | -LL | <T as Trait>::Type{key: value} => (), - | ------------------^ unexpected `{` after qualified path - | | - | the qualified path - -error: aborting due to previous error - diff --git a/src/test/ui/parser/paren-after-qualified-path-in-match.rs b/src/test/ui/parser/paren-after-qualified-path-in-match.rs deleted file mode 100644 index 68b1c2baf10..00000000000 --- a/src/test/ui/parser/paren-after-qualified-path-in-match.rs +++ /dev/null @@ -1,7 +0,0 @@ -fn main() { - match 10 { - <T as Trait>::Type(2) => (), - //~^ ERROR unexpected `(` after qualified path - _ => (), - } -} diff --git a/src/test/ui/parser/paren-after-qualified-path-in-match.stderr b/src/test/ui/parser/paren-after-qualified-path-in-match.stderr deleted file mode 100644 index af21f919546..00000000000 --- a/src/test/ui/parser/paren-after-qualified-path-in-match.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: unexpected `(` after qualified path - --> $DIR/paren-after-qualified-path-in-match.rs:3:27 - | -LL | <T as Trait>::Type(2) => (), - | ------------------^ unexpected `(` after qualified path - | | - | the qualified path - -error: aborting due to previous error - diff --git a/src/test/ui/reify-intrinsic.rs b/src/test/ui/reify-intrinsic.rs index 05535b92cca..9eb2f724017 100644 --- a/src/test/ui/reify-intrinsic.rs +++ b/src/test/ui/reify-intrinsic.rs @@ -1,6 +1,6 @@ // check-fail -#![feature(intrinsics)] +#![feature(core_intrinsics, intrinsics)] fn a() { let _: unsafe extern "rust-intrinsic" fn(isize) -> usize = std::mem::transmute; @@ -14,8 +14,8 @@ fn b() { fn c() { let _ = [ - std::intrinsics::copy_nonoverlapping::<i32>, - std::intrinsics::copy::<i32>, + std::intrinsics::likely, + std::intrinsics::unlikely, //~^ ERROR cannot coerce ]; } diff --git a/src/test/ui/reify-intrinsic.stderr b/src/test/ui/reify-intrinsic.stderr index 5d82fdbd311..69c11b5c56f 100644 --- a/src/test/ui/reify-intrinsic.stderr +++ b/src/test/ui/reify-intrinsic.stderr @@ -22,11 +22,11 @@ LL | let _ = std::mem::transmute as unsafe extern "rust-intrinsic" fn(isize) error[E0308]: cannot coerce intrinsics to function pointers --> $DIR/reify-intrinsic.rs:18:9 | -LL | std::intrinsics::copy::<i32>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot coerce intrinsics to function pointers +LL | std::intrinsics::unlikely, + | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot coerce intrinsics to function pointers | - = note: expected type `unsafe extern "rust-intrinsic" fn(_, _, _) {copy_nonoverlapping::<i32>}` - found fn item `unsafe extern "rust-intrinsic" fn(_, _, _) {std::intrinsics::copy::<i32>}` + = note: expected type `extern "rust-intrinsic" fn(_) -> _ {likely}` + found fn item `extern "rust-intrinsic" fn(_) -> _ {unlikely}` error: aborting due to 3 previous errors diff --git a/src/test/ui/simd/wasm-simd-indirect.rs b/src/test/ui/simd/wasm-simd-indirect.rs index deac593df43..88f92fce2b2 100644 --- a/src/test/ui/simd/wasm-simd-indirect.rs +++ b/src/test/ui/simd/wasm-simd-indirect.rs @@ -1,7 +1,5 @@ // build-pass -#![cfg_attr(target_arch = "wasm32", feature(wasm_simd, wasm_target_feature))] - #[cfg(target_arch = "wasm32")] fn main() { unsafe { diff --git a/src/test/ui/suggestions/issue-86100-tuple-paren-comma.rs b/src/test/ui/suggestions/issue-86100-tuple-paren-comma.rs new file mode 100644 index 00000000000..fa9d1a88928 --- /dev/null +++ b/src/test/ui/suggestions/issue-86100-tuple-paren-comma.rs @@ -0,0 +1,25 @@ +// Tests that a suggestion is issued for type mismatch errors when a +// 1-tuple is expected and a parenthesized expression of non-tuple +// type is supplied. + +fn foo<T>(_t: (T,)) {} +struct S { _s: (String,) } + +fn main() { + let _x: (i32,) = (5); + //~^ ERROR: mismatched types [E0308] + //~| HELP: use a trailing comma to create a tuple with one element + + foo((Some(3))); + //~^ ERROR: mismatched types [E0308] + //~| HELP: use a trailing comma to create a tuple with one element + + let _s = S { _s: ("abc".to_string()) }; + //~^ ERROR: mismatched types [E0308] + //~| HELP: use a trailing comma to create a tuple with one element + + // Do not issue the suggestion if the found type is already a tuple. + let t = (1, 2); + let _x: (i32,) = (t); + //~^ ERROR: mismatched types [E0308] +} diff --git a/src/test/ui/suggestions/issue-86100-tuple-paren-comma.stderr b/src/test/ui/suggestions/issue-86100-tuple-paren-comma.stderr new file mode 100644 index 00000000000..575379690b4 --- /dev/null +++ b/src/test/ui/suggestions/issue-86100-tuple-paren-comma.stderr @@ -0,0 +1,55 @@ +error[E0308]: mismatched types + --> $DIR/issue-86100-tuple-paren-comma.rs:9:22 + | +LL | let _x: (i32,) = (5); + | ------ ^^^ expected tuple, found integer + | | + | expected due to this + | + = note: expected tuple `(i32,)` + found type `{integer}` +help: use a trailing comma to create a tuple with one element + | +LL | let _x: (i32,) = (5,); + | ^^^^ + +error[E0308]: mismatched types + --> $DIR/issue-86100-tuple-paren-comma.rs:13:9 + | +LL | foo((Some(3))); + | ^^^^^^^^^ expected tuple, found enum `Option` + | + = note: expected tuple `(_,)` + found enum `Option<{integer}>` +help: use a trailing comma to create a tuple with one element + | +LL | foo((Some(3),)); + | ^^^^^^^^^^ + +error[E0308]: mismatched types + --> $DIR/issue-86100-tuple-paren-comma.rs:17:22 + | +LL | let _s = S { _s: ("abc".to_string()) }; + | ^^^^^^^^^^^^^^^^^^^ expected tuple, found struct `String` + | + = note: expected tuple `(String,)` + found struct `String` +help: use a trailing comma to create a tuple with one element + | +LL | let _s = S { _s: ("abc".to_string(),) }; + | ^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: mismatched types + --> $DIR/issue-86100-tuple-paren-comma.rs:23:22 + | +LL | let _x: (i32,) = (t); + | ------ ^^^ expected a tuple with 1 element, found one with 2 elements + | | + | expected due to this + | + = note: expected tuple `(i32,)` + found tuple `({integer}, {integer})` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/thread-local-static.rs b/src/test/ui/thread-local-static.rs index c7fee9e6b4c..dc542fe2db9 100644 --- a/src/test/ui/thread-local-static.rs +++ b/src/test/ui/thread-local-static.rs @@ -11,6 +11,7 @@ const fn g(x: &mut [u32; 8]) { //~| ERROR mutable references are not allowed //~| ERROR use of mutable static is unsafe //~| constant functions cannot refer to statics + //~| ERROR calls in constant functions are limited to constant functions } fn main() {} diff --git a/src/test/ui/thread-local-static.stderr b/src/test/ui/thread-local-static.stderr index 08bf593a5a7..a213282eb85 100644 --- a/src/test/ui/thread-local-static.stderr +++ b/src/test/ui/thread-local-static.stderr @@ -30,6 +30,12 @@ LL | std::mem::swap(x, &mut STATIC_VAR_2) = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable +error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants + --> $DIR/thread-local-static.rs:9:5 + | +LL | std::mem::swap(x, &mut STATIC_VAR_2) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error[E0133]: use of mutable static is unsafe and requires unsafe function or block --> $DIR/thread-local-static.rs:9:23 | @@ -38,7 +44,7 @@ LL | std::mem::swap(x, &mut STATIC_VAR_2) | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior -error: aborting due to 5 previous errors +error: aborting due to 6 previous errors -Some errors have detailed explanations: E0013, E0133, E0658. +Some errors have detailed explanations: E0013, E0015, E0133, E0658. For more information about an error, try `rustc --explain E0013`. diff --git a/src/test/ui/tool_lints.rs b/src/test/ui/tool_lints.rs index 9e4aa7a939a..ef27532f6de 100644 --- a/src/test/ui/tool_lints.rs +++ b/src/test/ui/tool_lints.rs @@ -1,5 +1,4 @@ #[warn(foo::bar)] //~^ ERROR unknown tool name `foo` found in scoped lint: `foo::bar` //~| ERROR unknown tool name `foo` found in scoped lint: `foo::bar` -//~| ERROR unknown tool name `foo` found in scoped lint: `foo::bar` fn main() {} diff --git a/src/test/ui/tool_lints.stderr b/src/test/ui/tool_lints.stderr index e06f6ddc1ca..d36cd193b15 100644 --- a/src/test/ui/tool_lints.stderr +++ b/src/test/ui/tool_lints.stderr @@ -14,14 +14,6 @@ LL | #[warn(foo::bar)] | = help: add `#![register_tool(foo)]` to the crate root -error[E0710]: unknown tool name `foo` found in scoped lint: `foo::bar` - --> $DIR/tool_lints.rs:1:8 - | -LL | #[warn(foo::bar)] - | ^^^ - | - = help: add `#![register_tool(foo)]` to the crate root - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0710`. diff --git a/src/test/ui/unknown-lint-tool-name.rs b/src/test/ui/unknown-lint-tool-name.rs index 84ab7c1944a..cd5d2f028af 100644 --- a/src/test/ui/unknown-lint-tool-name.rs +++ b/src/test/ui/unknown-lint-tool-name.rs @@ -1,8 +1,6 @@ #![deny(foo::bar)] //~ ERROR unknown tool name `foo` found in scoped lint: `foo::bar` //~| ERROR unknown tool name `foo` found in scoped lint: `foo::bar` - //~| ERROR unknown tool name `foo` found in scoped lint: `foo::bar` #[allow(foo::bar)] //~ ERROR unknown tool name `foo` found in scoped lint: `foo::bar` //~| ERROR unknown tool name `foo` found in scoped lint: `foo::bar` - //~| ERROR unknown tool name `foo` found in scoped lint: `foo::bar` fn main() {} diff --git a/src/test/ui/unknown-lint-tool-name.stderr b/src/test/ui/unknown-lint-tool-name.stderr index 1d145515abf..5f8349ce6c3 100644 --- a/src/test/ui/unknown-lint-tool-name.stderr +++ b/src/test/ui/unknown-lint-tool-name.stderr @@ -7,7 +7,7 @@ LL | #![deny(foo::bar)] = help: add `#![register_tool(foo)]` to the crate root error[E0710]: unknown tool name `foo` found in scoped lint: `foo::bar` - --> $DIR/unknown-lint-tool-name.rs:5:9 + --> $DIR/unknown-lint-tool-name.rs:4:9 | LL | #[allow(foo::bar)] | ^^^ @@ -23,29 +23,13 @@ LL | #![deny(foo::bar)] = help: add `#![register_tool(foo)]` to the crate root error[E0710]: unknown tool name `foo` found in scoped lint: `foo::bar` - --> $DIR/unknown-lint-tool-name.rs:5:9 + --> $DIR/unknown-lint-tool-name.rs:4:9 | LL | #[allow(foo::bar)] | ^^^ | = help: add `#![register_tool(foo)]` to the crate root -error[E0710]: unknown tool name `foo` found in scoped lint: `foo::bar` - --> $DIR/unknown-lint-tool-name.rs:1:9 - | -LL | #![deny(foo::bar)] - | ^^^ - | - = help: add `#![register_tool(foo)]` to the crate root - -error[E0710]: unknown tool name `foo` found in scoped lint: `foo::bar` - --> $DIR/unknown-lint-tool-name.rs:5:9 - | -LL | #[allow(foo::bar)] - | ^^^ - | - = help: add `#![register_tool(foo)]` to the crate root - -error: aborting due to 6 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0710`. diff --git a/src/test/ui/unused-crate-deps/extern-loc-bad-loctype.rs b/src/test/ui/unused-crate-deps/extern-loc-bad-loctype.rs index 3e1527e2c2e..e69df0359fd 100644 --- a/src/test/ui/unused-crate-deps/extern-loc-bad-loctype.rs +++ b/src/test/ui/unused-crate-deps/extern-loc-bad-loctype.rs @@ -1,7 +1,7 @@ // --extern-location with bad location type // aux-crate:bar=bar.rs -// compile-flags:--extern-location bar=badloc:in-the-test-file +// compile-flags:--extern-location bar=badloc:in-the-test-file -Z unstable-options #![warn(unused_crate_dependencies)] diff --git a/src/test/ui/unused-crate-deps/extern-loc-json-bad-json.rs b/src/test/ui/unused-crate-deps/extern-loc-json-bad-json.rs index 6fdf710a126..aee6233e428 100644 --- a/src/test/ui/unused-crate-deps/extern-loc-json-bad-json.rs +++ b/src/test/ui/unused-crate-deps/extern-loc-json-bad-json.rs @@ -1,7 +1,7 @@ // --extern-location with a raw reference // aux-crate:bar=bar.rs -// compile-flags:--extern-location bar=json:[{"malformed +// compile-flags:--extern-location bar=json:[{"malformed -Z unstable-options #![warn(unused_crate_dependencies)] diff --git a/src/test/ui/unused-crate-deps/extern-loc-json-json.rs b/src/test/ui/unused-crate-deps/extern-loc-json-json.rs index 02a9869151f..c7988cd469e 100644 --- a/src/test/ui/unused-crate-deps/extern-loc-json-json.rs +++ b/src/test/ui/unused-crate-deps/extern-loc-json-json.rs @@ -2,7 +2,7 @@ // check-pass // aux-crate:bar=bar.rs -// compile-flags:--extern-location bar=json:{"key":123,"value":{}} --error-format json +// compile-flags:--extern-location bar=json:{"key":123,"value":{}} --error-format json -Z unstable-options #![warn(unused_crate_dependencies)] //~^ WARNING external crate `bar` unused in diff --git a/src/test/ui/unused-crate-deps/extern-loc-json-json.stderr b/src/test/ui/unused-crate-deps/extern-loc-json-json.stderr index 5fc8397e469..001ec6a2554 100644 --- a/src/test/ui/unused-crate-deps/extern-loc-json-json.stderr +++ b/src/test/ui/unused-crate-deps/extern-loc-json-json.stderr @@ -1,4 +1,4 @@ -{"message":"external crate `bar` unused in `extern_loc_json_json`: remove the dependency or add `use bar as _;`","code":{"code":"unused_crate_dependencies","explanation":null},"level":"warning","spans":[{"file_name":"$DIR/extern-loc-json-json.rs","byte_start":169,"byte_end":169,"line_start":7,"line_end":7,"column_start":1,"column_end":1,"is_primary":true,"text":[{"text":"#![warn(unused_crate_dependencies)]","highlight_start":1,"highlight_end":1}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the lint level is defined here","code":null,"level":"note","spans":[{"file_name":"$DIR/extern-loc-json-json.rs","byte_start":177,"byte_end":202,"line_start":7,"line_end":7,"column_start":9,"column_end":34,"is_primary":true,"text":[{"text":"#![warn(unused_crate_dependencies)]","highlight_start":9,"highlight_end":34}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null},{"message":"remove unnecessary dependency `bar`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"json extern location","code":null,"level":"help","spans":[],"children":[],"rendered":null,"tool_metadata":{"key":123,"value":{}}}],"rendered":"warning: external crate `bar` unused in `extern_loc_json_json`: remove the dependency or add `use bar as _;` +{"message":"external crate `bar` unused in `extern_loc_json_json`: remove the dependency or add `use bar as _;`","code":{"code":"unused_crate_dependencies","explanation":null},"level":"warning","spans":[{"file_name":"$DIR/extern-loc-json-json.rs","byte_start":189,"byte_end":189,"line_start":7,"line_end":7,"column_start":1,"column_end":1,"is_primary":true,"text":[{"text":"#![warn(unused_crate_dependencies)]","highlight_start":1,"highlight_end":1}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the lint level is defined here","code":null,"level":"note","spans":[{"file_name":"$DIR/extern-loc-json-json.rs","byte_start":197,"byte_end":222,"line_start":7,"line_end":7,"column_start":9,"column_end":34,"is_primary":true,"text":[{"text":"#![warn(unused_crate_dependencies)]","highlight_start":9,"highlight_end":34}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null},{"message":"remove unnecessary dependency `bar`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"json extern location","code":null,"level":"help","spans":[],"children":[],"rendered":null,"tool_metadata":{"key":123,"value":{}}}],"rendered":"warning: external crate `bar` unused in `extern_loc_json_json`: remove the dependency or add `use bar as _;` --> $DIR/extern-loc-json-json.rs:7:1 | LL | #![warn(unused_crate_dependencies)] diff --git a/src/test/ui/unused-crate-deps/extern-loc-json.rs b/src/test/ui/unused-crate-deps/extern-loc-json.rs index 212610d532e..c0d76c86b89 100644 --- a/src/test/ui/unused-crate-deps/extern-loc-json.rs +++ b/src/test/ui/unused-crate-deps/extern-loc-json.rs @@ -2,7 +2,7 @@ // check-pass // aux-crate:bar=bar.rs -// compile-flags:--extern-location bar=json:{"key":123,"value":{}} +// compile-flags:--extern-location bar=json:{"key":123,"value":{}} -Z unstable-options #![warn(unused_crate_dependencies)] //~^ WARNING external crate `bar` unused in diff --git a/src/test/ui/unused-crate-deps/extern-loc-missing-loctype.rs b/src/test/ui/unused-crate-deps/extern-loc-missing-loctype.rs index 4768365a653..3590b9c2812 100644 --- a/src/test/ui/unused-crate-deps/extern-loc-missing-loctype.rs +++ b/src/test/ui/unused-crate-deps/extern-loc-missing-loctype.rs @@ -1,7 +1,7 @@ // --extern-location with no type // aux-crate:bar=bar.rs -// compile-flags:--extern-location bar=missing-loc-type +// compile-flags:--extern-location bar=missing-loc-type -Z unstable-options #![warn(unused_crate_dependencies)] diff --git a/src/test/ui/unused-crate-deps/extern-loc-raw-json.rs b/src/test/ui/unused-crate-deps/extern-loc-raw-json.rs index 207615ccc87..64c3d77ce08 100644 --- a/src/test/ui/unused-crate-deps/extern-loc-raw-json.rs +++ b/src/test/ui/unused-crate-deps/extern-loc-raw-json.rs @@ -2,7 +2,7 @@ // check-pass // aux-crate:bar=bar.rs -// compile-flags:--extern-location bar=raw:in-the-test-file --error-format json +// compile-flags:--extern-location bar=raw:in-the-test-file --error-format json -Z unstable-options #![warn(unused_crate_dependencies)] //~^ WARNING external crate `bar` unused in diff --git a/src/test/ui/unused-crate-deps/extern-loc-raw-json.stderr b/src/test/ui/unused-crate-deps/extern-loc-raw-json.stderr index 25f099927fd..4083bd51835 100644 --- a/src/test/ui/unused-crate-deps/extern-loc-raw-json.stderr +++ b/src/test/ui/unused-crate-deps/extern-loc-raw-json.stderr @@ -1,4 +1,4 @@ -{"message":"external crate `bar` unused in `extern_loc_raw_json`: remove the dependency or add `use bar as _;`","code":{"code":"unused_crate_dependencies","explanation":null},"level":"warning","spans":[{"file_name":"$DIR/extern-loc-raw-json.rs","byte_start":162,"byte_end":162,"line_start":7,"line_end":7,"column_start":1,"column_end":1,"is_primary":true,"text":[{"text":"#![warn(unused_crate_dependencies)]","highlight_start":1,"highlight_end":1}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the lint level is defined here","code":null,"level":"note","spans":[{"file_name":"$DIR/extern-loc-raw-json.rs","byte_start":170,"byte_end":195,"line_start":7,"line_end":7,"column_start":9,"column_end":34,"is_primary":true,"text":[{"text":"#![warn(unused_crate_dependencies)]","highlight_start":9,"highlight_end":34}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null},{"message":"remove unnecessary dependency `bar` at `in-the-test-file`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"raw extern location","code":null,"level":"help","spans":[{"file_name":"$DIR/extern-loc-raw-json.rs","byte_start":0,"byte_end":0,"line_start":1,"line_end":1,"column_start":1,"column_end":1,"is_primary":true,"text":[],"label":null,"suggested_replacement":"in-the-test-file","suggestion_applicability":"Unspecified","expansion":null}],"children":[],"rendered":null},{"message":"json extern location","code":null,"level":"help","spans":[],"children":[],"rendered":null,"tool_metadata":"in-the-test-file"}],"rendered":"warning: external crate `bar` unused in `extern_loc_raw_json`: remove the dependency or add `use bar as _;` +{"message":"external crate `bar` unused in `extern_loc_raw_json`: remove the dependency or add `use bar as _;`","code":{"code":"unused_crate_dependencies","explanation":null},"level":"warning","spans":[{"file_name":"$DIR/extern-loc-raw-json.rs","byte_start":182,"byte_end":182,"line_start":7,"line_end":7,"column_start":1,"column_end":1,"is_primary":true,"text":[{"text":"#![warn(unused_crate_dependencies)]","highlight_start":1,"highlight_end":1}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the lint level is defined here","code":null,"level":"note","spans":[{"file_name":"$DIR/extern-loc-raw-json.rs","byte_start":190,"byte_end":215,"line_start":7,"line_end":7,"column_start":9,"column_end":34,"is_primary":true,"text":[{"text":"#![warn(unused_crate_dependencies)]","highlight_start":9,"highlight_end":34}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null},{"message":"remove unnecessary dependency `bar` at `in-the-test-file`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"raw extern location","code":null,"level":"help","spans":[{"file_name":"$DIR/extern-loc-raw-json.rs","byte_start":0,"byte_end":0,"line_start":1,"line_end":1,"column_start":1,"column_end":1,"is_primary":true,"text":[],"label":null,"suggested_replacement":"in-the-test-file","suggestion_applicability":"Unspecified","expansion":null}],"children":[],"rendered":null},{"message":"json extern location","code":null,"level":"help","spans":[],"children":[],"rendered":null,"tool_metadata":"in-the-test-file"}],"rendered":"warning: external crate `bar` unused in `extern_loc_raw_json`: remove the dependency or add `use bar as _;` --> $DIR/extern-loc-raw-json.rs:7:1 | LL | #![warn(unused_crate_dependencies)] diff --git a/src/test/ui/unused-crate-deps/extern-loc-raw-missing-loc.rs b/src/test/ui/unused-crate-deps/extern-loc-raw-missing-loc.rs index 65b64268394..a9e7afbda31 100644 --- a/src/test/ui/unused-crate-deps/extern-loc-raw-missing-loc.rs +++ b/src/test/ui/unused-crate-deps/extern-loc-raw-missing-loc.rs @@ -1,7 +1,7 @@ // --extern-location with a raw reference // aux-crate:bar=bar.rs -// compile-flags:--extern-location bar=raw +// compile-flags:--extern-location bar=raw -Z unstable-options #![warn(unused_crate_dependencies)] diff --git a/src/test/ui/unused-crate-deps/extern-loc-raw.rs b/src/test/ui/unused-crate-deps/extern-loc-raw.rs index fc3fed1e10e..27d0975d01a 100644 --- a/src/test/ui/unused-crate-deps/extern-loc-raw.rs +++ b/src/test/ui/unused-crate-deps/extern-loc-raw.rs @@ -2,7 +2,7 @@ // check-pass // aux-crate:bar=bar.rs -// compile-flags:--extern-location bar=raw:in-the-test-file +// compile-flags:--extern-location bar=raw:in-the-test-file -Z unstable-options #![warn(unused_crate_dependencies)] //~^ WARNING external crate `bar` unused in diff --git a/src/tools/clippy/clippy_lints/src/misc_early/unneeded_field_pattern.rs b/src/tools/clippy/clippy_lints/src/misc_early/unneeded_field_pattern.rs index 329a0009a3e..2201cf56d52 100644 --- a/src/tools/clippy/clippy_lints/src/misc_early/unneeded_field_pattern.rs +++ b/src/tools/clippy/clippy_lints/src/misc_early/unneeded_field_pattern.rs @@ -5,7 +5,7 @@ use rustc_lint::{EarlyContext, LintContext}; use super::UNNEEDED_FIELD_PATTERN; pub(super) fn check(cx: &EarlyContext<'_>, pat: &Pat) { - if let PatKind::Struct(ref npat, ref pfields, _) = pat.kind { + if let PatKind::Struct(_, ref npat, ref pfields, _) = pat.kind { let mut wilds = 0; let type_name = npat .segments diff --git a/src/tools/clippy/clippy_lints/src/misc_early/unneeded_wildcard_pattern.rs b/src/tools/clippy/clippy_lints/src/misc_early/unneeded_wildcard_pattern.rs index 4dd032d78f1..df044538fe1 100644 --- a/src/tools/clippy/clippy_lints/src/misc_early/unneeded_wildcard_pattern.rs +++ b/src/tools/clippy/clippy_lints/src/misc_early/unneeded_wildcard_pattern.rs @@ -7,7 +7,7 @@ use rustc_span::source_map::Span; use super::UNNEEDED_WILDCARD_PATTERN; pub(super) fn check(cx: &EarlyContext<'_>, pat: &Pat) { - if let PatKind::TupleStruct(_, ref patterns) | PatKind::Tuple(ref patterns) = pat.kind { + if let PatKind::TupleStruct(_, _, ref patterns) | PatKind::Tuple(ref patterns) = pat.kind { if let Some(rest_index) = patterns.iter().position(|pat| pat.is_rest()) { if let Some((left_index, left_pat)) = patterns[..rest_index] .iter() diff --git a/src/tools/clippy/clippy_lints/src/non_expressive_names.rs b/src/tools/clippy/clippy_lints/src/non_expressive_names.rs index 5292af5f076..1a23e6afe28 100644 --- a/src/tools/clippy/clippy_lints/src/non_expressive_names.rs +++ b/src/tools/clippy/clippy_lints/src/non_expressive_names.rs @@ -139,7 +139,7 @@ impl<'a, 'tcx, 'b> Visitor<'tcx> for SimilarNamesNameVisitor<'a, 'tcx, 'b> { self.check_ident(ident); } }, - PatKind::Struct(_, ref fields, _) => { + PatKind::Struct(_, _, ref fields, _) => { for field in fields { if !field.is_shorthand { self.visit_pat(&field.pat); diff --git a/src/tools/clippy/clippy_lints/src/unnested_or_patterns.rs b/src/tools/clippy/clippy_lints/src/unnested_or_patterns.rs index 3e985fa72b8..1b3c457b01a 100644 --- a/src/tools/clippy/clippy_lints/src/unnested_or_patterns.rs +++ b/src/tools/clippy/clippy_lints/src/unnested_or_patterns.rs @@ -1,6 +1,6 @@ #![allow(clippy::wildcard_imports, clippy::enum_glob_use)] -use clippy_utils::ast_utils::{eq_field_pat, eq_id, eq_pat, eq_path}; +use clippy_utils::ast_utils::{eq_field_pat, eq_id, eq_pat, eq_path, eq_maybe_qself}; use clippy_utils::diagnostics::span_lint_and_then; use clippy_utils::{meets_msrv, msrvs, over}; use rustc_ast::mut_visit::*; @@ -273,16 +273,16 @@ fn transform_with_focus_on_idx(alternatives: &mut Vec<P<Pat>>, focus_idx: usize) |k| always_pat!(k, Tuple(ps) => ps), ), // Transform `S(pre, x, post) | ... | S(pre, y, post)` into `S(pre, x | y, post)`. - TupleStruct(path1, ps1) => extend_with_matching_product( + TupleStruct(qself1, path1, ps1) => extend_with_matching_product( ps1, start, alternatives, |k, ps1, idx| matches!( k, - TupleStruct(path2, ps2) if eq_path(path1, path2) && eq_pre_post(ps1, ps2, idx) + TupleStruct(qself2, path2, ps2) if eq_maybe_qself(qself1, qself2) && eq_path(path1, path2) && eq_pre_post(ps1, ps2, idx) ), - |k| always_pat!(k, TupleStruct(_, ps) => ps), + |k| always_pat!(k, TupleStruct(_, _, ps) => ps), ), // Transform a record pattern `S { fp_0, ..., fp_n }`. - Struct(path1, fps1, rest1) => extend_with_struct_pat(path1, fps1, *rest1, start, alternatives), + Struct(qself1, path1, fps1, rest1) => extend_with_struct_pat(qself1, path1, fps1, *rest1, start, alternatives), }; alternatives[focus_idx].kind = focus_kind; @@ -294,6 +294,7 @@ fn transform_with_focus_on_idx(alternatives: &mut Vec<P<Pat>>, focus_idx: usize) /// So when we fixate on some `ident_k: pat_k`, we try to find `ident_k` in the other pattern /// and check that all `fp_i` where `i ∈ ((0...n) \ k)` between two patterns are equal. fn extend_with_struct_pat( + qself1: &Option<ast::QSelf>, path1: &ast::Path, fps1: &mut Vec<ast::PatField>, rest1: bool, @@ -306,8 +307,9 @@ fn extend_with_struct_pat( start, alternatives, |k| { - matches!(k, Struct(path2, fps2, rest2) + matches!(k, Struct(qself2, path2, fps2, rest2) if rest1 == *rest2 // If one struct pattern has `..` so must the other. + && eq_maybe_qself(qself1, qself2) && eq_path(path1, path2) && fps1.len() == fps2.len() && fps1.iter().enumerate().all(|(idx_1, fp1)| { @@ -323,7 +325,7 @@ fn extend_with_struct_pat( })) }, // Extract `p2_k`. - |k| always_pat!(k, Struct(_, mut fps, _) => fps.swap_remove(pos_in_2.take().unwrap()).pat), + |k| always_pat!(k, Struct(_, _, mut fps, _) => fps.swap_remove(pos_in_2.take().unwrap()).pat), ); extend_with_tail_or(&mut fps1[idx].pat, tail_or) }) diff --git a/src/tools/clippy/clippy_utils/src/ast_utils.rs b/src/tools/clippy/clippy_utils/src/ast_utils.rs index 93e10c836cc..e6d84bc7560 100644 --- a/src/tools/clippy/clippy_utils/src/ast_utils.rs +++ b/src/tools/clippy/clippy_utils/src/ast_utils.rs @@ -47,9 +47,9 @@ pub fn eq_pat(l: &Pat, r: &Pat) -> bool { | (Ref(l, Mutability::Mut), Ref(r, Mutability::Mut)) => eq_pat(l, r), (Tuple(l), Tuple(r)) | (Slice(l), Slice(r)) => over(l, r, |l, r| eq_pat(l, r)), (Path(lq, lp), Path(rq, rp)) => both(lq, rq, |l, r| eq_qself(l, r)) && eq_path(lp, rp), - (TupleStruct(lp, lfs), TupleStruct(rp, rfs)) => eq_path(lp, rp) && over(lfs, rfs, |l, r| eq_pat(l, r)), - (Struct(lp, lfs, lr), Struct(rp, rfs, rr)) => { - lr == rr && eq_path(lp, rp) && unordered_over(lfs, rfs, |lf, rf| eq_field_pat(lf, rf)) + (TupleStruct(lqself, lp, lfs), TupleStruct(rqself, rp, rfs)) => eq_maybe_qself(lqself, rqself) && eq_path(lp, rp) && over(lfs, rfs, |l, r| eq_pat(l, r)), + (Struct(lqself, lp, lfs, lr), Struct(rqself, rp, rfs, rr)) => { + lr == rr && eq_maybe_qself(lqself, rqself) &&eq_path(lp, rp) && unordered_over(lfs, rfs, |lf, rf| eq_field_pat(lf, rf)) }, (Or(ls), Or(rs)) => unordered_over(ls, rs, |l, r| eq_pat(l, r)), (MacCall(l), MacCall(r)) => eq_mac_call(l, r), @@ -78,6 +78,14 @@ pub fn eq_qself(l: &QSelf, r: &QSelf) -> bool { l.position == r.position && eq_ty(&l.ty, &r.ty) } +pub fn eq_maybe_qself(l: &Option<QSelf>, r: &Option<QSelf>) -> bool { + match (l, r) { + (Some(l), Some(r)) => eq_qself(l, r), + (None, None) => true, + _ => false + } +} + pub fn eq_path(l: &Path, r: &Path) -> bool { over(&l.segments, &r.segments, |l, r| eq_path_seg(l, r)) } @@ -170,7 +178,8 @@ pub fn eq_expr(l: &Expr, r: &Expr) -> bool { (Path(lq, lp), Path(rq, rp)) => both(lq, rq, |l, r| eq_qself(l, r)) && eq_path(lp, rp), (MacCall(l), MacCall(r)) => eq_mac_call(l, r), (Struct(lse), Struct(rse)) => { - eq_path(&lse.path, &rse.path) + eq_maybe_qself(&lse.qself, &rse.qself) + && eq_path(&lse.path, &rse.path) && eq_struct_rest(&lse.rest, &rse.rest) && unordered_over(&lse.fields, &rse.fields, |l, r| eq_field(l, r)) }, diff --git a/src/tools/clippy/clippy_utils/src/paths.rs b/src/tools/clippy/clippy_utils/src/paths.rs index 8037d670500..b913d1ce8b1 100644 --- a/src/tools/clippy/clippy_utils/src/paths.rs +++ b/src/tools/clippy/clippy_utils/src/paths.rs @@ -116,8 +116,8 @@ pub const PERMISSIONS_FROM_MODE: [&str; 7] = ["std", "os", "imp", "unix", "fs", pub const POLL: [&str; 4] = ["core", "task", "poll", "Poll"]; pub const POLL_PENDING: [&str; 5] = ["core", "task", "poll", "Poll", "Pending"]; pub const POLL_READY: [&str; 5] = ["core", "task", "poll", "Poll", "Ready"]; -pub const PTR_COPY: [&str; 4] = ["core", "intrinsics", "", "copy"]; -pub const PTR_COPY_NONOVERLAPPING: [&str; 4] = ["core", "intrinsics", "", "copy_nonoverlapping"]; +pub const PTR_COPY: [&str; 3] = ["core", "intrinsics", "copy"]; +pub const PTR_COPY_NONOVERLAPPING: [&str; 3] = ["core", "intrinsics", "copy_nonoverlapping"]; pub const PTR_EQ: [&str; 3] = ["core", "ptr", "eq"]; pub const PTR_NULL: [&str; 3] = ["core", "ptr", "null"]; pub const PTR_NULL_MUT: [&str; 3] = ["core", "ptr", "null_mut"]; diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 408c0b8da0b..a5b526be86f 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -346,6 +346,9 @@ pub struct Config { /// whether to run `tidy` when a rustdoc test fails pub has_tidy: bool, + /// The current Rust channel + pub channel: String, + // Configuration for various run-make tests frobbing things like C compilers // or querying about various LLVM component information. pub cc: String, diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 983934d129a..26c1710be74 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -50,6 +50,15 @@ impl EarlyProps { let has_msan = util::MSAN_SUPPORTED_TARGETS.contains(&&*config.target); let has_tsan = util::TSAN_SUPPORTED_TARGETS.contains(&&*config.target); let has_hwasan = util::HWASAN_SUPPORTED_TARGETS.contains(&&*config.target); + // for `-Z gcc-ld=lld` + let has_rust_lld = config + .compile_lib_path + .join("rustlib") + .join(&config.target) + .join("bin") + .join("gcc-ld") + .join(if config.host.contains("windows") { "ld.exe" } else { "ld" }) + .exists(); iter_header(testfile, None, rdr, &mut |ln| { // we should check if any only-<platform> exists and if it exists @@ -136,6 +145,10 @@ impl EarlyProps { if config.debugger == Some(Debugger::Lldb) && ignore_lldb(config, ln) { props.ignore = true; } + + if !has_rust_lld && config.parse_name_directive(ln, "needs-rust-lld") { + props.ignore = true; + } } if let Some(s) = config.parse_aux_build(ln) { @@ -438,6 +451,9 @@ impl TestProps { if let Some(edition) = config.parse_edition(ln) { self.compile_flags.push(format!("--edition={}", edition)); + if edition == "2021" { + self.compile_flags.push("-Zunstable-options".to_string()); + } } config.parse_and_update_revisions(ln, &mut self.revisions); @@ -876,6 +892,7 @@ impl Config { name == util::get_arch(&self.target) || // architecture name == util::get_pointer_width(&self.target) || // pointer width name == self.stage_id.split('-').next().unwrap() || // stage + name == self.channel || // channel (self.target != self.host && name == "cross-compile") || (name == "endian-big" && util::is_big_endian(&self.target)) || (self.remote_test_client.is_some() && name == "remote") || diff --git a/src/tools/compiletest/src/header/tests.rs b/src/tools/compiletest/src/header/tests.rs index ca7458d255c..2c607b6a50e 100644 --- a/src/tools/compiletest/src/header/tests.rs +++ b/src/tools/compiletest/src/header/tests.rs @@ -55,6 +55,7 @@ fn config() -> Config { "--llvm-components=", "--android-cross-path=", "--target=x86_64-unknown-linux-gnu", + "--channel=nightly", ]; let args = args.iter().map(ToString::to_string).collect(); crate::parse_config(args) @@ -235,6 +236,20 @@ fn asm_support() { } #[test] +fn channel() { + let mut config = config(); + config.channel = "beta".into(); + + assert!(parse_rs(&config, "// ignore-beta").ignore); + assert!(parse_rs(&config, "// only-nightly").ignore); + assert!(parse_rs(&config, "// only-stable").ignore); + + assert!(!parse_rs(&config, "// only-beta").ignore); + assert!(!parse_rs(&config, "// ignore-nightly").ignore); + assert!(!parse_rs(&config, "// ignore-stable").ignore); +} + +#[test] fn test_extract_version_range() { use super::{extract_llvm_version, extract_version_range}; diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index 08ee8fc984d..c854663706a 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -144,7 +144,8 @@ pub fn parse_config(args: Vec<String>) -> Config { "enable this to generate a Rustfix coverage file, which is saved in \ `./<build_base>/rustfix_missing_coverage.txt`", ) - .optflag("h", "help", "show this message"); + .optflag("h", "help", "show this message") + .reqopt("", "channel", "current Rust channel", "CHANNEL"); let (argv0, args_) = args.split_first().unwrap(); if args.len() == 1 || args[1] == "-h" || args[1] == "--help" { @@ -278,6 +279,7 @@ pub fn parse_config(args: Vec<String>) -> Config { compare_mode: matches.opt_str("compare-mode").map(CompareMode::parse), rustfix_coverage: matches.opt_present("rustfix-coverage"), has_tidy, + channel: matches.opt_str("channel").unwrap(), cc: matches.opt_str("cc").unwrap(), cxx: matches.opt_str("cxx").unwrap(), diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 931c822ffe2..02dffaab7b6 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1785,6 +1785,9 @@ impl<'test> TestCx<'test> { get_lib_name(&aux_path.trim_end_matches(".rs").replace('-', "_"), is_dylib); rustc.arg("--extern").arg(format!("{}={}/{}", aux_name, aux_dir.display(), lib_name)); } + if !self.props.aux_crates.is_empty() { + rustc.arg("-Zunstable-options"); + } aux_dir } @@ -2488,6 +2491,7 @@ impl<'test> TestCx<'test> { { let mut diff_output = File::create(&diff_filename).unwrap(); + let mut wrote_data = false; for entry in walkdir::WalkDir::new(out_dir) { let entry = entry.expect("failed to read file"); let extension = entry.path().extension().and_then(|p| p.to_str()); @@ -2500,17 +2504,28 @@ impl<'test> TestCx<'test> { if let Ok(s) = std::fs::read(&expected_path) { s } else { continue }; let actual_path = entry.path(); let actual = std::fs::read(&actual_path).unwrap(); - diff_output - .write_all(&unified_diff::diff( - &expected, - &expected_path.to_string_lossy(), - &actual, - &actual_path.to_string_lossy(), - 3, - )) - .unwrap(); + let diff = unified_diff::diff( + &expected, + &expected_path.to_string_lossy(), + &actual, + &actual_path.to_string_lossy(), + 3, + ); + wrote_data |= !diff.is_empty(); + diff_output.write_all(&diff).unwrap(); } } + + if !wrote_data { + println!("note: diff is identical to nightly rustdoc"); + assert!(diff_output.metadata().unwrap().len() == 0); + return; + } else if self.config.verbose { + eprintln!("printing diff:"); + let mut buf = Vec::new(); + diff_output.read_to_end(&mut buf).unwrap(); + std::io::stderr().lock().write_all(&mut buf).unwrap(); + } } match self.config.color { diff --git a/src/tools/miri b/src/tools/miri -Subproject c8713c2f9fc1e28c90876b9ec9557d8c5729757 +Subproject e5c3af6f516311cc4b1fc017c58d83b7442cbc3 diff --git a/src/tools/rustfmt/src/expr.rs b/src/tools/rustfmt/src/expr.rs index ced382c4915..bca9f77f959 100644 --- a/src/tools/rustfmt/src/expr.rs +++ b/src/tools/rustfmt/src/expr.rs @@ -107,7 +107,9 @@ pub(crate) fn format_expr( } ast::ExprKind::Unary(op, ref subexpr) => rewrite_unary_op(context, op, subexpr, shape), ast::ExprKind::Struct(ref struct_expr) => { - let ast::StructExpr { fields, path, rest } = &**struct_expr; + let ast::StructExpr { + fields, path, rest, .. + } = &**struct_expr; rewrite_struct_lit(context, path, fields, rest, &expr.attrs, expr.span, shape) } ast::ExprKind::Tup(ref items) => { diff --git a/src/tools/rustfmt/src/patterns.rs b/src/tools/rustfmt/src/patterns.rs index 6824fc661ba..fa0ef260991 100644 --- a/src/tools/rustfmt/src/patterns.rs +++ b/src/tools/rustfmt/src/patterns.rs @@ -45,7 +45,7 @@ fn is_short_pattern_inner(pat: &ast::Pat) -> bool { | ast::PatKind::Path(..) | ast::PatKind::Range(..) => false, ast::PatKind::Tuple(ref subpats) => subpats.len() <= 1, - ast::PatKind::TupleStruct(ref path, ref subpats) => { + ast::PatKind::TupleStruct(_, ref path, ref subpats) => { path.segments.len() <= 1 && subpats.len() <= 1 } ast::PatKind::Box(ref p) | ast::PatKind::Ref(ref p, _) | ast::PatKind::Paren(ref p) => { @@ -226,7 +226,7 @@ impl Rewrite for Pat { PatKind::Path(ref q_self, ref path) => { rewrite_path(context, PathContext::Expr, q_self.as_ref(), path, shape) } - PatKind::TupleStruct(ref path, ref pat_vec) => { + PatKind::TupleStruct(_, ref path, ref pat_vec) => { let path_str = rewrite_path(context, PathContext::Expr, None, path, shape)?; rewrite_tuple_pat(pat_vec, Some(path_str), self.span, context, shape) } @@ -244,7 +244,7 @@ impl Rewrite for Pat { .collect(); Some(format!("[{}]", rw.join(", "))) } - PatKind::Struct(ref path, ref fields, ellipsis) => { + PatKind::Struct(_, ref path, ref fields, ellipsis) => { rewrite_struct_pat(path, fields, ellipsis, self.span, context, shape) } PatKind::MacCall(ref mac) => { |
