Auto merge of #89103 - Mark-Simulacrum:migrate-2021, r=estebank

Migrate in-tree crates to 2021

This replaces #89075 (cherry picking some of the commits from there), and closes #88637 and fixes #89074.

It excludes a migration of the library crates for now (see tidy diff) because we have some pending bugs around macro spans to fix there.

I instrumented bootstrap during the migration to make sure all crates moved from 2018 to 2021 had the compatibility warnings applied first.

Originally, the intent was to support cargo fix --edition within bootstrap, but this proved fairly difficult to pull off. We'd need to architect the check functionality to support running cargo check and cargo fix within the same x.py invocation, and only resetting sysroots on check. Further, it was found that cargo fix doesn't behave too well with "not quite workspaces", such as Clippy which has several crates. Bootstrap runs with --manifest-path ... for all the tools, and this makes cargo fix only attempt migration for that crate. We can't use e.g. --workspace due to needing to maintain sysroots for different phases of compilation appropriately.

It is recommended to skip the mass migration of Cargo.toml's to 2021 for review purposes; you can also use `git diff d6cd2c6c87 -I'^edition = .20...$'` to ignore the edition = 2018/21 lines in the diff.
This commit is contained in:
bors 2021-09-21 19:25:49 +00:00
commit ac2d9fc509
104 changed files with 185 additions and 152 deletions

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc-main" name = "rustc-main"
version = "0.0.0" version = "0.0.0"
edition = '2018' edition = "2021"
[dependencies] [dependencies]
rustc_driver = { path = "../rustc_driver" } rustc_driver = { path = "../rustc_driver" }

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_apfloat" name = "rustc_apfloat"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[dependencies] [dependencies]
bitflags = "1.2.1" bitflags = "1.2.1"

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_arena" name = "rustc_arena"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[dependencies] [dependencies]
rustc_data_structures = { path = "../rustc_data_structures" } rustc_data_structures = { path = "../rustc_data_structures" }

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_ast" name = "rustc_ast"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_ast_lowering" name = "rustc_ast_lowering"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_ast_passes" name = "rustc_ast_passes"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[dependencies] [dependencies]
itertools = "0.9" itertools = "0.9"

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_ast_pretty" name = "rustc_ast_pretty"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_attr" name = "rustc_attr"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_borrowck" name = "rustc_borrowck"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_builtin_macros" name = "rustc_builtin_macros"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_codegen_cranelift" name = "rustc_codegen_cranelift"
version = "0.1.0" version = "0.1.0"
edition = "2018" edition = "2021"
[lib] [lib]
crate-type = ["dylib"] crate-type = ["dylib"]

View File

