Skip to content

Commit

Permalink
Rebasing changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nrc committed Dec 26, 2014
1 parent dbde741 commit 4b92a5a
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 39 deletions.
2 changes: 1 addition & 1 deletion src/libcollections/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3330,10 +3330,10 @@ mod tests {

#[cfg(test)]
mod bench {
use super::*;
use prelude::*;
use test::Bencher;
use test::black_box;
use super::*;

#[bench]
fn char_iterator(b: &mut Bencher) {
Expand Down
8 changes: 6 additions & 2 deletions src/librustc/middle/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ use std::mem;
use std::ops;
use std::rc::Rc;
use collections::enum_set::{EnumSet, CLike};
use std::collections::hash_map::HashMap;
use std::collections::{HashMap, HashSet};
use std::collections::hash_map::Entry::{Occupied, Vacant};
use syntax::abi;
use syntax::ast::{CrateNum, DefId, DUMMY_NODE_ID, Ident, ItemTrait, LOCAL_CRATE};
Expand Down Expand Up @@ -105,7 +105,7 @@ pub struct CrateAnalysis<'tcx> {
pub ty_cx: ty::ctxt<'tcx>,
pub reachable: NodeSet,
pub name: String,
pub glob_map: Option<middle::resolve::GlobMap>,
pub glob_map: Option<GlobMap>,
}

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

// Map from the NodeId of a glob import to a list of items which are actually
// imported.
pub type GlobMap = HashMap<NodeId, HashSet<Name>>;

pub fn with_freevars<T, F>(tcx: &ty::ctxt, fid: ast::NodeId, f: F) -> T where
F: FnOnce(&[Freevar]) -> T,
{
Expand Down
6 changes: 4 additions & 2 deletions src/librustc_driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,11 @@ pub fn phase_3_run_analysis_passes<'tcx>(sess: Session,
middle::lang_items::collect_language_items(krate, &sess));

let make_glob_map = if save_analysis(&sess) {
middle::resolve::MakeGlobMap::Yes
resolve::MakeGlobMap::Yes
} else {
middle::resolve::MakeGlobMap::No
resolve::MakeGlobMap::No
};
let resolve::CrateMap {
def_map,
freevars,
capture_mode_map,
Expand All @@ -358,6 +359,7 @@ pub fn phase_3_run_analysis_passes<'tcx>(sess: Session,
} =
time(time_passes, "resolution", (),
|_| resolve::resolve_crate(&sess,
&ast_map,
&lang_items,
krate,
make_glob_map));
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_resolve/check_unused.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ struct UnusedImportCheckVisitor<'a, 'b:'a, 'tcx:'b> {
}

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

impl<'a, 'b, 'tcx> DerefMut<Resolver<'b, 'tcx>> for UnusedImportCheckVisitor<'a, 'b, 'tcx:'b> {
impl<'a, 'b, 'tcx:'b> DerefMut<Resolver<'b, 'tcx>> for UnusedImportCheckVisitor<'a, 'b, 'tcx> {
fn deref_mut<'c>(&'c mut self) -> &'c mut Resolver<'b, 'tcx> {
&mut *self.resolver
}
}

