Skip to content

Commit 89a69fd

Browse files
authored
Rollup merge of #64139 - Mark-Simulacrum:strip-legacy-proc-macro, r=petrochenkov
Migrate internal diagnostic registration to macro_rules Review is best done commit-by-commit. Fixes #64132.
2 parents 3c4a586 + 5153db1 commit 89a69fd

File tree

49 files changed

+176
-489
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+176
-489
lines changed

Cargo.lock

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3129,11 +3129,7 @@ dependencies = [
31293129
name = "rustc_codegen_llvm"
31303130
version = "0.0.0"
31313131
dependencies = [
3132-
"cc",
3133-
"memmap",
3134-
"num_cpus",
31353132
"rustc_llvm",
3136-
"tempfile",
31373133
]
31383134

31393135
[[package]]

src/bootstrap/test.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1327,7 +1327,10 @@ impl Step for Compiletest {
13271327
cmd.env("RUSTC_PROFILER_SUPPORT", "1");
13281328
}
13291329

1330-
cmd.env("RUST_TEST_TMPDIR", builder.out.join("tmp"));
1330+
let tmp = builder.out.join("tmp");
1331+
std::fs::create_dir_all(&tmp).unwrap();
1332+
cmd.env("RUST_TEST_TMPDIR", tmp);
1333+
13311334

13321335
cmd.arg("--adb-path").arg("adb");
13331336
cmd.arg("--adb-test-dir").arg(ADB_TEST_DIR);

src/librustc/error_codes.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Error messages for EXXXX errors.
2-
// Each message should start and end with a new line, and be wrapped to 80 characters.
3-
// In vim you can `:set tw=80` and use `gq` to wrap paragraphs. Use `:set tw=0` to disable.
4-
register_long_diagnostics! {
2+
// Each message should start and end with a new line, and be wrapped to 80
3+
// characters. In vim you can `:set tw=80` and use `gq` to wrap paragraphs. Use
4+
// `:set tw=0` to disable.
5+
syntax::register_diagnostics! {
56
E0038: r##"
67
Trait objects like `Box<Trait>` can only be constructed when certain
78
requirements are satisfied by the trait in question.
@@ -2183,11 +2184,7 @@ Examples of erroneous code:
21832184
static X: u32 = 42;
21842185
```
21852186
"##,
2186-
2187-
}
2188-
2189-
2190-
register_diagnostics! {
2187+
;
21912188
// E0006, // merged with E0005
21922189
// E0101, // replaced with E0282
21932190
// E0102, // replaced with E0282
@@ -2206,7 +2203,8 @@ register_diagnostics! {
22062203
// E0305, // expected constant
22072204
E0311, // thing may not live long enough
22082205
E0312, // lifetime of reference outlives lifetime of borrowed content
2209-
E0313, // lifetime of borrowed pointer outlives lifetime of captured variable
2206+
E0313, // lifetime of borrowed pointer outlives lifetime of captured
2207+
// variable
22102208
E0314, // closure outlives stack frame
22112209
E0315, // cannot invoke closure outside of its lifetime
22122210
E0316, // nested quantification of lifetimes
@@ -2223,12 +2221,13 @@ register_diagnostics! {
22232221
E0483, // lifetime of operand does not outlive the operation
22242222
E0484, // reference is not valid at the time of borrow
22252223
E0485, // automatically reference is not valid at the time of borrow
2226-
E0486, // type of expression contains references that are not valid during...
2224+
E0486, // type of expression contains references that are not valid during..
22272225
E0487, // unsafe use of destructor: destructor might be called while...
22282226
E0488, // lifetime of variable does not enclose its declaration
22292227
E0489, // type/lifetime parameter not in scope here
22302228
E0490, // a value of type `..` is borrowed for too long
2231-
E0495, // cannot infer an appropriate lifetime due to conflicting requirements
2229+
E0495, // cannot infer an appropriate lifetime due to conflicting
2230+
// requirements
22322231
E0566, // conflicting representation hints
22332232
E0623, // lifetime mismatch where both parameters are anonymous regions
22342233
E0628, // generators cannot have explicit parameters
@@ -2239,7 +2238,8 @@ register_diagnostics! {
22392238
E0688, // in-band lifetimes cannot be mixed with explicit lifetime binders
22402239
E0697, // closures cannot be static
22412240
E0707, // multiple elided lifetimes used in arguments of `async fn`
2242-
E0708, // `async` non-`move` closures with parameters are not currently supported
2241+
E0708, // `async` non-`move` closures with parameters are not currently
2242+
// supported
22432243
E0709, // multiple different lifetimes used in arguments of `async fn`
22442244
E0710, // an unknown tool name found in scoped lint
22452245
E0711, // a feature has been declared with conflicting stability attributes

src/librustc/lib.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
#![feature(non_exhaustive)]
4646
#![feature(optin_builtin_traits)]
4747
#![feature(range_is_empty)]
48-
#![feature(rustc_diagnostic_macros)]
4948
#![feature(slice_patterns)]
5049
#![feature(specialization)]
5150
#![feature(unboxed_closures)]
@@ -88,8 +87,6 @@ mod tests;
8887
#[macro_use]
8988
mod macros;
9089

91-
// N.B., this module needs to be declared first so diagnostics are
92-
// registered before they are used.
9390
pub mod error_codes;
9491

9592
#[macro_use]
@@ -142,6 +139,3 @@ pub mod util {
142139

143140
// Allows macros to refer to this crate as `::rustc`
144141
extern crate self as rustc;
145-
146-
// Build the diagnostics array at the end so that the metadata includes error use sites.
147-
__build_diagnostic_array! { librustc, DIAGNOSTICS }

src/librustc_codegen_llvm/Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@ crate-type = ["dylib"]
1111
test = false
1212

1313
[dependencies]
14-
cc = "1.0.1" # Used to locate MSVC
15-
num_cpus = "1.0"
16-
tempfile = "3.0"
1714
rustc_llvm = { path = "../librustc_llvm" }
18-
memmap = "0.6"
1915

2016
[features]
2117
# This is used to convince Cargo to separately cache builds of `rustc_codegen_llvm`

src/librustc_codegen_llvm/error_codes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
register_long_diagnostics! {
1+
register_diagnostics! {
22

33
E0511: r##"
44
Invalid monomorphization of an intrinsic function was used. Erroneous code

src/librustc_codegen_llvm/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#![feature(in_band_lifetimes)]
1515
#![feature(libc)]
1616
#![feature(nll)]
17-
#![feature(rustc_diagnostic_macros)]
1817
#![feature(optin_builtin_traits)]
1918
#![feature(concat_idents)]
2019
#![feature(link_args)]
@@ -256,7 +255,7 @@ impl CodegenBackend for LlvmCodegenBackend {
256255
}
257256

258257
fn diagnostics(&self) -> &[(&'static str, &'static str)] {
259-
&DIAGNOSTICS
258+
&error_codes::DIAGNOSTICS
260259
}
261260

262261
fn target_features(&self, sess: &Session) -> Vec<Symbol> {
@@ -425,5 +424,3 @@ impl Drop for ModuleLlvm {
425424
}
426425
}
427426
}
428-
429-
__build_diagnostic_array! { librustc_codegen_llvm, DIAGNOSTICS }

src/librustc_codegen_ssa/error_codes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
register_long_diagnostics! {
1+
syntax::register_diagnostics! {
22

33
E0668: r##"
44
Malformed inline assembly rejected by LLVM.

src/librustc_codegen_ssa/lib.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#![feature(box_syntax)]
55
#![feature(core_intrinsics)]
66
#![feature(libc)]
7-
#![feature(rustc_diagnostic_macros)]
87
#![feature(stmt_expr_attributes)]
98
#![feature(try_blocks)]
109
#![feature(in_band_lifetimes)]
@@ -35,8 +34,6 @@ use rustc_data_structures::svh::Svh;
3534
use rustc::middle::cstore::{LibSource, CrateSource, NativeLibrary};
3635
use syntax_pos::symbol::Symbol;
3736

38-
// N.B., this module needs to be declared first so diagnostics are
39-
// registered before they are used.
4037
mod error_codes;
4138

4239
pub mod common;
@@ -158,5 +155,3 @@ pub struct CodegenResults {
158155
pub linker_info: back::linker::LinkerInfo,
159156
pub crate_info: CrateInfo,
160157
}
161-
162-
__build_diagnostic_array! { librustc_codegen_ssa, DIAGNOSTICS }

src/librustc_codegen_utils/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#![feature(core_intrinsics)]
1111
#![feature(never_type)]
1212
#![feature(nll)]
13-
#![feature(rustc_diagnostic_macros)]
1413
#![feature(in_band_lifetimes)]
1514

1615
#![recursion_limit="256"]

0 commit comments

Comments
 (0)