@ -8,7 +8,6 @@
#![feature(rustc_private)] #![feature(rustc_private)]
extern crate rustc_data_structures;
extern crate rustc_driver; extern crate rustc_driver;
extern crate rustc_interface; extern crate rustc_interface;
extern crate rustc_session; extern crate rustc_session;

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_codegen_llvm" name = "rustc_codegen_llvm"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
test = false test = false

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_codegen_ssa" name = "rustc_codegen_ssa"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
test = false test = false

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_const_eval" name = "rustc_const_eval"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -77,7 +77,7 @@ macro_rules! throw_validation_failure {
/// ///
macro_rules! try_validation { macro_rules! try_validation {
($e:expr, $where:expr, ($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 { match $e {
Ok(x) => x, Ok(x) => x,

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_data_structures" name = "rustc_data_structures"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_driver" name = "rustc_driver"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
crate-type = ["dylib"] crate-type = ["dylib"]

View File

@ -1,4 +1,4 @@
[package] [package]
name = "rustc_error_codes" name = "rustc_error_codes"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_errors" name = "rustc_errors"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -1028,15 +1028,13 @@ impl HandlerInner {
let mut error_codes = self let mut error_codes = self
.emitted_diagnostic_codes .emitted_diagnostic_codes
.iter() .iter()
.filter_map(|x| { .filter_map(|x| match &x {
match &x {
DiagnosticId::Error(s) 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()) Some(s.clone())
} }
_ => None, _ => None,
}
}) })
.collect::<Vec<_>>(); .collect::<Vec<_>>();
if !error_codes.is_empty() { if !error_codes.is_empty() {

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_expand" name = "rustc_expand"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
build = false build = false
[lib] [lib]

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_feature" name = "rustc_feature"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -1,4 +1,4 @@
[package] [package]
name = "rustc_fs_util" name = "rustc_fs_util"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"

View File

@ -1,4 +1,4 @@
[package] [package]
name = "rustc_graphviz" name = "rustc_graphviz"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_hir" name = "rustc_hir"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_hir_pretty" name = "rustc_hir_pretty"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_incremental" name = "rustc_incremental"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_index" name = "rustc_index"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_infer" name = "rustc_infer"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_interface" name = "rustc_interface"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -125,6 +125,7 @@ pub fn scoped_thread<F: FnOnce() -> R + Send, R: Send>(cfg: thread::Builder, f:
let result_ptr = Ptr(&mut result as *mut _ as *mut ()); let result_ptr = Ptr(&mut result as *mut _ as *mut ());
let thread = cfg.spawn(move || { let thread = cfg.spawn(move || {
let _ = (&run, &result_ptr);
let run = unsafe { (*(run.0 as *mut Option<F>)).take().unwrap() }; let run = unsafe { (*(run.0 as *mut Option<F>)).take().unwrap() };
let result = unsafe { &mut *(result_ptr.0 as *mut Option<R>) }; let result = unsafe { &mut *(result_ptr.0 as *mut Option<R>) };
*result = Some(run()); *result = Some(run());

View File

@ -2,7 +2,7 @@
name = "rustc_lexer" name = "rustc_lexer"
version = "0.1.0" version = "0.1.0"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
edition = "2018" edition = "2021"
repository = "https://github.com/rust-lang/rust/" repository = "https://github.com/rust-lang/rust/"
description = """ description = """

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_lint" name = "rustc_lint"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[dependencies] [dependencies]
if_chain = "1.0" if_chain = "1.0"

View File

@ -13,7 +13,7 @@ declare_lint! {
/// ///
/// ### Example /// ### Example
/// ///
/// ```rust /// ```rust,edition2018
/// # #![allow(unused)] /// # #![allow(unused)]
/// [1, 2, 3].into_iter().for_each(|n| { *n; }); /// [1, 2, 3].into_iter().for_each(|n| { *n; });
/// ``` /// ```

View File

@ -1686,7 +1686,7 @@ declare_lint! {
/// ///
/// ### Example /// ### Example
/// ///
/// ```rust /// ```rust,edition2018
/// let x = 123; /// let x = 123;
/// match x { /// match x {
/// 0...100 => {} /// 0...100 => {}

View File

@ -18,7 +18,7 @@ declare_lint! {
/// ///
/// ### Example /// ### Example
/// ///
/// ```rust,no_run /// ```rust,no_run,edition2018
/// panic!("{}"); /// panic!("{}");
/// panic!(123); /// panic!(123);
/// ``` /// ```

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_lint_defs" name = "rustc_lint_defs"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[dependencies] [dependencies]
rustc_ast = { path = "../rustc_ast" } rustc_ast = { path = "../rustc_ast" }

View File

@ -1584,7 +1584,7 @@ declare_lint! {
/// ///
/// ### Example /// ### Example
/// ///
/// ```rust /// ```rust,edition2018
/// trait Trait { } /// trait Trait { }
/// ///
/// fn takes_trait_object(_: Box<Trait>) { /// fn takes_trait_object(_: Box<Trait>) {
@ -3313,7 +3313,7 @@ declare_lint! {
/// ///
/// ### Example /// ### Example
/// ///
/// ```rust,compile_fail /// ```rust,edition2018,compile_fail
/// #![deny(rust_2021_prefixes_incompatible_syntax)] /// #![deny(rust_2021_prefixes_incompatible_syntax)]
/// ///
/// macro_rules! m { /// macro_rules! m {
@ -3333,6 +3333,8 @@ declare_lint! {
/// ///
/// This lint suggests to add whitespace between the `z` and `"hey"` tokens /// This lint suggests to add whitespace between the `z` and `"hey"` tokens
/// to keep them separated in Rust 2021. /// 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, pub RUST_2021_PREFIXES_INCOMPATIBLE_SYNTAX,
Allow, Allow,
"identifiers that will be parsed as a prefix in Rust 2021", "identifiers that will be parsed as a prefix in Rust 2021",

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_llvm" name = "rustc_llvm"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[features] [features]
static-libstdcpp = [] static-libstdcpp = []

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_macros" name = "rustc_macros"
version = "0.1.0" version = "0.1.0"
edition = "2018" edition = "2021"
[lib] [lib]
proc-macro = true proc-macro = true

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_metadata" name = "rustc_metadata"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -11,10 +11,10 @@
//! should be used when linking each output type requested in this session. This //! should be used when linking each output type requested in this session. This
//! generally follows this set of rules: //! generally follows this set of rules:
//! //!
//! 1. Each library must appear exactly once in the output. //! 1. Each library must appear exactly once in the output.
//! 2. Each rlib contains only one library (it's just an object file) //! 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), //! 3. Each dylib can contain more than one library (due to static linking),
//! and can also bring in many dynamic dependencies. //! and can also bring in many dynamic dependencies.
//! //!
//! With these constraints in mind, it's generally a very difficult problem to //! 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 //! 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: //! The current selection algorithm below looks mostly similar to:
//! //!
//! 1. If static linking is required, then require all upstream dependencies //! 1. If static linking is required, then require all upstream dependencies
//! to be available as rlibs. If not, generate an error. //! to be available as rlibs. If not, generate an error.
//! 2. If static linking is requested (generating an executable), then //! 2. If static linking is requested (generating an executable), then
//! attempt to use all upstream dependencies as rlibs. If any are not //! attempt to use all upstream dependencies as rlibs. If any are not
//! found, bail out and continue to step 3. //! found, bail out and continue to step 3.
//! 3. Static linking has failed, at least one library must be dynamically //! 3. Static linking has failed, at least one library must be dynamically
//! linked. Apply a heuristic by greedily maximizing the number of //! linked. Apply a heuristic by greedily maximizing the number of
//! dynamically linked libraries. //! dynamically linked libraries.
//! 4. Each upstream dependency available as a dynamic library is //! 4. Each upstream dependency available as a dynamic library is
//! registered. The dependencies all propagate, adding to a map. It 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 //! 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 //! is illegal for two dylibs to add the same static library as a
//! dependency. The same dylib can be added twice. Additionally, it is //! dependency. The same dylib can be added twice. Additionally, it is
//! illegal to add a static dependency when it was previously found as a //! illegal to add a static dependency when it was previously found as a
//! dylib (and vice versa) //! dylib (and vice versa)
//! 5. After all dynamic dependencies have been traversed, re-traverse the //! 5. After all dynamic dependencies have been traversed, re-traverse the
//! remaining dependencies and add them statically (if they haven't been //! remaining dependencies and add them statically (if they haven't been
//! added already). //! added already).
//! //!
//! While not perfect, this algorithm should help support use-cases such as leaf //! While not perfect, this algorithm should help support use-cases such as leaf
//! dependencies being static while the larger tree of inner dependencies are //! dependencies being static while the larger tree of inner dependencies are

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_middle" name = "rustc_middle"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -257,7 +257,8 @@ pub struct ScopeTree {
/// ``` /// ```
/// ///
/// With the HIR tree (calls numbered for expository purposes) /// With the HIR tree (calls numbered for expository purposes)
/// ``` ///
/// ```text
/// Call#0(foo, [Call#1(f), Yield(y), Call#2(bar, Call#3(g))]) /// Call#0(foo, [Call#1(f), Yield(y), Call#2(bar, Call#3(g))])
/// ``` /// ```
/// ///

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_mir_build" name = "rustc_mir_build"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_mir_dataflow" name = "rustc_mir_dataflow"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_mir_transform" name = "rustc_mir_transform"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -1,7 +1,7 @@
[package] [package]
name = "coverage_test_macros" name = "coverage_test_macros"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
proc-macro = true proc-macro = true

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_monomorphize" name = "rustc_monomorphize"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_parse" name = "rustc_parse"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_parse_format" name = "rustc_parse_format"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[dependencies] [dependencies]
rustc_span = { path = "../rustc_span" } rustc_span = { path = "../rustc_span" }

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_passes" name = "rustc_passes"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[dependencies] [dependencies]
tracing = "0.1" tracing = "0.1"

View File

@ -2,7 +2,7 @@
name = "rustc_plugin_impl" name = "rustc_plugin_impl"
version = "0.0.0" version = "0.0.0"
build = false build = false
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_privacy" name = "rustc_privacy"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[dependencies] [dependencies]
rustc_middle = { path = "../rustc_middle" } rustc_middle = { path = "../rustc_middle" }

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_query_impl" name = "rustc_query_impl"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_query_system" name = "rustc_query_system"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_resolve" name = "rustc_resolve"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
test = false test = false

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_save_analysis" name = "rustc_save_analysis"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[dependencies] [dependencies]
tracing = "0.1" tracing = "0.1"

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_serialize" name = "rustc_serialize"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[dependencies] [dependencies]
indexmap = "1" indexmap = "1"

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_session" name = "rustc_session"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[dependencies] [dependencies]
getopts = "0.2" getopts = "0.2"

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_span" name = "rustc_span"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_symbol_mangling" name = "rustc_symbol_mangling"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_target" name = "rustc_target"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[dependencies] [dependencies]
bitflags = "1.2.1" bitflags = "1.2.1"

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_trait_selection" name = "rustc_trait_selection"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -104,19 +104,21 @@ impl ChildrenExt for Children {
let self_ty = trait_ref.self_ty(); let self_ty = trait_ref.self_ty();
// FIXME: should postpone string formatting until we decide to actually emit. // FIXME: should postpone string formatting until we decide to actually emit.
with_no_trimmed_paths(|| OverlapError { with_no_trimmed_paths(|| {
with_impl: possible_sibling, OverlapError {
trait_desc: trait_ref.print_only_trait_path().to_string(), with_impl: possible_sibling,
// Only report the `Self` type if it has at least trait_desc: trait_ref.print_only_trait_path().to_string(),
// some outer concrete shell; otherwise, it's // Only report the `Self` type if it has at least
// not adding much information. // some outer concrete shell; otherwise, it's
self_desc: if self_ty.has_concrete_skeleton() { // not adding much information.
Some(self_ty.to_string()) self_desc: if self_ty.has_concrete_skeleton() {
} else { Some(self_ty.to_string())
None } else {
}, None
intercrate_ambiguity_causes: overlap.intercrate_ambiguity_causes, },
involves_placeholder: overlap.involves_placeholder, intercrate_ambiguity_causes: overlap.intercrate_ambiguity_causes,
involves_placeholder: overlap.involves_placeholder,
}
}) })
}; };

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_traits" name = "rustc_traits"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[dependencies] [dependencies]
tracing = "0.1" tracing = "0.1"

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_ty_utils" name = "rustc_ty_utils"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[dependencies] [dependencies]
tracing = "0.1" tracing = "0.1"

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_type_ir" name = "rustc_type_ir"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
doctest = false doctest = false

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustc_typeck" name = "rustc_typeck"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
test = false test = false

View File

@ -2417,13 +2417,14 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
let substs = InternalSubsts::for_item(tcx, def_id, |param, _| { let substs = InternalSubsts::for_item(tcx, def_id, |param, _| {
if let Some(i) = (param.index as usize).checked_sub(generics.parent_count) { if let Some(i) = (param.index as usize).checked_sub(generics.parent_count) {
// Our own parameters are the resolved lifetimes. // Our own parameters are the resolved lifetimes.
match param.kind { if let GenericParamDefKind::Lifetime = param.kind {
GenericParamDefKind::Lifetime if let hir::GenericArg::Lifetime(lifetime) = &lifetimes[i] {
if let hir::GenericArg::Lifetime(lifetime) = &lifetimes[i] =>
{
self.ast_region_to_region(lifetime, None).into() self.ast_region_to_region(lifetime, None).into()
} else {
bug!()
} }
_ => bug!(), } else {
bug!()
} }
} else { } else {
match param.kind { match param.kind {

View File

@ -1,7 +1,7 @@
[package] [package]
name = "bootstrap" name = "bootstrap"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
build = "build.rs" build = "build.rs"
[lib] [lib]

View File

@ -262,7 +262,7 @@ impl Step for CodegenBackend {
let mut cargo = builder.cargo( let mut cargo = builder.cargo(
compiler, compiler,
Mode::Codegen, Mode::Codegen,
SourceType::Submodule, SourceType::InTree,
target, target,
cargo_subcommand(builder.kind), cargo_subcommand(builder.kind),
); );

View File

@ -817,8 +817,7 @@ impl Step for CodegenBackend {
let out_dir = builder.cargo_out(compiler, Mode::Codegen, target); let out_dir = builder.cargo_out(compiler, Mode::Codegen, target);
let mut cargo = let mut cargo = builder.cargo(compiler, Mode::Codegen, SourceType::InTree, target, "build");
builder.cargo(compiler, Mode::Codegen, SourceType::Submodule, target, "build");
cargo cargo
.arg("--manifest-path") .arg("--manifest-path")
.arg(builder.src.join(format!("compiler/rustc_codegen_{}/Cargo.toml", backend))); .arg(builder.src.join(format!("compiler/rustc_codegen_{}/Cargo.toml", backend)));

View File

@ -390,7 +390,7 @@ impl Step for Rustfmt {
host, host,
"test", "test",
"src/tools/rustfmt", "src/tools/rustfmt",
SourceType::Submodule, SourceType::InTree,
&[], &[],
); );

View File

@ -1,7 +1,7 @@
[package] [package]
name = "build_helper" name = "build_helper"
version = "0.1.0" version = "0.1.0"
edition = "2018" edition = "2021"
[lib] [lib]
path = "lib.rs" path = "lib.rs"

View File

@ -1,7 +1,7 @@
[package] [package]
name = "test-float-parse" name = "test-float-parse"
version = "0.1.0" version = "0.1.0"
edition = "2018" edition = "2021"
publish = false publish = false
[workspace] [workspace]

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustdoc" name = "rustdoc"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[lib] [lib]
path = "lib.rs" path = "lib.rs"

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustdoc-json-types" name = "rustdoc-json-types"
version = "0.1.0" version = "0.1.0"
edition = "2018" edition = "2021"
[lib] [lib]
path = "lib.rs" path = "lib.rs"

View File

@ -1,7 +1,7 @@
[package] [package]
name = "build-manifest" name = "build-manifest"
version = "0.1.0" version = "0.1.0"
edition = "2018" edition = "2021"
[dependencies] [dependencies]
toml = "0.5" toml = "0.5"

View File

@ -1,7 +1,7 @@
[package] [package]
name = "bump-stage0" name = "bump-stage0"
version = "0.1.0" version = "0.1.0"
edition = "2018" edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -1,7 +1,7 @@
[package] [package]
name = "cargotest2" name = "cargotest2"
version = "0.1.0" version = "0.1.0"
edition = "2018" edition = "2021"
[[bin]] [[bin]]
name = "cargotest" name = "cargotest"

View File

@ -1,7 +1,7 @@
[package] [package]
name = "compiletest" name = "compiletest"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[dependencies] [dependencies]
colored = "2" colored = "2"

View File

@ -1,7 +1,7 @@
[package] [package]
name = "error_index_generator" name = "error_index_generator"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
[dependencies] [dependencies]
rustdoc = { path = "../../librustdoc" } rustdoc = { path = "../../librustdoc" }

View File

@ -1,7 +1,7 @@
[package] [package]
name = "expand-yaml-anchors" name = "expand-yaml-anchors"
version = "0.1.0" version = "0.1.0"
edition = "2018" edition = "2021"
[dependencies] [dependencies]
yaml-rust = "0.4.3" yaml-rust = "0.4.3"

View File

@ -1,7 +1,7 @@
[package] [package]
name = "html-checker" name = "html-checker"
version = "0.1.0" version = "0.1.0"
edition = "2018" edition = "2021"
[[bin]] [[bin]]
name = "html-checker" name = "html-checker"

View File

@ -1,7 +1,7 @@
[package] [package]
name = "jsondocck" name = "jsondocck"
version = "0.1.0" version = "0.1.0"
edition = "2018" edition = "2021"
[dependencies] [dependencies]
jsonpath_lib = "0.2" jsonpath_lib = "0.2"

View File

@ -1,7 +1,7 @@
[package] [package]
name = "linkchecker" name = "linkchecker"
version = "0.1.0" version = "0.1.0"
edition = "2018" edition = "2021"
[[bin]] [[bin]]
name = "linkchecker" name = "linkchecker"

View File

@ -1,7 +1,7 @@
[package] [package]
name = "lint-docs" name = "lint-docs"
version = "0.1.0" version = "0.1.0"
edition = "2018" edition = "2021"
description = "A script to extract the lint documentation for the rustc book." 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 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -149,6 +149,10 @@ impl<'a> LintExtractor<'a> {
} else if line.starts_with("// ") { } else if line.starts_with("// ") {
// Ignore comments. // Ignore comments.
continue; continue;
} else if line.starts_with("#[allow") {
// Ignore allow of lints (useful for
// invalid_rust_codeblocks).
continue;
} else { } else {
let name = lint_name(line).map_err(|e| { let name = lint_name(line).map_err(|e| {
format!( format!(

View File

@ -1,6 +1,6 @@
[package] [package]
name = "remote-test-client" name = "remote-test-client"
version = "0.1.0" version = "0.1.0"
edition = "2018" edition = "2021"
[dependencies] [dependencies]

View File

@ -1,6 +1,6 @@
[package] [package]
name = "remote-test-server" name = "remote-test-server"
version = "0.1.0" version = "0.1.0"
edition = "2018" edition = "2021"
[dependencies] [dependencies]

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rust-demangler" name = "rust-demangler"
version = "0.0.1" version = "0.0.1"
edition = "2018" edition = "2021"
[dependencies] [dependencies]
regex = "1.0" regex = "1.0"

View File

@ -2,7 +2,7 @@
name = "rustbook" name = "rustbook"
version = "0.1.0" version = "0.1.0"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
edition = "2018" edition = "2021"
[dependencies] [dependencies]
clap = "2.25.0" clap = "2.25.0"

View File

@ -5,7 +5,7 @@ license = 'MIT OR Apache-2.0'
description = """ description = """
Hack for the compiler's own build system Hack for the compiler's own build system
""" """
edition = "2018" edition = "2021"
[lib] [lib]
path = "lib.rs" path = "lib.rs"

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustdoc-themes" name = "rustdoc-themes"
version = "0.1.0" version = "0.1.0"
edition = "2018" edition = "2021"
[[bin]] [[bin]]
name = "rustdoc-themes" name = "rustdoc-themes"

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rustdoc-tool" name = "rustdoc-tool"
version = "0.0.0" version = "0.0.0"
edition = "2018" edition = "2021"
# Cargo adds a number of paths to the dylib search path on windows, which results in # 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" # the wrong rustdoc being executed. To avoid the conflicting rustdocs, we name the "tool"

View File

@ -8,7 +8,7 @@ readme = "README.md"
license = "Apache-2.0/MIT" license = "Apache-2.0/MIT"
build = "build.rs" build = "build.rs"
categories = ["development-tools"] categories = ["development-tools"]
edition = "2018" edition = "2021"
[[bin]] [[bin]]
name = "rustfmt" name = "rustfmt"

View File

@ -1,7 +1,7 @@
[package] [package]
name = "tidy" name = "tidy"
version = "0.1.0" version = "0.1.0"
edition = "2018" edition = "2021"
autobins = false autobins = false
[dependencies] [dependencies]

View File

@ -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; use std::path::Path;
fn is_edition_2018(mut line: &str) -> bool { fn is_edition_2018(mut line: &str) -> bool {
line = line.trim(); 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) { 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 |path| super::filter_dirs(path) || path.ends_with("src/test"),
&mut |entry, contents| { &mut |entry, contents| {
let file = entry.path(); let file = entry.path();
let filestr = file.to_string_lossy().replace("\\", "/");
let filename = file.file_name().unwrap(); let filename = file.file_name().unwrap();
if filename != "Cargo.toml" { if filename != "Cargo.toml" {
return; return;
} }
let has_edition = contents.lines().any(is_edition_2018);
if !has_edition { // Library crates are not yet ready to migrate to 2021.
tidy_error!( //
bad, // The reference and rustc-dev-guide are submodules, so are left at
"{} doesn't have `edition = \"2018\"` on a separate line", // 2018 for now. They should be removed from this exception list
file.display() // 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()
);
}
} }
}, },
); );

Some files were not shown because too many files have changed in this diff Show More