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 9 pull requests #57874

Closed
wants to merge 25 commits into from
Closed
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
1dc4e41
Manually inline a function that was only used once
oli-obk Jan 18, 2019
efda681
Allow evaluating trivial drop glue in constants
oli-obk Jan 18, 2019
a59eabb
Get rid of the fake stack frame
oli-obk Jan 14, 2019
db2978a
Bail out on overly generic substitutions
oli-obk Jan 14, 2019
f6da141
Span fixup
oli-obk Jan 14, 2019
2c57d1d
Add regression test
oli-obk Jan 14, 2019
b154234
don't call get_macro on proc-macro stubs
QuietMisdreavus Jan 22, 2019
b876694
add intra-doc link test to proc-macro test
QuietMisdreavus Jan 22, 2019
d4ee556
Follow naming scheme for "frame" methods
oli-obk Jan 23, 2019
8db59d4
Add os::fortanix_sgx::ffi module
Jan 23, 2019
0db2587
Don't export table by default in wasm
pepyakin Jan 23, 2019
b2dfd96
Fix race condition when emitting stored diagnostics
Zoxc Dec 22, 2018
39aa89b
Add a compile-fail test for `Drop` in constants in the presence of `O…
oli-obk Jan 23, 2019
31cd65f
Fix std::future::from_generator documentation
Aaron1011 Jan 23, 2019
f14d007
Add suggestion for incorrect field syntax.
davidtwco Jan 23, 2019
b12aa4f
Stabilize no_panic_pow
milesand Jan 24, 2019
b3cefbc
Rollup merge of #57066 - Zoxc:graph-race, r=michaelwoerister
Centril Jan 24, 2019
25f6171
Rollup merge of #57606 - oli-obk:shrink, r=RalfJung
Centril Jan 24, 2019
7fbecb6
Rollup merge of #57734 - oli-obk:fixes_and_cleanups, r=pnkfelix
Centril Jan 24, 2019
bbae978
Rollup merge of #57846 - QuietMisdreavus:proc-macro-links, r=Guillaum…
Centril Jan 24, 2019
eea9b2c
Rollup merge of #57860 - jethrogb:jb/sgx-os-ffi, r=joshtriplett
Centril Jan 24, 2019
b5628bb
Rollup merge of #57861 - pepyakin:wasm-dont-export-table, r=alexcrichton
Centril Jan 24, 2019
8470dad
Rollup merge of #57863 - davidtwco:issue-57684, r=estebank
Centril Jan 24, 2019
11fef00
Rollup merge of #57867 - Aaron1011:fix/gen-future-doc, r=Centril
Centril Jan 24, 2019
84dd79b
Rollup merge of #57873 - milesand:master, r=Centril
Centril Jan 24, 2019
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
24 changes: 8 additions & 16 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -847,13 +847,12 @@ overflow occurred.
Basic usage:

```
#![feature(no_panic_pow)]
", $Feature, "assert_eq!(8", stringify!($SelfT), ".checked_pow(2), Some(64));
assert_eq!(", stringify!($SelfT), "::max_value().checked_pow(2), None);",
$EndFeature, "
```"),

#[unstable(feature = "no_panic_pow", issue = "48320")]
#[stable(feature = "no_panic_pow", since = "1.34.0")]
#[inline]
pub fn checked_pow(self, mut exp: u32) -> Option<Self> {
let mut base = self;
Expand Down Expand Up @@ -966,15 +965,14 @@ saturating at the numeric bounds instead of overflowing.
Basic usage:

```
#![feature(no_panic_pow)]
", $Feature, "use std::", stringify!($SelfT), ";

