diff --git a/clippy_lints/src/consts.rs b/clippy_lints/src/consts.rs index 36417cd0877..6fc6637900d 100644 --- a/clippy_lints/src/consts.rs +++ b/clippy_lints/src/consts.rs @@ -13,7 +13,6 @@ use std::rc::Rc; use syntax::ast::{FloatTy, LitKind}; use syntax::ptr::P; -use rustc::middle::const_val::ConstVal; use crate::utils::{sext, unsext, clip}; #[derive(Debug, Copy, Clone)] @@ -428,7 +427,7 @@ fn binop(&mut self, op: BinOp, left: &Expr, right: &Expr) -> Option { pub fn miri_to_const<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, result: &ty::Const<'tcx>) -> Option { use rustc::mir::interpret::{Scalar, ConstValue}; match result.val { - ConstVal::Value(ConstValue::Scalar(Scalar::Bits{ bits: b, ..})) => match result.ty.sty { + ConstValue::Scalar(Scalar::Bits{ bits: b, ..}) => match result.ty.sty { ty::TyBool => Some(Constant::Bool(b == 1)), ty::TyUint(_) | ty::TyInt(_) => Some(Constant::Int(b)), ty::TyFloat(FloatTy::F32) => Some(Constant::F32(f32::from_bits(b as u32))), @@ -436,7 +435,7 @@ pub fn miri_to_const<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, result: &ty::Const<' // FIXME: implement other conversion _ => None, }, - ConstVal::Value(ConstValue::ScalarPair(Scalar::Ptr(ptr), Scalar::Bits { bits: n, .. })) => match result.ty.sty { + ConstValue::ScalarPair(Scalar::Ptr(ptr), Scalar::Bits { bits: n, .. }) => match result.ty.sty { ty::TyRef(_, tam, _) => match tam.sty { ty::TyStr => { let alloc = tcx diff --git a/clippy_lints/src/utils/paths.rs b/clippy_lints/src/utils/paths.rs index 7606f4f8471..4d89f8ddffb 100644 --- a/clippy_lints/src/utils/paths.rs +++ b/clippy_lints/src/utils/paths.rs @@ -2,18 +2,18 @@ //! about. pub const ANY_TRAIT: [&str; 3] = ["std", "any", "Any"]; -pub const ARC: [&str; 3] = ["alloc", "arc", "Arc"]; +pub const ARC: [&str; 3] = ["alloc", "sync", "Arc"]; pub const ASMUT_TRAIT: [&str; 3] = ["core", "convert", "AsMut"]; pub const ASREF_TRAIT: [&str; 3] = ["core", "convert", "AsRef"]; pub const BEGIN_PANIC: [&str; 3] = ["std", "panicking", "begin_panic"]; pub const BEGIN_PANIC_FMT: [&str; 3] = ["std", "panicking", "begin_panic_fmt"]; -pub const BINARY_HEAP: [&str; 3] = ["alloc", "binary_heap", "BinaryHeap"]; +pub const BINARY_HEAP: [&str; 4] = ["alloc", "collections", "binary_heap", "BinaryHeap"]; pub const BORROW_TRAIT: [&str; 3] = ["core", "borrow", "Borrow"]; pub const BOX: [&str; 3] = ["std", "boxed", "Box"]; pub const BOX_NEW: [&str; 4] = ["std", "boxed", "Box", "new"]; -pub const BTREEMAP: [&str; 4] = ["alloc", "btree", "map", "BTreeMap"]; -pub const BTREEMAP_ENTRY: [&str; 4] = ["alloc", "btree", "map", "Entry"]; -pub const BTREESET: [&str; 4] = ["alloc", "btree", "set", "BTreeSet"]; +pub const BTREEMAP: [&str; 5] = ["alloc", "collections", "btree", "map", "BTreeMap"]; +pub const BTREEMAP_ENTRY: [&str; 5] = ["alloc", "collections", "btree", "map", "Entry"]; +pub const BTREESET: [&str; 5] = ["alloc", "collections", "btree", "set", "BTreeSet"]; pub const CLONE: [&str; 4] = ["core", "clone", "Clone", "clone"]; pub const CLONE_TRAIT: [&str; 3] = ["core", "clone", "Clone"]; pub const CMP_MAX: [&str; 3] = ["core", "cmp", "max"]; @@ -47,7 +47,7 @@ pub const IO_READ: [&str; 3] = ["std", "io", "Read"]; pub const IO_WRITE: [&str; 3] = ["std", "io", "Write"]; pub const ITERATOR: [&str; 4] = ["core", "iter", "iterator", "Iterator"]; -pub const LINKED_LIST: [&str; 3] = ["alloc", "linked_list", "LinkedList"]; +pub const LINKED_LIST: [&str; 4] = ["alloc", "collections", "linked_list", "LinkedList"]; pub const LINT: [&str; 2] = ["lint", "Lint"]; pub const LINT_ARRAY: [&str; 2] = ["lint", "LintArray"]; pub const MEM_FORGET: [&str; 3] = ["core", "mem", "forget"]; @@ -101,7 +101,7 @@ pub const TRY_INTO_RESULT: [&str; 4] = ["std", "ops", "Try", "into_result"]; pub const UNINIT: [&str; 4] = ["core", "intrinsics", "", "uninit"]; pub const VEC: [&str; 3] = ["alloc", "vec", "Vec"]; -pub const VEC_DEQUE: [&str; 3] = ["alloc", "vec_deque", "VecDeque"]; +pub const VEC_DEQUE: [&str; 4] = ["alloc", "collections", "vec_deque", "VecDeque"]; pub const VEC_FROM_ELEM: [&str; 3] = ["alloc", "vec", "from_elem"]; -pub const WEAK_ARC: [&str; 3] = ["alloc", "arc", "Weak"]; +pub const WEAK_ARC: [&str; 3] = ["alloc", "sync", "Weak"]; pub const WEAK_RC: [&str; 3] = ["alloc", "rc", "Weak"]; diff --git a/tests/ui/dlist.rs b/tests/ui/dlist.rs index a4fab5735e2..1318ed78717 100644 --- a/tests/ui/dlist.rs +++ b/tests/ui/dlist.rs @@ -6,7 +6,7 @@ #![allow(dead_code, needless_pass_by_value)] extern crate alloc; -use alloc::linked_list::LinkedList; +use alloc::collections::linked_list::LinkedList; trait Foo { type Baz = LinkedList;