Skip to content

Commit 96a9511

Browse files
authored
Rollup merge of rust-lang#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.
2 parents 23b4fba + 8c29b74 commit 96a9511

File tree

1 file changed

+1
-26
lines changed

1 file changed

+1
-26
lines changed

src/librustc/lint/context.rs

+1-26
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ use crate::util::common::time;
3535
use errors::DiagnosticBuilder;
3636
use std::slice;
3737
use rustc_data_structures::sync::{self, ParallelIterator, join, par_iter};
38-
use rustc_serialize::{Decoder, Decodable, Encoder, Encodable};
3938
use syntax::ast;
4039
use syntax::util::lev_distance::find_best_match_for_name;
4140
use syntax::visit as ast_visit;
@@ -71,7 +70,7 @@ pub struct LintStore {
7170

7271
/// Lints that are buffered up early on in the `Session` before the
7372
/// `LintLevels` is calculated
74-
#[derive(PartialEq, RustcEncodable, RustcDecodable, Debug)]
73+
#[derive(PartialEq, Debug)]
7574
pub struct BufferedEarlyLint {
7675
pub lint_id: LintId,
7776
pub ast_id: ast::NodeId,
@@ -1574,27 +1573,3 @@ pub fn check_ast_crate<T: EarlyLintPass>(
15741573
}
15751574
}
15761575
}
1577-
1578-
impl Encodable for LintId {
1579-
fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
1580-
s.emit_str(&self.lint.name.to_lowercase())
1581-
}
1582-
}
1583-
1584-
impl Decodable for LintId {
1585-
#[inline]
1586-
fn decode<D: Decoder>(d: &mut D) -> Result<LintId, D::Error> {
1587-
let s = d.read_str()?;
1588-
ty::tls::with(|tcx| {
1589-
match tcx.lint_store.find_lints(&s) {
1590-
Ok(ids) => {
1591-
if ids.len() != 0 {
1592-
panic!("invalid lint-id `{}`", s);
1593-
}
1594-
Ok(ids[0])
1595-
}
1596-
Err(_) => panic!("invalid lint-id `{}`", s),
1597-
}
1598-
})
1599-
}
1600-
}

0 commit comments

Comments
 (0)