Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 8 pull requests #35163

Merged
merged 18 commits into from
Aug 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
1f86005
Use "x86-64" as the target CPU for NetBSD and Bitrig on amd64.
jakllsch Jul 25, 2016
ca25966
Reduce git clone --depth from 50 to 1
dns2utf8 Jul 28, 2016
990f193
Merge remote-tracking branch 'upstream/master' into remaining_cpu_x86-64
jakllsch Jul 28, 2016
2eea1f3
Rewrite `slice::chunks` doc example to not require printing.
frewsxcv Jul 31, 2016
a80d329
Don't gate methods `Fn(Mut,Once)::call(mut,once)` with feature `unbox…
petrochenkov Jul 13, 2016
aaf8a6e
tcp-stress-test: Factor out thread count as constant.
the-kenny Jul 30, 2016
d1f341d
rustc_trans: apply the debug location for the MIR Assert panic call.
eddyb Jul 31, 2016
3ea293d
tcp-stress-test.rs: Only spawn 200 threads.
the-kenny Aug 1, 2016
d5a5149
Move caching of HIR-inlining into CStore in order to avoid duplicatin…
michaelwoerister Jul 26, 2016
d7a0440
Remove CMake workaround
sanxiyn Aug 1, 2016
054d489
Rollup merge of #34802 - petrochenkov:call, r=eddyb
sanxiyn Aug 1, 2016
758333a
Rollup merge of #35033 - jakllsch:remaining_cpu_x86-64, r=alexcrichton
sanxiyn Aug 1, 2016
05a2d39
Rollup merge of #35085 - dns2utf8:git_clone_depth, r=alexcrichton
sanxiyn Aug 1, 2016
518524d
Rollup merge of #35114 - michaelwoerister:inline-meta-to-hir-map, r=e…
sanxiyn Aug 1, 2016
2effa89
Rollup merge of #35134 - frewsxcv:slice-chunks, r=GuillaumeGomez
sanxiyn Aug 1, 2016
a790fbc
Rollup merge of #35140 - the-kenny:tcp-stress-test-const-thread-count…
sanxiyn Aug 1, 2016
dc63b3a
Rollup merge of #35141 - eddyb:assert-mir-debug, r=nagisa
sanxiyn Aug 1, 2016
5fb13cf
Rollup merge of #35157 - sanxiyn:remove-workaround, r=eddyb
sanxiyn Aug 1, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ services:
# our configure script, so disable auto submodule management.
git:
submodules: false
depth: 1

before_install:
- docker build -t rust -f src/etc/Dockerfile src/etc
Expand Down
6 changes: 0 additions & 6 deletions src/etc/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,5 @@ RUN apt-get update && apt-get -y install \
libedit-dev zlib1g-dev \
llvm-3.7-tools cmake

# When we compile compiler-rt we pass it the llvm-config we just installed on
# the system, but unfortunately it doesn't infer correctly where
# LLVMConfig.cmake is so we need to coerce it a bit...
RUN mkdir -p /usr/lib/llvm-3.7/build/share/llvm
RUN ln -s /usr/share/llvm-3.7/cmake /usr/lib/llvm-3.7/build/share/llvm/cmake

RUN mkdir /build
WORKDIR /build
1 change: 0 additions & 1 deletion src/libcollections/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
#![feature(specialization)]
#![feature(staged_api)]
#![feature(step_by)]
#![feature(unboxed_closures)]
#![feature(unicode)]
#![feature(unique)]
#![feature(unsafe_no_drop_flag)]
Expand Down
16 changes: 7 additions & 9 deletions src/libcollections/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,15 +577,13 @@ impl<T> [T] {
///
/// # Example
///
/// Print the slice two elements at a time (i.e. `[1,2]`,
/// `[3,4]`, `[5]`):
///
/// ```rust
/// let v = &[1, 2, 3, 4, 5];
///
/// for chunk in v.chunks(2) {
/// println!("{:?}", chunk);
/// }
/// ```
/// let slice = ['l', 'o', 'r', 'e', 'm'];
/// let mut iter = slice.chunks(2);
/// assert_eq!(iter.next().unwrap(), &['l', 'o']);
/// assert_eq!(iter.next().unwrap(), &['r', 'e']);
/// assert_eq!(iter.next().unwrap(), &['m']);
/// assert!(iter.next().is_none());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
Expand Down
1 change: 0 additions & 1 deletion src/libcoretest/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#![feature(step_by)]
#![feature(test)]
#![feature(try_from)]
#![feature(unboxed_closures)]
#![feature(unicode)]
#![feature(unique)]

Expand Down
3 changes: 2 additions & 1 deletion src/librustc/hir/intravisit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ pub fn walk_vis<'v, V: Visitor<'v>>(visitor: &mut V, vis: &'v Visibility) {
}
}

