about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2019-11-13 22:09:31 +0900
committerGitHub <noreply@github.com>2019-11-13 22:09:31 +0900
commitd52dafd2a885f91081faa0ff3dcd4ea24ef6d073 (patch)
tree9097068ee322e19c2a947de662df6c3a1ed50cd5
parentfab583bdfc319323cbb6ac8e98c2a1020cb4baa6 (diff)
parent8c29b74b15d494fd963109bade5f31a0ada431d0 (diff)
downloadrust-d52dafd2a885f91081faa0ff3dcd4ea24ef6d073.tar.gz
rust-d52dafd2a885f91081faa0ff3dcd4ea24ef6d073.zip
Rollup merge of #66337 - Mark-Simulacrum:no-decode-lint-id, r=Dylan-DPC
Remove dead code for encoding/decoding lint IDs

This helps decouple the lint system from needing the implicit TLS TyCtxt
as well.
-rw-r--r--src/librustc/lint/context.rs27
1 files changed, 1 insertions, 26 deletions
diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs
index 721baad2563..dc3bc5fa0ce 100644
--- a/src/librustc/lint/context.rs
+++ b/src/librustc/lint/context.rs
@@ -35,7 +35,6 @@ use crate::util::common::time;
 use errors::DiagnosticBuilder;
 use std::slice;
 use rustc_data_structures::sync::{self, ParallelIterator, join, par_iter};
-use rustc_serialize::{Decoder, Decodable, Encoder, Encodable};
 use syntax::ast;
 use syntax::util::lev_distance::find_best_match_for_name;
 use syntax::visit as ast_visit;
@@ -71,7 +70,7 @@ pub struct LintStore {
 
 /// Lints that are buffered up early on in the `Session` before the
 /// `LintLevels` is calculated
-#[derive(PartialEq, RustcEncodable, RustcDecodable, Debug)]
+#[derive(PartialEq, Debug)]
 pub struct BufferedEarlyLint {
     pub lint_id: LintId,
     pub ast_id: ast::NodeId,
@@ -1574,27 +1573,3 @@ pub fn check_ast_crate<T: EarlyLintPass>(
         }
     }
 }
-
-impl Encodable for LintId {
-    fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
-        s.emit_str(&self.lint.name.to_lowercase())
-    }
-}
-
-impl Decodable for LintId {
-    #[inline]
-    fn decode<D: Decoder>(d: &mut D) -> Result<LintId, D::Error> {
-        let s = d.read_str()?;
-        ty::tls::with(|tcx| {
-            match tcx.lint_store.find_lints(&s) {
-                Ok(ids) => {
-                    if ids.len() != 0 {
-                        panic!("invalid lint-id `{}`", s);
-                    }
-                    Ok(ids[0])
-                }
-                Err(_) => panic!("invalid lint-id `{}`", s),
-            }
-        })
-    }
-}