Remove (lots of) dead code
Found with https://github.com/est31/warnalyzer. Dubious changes: - Is anyone else using rustc_apfloat? I feel weird completely deleting x87 support. - Maybe some of the dead code in rustc_data_structures, in case someone wants to use it in the future? - Don't change rustc_serialize I plan to scrap most of the json module in the near future (see https://github.com/rust-lang/compiler-team/issues/418) and fixing the tests needed more work than I expected. TODO: check if any of the comments on the deleted code should be kept.
This commit is contained in:
parent
785aeac521
commit
441dc3640a
74 changed files with 60 additions and 1298 deletions
|
@ -20,7 +20,7 @@ use rustc_errors::annotate_snippet_emitter_writer::AnnotateSnippetEmitterWriter;
|
|||
use rustc_errors::emitter::{Emitter, EmitterWriter, HumanReadableErrorType};
|
||||
use rustc_errors::json::JsonEmitter;
|
||||
use rustc_errors::registry::Registry;
|
||||
use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder, DiagnosticId, ErrorReported};
|
||||
use rustc_errors::{Diagnostic, DiagnosticBuilder, DiagnosticId, ErrorReported};
|
||||
use rustc_lint_defs::FutureBreakage;
|
||||
pub use rustc_span::crate_disambiguator::CrateDisambiguator;
|
||||
use rustc_span::edition::Edition;
|
||||
|
@ -241,8 +241,7 @@ pub struct PerfStats {
|
|||
enum DiagnosticBuilderMethod {
|
||||
Note,
|
||||
SpanNote,
|
||||
SpanSuggestion(String), // suggestion
|
||||
// Add more variants as needed to support one-time diagnostics.
|
||||
// Add more variants as needed to support one-time diagnostics.
|
||||
}
|
||||
|
||||
/// Trait implemented by error types. This should not be implemented manually. Instead, use
|
||||
|
@ -365,14 +364,6 @@ impl Session {
|
|||
pub fn struct_span_warn<S: Into<MultiSpan>>(&self, sp: S, msg: &str) -> DiagnosticBuilder<'_> {
|
||||
self.diagnostic().struct_span_warn(sp, msg)
|
||||
}
|
||||
pub fn struct_span_warn_with_code<S: Into<MultiSpan>>(
|
||||
&self,
|
||||
sp: S,
|
||||
msg: &str,
|
||||
code: DiagnosticId,
|
||||
) -> DiagnosticBuilder<'_> {
|
||||
self.diagnostic().struct_span_warn_with_code(sp, msg, code)
|
||||
}
|
||||
pub fn struct_warn(&self, msg: &str) -> DiagnosticBuilder<'_> {
|
||||
self.diagnostic().struct_warn(msg)
|
||||
}
|
||||
|
@ -411,37 +402,16 @@ impl Session {
|
|||
) -> DiagnosticBuilder<'_> {
|
||||
self.diagnostic().struct_span_fatal_with_code(sp, msg, code)
|
||||
}
|
||||
pub fn struct_fatal(&self, msg: &str) -> DiagnosticBuilder<'_> {
|
||||
self.diagnostic().struct_fatal(msg)
|
||||
}
|
||||
|
||||
pub fn span_fatal<S: Into<MultiSpan>>(&self, sp: S, msg: &str) -> ! {
|
||||
self.diagnostic().span_fatal(sp, msg).raise()
|
||||
}
|
||||
pub fn span_fatal_with_code<S: Into<MultiSpan>>(
|
||||
&self,
|
||||
sp: S,
|
||||
msg: &str,
|
||||
code: DiagnosticId,
|
||||
) -> ! {
|
||||
self.diagnostic().span_fatal_with_code(sp, msg, code).raise()
|
||||
}
|
||||
pub fn fatal(&self, msg: &str) -> ! {
|
||||
self.diagnostic().fatal(msg).raise()
|
||||
}
|
||||
pub fn span_err_or_warn<S: Into<MultiSpan>>(&self, is_warning: bool, sp: S, msg: &str) {
|
||||
if is_warning {
|
||||
self.span_warn(sp, msg);
|
||||
} else {
|
||||
self.span_err(sp, msg);
|
||||
}
|
||||
}
|
||||
pub fn span_err<S: Into<MultiSpan>>(&self, sp: S, msg: &str) {
|
||||
self.diagnostic().span_err(sp, msg)
|
||||
}
|
||||
pub fn span_err_with_code<S: Into<MultiSpan>>(&self, sp: S, msg: &str, code: DiagnosticId) {
|
||||
self.diagnostic().span_err_with_code(sp, &msg, code)
|
||||
}
|
||||
pub fn err(&self, msg: &str) {
|
||||
self.diagnostic().err(msg)
|
||||
}
|
||||
|
@ -481,18 +451,9 @@ impl Session {
|
|||
pub fn span_warn<S: Into<MultiSpan>>(&self, sp: S, msg: &str) {
|
||||
self.diagnostic().span_warn(sp, msg)
|
||||
}
|
||||
pub fn span_warn_with_code<S: Into<MultiSpan>>(&self, sp: S, msg: &str, code: DiagnosticId) {
|
||||
self.diagnostic().span_warn_with_code(sp, msg, code)
|
||||
}
|
||||
pub fn warn(&self, msg: &str) {
|
||||
self.diagnostic().warn(msg)
|
||||
}
|
||||
pub fn opt_span_warn<S: Into<MultiSpan>>(&self, opt_sp: Option<S>, msg: &str) {
|
||||
match opt_sp {
|
||||
Some(sp) => self.span_warn(sp, msg),
|
||||
None => self.warn(msg),
|
||||
}
|
||||
}
|
||||
/// Delay a span_bug() call until abort_if_errors()
|
||||
#[track_caller]
|
||||
pub fn delay_span_bug<S: Into<MultiSpan>>(&self, sp: S, msg: &str) {
|
||||
|
@ -519,9 +480,6 @@ impl Session {
|
|||
pub fn note_without_error(&self, msg: &str) {
|
||||
self.diagnostic().note_without_error(msg)
|
||||
}
|
||||
pub fn span_note_without_error<S: Into<MultiSpan>>(&self, sp: S, msg: &str) {
|
||||
self.diagnostic().span_note_without_error(sp, msg)
|
||||
}
|
||||
pub fn struct_note_without_error(&self, msg: &str) -> DiagnosticBuilder<'_> {
|
||||
self.diagnostic().struct_note_without_error(msg)
|
||||
}
|
||||
|
@ -551,15 +509,6 @@ impl Session {
|
|||
let span = span_maybe.expect("`span_note` needs a span");
|
||||
diag_builder.span_note(span, message);
|
||||
}
|
||||
DiagnosticBuilderMethod::SpanSuggestion(suggestion) => {
|
||||
let span = span_maybe.expect("`span_suggestion_*` needs a span");
|
||||
diag_builder.span_suggestion(
|
||||
span,
|
||||
message,
|
||||
suggestion,
|
||||
Applicability::Unspecified,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -589,23 +538,6 @@ impl Session {
|
|||
self.diag_once(diag_builder, DiagnosticBuilderMethod::Note, msg_id, message, None);
|
||||
}
|
||||
|
||||
pub fn diag_span_suggestion_once<'a, 'b>(
|
||||
&'a self,
|
||||
diag_builder: &'b mut DiagnosticBuilder<'a>,
|
||||
msg_id: DiagnosticMessageId,
|
||||
span: Span,
|
||||
message: &str,
|
||||
suggestion: String,
|
||||
) {
|
||||
self.diag_once(
|
||||
diag_builder,
|
||||
DiagnosticBuilderMethod::SpanSuggestion(suggestion),
|
||||
msg_id,
|
||||
message,
|
||||
Some(span),
|
||||
);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn source_map(&self) -> &SourceMap {
|
||||
self.parse_sess.source_map()
|
||||
|
@ -631,9 +563,6 @@ impl Session {
|
|||
pub fn verify_llvm_ir(&self) -> bool {
|
||||
self.opts.debugging_opts.verify_llvm_ir || option_env!("RUSTC_VERIFY_LLVM_IR").is_some()
|
||||
}
|
||||
pub fn borrowck_stats(&self) -> bool {
|
||||
self.opts.debugging_opts.borrowck_stats
|
||||
}
|
||||
pub fn print_llvm_passes(&self) -> bool {
|
||||
self.opts.debugging_opts.print_llvm_passes
|
||||
}
|
||||
|
@ -890,22 +819,6 @@ impl Session {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn set_incr_session_load_dep_graph(&self, load: bool) {
|
||||
let mut incr_comp_session = self.incr_comp_session.borrow_mut();
|
||||
|
||||
if let IncrCompSession::Active { ref mut load_dep_graph, .. } = *incr_comp_session {
|
||||
*load_dep_graph = load;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn incr_session_load_dep_graph(&self) -> bool {
|
||||
let incr_comp_session = self.incr_comp_session.borrow();
|
||||
match *incr_comp_session {
|
||||
IncrCompSession::Active { load_dep_graph, .. } => load_dep_graph,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn init_incr_comp_session(
|
||||
&self,
|
||||
session_dir: PathBuf,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue