diff --git a/components/plugins/lib.rs b/components/plugins/lib.rs index eca3feef5f1..43995876599 100644 --- a/components/plugins/lib.rs +++ b/components/plugins/lib.rs @@ -46,7 +46,6 @@ pub fn plugin_registrar(reg: &mut Registry) { reg.register_late_lint_pass(box lints::unrooted_must_root::UnrootedPass::new()); reg.register_late_lint_pass(box lints::privatize::PrivatizePass); reg.register_late_lint_pass(box lints::inheritance_integrity::InheritancePass); - reg.register_late_lint_pass(box lints::transmute_type::TransmutePass); reg.register_early_lint_pass(box lints::ban::BanPass); reg.register_attribute("_dom_struct_marker".to_string(), Whitelisted); reg.register_attribute("allow_unrooted_interior".to_string(), Whitelisted); diff --git a/components/plugins/lints/mod.rs b/components/plugins/lints/mod.rs index 31c6b90737b..3bdff2003eb 100644 --- a/components/plugins/lints/mod.rs +++ b/components/plugins/lints/mod.rs @@ -5,5 +5,4 @@ pub mod ban; pub mod inheritance_integrity; pub mod privatize; -pub mod transmute_type; pub mod unrooted_must_root; diff --git a/components/plugins/lints/transmute_type.rs b/components/plugins/lints/transmute_type.rs deleted file mode 100644 index 15e760291f9..00000000000 --- a/components/plugins/lints/transmute_type.rs +++ /dev/null @@ -1,45 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -use rustc::hir; -use rustc::lint::{LateContext, LintPass, LintArray, LateLintPass, LintContext}; - -declare_lint!(TRANSMUTE_TYPE_LINT, Allow, - "Warn and report types being transmuted"); - -/// Lint for auditing transmutes -/// -/// This lint (off by default, enable with `-W transmute-type-lint`) warns about all the transmutes -/// being used, along with the types they transmute to/from. -pub struct TransmutePass; - -impl LintPass for TransmutePass { - fn get_lints(&self) -> LintArray { - lint_array!(TRANSMUTE_TYPE_LINT) - } -} - -impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TransmutePass { - fn check_expr(&mut self, cx: &LateContext, ex: &hir::Expr) { - match ex.node { - hir::ExprCall(ref expr, ref args) => { - match expr.node { - hir::ExprPath(hir::QPath::Resolved(_, ref path)) => { - if path.segments.last() - .map_or(false, |ref segment| &*segment.name.as_str() == "transmute") && - args.len() == 1 { - cx.span_lint(TRANSMUTE_TYPE_LINT, ex.span, - &format!("Transmute to {:?} from {:?} detected", - cx.tables.expr_ty(ex), - cx.tables.expr_ty(&args.get(0).unwrap()) - )); - } - } - _ => {} - } - } - _ => {} - } - } -} diff --git a/tests/compiletest/plugin/compile-fail/transmute_type.rs b/tests/compiletest/plugin/compile-fail/transmute_type.rs deleted file mode 100644 index 42bdd8c8c0f..00000000000 --- a/tests/compiletest/plugin/compile-fail/transmute_type.rs +++ /dev/null @@ -1,19 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#![feature(plugin)] -#![plugin(plugins)] -#![allow(dead_code)] -#![deny(transmute_type_lint)] - -use std::mem::{self, transmute}; - - -fn main() { - let _: &[u8] = unsafe { transmute("Rust") }; - //~^ ERROR Transmute to &[u8] from &'static str detected - - let _: &[u8] = unsafe { mem::transmute("Rust") }; - //~^ ERROR Transmute to &[u8] from &'static str detected -}