diff --git a/Cargo.lock b/Cargo.lock index 084d594ff6c21..d21a126cf3fd6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4304,8 +4304,7 @@ version = "0.0.0" dependencies = [ "expect-test", "memchr", - "unicode-ident", - "unicode-properties", + "rustc_unicode", ] [[package]] @@ -4336,10 +4335,10 @@ dependencies = [ "rustc_symbol_mangling", "rustc_target", "rustc_trait_selection", + "rustc_unicode", "smallvec", "thin-vec", "tracing", - "unicode-security", ] [[package]] @@ -4589,11 +4588,9 @@ dependencies = [ "rustc_macros", "rustc_session", "rustc_span", + "rustc_unicode", "thin-vec", "tracing", - "unicode-normalization", - "unicode-properties", - "unicode-width 0.2.3", ] [[package]] @@ -4827,11 +4824,11 @@ dependencies = [ "rustc_lexer", "rustc_macros", "rustc_serialize", + "rustc_unicode", "scoped-tls", "sha1", "sha2", "tracing", - "unicode-width 0.2.3", ] [[package]] @@ -5029,6 +5026,18 @@ dependencies = [ "synstructure", ] +[[package]] +name = "rustc_unicode" +version = "0.0.0" +dependencies = [ + "unicode-ident", + "unicode-normalization", + "unicode-properties", + "unicode-script", + "unicode-security", + "unicode-width 0.2.3", +] + [[package]] name = "rustc_version" version = "0.4.1" diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index 8867d139396fc..96684a56505f9 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -3456,100 +3456,132 @@ pub enum AttrKind { /// means it can only be added to items that cannot later be observed by other macros. #[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum GeneratedAttr { + // tidy-alphabetical-start AutomaticallyDerived, - RustcConstUnstableDerived, - Inline, - DocHidden, CoverageOff, + DocHidden, + Inline, + PreludeImport, + RustcConstUnstableDerived, + RustcMain, RustcTestMarker(Symbol), RustcTrivialFieldReads, + // tidy-alphabetical-end } impl GeneratedAttr { pub fn descr(&self) -> String { match self { + // tidy-alphabetical-start GeneratedAttr::AutomaticallyDerived => "#[automatically_derived]".into(), + GeneratedAttr::CoverageOff => "#[coverage(off)]".into(), + GeneratedAttr::DocHidden => "#[doc(hidden)]".into(), + GeneratedAttr::Inline => "#[inline]".into(), + GeneratedAttr::PreludeImport => "#[prelude_import]".into(), GeneratedAttr::RustcConstUnstableDerived => { "#[rustc_const_unstable(feature = \"derive_const\", issue = \"143874\")]".into() } - GeneratedAttr::Inline => "#[inline]".into(), - GeneratedAttr::DocHidden => "#[doc(hidden)]".into(), - GeneratedAttr::CoverageOff => "#[coverage(off)]".into(), + GeneratedAttr::RustcMain => "#[rustc_main]".into(), GeneratedAttr::RustcTestMarker(test_path) => { format!("#[rustc_test_marker = \"{test_path}\"]") } GeneratedAttr::RustcTrivialFieldReads => "#[rustc_trivial_field_reads]".into(), + // tidy-alphabetical-end } } pub fn value_span(&self) -> Option { match self { + // tidy-alphabetical-start GeneratedAttr::AutomaticallyDerived => None, - GeneratedAttr::RustcConstUnstableDerived => None, - GeneratedAttr::Inline => None, - GeneratedAttr::DocHidden => None, GeneratedAttr::CoverageOff => None, + GeneratedAttr::DocHidden => None, + GeneratedAttr::Inline => None, + GeneratedAttr::PreludeImport => None, + GeneratedAttr::RustcConstUnstableDerived => None, + GeneratedAttr::RustcMain => None, GeneratedAttr::RustcTestMarker(_) => None, GeneratedAttr::RustcTrivialFieldReads => None, + // tidy-alphabetical-end } } pub fn is_doc_comment(&self) -> bool { match self { + // tidy-alphabetical-start GeneratedAttr::AutomaticallyDerived => false, - GeneratedAttr::RustcConstUnstableDerived => false, - GeneratedAttr::Inline => false, - GeneratedAttr::DocHidden => false, GeneratedAttr::CoverageOff => false, + GeneratedAttr::DocHidden => false, + GeneratedAttr::Inline => false, + GeneratedAttr::PreludeImport => false, + GeneratedAttr::RustcConstUnstableDerived => false, + GeneratedAttr::RustcMain => false, GeneratedAttr::RustcTestMarker(_) => false, GeneratedAttr::RustcTrivialFieldReads => false, + // tidy-alphabetical-end } } pub fn path(&self) -> &[Symbol] { match self { + // tidy-alphabetical-start GeneratedAttr::AutomaticallyDerived => &[sym::automatically_derived], - GeneratedAttr::RustcConstUnstableDerived => &[sym::rustc_const_unstable], - GeneratedAttr::Inline => &[sym::inline], - GeneratedAttr::DocHidden => &[sym::doc], GeneratedAttr::CoverageOff => &[sym::coverage], + GeneratedAttr::DocHidden => &[sym::doc], + GeneratedAttr::Inline => &[sym::inline], + GeneratedAttr::PreludeImport => &[sym::prelude_import], + GeneratedAttr::RustcConstUnstableDerived => &[sym::rustc_const_unstable], + GeneratedAttr::RustcMain => &[sym::rustc_main], GeneratedAttr::RustcTestMarker(_) => &[sym::rustc_test_marker], GeneratedAttr::RustcTrivialFieldReads => &[sym::rustc_trivial_field_reads], + // tidy-alphabetical-end } } pub fn path_span(&self) -> Option { match self { + // tidy-alphabetical-start GeneratedAttr::AutomaticallyDerived => None, - GeneratedAttr::RustcConstUnstableDerived => None, - GeneratedAttr::Inline => None, - GeneratedAttr::DocHidden => None, GeneratedAttr::CoverageOff => None, + GeneratedAttr::DocHidden => None, + GeneratedAttr::Inline => None, + GeneratedAttr::PreludeImport => None, + GeneratedAttr::RustcConstUnstableDerived => None, + GeneratedAttr::RustcMain => None, GeneratedAttr::RustcTestMarker(_) => None, GeneratedAttr::RustcTrivialFieldReads => None, + // tidy-alphabetical-end } } pub fn value_str(&self) -> Option { match self { + // tidy-alphabetical-start GeneratedAttr::AutomaticallyDerived => None, - GeneratedAttr::RustcConstUnstableDerived => None, - GeneratedAttr::Inline => None, - GeneratedAttr::DocHidden => None, GeneratedAttr::CoverageOff => None, + GeneratedAttr::DocHidden => None, + GeneratedAttr::Inline => None, + GeneratedAttr::PreludeImport => None, + GeneratedAttr::RustcConstUnstableDerived => None, + GeneratedAttr::RustcMain => None, GeneratedAttr::RustcTestMarker(test_path) => Some(*test_path), GeneratedAttr::RustcTrivialFieldReads => None, + // tidy-alphabetical-end } } pub fn doc_str_and_fragment_kind(&self) -> Option { match self { + // tidy-alphabetical-start GeneratedAttr::AutomaticallyDerived => None, - GeneratedAttr::RustcConstUnstableDerived => None, - GeneratedAttr::Inline => None, - GeneratedAttr::DocHidden => None, GeneratedAttr::CoverageOff => None, + GeneratedAttr::DocHidden => None, + GeneratedAttr::Inline => None, + GeneratedAttr::PreludeImport => None, + GeneratedAttr::RustcConstUnstableDerived => None, + GeneratedAttr::RustcMain => None, GeneratedAttr::RustcTestMarker(_) => None, GeneratedAttr::RustcTrivialFieldReads => None, + // tidy-alphabetical-end } } diff --git a/compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs b/compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs index a949015dde5c2..ad036451f5e1b 100644 --- a/compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs +++ b/compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs @@ -132,7 +132,6 @@ pub(crate) struct AllowInternalUnsafeParser; impl NoArgsAttributeParser for AllowInternalUnsafeParser { const PATH: &[Symbol] = &[sym::allow_internal_unsafe]; - const ON_DUPLICATE: OnDuplicate = OnDuplicate::Ignore; const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[Allow(Target::Fn), Allow(Target::MacroDef)]); const STABILITY: AttributeStability = unstable!(allow_internal_unsafe); diff --git a/compiler/rustc_attr_parsing/src/attributes/stability.rs b/compiler/rustc_attr_parsing/src/attributes/stability.rs index f14934ab76547..70b549459ebc1 100644 --- a/compiler/rustc_attr_parsing/src/attributes/stability.rs +++ b/compiler/rustc_attr_parsing/src/attributes/stability.rs @@ -208,7 +208,6 @@ impl AttributeParser for BodyStabilityParser { pub(crate) struct RustcConstStableIndirectParser; impl NoArgsAttributeParser for RustcConstStableIndirectParser { const PATH: &[Symbol] = &[sym::rustc_const_stable_indirect]; - const ON_DUPLICATE: OnDuplicate = OnDuplicate::Ignore; const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[ Allow(Target::Fn), Allow(Target::Method(MethodKind::Inherent)), diff --git a/compiler/rustc_attr_parsing/src/generated.rs b/compiler/rustc_attr_parsing/src/generated.rs index 8e8fe81878fc0..45874c21b0a1c 100644 --- a/compiler/rustc_attr_parsing/src/generated.rs +++ b/compiler/rustc_attr_parsing/src/generated.rs @@ -18,7 +18,16 @@ pub(crate) struct GeneratedAttrState { impl GeneratedAttrState { pub(crate) fn accept_generated_attr(&mut self, span: Span, generated: &GeneratedAttr) { let attr = match *generated { + // tidy-alphabetical-start GeneratedAttr::AutomaticallyDerived => AttributeKind::AutomaticallyDerived, + GeneratedAttr::CoverageOff => AttributeKind::Coverage(CoverageAttrKind::Off), + GeneratedAttr::DocHidden => AttributeKind::Doc(Box::new({ + let mut d = DocAttribute::default(); + d.hidden = Some(span); + d + })), + GeneratedAttr::Inline => AttributeKind::Inline(InlineAttr::Hint, span), + GeneratedAttr::PreludeImport => AttributeKind::PreludeImport, GeneratedAttr::RustcConstUnstableDerived => AttributeKind::RustcConstStability { stability: PartialConstStability { feature: sym::derive_const, @@ -32,17 +41,12 @@ impl GeneratedAttrState { }, span, }, - GeneratedAttr::Inline => AttributeKind::Inline(InlineAttr::Hint, span), - GeneratedAttr::DocHidden => AttributeKind::Doc(Box::new({ - let mut d = DocAttribute::default(); - d.hidden = Some(span); - d - })), - GeneratedAttr::CoverageOff => AttributeKind::Coverage(CoverageAttrKind::Off), + GeneratedAttr::RustcMain => AttributeKind::RustcMain, GeneratedAttr::RustcTestMarker(test_marker) => { AttributeKind::RustcTestMarker(test_marker) } GeneratedAttr::RustcTrivialFieldReads => AttributeKind::RustcTrivialFieldReads(span), + // tidy-alphabetical-end }; self.state.push(attr); } diff --git a/compiler/rustc_builtin_macros/src/standard_library_imports.rs b/compiler/rustc_builtin_macros/src/standard_library_imports.rs index ceada06a08010..c5f4854adadd3 100644 --- a/compiler/rustc_builtin_macros/src/standard_library_imports.rs +++ b/compiler/rustc_builtin_macros/src/standard_library_imports.rs @@ -1,4 +1,4 @@ -use rustc_ast::{self as ast, attr}; +use rustc_ast::{self as ast, GeneratedAttr, attr}; use rustc_expand::base::{ExtCtxt, ResolverExpand}; use rustc_expand::expand::ExpansionConfig; use rustc_feature::Features; @@ -65,7 +65,7 @@ pub fn inject( // Inject the relevant crate's prelude. let use_item = cx.item( span, - thin_vec![cx.attr_word(sym::prelude_import, span)], + thin_vec![cx.generated_attr(span, GeneratedAttr::PreludeImport)], ast::ItemKind::Use(ast::UseTree { prefix: cx.path(span, &import_path), kind: ast::UseTreeKind::Glob(span), diff --git a/compiler/rustc_builtin_macros/src/test_harness.rs b/compiler/rustc_builtin_macros/src/test_harness.rs index 30a23f7b8c9fa..5e61b748b7d5a 100644 --- a/compiler/rustc_builtin_macros/src/test_harness.rs +++ b/compiler/rustc_builtin_macros/src/test_harness.rs @@ -315,7 +315,7 @@ fn add_main(cx: &mut TestCtxt<'_>, c: &mut ast::Crate) { ecx.item(sp, ast::AttrVec::new(), ast::ItemKind::ExternCrate(None, test_ident)); // #[rustc_main] - let main_attr = ecx.attr_word(sym::rustc_main, sp); + let main_attr = ecx.generated_attr(sp, GeneratedAttr::RustcMain); // #[coverage(off)] let coverage_attr = ecx.generated_attr(sp, GeneratedAttr::CoverageOff); // #[doc(hidden)] diff --git a/compiler/rustc_codegen_cranelift/scripts/filter_profile.rs b/compiler/rustc_codegen_cranelift/scripts/filter_profile.rs index 4595063c032dc..cbc721757bf39 100755 --- a/compiler/rustc_codegen_cranelift/scripts/filter_profile.rs +++ b/compiler/rustc_codegen_cranelift/scripts/filter_profile.rs @@ -48,7 +48,7 @@ fn main() -> Result<(), Box> { // Trim start if let Some(index) = stack.find("rustc_interface::passes::configure_and_expand") { stack = &stack[index..]; - } else if let Some(index) = stack.find("rustc_interface::passes::analysis") { + } else if let Some(index) = stack.find("rustc_interface::passes::full_analysis") { stack = &stack[index..]; } else if let Some(index) = stack.find("rustc_interface::passes::start_codegen") { stack = &stack[index..]; diff --git a/compiler/rustc_codegen_cranelift/src/driver/aot.rs b/compiler/rustc_codegen_cranelift/src/driver/aot.rs index 6fde623d46f73..5b5039ba5adf5 100644 --- a/compiler/rustc_codegen_cranelift/src/driver/aot.rs +++ b/compiler/rustc_codegen_cranelift/src/driver/aot.rs @@ -22,7 +22,8 @@ use rustc_errors::{DiagCtxt, DiagCtxtHandle}; use rustc_middle::dep_graph::WorkProduct; use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags; use rustc_middle::mono::{MonoItem, MonoItemData, Visibility}; -use rustc_session::config::{OutputFilenames, OutputType}; +use rustc_session::config::OutputFilenames; +use rustc_session::output::OutputType; use rustc_session::{BorrowedIncrCompSession, Session}; use rustc_span::Symbol; diff --git a/compiler/rustc_codegen_cranelift/src/pretty_clif.rs b/compiler/rustc_codegen_cranelift/src/pretty_clif.rs index fee3562c7bede..e3e80532a67f3 100644 --- a/compiler/rustc_codegen_cranelift/src/pretty_clif.rs +++ b/compiler/rustc_codegen_cranelift/src/pretty_clif.rs @@ -65,7 +65,8 @@ use cranelift_codegen::isa::TargetIsa; use cranelift_codegen::write::{FuncWriter, PlainWriter}; use rustc_middle::ty::print::with_no_trimmed_paths; use rustc_session::Session; -use rustc_session::config::{OutputFilenames, OutputType}; +use rustc_session::config::OutputFilenames; +use rustc_session::output::OutputType; use rustc_target::callconv::FnAbi; use crate::prelude::*; @@ -282,7 +283,7 @@ pub(crate) fn write_ir_file( if let Err(err) = res { // Using early_warn as no Session is available here let handler = - rustc_session::EarlyDiagCtxt::new(rustc_session::config::ErrorOutputType::default()); + rustc_session::EarlyDiagCtxt::new(rustc_session::output::ErrorOutputType::default()); handler.early_warn(format!("error writing ir file: {}", err)); } } diff --git a/compiler/rustc_codegen_gcc/src/back/write.rs b/compiler/rustc_codegen_gcc/src/back/write.rs index dcb4bcde38b60..1bdfeb58a4d16 100644 --- a/compiler/rustc_codegen_gcc/src/back/write.rs +++ b/compiler/rustc_codegen_gcc/src/back/write.rs @@ -8,7 +8,7 @@ use rustc_data_structures::profiling::SelfProfilerRef; use rustc_errors::DiagCtxtHandle; use rustc_fs_util::link_or_copy; use rustc_log::tracing::debug; -use rustc_session::config::OutputType; +use rustc_session::output::OutputType; use rustc_target::spec::SplitDebuginfo; use crate::diagnostics::CopyBitcode; diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs index c41b95a02b597..c64aca4ac90a4 100644 --- a/compiler/rustc_codegen_llvm/src/back/write.rs +++ b/compiler/rustc_codegen_llvm/src/back/write.rs @@ -19,7 +19,8 @@ use rustc_errors::{DiagCtxt, DiagCtxtHandle, Level}; use rustc_fs_util::{link_or_copy, path_to_c_string}; use rustc_middle::ty::TyCtxt; use rustc_session::Session; -use rustc_session::config::{self, Lto, OutputType, Passes, SplitDwarfKind, SwitchWithOptPath}; +use rustc_session::config::{self, Lto, Passes, SplitDwarfKind, SwitchWithOptPath}; +use rustc_session::output::OutputType; use rustc_span::{BytePos, DUMMY_SP, InnerSpan, Pos, RemapPathScopeComponents}; use rustc_target::spec::{CodeModel, FloatAbi, RelocModel, SanitizerSet, SplitDebuginfo, TlsModel}; use tracing::{debug, trace}; diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index d4003a581c1f5..94c97e7740c06 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -33,9 +33,11 @@ use rustc_middle::middle::dependency_format::Linkage; use rustc_middle::middle::exported_symbols::SymbolExportKind; use rustc_session::config::{ self, CFGuard, DebugInfo, InstrumentMcount, JobsMode, LinkerFeaturesCli, LinkerJobs, - OutFileName, OutputFilenames, OutputType, PrintKind, SplitDwarfKind, Strip, + OutFileName, OutputFilenames, PrintKind, SplitDwarfKind, Strip, +}; +use rustc_session::output::{ + OutputType, check_file_is_writeable, invalid_output_for_target, out_filename, }; -use rustc_session::output::{check_file_is_writeable, invalid_output_for_target, out_filename}; use rustc_session::search_paths::PathKind; /// For all the linkers we support, and information they might /// need out of the shared crate context before we get rid of it. diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index 24fcab7218f7e..8d8f04f7b3b33 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -23,9 +23,10 @@ use rustc_metadata::fs::copy_to_stdout; use rustc_middle::dep_graph::{WorkProduct, WorkProductMap}; use rustc_middle::ty::TyCtxt; use rustc_session::config::{ - self, JobsMode, Lto, OptimizationObjective, OutFileName, OutputFilenames, OutputType, Passes, + self, JobsMode, Lto, OptimizationObjective, OutFileName, OutputFilenames, Passes, SwitchWithOptPath, }; +use rustc_session::output::OutputType; use rustc_session::{BorrowedIncrCompSession, IncrCompSession, Session}; use rustc_span::source_map::SourceMap; use rustc_span::{BytePos, FileName, InnerSpan, Span, SyntaxContext, bug}; diff --git a/compiler/rustc_codegen_ssa/src/lib.rs b/compiler/rustc_codegen_ssa/src/lib.rs index d19b80897a21d..27b2cc888a254 100644 --- a/compiler/rustc_codegen_ssa/src/lib.rs +++ b/compiler/rustc_codegen_ssa/src/lib.rs @@ -37,7 +37,8 @@ use rustc_middle::util::Providers; use rustc_serialize::opaque::{FileEncoder, MemDecoder}; use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; use rustc_session::Session; -use rustc_session::config::{OutputFilenames, OutputType}; +use rustc_session::config::OutputFilenames; +use rustc_session::output::OutputType; use rustc_span::{Span, Symbol}; use rustc_structures::{CrateType, NativeLibKind}; diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index 93f84d6cf9635..d53c3de10e923 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -51,11 +51,11 @@ use rustc_middle::ty::TyCtxt; use rustc_parse::lexer::StripTokens; use rustc_parse::{new_parser_from_file, new_parser_from_source_str, unwrap_or_emit_fatal}; use rustc_session::config::{ - CG_OPTIONS, ErrorOutputType, Input, OptionDesc, OutFileName, OutputType, Sysroot, - UnstableOptions, Z_OPTIONS, nightly_options, parse_target_triple, + CG_OPTIONS, Input, OptionDesc, OutFileName, Sysroot, UnstableOptions, Z_OPTIONS, + nightly_options, parse_target_triple, }; use rustc_session::getopts::{self, Matches}; -use rustc_session::output::invalid_output_for_target; +use rustc_session::output::{ErrorOutputType, OutputType, invalid_output_for_target}; use rustc_session::{EarlyDiagCtxt, Session, config}; use rustc_span::def_id::LOCAL_CRATE; use rustc_span::{DUMMY_SP, FileName}; @@ -323,7 +323,7 @@ pub fn compiler_entrypoint(at_args: &[String], callbacks: &mut (dyn Callbacks + return None; } - tcx.ensure_ok().analysis(()); + rustc_interface::passes::full_analysis(tcx); if callbacks.after_analysis(compiler, tcx) == Compilation::Stop { return None; diff --git a/compiler/rustc_driver_impl/src/pretty.rs b/compiler/rustc_driver_impl/src/pretty.rs index 952a9041df87e..01dc2f9d8451f 100644 --- a/compiler/rustc_driver_impl/src/pretty.rs +++ b/compiler/rustc_driver_impl/src/pretty.rs @@ -15,7 +15,8 @@ use rustc_middle::ty::{self, TyCtxt}; use rustc_mir_build::thir::print::{thir_flat, thir_tree}; use rustc_public::rustc_internal::pretty::write_smir_pretty; use rustc_session::Session; -use rustc_session::config::{OutFileName, OutputType, PpHirMode, PpMode, PpSourceMode}; +use rustc_session::config::{OutFileName, PpHirMode, PpMode, PpSourceMode}; +use rustc_session::output::OutputType; use rustc_span::{FileName, Ident, bug}; use tracing::debug; @@ -231,7 +232,7 @@ impl<'tcx> PrintExtra<'tcx> { pub fn print<'tcx>(sess: &Session, ppm: PpMode, ex: PrintExtra<'tcx>) { if ppm.needs_analysis() { - ex.tcx().ensure_ok().analysis(()); + rustc_interface::passes::full_analysis(ex.tcx()); } let (src, src_name) = get_source(sess); diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index e8041796a6195..1c9e76e4af18a 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -5,7 +5,7 @@ //! There are various `Emitter` implementations that generate different output formats such as //! JSON and human readable output. //! -//! The output types are defined in `rustc_session::config::ErrorOutputType`. +//! The output types are defined in `rustc_session::output::ErrorOutputType`. use std::borrow::Cow; use std::io::prelude::*; diff --git a/compiler/rustc_incremental/src/persist/fs.rs b/compiler/rustc_incremental/src/persist/fs.rs index 038bddaa021d2..e139ef72e433d 100644 --- a/compiler/rustc_incremental/src/persist/fs.rs +++ b/compiler/rustc_incremental/src/persist/fs.rs @@ -108,7 +108,7 @@ use rustc_data_structures::unord::{UnordMap, UnordSet}; use rustc_data_structures::{base_n, flock}; use rustc_fs_util::try_canonicalize; use rustc_middle::dep_graph::WorkProduct; -use rustc_session::config::OutputType; +use rustc_session::output::OutputType; use rustc_session::{IncrCompSession, Session, StableCrateId}; use rustc_span::{Symbol, bug}; use tracing::debug; diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index 7b881f99fb8d7..1fc1df52885b5 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -36,9 +36,9 @@ use rustc_parse::lexer::StripTokens; use rustc_parse::{new_parser_from_file, new_parser_from_source_str, unwrap_or_emit_fatal}; use rustc_passes::{abi_test, input_stats, layout_test}; use rustc_resolve::{Resolver, ResolverOutputs}; -use rustc_session::config::{Input, Offload, OutFileName, OutputFilenames, OutputType}; +use rustc_session::config::{Input, Offload, OutFileName, OutputFilenames}; use rustc_session::diagnostics::feature_err; -use rustc_session::output::{filename_for_input, invalid_output_for_target}; +use rustc_session::output::{OutputType, filename_for_input, invalid_output_for_target}; use rustc_session::search_paths::PathKind; use rustc_session::{IncrCompSession, Session}; use rustc_span::{ @@ -919,7 +919,7 @@ pub fn finish_and_emit_metadata<'tcx>(tcx: TyCtxt<'tcx>) -> EncodedMetadata { pub static DEFAULT_QUERY_PROVIDERS: LazyLock = LazyLock::new(|| { let providers = &mut Providers::default(); - providers.queries.analysis = analysis; + providers.queries.required_analysis = run_required_analyses; providers.queries.resolver_for_lowering_raw = resolver_for_lowering_raw; providers.queries.stripped_cfg_items = |tcx, _| &tcx.resolutions(()).stripped_cfg_items[..]; providers.queries.get_lang_items = |tcx, ()| &tcx.resolutions(()).lang_items; @@ -1125,7 +1125,7 @@ pub fn emit_delayed_lints(tcx: TyCtxt<'_>) { /// Runs all analyses that we guarantee to run, even if errors were reported in earlier analyses. /// This function never fails. -fn run_required_analyses(tcx: TyCtxt<'_>) { +fn run_required_analyses(tcx: TyCtxt<'_>, (): ()) { if tcx.sess.opts.unstable_opts.input_stats { rustc_passes::input_stats::print_hir_stats(tcx); } @@ -1227,8 +1227,8 @@ fn run_required_analyses(tcx: TyCtxt<'_>) { /// Runs the type-checking, region checking and other miscellaneous analysis /// passes on the crate. -fn analysis(tcx: TyCtxt<'_>, (): ()) { - run_required_analyses(tcx); +pub fn full_analysis(tcx: TyCtxt<'_>) { + tcx.ensure_ok().required_analysis(()); let sess = tcx.sess; diff --git a/compiler/rustc_interface/src/queries.rs b/compiler/rustc_interface/src/queries.rs index 89e22b1c0c3b6..5559075d4e732 100644 --- a/compiler/rustc_interface/src/queries.rs +++ b/compiler/rustc_interface/src/queries.rs @@ -9,7 +9,8 @@ use rustc_hir::def_id::LOCAL_CRATE; use rustc_metadata::EncodedMetadata; use rustc_middle::dep_graph::{DepGraph, WorkProduct, WorkProductMap}; use rustc_middle::ty::TyCtxt; -use rustc_session::config::{self, OutputFilenames, OutputType}; +use rustc_session::config::{self, OutputFilenames}; +use rustc_session::output::OutputType; use rustc_session::{IncrCompSession, Session}; use crate::diagnostics::FailedWritingFile; diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index e7f0fc6cd4c07..711e9dc28ee71 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -11,14 +11,15 @@ use rustc_errors::emitter::HumanReadableErrorType; use rustc_lint_defs::Level; use rustc_session::config::{ AnnotateMoves, AutoDiff, BranchProtection, CFGuard, Cfg, CodegenRetagOptions, CoverageLevel, - CoverageOptions, DebugInfo, DumpMonoStatsFormat, ErrorOutputType, ExternEntry, ExternLocation, - Externs, FmtDebug, FunctionReturn, IncrementalStateAssertion, InliningThreshold, Input, + CoverageOptions, DebugInfo, DumpMonoStatsFormat, ExternEntry, ExternLocation, Externs, + FmtDebug, FunctionReturn, IncrementalStateAssertion, InliningThreshold, Input, InstrumentCoverage, InstrumentMcount, InstrumentMcountOpts, InstrumentXRay, LinkSelfContained, LinkerPluginLto, LlvmTpde, LocationDetail, LtoCli, MirIncludeSpans, NextSolverConfig, Offload, - Options, OutFileName, OutputType, OutputTypes, PAuthKey, PacRet, Passes, - PatchableFunctionEntry, Polonius, ProcMacroExecutionStrategy, Strip, SwitchWithOptPath, - SymbolManglingVersion, WasiExecModel, build_session_options, rustc_optgroups, + Options, OutFileName, PAuthKey, PacRet, Passes, PatchableFunctionEntry, Polonius, + ProcMacroExecutionStrategy, Strip, SwitchWithOptPath, SymbolManglingVersion, WasiExecModel, + build_session_options, rustc_optgroups, }; +use rustc_session::output::{ErrorOutputType, OutputType, OutputTypes}; use rustc_session::search_paths::SearchPath; use rustc_session::utils::{CanonicalizedPath, NativeLib}; use rustc_session::{ diff --git a/compiler/rustc_interface/src/util.rs b/compiler/rustc_interface/src/util.rs index d1110ecf33cb7..004be0257d854 100644 --- a/compiler/rustc_interface/src/util.rs +++ b/compiler/rustc_interface/src/util.rs @@ -23,9 +23,9 @@ use rustc_middle::ty::{CurrentGcx, TyCtxt}; use rustc_query_impl::{CollectActiveJobsKind, collect_active_query_jobs}; pub use rustc_session::config::DEFAULT_STACK_SIZE; use rustc_session::config::{ - Cfg, Jobs, OptionsTargetModifiers, OutFileName, OutputFilenames, OutputTypes, Sysroot, - host_tuple, + Cfg, Jobs, OptionsTargetModifiers, OutFileName, OutputFilenames, Sysroot, host_tuple, }; +use rustc_session::output::OutputTypes; use rustc_session::{EarlyDiagCtxt, EarlySession, IncrCompSession, Session, filesearch}; use rustc_span::edition::Edition; use rustc_span::source_map::SourceMapInputs; diff --git a/compiler/rustc_lexer/Cargo.toml b/compiler/rustc_lexer/Cargo.toml index e16667ac5f63f..8ac812cb5db28 100644 --- a/compiler/rustc_lexer/Cargo.toml +++ b/compiler/rustc_lexer/Cargo.toml @@ -12,11 +12,12 @@ Rust lexer used by rustc. No stability guarantees are provided. # This will be used when publishing this crate as `rustc-ap-rustc_lexer`. [lib] -# Note that this crate purposefully does not depend on other rustc crates +# Note that this crate purposefully does not depend on other rustc crates other than `rustc-unicode` +# This is because all rustc dependencies of rust-analyzer must be added to +# . [dependencies] memchr = "2.7.6" -unicode-properties = { version = "0.1.4", default-features = false, features = ["emoji"] } -unicode-ident = "1.0.27" +rustc_unicode = { path = "../rustc_unicode" } [dev-dependencies] expect-test = "1.4.0" diff --git a/compiler/rustc_lexer/src/lib.rs b/compiler/rustc_lexer/src/lib.rs index 0aa57e75889fa..1ba476362b030 100644 --- a/compiler/rustc_lexer/src/lib.rs +++ b/compiler/rustc_lexer/src/lib.rs @@ -32,26 +32,9 @@ use std::str::Chars; use LiteralKind::*; use TokenKind::*; -pub use unicode_ident::UNICODE_VERSION; +use rustc_unicode::{unicode_ident, unicode_properties}; use unicode_properties::UnicodeEmoji; -// Make sure that the Unicode version of the dependencies is the same. -const _: () = { - let properties = unicode_properties::UNICODE_VERSION; - let ident = unicode_ident::UNICODE_VERSION; - - if properties.0 != ident.0 as u64 - || properties.1 != ident.1 as u64 - || properties.2 != ident.2 as u64 - { - panic!( - "unicode-properties and unicode-ident must use the same Unicode version, \ - `unicode_properties::UNICODE_VERSION` and `unicode_ident::UNICODE_VERSION` are \ - different." - ); - } -}; - /// Parsed token. /// It doesn't contain information about data that has been parsed, /// only the type of the token and its size. diff --git a/compiler/rustc_lint/Cargo.toml b/compiler/rustc_lint/Cargo.toml index 43417348f1d4b..418694fb58ca5 100644 --- a/compiler/rustc_lint/Cargo.toml +++ b/compiler/rustc_lint/Cargo.toml @@ -29,8 +29,8 @@ rustc_structures = { path = "../rustc_structures" } rustc_symbol_mangling = { path = "../rustc_symbol_mangling" } rustc_target = { path = "../rustc_target" } rustc_trait_selection = { path = "../rustc_trait_selection" } +rustc_unicode = { path = "../rustc_unicode" } smallvec = { version = "1.8.1", features = ["union", "may_dangle"] } thin-vec = "0.2.19" tracing = "0.1" -unicode-security = "0.1.0" # tidy-alphabetical-end diff --git a/compiler/rustc_lint/src/non_ascii_idents.rs b/compiler/rustc_lint/src/non_ascii_idents.rs index 588a9e1130f76..07680041dd6a0 100644 --- a/compiler/rustc_lint/src/non_ascii_idents.rs +++ b/compiler/rustc_lint/src/non_ascii_idents.rs @@ -3,6 +3,7 @@ use rustc_data_structures::fx::FxIndexMap; use rustc_data_structures::unord::UnordMap; use rustc_lint_defs::{declare_lint, declare_lint_pass}; use rustc_span::{OrdSpan, Symbol}; +use rustc_unicode::unicode_security; use unicode_security::general_security_profile::IdentifierType; use crate::diagnostics::{ diff --git a/compiler/rustc_metadata/src/fs.rs b/compiler/rustc_metadata/src/fs.rs index e653522950651..32e20e37d4c2f 100644 --- a/compiler/rustc_metadata/src/fs.rs +++ b/compiler/rustc_metadata/src/fs.rs @@ -5,8 +5,8 @@ use rustc_data_structures::temp_dir::MaybeTempDir; use rustc_fs_util::TempDirBuilder; use rustc_middle::ty::TyCtxt; use rustc_session::Session; -use rustc_session::config::{OutFileName, OutputType}; -use rustc_session::output::filename_for_metadata; +use rustc_session::config::OutFileName; +use rustc_session::output::{OutputType, filename_for_metadata}; use rustc_span::ErrorGuaranteed; use rustc_structures::CrateType; diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs index cd65f566ce198..dc6310227ebee 100644 --- a/compiler/rustc_metadata/src/rmeta/encoder.rs +++ b/compiler/rustc_metadata/src/rmeta/encoder.rs @@ -34,7 +34,8 @@ use rustc_middle::ty::fast_reject::{self, TreatParams}; use rustc_serialize::opaque::FileEncoder; use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; use rustc_session::config::mitigation_coverage::DeniedPartialMitigation; -use rustc_session::config::{OptLevel, OutputType, TargetModifier}; +use rustc_session::config::{OptLevel, TargetModifier}; +use rustc_session::output::OutputType; use rustc_span::def_id::CRATE_MOD_ID; use rustc_span::hygiene::{ HygieneEncodeContext, HygieneRemapper, HygieneRemappingResults, LocalExpnIdRemapper, diff --git a/compiler/rustc_middle/src/queries.rs b/compiler/rustc_middle/src/queries.rs index c91ec5eeedd25..4681789835244 100644 --- a/compiler/rustc_middle/src/queries.rs +++ b/compiler/rustc_middle/src/queries.rs @@ -403,10 +403,10 @@ rustc_queries! { } /// The root query triggering all analysis passes like typeck or borrowck. - query analysis(key: ()) { + query required_analysis(key: ()) { eval_always desc { - "running analysis passes on crate `{}`", + "running required analysis passes on crate `{}`", tcx.crate_name(LOCAL_CRATE), } } diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 738599b3ef5d4..cb26e7b14e0ff 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -1621,7 +1621,7 @@ impl<'tcx> TyCtxt<'tcx> { pub fn iter_local_def_id(self) -> impl Iterator { // Depend on the `analysis` query to ensure compilation if finished. - self.ensure_ok().analysis(()); + self.ensure_ok().required_analysis(()); let definitions = &self.untracked.definitions; gen { @@ -1642,7 +1642,7 @@ impl<'tcx> TyCtxt<'tcx> { pub fn definitions(self) -> &'tcx rustc_hir::definitions::Definitions { // Depend on the `analysis` query to ensure compilation if finished. - self.ensure_ok().analysis(()); + self.ensure_ok().required_analysis(()); // Freeze definitions once we start iterating on them, to prevent adding new ones // while iterating. If some query needs to add definitions, it should be `ensure`d above. diff --git a/compiler/rustc_parse/Cargo.toml b/compiler/rustc_parse/Cargo.toml index b54438384a215..84a79b542a6c3 100644 --- a/compiler/rustc_parse/Cargo.toml +++ b/compiler/rustc_parse/Cargo.toml @@ -18,11 +18,9 @@ rustc_lint_defs = { path = "../rustc_lint_defs" } rustc_macros = { path = "../rustc_macros" } rustc_session = { path = "../rustc_session" } rustc_span = { path = "../rustc_span" } +rustc_unicode = { path = "../rustc_unicode" } thin-vec = "0.2.21" tracing = "0.1" -unicode-normalization = "0.1.25" -unicode-properties = { version = "0.1.4", default-features = false, features = ["emoji"] } -unicode-width = "0.2.2" # tidy-alphabetical-end [dev-dependencies] diff --git a/compiler/rustc_parse/src/lexer/mod.rs b/compiler/rustc_parse/src/lexer/mod.rs index 13bda08fe8096..32c1071af617a 100644 --- a/compiler/rustc_parse/src/lexer/mod.rs +++ b/compiler/rustc_parse/src/lexer/mod.rs @@ -16,8 +16,8 @@ use rustc_literal_escaper::{EscapeError, Mode, check_for_errors}; use rustc_session::parse::ParseSess; use rustc_span::edition::Edition; use rustc_span::{BytePos, Pos, Span, Symbol, sym}; +use rustc_unicode::unicode_properties::emoji::UnicodeEmoji; use tracing::debug; -use unicode_properties::emoji::UnicodeEmoji; use crate::lexer::diagnostics::TokenTreeDiagInfo; use crate::lexer::unicode_chars::UNICODE_ARRAY; @@ -1301,7 +1301,7 @@ impl<'psess, 'src> Lexer<'psess, 'src> { } pub fn nfc_normalize(string: &str) -> Symbol { - use unicode_normalization::{IsNormalized, UnicodeNormalization, is_nfc_quick}; + use rustc_unicode::unicode_normalization::{IsNormalized, UnicodeNormalization, is_nfc_quick}; match is_nfc_quick(string.chars()) { IsNormalized::Yes => Symbol::intern(string), _ => { diff --git a/compiler/rustc_parse/src/lexer/unescape_error_reporting.rs b/compiler/rustc_parse/src/lexer/unescape_error_reporting.rs index f01caf8d9efed..c83f847f77195 100644 --- a/compiler/rustc_parse/src/lexer/unescape_error_reporting.rs +++ b/compiler/rustc_parse/src/lexer/unescape_error_reporting.rs @@ -6,6 +6,7 @@ use std::ops::Range; use rustc_errors::{Applicability, Diag, DiagCtxtHandle, ErrorGuaranteed}; use rustc_literal_escaper::{EscapeError, Mode}; use rustc_span::{BytePos, Span}; +use rustc_unicode::{unicode_normalization, unicode_width}; use tracing::debug; use crate::diagnostics::{ diff --git a/compiler/rustc_parse/src/lib.rs b/compiler/rustc_parse/src/lib.rs index 217e566057622..fcf4e0fc8a9f0 100644 --- a/compiler/rustc_parse/src/lib.rs +++ b/compiler/rustc_parse/src/lib.rs @@ -17,7 +17,6 @@ use rustc_ast::token; use rustc_ast::tokenstream::{DelimSpacing, DelimSpan, Spacing, TokenStream, TokenTree}; use rustc_ast_pretty::pprust; use rustc_errors::{Diag, FatalError, PResult, pluralize}; -pub use rustc_lexer::UNICODE_VERSION; use rustc_session::parse::ParseSess; use rustc_span::edit_distance::find_best_match_for_name; use rustc_span::source_map::SourceMap; @@ -35,44 +34,6 @@ pub mod lexer; mod diagnostics; -// Make sure that the Unicode version of the dependencies is the same. -const _: () = { - let rustc_lexer = rustc_lexer::UNICODE_VERSION; - let rustc_span = rustc_span::UNICODE_VERSION; - let normalization = unicode_normalization::UNICODE_VERSION; - let width = unicode_width::UNICODE_VERSION; - - if rustc_lexer.0 != rustc_span.0 - || rustc_lexer.1 != rustc_span.1 - || rustc_lexer.2 != rustc_span.2 - { - panic!( - "rustc_lexer and rustc_span must use the same Unicode version, \ - `rustc_lexer::UNICODE_VERSION` and `rustc_span::UNICODE_VERSION` are \ - different." - ); - } - - if rustc_lexer.0 != normalization.0 - || rustc_lexer.1 != normalization.1 - || rustc_lexer.2 != normalization.2 - { - panic!( - "rustc_lexer and unicode-normalization must use the same Unicode version, \ - `rustc_lexer::UNICODE_VERSION` and `unicode_normalization::UNICODE_VERSION` are \ - different." - ); - } - - if rustc_lexer.0 != width.0 || rustc_lexer.1 != width.1 || rustc_lexer.2 != width.2 { - panic!( - "rustc_lexer and unicode-width must use the same Unicode version, \ - `rustc_lexer::UNICODE_VERSION` and `unicode_width::UNICODE_VERSION` are \ - different." - ); - } -}; - // Unwrap the result if `Ok`, otherwise emit the diagnostics and abort. pub fn unwrap_or_emit_fatal(expr: Result>>) -> T { match expr { diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index 6b33279947115..3510c62d3651f 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -36,8 +36,8 @@ use rustc_middle::middle::resolve::{ }; use rustc_middle::middle::resolve_bound_vars::Set1; use rustc_middle::ty::{AssocTag, Visibility}; -use rustc_session::config::ResolveDocLinks; use rustc_session::diagnostics::feature_err; +use rustc_session::output::ResolveDocLinks; use rustc_span::{BytePos, DUMMY_SP, Ident, Span, Spanned, Symbol, bug, kw, respan, span_bug, sym}; use rustc_structures::CrateType; use smallvec::{SmallVec, smallvec}; diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 0975423ecf363..15e6b01bfcda7 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -1,9 +1,7 @@ //! Contains infrastructure for configuring the compiler, including parsing //! command-line options. -use std::collections::btree_map::{ - Iter as BTreeMapIter, Keys as BTreeMapKeysIter, Values as BTreeMapValuesIter, -}; +use std::collections::btree_map::Iter as BTreeMapIter; use std::collections::{BTreeMap, BTreeSet}; use std::ffi::OsStr; use std::hash::Hash; @@ -15,7 +13,7 @@ use std::{cmp, fs, iter, thread}; use externs::{ExternOpt, split_extern_opt}; use rustc_data_structures::fx::FxHashSet; -use rustc_data_structures::stable_hash::{StableHasher, StableOrd}; +use rustc_data_structures::stable_hash::StableHasher; use rustc_errors::emitter::HumanReadableErrorType; use rustc_errors::{ColorConfig, DiagCtxtFlags}; use rustc_feature::UnstableFeatures; @@ -43,6 +41,7 @@ pub use crate::config::print_request::{ use crate::diagnostics::FileWriteFail; use crate::macros::AllVariants; pub use crate::options::*; +use crate::output::{ErrorOutputType, OutputType, OutputTypes, ResolveDocLinks}; use crate::search_paths::SearchPath; use crate::utils::CanonicalizedPath; use crate::{EarlyDiagCtxt, Session, filesearch, lint}; @@ -692,298 +691,6 @@ impl FromStr for SplitDwarfKind { } } -macro_rules! define_output_types { - ( - $( - $(#[doc = $doc:expr])* - $Variant:ident => { - shorthand: $shorthand:expr, - extension: $extension:expr, - description: $description:expr, - default_filename: $default_filename:expr, - is_text: $is_text:expr, - compatible_with_cgus_and_single_output: $compatible:expr - } - ),* $(,)? - ) => { - #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, PartialOrd, Ord, StableHash)] - #[derive(Encodable, Decodable)] - pub enum OutputType { - $( - $(#[doc = $doc])* - $Variant, - )* - } - - impl StableOrd for OutputType { - const CAN_USE_UNSTABLE_SORT: bool = true; - - // Trivial C-Style enums have a stable sort order across compilation sessions. - const THIS_IMPLEMENTATION_HAS_BEEN_TRIPLE_CHECKED: () = (); - } - - impl OutputType { - pub fn iter_all() -> impl Iterator { - static ALL_VARIANTS: &[OutputType] = &[ - $( - OutputType::$Variant, - )* - ]; - ALL_VARIANTS.iter().copied() - } - - fn is_compatible_with_codegen_units_and_single_output_file(&self) -> bool { - match *self { - $( - OutputType::$Variant => $compatible, - )* - } - } - - pub fn shorthand(&self) -> &'static str { - match *self { - $( - OutputType::$Variant => $shorthand, - )* - } - } - - fn from_shorthand(shorthand: &str) -> Option { - match shorthand { - $( - s if s == $shorthand => Some(OutputType::$Variant), - )* - _ => None, - } - } - - fn shorthands_display() -> String { - let shorthands = vec![ - $( - format!("`{}`", $shorthand), - )* - ]; - shorthands.join(", ") - } - - pub fn extension(&self) -> &'static str { - match *self { - $( - OutputType::$Variant => $extension, - )* - } - } - - pub fn is_text_output(&self) -> bool { - match *self { - $( - OutputType::$Variant => $is_text, - )* - } - } - - pub fn description(&self) -> &'static str { - match *self { - $( - OutputType::$Variant => $description, - )* - } - } - - pub fn default_filename(&self) -> &'static str { - match *self { - $( - OutputType::$Variant => $default_filename, - )* - } - } - - - } - } -} - -define_output_types! { - Assembly => { - shorthand: "asm", - extension: "s", - description: "Generates a file with the crate's assembly code", - default_filename: "CRATE_NAME.s", - is_text: true, - compatible_with_cgus_and_single_output: false - }, - #[doc = "This is the optimized bitcode, which could be either pre-LTO or non-LTO bitcode,"] - #[doc = "depending on the specific request type."] - Bitcode => { - shorthand: "llvm-bc", - extension: "bc", - description: "Generates a binary file containing the LLVM bitcode", - default_filename: "CRATE_NAME.bc", - is_text: false, - compatible_with_cgus_and_single_output: false - }, - DepInfo => { - shorthand: "dep-info", - extension: "d", - description: "Generates a file with Makefile syntax that indicates all the source files that were loaded to generate the crate", - default_filename: "CRATE_NAME.d", - is_text: true, - compatible_with_cgus_and_single_output: true - }, - Exe => { - shorthand: "link", - extension: "", - description: "Generates the crates specified by --crate-type. This is the default if --emit is not specified", - default_filename: "(platform and crate-type dependent)", - is_text: false, - compatible_with_cgus_and_single_output: true - }, - LlvmAssembly => { - shorthand: "llvm-ir", - extension: "ll", - description: "Generates a file containing LLVM IR", - default_filename: "CRATE_NAME.ll", - is_text: true, - compatible_with_cgus_and_single_output: false - }, - Metadata => { - shorthand: "metadata", - extension: "rmeta", - description: "Generates a file containing metadata about the crate", - default_filename: "libCRATE_NAME.rmeta", - is_text: false, - compatible_with_cgus_and_single_output: true - }, - Mir => { - shorthand: "mir", - extension: "mir", - description: "Generates a file containing rustc's mid-level intermediate representation", - default_filename: "CRATE_NAME.mir", - is_text: true, - compatible_with_cgus_and_single_output: false - }, - Object => { - shorthand: "obj", - extension: "o", - description: "Generates a native object file", - default_filename: "CRATE_NAME.o", - is_text: false, - compatible_with_cgus_and_single_output: false - }, - #[doc = "This is the summary or index data part of the ThinLTO bitcode."] - ThinLinkBitcode => { - shorthand: "thin-link-bitcode", - extension: "indexing.o", - description: "Generates the ThinLTO summary as bitcode", - default_filename: "CRATE_NAME.indexing.o", - is_text: false, - compatible_with_cgus_and_single_output: false - }, -} - -/// The type of diagnostics output to generate. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)] -pub enum ErrorOutputType { - /// Output meant for the consumption of humans. - #[default] - HumanReadable { - kind: HumanReadableErrorType = HumanReadableErrorType { no_graphics: false, short: false, unicode: false }, - color_config: ColorConfig = ColorConfig::Auto, - }, - /// Output that's consumed by other tools such as `rustfix` or the `RLS`. - Json { - /// Render the JSON in a human readable way (with indents and newlines). - pretty: bool, - /// The JSON output includes a `rendered` field that includes the rendered - /// human output. - json_rendered: HumanReadableErrorType, - color_config: ColorConfig, - }, -} - -#[derive(Clone, Hash, Debug)] -pub enum ResolveDocLinks { - /// Do not resolve doc links. - None, - /// Resolve doc links on exported items only for crate types that have metadata. - ExportedMetadata, - /// Resolve doc links on exported items. - Exported, - /// Resolve doc links on all items. - All, -} - -/// Use tree-based collections to cheaply get a deterministic `Hash` implementation. -/// *Do not* switch `BTreeMap` out for an unsorted container type! That would break -/// dependency tracking for command-line arguments. Also only hash keys, since tracking -/// should only depend on the output types, not the paths they're written to. -#[derive(Clone, Debug, Hash, StableHash, Encodable, Decodable)] -pub struct OutputTypes(BTreeMap>); - -impl OutputTypes { - pub fn new(entries: &[(OutputType, Option)]) -> OutputTypes { - OutputTypes(BTreeMap::from_iter(entries.iter().map(|&(k, ref v)| (k, v.clone())))) - } - - pub(crate) fn get(&self, key: &OutputType) -> Option<&Option> { - self.0.get(key) - } - - pub fn contains_key(&self, key: &OutputType) -> bool { - self.0.contains_key(key) - } - - /// Returns `true` if user specified a name and not just produced type - pub fn contains_explicit_name(&self, key: &OutputType) -> bool { - matches!(self.0.get(key), Some(Some(..))) - } - - pub fn iter(&self) -> BTreeMapIter<'_, OutputType, Option> { - self.0.iter() - } - - pub fn keys(&self) -> BTreeMapKeysIter<'_, OutputType, Option> { - self.0.keys() - } - - pub fn values(&self) -> BTreeMapValuesIter<'_, OutputType, Option> { - self.0.values() - } - - pub fn len(&self) -> usize { - self.0.len() - } - - /// Returns `true` if any of the output types require codegen or linking. - pub fn should_codegen(&self) -> bool { - self.0.keys().any(|k| match *k { - OutputType::Bitcode - | OutputType::ThinLinkBitcode - | OutputType::Assembly - | OutputType::LlvmAssembly - | OutputType::Mir - | OutputType::Object - | OutputType::Exe => true, - OutputType::Metadata | OutputType::DepInfo => false, - }) - } - - /// Returns `true` if any of the output types require linking. - pub fn should_link(&self) -> bool { - self.0.keys().any(|k| match *k { - OutputType::Bitcode - | OutputType::ThinLinkBitcode - | OutputType::Assembly - | OutputType::LlvmAssembly - | OutputType::Mir - | OutputType::Metadata - | OutputType::Object - | OutputType::DepInfo => false, - OutputType::Exe => true, - }) - } -} - /// Use tree-based collections to cheaply get a deterministic `Hash` implementation. /// *Do not* switch `BTreeMap` or `BTreeSet` out for an unsorted container type! That /// would break dependency tracking for command-line arguments. diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 326323b727a04..b8a2269a3f8a8 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -22,6 +22,7 @@ use rustc_target::spec::{ }; use crate::config::*; +use crate::output::{ErrorOutputType, OutputTypes, ResolveDocLinks}; use crate::search_paths::SearchPath; use crate::utils::NativeLib; use crate::{EarlyDiagCtxt, Session, lint}; diff --git a/compiler/rustc_session/src/output.rs b/compiler/rustc_session/src/output.rs index 4824abae622c2..e24d5f3dd8724 100644 --- a/compiler/rustc_session/src/output.rs +++ b/compiler/rustc_session/src/output.rs @@ -1,12 +1,20 @@ //! Related to out filenames of compilation (e.g. binaries). +use std::collections::BTreeMap; +use std::collections::btree_map::{ + Iter as BTreeMapIter, Keys as BTreeMapKeysIter, Values as BTreeMapValuesIter, +}; use std::path::Path; +use rustc_data_structures::stable_hash::StableOrd; +use rustc_errors::ColorConfig; +use rustc_errors::emitter::HumanReadableErrorType; +use rustc_macros::{Decodable, Encodable, StableHash}; use rustc_span::{Span, Symbol}; use rustc_structures::CrateType; use crate::Session; -use crate::config::{OutFileName, OutputFilenames, OutputType}; +use crate::config::{OutFileName, OutputFilenames}; use crate::diagnostics::{ CrateNameEmpty, FileIsNotWriteable, InvalidCharacterInCrateName, InvalidCharacterInCrateNameSuggestion, @@ -158,3 +166,295 @@ pub fn invalid_output_for_target(sess: &Session, crate_type: CrateType) -> bool false } + +macro_rules! define_output_types { + ( + $( + $(#[doc = $doc:expr])* + $Variant:ident => { + shorthand: $shorthand:expr, + extension: $extension:expr, + description: $description:expr, + default_filename: $default_filename:expr, + is_text: $is_text:expr, + compatible_with_cgus_and_single_output: $compatible:expr + } + ),* $(,)? + ) => { + #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, PartialOrd, Ord, StableHash)] + #[derive(Encodable, Decodable)] + pub enum OutputType { + $( + $(#[doc = $doc])* + $Variant, + )* + } + + impl StableOrd for OutputType { + const CAN_USE_UNSTABLE_SORT: bool = true; + + // Trivial C-Style enums have a stable sort order across compilation sessions. + const THIS_IMPLEMENTATION_HAS_BEEN_TRIPLE_CHECKED: () = (); + } + + impl OutputType { + pub fn iter_all() -> impl Iterator { + static ALL_VARIANTS: &[OutputType] = &[ + $( + OutputType::$Variant, + )* + ]; + ALL_VARIANTS.iter().copied() + } + + pub(crate) fn is_compatible_with_codegen_units_and_single_output_file(&self) -> bool { + match *self { + $( + OutputType::$Variant => $compatible, + )* + } + } + + pub fn shorthand(&self) -> &'static str { + match *self { + $( + OutputType::$Variant => $shorthand, + )* + } + } + + pub(crate) fn from_shorthand(shorthand: &str) -> Option { + match shorthand { + $( + s if s == $shorthand => Some(OutputType::$Variant), + )* + _ => None, + } + } + + pub(crate) fn shorthands_display() -> String { + let shorthands = vec![ + $( + format!("`{}`", $shorthand), + )* + ]; + shorthands.join(", ") + } + + pub fn extension(&self) -> &'static str { + match *self { + $( + OutputType::$Variant => $extension, + )* + } + } + + pub fn is_text_output(&self) -> bool { + match *self { + $( + OutputType::$Variant => $is_text, + )* + } + } + + pub fn description(&self) -> &'static str { + match *self { + $( + OutputType::$Variant => $description, + )* + } + } + + pub fn default_filename(&self) -> &'static str { + match *self { + $( + OutputType::$Variant => $default_filename, + )* + } + } + + + } + } +} + +define_output_types! { + Assembly => { + shorthand: "asm", + extension: "s", + description: "Generates a file with the crate's assembly code", + default_filename: "CRATE_NAME.s", + is_text: true, + compatible_with_cgus_and_single_output: false + }, + #[doc = "This is the optimized bitcode, which could be either pre-LTO or non-LTO bitcode,"] + #[doc = "depending on the specific request type."] + Bitcode => { + shorthand: "llvm-bc", + extension: "bc", + description: "Generates a binary file containing the LLVM bitcode", + default_filename: "CRATE_NAME.bc", + is_text: false, + compatible_with_cgus_and_single_output: false + }, + DepInfo => { + shorthand: "dep-info", + extension: "d", + description: "Generates a file with Makefile syntax that indicates all the source files that were loaded to generate the crate", + default_filename: "CRATE_NAME.d", + is_text: true, + compatible_with_cgus_and_single_output: true + }, + Exe => { + shorthand: "link", + extension: "", + description: "Generates the crates specified by --crate-type. This is the default if --emit is not specified", + default_filename: "(platform and crate-type dependent)", + is_text: false, + compatible_with_cgus_and_single_output: true + }, + LlvmAssembly => { + shorthand: "llvm-ir", + extension: "ll", + description: "Generates a file containing LLVM IR", + default_filename: "CRATE_NAME.ll", + is_text: true, + compatible_with_cgus_and_single_output: false + }, + Metadata => { + shorthand: "metadata", + extension: "rmeta", + description: "Generates a file containing metadata about the crate", + default_filename: "libCRATE_NAME.rmeta", + is_text: false, + compatible_with_cgus_and_single_output: true + }, + Mir => { + shorthand: "mir", + extension: "mir", + description: "Generates a file containing rustc's mid-level intermediate representation", + default_filename: "CRATE_NAME.mir", + is_text: true, + compatible_with_cgus_and_single_output: false + }, + Object => { + shorthand: "obj", + extension: "o", + description: "Generates a native object file", + default_filename: "CRATE_NAME.o", + is_text: false, + compatible_with_cgus_and_single_output: false + }, + #[doc = "This is the summary or index data part of the ThinLTO bitcode."] + ThinLinkBitcode => { + shorthand: "thin-link-bitcode", + extension: "indexing.o", + description: "Generates the ThinLTO summary as bitcode", + default_filename: "CRATE_NAME.indexing.o", + is_text: false, + compatible_with_cgus_and_single_output: false + }, +} + +/// The type of diagnostics output to generate. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)] +pub enum ErrorOutputType { + /// Output meant for the consumption of humans. + #[default] + HumanReadable { + kind: HumanReadableErrorType = HumanReadableErrorType { no_graphics: false, short: false, unicode: false }, + color_config: ColorConfig = ColorConfig::Auto, + }, + /// Output that's consumed by other tools such as `rustfix` or the `RLS`. + Json { + /// Render the JSON in a human readable way (with indents and newlines). + pretty: bool, + /// The JSON output includes a `rendered` field that includes the rendered + /// human output. + json_rendered: HumanReadableErrorType, + color_config: ColorConfig, + }, +} + +#[derive(Clone, Hash, Debug)] +pub enum ResolveDocLinks { + /// Do not resolve doc links. + None, + /// Resolve doc links on exported items only for crate types that have metadata. + ExportedMetadata, + /// Resolve doc links on exported items. + Exported, + /// Resolve doc links on all items. + All, +} + +/// Use tree-based collections to cheaply get a deterministic `Hash` implementation. +/// *Do not* switch `BTreeMap` out for an unsorted container type! That would break +/// dependency tracking for command-line arguments. Also only hash keys, since tracking +/// should only depend on the output types, not the paths they're written to. +#[derive(Clone, Debug, Hash, StableHash, Encodable, Decodable)] +pub struct OutputTypes(pub(crate) BTreeMap>); + +impl OutputTypes { + pub fn new(entries: &[(OutputType, Option)]) -> OutputTypes { + OutputTypes(BTreeMap::from_iter(entries.iter().map(|&(k, ref v)| (k, v.clone())))) + } + + pub(crate) fn get(&self, key: &OutputType) -> Option<&Option> { + self.0.get(key) + } + + pub fn contains_key(&self, key: &OutputType) -> bool { + self.0.contains_key(key) + } + + /// Returns `true` if user specified a name and not just produced type + pub fn contains_explicit_name(&self, key: &OutputType) -> bool { + matches!(self.0.get(key), Some(Some(..))) + } + + pub fn iter(&self) -> BTreeMapIter<'_, OutputType, Option> { + self.0.iter() + } + + pub fn keys(&self) -> BTreeMapKeysIter<'_, OutputType, Option> { + self.0.keys() + } + + pub fn values(&self) -> BTreeMapValuesIter<'_, OutputType, Option> { + self.0.values() + } + + pub fn len(&self) -> usize { + self.0.len() + } + + /// Returns `true` if any of the output types require codegen or linking. + pub fn should_codegen(&self) -> bool { + self.0.keys().any(|k| match *k { + OutputType::Bitcode + | OutputType::ThinLinkBitcode + | OutputType::Assembly + | OutputType::LlvmAssembly + | OutputType::Mir + | OutputType::Object + | OutputType::Exe => true, + OutputType::Metadata | OutputType::DepInfo => false, + }) + } + + /// Returns `true` if any of the output types require linking. + pub fn should_link(&self) -> bool { + self.0.keys().any(|k| match *k { + OutputType::Bitcode + | OutputType::ThinLinkBitcode + | OutputType::Assembly + | OutputType::LlvmAssembly + | OutputType::Mir + | OutputType::Metadata + | OutputType::Object + | OutputType::DepInfo => false, + OutputType::Exe => true, + }) + } +} diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 6b7e2214f26d9..195a370707497 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -38,11 +38,12 @@ use crate::code_stats::CodeStats; pub use crate::code_stats::{DataTypeKind, FieldInfo, FieldKind, SizeKind, VariantInfo}; use crate::config::{ self, BranchProtection, Cfg, CheckCfg, CoverageLevel, CoverageOptions, DebugInfo, - ErrorOutputType, FunctionReturn, Input, InstrumentCoverage, InstrumentMcount, LtoCli, - NATIVE_CPU, OutFileName, OutputType, PAuthKey, PointerAuthOption, SwitchWithOptPath, + FunctionReturn, Input, InstrumentCoverage, InstrumentMcount, LtoCli, NATIVE_CPU, OutFileName, + PAuthKey, PointerAuthOption, SwitchWithOptPath, }; use crate::filesearch::FileSearch; use crate::lint::LintId; +use crate::output::{ErrorOutputType, OutputType}; use crate::parse::ParseSess; use crate::search_paths::SearchPath; use crate::{diagnostics, filesearch, lint}; @@ -1310,7 +1311,7 @@ fn default_emitter(sopts: &config::Options, source_map: Arc) -> Box match kind { + ErrorOutputType::HumanReadable { kind, color_config } => match kind { HumanReadableErrorType { no_graphics, short, unicode } => { let emitter = AnnotateSnippetEmitter::new(stderr_destination(color_config)) .sm(source_map) @@ -1327,7 +1328,7 @@ fn default_emitter(sopts: &config::Options, source_map: Arc) -> Box Box::new( + ErrorOutputType::Json { pretty, json_rendered, color_config } => Box::new( JsonEmitter::new( Box::new(io::BufWriter::new(io::stderr())), source_map, @@ -1971,7 +1972,7 @@ impl EarlyDiagCtxt { fn mk_emitter(output: ErrorOutputType) -> Box { let emitter: Box = match output { - config::ErrorOutputType::HumanReadable { kind, color_config } => match kind { + ErrorOutputType::HumanReadable { kind, color_config } => match kind { HumanReadableErrorType { no_graphics, short, unicode } => Box::new( AnnotateSnippetEmitter::new(stderr_destination(color_config)) .theme(if unicode { OutputTheme::Unicode } else { OutputTheme::Ascii }) @@ -1979,7 +1980,7 @@ fn mk_emitter(output: ErrorOutputType) -> Box { .no_graphics(no_graphics), ), }, - config::ErrorOutputType::Json { pretty, json_rendered, color_config } => { + ErrorOutputType::Json { pretty, json_rendered, color_config } => { Box::new(JsonEmitter::new( Box::new(io::BufWriter::new(io::stderr())), Some(Arc::new(SourceMap::new(FilePathMapping::empty()))), diff --git a/compiler/rustc_span/Cargo.toml b/compiler/rustc_span/Cargo.toml index 2ebe3ef8cacc9..b60617681a303 100644 --- a/compiler/rustc_span/Cargo.toml +++ b/compiler/rustc_span/Cargo.toml @@ -17,9 +17,9 @@ rustc_index = { path = "../rustc_index" } rustc_lexer = { path = "../rustc_lexer" } rustc_macros = { path = "../rustc_macros" } rustc_serialize = { path = "../rustc_serialize" } +rustc_unicode = { path = "../rustc_unicode" } scoped-tls = "1.0" sha1 = "0.10.0" sha2 = "0.10.1" tracing = "0.1" -unicode-width = "0.2.2" # tidy-alphabetical-end diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs index 03dc07870345a..2d9e827032669 100644 --- a/compiler/rustc_span/src/lib.rs +++ b/compiler/rustc_span/src/lib.rs @@ -39,7 +39,6 @@ use rustc_serialize::opaque::mem_encoder::MemEncoder; use rustc_serialize::opaque::{FileEncoder, MemDecoder}; use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; use tracing::debug; -pub use unicode_width::UNICODE_VERSION; mod caching_source_map_view; pub mod source_map; @@ -89,6 +88,7 @@ use rustc_data_structures::stable_hash::{StableHash, StableHasher}; use rustc_data_structures::sync::{FreezeLock, FreezeWriteGuard, Lock}; use rustc_data_structures::unord::UnordMap; use rustc_hashes::{Hash64, Hash128}; +use rustc_unicode::unicode_width; use sha1::Sha1; use sha2::Sha256; use span_encoding::InlineCtxt; diff --git a/compiler/rustc_unicode/Cargo.toml b/compiler/rustc_unicode/Cargo.toml new file mode 100644 index 0000000000000..1a22a932c6417 --- /dev/null +++ b/compiler/rustc_unicode/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "rustc_unicode" +version = "0.0.0" +edition = "2024" + +[dependencies] +# tidy-alphabetical-start +unicode-ident = "=1.0.27" +unicode-normalization = "=0.1.26" +unicode-properties = { version = "=0.1.5", default-features = false, features = ["emoji"] } +unicode-script = "=0.5.9" +unicode-security = "=0.1.3" +unicode-width = "=0.2.3" +# tidy-alphabetical-end diff --git a/compiler/rustc_unicode/src/lib.rs b/compiler/rustc_unicode/src/lib.rs new file mode 100644 index 0000000000000..26cbbcb22a4ae --- /dev/null +++ b/compiler/rustc_unicode/src/lib.rs @@ -0,0 +1,56 @@ +//! Unified crate for re-exporting Unicode crates for the compiler. +//! Used to avoid having multiple different Unicode versions in use. + +// If this changes, update https://github.com/rust-lang/reference/blob/HEAD/src/identifiers.md. +// At time of writing, updating this requires a T-lang FCP. +const UNICODE_VERSION: (u8, u8, u8) = (18, 0, 0); + +const _: () = { + let (major, minor, patch) = UNICODE_VERSION; + let (major_, minor_, patch_) = char::UNICODE_VERSION; + if major != major_ || minor != minor_ || patch != patch_ { + // For now, upgrades for the Unicode version used by core and the compiler are independent. + // Until this changes, the Unicode version in this crate and `char` may diverge by + // 1 major version. + // Update this const to make this explicit. + const VERSIONS_DIFFER: bool = false; + if !VERSIONS_DIFFER || major + 1 != major_ { + panic!("rustc_unicode::UNICODE_VERSION does not match char::UNICODE_VERSION",) + } + } +}; + +macro_rules! reexport_and_check { + ($($krate:ident),+ $(,)?) => { + $( + pub use $krate; + const _: () = { + let (major, minor, patch) = UNICODE_VERSION; + let (major_, minor_, patch_) = $krate::UNICODE_VERSION; + if ( + major as u64 != major_ as u64 || + minor as u64 != minor_ as u64 || + patch as u64 != patch_ as u64 + ) { + panic!( + concat!( + stringify!($krate), + " does not have the correct Unicode version (`rustc_unicode::UNICODE_VERSION`)" + ) + ) + } + }; + )+ + } +} + +reexport_and_check!( + // tidy-alphabetical-start + unicode_ident, + unicode_normalization, + unicode_properties, + unicode_script, + unicode_security, + unicode_width, + // tidy-alphabetical-end +); diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_bench.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_bench.snap index d0e0c03d9791b..65d4577af5fb9 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_bench.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_bench.snap @@ -97,6 +97,7 @@ expression: bench - Set({compiler/rustc_ty_walk}) - Set({compiler/rustc_type_ir}) - Set({compiler/rustc_type_ir_macros}) + - Set({compiler/rustc_unicode}) - Set({compiler/rustc_windows_rc}) [Bench] test::CrateRustdoc targets: [x86_64-unknown-linux-gnu] diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_build_compiler.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_build_compiler.snap index 653064633bf49..4c2185575da8a 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_build_compiler.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_build_compiler.snap @@ -79,6 +79,7 @@ expression: build compiler - Set({compiler/rustc_ty_walk}) - Set({compiler/rustc_type_ir}) - Set({compiler/rustc_type_ir_macros}) + - Set({compiler/rustc_unicode}) - Set({compiler/rustc_windows_rc}) [Build] compile::Assemble targets: [x86_64-unknown-linux-gnu] diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_check.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_check.snap index eb848cb57e67f..41905ec562178 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_check.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_check.snap @@ -81,6 +81,7 @@ expression: check - Set({compiler/rustc_ty_walk}) - Set({compiler/rustc_type_ir}) - Set({compiler/rustc_type_ir_macros}) + - Set({compiler/rustc_unicode}) - Set({compiler/rustc_windows_rc}) [Check] check::Rustdoc targets: [x86_64-unknown-linux-gnu] diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_check_compiler.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_check_compiler.snap index ac338441af824..27a984e3327c0 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_check_compiler.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_check_compiler.snap @@ -81,4 +81,5 @@ expression: check compiler - Set({compiler/rustc_ty_walk}) - Set({compiler/rustc_type_ir}) - Set({compiler/rustc_type_ir_macros}) + - Set({compiler/rustc_unicode}) - Set({compiler/rustc_windows_rc}) diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_check_compiletest_include_default_paths.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_check_compiletest_include_default_paths.snap index 8d0ec95e02658..ffee498b71b40 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_check_compiletest_include_default_paths.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_check_compiletest_include_default_paths.snap @@ -81,6 +81,7 @@ expression: check compiletest --include-default-paths - Set({compiler/rustc_ty_walk}) - Set({compiler/rustc_type_ir}) - Set({compiler/rustc_type_ir_macros}) + - Set({compiler/rustc_unicode}) - Set({compiler/rustc_windows_rc}) [Check] check::Rustdoc targets: [x86_64-unknown-linux-gnu] diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_clippy.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_clippy.snap index de6fde4a754e8..df02c12f5ac7d 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_clippy.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_clippy.snap @@ -96,4 +96,5 @@ expression: clippy - Set({compiler/rustc_ty_walk}) - Set({compiler/rustc_type_ir}) - Set({compiler/rustc_type_ir_macros}) + - Set({compiler/rustc_unicode}) - Set({compiler/rustc_windows_rc}) diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_fix.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_fix.snap index e8a77106c8c97..e227c311d30eb 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_fix.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_fix.snap @@ -81,6 +81,7 @@ expression: fix - Set({compiler/rustc_ty_walk}) - Set({compiler/rustc_type_ir}) - Set({compiler/rustc_type_ir_macros}) + - Set({compiler/rustc_unicode}) - Set({compiler/rustc_windows_rc}) [Fix] check::Rustdoc targets: [x86_64-unknown-linux-gnu] diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test.snap index 44bf24b81413d..b01ccfcba50b5 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test.snap @@ -148,6 +148,7 @@ expression: test - Set({compiler/rustc_ty_walk}) - Set({compiler/rustc_type_ir}) - Set({compiler/rustc_type_ir_macros}) + - Set({compiler/rustc_unicode}) - Set({compiler/rustc_windows_rc}) [Test] test::CrateRustdoc targets: [x86_64-unknown-linux-gnu] diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage.snap index 0ba7dd237a62d..0a4ccdbd86e3d 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage.snap @@ -145,6 +145,7 @@ expression: test --skip=coverage - Set({compiler/rustc_ty_walk}) - Set({compiler/rustc_type_ir}) - Set({compiler/rustc_type_ir_macros}) + - Set({compiler/rustc_unicode}) - Set({compiler/rustc_windows_rc}) [Test] test::CrateRustdoc targets: [x86_64-unknown-linux-gnu] diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage_map.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage_map.snap index c73a049573052..89f26ad80b322 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage_map.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage_map.snap @@ -148,6 +148,7 @@ expression: test --skip=coverage-map - Set({compiler/rustc_ty_walk}) - Set({compiler/rustc_type_ir}) - Set({compiler/rustc_type_ir_macros}) + - Set({compiler/rustc_unicode}) - Set({compiler/rustc_windows_rc}) [Test] test::CrateRustdoc targets: [x86_64-unknown-linux-gnu] diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage_run.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage_run.snap index cfdf14a738906..b0b5ba9c3e116 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage_run.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage_run.snap @@ -148,6 +148,7 @@ expression: test --skip=coverage-run - Set({compiler/rustc_ty_walk}) - Set({compiler/rustc_type_ir}) - Set({compiler/rustc_type_ir_macros}) + - Set({compiler/rustc_unicode}) - Set({compiler/rustc_windows_rc}) [Test] test::CrateRustdoc targets: [x86_64-unknown-linux-gnu] diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests.snap index d21d4613add25..95472f161268e 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests.snap @@ -106,6 +106,7 @@ expression: test --skip=tests - Set({compiler/rustc_ty_walk}) - Set({compiler/rustc_type_ir}) - Set({compiler/rustc_type_ir_macros}) + - Set({compiler/rustc_unicode}) - Set({compiler/rustc_windows_rc}) [Test] test::CrateRustdoc targets: [x86_64-unknown-linux-gnu] diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests_coverage.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests_coverage.snap index 68853acdba170..8c9faca01e50c 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests_coverage.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests_coverage.snap @@ -145,6 +145,7 @@ expression: test --skip=tests/coverage - Set({compiler/rustc_ty_walk}) - Set({compiler/rustc_type_ir}) - Set({compiler/rustc_type_ir_macros}) + - Set({compiler/rustc_unicode}) - Set({compiler/rustc_windows_rc}) [Test] test::CrateRustdoc targets: [x86_64-unknown-linux-gnu] diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests_etc.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests_etc.snap index 6a24274b01835..9c276798d948e 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests_etc.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests_etc.snap @@ -90,6 +90,7 @@ expression: test --skip=tests --skip=library --skip=tidyselftest - Set({compiler/rustc_ty_walk}) - Set({compiler/rustc_type_ir}) - Set({compiler/rustc_type_ir_macros}) + - Set({compiler/rustc_unicode}) - Set({compiler/rustc_windows_rc}) [Test] test::CrateRustdoc targets: [x86_64-unknown-linux-gnu] diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs index 9be30acb19252..49ecc3e9114fc 100644 --- a/src/bootstrap/src/core/builder/tests.rs +++ b/src/bootstrap/src/core/builder/tests.rs @@ -1492,7 +1492,7 @@ mod snapshot { #[test] fn check_compiler_no_explicit_stage() { let ctx = TestCtx::new(); - expect_test::expect!["[check] rustc 0 -> rustc 1 (77 crates)"] + expect_test::expect!["[check] rustc 0 -> rustc 1 (78 crates)"] .assert_eq(&ctx.config("check").path("compiler").render_steps()); } @@ -1513,7 +1513,7 @@ mod snapshot { #[test] fn check_compiler_stage_1() { let ctx = TestCtx::new(); - expect_test::expect!["[check] rustc 0 -> rustc 1 (77 crates)"] + expect_test::expect!["[check] rustc 0 -> rustc 1 (78 crates)"] .assert_eq(&ctx.config("check").path("compiler").stage(1).render_steps()); } @@ -1524,7 +1524,7 @@ mod snapshot { [build] llvm [build] rustc 0 -> rustc 1 [build] rustc 1 -> std 1 - [check] rustc 1 -> rustc 2 (77 crates)"#]] + [check] rustc 1 -> rustc 2 (78 crates)"#]] .assert_eq(&ctx.config("check").path("compiler").stage(2).render_steps()); } @@ -1536,7 +1536,7 @@ mod snapshot { [build] rustc 0 -> rustc 1 [build] rustc 1 -> std 1 [check] rustc 1 -> std 1 - [check] rustc 1 -> rustc 2 (77 crates) + [check] rustc 1 -> rustc 2 (78 crates) [check] rustc 1 -> rustc 2 [check] rustc 1 -> Rustdoc 2 [check] rustc 1 -> rustc_codegen_cranelift 2 @@ -1617,7 +1617,7 @@ mod snapshot { expect_test::expect![[""]] .assert_eq(&ctx.config("check").paths(&["library"]).args(&args).render_steps()); - expect_test::expect!["[check] rustc 0 -> rustc 1 (77 crates)"].assert_eq( + expect_test::expect!["[check] rustc 0 -> rustc 1 (78 crates)"].assert_eq( &ctx.config("check").paths(&["library", "compiler"]).args(&args).render_steps(), ); } @@ -2756,7 +2756,7 @@ mod snapshot { #[test] fn fix_compiler() { let ctx = TestCtx::new(); - expect_test::expect!["[fix] rustc 0 -> rustc 1 (77 crates)"] + expect_test::expect!["[fix] rustc 0 -> rustc 1 (78 crates)"] .assert_eq(&ctx.config("fix").path("compiler").render_steps()); } } diff --git a/src/doc/rustc-dev-guide/src/parallel-rustc.md b/src/doc/rustc-dev-guide/src/parallel-rustc.md index c4e0663068e6e..4a530518c8696 100644 --- a/src/doc/rustc-dev-guide/src/parallel-rustc.md +++ b/src/doc/rustc-dev-guide/src/parallel-rustc.md @@ -116,18 +116,18 @@ the parallel iterator function has been used are as follows: | caller | scenario | callee | | ------------------------------------------------------- | ------------------------------------------------------------ | ------------------------ | -| rustc_metadata::rmeta::encoder::prefetch_mir | Prefetch queries which will be needed later by metadata encoding | par_iter | +| rustc_metadata::rmeta::encoder::prefetch_mir | Prefetch queries which will be needed later by metadata encoding | par_iter | | rustc_monomorphize::collector::collect_crate_mono_items | Collect monomorphized items reachable from non-generic items | par_for_each_in | -| rustc_interface::passes::analysis | Check the validity of the match statements | Map::par_body_owners | -| rustc_interface::passes::analysis | MIR borrow check | Map::par_body_owners | +| rustc_interface::passes::full_analysis | Check the validity of the match statements | Map::par_body_owners | +| rustc_interface::passes::full_analysis | MIR borrow check | Map::par_body_owners | | rustc_typeck::check::typeck_item_bodies | Type check | Map::par_body_owners | | rustc_interface::passes::hir_id_validator::check_crate | Check the validity of hir | Map::par_for_each_module | -| rustc_interface::passes::analysis | Check the validity of loops body, attributes, naked functions, unstable abi, const bodys | Map::par_for_each_module | -| rustc_interface::passes::analysis | Liveness and intrinsic checking of MIR | Map::par_for_each_module | -| rustc_interface::passes::analysis | Deathness checking | Map::par_for_each_module | -| rustc_interface::passes::analysis | Privacy checking | Map::par_for_each_module | +| rustc_interface::passes::full_analysis | Check the validity of loops body, attributes, naked functions, unstable abi, const bodys | Map::par_for_each_module | +| rustc_interface::passes::full_analysis | Liveness and intrinsic checking of MIR | Map::par_for_each_module | +| rustc_interface::passes::full_analysis | Deathness checking | Map::par_for_each_module | +| rustc_interface::passes::full_analysis | Privacy checking | Map::par_for_each_module | | rustc_lint::late::check_crate | Run per-module lints | Map::par_for_each_module | -| rustc_typeck::check_crate | Well-formedness checking | Map::par_for_each_module | +| rustc_typeck::check_crate | Well-formedness checking | Map::par_for_each_module | There are still many loops that have the potential to use parallel iterators. diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index 4c8793c2cd4a6..38ce45cb009a9 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -9,11 +9,12 @@ use rustc_data_structures::fx::FxIndexMap; use rustc_errors::DiagCtxtHandle; use rustc_lint::Level; use rustc_session::config::{ - self, CodegenOptions, ErrorOutputType, Externs, Input, JsonUnusedExterns, - OptionsTargetModifiers, OutFileName, PrintCategory, PrintRequest, Sysroot, UnstableOptions, - collect_print_requests, get_cmd_lint_options, nightly_options, parse_crate_types_from_list, - parse_externs, parse_target_triple, + self, CodegenOptions, Externs, Input, JsonUnusedExterns, OptionsTargetModifiers, OutFileName, + PrintCategory, PrintRequest, Sysroot, UnstableOptions, collect_print_requests, + get_cmd_lint_options, nightly_options, parse_crate_types_from_list, parse_externs, + parse_target_triple, }; +use rustc_session::output::ErrorOutputType; use rustc_session::search_paths::SearchPath; use rustc_session::{EarlyDiagCtxt, getopts}; use rustc_span::edition::Edition; diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index e7e47cba44dd6..0a39a1a9cebee 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -19,10 +19,9 @@ use rustc_lint::{MissingDoc, late_lint_mod}; use rustc_middle::hir::nested_filter; use rustc_middle::ty::{self, ParamEnv, Ty, TyCtxt}; use rustc_session::Session; -use rustc_session::config::{ - self, ErrorOutputType, Input, OutputType, OutputTypes, ResolveDocLinks, -}; +use rustc_session::config::{self, Input}; pub(crate) use rustc_session::config::{Options, UnstableOptions}; +use rustc_session::output::{ErrorOutputType, OutputType, OutputTypes, ResolveDocLinks}; use rustc_span::source_map; use rustc_span::symbol::sym; use rustc_structures::CrateType; diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index 0c0e2cddf6826..ca2ecb407d77a 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -27,7 +27,8 @@ use rustc_hir::def_id::LOCAL_CRATE; use rustc_interface::interface; use rustc_lint as lint; use rustc_middle::ty::TyCtxt; -use rustc_session::config::{self, ErrorOutputType, Input}; +use rustc_session::config::{self, Input}; +use rustc_session::output::ErrorOutputType; use rustc_span::edition::Edition; use rustc_span::{FileName, RemapPathScopeComponents, Span}; use rustc_structures::CrateType; diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 9a16942a2e5bc..b49703b2844b2 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -70,7 +70,8 @@ use rustc_errors::DiagCtxtHandle; use rustc_hir::def_id::LOCAL_CRATE; use rustc_interface::interface; use rustc_middle::ty::TyCtxt; -use rustc_session::config::{ErrorOutputType, Input, RustcOptGroup, make_crate_type_option}; +use rustc_session::config::{Input, RustcOptGroup, make_crate_type_option}; +use rustc_session::output::ErrorOutputType; use rustc_session::{EarlyDiagCtxt, getopts}; use rustc_span::{BytePos, Span, SyntaxContext}; use tracing::info; diff --git a/src/tools/clippy/clippy_config/src/de.rs b/src/tools/clippy/clippy_config/src/de.rs index fb335f27aeed6..4e0f1ed31201c 100644 --- a/src/tools/clippy/clippy_config/src/de.rs +++ b/src/tools/clippy/clippy_config/src/de.rs @@ -5,7 +5,7 @@ use rustc_attr_ir::RustcVersion; use rustc_attr_parsing::parse_version; use rustc_errors::{DiagCtxtHandle, DiagMessage}; use rustc_session::Session; -use rustc_session::config::ErrorOutputType; +use rustc_session::output::ErrorOutputType; use rustc_span::edit_distance::edit_distance; use rustc_span::{BytePos, Pos as _, Span, Spanned, Symbol}; use std::collections::{HashMap, HashSet}; diff --git a/src/tools/clippy/src/driver.rs b/src/tools/clippy/src/driver.rs index e83fe592a7ca6..c179a9a84f5f8 100644 --- a/src/tools/clippy/src/driver.rs +++ b/src/tools/clippy/src/driver.rs @@ -18,7 +18,7 @@ rustc_driver::override_c_allocator_in_binary!(); use clippy_utils::sym; use declare_clippy_lint::LintListBuilder; use rustc_interface::interface; -use rustc_session::config::ErrorOutputType; +use rustc_session::output::ErrorOutputType; use rustc_session::{EarlyDiagCtxt, Session}; use rustc_span::symbol::Symbol; diff --git a/src/tools/error_index_generator/main.rs b/src/tools/error_index_generator/main.rs index c78df2b60b56d..c18b73a4c656e 100644 --- a/src/tools/error_index_generator/main.rs +++ b/src/tools/error_index_generator/main.rs @@ -191,7 +191,7 @@ fn parse_args() -> (OutputFormat, PathBuf) { fn main() { let handler = - rustc_session::EarlyDiagCtxt::new(rustc_session::config::ErrorOutputType::default()); + rustc_session::EarlyDiagCtxt::new(rustc_session::output::ErrorOutputType::default()); rustc_driver::init_logger(&handler, rustc_log::LoggerConfig::from_env("RUST_LOG")); let (format, dst) = parse_args(); let result = main_with_result(format, &dst); diff --git a/src/tools/miri/priroda/src/main.rs b/src/tools/miri/priroda/src/main.rs index 73809cd50a6df..c5ba7c415967e 100644 --- a/src/tools/miri/priroda/src/main.rs +++ b/src/tools/miri/priroda/src/main.rs @@ -19,7 +19,7 @@ use rustc_driver::Compilation; use rustc_interface::interface; use rustc_middle::ty::TyCtxt; use rustc_session::EarlyDiagCtxt; -use rustc_session::config::ErrorOutputType; +use rustc_session::output::ErrorOutputType; use rustc_structures::CrateType; fn find_sysroot() -> String { diff --git a/src/tools/miri/src/bin/miri.rs b/src/tools/miri/src/bin/miri.rs index e3e2eef146ccc..7a69297c1a221 100644 --- a/src/tools/miri/src/bin/miri.rs +++ b/src/tools/miri/src/bin/miri.rs @@ -45,7 +45,8 @@ use rustc_interface::util::DummyCodegenBackend; use rustc_log::tracing::debug; use rustc_middle::query::LocalCrate; use rustc_middle::ty::TyCtxt; -use rustc_session::config::{ErrorOutputType, OptLevel}; +use rustc_session::config::{OptLevel}; +use rustc_session::output::{ErrorOutputType}; use rustc_session::{EarlyDiagCtxt, EarlySession, Session}; use rustc_structures::CrateType; diff --git a/src/tools/rustfmt/src/bin/main.rs b/src/tools/rustfmt/src/bin/main.rs index b662959adaad9..d2c95f089d263 100644 --- a/src/tools/rustfmt/src/bin/main.rs +++ b/src/tools/rustfmt/src/bin/main.rs @@ -28,7 +28,7 @@ extern crate rustc_driver; extern crate rustc_session; use rustc_session::EarlyDiagCtxt; -use rustc_session::config::ErrorOutputType; +use rustc_session::output::ErrorOutputType; fn main() { rustc_driver::install_ice_hook(BUG_REPORT_URL, |_| ()); diff --git a/tests/ui-fulldeps/lexer/unicode-version.rs b/tests/ui-fulldeps/lexer/unicode-version.rs deleted file mode 100644 index a924f9241649a..0000000000000 --- a/tests/ui-fulldeps/lexer/unicode-version.rs +++ /dev/null @@ -1,25 +0,0 @@ -// This test is used to validate which version of Unicode is used for parsing -// identifiers. If the Unicode version changes, it should also be updated in -// the reference at -// https://github.com/rust-lang/reference/blob/HEAD/src/identifiers.md. - -//@ run-pass -//@ check-run-results -//@ ignore-cross-compile -//@ reference: ident.unicode -//@ reference: ident.normalization - -#![feature(rustc_private)] - -extern crate rustc_driver; -extern crate rustc_parse; - -fn main() { - println!("Checking if Unicode version changed."); - println!( - "If the Unicode version changes are intentional, \ - it should also be updated in the reference at \ - https://github.com/rust-lang/reference/blob/HEAD/src/identifiers.md." - ); - println!("Unicode version used in rustc_parse is: {:?}", rustc_parse::UNICODE_VERSION); -} diff --git a/tests/ui-fulldeps/lexer/unicode-version.run.stdout b/tests/ui-fulldeps/lexer/unicode-version.run.stdout deleted file mode 100644 index 232b1ac21afe8..0000000000000 --- a/tests/ui-fulldeps/lexer/unicode-version.run.stdout +++ /dev/null @@ -1,3 +0,0 @@ -Checking if Unicode version changed. -If the Unicode version changes are intentional, it should also be updated in the reference at https://github.com/rust-lang/reference/blob/HEAD/src/identifiers.md. -Unicode version used in rustc_parse is: (18, 0, 0) diff --git a/tests/ui-fulldeps/run-compiler-twice.rs b/tests/ui-fulldeps/run-compiler-twice.rs index 85e370769517d..dafa4b011c4dc 100644 --- a/tests/ui-fulldeps/run-compiler-twice.rs +++ b/tests/ui-fulldeps/run-compiler-twice.rs @@ -18,7 +18,8 @@ extern crate rustc_span; use std::path::{Path, PathBuf}; use rustc_interface::{Linker, interface}; -use rustc_session::config::{Input, Options, OutFileName, OutputType, OutputTypes, Sysroot}; +use rustc_session::config::{Input, Options, OutFileName, Sysroot}; +use rustc_session::output::{OutputType, OutputTypes}; use rustc_span::FileName; fn main() { @@ -78,7 +79,7 @@ fn compile(code: String, output: PathBuf, sysroot: Sysroot, linker: Option<&Path let krate = rustc_interface::passes::parse(&compiler.sess); let (linker, incr_comp_session) = rustc_interface::create_and_enter_global_ctxt(&compiler, krate, |tcx| { - let _ = tcx.analysis(()); + let _ = rustc_interface::passes::full_analysis(tcx); let metadata = rustc_interface::passes::finish_and_emit_metadata(tcx); Linker::codegen_and_build_linker(tcx, &*compiler.codegen_backend, metadata) }); diff --git a/tests/ui/consts/const-eval/const-eval-query-stack.stderr b/tests/ui/consts/const-eval/const-eval-query-stack.stderr index 5e1179d3993af..683e8e3bc4fc2 100644 --- a/tests/ui/consts/const-eval/const-eval-query-stack.stderr +++ b/tests/ui/consts/const-eval/const-eval-query-stack.stderr @@ -11,5 +11,5 @@ query stack during panic: #0 [eval_to_allocation_raw] const-evaluating + checking `X` #1 [eval_to_const_value_raw] simplifying constant for the type system `X` #2 [eval_to_const_value_raw] simplifying constant for the type system `X` -#3 [analysis] running analysis passes on crate `const_eval_query_stack` +#3 [required_analysis] running required analysis passes on crate `const_eval_query_stack` end of query stack diff --git a/tests/ui/consts/const-eval/do_not_const_check.stderr b/tests/ui/consts/const-eval/do_not_const_check.stderr index 7db40e7ab0114..a6fdf58154384 100644 --- a/tests/ui/consts/const-eval/do_not_const_check.stderr +++ b/tests/ui/consts/const-eval/do_not_const_check.stderr @@ -15,7 +15,7 @@ query stack during panic: #0 [eval_to_allocation_raw] const-evaluating + checking `_` #1 [eval_to_const_value_raw] simplifying constant for the type system `_` #2 [eval_to_const_value_raw] simplifying constant for the type system `_` -#3 [analysis] running analysis passes on crate `do_not_const_check` +#3 [required_analysis] running required analysis passes on crate `do_not_const_check` end of query stack error: internal compiler error: compiler/rustc_const_eval/src/const_eval/machine.rs:LL:CC: calling non-const function `integer_min::` --> $DIR/do_not_const_check.rs:34:5 @@ -34,7 +34,7 @@ query stack during panic: #0 [eval_to_allocation_raw] const-evaluating + checking `_` #1 [eval_to_const_value_raw] simplifying constant for the type system `_` #2 [eval_to_const_value_raw] simplifying constant for the type system `_` -#3 [analysis] running analysis passes on crate `do_not_const_check` +#3 [required_analysis] running required analysis passes on crate `do_not_const_check` end of query stack error: aborting due to 2 previous errors diff --git a/tests/ui/consts/recursive-zst-static.default.stderr b/tests/ui/consts/recursive-zst-static.default.stderr index 44a07cf3dc807..c01dbe5a6e6f0 100644 --- a/tests/ui/consts/recursive-zst-static.default.stderr +++ b/tests/ui/consts/recursive-zst-static.default.stderr @@ -16,7 +16,7 @@ note: ...which requires evaluating initializer of static `B`... LL | static B: () = A; | ^^^^^^^^^^^^ = note: ...which again requires evaluating initializer of static `A`, completing the cycle - = note: cycle used when running analysis passes on crate `recursive_zst_static` + = note: cycle used when running required analysis passes on crate `recursive_zst_static` = note: for more information, see and error: aborting due to 2 previous errors diff --git a/tests/ui/consts/recursive-zst-static.unleash.stderr b/tests/ui/consts/recursive-zst-static.unleash.stderr index 44a07cf3dc807..c01dbe5a6e6f0 100644 --- a/tests/ui/consts/recursive-zst-static.unleash.stderr +++ b/tests/ui/consts/recursive-zst-static.unleash.stderr @@ -16,7 +16,7 @@ note: ...which requires evaluating initializer of static `B`... LL | static B: () = A; | ^^^^^^^^^^^^ = note: ...which again requires evaluating initializer of static `A`, completing the cycle - = note: cycle used when running analysis passes on crate `recursive_zst_static` + = note: cycle used when running required analysis passes on crate `recursive_zst_static` = note: for more information, see and error: aborting due to 2 previous errors diff --git a/tests/ui/proc-macro/meta-macro-hygiene.stdout b/tests/ui/proc-macro/meta-macro-hygiene.stdout index 6dea8709019bc..0833f3721740e 100644 --- a/tests/ui/proc-macro/meta-macro-hygiene.stdout +++ b/tests/ui/proc-macro/meta-macro-hygiene.stdout @@ -18,7 +18,7 @@ Respanned: TokenStream [Ident { ident: "$crate", span: $DIR/auxiliary/make-macro #![no_std /* 0#0 */] extern crate core /* 0#1 */; -#[prelude_import /* 0#1 */] +#[prelude_import] use core /* 0#1 */::prelude /* 0#1 */::rust_2018 /* 0#1 */::*; // Don't load unnecessary hygiene information from std extern crate std /* 0#0 */; diff --git a/tests/ui/proc-macro/nonterminal-token-hygiene.stdout b/tests/ui/proc-macro/nonterminal-token-hygiene.stdout index 9e54a21735e58..d1b436bbc80d6 100644 --- a/tests/ui/proc-macro/nonterminal-token-hygiene.stdout +++ b/tests/ui/proc-macro/nonterminal-token-hygiene.stdout @@ -39,7 +39,7 @@ PRINT-BANG INPUT (DEBUG): TokenStream [ #![feature /* 0#0 */(decl_macro /* 0#0 */)] #![no_std /* 0#0 */] extern crate core /* 0#2 */; -#[prelude_import /* 0#1 */] +#[prelude_import] use ::core /* 0#1 */::prelude /* 0#1 */::rust_2015 /* 0#1 */::*; // Don't load unnecessary hygiene information from std extern crate std /* 0#0 */; diff --git a/tests/ui/stats/input-stats.stderr b/tests/ui/stats/input-stats.stderr index be15fb0df6a9c..e4f23db345c88 100644 --- a/tests/ui/stats/input-stats.stderr +++ b/tests/ui/stats/input-stats.stderr @@ -10,7 +10,7 @@ ast-stats - Impl 144 (NN.N%) 1 ast-stats - Trait 144 (NN.N%) 1 ast-stats - Fn 288 (NN.N%) 2 ast-stats - Use 576 (NN.N%) 4 -ast-stats PathSegment 840 (NN.N%) 35 24 +ast-stats PathSegment 816 (NN.N%) 34 24 ast-stats Ty 784 (NN.N%) 14 56 ast-stats - Ptr 56 (NN.N%) 1 ast-stats - Ref 56 (NN.N%) 1 @@ -43,8 +43,9 @@ ast-stats FieldDef 160 (NN.N%) 2 80 ast-stats Block 144 (NN.N%) 6 24 ast-stats Attribute 128 (NN.N%) 4 32 ast-stats - DocComment 32 (NN.N%) 1 +ast-stats - Generated 32 (NN.N%) 1 +ast-stats - Normal 32 (NN.N%) 1 ast-stats - Synthetic 32 (NN.N%) 1 -ast-stats - Normal 64 (NN.N%) 2 ast-stats InlineAsm 120 (NN.N%) 1 120 ast-stats FnDecl 120 (NN.N%) 5 24 ast-stats Local 96 (NN.N%) 1 96 @@ -58,7 +59,7 @@ ast-stats GenericArgs 40 (NN.N%) 1 40 ast-stats - AngleBracketed 40 (NN.N%) 1 ast-stats Crate 40 (NN.N%) 1 40 ast-stats ---------------------------------------------------------------- -ast-stats Total 6_872 126 +ast-stats Total 6_848 125 ast-stats ================================================================ hir-stats ================================================================ hir-stats HIR STATS: input_stats diff --git a/tests/ui/track-diagnostics/track.stderr b/tests/ui/track-diagnostics/track.stderr index 9ac567436939b..6a203f0c12e99 100644 --- a/tests/ui/track-diagnostics/track.stderr +++ b/tests/ui/track-diagnostics/track.stderr @@ -41,7 +41,7 @@ note: compiler flags: ... -Z ui-testing ... -Z track-diagnostics query stack during panic: #0 [typeck_root] type-checking `main` -#1 [analysis] running analysis passes on crate `track` +#1 [required_analysis] running required analysis passes on crate `track` end of query stack error: aborting due to 3 previous errors diff --git a/tests/ui/treat-err-as-bug/err.stderr b/tests/ui/treat-err-as-bug/err.stderr index 8ff267deacef5..6e2b513ea16b0 100644 --- a/tests/ui/treat-err-as-bug/err.stderr +++ b/tests/ui/treat-err-as-bug/err.stderr @@ -9,5 +9,5 @@ error: the compiler unexpectedly panicked. This is a bug query stack during panic: #0 [eval_static_initializer] evaluating initializer of static `C` -#1 [analysis] running analysis passes on crate `err` +#1 [required_analysis] running required analysis passes on crate `err` end of query stack diff --git a/triagebot.toml b/triagebot.toml index e74b26445d2f4..0e2010bfaf009 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -1688,13 +1688,6 @@ cc = ["@Zalathar"] [mentions."src/tools/opt-dist"] cc = ["@kobzol"] -[mentions."tests/ui-fulldeps/lexer/unicode-version.run.stdout"] -message = """If the Unicode version changes are intentional, -it should also be updated in the reference at -https://github.com/rust-lang/reference/blob/HEAD/src/identifiers.md. -""" -cc = ["@rust-lang/lang-docs"] - [mentions."src/doc/rustc-dev-guide"] message = "The rustc-dev-guide subtree was changed. If your future PRs *only* touch the subtree, consider submitting them directly to [rust-lang/rustc-dev-guide](https://github.com/rust-lang/rustc-dev-guide/pulls), which is where the document is primarily maintained (and has faster CI)." cc = ["@BoxyUwU", "@tshepang"]