Skip to content

Commit 4b92a5a

Browse files
committed
Rebasing changes
1 parent dbde741 commit 4b92a5a

File tree

9 files changed

+30
-39
lines changed

9 files changed

+30
-39
lines changed

src/libcollections/str.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3330,10 +3330,10 @@ mod tests {
33303330

33313331
#[cfg(test)]
33323332
mod bench {
3333+
use super::*;
33333334
use prelude::*;
33343335
use test::Bencher;
33353336
use test::black_box;
3336-
use super::*;
33373337

33383338
#[bench]
33393339
fn char_iterator(b: &mut Bencher) {

src/librustc/middle/ty.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ use std::mem;
7777
use std::ops;
7878
use std::rc::Rc;
7979
use collections::enum_set::{EnumSet, CLike};
80-
use std::collections::hash_map::HashMap;
80+
use std::collections::{HashMap, HashSet};
8181
use std::collections::hash_map::Entry::{Occupied, Vacant};
8282
use syntax::abi;
8383
use syntax::ast::{CrateNum, DefId, DUMMY_NODE_ID, Ident, ItemTrait, LOCAL_CRATE};
@@ -105,7 +105,7 @@ pub struct CrateAnalysis<'tcx> {
105105
pub ty_cx: ty::ctxt<'tcx>,
106106
pub reachable: NodeSet,
107107
pub name: String,
108-
pub glob_map: Option<middle::resolve::GlobMap>,
108+
pub glob_map: Option<GlobMap>,
109109
}
110110

111111
#[deriving(Copy, PartialEq, Eq, Hash)]
@@ -6286,6 +6286,10 @@ pub type CaptureModeMap = NodeMap<ast::CaptureClause>;
62866286
// Trait method resolution
62876287
pub type TraitMap = NodeMap<Vec<DefId>>;
62886288

6289+
// Map from the NodeId of a glob import to a list of items which are actually
6290+
// imported.
6291+
pub type GlobMap = HashMap<NodeId, HashSet<Name>>;
6292+
62896293
pub fn with_freevars<T, F>(tcx: &ty::ctxt, fid: ast::NodeId, f: F) -> T where
62906294
F: FnOnce(&[Freevar]) -> T,
62916295
{

src/librustc_driver/driver.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -343,10 +343,11 @@ pub fn phase_3_run_analysis_passes<'tcx>(sess: Session,
343343
middle::lang_items::collect_language_items(krate, &sess));
344344

345345
let make_glob_map = if save_analysis(&sess) {
346-
middle::resolve::MakeGlobMap::Yes
346+
resolve::MakeGlobMap::Yes
347347
} else {
348-
middle::resolve::MakeGlobMap::No
348+
resolve::MakeGlobMap::No
349349
};
350+
let resolve::CrateMap {
350351
def_map,
351352
freevars,
352353
capture_mode_map,
@@ -358,6 +359,7 @@ pub fn phase_3_run_analysis_passes<'tcx>(sess: Session,
358359
} =
359360
time(time_passes, "resolution", (),
360361
|_| resolve::resolve_crate(&sess,
362+
&ast_map,
361363
&lang_items,
362364
krate,
363365
make_glob_map));

src/librustc_resolve/check_unused.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,19 @@ struct UnusedImportCheckVisitor<'a, 'b:'a, 'tcx:'b> {
3333
}
3434

3535
// Deref and DerefMut impls allow treating UnusedImportCheckVisitor as Resolver.
36-
impl<'a, 'b, 'tcx> Deref<Resolver<'b, 'tcx>> for UnusedImportCheckVisitor<'a, 'b, 'tcx:'b> {
36+
impl<'a, 'b, 'tcx:'b> Deref<Resolver<'b, 'tcx>> for UnusedImportCheckVisitor<'a, 'b, 'tcx> {
3737
fn deref<'c>(&'c self) -> &'c Resolver<'b, 'tcx> {
3838
&*self.resolver
3939
}
4040
}
4141

