Auto merge of #30325 - jseyfried:fixes_30078, r=nrc

This fixes a bug in which unused imports can get wrongly marked as used when checking for unused qualifications in `resolve_path` (issue #30078), and it removes unused imports that were previously undetected because of the bug.
This commit is contained in:
bors 2015-12-17 18:21:25 +00:00
commit 6734dccc31
44 changed files with 60 additions and 75 deletions

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use self::TargetLocation::*;
use common::Config;
use common::{CompileFail, ParseFail, Pretty, RunFail, RunPass, RunPassValgrind};
use common::{Codegen, DebugInfoLldb, DebugInfoGdb, Rustdoc};

View File

@ -23,7 +23,7 @@ use core::marker::PhantomData;
use core::ops::{Deref, DerefMut, Index, IndexMut};
use core::ptr::Unique;
use core::{slice, mem, ptr, cmp};
use alloc::heap::{self, EMPTY};
use alloc::heap;
use borrow::Borrow;

View File

@ -23,7 +23,7 @@ use core::fmt;
use core::hash;
use core::iter::FromIterator;
use core::mem;
use core::ops::{self, Deref, Add, Index};
use core::ops::{self, Add};
use core::ptr;
use core::slice;
use core::str::pattern::Pattern;

View File

@ -68,7 +68,7 @@ use core::hash::{self, Hash};
use core::intrinsics::{arith_offset, assume, needs_drop};
use core::iter::FromIterator;
use core::mem;
use core::ops::{Index, IndexMut, Deref};
use core::ops::{Index, IndexMut};
use core::ops;
use core::ptr;
use core::slice;

View File

@ -48,7 +48,6 @@ use result::Result;
use result::Result::{Ok, Err};
use ptr;
use mem;
use mem::size_of;
use marker::{Send, Sync, self};
use num::wrapping::OverflowingOps;
use raw::Repr;

View File

@ -26,7 +26,7 @@
use self::TargetLint::*;
use middle::privacy::AccessLevels;
use middle::ty::{self, Ty};
use middle::ty;
use session::{early_error, Session};
use lint::{Level, LevelSource, Lint, LintId, LintArray, LintPass};
use lint::{EarlyLintPass, EarlyLintPassObject, LateLintPass, LateLintPassObject};

View File

@ -41,7 +41,6 @@ use super::{InferCtxt};
use super::{MiscVariable, TypeTrace};
use super::type_variable::{RelationDir, BiTo, EqTo, SubtypeOf, SupertypeOf};
use middle::ty::{TyVar};
use middle::ty::{IntType, UintType};
use middle::ty::{self, Ty};
use middle::ty::error::TypeError;

View File

@ -27,10 +27,9 @@ use middle::region::CodeExtent;
use middle::subst;
use middle::subst::Substs;
use middle::subst::Subst;
use middle::traits::{self, FulfillmentContext, Normalized,
SelectionContext, ObligationCause};
use middle::traits;
use middle::ty::adjustment;
use middle::ty::{TyVid, IntVid, FloatVid, RegionVid};
use middle::ty::{TyVid, IntVid, FloatVid};
use middle::ty::{self, Ty, HasTypeFlags};
use middle::ty::error::{ExpectedFound, TypeError, UnconstrainedNumeric};
use middle::ty::fold::{TypeFolder, TypeFoldable};

View File

@ -24,7 +24,7 @@ use rustc_data_structures::graph::{self, Direction, NodeIndex};
use rustc_data_structures::unify::{self, UnificationTable};
use middle::free_region::FreeRegionMap;
use middle::ty::{self, Ty};
use middle::ty::{BoundRegion, FreeRegion, Region, RegionVid};
use middle::ty::{BoundRegion, Region, RegionVid};
use middle::ty::{ReEmpty, ReStatic, ReFree, ReEarlyBound};
use middle::ty::{ReLateBound, ReScope, ReVar, ReSkolemized, BrFresh};
use middle::ty::error::TypeError;

View File

@ -29,7 +29,7 @@ use syntax::attr::{self, Stability, Deprecation, AttrMetaMethods};
use util::nodemap::{DefIdMap, FnvHashSet, FnvHashMap};
use rustc_front::hir;
use rustc_front::hir::{Block, Crate, Item, Generics, StructField, Variant};
use rustc_front::hir::{Crate, Item, Generics, StructField, Variant};
use rustc_front::intravisit::{self, Visitor};
use std::mem::replace;

View File

@ -27,7 +27,7 @@ use middle::def::{self, ExportMap};
use middle::def_id::DefId;
use middle::lang_items::{FnTraitLangItem, FnMutTraitLangItem, FnOnceTraitLangItem};
use middle::region::{CodeExtent};
use middle::subst::{self, ParamSpace, Subst, Substs, VecPerParamSpace};
use middle::subst::{self, Subst, Substs, VecPerParamSpace};
use middle::traits;
use middle::ty;
use middle::ty::fold::TypeFolder;
@ -52,7 +52,6 @@ use syntax::parse::token::{InternedString, special_idents};
use rustc_front::hir;
use rustc_front::hir::{ItemImpl, ItemTrait};
use rustc_front::hir::{MutImmutable, MutMutable, Visibility};
pub use self::sty::{Binder, DebruijnIndex};
pub use self::sty::{BuiltinBound, BuiltinBounds, ExistentialBounds};

View File

@ -11,16 +11,13 @@
use middle::def_id::DefId;
use middle::subst::{self, Subst};
use middle::ty::{BoundRegion, BrAnon, BrNamed};
use middle::ty::{ReEarlyBound, BrFresh, ctxt};
use middle::ty::{ReFree, ReScope, ReStatic, Region, ReEmpty};
use middle::ty::{ReSkolemized, ReVar, BrEnv};
use middle::ty::{BrAnon, BrEnv, BrFresh, BrNamed};
use middle::ty::{TyBool, TyChar, TyStruct, TyEnum};
use middle::ty::{TyError, TyStr, TyArray, TySlice, TyFloat, TyBareFn};
use middle::ty::{TyParam, TyRawPtr, TyRef, TyTuple};
use middle::ty::TyClosure;
use middle::ty::{TyBox, TyTrait, TyInt, TyUint, TyInfer};
use middle::ty::{self, TypeAndMut, Ty, HasTypeFlags};
use middle::ty::{self, Ty, HasTypeFlags};
use middle::ty::fold::TypeFoldable;
use std::fmt;

View File

@ -29,7 +29,7 @@ use syntax::ast;
use syntax::codemap::Span;
use syntax::ast::NodeId;
use rustc_front::hir;
use rustc_front::hir::{Expr, FnDecl, Block, Pat};
use rustc_front::hir::Expr;
use rustc_front::intravisit;
use rustc_front::intravisit::Visitor;

View File

@ -38,7 +38,7 @@ use rustc::middle::ty::{self, Ty};
use std::fmt;
use std::mem;
use std::rc::Rc;
use syntax::ast::{self, NodeId};
use syntax::ast;
use syntax::codemap::Span;
use rustc_front::hir;

View File

@ -16,7 +16,7 @@ use rbml::reader::Decoder as RbmlDecoder;
use rustc::middle::cstore::tls;
use rustc::middle::def_id::DefId;
use rustc::middle::subst::Substs;
use rustc::middle::ty::{self, Ty};
use rustc::middle::ty;
use decoder::{self, Cmd};
use encoder;

View File

@ -45,7 +45,7 @@ use rustc::middle::privacy::ImportUse::*;
use rustc::middle::privacy::LastPrivate::*;
use rustc::middle::privacy::PrivateDep::*;
use rustc::middle::privacy::ExternalExports;
use rustc::middle::ty::{self, Ty};
use rustc::middle::ty;
use rustc::util::nodemap::NodeMap;
use rustc::front::map as ast_map;

View File

@ -38,12 +38,12 @@ use syntax::parse::token::special_idents;
use syntax::codemap::{Span, DUMMY_SP};
use rustc_front::hir;
use rustc_front::hir::{Block, Crate, DeclItem};
use rustc_front::hir::{Block, DeclItem};
use rustc_front::hir::{ForeignItem, ForeignItemFn, ForeignItemStatic};
use rustc_front::hir::{Item, ItemConst, ItemEnum, ItemExternCrate, ItemFn};
use rustc_front::hir::{ItemForeignMod, ItemImpl, ItemMod, ItemStatic, ItemDefaultImpl};
use rustc_front::hir::{ItemStruct, ItemTrait, ItemTy, ItemUse};
use rustc_front::hir::{NamedField, PathListIdent, PathListMod, Public};
use rustc_front::hir::{NamedField, PathListIdent, PathListMod};
use rustc_front::hir::StmtDecl;
use rustc_front::hir::UnnamedField;
use rustc_front::hir::{Variant, ViewPathGlob, ViewPathList, ViewPathSimple};

View File

@ -64,7 +64,7 @@ use rustc::middle::ty::{Freevar, FreevarMap, TraitMap, GlobMap};
use rustc::util::nodemap::{NodeMap, DefIdSet, FnvHashMap};
use syntax::ast;
use syntax::ast::{CRATE_NODE_ID, Ident, Name, NodeId, CrateNum, TyIs, TyI8, TyI16, TyI32, TyI64};
use syntax::ast::{CRATE_NODE_ID, Name, NodeId, CrateNum, TyIs, TyI8, TyI16, TyI32, TyI64};
use syntax::ast::{TyUs, TyU8, TyU16, TyU32, TyU64, TyF64, TyF32};
use syntax::attr::AttrMetaMethods;
use syntax::parse::token::{self, special_names, special_idents};
@ -1463,7 +1463,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
fn resolve_item_in_lexical_scope(&mut self,
module_: Rc<Module>,
name: Name,
namespace: Namespace)
namespace: Namespace,
record_used: bool)
-> ResolveResult<(Target, bool)> {
debug!("(resolving item in lexical scope) resolving `{}` in namespace {:?} in `{}`",
name,
@ -1503,11 +1504,13 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
debug!("(resolving item in lexical scope) using import resolution");
// track used imports and extern crates as well
let id = import_resolution[namespace].id;
if record_used {
self.used_imports.insert((id, namespace));
self.record_import_use(id, name);
if let Some(DefId{krate: kid, ..}) = target.target_module.def_id() {
self.used_crates.insert(kid);
}
}
return Success((target, false));
}
}
@ -1583,7 +1586,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
-> ResolveResult<Rc<Module>> {
// If this module is an anonymous module, resolve the item in the
// lexical scope. Otherwise, resolve the item from the crate root.
let resolve_result = self.resolve_item_in_lexical_scope(module_, name, TypeNS);
let resolve_result = self.resolve_item_in_lexical_scope(module_, name, TypeNS, true);
match resolve_result {
Success((target, _)) => {
if let Some(module_def) = target.binding.module() {
@ -2791,7 +2794,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
span: Span)
-> BareIdentifierPatternResolution {
let module = self.current_module.clone();
match self.resolve_item_in_lexical_scope(module, name, ValueNS) {
match self.resolve_item_in_lexical_scope(module, name, ValueNS, true) {
Success((target, _)) => {
debug!("(resolve bare identifier pattern) succeeded in finding {} at {:?}",
name,
@ -2899,17 +2902,16 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
}
// Try to find a path to an item in a module.
let unqualified_def = self.resolve_identifier(segments.last().unwrap().identifier,
namespace,
check_ribs);
let last_ident = segments.last().unwrap().identifier;
if segments.len() <= 1 {
let unqualified_def = self.resolve_identifier(last_ident, namespace, check_ribs, true);
return unqualified_def.and_then(|def| self.adjust_local_def(def, span))
.map(|def| {
PathResolution::new(def, LastMod(AllPublic), path_depth)
});
}
let unqualified_def = self.resolve_identifier(last_ident, namespace, check_ribs, false);
let def = self.resolve_module_relative_path(span, segments, namespace);
match (def, unqualified_def) {
(Some((ref d, _)), Some(ref ud)) if *d == ud.def => {
@ -2929,7 +2931,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
fn resolve_identifier(&mut self,
identifier: hir::Ident,
namespace: Namespace,
check_ribs: bool)
check_ribs: bool,
record_used: bool)
-> Option<LocalDef> {
// First, check to see whether the name is a primitive type.
if namespace == TypeNS {
@ -2946,7 +2949,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
}
}
self.resolve_item_by_name_in_lexical_scope(identifier.unhygienic_name, namespace)
let name = identifier.unhygienic_name;
self.resolve_item_by_name_in_lexical_scope(name, namespace, record_used)
.map(LocalDef::from_def)
}
@ -3197,11 +3201,12 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
fn resolve_item_by_name_in_lexical_scope(&mut self,
name: Name,
namespace: Namespace)
namespace: Namespace,
record_used: bool)
-> Option<Def> {
// Check the items.
let module = self.current_module.clone();
match self.resolve_item_in_lexical_scope(module, name, namespace) {
match self.resolve_item_in_lexical_scope(module, name, namespace, record_used) {
Success((target, _)) => {
match target.binding.def() {
None => {

View File

@ -34,10 +34,9 @@ use session::Session;
use middle::def;
use middle::def_id::DefId;
use middle::ty::{self, Ty};
use middle::ty;
use std::fs::File;
use std::path::Path;
use syntax::ast::{self, NodeId};
use syntax::codemap::*;

View File

@ -20,7 +20,7 @@ use trans::build::*;
use trans::callee::{self, ArgVals, Callee, TraitItem, MethodData};
use trans::cleanup::{CleanupMethods, CustomScope, ScopeId};
use trans::common::*;
use trans::datum::{self, Datum, rvalue_scratch_datum, Rvalue, ByValue};
use trans::datum::{self, Datum, rvalue_scratch_datum, Rvalue};
use trans::debuginfo::{self, DebugLoc};
use trans::declare;
use trans::expr;

View File

@ -11,7 +11,6 @@
// .debug_gdb_scripts binary section.
use llvm;
use llvm::ValueRef;
use trans::common::{C_bytes, CrateContext, C_i32};
use trans::declare;

View File

@ -14,7 +14,7 @@ use arena::TypedArena;
use intrinsics::{self, Intrinsic};
use libc;
use llvm;
use llvm::{SequentiallyConsistent, Acquire, Release, AtomicXchg, ValueRef, TypeKind};
use llvm::{ValueRef, TypeKind};
use middle::infer;
use middle::subst;
use middle::subst::FnSpace;
@ -32,10 +32,8 @@ use trans::debuginfo::DebugLoc;
use trans::declare;
use trans::expr;
use trans::glue;
use trans::type_of::*;
use trans::type_of;
use trans::machine;
use trans::machine::llsize_of;
use trans::type_::Type;
use middle::ty::{self, Ty, HasTypeFlags};
use middle::subst::Substs;

View File

@ -28,7 +28,6 @@ use trans::consts;
use trans::datum::*;
use trans::debuginfo::DebugLoc;
use trans::declare;
use trans::expr::SaveIn;
use trans::expr;
use trans::glue;
use trans::machine;

View File

@ -93,7 +93,7 @@ use middle::pat_util::{self, pat_id_map};
use middle::privacy::{AllPublic, LastMod};
use middle::subst::{self, Subst, Substs, VecPerParamSpace, ParamSpace, TypeSpace};
use middle::traits::{self, report_fulfillment_errors};
use middle::ty::{FnSig, GenericPredicates, TypeScheme};
use middle::ty::{GenericPredicates, TypeScheme};
use middle::ty::{Disr, ParamTy, ParameterEnvironment};
use middle::ty::{LvaluePreference, NoPreference, PreferMutLvalue};
use middle::ty::{self, HasTypeFlags, RegionEscape, ToPolyTraitRef, Ty};
@ -127,7 +127,6 @@ use syntax::util::lev_distance::lev_distance;
use rustc_front::intravisit::{self, Visitor};
use rustc_front::hir;
use rustc_front::hir::Visibility;
use rustc_front::hir::{Item, ItemImpl};
use rustc_front::print::pprust;
use rustc_back::slice;

View File

@ -92,7 +92,7 @@ use middle::mem_categorization::Categorization;
use middle::region::{self, CodeExtent};
use middle::subst::Substs;
use middle::traits;
use middle::ty::{self, RegionEscape, ReScope, Ty, MethodCall, HasTypeFlags};
use middle::ty::{self, RegionEscape, Ty, MethodCall, HasTypeFlags};
use middle::infer::{self, GenericKind, InferCtxt, SubregionOrigin, TypeOrigin, VerifyBound};
use middle::pat_util;
use middle::ty::adjustment;

View File

@ -40,7 +40,6 @@ use syntax::codemap::Span;
use syntax::parse::token;
use util::nodemap::{DefIdMap, FnvHashMap};
use rustc::front::map as hir_map;
use rustc::front::map::NodeItem;
use rustc_front::intravisit;
use rustc_front::hir::{Item, ItemImpl,Crate};
use rustc_front::hir;

View File

@ -19,7 +19,6 @@ use syntax::ast;
use syntax::codemap::Span;
use rustc_front::intravisit;
use rustc_front::hir;
use rustc_front::hir::{Item, ItemImpl};
pub fn check(tcx: &ty::ctxt) {
let mut orphan = OrphanChecker { tcx: tcx };

View File

@ -15,7 +15,7 @@ use middle::cstore::{CrateStore, LOCAL_CRATE};
use middle::def_id::DefId;
use middle::traits;
use middle::ty;
use middle::infer::{self, new_infer_ctxt};
use middle::infer;
use syntax::ast;
use syntax::codemap::Span;
use rustc_front::hir;

View File

@ -14,7 +14,6 @@
use middle::ty;
use rustc_front::intravisit;
use rustc_front::hir;
use rustc_front::hir::{Item, ItemImpl};
pub fn check(tcx: &ty::ctxt) {
let mut orphan = UnsafetyChecker { tcx: tcx };

View File

@ -110,7 +110,6 @@ use util::common::time;
use rustc_front::hir;
use syntax::codemap::Span;
use syntax::print::pprust::*;
use syntax::{ast, abi};
use std::cell::RefCell;

View File

@ -24,7 +24,6 @@ use mem::{self, replace};
use ops::{Deref, FnMut, FnOnce, Index};
use option::Option::{self, Some, None};
use rand::{self, Rng};
use result::Result;
use super::table::{
self,

View File

@ -13,7 +13,6 @@ use clone::Clone;
use cmp::{Eq, PartialEq};
use core::marker::Sized;
use default::Default;
use fmt::Debug;
use fmt;
use hash::Hash;
use iter::{Iterator, IntoIterator, ExactSizeIterator, FromIterator, Map, Chain, Extend};

View File

@ -14,7 +14,7 @@ use os::unix::prelude::*;
use ffi::{CString, CStr, OsString, OsStr};
use fmt;
use io::{self, Error, ErrorKind, SeekFrom};
use libc::{self, c_int, size_t, off_t, c_char, mode_t};
use libc::{self, c_int, off_t, c_char, mode_t};
use mem;
use path::{Path, PathBuf};
use ptr;

View File

@ -51,7 +51,7 @@ use abi::Abi;
use ext::base;
use ext::tt::macro_parser;
use owned_slice::OwnedSlice;
use parse::token::{InternedString, str_to_ident};
use parse::token::InternedString;
use parse::token;
use parse::lexer;
use parse::lexer::comments::{doc_comment_style, strip_doc_comment_decoration};

View File

@ -24,7 +24,7 @@ use config::CfgDiag;
use diagnostic::SpanHandler;
use feature_gate::{GatedCfg, GatedCfgAttr};
use parse::lexer::comments::{doc_comment_style, strip_doc_comment_decoration};
use parse::token::{InternedString, intern_and_get_ident};
use parse::token::InternedString;
use parse::token;
use ptr::P;

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use ast::{Block, Crate, DeclLocal, ExprMac, PatMac};
use ast::{Block, Crate, DeclLocal, PatMac};
use ast::{Local, Ident, Mac_, Name};
use ast::{ItemMac, MacStmtWithSemicolon, Mrk, Stmt, StmtDecl, StmtMac};
use ast::{StmtExpr, StmtSemi};

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use ast::{self, Arg, Arm, Block, Expr, Item, Pat, Path, Stmt, TokenTree, Ty};
use ast::{self, Arg, Arm, Block, Expr, Item, Pat, Stmt, TokenTree, Ty};
use codemap::Span;
use ext::base::ExtCtxt;
use ext::base;
@ -33,7 +33,7 @@ pub mod rt {
use ptr::P;
use std::rc::Rc;
use ast::{TokenTree, Expr};
use ast::TokenTree;
pub use parse::new_parser_from_tts;
pub use codemap::{BytePos, Span, dummy_spanned, DUMMY_SP};

View File

@ -85,7 +85,7 @@ use codemap;
use parse::lexer::*; //resolve bug?
use parse::ParseSess;
use parse::parser::{LifetimeAndTypesWithoutColons, Parser};
use parse::token::{Eof, DocComment, MatchNt, SubstNt};
use parse::token::{DocComment, MatchNt, SubstNt};
use parse::token::{Token, Nonterminal};
use parse::token;
use print::pprust;

View File

@ -14,7 +14,7 @@ use ast::{TokenTree, Ident, Name};
use codemap::{Span, DUMMY_SP};
use diagnostic::SpanHandler;
use ext::tt::macro_parser::{NamedMatch, MatchedSeq, MatchedNonterminal};
use parse::token::{Eof, DocComment, Interpolated, MatchNt, SubstNt};
use parse::token::{DocComment, MatchNt, SubstNt};
use parse::token::{Token, NtIdent, SpecialMacroVar};
use parse::token;
use parse::lexer::TokenAndSpan;

View File

@ -28,12 +28,12 @@ use ast::{ExprLit, ExprLoop, ExprMac, ExprRange};
use ast::{ExprMethodCall, ExprParen, ExprPath};
use ast::{ExprRepeat, ExprRet, ExprStruct, ExprTup, ExprUnary};
use ast::{ExprVec, ExprWhile, ExprWhileLet, ExprForLoop, Field, FnDecl};
use ast::{ForeignItem, ForeignItemStatic, ForeignItemFn, ForeignMod, FunctionRetTy};
use ast::{ForeignItem, ForeignItemStatic, ForeignItemFn, FunctionRetTy};
use ast::{Ident, Inherited, ImplItem, Item, Item_, ItemStatic};
use ast::{ItemEnum, ItemFn, ItemForeignMod, ItemImpl, ItemConst};
use ast::{ItemMac, ItemMod, ItemStruct, ItemTrait, ItemTy, ItemDefaultImpl};
use ast::{ItemExternCrate, ItemUse};
use ast::{LifetimeDef, Lit, Lit_};
use ast::{Lit, Lit_};
use ast::{LitBool, LitChar, LitByte, LitByteStr};
use ast::{LitStr, LitInt, Local};
use ast::{MacStmtWithBraces, MacStmtWithSemicolon, MacStmtWithoutBraces};
@ -50,7 +50,7 @@ use ast::{SelfExplicit, SelfRegion, SelfStatic, SelfValue};
use ast::{Delimited, SequenceRepetition, TokenTree, TraitItem, TraitRef};
use ast::{Ty, Ty_, TypeBinding, TyMac};
use ast::{TyFixedLengthVec, TyBareFn, TyTypeof, TyInfer};
use ast::{TyParam, TyParamBound, TyParen, TyPath, TyPolyTraitRef, TyPtr};
use ast::{TyParam, TyParamBound, TyParen, TyPath, TyPtr};
use ast::{TyRptr, TyTup, TyU32, TyVec};
use ast::TypeTraitItem;
use ast::{UnnamedField, UnsafeBlock};

View File

@ -18,7 +18,6 @@ use syntax::ext::base::*;
use syntax::ext::base;
use syntax::ext::build::AstBuilder;
use syntax::attr;
use syntax::attr::*;
use syntax::parse::token;
use syntax::config::CfgDiagReal;

View File

@ -59,11 +59,9 @@ use self::NamePadding::*;
use self::OutputLocation::*;
use stats::Stats;
use getopts::{OptGroup, optflag, optopt};
use serialize::Encodable;
use std::boxed::FnBox;
use term::Terminal;
use term::color::{Color, RED, YELLOW, GREEN, CYAN};
use std::any::Any;
use std::cmp;

View File

@ -17,4 +17,5 @@ mod foo {
fn main() {
use foo::bar;
foo::bar(); //~ ERROR: unnecessary qualification
bar();
}

View File

@ -50,11 +50,14 @@ mod foo {
mod bar {
// Don't ignore on 'pub use' because we're not sure if it's used or not
pub use std::cmp::PartialEq;
pub struct Square;
pub mod c {
use foo::Point;
use foo::Square; //~ ERROR unused import
pub fn cc(p: Point) -> isize { return 2 * (p.x + p.y); }
pub fn cc(_p: Point) -> super::Square {
super::Square
}
}
#[allow(unused_imports)]