diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index b81f7a24270..09a3e53c7f0 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -41,9 +41,6 @@ use std::convert::TryFrom; use std::fmt; use std::mem; -#[cfg(test)] -mod tests; - /// A "Label" is an identifier of some point in sources, /// e.g. in the following code: /// diff --git a/compiler/rustc_ast/src/ast/tests.rs b/compiler/rustc_ast/src/ast/tests.rs deleted file mode 100644 index 8ba55bf037b..00000000000 --- a/compiler/rustc_ast/src/ast/tests.rs +++ /dev/null @@ -1,11 +0,0 @@ -use super::*; - -// Are ASTs encodable? -#[test] -fn check_asts_encodable() { - fn assert_encodable< - T: for<'a> rustc_serialize::Encodable>, - >() { - } - assert_encodable::(); -} diff --git a/compiler/rustc_driver/src/lib.rs b/compiler/rustc_driver/src/lib.rs index 0434997977a..179a184536e 100644 --- a/compiler/rustc_driver/src/lib.rs +++ b/compiler/rustc_driver/src/lib.rs @@ -343,10 +343,7 @@ fn run_compiler( return early_exit(); } - if sess.opts.debugging_opts.parse_only - || sess.opts.debugging_opts.show_span.is_some() - || sess.opts.debugging_opts.ast_json_noexpand - { + if sess.opts.debugging_opts.parse_only || sess.opts.debugging_opts.show_span.is_some() { return early_exit(); } @@ -375,7 +372,7 @@ fn run_compiler( queries.global_ctxt()?; - if sess.opts.debugging_opts.no_analysis || sess.opts.debugging_opts.ast_json { + if sess.opts.debugging_opts.no_analysis { return early_exit(); } diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index e6c9c6693c5..3c867e308c4 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -27,7 +27,6 @@ use rustc_passes::{self, hir_stats, layout_test}; use rustc_plugin_impl as plugin; use rustc_query_impl::{OnDiskCache, Queries as TcxQueries}; use rustc_resolve::{Resolver, ResolverArenas}; -use rustc_serialize::json; use rustc_session::config::{CrateType, Input, OutputFilenames, OutputType}; use rustc_session::cstore::{MetadataLoader, MetadataLoaderDyn}; use rustc_session::output::{filename_for_input, filename_for_metadata}; @@ -59,10 +58,6 @@ pub fn parse<'a>(sess: &'a Session, input: &Input) -> PResult<'a, ast::Crate> { } })?; - if sess.opts.debugging_opts.ast_json_noexpand { - println!("{}", json::as_json(&krate)); - } - if sess.opts.debugging_opts.input_stats { eprintln!("Lines of code: {}", sess.source_map().count_lines()); eprintln!("Pre-expansion node count: {}", count_nodes(&krate)); @@ -423,10 +418,6 @@ pub fn configure_and_expand( hir_stats::print_ast_stats(&krate, "POST EXPANSION AST STATS"); } - if sess.opts.debugging_opts.ast_json { - println!("{}", json::as_json(&krate)); - } - resolver.resolve_crate(&krate); // Needs to go *after* expansion to be able to check the results of macro expansion. diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index 1327bf6fcd4..a178cca6d10 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -644,8 +644,6 @@ fn test_debugging_options_tracking_hash() { // Make sure that changing an [UNTRACKED] option leaves the hash unchanged. // This list is in alphabetical order. untracked!(assert_incr_state, Some(String::from("loaded"))); - untracked!(ast_json, true); - untracked!(ast_json_noexpand, true); untracked!(borrowck, String::from("other")); untracked!(deduplicate_diagnostics, false); untracked!(dep_tasks, true); diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 66198dff2ae..ae32fd2dee9 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -1207,10 +1207,6 @@ options! { assert_incr_state: Option = (None, parse_opt_string, [UNTRACKED], "assert that the incremental cache is in given state: \ either `loaded` or `not-loaded`."), - ast_json: bool = (false, parse_bool, [UNTRACKED], - "print the AST as JSON and halt (default: no)"), - ast_json_noexpand: bool = (false, parse_bool, [UNTRACKED], - "print the pre-expansion AST as JSON and halt (default: no)"), binary_dep_depinfo: bool = (false, parse_bool, [TRACKED], "include artifacts (sysroot, crate dependencies) used during compilation in dep-info \ (default: no)"), diff --git a/src/test/ui/ast-json/ast-json-ice.rs b/src/test/ui/ast-json/ast-json-ice.rs deleted file mode 100644 index ce93e4b5d4b..00000000000 --- a/src/test/ui/ast-json/ast-json-ice.rs +++ /dev/null @@ -1,56 +0,0 @@ -// Test that AST json serialization doesn't ICE (#63728). - -// revisions: expand noexpand - -//[expand] compile-flags: -Zast-json -//[noexpand] compile-flags: -Zast-json-noexpand - -// check-pass -// dont-check-compiler-stdout - don't check for any AST change. - -enum V { - A(i32), - B { f: [i64; 3 + 4] } -} - -trait X { - type Output; - fn read(&self) -> Self::Output; - fn write(&mut self, _: Self::Output); -} - -macro_rules! call_println { - ($y:ident) => { println!("{}", $y) } -} - -fn main() { - let x: (i32) = 35; - let y = x as i64<> + 5; - - call_println!(y); - - struct A; -} - -// Regressions tests for issues #78398 and #78510 (captured tokens in associated and foreign items) - -struct S; - -macro_rules! mac_extern { - ($i:item) => { - extern "C" { $i } - } -} -macro_rules! mac_assoc { - ($i:item) => { - impl S { $i } - trait Bar { $i } - } -} - -mac_extern! { - fn foo(); -} -mac_assoc! { - fn foo() {} -} diff --git a/src/test/ui/ast-json/ast-json-noexpand-output.rs b/src/test/ui/ast-json/ast-json-noexpand-output.rs deleted file mode 100644 index cba539f0065..00000000000 --- a/src/test/ui/ast-json/ast-json-noexpand-output.rs +++ /dev/null @@ -1,10 +0,0 @@ -// Check that AST json printing works. -#![crate_type = "lib"] - -// check-pass -// compile-flags: -Zast-json-noexpand -// normalize-stdout-test ":\d+" -> ":0" - -// Only include a single item to reduce how often the test output needs -// updating. -extern crate core; diff --git a/src/test/ui/ast-json/ast-json-noexpand-output.stdout b/src/test/ui/ast-json/ast-json-noexpand-output.stdout deleted file mode 100644 index 6f6e9b38e94..00000000000 --- a/src/test/ui/ast-json/ast-json-noexpand-output.stdout +++ /dev/null @@ -1 +0,0 @@ -{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"crate_type","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":{"variant":"Eq","fields":[{"lo":0,"hi":0},{"variant":"Ast","fields":[{"id":0,"kind":{"variant":"Lit","fields":[{"token":{"kind":"Str","symbol":"lib","suffix":null},"kind":{"variant":"Str","fields":["lib","Cooked"]},"span":{"lo":0,"hi":0}}]},"span":{"lo":0,"hi":0},"attrs":{"0":null},"tokens":{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}}]}]},"tokens":null},{"0":[[{"variant":"Token","fields":[{"kind":"Pound","span":{"lo":0,"hi":0}}]},"Joint"],[{"variant":"Token","fields":[{"kind":"Not","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Delimited","fields":[{"open":{"lo":0,"hi":0},"close":{"lo":0,"hi":0}},"Bracket",{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Ident","fields":["crate_type",false]},"span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":"Eq","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}]},"Alone"]]}]},"id":null,"style":"Inner","span":{"lo":0,"hi":0}}],"items":[{"attrs":[],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"core","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":null}],"spans":{"inner_span":{"lo":0,"hi":0},"inject_use_span":{"lo":0,"hi":0}},"id":0,"is_placeholder":false} diff --git a/src/test/ui/ast-json/ast-json-output.rs b/src/test/ui/ast-json/ast-json-output.rs deleted file mode 100644 index 2e009149ed6..00000000000 --- a/src/test/ui/ast-json/ast-json-output.rs +++ /dev/null @@ -1,10 +0,0 @@ -// Check that AST json printing works. -#![crate_type = "lib"] - -// check-pass -// compile-flags: -Zast-json -// normalize-stdout-test ":\d+" -> ":0" - -// Only include a single item to reduce how often the test output needs -// updating. -extern crate core; diff --git a/src/test/ui/ast-json/ast-json-output.stdout b/src/test/ui/ast-json/ast-json-output.stdout deleted file mode 100644 index 5637ce596b3..00000000000 --- a/src/test/ui/ast-json/ast-json-output.stdout +++ /dev/null @@ -1 +0,0 @@ -{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"crate_type","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":{"variant":"Eq","fields":[{"lo":0,"hi":0},{"variant":"Ast","fields":[{"id":0,"kind":{"variant":"Lit","fields":[{"token":{"kind":"Str","symbol":"lib","suffix":null},"kind":{"variant":"Str","fields":["lib","Cooked"]},"span":{"lo":0,"hi":0}}]},"span":{"lo":0,"hi":0},"attrs":{"0":null},"tokens":{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}}]}]},"tokens":null},{"0":[[{"variant":"Token","fields":[{"kind":"Pound","span":{"lo":0,"hi":0}}]},"Joint"],[{"variant":"Token","fields":[{"kind":"Not","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Delimited","fields":[{"open":{"lo":0,"hi":0},"close":{"lo":0,"hi":0}},"Bracket",{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Ident","fields":["crate_type",false]},"span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":"Eq","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}]},"Alone"]]}]},"id":null,"style":"Inner","span":{"lo":0,"hi":0}}],"items":[{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"prelude_import","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":"Empty","tokens":null},null]},"id":null,"style":"Outer","span":{"lo":0,"hi":0}}],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"","span":{"lo":0,"hi":0}},"kind":{"variant":"Use","fields":[{"prefix":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"{{root}}","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"std","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"prelude","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"rust_2015","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"kind":"Glob","span":{"lo":0,"hi":0}}]},"tokens":null},{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"macro_use","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":"Empty","tokens":null},null]},"id":null,"style":"Outer","span":{"lo":0,"hi":0}}],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"std","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":null},{"attrs":[],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"core","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":null}],"spans":{"inner_span":{"lo":0,"hi":0},"inject_use_span":{"lo":0,"hi":0}},"id":0,"is_placeholder":false}