42-
impl<'a, 'b, 'tcx> DerefMut<Resolver<'b, 'tcx>> for UnusedImportCheckVisitor<'a, 'b, 'tcx:'b> {
42+
impl<'a, 'b, 'tcx:'b> DerefMut<Resolver<'b, 'tcx>> for UnusedImportCheckVisitor<'a, 'b, 'tcx> {
4343
fn deref_mut<'c>(&'c mut self) -> &'c mut Resolver<'b, 'tcx> {
4444
&mut *self.resolver
4545
}
4646
}
4747

48-
impl<'a, 'b> UnusedImportCheckVisitor<'a, 'b> {
48+
impl<'a, 'b, 'tcx> UnusedImportCheckVisitor<'a, 'b, 'tcx> {
4949
// We have information about whether `use` (import) directives are actually used now.
5050
// If an import is not used at all, we signal a lint error. If an import is only used
5151
// for a single namespace, we remove the other namespace from the recorded privacy

src/librustc_resolve/lib.rs

+2-20
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ use rustc::middle::lang_items::LanguageItems;
5555
use rustc::middle::pat_util::pat_bindings;
5656
use rustc::middle::privacy::*;
5757
use rustc::middle::subst::{ParamSpace, FnSpace, TypeSpace};
58-
use rustc::middle::ty::{CaptureModeMap, Freevar, FreevarMap, TraitMap};
58+
use rustc::middle::ty::{CaptureModeMap, Freevar, FreevarMap, TraitMap, GlobMap};
5959
use rustc::util::nodemap::{NodeMap, NodeSet, DefIdSet, FnvHashMap};
6060
use rustc::util::lev_distance::lev_distance;
6161

@@ -66,7 +66,7 @@ use syntax::ast::{ExprPath, ExprStruct, FnDecl};
6666
use syntax::ast::{ForeignItem, ForeignItemFn, ForeignItemStatic, Generics};
6767
use syntax::ast::{Ident, ImplItem, Item, ItemConst, ItemEnum, ItemFn};
6868
use syntax::ast::{ItemForeignMod, ItemImpl, ItemMac, ItemMod, ItemStatic};
69-
use syntax::ast::{ItemStruct, ItemTrait, ItemTy, Local};
69+
use syntax::ast::{ItemStruct, ItemTrait, ItemTy, Local, LOCAL_CRATE};
7070
use syntax::ast::{MethodImplItem, Mod, Name, NamedField, NodeId};
7171
use syntax::ast::{Pat, PatEnum, PatIdent, PatLit};
7272
use syntax::ast::{PatRange, PatStruct, Path, PathListIdent, PathListMod};
@@ -110,10 +110,6 @@ struct BindingInfo {
110110
// Map from the name in a pattern to its binding mode.
111111
type BindingMap = HashMap<Name, BindingInfo>;
112112

113-
// Map from the NodeId of a glob import to a list of items which are actually
114-
// imported.
115-
pub type GlobMap = HashMap<NodeId, HashSet<Name>>;
116-
117113
#[deriving(Copy, PartialEq)]
118114
enum PatternBindingMode {
119115
RefutableMode,
@@ -970,20 +966,6 @@ impl<'a, 'b, 'v, 'tcx> Visitor<'v> for BuildReducedGraphVisitor<'a, 'b, 'tcx> {
970966

971967
}
972968

973-
<<<<<<< HEAD:src/librustc_resolve/lib.rs
974-
=======
975-
struct UnusedImportCheckVisitor<'a, 'b:'a, 'tcx:'b> {
976-
resolver: &'a mut Resolver<'b, 'tcx>
977-
}
978-
979-
impl<'a, 'b, 'v, 'tcx> Visitor<'v> for UnusedImportCheckVisitor<'a, 'b, 'tcx> {
980-
fn visit_view_item(&mut self, vi: &ViewItem) {
981-
self.resolver.check_for_item_unused_imports(vi);
982-
visit::walk_view_item(self, vi);
983-
}
984-
}
985-
986-
>>>>>>> save-analysis: emit names of items that a glob import actually imports.:src/librustc/middle/resolve.rs
987969
#[deriving(PartialEq)]
988970
enum FallbackChecks {
989971
Everything,

src/librustc_resolve/record_exports.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,24 @@ use syntax::parse::token;
2727

2828
use std::rc::Rc;
2929

30-
struct ExportRecorder<'a, 'b:'a> {
31-
resolver: &'a mut Resolver<'b>
30+
struct ExportRecorder<'a, 'b:'a, 'tcx:'b> {
31+
resolver: &'a mut Resolver<'b, 'tcx>
3232
}
3333

3434
// Deref and DerefMut impls allow treating ExportRecorder as Resolver.
35-
impl<'a, 'b> Deref<Resolver<'b>> for ExportRecorder<'a, 'b> {
36-
fn deref<'c>(&'c self) -> &'c Resolver<'b> {
35+
impl<'a, 'b, 'tcx:'b> Deref<Resolver<'b, 'tcx>> for ExportRecorder<'a, 'b, 'tcx> {
36+
fn deref<'c>(&'c self) -> &'c Resolver<'b, 'tcx> {
3737
&*self.resolver
3838
}
3939
}
4040