assert_eq!((-4", stringify!($SelfT), ").saturating_pow(3), -64);
assert_eq!(", stringify!($SelfT), "::MIN.saturating_pow(2), ", stringify!($SelfT), "::MAX);
assert_eq!(", stringify!($SelfT), "::MIN.saturating_pow(3), ", stringify!($SelfT), "::MIN);",
$EndFeature, "
```"),
#[unstable(feature = "no_panic_pow", issue = "48320")]
#[stable(feature = "no_panic_pow", since = "1.34.0")]
#[inline]
pub fn saturating_pow(self, exp: u32) -> Self {
match self.checked_pow(exp) {
Expand Down Expand Up @@ -1297,13 +1295,12 @@ wrapping around at the boundary of the type.
Basic usage:

```
#![feature(no_panic_pow)]
", $Feature, "assert_eq!(3", stringify!($SelfT), ".wrapping_pow(4), 81);
assert_eq!(3i8.wrapping_pow(5), -13);
assert_eq!(3i8.wrapping_pow(6), -39);",
$EndFeature, "
```"),
#[unstable(feature = "no_panic_pow", issue = "48320")]
#[stable(feature = "no_panic_pow", since = "1.34.0")]
#[inline]
pub fn wrapping_pow(self, mut exp: u32) -> Self {
let mut base = self;
Expand Down Expand Up @@ -1669,12 +1666,11 @@ whether an overflow happened.
Basic usage:

```
#![feature(no_panic_pow)]
", $Feature, "assert_eq!(3", stringify!($SelfT), ".overflowing_pow(4), (81, false));
assert_eq!(3i8.overflowing_pow(5), (-13, true));",
$EndFeature, "
```"),
#[unstable(feature = "no_panic_pow", issue = "48320")]
#[stable(feature = "no_panic_pow", since = "1.34.0")]
#[inline]
pub fn overflowing_pow(self, mut exp: u32) -> (Self, bool) {
let mut base = self;
Expand Down Expand Up @@ -2789,11 +2785,10 @@ overflow occurred.
Basic usage:

```
#![feature(no_panic_pow)]
", $Feature, "assert_eq!(2", stringify!($SelfT), ".checked_pow(5), Some(32));
assert_eq!(", stringify!($SelfT), "::max_value().checked_pow(2), None);", $EndFeature, "
```"),
#[unstable(feature = "no_panic_pow", issue = "48320")]
#[stable(feature = "no_panic_pow", since = "1.34.0")]
#[inline]
pub fn checked_pow(self, mut exp: u32) -> Option<Self> {
let mut base = self;
Expand Down Expand Up @@ -2893,14 +2888,13 @@ saturating at the numeric bounds instead of overflowing.
Basic usage:

```
#![feature(no_panic_pow)]
", $Feature, "use std::", stringify!($SelfT), ";