#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug)]
#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug, PartialEq, Eq)]
pub struct IdRange {
pub min: NodeId,
pub max: NodeId,
Expand All @@ -893,6 +893,7 @@ impl IdRange {
self.min = cmp::min(self.min, id);
self.max = cmp::max(self.max, id + 1);
}

}


Expand Down
62 changes: 57 additions & 5 deletions src/librustc/hir/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ use hir::print as pprust;

use arena::TypedArena;
use std::cell::RefCell;
use std::cmp;
use std::io;
use std::mem;

Expand Down Expand Up @@ -127,7 +128,10 @@ impl<'ast> MapEntry<'ast> {
EntryStructCtor(id, _) => id,
EntryLifetime(id, _) => id,
EntryTyParam(id, _) => id,
_ => return None

NotPresent |
RootCrate |
RootInlinedParent(_) => return None,
})
}

Expand Down Expand Up @@ -196,6 +200,10 @@ pub struct Map<'ast> {
map: RefCell<Vec<MapEntry<'ast>>>,

definitions: RefCell<Definitions>,

/// All NodeIds that are numerically greater or equal to this value come
/// from inlined items.
local_node_id_watermark: NodeId,
}

impl<'ast> Map<'ast> {
Expand Down Expand Up @@ -550,6 +558,13 @@ impl<'ast> Map<'ast> {
}
}

pub fn expect_inlined_item(&self, id: NodeId) -> &'ast InlinedItem {
match self.find_entry(id) {
Some(RootInlinedParent(inlined_item)) => inlined_item,
_ => bug!("expected inlined item, found {}", self.node_to_string(id)),
}
}