41-
impl<'a, 'b> DerefMut<Resolver<'b>> for ExportRecorder<'a, 'b> {
42-
fn deref_mut<'c>(&'c mut self) -> &'c mut Resolver<'b> {
41+
impl<'a, 'b, 'tcx:'b> DerefMut<Resolver<'b, 'tcx>> for ExportRecorder<'a, 'b, 'tcx> {
42+
fn deref_mut<'c>(&'c mut self) -> &'c mut Resolver<'b, 'tcx> {
4343
&mut *self.resolver
4444
}
4545
}
4646

47-
impl<'a, 'b> ExportRecorder<'a, 'b> {
47+
impl<'a, 'b, 'tcx> ExportRecorder<'a, 'b, 'tcx> {
4848
fn record_exports_for_module_subtree(&mut self,
4949
module_: Rc<Module>) {
5050
// If this isn't a local krate, then bail out. We don't need to record

src/libstd/c_str.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -534,13 +534,12 @@ pub unsafe fn from_c_multistring<F>(buf: *const libc::c_char,
534534

535535
#[cfg(test)]
536536
mod tests {
537+
use super::*;
537538
use prelude::*;
538539
use ptr;
539540
use thread::Thread;
540541
use libc;
541542

542-
use super::*;
543-
544543
#[test]
545544
fn test_str_multistring_parsing() {
546545
unsafe {

src/libstd/path/posix.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,9 @@ static dot_dot_static: &'static [u8] = b"..";
448448
#[cfg(test)]
449449
mod tests {
450450
use super::*;
451-
use prelude::*;
451+
use prelude::Option::{mod, Some, None};
452+
use prelude::{Vec, Clone, AsSlice, SliceExt, CloneSliceExt, IteratorExt};
453+
use prelude::{DoubleEndedIteratorExt, Str, StrExt, ToString, GenericPath};
452454
use str;
453455

454456
macro_rules! t {

src/libstd/path/windows.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1121,8 +1121,10 @@ fn prefix_len(p: Option<PathPrefix>) -> uint {
11211121

11221122
#[cfg(test)]
11231123
mod tests {
1124-
use mem;
11251124
use super::*;
1125+
use prelude::Option::{mod, Some, None};
1126+
use prelude::{Vec, Clone, AsSlice, SliceExt, CloneSliceExt, IteratorExt};
1127+
use prelude::{DoubleEndedIteratorExt, Str, ToString, GenericPath};
11261128
use super::PathPrefix::*;
11271129
use super::parse_prefix;
11281130

0 commit comments

Comments
 (0)