Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate in-tree crates to 2021 #89103

Merged
merged 8 commits into from
Sep 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc-main"
version = "0.0.0"
edition = '2018'
edition = "2021"

[dependencies]
rustc_driver = { path = "../rustc_driver" }
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_apfloat/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc_apfloat"
version = "0.0.0"
edition = "2018"
edition = "2021"

[dependencies]
bitflags = "1.2.1"
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_arena/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc_arena"
version = "0.0.0"
edition = "2018"
edition = "2021"

[dependencies]
rustc_data_structures = { path = "../rustc_data_structures" }
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc_ast"
version = "0.0.0"
edition = "2018"
edition = "2021"

[lib]
doctest = false
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc_ast_lowering"
version = "0.0.0"
edition = "2018"
edition = "2021"

[lib]
doctest = false
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_passes/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc_ast_passes"
version = "0.0.0"
edition = "2018"
edition = "2021"

[dependencies]
itertools = "0.9"
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_pretty/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc_ast_pretty"
version = "0.0.0"
edition = "2018"
edition = "2021"

[lib]
doctest = false
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_attr/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc_attr"
version = "0.0.0"
edition = "2018"
edition = "2021"

[lib]
doctest = false
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc_borrowck"
version = "0.0.0"
edition = "2018"
edition = "2021"

[lib]
doctest = false
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc_builtin_macros"
version = "0.0.0"
edition = "2018"
edition = "2021"

[lib]
doctest = false
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc_codegen_cranelift"
version = "0.1.0"
edition = "2018"
edition = "2021"

[lib]
crate-type = ["dylib"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#![feature(rustc_private)]

extern crate rustc_data_structures;
Mark-Simulacrum marked this conversation as resolved.
Show resolved Hide resolved
extern crate rustc_driver;
extern crate rustc_interface;
extern crate rustc_session;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc_codegen_llvm"
version = "0.0.0"
edition = "2018"
edition = "2021"

[lib]
test = false
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc_codegen_ssa"
version = "0.0.0"
edition = "2018"
edition = "2021"

[lib]
test = false
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_const_eval/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc_const_eval"
version = "0.0.0"
edition = "2018"
edition = "2021"

[lib]
doctest = false
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_const_eval/src/interpret/validity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_data_structures/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc_data_structures"
version = "0.0.0"
edition = "2018"
edition = "2021"

[lib]
doctest = false
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_driver/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc_driver"
version = "0.0.0"
edition = "2018"
edition = "2021"

[lib]
crate-type = ["dylib"]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_error_codes/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[package]
name = "rustc_error_codes"
version = "0.0.0"
edition = "2018"
edition = "2021"
2 changes: 1 addition & 1 deletion compiler/rustc_errors/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc_errors"
version = "0.0.0"
edition = "2018"
edition = "2021"

[lib]
doctest = false
Expand Down
6 changes: 2 additions & 4 deletions compiler/rustc_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_expand/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc_expand"
version = "0.0.0"
edition = "2018"
edition = "2021"
build = false

[lib]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_feature/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc_feature"
version = "0.0.0"
edition = "2018"
edition = "2021"

[lib]
doctest = false
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_fs_util/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[package]
name = "rustc_fs_util"
version = "0.0.0"
edition = "2018"
edition = "2021"
2 changes: 1 addition & 1 deletion compiler/rustc_graphviz/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[package]
name = "rustc_graphviz"
version = "0.0.0"
edition = "2018"
edition = "2021"
2 changes: 1 addition & 1 deletion compiler/rustc_hir/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc_hir"
version = "0.0.0"
edition = "2018"
edition = "2021"

[lib]
doctest = false
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_pretty/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc_hir_pretty"
version = "0.0.0"
edition = "2018"
edition = "2021"

[lib]
doctest = false
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_incremental/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc_incremental"
version = "0.0.0"
edition = "2018"
edition = "2021"

[lib]
doctest = false
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_index/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc_index"
version = "0.0.0"
edition = "2018"
edition = "2021"

[lib]
doctest = false
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_infer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc_infer"
version = "0.0.0"
edition = "2018"
edition = "2021"

[lib]
doctest = false
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_interface/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc_interface"
version = "0.0.0"
edition = "2018"
edition = "2021"

[lib]
doctest = false
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_interface/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are necessary since raw pointers aren't send/sync, but this whole block is likely to go away shortly anyway - #89104

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());
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lexer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = """
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc_lint"
version = "0.0.0"
edition = "2018"
edition = "2021"

[dependencies]
if_chain = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/array_into_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ declare_lint! {
///
/// ### Example
///
/// ```rust
/// ```rust,edition2018
/// # #![allow(unused)]
/// [1, 2, 3].into_iter().for_each(|n| { *n; });
/// ```
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1686,7 +1686,7 @@ declare_lint! {
///
/// ### Example
///
/// ```rust
/// ```rust,edition2018
/// let x = 123;
/// match x {
/// 0...100 => {}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/non_fmt_panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ declare_lint! {
///
/// ### Example
///
/// ```rust,no_run
/// ```rust,no_run,edition2018
/// panic!("{}");
/// panic!(123);
/// ```
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint_defs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc_lint_defs"
version = "0.0.0"
edition = "2018"
edition = "2021"

[dependencies]
rustc_ast = { path = "../rustc_ast" }
Expand Down
6 changes: 4 additions & 2 deletions compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1584,7 +1584,7 @@ declare_lint! {
///
/// ### Example
///
/// ```rust
/// ```rust,edition2018
/// trait Trait { }
///
/// fn takes_trait_object(_: Box<Trait>) {
Expand Down Expand Up @@ -3313,7 +3313,7 @@ declare_lint! {
///
/// ### Example
///
/// ```rust,compile_fail
/// ```rust,edition2018,compile_fail
/// #![deny(rust_2021_prefixes_incompatible_syntax)]
///
/// macro_rules! m {
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_llvm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc_llvm"
version = "0.0.0"
edition = "2018"
edition = "2021"

[features]
static-libstdcpp = []
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc_macros"
version = "0.1.0"
edition = "2018"
edition = "2021"

[lib]
proc-macro = true
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_metadata/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustc_metadata"
version = "0.0.0"
edition = "2018"
edition = "2021"

[lib]
doctest = false
Expand Down
Loading