/// Returns the name associated with the given NodeId's AST.
pub fn name(&self, id: NodeId) -> Name {
match self.get(id) {
Expand Down Expand Up @@ -649,6 +664,10 @@ impl<'ast> Map<'ast> {
pub fn node_to_user_string(&self, id: NodeId) -> String {
node_id_to_string(self, id, false)
}

pub fn is_inlined(&self, id: NodeId) -> bool {
id >= self.local_node_id_watermark
}
}

pub struct NodesMatchingSuffix<'a, 'ast:'a> {
Expand Down Expand Up @@ -765,13 +784,37 @@ pub trait FoldOps {
}

/// A Folder that updates IDs and Span's according to fold_ops.
struct IdAndSpanUpdater<F> {
fold_ops: F
pub struct IdAndSpanUpdater<F> {
fold_ops: F,
min_id_assigned: NodeId,
max_id_assigned: NodeId,
}

impl<F: FoldOps> IdAndSpanUpdater<F> {
pub fn new(fold_ops: F) -> IdAndSpanUpdater<F> {
IdAndSpanUpdater {
fold_ops: fold_ops,
min_id_assigned: ::std::u32::MAX,
max_id_assigned: ::std::u32::MIN,
}
}

pub fn id_range(&self) -> intravisit::IdRange {
intravisit::IdRange {
min: self.min_id_assigned,
max: self.max_id_assigned + 1,
}
}
}

impl<F: FoldOps> Folder for IdAndSpanUpdater<F> {
fn new_id(&mut self, id: NodeId) -> NodeId {
self.fold_ops.new_id(id)
let id = self.fold_ops.new_id(id);

self.min_id_assigned = cmp::min(self.min_id_assigned, id);
self.max_id_assigned = cmp::max(self.max_id_assigned, id);

id
}

fn new_span(&mut self, span: Span) -> Span {
Expand Down Expand Up @@ -802,11 +845,14 @@ pub fn map_crate<'ast>(forest: &'ast mut Forest,
entries, vector_length, (entries as f64 / vector_length as f64) * 100.);
}

let local_node_id_watermark = map.len() as NodeId;

Map {
forest: forest,
dep_graph: forest.dep_graph.clone(),
map: RefCell::new(map),
definitions: RefCell::new(definitions),
local_node_id_watermark: local_node_id_watermark
}
}

Expand All @@ -818,7 +864,7 @@ pub fn map_decoded_item<'ast, F: FoldOps>(map: &Map<'ast>,
ii: InlinedItem,
fold_ops: F)
-> &'ast InlinedItem {
let mut fld = IdAndSpanUpdater { fold_ops: fold_ops };
let mut fld = IdAndSpanUpdater::new(fold_ops);
let ii = match ii {
II::Item(i) => II::Item(i.map(|i| fld.fold_item(i))),
II::TraitItem(d, ti) => {
Expand All @@ -835,6 +881,12 @@ pub fn map_decoded_item<'ast, F: FoldOps>(map: &Map<'ast>,
let ii = map.forest.inlined_items.alloc(ii);
let ii_parent_id = fld.new_id(DUMMY_NODE_ID);

// Assert that the ii_parent_id is the last NodeId in our reserved range
assert!(ii_parent_id == fld.max_id_assigned);
// Assert that we did not violate the invariant that all inlined HIR items
// have NodeIds greater than or equal to `local_node_id_watermark`
assert!(fld.min_id_assigned >= map.local_node_id_watermark);

let defs = &mut *map.definitions.borrow_mut();
let mut def_collector = DefCollector::extend(ii_parent_id,
parent_def_path.clone(),
Expand Down
22 changes: 14 additions & 8 deletions src/librustc/middle/cstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,6 @@ pub struct ChildItem {
pub vis: ty::Visibility,
}

pub enum FoundAst<'ast> {
Found(&'ast InlinedItem),
FoundParent(DefId, &'ast hir::Item),
NotFound,
}

#[derive(Copy, Clone, Debug)]
pub struct ExternCrate {
/// def_id of an `extern crate` in the current crate that caused
Expand Down Expand Up @@ -250,7 +244,10 @@ pub trait CrateStore<'tcx> {

// misc. metadata
fn maybe_get_item_ast<'a>(&'tcx self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId)
-> FoundAst<'tcx>;
-> Option<(&'tcx InlinedItem, ast::NodeId)>;
fn local_node_for_inlined_defid(&'tcx self, def_id: DefId) -> Option<ast::NodeId>;
fn defid_for_inlined_node(&'tcx self, node_id: ast::NodeId) -> Option<DefId>;

fn maybe_get_item_mir<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId)
-> Option<Mir<'tcx>>;
fn is_item_mir_available(&self, def: DefId) -> bool;
Expand Down Expand Up @@ -447,7 +444,16 @@ impl<'tcx> CrateStore<'tcx> for DummyCrateStore {

// misc. metadata
fn maybe_get_item_ast<'a>(&'tcx self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId)
-> FoundAst<'tcx> { bug!("maybe_get_item_ast") }
-> Option<(&'tcx InlinedItem, ast::NodeId)> {
bug!("maybe_get_item_ast")
}
fn local_node_for_inlined_defid(&'tcx self, def_id: DefId) -> Option<ast::NodeId> {
bug!("local_node_for_inlined_defid")
}
fn defid_for_inlined_node(&'tcx self, node_id: ast::NodeId) -> Option<DefId> {
bug!("defid_for_inlined_node")
}

fn maybe_get_item_mir<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId)
-> Option<Mir<'tcx>> { bug!("maybe_get_item_mir") }
fn is_item_mir_available(&self, def: DefId) -> bool {
Expand Down
1 change: 1 addition & 0 deletions src/librustc_back/target/x86_64_rumprun_netbsd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use target::{Target, TargetResult};

pub fn target() -> TargetResult {
let mut base = super::netbsd_base::opts();
base.cpu = "x86-64".to_string();
base.pre_link_args.push("-m64".to_string());
base.linker = "x86_64-rumprun-netbsd-gcc".to_string();
base.ar = "x86_64-rumprun-netbsd-ar".to_string();
Expand Down
1 change: 1 addition & 0 deletions src/librustc_back/target/x86_64_unknown_bitrig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use target::{Target, TargetResult};

pub fn target() -> TargetResult {
let mut base = super::bitrig_base::opts();
base.cpu = "x86-64".to_string();
base.max_atomic_width = 64;
base.pre_link_args.push("-m64".to_string());

Expand Down
1 change: 1 addition & 0 deletions src/librustc_back/target/x86_64_unknown_netbsd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use target::{Target, TargetResult};

pub fn target() -> TargetResult {
let mut base = super::netbsd_base::opts();
base.cpu = "x86-64".to_string();
base.max_atomic_width = 64;
base.pre_link_args.push("-m64".to_string());

Expand Down
12 changes: 6 additions & 6 deletions src/librustc_const_eval/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use self::EvalHint::*;

use rustc::hir::map as ast_map;
use rustc::hir::map::blocks::FnLikeNode;
use rustc::middle::cstore::{self, InlinedItem};
use rustc::middle::cstore::InlinedItem;
use rustc::traits;
use rustc::hir::def::{Def, PathResolution};
use rustc::hir::def_id::DefId;
Expand Down Expand Up @@ -142,13 +142,13 @@ pub fn lookup_const_by_id<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
}
let mut used_substs = false;
let expr_ty = match tcx.sess.cstore.maybe_get_item_ast(tcx, def_id) {
cstore::FoundAst::Found(&InlinedItem::Item(ref item)) => match item.node {
Some((&InlinedItem::Item(ref item), _)) => match item.node {
hir::ItemConst(ref ty, ref const_expr) => {
Some((&**const_expr, tcx.ast_ty_to_prim_ty(ty)))
},
_ => None
},
cstore::FoundAst::Found(&InlinedItem::TraitItem(trait_id, ref ti)) => match ti.node {
Some((&InlinedItem::TraitItem(trait_id, ref ti), _)) => match ti.node {
hir::ConstTraitItem(_, _) => {
used_substs = true;
if let Some(substs) = substs {
Expand All @@ -163,7 +163,7 @@ pub fn lookup_const_by_id<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
}
_ => None
},
cstore::FoundAst::Found(&InlinedItem::ImplItem(_, ref ii)) => match ii.node {
Some((&InlinedItem::ImplItem(_, ref ii), _)) => match ii.node {
hir::ImplItemKind::Const(ref ty, ref expr) => {
Some((&**expr, tcx.ast_ty_to_prim_ty(ty)))
},
Expand Down Expand Up @@ -198,8 +198,8 @@ fn inline_const_fn_from_external_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
}

let fn_id = match tcx.sess.cstore.maybe_get_item_ast(tcx, def_id) {
cstore::FoundAst::Found(&InlinedItem::Item(ref item)) => Some(item.id),
cstore::FoundAst::Found(&InlinedItem::ImplItem(_, ref item)) => Some(item.id),
Some((&InlinedItem::Item(ref item), _)) => Some(item.id),
Some((&InlinedItem::ImplItem(_, ref item), _)) => Some(item.id),
_ => None
};
tcx.extern_const_fns.borrow_mut().insert(def_id,
Expand Down
1 change: 0 additions & 1 deletion src/librustc_driver/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#![feature(set_stdio)]
#![feature(staged_api)]
#![feature(question_mark)]
#![feature(unboxed_closures)]

extern crate arena;
extern crate flate;
Expand Down
Loading