Skip to content

Rollup of 13 pull requests #50686

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

Merged
merged 25 commits into from
May 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
bcdb67b
Update derive-new
Eijebong May 8, 2018
da02fad
Update assert_cli
Eijebong May 8, 2018
e333725
use fmt::Result where applicable
llogiq May 8, 2018
9d7eda9
Mention that fs::canonicalize makes paths absolute.
Screwtapello May 10, 2018
8720314
fs::canonicalize has some important portability concerns.
Screwtapello May 10, 2018
ca32340
Allocate Symbol strings from an arena
Zoxc May 10, 2018
4d8d0a6
const time
rizakrko May 8, 2018
89a8f2c
Remove shared access to DepGraph::work_products
whitfin May 9, 2018
d23cbc3
Catch a bad reference in use clauses
whitfin May 9, 2018
5c83422
Neaten a couple of long signatures
whitfin May 9, 2018
0a4fbe3
Update naming in line with PR comments
whitfin May 9, 2018
8402a58
Update an old method name in debug logging
whitfin May 9, 2018
60f9fc2
Rollup merge of #50544 - Eijebong:cleanup_deps, r=alexcrichton
Mark-Simulacrum May 12, 2018
3603d24
Rollup merge of #50545 - rizakrko:const_time, r=oli-obk
Mark-Simulacrum May 12, 2018
d7f5e1f
Rollup merge of #50550 - llogiq:fmt-result, r=petrochenkov
Mark-Simulacrum May 12, 2018
b9c9fac
Rollup merge of #50558 - whitfin:issue-50500, r=michaelwoerister
Mark-Simulacrum May 12, 2018
bf832c2
Rollup merge of #50602 - Screwtapello:update-canonicalize-docs, r=cra…
Mark-Simulacrum May 12, 2018
575ac94
Rollup merge of #50607 - Zoxc:symbol-arena, r=michaelwoerister
Mark-Simulacrum May 12, 2018
bf6804b
fs::write: Add example writing a &str
adevore May 10, 2018
5d015e1
Do not silently truncate offsets for `read_at`/`write_at` on emscripten
tbu- May 12, 2018
9d690d4
AppVeyor: Dump crash log on failure.
kennytm May 11, 2018
ae41d6c
Ignore non .rs files for tidy libcoretest
varkor May 11, 2018
bd44177
Display the name of the failed file in tidy/libcoretest
varkor May 11, 2018
2885632
rustc: Allow an edition's feature on that edition
alexcrichton May 11, 2018
da79ff3
rustc: Only suggest deleting `extern crate` if it works
alexcrichton May 11, 2018
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
5 changes: 5 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ test_script:
- set NO_CCACHE=1
- sh src/ci/run.sh

on_failure:
# Dump crash log
- set PATH=%PATH%;"C:\Program Files (x86)\Windows Kits\10\Debuggers\X64"
- if exist %LOCALAPPDATA%\CrashDumps for %%f in (%LOCALAPPDATA%\CrashDumps\*) do cdb -c "k;q" -G -z "%%f"

branches:
only:
- auto
Expand Down
132 changes: 16 additions & 116 deletions src/Cargo.lock

Large diffs are not rendered by default.

