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 6 pull requests #41373

Merged
merged 20 commits into from
Apr 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
5a09d7c
Add `as_bytes()` for `FromUtf8Error`.
3Hren Mar 6, 2017
4cb9de4
fix: add feature to doc tests
3Hren Apr 8, 2017
0eecd51
refactor: add reason string
3Hren Apr 8, 2017
4cea3f7
docs: track newly introduced unstable feature
3Hren Apr 10, 2017
3ae20de
fix: add missing link in SUMMARY.md
3Hren Apr 11, 2017
1bc9e5d
Fix stdio descriptors in exec by removing cloexec if present. Use dup…
jackpot51 Apr 16, 2017
bbdf190
fix: remove `field_init_shorthand` from SUMMARY.md
3Hren Apr 17, 2017
1dbc72b
bootstrap: Don't workaround uname -m on Darwin
richo Apr 18, 2017
810e015
convert calls to `visit_all_item_likes_in_krate`
nikomatsakis Apr 18, 2017
3e473b1
use Lvalue helper functions in rustc_mir::shim
arielb1 Apr 18, 2017
ed3810b
lower `move_val_init` during MIR construction
arielb1 Apr 18, 2017
8388772
kill a bunch of one off tasks
nikomatsakis Apr 18, 2017
c842783
update `dep-graph-struct-signature` test case
nikomatsakis Apr 18, 2017
e46a8bd
std: Back out backtrace pruning logic
alexcrichton Mar 20, 2017
353bdb3
Rollup merge of #40290 - 3Hren:master, r=aturon
frewsxcv Apr 18, 2017
2e4b0d5
Rollup merge of #41353 - redox-os:master, r=alexcrichton
frewsxcv Apr 18, 2017
ddf4781
Rollup merge of #41356 - richo:darwin-no-cputype-hack, r=alexcrichton
frewsxcv Apr 18, 2017
ceaa55e
Rollup merge of #41360 - nikomatsakis:incr-comp-issue-40746-visitors,…
frewsxcv Apr 18, 2017
f448cdf
Rollup merge of #41361 - arielb1:move-mir-init, r=pnkfelix
frewsxcv Apr 18, 2017
20718c8
Rollup merge of #41364 - alexcrichton:less-backtrace-prune, r=petroch…
frewsxcv Apr 18, 2017
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
8 changes: 0 additions & 8 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,14 +404,6 @@ def build_triple(self):
raise Exception(err)
sys.exit(err)

# Darwin's `uname -s` lies and always returns i386. We have to use
# sysctl instead.
if ostype == 'Darwin' and cputype == 'i686':
args = ['sysctl', 'hw.optional.x86_64']
sysctl = subprocess.check_output(args).decode(default_encoding)
if ': 1' in sysctl:
cputype = 'x86_64'

# The goal here is to come up with the same triple as LLVM would,
# at least for the subset of platforms we're willing to target.
if ostype == 'Linux':
Expand Down
1 change: 1 addition & 0 deletions src/doc/unstable-book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
- [fmt_internals](fmt-internals.md)
- [fn_traits](fn-traits.md)
- [fnbox](fnbox.md)
- [from_utf8_error_as_bytes](from_utf8_error_as_bytes.md)
- [fundamental](fundamental.md)
- [fused](fused.md)
- [future_atomic_orderings](future-atomic-orderings.md)
Expand Down
7 changes: 7 additions & 0 deletions src/doc/unstable-book/src/from_utf8_error_as_bytes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# `from_utf8_error_as_bytes`