impl<'a, 'b> UnusedImportCheckVisitor<'a, 'b> {
impl<'a, 'b, 'tcx> UnusedImportCheckVisitor<'a, 'b, 'tcx> {
// We have information about whether `use` (import) directives are actually used now.
// If an import is not used at all, we signal a lint error. If an import is only used
// for a single namespace, we remove the other namespace from the recorded privacy
Expand Down
22 changes: 2 additions & 20 deletions src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ use rustc::middle::lang_items::LanguageItems;
use rustc::middle::pat_util::pat_bindings;
use rustc::middle::privacy::*;
use rustc::middle::subst::{ParamSpace, FnSpace, TypeSpace};
use rustc::middle::ty::{CaptureModeMap, Freevar, FreevarMap, TraitMap};
use rustc::middle::ty::{CaptureModeMap, Freevar, FreevarMap, TraitMap, GlobMap};
use rustc::util::nodemap::{NodeMap, NodeSet, DefIdSet, FnvHashMap};
use rustc::util::lev_distance::lev_distance;

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

// Map from the NodeId of a glob import to a list of items which are actually
// imported.
pub type GlobMap = HashMap<NodeId, HashSet<Name>>;

#[deriving(Copy, PartialEq)]
enum PatternBindingMode {
RefutableMode,
Expand Down Expand Up @@ -970,20 +966,6 @@ impl<'a, 'b, 'v, 'tcx> Visitor<'v> for BuildReducedGraphVisitor<'a, 'b, 'tcx> {

}

<<<<<<< HEAD:src/librustc_resolve/lib.rs
=======
struct UnusedImportCheckVisitor<'a, 'b:'a, 'tcx:'b> {
resolver: &'a mut Resolver<'b, 'tcx>
}

impl<'a, 'b, 'v, 'tcx> Visitor<'v> for UnusedImportCheckVisitor<'a, 'b, 'tcx> {
fn visit_view_item(&mut self, vi: &ViewItem) {
self.resolver.check_for_item_unused_imports(vi);
visit::walk_view_item(self, vi);
}
}

>>>>>>> save-analysis: emit names of items that a glob import actually imports.:src/librustc/middle/resolve.rs
#[deriving(PartialEq)]
enum FallbackChecks {
Everything,
Expand Down
14 changes: 7 additions & 7 deletions src/librustc_resolve/record_exports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,24 @@ use syntax::parse::token;

use std::rc::Rc;

struct ExportRecorder<'a, 'b:'a> {
resolver: &'a mut Resolver<'b>
struct ExportRecorder<'a, 'b:'a, 'tcx:'b> {
resolver: &'a mut Resolver<'b, 'tcx>
}

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

impl<'a, 'b> DerefMut<Resolver<'b>> for ExportRecorder<'a, 'b> {
fn deref_mut<'c>(&'c mut self) -> &'c mut Resolver<'b> {
impl<'a, 'b, 'tcx:'b> DerefMut<Resolver<'b, 'tcx>> for ExportRecorder<'a, 'b, 'tcx> {
fn deref_mut<'c>(&'c mut self) -> &'c mut Resolver<'b, 'tcx> {
&mut *self.resolver
}
}

impl<'a, 'b> ExportRecorder<'a, 'b> {
impl<'a, 'b, 'tcx> ExportRecorder<'a, 'b, 'tcx> {
fn record_exports_for_module_subtree(&mut self,
module_: Rc<Module>) {
// If this isn't a local krate, then bail out. We don't need to record
Expand Down
3 changes: 1 addition & 2 deletions src/libstd/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,13 +534,12 @@ pub unsafe fn from_c_multistring<F>(buf: *const libc::c_char,

#[cfg(test)]
mod tests {
use super::*;
use prelude::*;
use ptr;
use thread::Thread;
use libc;

use super::*;

#[test]
fn test_str_multistring_parsing() {
unsafe {
Expand Down
4 changes: 3 additions & 1 deletion src/libstd/path/posix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,9 @@ static dot_dot_static: &'static [u8] = b"..";
#[cfg(test)]
mod tests {
use super::*;
use prelude::*;
use prelude::Option::{mod, Some, None};
use prelude::{Vec, Clone, AsSlice, SliceExt, CloneSliceExt, IteratorExt};
use prelude::{DoubleEndedIteratorExt, Str, StrExt, ToString, GenericPath};
use str;

macro_rules! t {
Expand Down
4 changes: 3 additions & 1 deletion src/libstd/path/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1121,8 +1121,10 @@ fn prefix_len(p: Option<PathPrefix>) -> uint {

#[cfg(test)]
mod tests {
use mem;
use super::*;
use prelude::Option::{mod, Some, None};
use prelude::{Vec, Clone, AsSlice, SliceExt, CloneSliceExt, IteratorExt};
use prelude::{DoubleEndedIteratorExt, Str, ToString, GenericPath};
use super::PathPrefix::*;
use super::parse_prefix;

Expand Down

6 comments on commit 4b92a5a

@bors
Copy link
Contributor

@bors bors commented on 4b92a5a Dec 27, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from pcwalton
at nrc@4b92a5a

@bors
Copy link
Contributor

@bors bors commented on 4b92a5a Dec 27, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging nick29581/rust/dxr-glob = 4b92a5a into auto

@bors
Copy link
Contributor

@bors bors commented on 4b92a5a Dec 27, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

status: {"merge_sha": "3c60bc02ce6de2823d0b837f90d5db0077fce6f7"}

@bors
Copy link
Contributor

@bors bors commented on 4b92a5a Dec 27, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nick29581/rust/dxr-glob = 4b92a5a merged ok, testing candidate = 3c60bc0

@bors
Copy link
Contributor

@bors bors commented on 4b92a5a Dec 27, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 3c60bc0

Please sign in to comment.