42 changes: 40 additions & 2 deletions src/libcore/tests/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,43 @@ fn creation() {
#[test]
fn secs() {
assert_eq!(Duration::new(0, 0).as_secs(), 0);
assert_eq!(Duration::new(0, 500_000_005).as_secs(), 0);
assert_eq!(Duration::new(0, 1_050_000_001).as_secs(), 1);
assert_eq!(Duration::from_secs(1).as_secs(), 1);
assert_eq!(Duration::from_millis(999).as_secs(), 0);
assert_eq!(Duration::from_millis(1001).as_secs(), 1);
assert_eq!(Duration::from_micros(999_999).as_secs(), 0);
assert_eq!(Duration::from_micros(1_000_001).as_secs(), 1);
assert_eq!(Duration::from_nanos(999_999_999).as_secs(), 0);
assert_eq!(Duration::from_nanos(1_000_000_001).as_secs(), 1);
}

#[test]
fn millis() {
assert_eq!(Duration::new(0, 0).subsec_millis(), 0);
assert_eq!(Duration::new(0, 500_000_005).subsec_millis(), 500);
assert_eq!(Duration::new(0, 1_050_000_001).subsec_millis(), 50);
assert_eq!(Duration::from_secs(1).subsec_millis(), 0);
assert_eq!(Duration::from_millis(999).subsec_millis(), 999);
assert_eq!(Duration::from_millis(1001).subsec_millis(), 1);
assert_eq!(Duration::from_micros(999_999).subsec_millis(), 999);
assert_eq!(Duration::from_micros(1_001_000).subsec_millis(), 1);
assert_eq!(Duration::from_nanos(999_999_999).subsec_millis(), 999);
assert_eq!(Duration::from_nanos(1_001_000_000).subsec_millis(), 1);
}

#[test]
fn micros() {
assert_eq!(Duration::new(0, 0).subsec_micros(), 0);
assert_eq!(Duration::new(0, 500_000_005).subsec_micros(), 500_000);
assert_eq!(Duration::new(0, 1_050_000_001).subsec_micros(), 50_000);
assert_eq!(Duration::from_secs(1).subsec_micros(), 0);
assert_eq!(Duration::from_millis(999).subsec_micros(), 999_000);
assert_eq!(Duration::from_millis(1001).subsec_micros(), 1_000);
assert_eq!(Duration::from_micros(999_999).subsec_micros(), 999_999);
assert_eq!(Duration::from_micros(1_000_001).subsec_micros(), 1);
assert_eq!(Duration::from_nanos(999_999_999).subsec_micros(), 999_999);
assert_eq!(Duration::from_nanos(1_000_001_000).subsec_micros(), 1);
}

#[test]
Expand All @@ -34,8 +68,12 @@ fn nanos() {
assert_eq!(Duration::new(0, 5).subsec_nanos(), 5);
assert_eq!(Duration::new(0, 1_000_000_001).subsec_nanos(), 1);
assert_eq!(Duration::from_secs(1).subsec_nanos(), 0);
assert_eq!(Duration::from_millis(999).subsec_nanos(), 999 * 1_000_000);
assert_eq!(Duration::from_millis(1001).subsec_nanos(), 1 * 1_000_000);
assert_eq!(Duration::from_millis(999).subsec_nanos(), 999_000_000);
assert_eq!(Duration::from_millis(1001).subsec_nanos(), 1_000_000);
assert_eq!(Duration::from_micros(999_999).subsec_nanos(), 999_999_000);
assert_eq!(Duration::from_micros(1_000_001).subsec_nanos(), 1000);
assert_eq!(Duration::from_nanos(999_999_999).subsec_nanos(), 999_999_999);
assert_eq!(Duration::from_nanos(1_000_000_001).subsec_nanos(), 1);
}

#[test]
Expand Down
12 changes: 8 additions & 4 deletions src/libcore/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,9 @@ impl Duration {
///
/// [`subsec_nanos`]: #method.subsec_nanos
#[stable(feature = "duration", since = "1.3.0")]
#[rustc_const_unstable(feature="duration_getters")]
#[inline]
pub fn as_secs(&self) -> u64 { self.secs }
pub const fn as_secs(&self) -> u64 { self.secs }

/// Returns the fractional part of this `Duration`, in milliseconds.
///
Expand All @@ -222,8 +223,9 @@ impl Duration {
/// assert_eq!(duration.subsec_millis(), 432);
/// ```
#[stable(feature = "duration_extras", since = "1.27.0")]
#[rustc_const_unstable(feature="duration_getters")]
#[inline]
pub fn subsec_millis(&self) -> u32 { self.nanos / NANOS_PER_MILLI }
pub const fn subsec_millis(&self) -> u32 { self.nanos / NANOS_PER_MILLI }

/// Returns the fractional part of this `Duration`, in microseconds.
///
Expand All @@ -241,8 +243,9 @@ impl Duration {
/// assert_eq!(duration.subsec_micros(), 234_567);
/// ```
#[stable(feature = "duration_extras", since = "1.27.0")]
#[rustc_const_unstable(feature="duration_getters")]
#[inline]
pub fn subsec_micros(&self) -> u32 { self.nanos / NANOS_PER_MICRO }
pub const fn subsec_micros(&self) -> u32 { self.nanos / NANOS_PER_MICRO }

/// Returns the fractional part of this `Duration`, in nanoseconds.
///
Expand All @@ -260,8 +263,9 @@ impl Duration {
/// assert_eq!(duration.subsec_nanos(), 10_000_000);
/// ```
#[stable(feature = "duration", since = "1.3.0")]
#[rustc_const_unstable(feature="duration_getters")]
#[inline]
pub fn subsec_nanos(&self) -> u32 { self.nanos }
pub const fn subsec_nanos(&self) -> u32 { self.nanos }

/// Checked `Duration` addition. Computes `self + other`, returning [`None`]
/// if overflow occurred.
Expand Down
25 changes: 1 addition & 24 deletions src/librustc/dep_graph/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
use rustc_data_structures::small_vec::SmallVec;
use rustc_data_structures::sync::{Lrc, RwLock, ReadGuard, Lock};
use rustc_data_structures::sync::{Lrc, Lock};
use std::env;
use std::hash::Hash;
use ty::{self, TyCtxt};
Expand Down Expand Up @@ -80,9 +80,6 @@ struct DepGraphData {
/// this map. We can later look for and extract that data.
previous_work_products: FxHashMap<WorkProductId, WorkProduct>,

/// Work-products that we generate in this run.
work_products: RwLock<FxHashMap<WorkProductId, WorkProduct>>,

dep_node_debug: Lock<FxHashMap<DepNode, String>>,

// Used for testing, only populated when -Zquery-dep-graph is specified.
Expand All @@ -103,7 +100,6 @@ impl DepGraph {
DepGraph {
data: Some(Lrc::new(DepGraphData {
previous_work_products: prev_work_products,
work_products: RwLock::new(FxHashMap()),
dep_node_debug: Lock::new(FxHashMap()),
current: Lock::new(CurrentDepGraph::new()),
previous: prev_graph,
Expand Down Expand Up @@ -462,19 +458,6 @@ impl DepGraph {
self.data.as_ref().unwrap().previous.node_to_index(dep_node)
}

/// Indicates that we created the given work-product in this run
/// for `v`. This record will be preserved and loaded in the next
/// run.
pub fn insert_work_product(&self, v: &WorkProductId, data: WorkProduct) {
debug!("insert_work_product({:?}, {:?})", v, data);
self.data
.as_ref()
.unwrap()
.work_products
.borrow_mut()
.insert(v.clone(), data);
}

/// Check whether a previous work product exists for `v` and, if
/// so, return the path that leads to it. Used to skip doing work.
pub fn previous_work_product(&self, v: &WorkProductId) -> Option<WorkProduct> {
Expand All @@ -485,12 +468,6 @@ impl DepGraph {
})
}

/// Access the map of work-products created during this run. Only
/// used during saving of the dep-graph.
pub fn work_products(&self) -> ReadGuard<FxHashMap<WorkProductId, WorkProduct>> {
self.data.as_ref().unwrap().work_products.borrow()
}

/// Access the map of work-products created during the cached run. Only
/// used during saving of the dep-graph.
pub fn previous_work_products(&self) -> &FxHashMap<WorkProductId, WorkProduct> {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ich/fingerprint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl Fingerprint {
}

impl ::std::fmt::Display for Fingerprint {
fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error> {
fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
write!(formatter, "{:x}-{:x}", self.0, self.1)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ impl<Node: Idx> DominatorTree<Node> {
}

impl<Node: Idx> fmt::Debug for DominatorTree<Node> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt::Debug::fmt(&DominatorTreeNode {
tree: self,
node: self.root,
Expand All @@ -190,7 +190,7 @@ struct DominatorTreeNode<'tree, Node: Idx> {
}

impl<'tree, Node: Idx> fmt::Debug for DominatorTreeNode<'tree, Node> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
let subtrees: Vec<_> = self.tree
.children(self.node)
.iter()
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_data_structures/owning_ref/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ impl<O, T: ?Sized> Debug for OwningRef<O, T>
where O: Debug,
T: Debug,
{
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f,
"OwningRef {{ owner: {:?}, reference: {:?} }}",
self.owner(),
Expand All @@ -1014,7 +1014,7 @@ impl<O, T: ?Sized> Debug for OwningRefMut<O, T>
where O: Debug,
T: Debug,
{
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f,
"OwningRefMut {{ owner: {:?}, reference: {:?} }}",
self.owner(),
Expand Down Expand Up @@ -1047,7 +1047,7 @@ unsafe impl<O, T: ?Sized> Sync for OwningRefMut<O, T>
where O: Sync, for<'a> (&'a mut T): Sync {}

impl Debug for Erased {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "<Erased>",)
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_errors/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ impl FatalError {
}

impl fmt::Display for FatalError {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "parser fatal error")
}
}
Expand All @@ -249,7 +249,7 @@ impl error::Error for FatalError {
pub struct ExplicitBug;

impl fmt::Display for ExplicitBug {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "parser internal bug")
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_incremental/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ pub use persist::dep_graph_tcx_init;
pub use persist::load_dep_graph;
pub use persist::load_query_result_cache;
pub use persist::LoadResult;
pub use persist::copy_cgu_workproducts_to_incr_comp_cache_dir;
pub use persist::save_dep_graph;
pub use persist::save_trans_partition;
pub use persist::save_work_products;
pub use persist::save_work_product_index;
pub use persist::in_incr_comp_dir;
pub use persist::prepare_session_directory;
pub use persist::finalize_session_directory;
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_incremental/persist/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ pub use self::load::load_dep_graph;
pub use self::load::load_query_result_cache;
pub use self::load::LoadResult;
pub use self::save::save_dep_graph;
pub use self::save::save_work_products;
pub use self::work_product::save_trans_partition;
pub use self::save::save_work_product_index;
pub use self::work_product::copy_cgu_workproducts_to_incr_comp_cache_dir;
pub use self::work_product::delete_workproduct_files;
21 changes: 10 additions & 11 deletions src/librustc_incremental/persist/save.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use rustc::dep_graph::{DepGraph, DepKind};
use rustc::dep_graph::{DepGraph, DepKind, WorkProduct, WorkProductId};
use rustc::session::Session;
use rustc::ty::TyCtxt;
use rustc::util::common::time;
Expand Down Expand Up @@ -55,22 +55,22 @@ pub fn save_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
})
}

pub fn save_work_products(sess: &Session, dep_graph: &DepGraph) {
pub fn save_work_product_index(sess: &Session,
dep_graph: &DepGraph,
new_work_products: FxHashMap<WorkProductId, WorkProduct>) {
if sess.opts.incremental.is_none() {
return;
}

debug!("save_work_products()");
debug!("save_work_product_index()");
dep_graph.assert_ignored();
let path = work_products_path(sess);
save_in(sess, path, |e| encode_work_products(dep_graph, e));
save_in(sess, path, |e| encode_work_product_index(&new_work_products, e));

// We also need to clean out old work-products, as not all of them are
// deleted during invalidation. Some object files don't change their
// content, they are just not needed anymore.
let new_work_products = dep_graph.work_products();
let previous_work_products = dep_graph.previous_work_products();

for (id, wp) in previous_work_products.iter() {
if !new_work_products.contains_key(id) {
work_product::delete_workproduct_files(sess, wp);
Expand Down Expand Up @@ -234,10 +234,9 @@ fn encode_dep_graph(tcx: TyCtxt,
Ok(())
}

fn encode_work_products(dep_graph: &DepGraph,
encoder: &mut Encoder) -> io::Result<()> {
let work_products: Vec<_> = dep_graph
.work_products()
fn encode_work_product_index(work_products: &FxHashMap<WorkProductId, WorkProduct>,
encoder: &mut Encoder) -> io::Result<()> {
let serialized_products: Vec<_> = work_products
.iter()
.map(|(id, work_product)| {
SerializedWorkProduct {
Expand All @@ -247,7 +246,7 @@ fn encode_work_products(dep_graph: &DepGraph,
})
.collect();

work_products.encode(encoder)
serialized_products.encode(encoder)
}

fn encode_query_cache(tcx: TyCtxt,
Expand Down
19 changes: 10 additions & 9 deletions src/librustc_incremental/persist/work_product.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,22 @@
//! This module contains files for saving intermediate work-products.

use persist::fs::*;
use rustc::dep_graph::{WorkProduct, WorkProductId, DepGraph, WorkProductFileKind};
use rustc::dep_graph::{WorkProduct, WorkProductId, WorkProductFileKind};
use rustc::session::Session;
use rustc::util::fs::link_or_copy;
use std::path::PathBuf;
use std::fs as std_fs;

pub fn save_trans_partition(sess: &Session,
dep_graph: &DepGraph,
cgu_name: &str,
files: &[(WorkProductFileKind, PathBuf)]) {
debug!("save_trans_partition({:?},{:?})",
pub fn copy_cgu_workproducts_to_incr_comp_cache_dir(
sess: &Session,
cgu_name: &str,
files: &[(WorkProductFileKind, PathBuf)]
) -> Option<(WorkProductId, WorkProduct)> {
debug!("copy_cgu_workproducts_to_incr_comp_cache_dir({:?},{:?})",
cgu_name,
files);
if sess.opts.incremental.is_none() {
return
return None
}
let work_product_id = WorkProductId::from_cgu_name(cgu_name);

Expand Down Expand Up @@ -53,16 +54,16 @@ pub fn save_trans_partition(sess: &Session,
})
.collect();
let saved_files = match saved_files {
None => return None,
Some(v) => v,
None => return,
};

let work_product = WorkProduct {
cgu_name: cgu_name.to_string(),
saved_files,
};

dep_graph.insert_work_product(&work_product_id, work_product);
Some((work_product_id, work_product))
}

pub fn delete_workproduct_files(sess: &Session, work_product: &WorkProduct) {
Expand Down
3 changes: 3 additions & 0 deletions src/librustc_lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1548,6 +1548,9 @@ impl LintPass for ExternCrate {

impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ExternCrate {
fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
if !cx.tcx.features().extern_absolute_paths {
return
}
if let hir::ItemExternCrate(ref orig) = it.node {
if it.attrs.iter().any(|a| a.check_name("macro_use")) {
return
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/borrow_check/nll/region_infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ impl<'tcx> RegionDefinition<'tcx> {
}

impl fmt::Debug for Constraint {
fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(
formatter,
"({:?}: {:?} @ {:?}) due to {:?}",
Expand Down
Loading