The tracking issue for this feature is: [#40895]

[#40895]: https://github.com/rust-lang/rust/issues/40895

------------------------
20 changes: 20 additions & 0 deletions src/libcollections/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1403,6 +1403,26 @@ impl String {
}

impl FromUtf8Error {
/// Returns a slice of [`u8`]s bytes that were attempted to convert to a `String`.
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// #![feature(from_utf8_error_as_bytes)]
/// // some invalid bytes, in a vector
/// let bytes = vec![0, 159];
///
/// let value = String::from_utf8(bytes);
///
/// assert_eq!(&[0, 159], value.unwrap_err().as_bytes());
/// ```
#[unstable(feature = "from_utf8_error_as_bytes", reason = "recently added", issue = "40895")]
pub fn as_bytes(&self) -> &[u8] {
&self.bytes[..]
}

/// Returns the bytes that were attempted to convert to a `String`.
///
/// This method is carefully constructed to avoid allocation. It will
Expand Down
40 changes: 0 additions & 40 deletions src/librustc/dep_graph/dep_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,30 +56,15 @@ pub enum DepNode<D: Clone + Debug> {
WorkProduct(Arc<WorkProductId>),

// Represents different phases in the compiler.
CollectLanguageItems,
ResolveLifetimes,
RegionResolveCrate,
PluginRegistrar,
StabilityIndex,
CollectItem(D),
CollectItemSig(D),
Coherence,
Resolve,
EntryPoint,
CheckEntryFn,
CoherenceCheckTrait(D),
CoherenceCheckImpl(D),
CoherenceOverlapCheck(D),
CoherenceOverlapCheckSpecial(D),
CoherenceOrphanCheck(D),
Variance,
WfCheck(D),
TypeckItemType(D),
UnusedTraitCheck,
CheckConst(D),
PrivacyAccessLevels(CrateNum),
IntrinsicCheck(D),
MatchCheck(D),

// Represents the MIR for a fn; also used as the task node for
// things read/modify that MIR.
Expand All @@ -91,14 +76,10 @@ pub enum DepNode<D: Clone + Debug> {
BorrowCheck(D),
RvalueCheck(D),
Reachability,
DeadCheck,
StabilityCheck(D),
LateLintCheck,
TransCrate,
TransCrateItem(D),
TransInlinedItem(D),
TransWriteMetadata,
LinkBinary,

// Nodes representing bits of computed IR in the tcx. Each shared
// table in the tcx (or elsewhere) maps to one of these
Expand Down Expand Up @@ -184,12 +165,10 @@ impl<D: Clone + Debug> DepNode<D> {
}

check! {
CollectItem,
BorrowCheck,
Hir,
HirBody,
TransCrateItem,
TypeckItemType,
AssociatedItems,
ItemSignature,
AssociatedItemDefIds,
Expand All @@ -211,24 +190,14 @@ impl<D: Clone + Debug> DepNode<D> {
BorrowCheckKrate => Some(BorrowCheckKrate),
MirKrate => Some(MirKrate),
TypeckBodiesKrate => Some(TypeckBodiesKrate),
CollectLanguageItems => Some(CollectLanguageItems),
ResolveLifetimes => Some(ResolveLifetimes),
RegionResolveCrate => Some(RegionResolveCrate),
PluginRegistrar => Some(PluginRegistrar),
StabilityIndex => Some(StabilityIndex),
Coherence => Some(Coherence),
Resolve => Some(Resolve),
EntryPoint => Some(EntryPoint),
CheckEntryFn => Some(CheckEntryFn),
Variance => Some(Variance),
UnusedTraitCheck => Some(UnusedTraitCheck),
PrivacyAccessLevels(k) => Some(PrivacyAccessLevels(k)),
Reachability => Some(Reachability),
DeadCheck => Some(DeadCheck),
LateLintCheck => Some(LateLintCheck),
TransCrate => Some(TransCrate),
TransWriteMetadata => Some(TransWriteMetadata),
LinkBinary => Some(LinkBinary),

// work product names do not need to be mapped, because
// they are always absolute.
Expand All @@ -237,26 +206,17 @@ impl<D: Clone + Debug> DepNode<D> {
Hir(ref d) => op(d).map(Hir),
HirBody(ref d) => op(d).map(HirBody),
MetaData(ref d) => op(d).map(MetaData),
CollectItem(ref d) => op(d).map(CollectItem),
CollectItemSig(ref d) => op(d).map(CollectItemSig),
CoherenceCheckTrait(ref d) => op(d).map(CoherenceCheckTrait),
CoherenceCheckImpl(ref d) => op(d).map(CoherenceCheckImpl),
CoherenceOverlapCheck(ref d) => op(d).map(CoherenceOverlapCheck),
CoherenceOverlapCheckSpecial(ref d) => op(d).map(CoherenceOverlapCheckSpecial),
CoherenceOrphanCheck(ref d) => op(d).map(CoherenceOrphanCheck),
WfCheck(ref d) => op(d).map(WfCheck),
TypeckItemType(ref d) => op(d).map(TypeckItemType),
CheckConst(ref d) => op(d).map(CheckConst),
IntrinsicCheck(ref d) => op(d).map(IntrinsicCheck),
MatchCheck(ref d) => op(d).map(MatchCheck),
Mir(ref d) => op(d).map(Mir),
MirShim(ref def_ids) => {
let def_ids: Option<Vec<E>> = def_ids.iter().map(op).collect();
def_ids.map(MirShim)
}
BorrowCheck(ref d) => op(d).map(BorrowCheck),
RvalueCheck(ref d) => op(d).map(RvalueCheck),
StabilityCheck(ref d) => op(d).map(StabilityCheck),
TransCrateItem(ref d) => op(d).map(TransCrateItem),
TransInlinedItem(ref d) => op(d).map(TransInlinedItem),
AssociatedItems(ref d) => op(d).map(AssociatedItems),
Expand Down
2 changes: 0 additions & 2 deletions src/librustc/middle/dead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// closely. The idea is that all reachable symbols are live, codes called
// from live codes are live, and everything else is dead.

use dep_graph::DepNode;
use hir::map as hir_map;
use hir::{self, PatKind};
use hir::intravisit::{self, Visitor, NestedVisitorMap};
Expand Down Expand Up @@ -594,7 +593,6 @@ impl<'a, 'tcx> Visitor<'tcx> for DeadVisitor<'a, 'tcx> {
}

pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
let _task = tcx.dep_graph.in_task(DepNode::DeadCheck);
let access_levels = &ty::queries::privacy_access_levels::get(tcx, DUMMY_SP, LOCAL_CRATE);
let krate = tcx.hir.krate();
let live_symbols = find_live(tcx, access_levels, krate);
Expand Down
3 changes: 0 additions & 3 deletions src/librustc/middle/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
// except according to those terms.


use dep_graph::DepNode;
use hir::map as hir_map;
use hir::def_id::{CRATE_DEF_INDEX};
use session::{config, Session};
Expand Down Expand Up @@ -57,8 +56,6 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for EntryContext<'a, 'tcx> {
}

pub fn find_entry_point(session: &Session, hir_map: &hir_map::Map) {
let _task = hir_map.dep_graph.in_task(DepNode::EntryPoint);

let any_exe = session.crate_types.borrow().iter().any(|ty| {
*ty == config::CrateTypeExecutable
});
Expand Down
3 changes: 1 addition & 2 deletions src/librustc/middle/intrinsicck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use dep_graph::DepNode;
use hir::def::Def;
use hir::def_id::DefId;
use infer::InferCtxt;
Expand All @@ -25,7 +24,7 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
let mut visitor = ItemVisitor {
tcx: tcx
};
tcx.visit_all_item_likes_in_krate(DepNode::IntrinsicCheck, &mut visitor.as_deep_visitor());
tcx.hir.krate().visit_all_item_likes(&mut visitor.as_deep_visitor());
}

struct ItemVisitor<'a, 'tcx: 'a> {
Expand Down
2 changes: 0 additions & 2 deletions src/librustc/middle/lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

pub use self::LangItem::*;

use dep_graph::DepNode;
use hir::map as hir_map;
use session::Session;
use hir::def_id::DefId;
Expand Down Expand Up @@ -236,7 +235,6 @@ pub fn extract(attrs: &[ast::Attribute]) -> Option<Symbol> {
pub fn collect_language_items(session: &Session,
map: &hir_map::Map)
-> LanguageItems {
let _task = map.dep_graph.in_task(DepNode::CollectLanguageItems);
let krate: &hir::Crate = map.krate();
let mut collector = LanguageItemCollector::new(session, map);
collector.collect(krate);
Expand Down
2 changes: 0 additions & 2 deletions src/librustc/middle/resolve_lifetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
//! used between functions, and they operate in a purely top-down
//! way. Therefore we break lifetime name resolution into a separate pass.

use dep_graph::DepNode;
use hir::map::Map;
use session::Session;
use hir::def::Def;
Expand Down Expand Up @@ -259,7 +258,6 @@ const ROOT_SCOPE: ScopeRef<'static> = &Scope::Root;
pub fn krate(sess: &Session,
hir_map: &Map)
-> Result<NamedRegionMap, usize> {
let _task = hir_map.dep_graph.in_task(DepNode::ResolveLifetimes);
let krate = hir_map.krate();
let mut map = NamedRegionMap {
defs: NodeMap(),
Expand Down
6 changes: 1 addition & 5 deletions src/librustc/middle/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

pub use self::StabilityLevel::*;

use dep_graph::DepNode;
use hir::map as hir_map;
use lint;
use hir::def::Def;
Expand Down Expand Up @@ -383,7 +382,6 @@ impl<'a, 'tcx> Index<'tcx> {
// Put the active features into a map for quick lookup
self.active_features = active_lib_features.iter().map(|&(ref s, _)| s.clone()).collect();

let _task = tcx.dep_graph.in_task(DepNode::StabilityIndex);
let krate = tcx.hir.krate();
let mut annotator = Annotator {
tcx: tcx,
Expand All @@ -397,7 +395,6 @@ impl<'a, 'tcx> Index<'tcx> {
}

pub fn new(hir_map: &hir_map::Map) -> Index<'tcx> {
let _task = hir_map.dep_graph.in_task(DepNode::StabilityIndex);
let krate = hir_map.krate();

let mut is_staged_api = false;
Expand All @@ -424,7 +421,7 @@ impl<'a, 'tcx> Index<'tcx> {
/// features and possibly prints errors.
pub fn check_unstable_api_usage<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
let mut checker = Checker { tcx: tcx };
tcx.visit_all_item_likes_in_krate(DepNode::StabilityCheck, &mut checker.as_deep_visitor());
tcx.hir.krate().visit_all_item_likes(&mut checker.as_deep_visitor());
}

struct Checker<'a, 'tcx: 'a> {
Expand Down Expand Up @@ -662,7 +659,6 @@ pub fn check_unused_or_stable_features<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
let access_levels = &ty::queries::privacy_access_levels::get(tcx, DUMMY_SP, LOCAL_CRATE);

if tcx.stability.borrow().staged_api[&LOCAL_CRATE] && tcx.sess.features.borrow().staged_api {
let _task = tcx.dep_graph.in_task(DepNode::StabilityIndex);
let krate = tcx.hir.krate();
let mut missing = MissingStabilityAnnotations {
tcx: tcx,
Expand Down
5 changes: 1 addition & 4 deletions src/librustc_const_eval/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ use _match::WitnessPreference::*;

use pattern::{Pattern, PatternContext, PatternError, PatternKind};

use rustc::dep_graph::DepNode;

use rustc::middle::expr_use_visitor::{ConsumeMode, Delegate, ExprUseVisitor};
use rustc::middle::expr_use_visitor::{LoanCause, MutateMode};
use rustc::middle::expr_use_visitor as euv;
Expand Down Expand Up @@ -56,8 +54,7 @@ impl<'a, 'tcx> Visitor<'tcx> for OuterVisitor<'a, 'tcx> {
}

pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
tcx.visit_all_item_likes_in_krate(DepNode::MatchCheck,
&mut OuterVisitor { tcx: tcx }.as_deep_visitor());
tcx.hir.krate().visit_all_item_likes(&mut OuterVisitor { tcx: tcx }.as_deep_visitor());
tcx.sess.abort_if_errors();
}

Expand Down
2 changes: 0 additions & 2 deletions src/librustc_driver/derive_registrar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use rustc::dep_graph::DepNode;
use rustc::hir::itemlikevisit::ItemLikeVisitor;
use rustc::hir::map::Map;
use rustc::hir;
use syntax::ast;
use syntax::attr;

pub fn find(hir_map: &Map) -> Option<ast::NodeId> {
let _task = hir_map.dep_graph.in_task(DepNode::PluginRegistrar);
let krate = hir_map.krate();

let mut finder = Finder { registrar: None };
Expand Down
7 changes: 4 additions & 3 deletions src/librustc_mir/build/expr/as_temp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
debug!("expr_as_temp(block={:?}, expr={:?})", block, expr);
let this = self;

if let ExprKind::Scope { .. } = expr.kind {
span_bug!(expr.span, "unexpected scope expression in as_temp: {:?}",
expr);
if let ExprKind::Scope { extent, value } = expr.kind {
return this.in_scope(extent, block, |this| {
this.as_temp(block, temp_lifetime, value)
});
}

let expr_ty = expr.ty.clone();
Expand Down
Loading