From 440d9372a2b8dfd01a98ba16a68f750792ab43fa Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Sat, 18 Sep 2021 18:04:40 -0400 Subject: [PATCH 1/8] Workaround ICE with if-let and RFC 2229 --- compiler/rustc_errors/src/lib.rs | 6 ++---- compiler/rustc_typeck/src/astconv/mod.rs | 11 ++++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index b1526cf78d2e9..03e8534ef289f 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -1028,15 +1028,13 @@ impl HandlerInner { let mut error_codes = self .emitted_diagnostic_codes .iter() - .filter_map(|x| { - match &x { + .filter_map(|x| match &x { DiagnosticId::Error(s) - if let Ok(Some(_explanation)) = registry.try_find_description(s) => + if registry.try_find_description(s).map_or(false, |o| o.is_some()) => { Some(s.clone()) } _ => None, - } }) .collect::>(); if !error_codes.is_empty() { diff --git a/compiler/rustc_typeck/src/astconv/mod.rs b/compiler/rustc_typeck/src/astconv/mod.rs index 2f2223ee822e4..33df541eb2ba8 100644 --- a/compiler/rustc_typeck/src/astconv/mod.rs +++ b/compiler/rustc_typeck/src/astconv/mod.rs @@ -2417,13 +2417,14 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { let substs = InternalSubsts::for_item(tcx, def_id, |param, _| { if let Some(i) = (param.index as usize).checked_sub(generics.parent_count) { // Our own parameters are the resolved lifetimes. - match param.kind { - GenericParamDefKind::Lifetime - if let hir::GenericArg::Lifetime(lifetime) = &lifetimes[i] => - { + if let GenericParamDefKind::Lifetime = param.kind { + if let hir::GenericArg::Lifetime(lifetime) = &lifetimes[i] { self.ast_region_to_region(lifetime, None).into() + } else { + bug!() } - _ => bug!(), + } else { + bug!() } } else { match param.kind { From 5e1a614b5369c430a383beaf1aec04f09740edbb Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Sun, 19 Sep 2021 10:36:17 -0400 Subject: [PATCH 2/8] Adjust to SourceType::InTree in several places These were left over in migrations to subtrees, which should generally be treated as-if it was local. Also fixes a warning caused by this change. --- .../rustc_codegen_cranelift/src/bin/cg_clif_build_sysroot.rs | 1 - src/bootstrap/check.rs | 2 +- src/bootstrap/compile.rs | 3 +-- src/bootstrap/test.rs | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_codegen_cranelift/src/bin/cg_clif_build_sysroot.rs b/compiler/rustc_codegen_cranelift/src/bin/cg_clif_build_sysroot.rs index e7cd5edbbf654..89e0cb8d90ecd 100644 --- a/compiler/rustc_codegen_cranelift/src/bin/cg_clif_build_sysroot.rs +++ b/compiler/rustc_codegen_cranelift/src/bin/cg_clif_build_sysroot.rs @@ -8,7 +8,6 @@ #![feature(rustc_private)] -extern crate rustc_data_structures; extern crate rustc_driver; extern crate rustc_interface; extern crate rustc_session; diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index f5fad4b413684..f66f282bea933 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -262,7 +262,7 @@ impl Step for CodegenBackend { let mut cargo = builder.cargo( compiler, Mode::Codegen, - SourceType::Submodule, + SourceType::InTree, target, cargo_subcommand(builder.kind), ); diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index df9e9bce41527..ae234fb1dc729 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -817,8 +817,7 @@ impl Step for CodegenBackend { let out_dir = builder.cargo_out(compiler, Mode::Codegen, target); - let mut cargo = - builder.cargo(compiler, Mode::Codegen, SourceType::Submodule, target, "build"); + let mut cargo = builder.cargo(compiler, Mode::Codegen, SourceType::InTree, target, "build"); cargo .arg("--manifest-path") .arg(builder.src.join(format!("compiler/rustc_codegen_{}/Cargo.toml", backend))); diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 386ffb384a81e..272b715311137 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -390,7 +390,7 @@ impl Step for Rustfmt { host, "test", "src/tools/rustfmt", - SourceType::Submodule, + SourceType::InTree, &[], ); From 45b989a03319c6a53bb726ec98dfe7d172035ac6 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Sat, 18 Sep 2021 17:37:24 -0400 Subject: [PATCH 3/8] Enable 2021 compatibility lints for all in-tree code This just applies the suggested fixes from the compatibility warnings, leaving any that are in practice spurious in. This is primarily intended to provide a starting point to identify possible fixes to the migrations (e.g., by avoiding spurious warnings). A secondary commit cleans these up where they are false positives (as is true in many of the cases). --- compiler/rustc_codegen_llvm/src/back/lto.rs | 7 ++-- .../src/interpret/validity.rs | 2 +- compiler/rustc_infer/src/infer/at.rs | 32 +++++++++---------- compiler/rustc_interface/src/util.rs | 1 + compiler/rustc_mir_build/src/lints.rs | 1 + .../src/traits/query/type_op/custom.rs | 5 ++- .../src/traits/specialize/mod.rs | 1 + .../traits/specialize/specialization_graph.rs | 29 +++++++++-------- .../rustc_typeck/src/check/compare_method.rs | 1 + .../rustc_typeck/src/check/method/probe.rs | 1 + src/librustdoc/doctest.rs | 1 + src/tools/clippy/clippy_utils/src/lib.rs | 5 ++- 12 files changed, 52 insertions(+), 34 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/back/lto.rs b/compiler/rustc_codegen_llvm/src/back/lto.rs index f612785e5a416..fcb79c8332c1e 100644 --- a/compiler/rustc_codegen_llvm/src/back/lto.rs +++ b/compiler/rustc_codegen_llvm/src/back/lto.rs @@ -906,8 +906,11 @@ impl ThinLTOKeysMap { ) -> Self { let keys = iter::zip(modules, names) .map(|(module, name)| { - let key = build_string(|rust_str| unsafe { - llvm::LLVMRustComputeLTOCacheKey(rust_str, module.identifier, data.0); + let key = build_string(|rust_str| { + let _ = &data; + unsafe { + llvm::LLVMRustComputeLTOCacheKey(rust_str, module.identifier, data.0); + } }) .expect("Invalid ThinLTO module key"); (name.clone().into_string().unwrap(), key) diff --git a/compiler/rustc_const_eval/src/interpret/validity.rs b/compiler/rustc_const_eval/src/interpret/validity.rs index a6375ad0e02cf..fc69770bf6a30 100644 --- a/compiler/rustc_const_eval/src/interpret/validity.rs +++ b/compiler/rustc_const_eval/src/interpret/validity.rs @@ -77,7 +77,7 @@ macro_rules! throw_validation_failure { /// macro_rules! try_validation { ($e:expr, $where:expr, - $( $( $p:pat )|+ => { $( $what_fmt:expr ),+ } $( expected { $( $expected_fmt:expr ),+ } )? ),+ $(,)? + $( $( $p:pat_param )|+ => { $( $what_fmt:expr ),+ } $( expected { $( $expected_fmt:expr ),+ } )? ),+ $(,)? ) => {{ match $e { Ok(x) => x, diff --git a/compiler/rustc_infer/src/infer/at.rs b/compiler/rustc_infer/src/infer/at.rs index 11ee8fb17ad1b..33ce8f5f97fdf 100644 --- a/compiler/rustc_infer/src/infer/at.rs +++ b/compiler/rustc_infer/src/infer/at.rs @@ -195,10 +195,10 @@ impl<'a, 'tcx> Trace<'a, 'tcx> { let Trace { at, trace, a_is_expected } = self; at.infcx.commit_if_ok(|_| { let mut fields = at.infcx.combine_fields(trace, at.param_env); - fields - .sub(a_is_expected) - .relate(a, b) - .map(move |_| InferOk { value: (), obligations: fields.obligations }) + fields.sub(a_is_expected).relate(a, b).map(move |_| { + let _ = &fields; + InferOk { value: (), obligations: fields.obligations } + }) }) } @@ -212,10 +212,10 @@ impl<'a, 'tcx> Trace<'a, 'tcx> { let Trace { at, trace, a_is_expected } = self; at.infcx.commit_if_ok(|_| { let mut fields = at.infcx.combine_fields(trace, at.param_env); - fields - .equate(a_is_expected) - .relate(a, b) - .map(move |_| InferOk { value: (), obligations: fields.obligations }) + fields.equate(a_is_expected).relate(a, b).map(move |_| { + let _ = &fields; + InferOk { value: (), obligations: fields.obligations } + }) }) } @@ -227,10 +227,10 @@ impl<'a, 'tcx> Trace<'a, 'tcx> { let Trace { at, trace, a_is_expected } = self; at.infcx.commit_if_ok(|_| { let mut fields = at.infcx.combine_fields(trace, at.param_env); - fields - .lub(a_is_expected) - .relate(a, b) - .map(move |t| InferOk { value: t, obligations: fields.obligations }) + fields.lub(a_is_expected).relate(a, b).map(move |t| { + let _ = &fields; + InferOk { value: t, obligations: fields.obligations } + }) }) } @@ -242,10 +242,10 @@ impl<'a, 'tcx> Trace<'a, 'tcx> { let Trace { at, trace, a_is_expected } = self; at.infcx.commit_if_ok(|_| { let mut fields = at.infcx.combine_fields(trace, at.param_env); - fields - .glb(a_is_expected) - .relate(a, b) - .map(move |t| InferOk { value: t, obligations: fields.obligations }) + fields.glb(a_is_expected).relate(a, b).map(move |t| { + let _ = &fields; + InferOk { value: t, obligations: fields.obligations } + }) }) } } diff --git a/compiler/rustc_interface/src/util.rs b/compiler/rustc_interface/src/util.rs index a5f0c01477898..3d90a6c934536 100644 --- a/compiler/rustc_interface/src/util.rs +++ b/compiler/rustc_interface/src/util.rs @@ -125,6 +125,7 @@ pub fn scoped_thread R + Send, R: Send>(cfg: thread::Builder, f: let result_ptr = Ptr(&mut result as *mut _ as *mut ()); let thread = cfg.spawn(move || { + let _ = (&run, &result_ptr); let run = unsafe { (*(run.0 as *mut Option)).take().unwrap() }; let result = unsafe { &mut *(result_ptr.0 as *mut Option) }; *result = Some(run()); diff --git a/compiler/rustc_mir_build/src/lints.rs b/compiler/rustc_mir_build/src/lints.rs index ef8bd20d51098..2d408e577d167 100644 --- a/compiler/rustc_mir_build/src/lints.rs +++ b/compiler/rustc_mir_build/src/lints.rs @@ -41,6 +41,7 @@ crate fn check<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>) { let hir_id = tcx.hir().local_def_id_to_hir_id(def_id); let sp = tcx.sess.source_map().guess_head_span(tcx.hir().span_with_body(hir_id)); tcx.struct_span_lint_hir(UNCONDITIONAL_RECURSION, hir_id, sp, |lint| { + let _ = &vis; let mut db = lint.build("function cannot return without recursing"); db.span_label(sp, "cannot return without recursing"); // offer some help to the programmer. diff --git a/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs b/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs index b5398f8a4353b..8ee217655d92d 100644 --- a/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs +++ b/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs @@ -40,7 +40,10 @@ where info!("fully_perform({:?})", self); } - scrape_region_constraints(infcx, || (self.closure)(infcx)) + scrape_region_constraints(infcx, || { + let _ = &self; + (self.closure)(infcx) + }) } } diff --git a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs index 88aca794a6be6..36fe059498352 100644 --- a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs @@ -394,6 +394,7 @@ fn report_conflicting_impls( // now because the struct_lint methods don't return back the DiagnosticBuilder // that's passed in. let decorate = |err: LintDiagnosticBuilder<'_>| { + let _ = &overlap; let msg = format!( "conflicting implementations of trait `{}`{}{}", overlap.trait_desc, diff --git a/compiler/rustc_trait_selection/src/traits/specialize/specialization_graph.rs b/compiler/rustc_trait_selection/src/traits/specialize/specialization_graph.rs index c8bcab6efd7ca..c3e5b79c8f468 100644 --- a/compiler/rustc_trait_selection/src/traits/specialize/specialization_graph.rs +++ b/compiler/rustc_trait_selection/src/traits/specialize/specialization_graph.rs @@ -104,19 +104,22 @@ impl ChildrenExt for Children { let self_ty = trait_ref.self_ty(); // FIXME: should postpone string formatting until we decide to actually emit. - with_no_trimmed_paths(|| OverlapError { - with_impl: possible_sibling, - trait_desc: trait_ref.print_only_trait_path().to_string(), - // Only report the `Self` type if it has at least - // some outer concrete shell; otherwise, it's - // not adding much information. - self_desc: if self_ty.has_concrete_skeleton() { - Some(self_ty.to_string()) - } else { - None - }, - intercrate_ambiguity_causes: overlap.intercrate_ambiguity_causes, - involves_placeholder: overlap.involves_placeholder, + with_no_trimmed_paths(|| { + let _ = &overlap; + OverlapError { + with_impl: possible_sibling, + trait_desc: trait_ref.print_only_trait_path().to_string(), + // Only report the `Self` type if it has at least + // some outer concrete shell; otherwise, it's + // not adding much information. + self_desc: if self_ty.has_concrete_skeleton() { + Some(self_ty.to_string()) + } else { + None + }, + intercrate_ambiguity_causes: overlap.intercrate_ambiguity_causes, + involves_placeholder: overlap.involves_placeholder, + } }) }; diff --git a/compiler/rustc_typeck/src/check/compare_method.rs b/compiler/rustc_typeck/src/check/compare_method.rs index d5b631df058ae..b359e8b2ebe06 100644 --- a/compiler/rustc_typeck/src/check/compare_method.rs +++ b/compiler/rustc_typeck/src/check/compare_method.rs @@ -1192,6 +1192,7 @@ fn compare_type_predicate_entailment<'tcx>( normalize_cause.clone(), ); tcx.infer_ctxt().enter(|infcx| { + let _ = &impl_ty_own_bounds; let inh = Inherited::new(infcx, impl_ty.def_id.expect_local()); let infcx = &inh.infcx; diff --git a/compiler/rustc_typeck/src/check/method/probe.rs b/compiler/rustc_typeck/src/check/method/probe.rs index cbfdce96bc57b..56b1588301343 100644 --- a/compiler/rustc_typeck/src/check/method/probe.rs +++ b/compiler/rustc_typeck/src/check/method/probe.rs @@ -441,6 +441,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // this creates one big transaction so that all type variables etc // that we create during the probe process are removed later self.probe(|_| { + let _ = &steps; let mut probe_cx = ProbeContext::new( self, span, diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index dbeea9cddf387..71bdfdd4adefe 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -964,6 +964,7 @@ impl Tester for Collector { test_type: test::TestType::DocTest, }, testfn: test::DynTestFn(Box::new(move || { + let _ = &config; let report_unused_externs = |uext| { unused_externs.lock().unwrap().push(uext); }; diff --git a/src/tools/clippy/clippy_utils/src/lib.rs b/src/tools/clippy/clippy_utils/src/lib.rs index 3a94f47298390..5c505f6851afe 100644 --- a/src/tools/clippy/clippy_utils/src/lib.rs +++ b/src/tools/clippy/clippy_utils/src/lib.rs @@ -990,7 +990,10 @@ pub fn can_move_expr_to_closure(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) -> captures: HirIdMap::default(), }; v.visit_expr(expr); - v.allow_closure.then(|| v.captures) + v.allow_closure.then(|| { + let _ = &v; + v.captures + }) } /// Returns the method names and argument list of nested method call expressions that make up From c746be2219fac78e5adad715082dedeb2d737f0d Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Sun, 19 Sep 2021 12:49:55 -0400 Subject: [PATCH 4/8] Migrate to 2021 --- compiler/rustc/Cargo.toml | 2 +- compiler/rustc_apfloat/Cargo.toml | 2 +- compiler/rustc_arena/Cargo.toml | 2 +- compiler/rustc_ast/Cargo.toml | 2 +- compiler/rustc_ast_lowering/Cargo.toml | 2 +- compiler/rustc_ast_passes/Cargo.toml | 2 +- compiler/rustc_ast_pretty/Cargo.toml | 2 +- compiler/rustc_attr/Cargo.toml | 2 +- compiler/rustc_borrowck/Cargo.toml | 2 +- compiler/rustc_builtin_macros/Cargo.toml | 2 +- compiler/rustc_codegen_cranelift/Cargo.toml | 2 +- compiler/rustc_codegen_llvm/Cargo.toml | 2 +- compiler/rustc_codegen_ssa/Cargo.toml | 2 +- compiler/rustc_const_eval/Cargo.toml | 2 +- compiler/rustc_data_structures/Cargo.toml | 2 +- compiler/rustc_driver/Cargo.toml | 2 +- compiler/rustc_error_codes/Cargo.toml | 2 +- compiler/rustc_errors/Cargo.toml | 2 +- compiler/rustc_expand/Cargo.toml | 2 +- compiler/rustc_feature/Cargo.toml | 2 +- compiler/rustc_fs_util/Cargo.toml | 2 +- compiler/rustc_graphviz/Cargo.toml | 2 +- compiler/rustc_hir/Cargo.toml | 2 +- compiler/rustc_hir_pretty/Cargo.toml | 2 +- compiler/rustc_incremental/Cargo.toml | 2 +- compiler/rustc_index/Cargo.toml | 2 +- compiler/rustc_infer/Cargo.toml | 2 +- compiler/rustc_interface/Cargo.toml | 2 +- compiler/rustc_lexer/Cargo.toml | 2 +- compiler/rustc_lint/Cargo.toml | 2 +- compiler/rustc_lint_defs/Cargo.toml | 2 +- compiler/rustc_llvm/Cargo.toml | 2 +- compiler/rustc_macros/Cargo.toml | 2 +- compiler/rustc_metadata/Cargo.toml | 2 +- compiler/rustc_middle/Cargo.toml | 2 +- compiler/rustc_mir_build/Cargo.toml | 2 +- compiler/rustc_mir_dataflow/Cargo.toml | 2 +- compiler/rustc_mir_transform/Cargo.toml | 2 +- .../rustc_mir_transform/src/coverage/test_macros/Cargo.toml | 2 +- compiler/rustc_monomorphize/Cargo.toml | 2 +- compiler/rustc_parse/Cargo.toml | 2 +- compiler/rustc_parse_format/Cargo.toml | 2 +- compiler/rustc_passes/Cargo.toml | 2 +- compiler/rustc_plugin_impl/Cargo.toml | 2 +- compiler/rustc_privacy/Cargo.toml | 2 +- compiler/rustc_query_impl/Cargo.toml | 2 +- compiler/rustc_query_system/Cargo.toml | 2 +- compiler/rustc_resolve/Cargo.toml | 2 +- compiler/rustc_save_analysis/Cargo.toml | 2 +- compiler/rustc_serialize/Cargo.toml | 2 +- compiler/rustc_session/Cargo.toml | 2 +- compiler/rustc_span/Cargo.toml | 2 +- compiler/rustc_symbol_mangling/Cargo.toml | 2 +- compiler/rustc_target/Cargo.toml | 2 +- compiler/rustc_trait_selection/Cargo.toml | 2 +- compiler/rustc_traits/Cargo.toml | 2 +- compiler/rustc_ty_utils/Cargo.toml | 2 +- compiler/rustc_type_ir/Cargo.toml | 2 +- compiler/rustc_typeck/Cargo.toml | 2 +- src/bootstrap/Cargo.toml | 2 +- src/build_helper/Cargo.toml | 2 +- src/etc/test-float-parse/Cargo.toml | 2 +- src/librustdoc/Cargo.toml | 2 +- src/rustdoc-json-types/Cargo.toml | 2 +- src/tools/build-manifest/Cargo.toml | 2 +- src/tools/bump-stage0/Cargo.toml | 2 +- src/tools/cargotest/Cargo.toml | 2 +- src/tools/compiletest/Cargo.toml | 2 +- src/tools/error_index_generator/Cargo.toml | 2 +- src/tools/expand-yaml-anchors/Cargo.toml | 2 +- src/tools/html-checker/Cargo.toml | 2 +- src/tools/jsondocck/Cargo.toml | 2 +- src/tools/linkchecker/Cargo.toml | 2 +- src/tools/lint-docs/Cargo.toml | 2 +- src/tools/remote-test-client/Cargo.toml | 2 +- src/tools/remote-test-server/Cargo.toml | 2 +- src/tools/rust-demangler/Cargo.toml | 2 +- src/tools/rustbook/Cargo.toml | 2 +- src/tools/rustc-workspace-hack/Cargo.toml | 2 +- src/tools/rustdoc-themes/Cargo.toml | 2 +- src/tools/rustdoc/Cargo.toml | 2 +- src/tools/rustfmt/Cargo.toml | 2 +- src/tools/tidy/Cargo.toml | 2 +- src/tools/tier-check/Cargo.toml | 2 +- src/tools/unicode-table-generator/Cargo.toml | 2 +- src/tools/unstable-book-gen/Cargo.toml | 2 +- src/tools/x/Cargo.toml | 2 +- 87 files changed, 87 insertions(+), 87 deletions(-) diff --git a/compiler/rustc/Cargo.toml b/compiler/rustc/Cargo.toml index 37f90bf3c1008..277cf0f51d378 100644 --- a/compiler/rustc/Cargo.toml +++ b/compiler/rustc/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc-main" version = "0.0.0" -edition = '2018' +edition = "2021" [dependencies] rustc_driver = { path = "../rustc_driver" } diff --git a/compiler/rustc_apfloat/Cargo.toml b/compiler/rustc_apfloat/Cargo.toml index 9f266b1fb978d..bb01d4f51b899 100644 --- a/compiler/rustc_apfloat/Cargo.toml +++ b/compiler/rustc_apfloat/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_apfloat" version = "0.0.0" -edition = "2018" +edition = "2021" [dependencies] bitflags = "1.2.1" diff --git a/compiler/rustc_arena/Cargo.toml b/compiler/rustc_arena/Cargo.toml index eba8a2a082f3e..33ccd0445030f 100644 --- a/compiler/rustc_arena/Cargo.toml +++ b/compiler/rustc_arena/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_arena" version = "0.0.0" -edition = "2018" +edition = "2021" [dependencies] rustc_data_structures = { path = "../rustc_data_structures" } diff --git a/compiler/rustc_ast/Cargo.toml b/compiler/rustc_ast/Cargo.toml index 67cf5d92b00cb..58b967a370415 100644 --- a/compiler/rustc_ast/Cargo.toml +++ b/compiler/rustc_ast/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_ast" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_ast_lowering/Cargo.toml b/compiler/rustc_ast_lowering/Cargo.toml index 4e848a6a2b8fb..f4859ee4ae91f 100644 --- a/compiler/rustc_ast_lowering/Cargo.toml +++ b/compiler/rustc_ast_lowering/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_ast_lowering" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_ast_passes/Cargo.toml b/compiler/rustc_ast_passes/Cargo.toml index 4a6eb80fb30ce..9312a68bc600c 100644 --- a/compiler/rustc_ast_passes/Cargo.toml +++ b/compiler/rustc_ast_passes/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_ast_passes" version = "0.0.0" -edition = "2018" +edition = "2021" [dependencies] itertools = "0.9" diff --git a/compiler/rustc_ast_pretty/Cargo.toml b/compiler/rustc_ast_pretty/Cargo.toml index fa88740103ba3..29f2be4cf4648 100644 --- a/compiler/rustc_ast_pretty/Cargo.toml +++ b/compiler/rustc_ast_pretty/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_ast_pretty" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_attr/Cargo.toml b/compiler/rustc_attr/Cargo.toml index 0566379e1f5e1..ba310a6860e82 100644 --- a/compiler/rustc_attr/Cargo.toml +++ b/compiler/rustc_attr/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_attr" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_borrowck/Cargo.toml b/compiler/rustc_borrowck/Cargo.toml index c683c388ba9ea..75e9c69af4e5c 100644 --- a/compiler/rustc_borrowck/Cargo.toml +++ b/compiler/rustc_borrowck/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_borrowck" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_builtin_macros/Cargo.toml b/compiler/rustc_builtin_macros/Cargo.toml index 2370ac201b018..fd34f947f72c0 100644 --- a/compiler/rustc_builtin_macros/Cargo.toml +++ b/compiler/rustc_builtin_macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_builtin_macros" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_codegen_cranelift/Cargo.toml b/compiler/rustc_codegen_cranelift/Cargo.toml index 6f40fc0fcb881..61d40702a3284 100644 --- a/compiler/rustc_codegen_cranelift/Cargo.toml +++ b/compiler/rustc_codegen_cranelift/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_codegen_cranelift" version = "0.1.0" -edition = "2018" +edition = "2021" [lib] crate-type = ["dylib"] diff --git a/compiler/rustc_codegen_llvm/Cargo.toml b/compiler/rustc_codegen_llvm/Cargo.toml index 3c99febbd57cc..3f02443458188 100644 --- a/compiler/rustc_codegen_llvm/Cargo.toml +++ b/compiler/rustc_codegen_llvm/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_codegen_llvm" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] test = false diff --git a/compiler/rustc_codegen_ssa/Cargo.toml b/compiler/rustc_codegen_ssa/Cargo.toml index 1446624b88157..0713e167c53b8 100644 --- a/compiler/rustc_codegen_ssa/Cargo.toml +++ b/compiler/rustc_codegen_ssa/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_codegen_ssa" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] test = false diff --git a/compiler/rustc_const_eval/Cargo.toml b/compiler/rustc_const_eval/Cargo.toml index 1653d5cf6c560..a51273732ae6f 100644 --- a/compiler/rustc_const_eval/Cargo.toml +++ b/compiler/rustc_const_eval/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_const_eval" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_data_structures/Cargo.toml b/compiler/rustc_data_structures/Cargo.toml index bc13ca26e2e22..4996257012970 100644 --- a/compiler/rustc_data_structures/Cargo.toml +++ b/compiler/rustc_data_structures/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_data_structures" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_driver/Cargo.toml b/compiler/rustc_driver/Cargo.toml index ba8616cc6ef73..6721e00027d42 100644 --- a/compiler/rustc_driver/Cargo.toml +++ b/compiler/rustc_driver/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_driver" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] crate-type = ["dylib"] diff --git a/compiler/rustc_error_codes/Cargo.toml b/compiler/rustc_error_codes/Cargo.toml index 270e5301895a4..7d5f3e4672a0f 100644 --- a/compiler/rustc_error_codes/Cargo.toml +++ b/compiler/rustc_error_codes/Cargo.toml @@ -1,4 +1,4 @@ [package] name = "rustc_error_codes" version = "0.0.0" -edition = "2018" +edition = "2021" diff --git a/compiler/rustc_errors/Cargo.toml b/compiler/rustc_errors/Cargo.toml index c74fd60e530c1..4846dc43605f8 100644 --- a/compiler/rustc_errors/Cargo.toml +++ b/compiler/rustc_errors/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_errors" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_expand/Cargo.toml b/compiler/rustc_expand/Cargo.toml index 1be9321e4fed5..45237ab2e9f25 100644 --- a/compiler/rustc_expand/Cargo.toml +++ b/compiler/rustc_expand/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_expand" version = "0.0.0" -edition = "2018" +edition = "2021" build = false [lib] diff --git a/compiler/rustc_feature/Cargo.toml b/compiler/rustc_feature/Cargo.toml index ee381e34251b5..3d8d0db20d122 100644 --- a/compiler/rustc_feature/Cargo.toml +++ b/compiler/rustc_feature/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_feature" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_fs_util/Cargo.toml b/compiler/rustc_fs_util/Cargo.toml index c417e978b311d..34c3fe2a005c8 100644 --- a/compiler/rustc_fs_util/Cargo.toml +++ b/compiler/rustc_fs_util/Cargo.toml @@ -1,4 +1,4 @@ [package] name = "rustc_fs_util" version = "0.0.0" -edition = "2018" +edition = "2021" diff --git a/compiler/rustc_graphviz/Cargo.toml b/compiler/rustc_graphviz/Cargo.toml index 87c41ae171ef5..d657fdb1a7789 100644 --- a/compiler/rustc_graphviz/Cargo.toml +++ b/compiler/rustc_graphviz/Cargo.toml @@ -1,4 +1,4 @@ [package] name = "rustc_graphviz" version = "0.0.0" -edition = "2018" +edition = "2021" diff --git a/compiler/rustc_hir/Cargo.toml b/compiler/rustc_hir/Cargo.toml index ff6758e66dff2..47bd4b7245b79 100644 --- a/compiler/rustc_hir/Cargo.toml +++ b/compiler/rustc_hir/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_hir" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_hir_pretty/Cargo.toml b/compiler/rustc_hir_pretty/Cargo.toml index c7510b7ec1422..46a8e7deeed04 100644 --- a/compiler/rustc_hir_pretty/Cargo.toml +++ b/compiler/rustc_hir_pretty/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_hir_pretty" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_incremental/Cargo.toml b/compiler/rustc_incremental/Cargo.toml index 9156243a10c0a..dece752c1945f 100644 --- a/compiler/rustc_incremental/Cargo.toml +++ b/compiler/rustc_incremental/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_incremental" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_index/Cargo.toml b/compiler/rustc_index/Cargo.toml index e1a2b619763f2..b984a1321e0aa 100644 --- a/compiler/rustc_index/Cargo.toml +++ b/compiler/rustc_index/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_index" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_infer/Cargo.toml b/compiler/rustc_infer/Cargo.toml index 15649bb678e24..f87ea43b1a72c 100644 --- a/compiler/rustc_infer/Cargo.toml +++ b/compiler/rustc_infer/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_infer" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_interface/Cargo.toml b/compiler/rustc_interface/Cargo.toml index e76fa6d8a1bc6..07af2201f5fc2 100644 --- a/compiler/rustc_interface/Cargo.toml +++ b/compiler/rustc_interface/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_interface" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_lexer/Cargo.toml b/compiler/rustc_lexer/Cargo.toml index 7e05fe545cabe..60c146f457b42 100644 --- a/compiler/rustc_lexer/Cargo.toml +++ b/compiler/rustc_lexer/Cargo.toml @@ -2,7 +2,7 @@ name = "rustc_lexer" version = "0.1.0" license = "MIT OR Apache-2.0" -edition = "2018" +edition = "2021" repository = "https://github.com/rust-lang/rust/" description = """ diff --git a/compiler/rustc_lint/Cargo.toml b/compiler/rustc_lint/Cargo.toml index 8294d5878fa99..414fcbeb9e415 100644 --- a/compiler/rustc_lint/Cargo.toml +++ b/compiler/rustc_lint/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_lint" version = "0.0.0" -edition = "2018" +edition = "2021" [dependencies] if_chain = "1.0" diff --git a/compiler/rustc_lint_defs/Cargo.toml b/compiler/rustc_lint_defs/Cargo.toml index f9ada5cc95f58..798d50819e2d8 100644 --- a/compiler/rustc_lint_defs/Cargo.toml +++ b/compiler/rustc_lint_defs/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_lint_defs" version = "0.0.0" -edition = "2018" +edition = "2021" [dependencies] rustc_ast = { path = "../rustc_ast" } diff --git a/compiler/rustc_llvm/Cargo.toml b/compiler/rustc_llvm/Cargo.toml index 2f0f3dd9ecbb9..d8dfcc84e68da 100644 --- a/compiler/rustc_llvm/Cargo.toml +++ b/compiler/rustc_llvm/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_llvm" version = "0.0.0" -edition = "2018" +edition = "2021" [features] static-libstdcpp = [] diff --git a/compiler/rustc_macros/Cargo.toml b/compiler/rustc_macros/Cargo.toml index e4dddbab06755..a9192be4d6ef4 100644 --- a/compiler/rustc_macros/Cargo.toml +++ b/compiler/rustc_macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_macros" version = "0.1.0" -edition = "2018" +edition = "2021" [lib] proc-macro = true diff --git a/compiler/rustc_metadata/Cargo.toml b/compiler/rustc_metadata/Cargo.toml index 42596f3318d6c..cc46a2fb9d3b9 100644 --- a/compiler/rustc_metadata/Cargo.toml +++ b/compiler/rustc_metadata/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_metadata" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_middle/Cargo.toml b/compiler/rustc_middle/Cargo.toml index 68b83fccc85fd..b1fcc34bee1d7 100644 --- a/compiler/rustc_middle/Cargo.toml +++ b/compiler/rustc_middle/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_middle" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_mir_build/Cargo.toml b/compiler/rustc_mir_build/Cargo.toml index e9fbc1b186d19..998b80a36c2f7 100644 --- a/compiler/rustc_mir_build/Cargo.toml +++ b/compiler/rustc_mir_build/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_mir_build" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_mir_dataflow/Cargo.toml b/compiler/rustc_mir_dataflow/Cargo.toml index 3cd4892402e4c..ffd7e3cd06bd2 100644 --- a/compiler/rustc_mir_dataflow/Cargo.toml +++ b/compiler/rustc_mir_dataflow/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_mir_dataflow" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_mir_transform/Cargo.toml b/compiler/rustc_mir_transform/Cargo.toml index 5e1a587b0ecea..bde4e215a2a61 100644 --- a/compiler/rustc_mir_transform/Cargo.toml +++ b/compiler/rustc_mir_transform/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_mir_transform" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_mir_transform/src/coverage/test_macros/Cargo.toml b/compiler/rustc_mir_transform/src/coverage/test_macros/Cargo.toml index cc93fd482b5d4..f5e8b65656a3e 100644 --- a/compiler/rustc_mir_transform/src/coverage/test_macros/Cargo.toml +++ b/compiler/rustc_mir_transform/src/coverage/test_macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "coverage_test_macros" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] proc-macro = true diff --git a/compiler/rustc_monomorphize/Cargo.toml b/compiler/rustc_monomorphize/Cargo.toml index 350ae08877718..f812afe6b62ba 100644 --- a/compiler/rustc_monomorphize/Cargo.toml +++ b/compiler/rustc_monomorphize/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_monomorphize" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_parse/Cargo.toml b/compiler/rustc_parse/Cargo.toml index 1ca1a92252ea4..1decaaa955f02 100644 --- a/compiler/rustc_parse/Cargo.toml +++ b/compiler/rustc_parse/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_parse" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_parse_format/Cargo.toml b/compiler/rustc_parse_format/Cargo.toml index 7b77560717e13..aa1714e820f48 100644 --- a/compiler/rustc_parse_format/Cargo.toml +++ b/compiler/rustc_parse_format/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_parse_format" version = "0.0.0" -edition = "2018" +edition = "2021" [dependencies] rustc_span = { path = "../rustc_span" } diff --git a/compiler/rustc_passes/Cargo.toml b/compiler/rustc_passes/Cargo.toml index bf1e52cd9a8ad..39e578bce7ef6 100644 --- a/compiler/rustc_passes/Cargo.toml +++ b/compiler/rustc_passes/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_passes" version = "0.0.0" -edition = "2018" +edition = "2021" [dependencies] tracing = "0.1" diff --git a/compiler/rustc_plugin_impl/Cargo.toml b/compiler/rustc_plugin_impl/Cargo.toml index c8eaca0703cb5..4e666e7e93d53 100644 --- a/compiler/rustc_plugin_impl/Cargo.toml +++ b/compiler/rustc_plugin_impl/Cargo.toml @@ -2,7 +2,7 @@ name = "rustc_plugin_impl" version = "0.0.0" build = false -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_privacy/Cargo.toml b/compiler/rustc_privacy/Cargo.toml index 6ac2915c34526..d952e288a6477 100644 --- a/compiler/rustc_privacy/Cargo.toml +++ b/compiler/rustc_privacy/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_privacy" version = "0.0.0" -edition = "2018" +edition = "2021" [dependencies] rustc_middle = { path = "../rustc_middle" } diff --git a/compiler/rustc_query_impl/Cargo.toml b/compiler/rustc_query_impl/Cargo.toml index 7c8dbe34240e2..89df3d4674b6b 100644 --- a/compiler/rustc_query_impl/Cargo.toml +++ b/compiler/rustc_query_impl/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_query_impl" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_query_system/Cargo.toml b/compiler/rustc_query_system/Cargo.toml index 47fb78be64079..11c18a497e5e6 100644 --- a/compiler/rustc_query_system/Cargo.toml +++ b/compiler/rustc_query_system/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_query_system" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_resolve/Cargo.toml b/compiler/rustc_resolve/Cargo.toml index 1581b0562752e..f1d3315d6e66a 100644 --- a/compiler/rustc_resolve/Cargo.toml +++ b/compiler/rustc_resolve/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_resolve" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] test = false diff --git a/compiler/rustc_save_analysis/Cargo.toml b/compiler/rustc_save_analysis/Cargo.toml index 535a48bcda182..15a89d82fa696 100644 --- a/compiler/rustc_save_analysis/Cargo.toml +++ b/compiler/rustc_save_analysis/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_save_analysis" version = "0.0.0" -edition = "2018" +edition = "2021" [dependencies] tracing = "0.1" diff --git a/compiler/rustc_serialize/Cargo.toml b/compiler/rustc_serialize/Cargo.toml index 593a7563e36a2..49778f82253bf 100644 --- a/compiler/rustc_serialize/Cargo.toml +++ b/compiler/rustc_serialize/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_serialize" version = "0.0.0" -edition = "2018" +edition = "2021" [dependencies] indexmap = "1" diff --git a/compiler/rustc_session/Cargo.toml b/compiler/rustc_session/Cargo.toml index 5b617a2997cd6..4cff21bee3dc3 100644 --- a/compiler/rustc_session/Cargo.toml +++ b/compiler/rustc_session/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_session" version = "0.0.0" -edition = "2018" +edition = "2021" [dependencies] getopts = "0.2" diff --git a/compiler/rustc_span/Cargo.toml b/compiler/rustc_span/Cargo.toml index e475e89d87e8e..781fb8c1e5d8c 100644 --- a/compiler/rustc_span/Cargo.toml +++ b/compiler/rustc_span/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_span" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_symbol_mangling/Cargo.toml b/compiler/rustc_symbol_mangling/Cargo.toml index aebf77a1fd85f..d5befa10e2363 100644 --- a/compiler/rustc_symbol_mangling/Cargo.toml +++ b/compiler/rustc_symbol_mangling/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_symbol_mangling" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_target/Cargo.toml b/compiler/rustc_target/Cargo.toml index e47a84dbc117e..925813e6bb427 100644 --- a/compiler/rustc_target/Cargo.toml +++ b/compiler/rustc_target/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_target" version = "0.0.0" -edition = "2018" +edition = "2021" [dependencies] bitflags = "1.2.1" diff --git a/compiler/rustc_trait_selection/Cargo.toml b/compiler/rustc_trait_selection/Cargo.toml index e2c626d1b2207..9a9737362c6c8 100644 --- a/compiler/rustc_trait_selection/Cargo.toml +++ b/compiler/rustc_trait_selection/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_trait_selection" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_traits/Cargo.toml b/compiler/rustc_traits/Cargo.toml index 219165ff55035..2e56a1bf6839e 100644 --- a/compiler/rustc_traits/Cargo.toml +++ b/compiler/rustc_traits/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_traits" version = "0.0.0" -edition = "2018" +edition = "2021" [dependencies] tracing = "0.1" diff --git a/compiler/rustc_ty_utils/Cargo.toml b/compiler/rustc_ty_utils/Cargo.toml index 2eb27fb1ad67e..78df95e680e00 100644 --- a/compiler/rustc_ty_utils/Cargo.toml +++ b/compiler/rustc_ty_utils/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_ty_utils" version = "0.0.0" -edition = "2018" +edition = "2021" [dependencies] tracing = "0.1" diff --git a/compiler/rustc_type_ir/Cargo.toml b/compiler/rustc_type_ir/Cargo.toml index 1f6acbe0d811d..439e6cdf70698 100644 --- a/compiler/rustc_type_ir/Cargo.toml +++ b/compiler/rustc_type_ir/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_type_ir" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] doctest = false diff --git a/compiler/rustc_typeck/Cargo.toml b/compiler/rustc_typeck/Cargo.toml index dd76a5e4b99b2..7e570e151c529 100644 --- a/compiler/rustc_typeck/Cargo.toml +++ b/compiler/rustc_typeck/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustc_typeck" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] test = false diff --git a/src/bootstrap/Cargo.toml b/src/bootstrap/Cargo.toml index 0b76a13e02b77..1ce1f0b26db58 100644 --- a/src/bootstrap/Cargo.toml +++ b/src/bootstrap/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bootstrap" version = "0.0.0" -edition = "2018" +edition = "2021" build = "build.rs" [lib] diff --git a/src/build_helper/Cargo.toml b/src/build_helper/Cargo.toml index 17a9e55b3238c..d88df0e08fab3 100644 --- a/src/build_helper/Cargo.toml +++ b/src/build_helper/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "build_helper" version = "0.1.0" -edition = "2018" +edition = "2021" [lib] path = "lib.rs" diff --git a/src/etc/test-float-parse/Cargo.toml b/src/etc/test-float-parse/Cargo.toml index 8226e815c2c1e..7ee19a0b6d913 100644 --- a/src/etc/test-float-parse/Cargo.toml +++ b/src/etc/test-float-parse/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "test-float-parse" version = "0.1.0" -edition = "2018" +edition = "2021" publish = false [workspace] diff --git a/src/librustdoc/Cargo.toml b/src/librustdoc/Cargo.toml index e02cef235ae00..945b2a8e9a80e 100644 --- a/src/librustdoc/Cargo.toml +++ b/src/librustdoc/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustdoc" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] path = "lib.rs" diff --git a/src/rustdoc-json-types/Cargo.toml b/src/rustdoc-json-types/Cargo.toml index a692f6f896da7..d60699efd36cb 100644 --- a/src/rustdoc-json-types/Cargo.toml +++ b/src/rustdoc-json-types/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustdoc-json-types" version = "0.1.0" -edition = "2018" +edition = "2021" [lib] path = "lib.rs" diff --git a/src/tools/build-manifest/Cargo.toml b/src/tools/build-manifest/Cargo.toml index 334407c2b2e56..340acff34f2ab 100644 --- a/src/tools/build-manifest/Cargo.toml +++ b/src/tools/build-manifest/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "build-manifest" version = "0.1.0" -edition = "2018" +edition = "2021" [dependencies] toml = "0.5" diff --git a/src/tools/bump-stage0/Cargo.toml b/src/tools/bump-stage0/Cargo.toml index 7d64e20a3d360..cf8840ff6ee89 100644 --- a/src/tools/bump-stage0/Cargo.toml +++ b/src/tools/bump-stage0/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bump-stage0" version = "0.1.0" -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/tools/cargotest/Cargo.toml b/src/tools/cargotest/Cargo.toml index a88272d234456..bfd894e2bd27b 100644 --- a/src/tools/cargotest/Cargo.toml +++ b/src/tools/cargotest/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "cargotest2" version = "0.1.0" -edition = "2018" +edition = "2021" [[bin]] name = "cargotest" diff --git a/src/tools/compiletest/Cargo.toml b/src/tools/compiletest/Cargo.toml index d6aa3fd2631f5..e9426a2d9f58c 100644 --- a/src/tools/compiletest/Cargo.toml +++ b/src/tools/compiletest/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "compiletest" version = "0.0.0" -edition = "2018" +edition = "2021" [dependencies] colored = "2" diff --git a/src/tools/error_index_generator/Cargo.toml b/src/tools/error_index_generator/Cargo.toml index 2e4b7beb37601..c84b79e11e9b4 100644 --- a/src/tools/error_index_generator/Cargo.toml +++ b/src/tools/error_index_generator/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "error_index_generator" version = "0.0.0" -edition = "2018" +edition = "2021" [dependencies] rustdoc = { path = "../../librustdoc" } diff --git a/src/tools/expand-yaml-anchors/Cargo.toml b/src/tools/expand-yaml-anchors/Cargo.toml index 358dff0653292..9a25b6c1f1c87 100644 --- a/src/tools/expand-yaml-anchors/Cargo.toml +++ b/src/tools/expand-yaml-anchors/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "expand-yaml-anchors" version = "0.1.0" -edition = "2018" +edition = "2021" [dependencies] yaml-rust = "0.4.3" diff --git a/src/tools/html-checker/Cargo.toml b/src/tools/html-checker/Cargo.toml index e88d2f0d928fb..34d3954db28dc 100644 --- a/src/tools/html-checker/Cargo.toml +++ b/src/tools/html-checker/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "html-checker" version = "0.1.0" -edition = "2018" +edition = "2021" [[bin]] name = "html-checker" diff --git a/src/tools/jsondocck/Cargo.toml b/src/tools/jsondocck/Cargo.toml index a65deb1254168..ccabe6483d7a4 100644 --- a/src/tools/jsondocck/Cargo.toml +++ b/src/tools/jsondocck/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "jsondocck" version = "0.1.0" -edition = "2018" +edition = "2021" [dependencies] jsonpath_lib = "0.2" diff --git a/src/tools/linkchecker/Cargo.toml b/src/tools/linkchecker/Cargo.toml index 21ba226955646..1d8f2f918823f 100644 --- a/src/tools/linkchecker/Cargo.toml +++ b/src/tools/linkchecker/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "linkchecker" version = "0.1.0" -edition = "2018" +edition = "2021" [[bin]] name = "linkchecker" diff --git a/src/tools/lint-docs/Cargo.toml b/src/tools/lint-docs/Cargo.toml index 6792887fa5d71..3578bda8276e7 100644 --- a/src/tools/lint-docs/Cargo.toml +++ b/src/tools/lint-docs/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "lint-docs" version = "0.1.0" -edition = "2018" +edition = "2021" description = "A script to extract the lint documentation for the rustc book." # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/tools/remote-test-client/Cargo.toml b/src/tools/remote-test-client/Cargo.toml index 7b20ba83546be..d59cd6b3d8e22 100644 --- a/src/tools/remote-test-client/Cargo.toml +++ b/src/tools/remote-test-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "remote-test-client" version = "0.1.0" -edition = "2018" +edition = "2021" [dependencies] diff --git a/src/tools/remote-test-server/Cargo.toml b/src/tools/remote-test-server/Cargo.toml index 01309aec9a338..e6be8530cf635 100644 --- a/src/tools/remote-test-server/Cargo.toml +++ b/src/tools/remote-test-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "remote-test-server" version = "0.1.0" -edition = "2018" +edition = "2021" [dependencies] diff --git a/src/tools/rust-demangler/Cargo.toml b/src/tools/rust-demangler/Cargo.toml index 157409bc8472c..2bb73b3262d8d 100644 --- a/src/tools/rust-demangler/Cargo.toml +++ b/src/tools/rust-demangler/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rust-demangler" version = "0.0.1" -edition = "2018" +edition = "2021" [dependencies] regex = "1.0" diff --git a/src/tools/rustbook/Cargo.toml b/src/tools/rustbook/Cargo.toml index da36ce0e69002..de1327d74ff57 100644 --- a/src/tools/rustbook/Cargo.toml +++ b/src/tools/rustbook/Cargo.toml @@ -2,7 +2,7 @@ name = "rustbook" version = "0.1.0" license = "MIT OR Apache-2.0" -edition = "2018" +edition = "2021" [dependencies] clap = "2.25.0" diff --git a/src/tools/rustc-workspace-hack/Cargo.toml b/src/tools/rustc-workspace-hack/Cargo.toml index 38b9fefbaf576..a28cf28841e54 100644 --- a/src/tools/rustc-workspace-hack/Cargo.toml +++ b/src/tools/rustc-workspace-hack/Cargo.toml @@ -5,7 +5,7 @@ license = 'MIT OR Apache-2.0' description = """ Hack for the compiler's own build system """ -edition = "2018" +edition = "2021" [lib] path = "lib.rs" diff --git a/src/tools/rustdoc-themes/Cargo.toml b/src/tools/rustdoc-themes/Cargo.toml index 4b2ad982a84fb..3d8c77d36d70d 100644 --- a/src/tools/rustdoc-themes/Cargo.toml +++ b/src/tools/rustdoc-themes/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustdoc-themes" version = "0.1.0" -edition = "2018" +edition = "2021" [[bin]] name = "rustdoc-themes" diff --git a/src/tools/rustdoc/Cargo.toml b/src/tools/rustdoc/Cargo.toml index 5625707b25a53..c4101f72cc2da 100644 --- a/src/tools/rustdoc/Cargo.toml +++ b/src/tools/rustdoc/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustdoc-tool" version = "0.0.0" -edition = "2018" +edition = "2021" # Cargo adds a number of paths to the dylib search path on windows, which results in # the wrong rustdoc being executed. To avoid the conflicting rustdocs, we name the "tool" diff --git a/src/tools/rustfmt/Cargo.toml b/src/tools/rustfmt/Cargo.toml index 81e3e26e8b000..7b4667c17c864 100644 --- a/src/tools/rustfmt/Cargo.toml +++ b/src/tools/rustfmt/Cargo.toml @@ -8,7 +8,7 @@ readme = "README.md" license = "Apache-2.0/MIT" build = "build.rs" categories = ["development-tools"] -edition = "2018" +edition = "2021" [[bin]] name = "rustfmt" diff --git a/src/tools/tidy/Cargo.toml b/src/tools/tidy/Cargo.toml index 57fe5a62e9aa7..69c8063f42e26 100644 --- a/src/tools/tidy/Cargo.toml +++ b/src/tools/tidy/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tidy" version = "0.1.0" -edition = "2018" +edition = "2021" autobins = false [dependencies] diff --git a/src/tools/tier-check/Cargo.toml b/src/tools/tier-check/Cargo.toml index d6119cac5f39e..3f08165a3fc63 100644 --- a/src/tools/tier-check/Cargo.toml +++ b/src/tools/tier-check/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tier-check" version = "0.1.0" -edition = "2018" +edition = "2021" license = "MIT OR Apache-2.0" [dependencies] diff --git a/src/tools/unicode-table-generator/Cargo.toml b/src/tools/unicode-table-generator/Cargo.toml index 948773f7810c3..ef01877c0b94b 100644 --- a/src/tools/unicode-table-generator/Cargo.toml +++ b/src/tools/unicode-table-generator/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "unicode-bdd" version = "0.1.0" -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/tools/unstable-book-gen/Cargo.toml b/src/tools/unstable-book-gen/Cargo.toml index febeaa446b394..73e5a91bec70a 100644 --- a/src/tools/unstable-book-gen/Cargo.toml +++ b/src/tools/unstable-book-gen/Cargo.toml @@ -2,7 +2,7 @@ name = "unstable-book-gen" version = "0.1.0" license = "MIT OR Apache-2.0" -edition = "2018" +edition = "2021" [dependencies] tidy = { path = "../tidy" } diff --git a/src/tools/x/Cargo.toml b/src/tools/x/Cargo.toml index 264a741159a8a..3150272796234 100644 --- a/src/tools/x/Cargo.toml +++ b/src/tools/x/Cargo.toml @@ -2,5 +2,5 @@ name = "x" version = "0.1.0" description = "Run x.py slightly more conveniently" -edition = "2018" +edition = "2021" publish = false From 662daee6582c84cdb7fc9b053bba4fb211a73299 Mon Sep 17 00:00:00 2001 From: Noah Lev Date: Sat, 18 Sep 2021 17:31:54 -0700 Subject: [PATCH 5/8] Adjust tidy edition lint to force 2021 This has a few exceptions today (library crates, a few submodules), but is mostly accurate. --- src/tools/tidy/src/edition.rs | 44 ++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/src/tools/tidy/src/edition.rs b/src/tools/tidy/src/edition.rs index 283c43e325c05..b5e9ceddbafd1 100644 --- a/src/tools/tidy/src/edition.rs +++ b/src/tools/tidy/src/edition.rs @@ -1,10 +1,15 @@ -//! Tidy check to ensure that crate `edition` is '2018' +//! Tidy check to ensure that crate `edition` is '2018' or '2021'. use std::path::Path; fn is_edition_2018(mut line: &str) -> bool { line = line.trim(); - line == "edition = \"2018\"" || line == "edition = \'2018\'" + line == "edition = \"2018\"" +} + +fn is_edition_2021(mut line: &str) -> bool { + line = line.trim(); + line == "edition = \"2021\"" } pub fn check(path: &Path, bad: &mut bool) { @@ -13,17 +18,38 @@ pub fn check(path: &Path, bad: &mut bool) { &mut |path| super::filter_dirs(path) || path.ends_with("src/test"), &mut |entry, contents| { let file = entry.path(); + let filestr = file.to_string_lossy().replace("\\", "/"); let filename = file.file_name().unwrap(); if filename != "Cargo.toml" { return; } - let has_edition = contents.lines().any(is_edition_2018); - if !has_edition { - tidy_error!( - bad, - "{} doesn't have `edition = \"2018\"` on a separate line", - file.display() - ); + + // Library crates are not yet ready to migrate to 2021. + // + // The reference and rustc-dev-guide are submodules, so are left at + // 2018 for now. They should be removed from this exception list + // when bumped. + if path.components().any(|c| c.as_os_str() == "library") + || filestr.contains("src/doc/reference/style-check/Cargo.toml") + || filestr.contains("src/doc/rustc-dev-guide/ci/date-check/Cargo.toml") + { + let has = contents.lines().any(is_edition_2018); + if !has { + tidy_error!( + bad, + "{} doesn't have `edition = \"2018\"` on a separate line", + file.display() + ); + } + } else { + let is_2021 = contents.lines().any(is_edition_2021); + if !is_2021 { + tidy_error!( + bad, + "{} doesn't have `edition = \"2021\"` on a separate line", + file.display() + ); + } } }, ); From 5e344da2170da48f6fe7ba28770b11b00796fa5f Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Sun, 19 Sep 2021 13:13:16 -0400 Subject: [PATCH 6/8] Drop migration lint for Send/Sync bound in LTO backend The closure in question does not require Send/Sync impls, so it's OK to lose them when we just capture data.0. --- compiler/rustc_codegen_llvm/src/back/lto.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/back/lto.rs b/compiler/rustc_codegen_llvm/src/back/lto.rs index fcb79c8332c1e..f612785e5a416 100644 --- a/compiler/rustc_codegen_llvm/src/back/lto.rs +++ b/compiler/rustc_codegen_llvm/src/back/lto.rs @@ -906,11 +906,8 @@ impl ThinLTOKeysMap { ) -> Self { let keys = iter::zip(modules, names) .map(|(module, name)| { - let key = build_string(|rust_str| { - let _ = &data; - unsafe { - llvm::LLVMRustComputeLTOCacheKey(rust_str, module.identifier, data.0); - } + let key = build_string(|rust_str| unsafe { + llvm::LLVMRustComputeLTOCacheKey(rust_str, module.identifier, data.0); }) .expect("Invalid ThinLTO module key"); (name.clone().into_string().unwrap(), key) From f33890082603434eb640dfd256819b0d722e911d Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Sun, 19 Sep 2021 13:46:05 -0400 Subject: [PATCH 7/8] Remove Drop-caused migration-added captures All of these were added due to insignificant Drop types being present. --- compiler/rustc_infer/src/infer/at.rs | 32 +++++++++---------- compiler/rustc_mir_build/src/lints.rs | 1 - .../src/traits/query/type_op/custom.rs | 5 +-- .../src/traits/specialize/mod.rs | 1 - .../traits/specialize/specialization_graph.rs | 1 - .../rustc_typeck/src/check/compare_method.rs | 1 - .../rustc_typeck/src/check/method/probe.rs | 1 - src/librustdoc/doctest.rs | 1 - src/tools/clippy/clippy_utils/src/lib.rs | 5 +-- 9 files changed, 18 insertions(+), 30 deletions(-) diff --git a/compiler/rustc_infer/src/infer/at.rs b/compiler/rustc_infer/src/infer/at.rs index 33ce8f5f97fdf..11ee8fb17ad1b 100644 --- a/compiler/rustc_infer/src/infer/at.rs +++ b/compiler/rustc_infer/src/infer/at.rs @@ -195,10 +195,10 @@ impl<'a, 'tcx> Trace<'a, 'tcx> { let Trace { at, trace, a_is_expected } = self; at.infcx.commit_if_ok(|_| { let mut fields = at.infcx.combine_fields(trace, at.param_env); - fields.sub(a_is_expected).relate(a, b).map(move |_| { - let _ = &fields; - InferOk { value: (), obligations: fields.obligations } - }) + fields + .sub(a_is_expected) + .relate(a, b) + .map(move |_| InferOk { value: (), obligations: fields.obligations }) }) } @@ -212,10 +212,10 @@ impl<'a, 'tcx> Trace<'a, 'tcx> { let Trace { at, trace, a_is_expected } = self; at.infcx.commit_if_ok(|_| { let mut fields = at.infcx.combine_fields(trace, at.param_env); - fields.equate(a_is_expected).relate(a, b).map(move |_| { - let _ = &fields; - InferOk { value: (), obligations: fields.obligations } - }) + fields + .equate(a_is_expected) + .relate(a, b) + .map(move |_| InferOk { value: (), obligations: fields.obligations }) }) } @@ -227,10 +227,10 @@ impl<'a, 'tcx> Trace<'a, 'tcx> { let Trace { at, trace, a_is_expected } = self; at.infcx.commit_if_ok(|_| { let mut fields = at.infcx.combine_fields(trace, at.param_env); - fields.lub(a_is_expected).relate(a, b).map(move |t| { - let _ = &fields; - InferOk { value: t, obligations: fields.obligations } - }) + fields + .lub(a_is_expected) + .relate(a, b) + .map(move |t| InferOk { value: t, obligations: fields.obligations }) }) } @@ -242,10 +242,10 @@ impl<'a, 'tcx> Trace<'a, 'tcx> { let Trace { at, trace, a_is_expected } = self; at.infcx.commit_if_ok(|_| { let mut fields = at.infcx.combine_fields(trace, at.param_env); - fields.glb(a_is_expected).relate(a, b).map(move |t| { - let _ = &fields; - InferOk { value: t, obligations: fields.obligations } - }) + fields + .glb(a_is_expected) + .relate(a, b) + .map(move |t| InferOk { value: t, obligations: fields.obligations }) }) } } diff --git a/compiler/rustc_mir_build/src/lints.rs b/compiler/rustc_mir_build/src/lints.rs index 2d408e577d167..ef8bd20d51098 100644 --- a/compiler/rustc_mir_build/src/lints.rs +++ b/compiler/rustc_mir_build/src/lints.rs @@ -41,7 +41,6 @@ crate fn check<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>) { let hir_id = tcx.hir().local_def_id_to_hir_id(def_id); let sp = tcx.sess.source_map().guess_head_span(tcx.hir().span_with_body(hir_id)); tcx.struct_span_lint_hir(UNCONDITIONAL_RECURSION, hir_id, sp, |lint| { - let _ = &vis; let mut db = lint.build("function cannot return without recursing"); db.span_label(sp, "cannot return without recursing"); // offer some help to the programmer. diff --git a/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs b/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs index 8ee217655d92d..b5398f8a4353b 100644 --- a/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs +++ b/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs @@ -40,10 +40,7 @@ where info!("fully_perform({:?})", self); } - scrape_region_constraints(infcx, || { - let _ = &self; - (self.closure)(infcx) - }) + scrape_region_constraints(infcx, || (self.closure)(infcx)) } } diff --git a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs index 36fe059498352..88aca794a6be6 100644 --- a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs @@ -394,7 +394,6 @@ fn report_conflicting_impls( // now because the struct_lint methods don't return back the DiagnosticBuilder // that's passed in. let decorate = |err: LintDiagnosticBuilder<'_>| { - let _ = &overlap; let msg = format!( "conflicting implementations of trait `{}`{}{}", overlap.trait_desc, diff --git a/compiler/rustc_trait_selection/src/traits/specialize/specialization_graph.rs b/compiler/rustc_trait_selection/src/traits/specialize/specialization_graph.rs index c3e5b79c8f468..2ecc169e1cf1d 100644 --- a/compiler/rustc_trait_selection/src/traits/specialize/specialization_graph.rs +++ b/compiler/rustc_trait_selection/src/traits/specialize/specialization_graph.rs @@ -105,7 +105,6 @@ impl ChildrenExt for Children { // FIXME: should postpone string formatting until we decide to actually emit. with_no_trimmed_paths(|| { - let _ = &overlap; OverlapError { with_impl: possible_sibling, trait_desc: trait_ref.print_only_trait_path().to_string(), diff --git a/compiler/rustc_typeck/src/check/compare_method.rs b/compiler/rustc_typeck/src/check/compare_method.rs index b359e8b2ebe06..d5b631df058ae 100644 --- a/compiler/rustc_typeck/src/check/compare_method.rs +++ b/compiler/rustc_typeck/src/check/compare_method.rs @@ -1192,7 +1192,6 @@ fn compare_type_predicate_entailment<'tcx>( normalize_cause.clone(), ); tcx.infer_ctxt().enter(|infcx| { - let _ = &impl_ty_own_bounds; let inh = Inherited::new(infcx, impl_ty.def_id.expect_local()); let infcx = &inh.infcx; diff --git a/compiler/rustc_typeck/src/check/method/probe.rs b/compiler/rustc_typeck/src/check/method/probe.rs index 56b1588301343..cbfdce96bc57b 100644 --- a/compiler/rustc_typeck/src/check/method/probe.rs +++ b/compiler/rustc_typeck/src/check/method/probe.rs @@ -441,7 +441,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // this creates one big transaction so that all type variables etc // that we create during the probe process are removed later self.probe(|_| { - let _ = &steps; let mut probe_cx = ProbeContext::new( self, span, diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index 71bdfdd4adefe..dbeea9cddf387 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -964,7 +964,6 @@ impl Tester for Collector { test_type: test::TestType::DocTest, }, testfn: test::DynTestFn(Box::new(move || { - let _ = &config; let report_unused_externs = |uext| { unused_externs.lock().unwrap().push(uext); }; diff --git a/src/tools/clippy/clippy_utils/src/lib.rs b/src/tools/clippy/clippy_utils/src/lib.rs index 5c505f6851afe..3a94f47298390 100644 --- a/src/tools/clippy/clippy_utils/src/lib.rs +++ b/src/tools/clippy/clippy_utils/src/lib.rs @@ -990,10 +990,7 @@ pub fn can_move_expr_to_closure(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) -> captures: HirIdMap::default(), }; v.visit_expr(expr); - v.allow_closure.then(|| { - let _ = &v; - v.captures - }) + v.allow_closure.then(|| v.captures) } /// Returns the method names and argument list of nested method call expressions that make up From 3b896796719ed1e151d507b4bf2ea635a89cda9e Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Mon, 20 Sep 2021 08:46:26 -0400 Subject: [PATCH 8/8] Adjust documentation for compatibility with 2021 This also adjusts the lint docs generation to accept (and ignore) an allow attribute, rather than expecting the documentation to be immediately followed by the lint name. --- compiler/rustc_lint/src/array_into_iter.rs | 2 +- compiler/rustc_lint/src/builtin.rs | 2 +- compiler/rustc_lint/src/non_fmt_panic.rs | 2 +- compiler/rustc_lint_defs/src/builtin.rs | 6 ++- .../rustc_metadata/src/dependency_format.rs | 44 +++++++++---------- compiler/rustc_middle/src/middle/region.rs | 3 +- src/tools/lint-docs/src/lib.rs | 4 ++ 7 files changed, 35 insertions(+), 28 deletions(-) diff --git a/compiler/rustc_lint/src/array_into_iter.rs b/compiler/rustc_lint/src/array_into_iter.rs index 5ac42c50c7240..1facd97375433 100644 --- a/compiler/rustc_lint/src/array_into_iter.rs +++ b/compiler/rustc_lint/src/array_into_iter.rs @@ -13,7 +13,7 @@ declare_lint! { /// /// ### Example /// - /// ```rust + /// ```rust,edition2018 /// # #![allow(unused)] /// [1, 2, 3].into_iter().for_each(|n| { *n; }); /// ``` diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index 2850e7a6b44e9..e1bcc3aa52bc6 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -1686,7 +1686,7 @@ declare_lint! { /// /// ### Example /// - /// ```rust + /// ```rust,edition2018 /// let x = 123; /// match x { /// 0...100 => {} diff --git a/compiler/rustc_lint/src/non_fmt_panic.rs b/compiler/rustc_lint/src/non_fmt_panic.rs index 33a6edafa2640..ae9c5ce5c3c2b 100644 --- a/compiler/rustc_lint/src/non_fmt_panic.rs +++ b/compiler/rustc_lint/src/non_fmt_panic.rs @@ -18,7 +18,7 @@ declare_lint! { /// /// ### Example /// - /// ```rust,no_run + /// ```rust,no_run,edition2018 /// panic!("{}"); /// panic!(123); /// ``` diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index a00561e521357..b14abb9e5db48 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -1584,7 +1584,7 @@ declare_lint! { /// /// ### Example /// - /// ```rust + /// ```rust,edition2018 /// trait Trait { } /// /// fn takes_trait_object(_: Box) { @@ -3313,7 +3313,7 @@ declare_lint! { /// /// ### Example /// - /// ```rust,compile_fail + /// ```rust,edition2018,compile_fail /// #![deny(rust_2021_prefixes_incompatible_syntax)] /// /// macro_rules! m { @@ -3333,6 +3333,8 @@ declare_lint! { /// /// This lint suggests to add whitespace between the `z` and `"hey"` tokens /// to keep them separated in Rust 2021. + // Allow this lint -- rustdoc doesn't yet support threading edition into this lint's parser. + #[allow(rustdoc::invalid_rust_codeblocks)] pub RUST_2021_PREFIXES_INCOMPATIBLE_SYNTAX, Allow, "identifiers that will be parsed as a prefix in Rust 2021", diff --git a/compiler/rustc_metadata/src/dependency_format.rs b/compiler/rustc_metadata/src/dependency_format.rs index b8d2256061816..8c41fd9c4a237 100644 --- a/compiler/rustc_metadata/src/dependency_format.rs +++ b/compiler/rustc_metadata/src/dependency_format.rs @@ -11,10 +11,10 @@ //! should be used when linking each output type requested in this session. This //! generally follows this set of rules: //! -//! 1. Each library must appear exactly once in the output. -//! 2. Each rlib contains only one library (it's just an object file) -//! 3. Each dylib can contain more than one library (due to static linking), -//! and can also bring in many dynamic dependencies. +//! 1. Each library must appear exactly once in the output. +//! 2. Each rlib contains only one library (it's just an object file) +//! 3. Each dylib can contain more than one library (due to static linking), +//! and can also bring in many dynamic dependencies. //! //! With these constraints in mind, it's generally a very difficult problem to //! find a solution that's not "all rlibs" or "all dylibs". I have suspicions @@ -22,24 +22,24 @@ //! //! The current selection algorithm below looks mostly similar to: //! -//! 1. If static linking is required, then require all upstream dependencies -//! to be available as rlibs. If not, generate an error. -//! 2. If static linking is requested (generating an executable), then -//! attempt to use all upstream dependencies as rlibs. If any are not -//! found, bail out and continue to step 3. -//! 3. Static linking has failed, at least one library must be dynamically -//! linked. Apply a heuristic by greedily maximizing the number of -//! dynamically linked libraries. -//! 4. Each upstream dependency available as a dynamic library is -//! registered. The dependencies all propagate, adding to a map. It is -//! possible for a dylib to add a static library as a dependency, but it -//! is illegal for two dylibs to add the same static library as a -//! dependency. The same dylib can be added twice. Additionally, it is -//! illegal to add a static dependency when it was previously found as a -//! dylib (and vice versa) -//! 5. After all dynamic dependencies have been traversed, re-traverse the -//! remaining dependencies and add them statically (if they haven't been -//! added already). +//! 1. If static linking is required, then require all upstream dependencies +//! to be available as rlibs. If not, generate an error. +//! 2. If static linking is requested (generating an executable), then +//! attempt to use all upstream dependencies as rlibs. If any are not +//! found, bail out and continue to step 3. +//! 3. Static linking has failed, at least one library must be dynamically +//! linked. Apply a heuristic by greedily maximizing the number of +//! dynamically linked libraries. +//! 4. Each upstream dependency available as a dynamic library is +//! registered. The dependencies all propagate, adding to a map. It is +//! possible for a dylib to add a static library as a dependency, but it +//! is illegal for two dylibs to add the same static library as a +//! dependency. The same dylib can be added twice. Additionally, it is +//! illegal to add a static dependency when it was previously found as a +//! dylib (and vice versa) +//! 5. After all dynamic dependencies have been traversed, re-traverse the +//! remaining dependencies and add them statically (if they haven't been +//! added already). //! //! While not perfect, this algorithm should help support use-cases such as leaf //! dependencies being static while the larger tree of inner dependencies are diff --git a/compiler/rustc_middle/src/middle/region.rs b/compiler/rustc_middle/src/middle/region.rs index bd4e83a42ef51..e271f59da8796 100644 --- a/compiler/rustc_middle/src/middle/region.rs +++ b/compiler/rustc_middle/src/middle/region.rs @@ -257,7 +257,8 @@ pub struct ScopeTree { /// ``` /// /// With the HIR tree (calls numbered for expository purposes) - /// ``` + /// + /// ```text /// Call#0(foo, [Call#1(f), Yield(y), Call#2(bar, Call#3(g))]) /// ``` /// diff --git a/src/tools/lint-docs/src/lib.rs b/src/tools/lint-docs/src/lib.rs index e5c7f12571238..fdc89a184da52 100644 --- a/src/tools/lint-docs/src/lib.rs +++ b/src/tools/lint-docs/src/lib.rs @@ -149,6 +149,10 @@ impl<'a> LintExtractor<'a> { } else if line.starts_with("// ") { // Ignore comments. continue; + } else if line.starts_with("#[allow") { + // Ignore allow of lints (useful for + // invalid_rust_codeblocks). + continue; } else { let name = lint_name(line).map_err(|e| { format!(