assert_eq!(4", stringify!($SelfT), ".saturating_pow(3), 64);
assert_eq!(", stringify!($SelfT), "::MAX.saturating_pow(2), ", stringify!($SelfT), "::MAX);",
$EndFeature, "
```"),
#[unstable(feature = "no_panic_pow", issue = "48320")]
#[stable(feature = "no_panic_pow", since = "1.34.0")]
#[inline]
pub fn saturating_pow(self, exp: u32) -> Self {
match self.checked_pow(exp) {
Expand Down Expand Up @@ -3178,11 +3172,10 @@ wrapping around at the boundary of the type.
Basic usage:

```
#![feature(no_panic_pow)]
", $Feature, "assert_eq!(3", stringify!($SelfT), ".wrapping_pow(5), 243);
assert_eq!(3u8.wrapping_pow(6), 217);", $EndFeature, "
```"),
#[unstable(feature = "no_panic_pow", issue = "48320")]
#[stable(feature = "no_panic_pow", since = "1.34.0")]
#[inline]
pub fn wrapping_pow(self, mut exp: u32) -> Self {
let mut base = self;
Expand Down Expand Up @@ -3497,11 +3490,10 @@ whether an overflow happened.
Basic usage:

```
#![feature(no_panic_pow)]
", $Feature, "assert_eq!(3", stringify!($SelfT), ".overflowing_pow(5), (243, false));
assert_eq!(3u8.overflowing_pow(6), (217, true));", $EndFeature, "
```"),
#[unstable(feature = "no_panic_pow", issue = "48320")]
#[stable(feature = "no_panic_pow", since = "1.34.0")]
#[inline]
pub fn overflowing_pow(self, mut exp: u32) -> (Self, bool) {
let mut base = self;
Expand Down
84 changes: 63 additions & 21 deletions src/librustc/dep_graph/graph.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use errors::DiagnosticBuilder;
use errors::{Diagnostic, DiagnosticBuilder};
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
Expand All @@ -9,6 +9,7 @@ use std::hash::Hash;
use std::collections::hash_map::Entry;
use ty::{self, TyCtxt};
use util::common::{ProfileQueriesMsg, profq_msg};
use parking_lot::{Mutex, Condvar};

use ich::{StableHashingContext, StableHashingContextProvider, Fingerprint};

Expand Down Expand Up @@ -60,6 +61,12 @@ struct DepGraphData {

colors: DepNodeColorMap,

/// A set of loaded diagnostics which has been emitted.
emitted_diagnostics: Mutex<FxHashSet<DepNodeIndex>>,

/// Used to wait for diagnostics to be emitted.
emitted_diagnostics_cond_var: Condvar,

/// When we load, there may be `.o` files, cached mir, or other such
/// things available to us. If we find that they are not dirty, we
/// load the path to the file storing those work-products here into
Expand All @@ -83,6 +90,8 @@ impl DepGraph {
previous_work_products: prev_work_products,
dep_node_debug: Default::default(),
current: Lock::new(CurrentDepGraph::new(prev_graph_node_count)),
emitted_diagnostics: Default::default(),
emitted_diagnostics_cond_var: Condvar::new(),
previous: prev_graph,
colors: DepNodeColorMap::new(prev_graph_node_count),
loaded_from_cache: Default::default(),
Expand Down Expand Up @@ -718,28 +727,18 @@ impl DepGraph {
};

// ... emitting any stored diagnostic ...
if did_allocation {
// Only the thread which did the allocation emits the error messages

// FIXME: Ensure that these are printed before returning for all threads.
// Currently threads where did_allocation = false can continue on
// and emit other diagnostics before these diagnostics are emitted.
// Such diagnostics should be emitted after these.
// See https://github.com/rust-lang/rust/issues/48685
let diagnostics = tcx.queries.on_disk_cache
.load_diagnostics(tcx, prev_dep_node_index);

if diagnostics.len() > 0 {
let handle = tcx.sess.diagnostic();
let diagnostics = tcx.queries.on_disk_cache
.load_diagnostics(tcx, prev_dep_node_index);

// Promote the previous diagnostics to the current session.
tcx.queries.on_disk_cache
.store_diagnostics(dep_node_index, diagnostics.clone().into());

for diagnostic in diagnostics {
DiagnosticBuilder::new_diagnostic(handle, diagnostic).emit();
}
}
if unlikely!(diagnostics.len() > 0) {
self.emit_diagnostics(
tcx,
data,
dep_node_index,
did_allocation,
diagnostics
);
}

// ... and finally storing a "Green" entry in the color map.
Expand All @@ -755,6 +754,49 @@ impl DepGraph {
Some(dep_node_index)
}

/// Atomically emits some loaded diagnotics assuming that this only gets called with
/// did_allocation set to true on one thread
#[cold]
#[inline(never)]
fn emit_diagnostics<'tcx>(
&self,
tcx: TyCtxt<'_, 'tcx, 'tcx>,
data: &DepGraphData,
dep_node_index: DepNodeIndex,
did_allocation: bool,
diagnostics: Vec<Diagnostic>,
) {
if did_allocation || !cfg!(parallel_queries) {
// Only the thread which did the allocation emits the error messages
let handle = tcx.sess.diagnostic();

// Promote the previous diagnostics to the current session.
tcx.queries.on_disk_cache
.store_diagnostics(dep_node_index, diagnostics.clone().into());

for diagnostic in diagnostics {
DiagnosticBuilder::new_diagnostic(handle, diagnostic).emit();
}

#[cfg(parallel_queries)]
{
// Mark the diagnostics and emitted and wake up waiters
data.emitted_diagnostics.lock().insert(dep_node_index);
data.emitted_diagnostics_cond_var.notify_all();
}
} else {
// The other threads will wait for the diagnostics to be emitted

let mut emitted_diagnostics = data.emitted_diagnostics.lock();
loop {
if emitted_diagnostics.contains(&dep_node_index) {
break;
}
data.emitted_diagnostics_cond_var.wait(&mut emitted_diagnostics);
}
}
}

// Returns true if the given node has been marked as green during the
// current compilation session. Used in various assertions
pub fn is_green(&self, dep_node: &DepNode) -> bool {
Expand Down
10 changes: 0 additions & 10 deletions src/librustc/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2937,16 +2937,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
}
}

/// Given the DefId of an item, returns its MIR, borrowed immutably.
/// Returns None if there is no MIR for the DefId
pub fn maybe_optimized_mir(self, did: DefId) -> Option<&'gcx Mir<'gcx>> {
if self.is_mir_available(did) {
Some(self.optimized_mir(did))
} else {
None
}
}

/// Get the attributes of a definition.
pub fn get_attrs(self, did: DefId) -> Attributes<'gcx> {
if let Some(id) = self.hir().as_local_node_id(did) {
Expand Down
3 changes: 0 additions & 3 deletions src/librustc_codegen_ssa/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -911,9 +911,6 @@ impl<'a> WasmLd<'a> {
// For now we just never have an entry symbol
cmd.arg("--no-entry");

// Make the default table accessible
cmd.arg("--export-table");

// Rust code should never have warnings, and warnings are often
// indicative of bugs, let's prevent them.
cmd.arg("--fatal-warnings");
Expand Down
1 change: 0 additions & 1 deletion src/librustc_codegen_ssa/mir/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
let field = const_field(
bx.tcx(),
ty::ParamEnv::reveal_all(),
self.instance,
None,
mir::Field::new(field as usize),
c,
Expand Down
Loading