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 d6cd2c6c877110748296760aefddc21a0ea1d316 -I'^edition = .20...$'` to ignore the edition = 2018/21 lines in the diff.
This commit is contained in:
commit
ac2d9fc509
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc-main"
|
||||
version = "0.0.0"
|
||||
edition = '2018'
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
rustc_driver = { path = "../rustc_driver" }
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_apfloat"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
bitflags = "1.2.1"
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_arena"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_ast"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_ast_lowering"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_ast_passes"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
itertools = "0.9"
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_ast_pretty"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_attr"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_borrowck"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_builtin_macros"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_codegen_cranelift"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
crate-type = ["dylib"]
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#![feature(rustc_private)]
|
||||
|
||||
extern crate rustc_data_structures;
|
||||
extern crate rustc_driver;
|
||||
extern crate rustc_interface;
|
||||
extern crate rustc_session;
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_codegen_llvm"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
test = false
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_codegen_ssa"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
test = false
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_const_eval"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -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,
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_data_structures"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_driver"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
crate-type = ["dylib"]
|
||||
|
@ -1,4 +1,4 @@
|
||||
[package]
|
||||
name = "rustc_error_codes"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_errors"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -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::<Vec<_>>();
|
||||
if !error_codes.is_empty() {
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_expand"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
build = false
|
||||
|
||||
[lib]
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_feature"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -1,4 +1,4 @@
|
||||
[package]
|
||||
name = "rustc_fs_util"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
@ -1,4 +1,4 @@
|
||||
[package]
|
||||
name = "rustc_graphviz"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_hir"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_hir_pretty"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_incremental"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_index"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_infer"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_interface"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -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 thread = cfg.spawn(move || {
|
||||
let _ = (&run, &result_ptr);
|
||||
let run = unsafe { (*(run.0 as *mut Option<F>)).take().unwrap() };
|
||||
let result = unsafe { &mut *(result_ptr.0 as *mut Option<R>) };
|
||||
*result = Some(run());
|
||||
|
@ -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 = """
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_lint"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
if_chain = "1.0"
|
||||
|
@ -13,7 +13,7 @@ declare_lint! {
|
||||
///
|
||||
/// ### Example
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust,edition2018
|
||||
/// # #![allow(unused)]
|
||||
/// [1, 2, 3].into_iter().for_each(|n| { *n; });
|
||||
/// ```
|
||||
|
@ -1686,7 +1686,7 @@ declare_lint! {
|
||||
///
|
||||
/// ### Example
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust,edition2018
|
||||
/// let x = 123;
|
||||
/// match x {
|
||||
/// 0...100 => {}
|
||||
|
@ -18,7 +18,7 @@ declare_lint! {
|
||||
///
|
||||
/// ### Example
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// ```rust,no_run,edition2018
|
||||
/// panic!("{}");
|
||||
/// panic!(123);
|
||||
/// ```
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_lint_defs"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
|
@ -1584,7 +1584,7 @@ declare_lint! {
|
||||
///
|
||||
/// ### Example
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust,edition2018
|
||||
/// trait Trait { }
|
||||
///
|
||||
/// fn takes_trait_object(_: Box<Trait>) {
|
||||
@ -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",
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_llvm"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[features]
|
||||
static-libstdcpp = []
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_macros"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_metadata"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -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
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_middle"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -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))])
|
||||
/// ```
|
||||
///
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_mir_build"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_mir_dataflow"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_mir_transform"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "coverage_test_macros"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_monomorphize"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_parse"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_parse_format"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
rustc_span = { path = "../rustc_span" }
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_passes"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
tracing = "0.1"
|
||||
|
@ -2,7 +2,7 @@
|
||||
name = "rustc_plugin_impl"
|
||||
version = "0.0.0"
|
||||
build = false
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_privacy"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
rustc_middle = { path = "../rustc_middle" }
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_query_impl"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_query_system"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_resolve"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
test = false
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_save_analysis"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
tracing = "0.1"
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_serialize"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
indexmap = "1"
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_session"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
getopts = "0.2"
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_span"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_symbol_mangling"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_target"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
bitflags = "1.2.1"
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_trait_selection"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -104,19 +104,21 @@ 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(|| {
|
||||
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,
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_traits"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
tracing = "0.1"
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_ty_utils"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
tracing = "0.1"
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_type_ir"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustc_typeck"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
test = false
|
||||
|
@ -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 {
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "bootstrap"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
build = "build.rs"
|
||||
|
||||
[lib]
|
||||
|
@ -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),
|
||||
);
|
||||
|
@ -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)));
|
||||
|
@ -390,7 +390,7 @@ impl Step for Rustfmt {
|
||||
host,
|
||||
"test",
|
||||
"src/tools/rustfmt",
|
||||
SourceType::Submodule,
|
||||
SourceType::InTree,
|
||||
&[],
|
||||
);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "build_helper"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
path = "lib.rs"
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "test-float-parse"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
|
||||
[workspace]
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustdoc"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
path = "lib.rs"
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustdoc-json-types"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
path = "lib.rs"
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "build-manifest"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
toml = "0.5"
|
||||
|
@ -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
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "cargotest2"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[[bin]]
|
||||
name = "cargotest"
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "compiletest"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
colored = "2"
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "error_index_generator"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
rustdoc = { path = "../../librustdoc" }
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "expand-yaml-anchors"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
yaml-rust = "0.4.3"
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "html-checker"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[[bin]]
|
||||
name = "html-checker"
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "jsondocck"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
jsonpath_lib = "0.2"
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "linkchecker"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[[bin]]
|
||||
name = "linkchecker"
|
||||
|
@ -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
|
||||
|
@ -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!(
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "remote-test-client"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "remote-test-server"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rust-demangler"
|
||||
version = "0.0.1"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
regex = "1.0"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "rustdoc-themes"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[[bin]]
|
||||
name = "rustdoc-themes"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "tidy"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
autobins = false
|
||||
|
||||
[dependencies]
|
||||
|
@ -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()
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user