about summary refs log tree commit diff
path: root/src/librustc_errors
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-08-21 08:14:17 +0000
committerbors <bors@rust-lang.org>2017-08-21 08:14:17 +0000
commit757b7ac2abd69d97ba196b76f0bbf78c377aaea9 (patch)
tree3c76b7c825867d596c18b62ecb9a54fbe45078b4 /src/librustc_errors
parent06bf94a129931d6e4abadf779af40b95c143b3eb (diff)
parentde4dbe5789d1a4f11c50aa891f9c9cad13860370 (diff)
downloadrust-757b7ac2abd69d97ba196b76f0bbf78c377aaea9.tar.gz
rust-757b7ac2abd69d97ba196b76f0bbf78c377aaea9.zip
Auto merge of #43986 - petrochenkov:pubcrate3, r=pnkfelix
rustc: Remove some dead code

Extracted from https://github.com/rust-lang/rust/pull/43192

r? @eddyb
Diffstat (limited to 'src/librustc_errors')
-rw-r--r--src/librustc_errors/diagnostic.rs12
-rw-r--r--src/librustc_errors/diagnostic_builder.rs7
-rw-r--r--src/librustc_errors/lib.rs21
3 files changed, 6 insertions, 34 deletions
diff --git a/src/librustc_errors/diagnostic.rs b/src/librustc_errors/diagnostic.rs
index 5a7016e7239..0f063542383 100644
--- a/src/librustc_errors/diagnostic.rs
+++ b/src/librustc_errors/diagnostic.rs
@@ -105,10 +105,6 @@ impl Diagnostic {
         self.level == Level::Cancelled
     }
 
-    pub fn is_fatal(&self) -> bool {
-        self.level == Level::Fatal
-    }
-
     /// Add a span/label to be included in the resulting snippet.
     /// This is pushed onto the `MultiSpan` that was created when the
     /// diagnostic was first built. If you don't call this function at
@@ -278,18 +274,10 @@ impl Diagnostic {
         self.message.iter().map(|i| i.0.to_owned()).collect::<String>()
     }
 
-    pub fn set_message(&mut self, message: &str) {
-        self.message = vec![(message.to_owned(), Style::NoStyle)];
-    }
-
     pub fn styled_message(&self) -> &Vec<(String, Style)> {
         &self.message
     }
 
-    pub fn level(&self) -> Level {
-        self.level
-    }
-
     /// Used by a lint. Copies over all details *but* the "main
     /// message".
     pub fn copy_details_not_message(&mut self, from: &Diagnostic) {
diff --git a/src/librustc_errors/diagnostic_builder.rs b/src/librustc_errors/diagnostic_builder.rs
index 73e09fd8fa9..8d7ce4eb4f6 100644
--- a/src/librustc_errors/diagnostic_builder.rs
+++ b/src/librustc_errors/diagnostic_builder.rs
@@ -183,13 +183,6 @@ impl<'a> DiagnosticBuilder<'a> {
             diagnostic: Diagnostic::new_with_code(level, code, message)
         }
     }
-
-    pub fn into_diagnostic(mut self) -> Diagnostic {
-        // annoyingly, the Drop impl means we can't actually move
-        let result = self.diagnostic.clone();
-        self.cancel();
-        result
-    }
 }
 
 impl<'a> Debug for DiagnosticBuilder<'a> {
diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs
index 26dda2dc42d..12b5ccf4837 100644
--- a/src/librustc_errors/lib.rs
+++ b/src/librustc_errors/lib.rs
@@ -38,8 +38,8 @@ use std::cell::{RefCell, Cell};
 use std::{error, fmt};
 use std::rc::Rc;
 
-pub mod diagnostic;
-pub mod diagnostic_builder;
+mod diagnostic;
+mod diagnostic_builder;
 pub mod emitter;
 mod snippet;
 pub mod registry;
@@ -111,7 +111,7 @@ impl CodeSuggestion {
     }
 
     /// Returns the number of substitutions
-    pub fn substitution_spans<'a>(&'a self) -> impl Iterator<Item = Span> + 'a {
+    fn substitution_spans<'a>(&'a self) -> impl Iterator<Item = Span> + 'a {
         self.substitution_parts.iter().map(|sub| sub.span)
     }
 
@@ -262,7 +262,7 @@ impl error::Error for ExplicitBug {
     }
 }
 
-pub use diagnostic::{Diagnostic, SubDiagnostic, DiagnosticStyledString, StringPart};
+pub use diagnostic::{Diagnostic, SubDiagnostic, DiagnosticStyledString};
 pub use diagnostic_builder::DiagnosticBuilder;
 
 /// A handler deals with errors; certain errors
@@ -491,7 +491,7 @@ impl Handler {
         self.bug(&format!("unimplemented {}", msg));
     }
 
-    pub fn bump_err_count(&self) {
+    fn bump_err_count(&self) {
         self.panic_if_treat_err_as_bug();
         self.err_count.set(self.err_count.get() + 1);
     }
@@ -571,7 +571,7 @@ impl fmt::Display for Level {
 }
 
 impl Level {
-    pub fn color(self) -> term::color::Color {
+    fn color(self) -> term::color::Color {
         match self {
             Bug | Fatal | PhaseFatal | Error => term::color::BRIGHT_RED,
             Warning => {
@@ -598,12 +598,3 @@ impl Level {
         }
     }
 }
-
-pub fn expect<T, M>(diag: &Handler, opt: Option<T>, msg: M) -> T
-    where M: FnOnce() -> String
-{
-    match opt {
-        Some(t) => t,
-        None => diag.bug(&msg()),
-    }
-}