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 13 pull requests #56728

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
934e4d3
Remove not used mod
yui-knk Nov 28, 2018
eaeebb5
Clearer error message for dead assign
JohnGinger Dec 2, 2018
54026c1
Fix line length
JohnGinger Dec 2, 2018
4cf5702
Fix stderr files
JohnGinger Dec 3, 2018
70536d4
Fix stderr file (unused variable)
JohnGinger Dec 3, 2018
c0e3f4b
Change to give a help message
JohnGinger Dec 7, 2018
86822eb
Unconditionally emit the target-cpu LLVM attribute.
michaelwoerister Dec 7, 2018
0bb075f
rustdoc: Fix local reexports of proc macros
ollie27 Dec 8, 2018
aa04285
Add lint for items deprecated in future
aheart Dec 9, 2018
c3c2de9
reject invalid external doc attributes
euclio Nov 28, 2018
7f7045f
improve diagnostics for invalid external docs
euclio Nov 28, 2018
5586c04
debug logging, added conditional error message, tests updated
kevgrasso Nov 12, 2018
07a3d69
Update the stdsimd submodule
alexcrichton Dec 10, 2018
3d23e55
fix install broken link
mishaker Dec 10, 2018
f8c03b6
Add lint for stlib
aheart Dec 10, 2018
771e8b8
[self-profiler] Add column for percent of total time
wesleywiser Dec 11, 2018
799cadb
Remove unnecessary feature gates from const fns
oli-obk Dec 11, 2018
1346619
Remove some dead code from `sgx`
oli-obk Dec 11, 2018
5457b19
Properly stage new feature gates
oli-obk Dec 11, 2018
30f531b
generate invalidations from 2-phase-borrow activations
nikomatsakis Dec 4, 2018
8ee2c06
adopt polonius-engine 0.6.1
nikomatsakis Dec 4, 2018
5acab2d
Always set the RDRAND and RDSEED features on SGX
Dec 11, 2018
86b786b
Rollup merge of #56203 - aheart:master, r=varkor
pietroalbini Dec 11, 2018
a7e1d77
Rollup merge of #56343 - yui-knk:remove_mir_stats_mod, r=nikomatsakis
pietroalbini Dec 11, 2018
f7de3cc
Rollup merge of #56439 - JohnGinger:master, r=nikomatsakis
pietroalbini Dec 11, 2018
a6e98b3
Rollup merge of #56507 - nikomatsakis:polonius-integrate, r=MatthewJa…
pietroalbini Dec 11, 2018
ece35d7
Rollup merge of #56572 - kevgrasso:let_self_err_dev, r=estebank
pietroalbini Dec 11, 2018
286c3cc
Rollup merge of #56609 - michaelwoerister:unconditional-target-cpu-at…
pietroalbini Dec 11, 2018
4674c10
Rollup merge of #56637 - ollie27:rustdoc_proc_macro_local_reexport, r…
pietroalbini Dec 11, 2018
8c648f0
Rollup merge of #56679 - euclio:external-doc-parse, r=estebank
pietroalbini Dec 11, 2018
bbefcb1
Rollup merge of #56682 - alexcrichton:update-stdsimd, r=nikomatsakis
pietroalbini Dec 11, 2018
2a5b105
Rollup merge of #56691 - mishaker:fix_doc_install_broken_link, r=jona…
pietroalbini Dec 11, 2018
ecccfb2
Rollup merge of #56702 - wesleywiser:calc_total_time_stats, r=michael…
pietroalbini Dec 11, 2018
31550ff
Rollup merge of #56708 - oli-obk:stability_internal_const_fn, r=alexc…
pietroalbini Dec 11, 2018
cd4e775
Rollup merge of #56710 - jethrogb:jb/sgx-target-features, r=alexcrichton
pietroalbini Dec 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
14 changes: 7 additions & 7 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ dependencies = [

[[package]]
name = "datafrog"
version = "0.1.0"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
Expand Down Expand Up @@ -1626,10 +1626,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "polonius-engine"
version = "0.5.0"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"datafrog 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"datafrog 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
Expand Down Expand Up @@ -2072,7 +2072,7 @@ dependencies = [
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"polonius-engine 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"polonius-engine 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-rayon-core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_apfloat 0.0.0",
Expand Down Expand Up @@ -2512,7 +2512,7 @@ dependencies = [
"graphviz 0.0.0",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"log_settings 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"polonius-engine 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"polonius-engine 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc 0.0.0",
"rustc_apfloat 0.0.0",
"rustc_data_structures 0.0.0",
Expand Down Expand Up @@ -3412,7 +3412,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum crypto-hash 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "09de9ee0fc255ace04c7fa0763c9395a945c37c8292bb554f8d48361d1dcf1b4"
"checksum curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)" = "c7c9d851c825e0c033979d4516c9173bc19a78a96eb4d6ae51d4045440eafa16"
"checksum curl-sys 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)" = "721c204978be2143fab0a84b708c49d79d1f6100b8785610f456043a90708870"
"checksum datafrog 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "16d724bf4ffe77cdceeecd461009b5f8d9e23c5d645d68bedb4586bf43e7e142"
"checksum datafrog 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "71a3eacc779bb35090718501c2de27bb679dee18f6c28e6589590e4ed8b9fa08"
"checksum derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "6ca414e896ae072546f4d789f452daaecf60ddee4c9df5dc6d5936d769e3d87c"
"checksum derive_more 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3f57d78cf3bd45270dad4e70c21ec77a960b36c7a841ff9db76aaa775a8fb871"
"checksum diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3c2b69f912779fbb121ceb775d74d51e915af17aaebc38d28a592843a2dd0a3a"
Expand Down Expand Up @@ -3520,7 +3520,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum phf_generator 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)" = "05a079dd052e7b674d21cb31cbb6c05efd56a2cd2827db7692e2f1a507ebd998"
"checksum phf_shared 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)" = "c2261d544c2bb6aa3b10022b0be371b9c7c64f762ef28c6f5d4f1ef6d97b5930"
"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c"
"checksum polonius-engine 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a5b6b0a7f5f4278b991ffd14abce1d01b013121ad297460237ef0a2f08d43201"
"checksum polonius-engine 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d9274a1db7bffb87f7e810ef480a75b67eed0f1a3838f80c652e881f4b4970fd"
"checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
"checksum pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a029430f0d744bc3d15dd474d591bed2402b645d024583082b9f63bb936dac6"
"checksum pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df8b3f4e0475def7d9c2e5de8e5a1306949849761e107b360d03e98eafaffd61"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ standard library, and documentation.

Read ["Installation"] from [The Book].

["Installation"]: https://doc.rust-lang.org/book/second-edition/ch01-01-installation.html
["Installation"]: https://doc.rust-lang.org/book/ch01-01-installation.html
[The Book]: https://doc.rust-lang.org/book/index.html

## Building from Source
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobserver = "0.1"
lazy_static = "1.0.0"
scoped-tls = { version = "0.1.1", features = ["nightly"] }
log = { version = "0.4", features = ["release_max_level_info", "std"] }
polonius-engine = "0.5.0"
polonius-engine = "0.6.1"
rustc-rayon = "0.1.1"
rustc-rayon-core = "0.1.1"
rustc_apfloat = { path = "../librustc_apfloat" }
Expand Down
8 changes: 8 additions & 0 deletions src/librustc/lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,13 @@ pub mod parser {
}
}

declare_lint! {
pub DEPRECATED_IN_FUTURE,
Allow,
"detects use of items that will be deprecated in a future version",
report_in_external_macro: true
}

/// Does nothing as a lint pass, but registers some `Lint`s
/// that are used by other parts of the compiler.
#[derive(Copy, Clone)]
Expand Down Expand Up @@ -427,6 +434,7 @@ impl LintPass for HardwiredLints {
MACRO_USE_EXTERN_CRATE,
MACRO_EXPANDED_MACRO_EXPORTS_ACCESSED_BY_ABSOLUTE_PATHS,
parser::QUESTION_MARK_MACRO_SEP,
DEPRECATED_IN_FUTURE,
)
}
}
Expand Down
12 changes: 8 additions & 4 deletions src/librustc/middle/liveness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1657,11 +1657,15 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
fn report_dead_assign(&self, hir_id: HirId, sp: Span, var: Variable, is_argument: bool) {
if let Some(name) = self.should_warn(var) {
if is_argument {
self.ir.tcx.lint_hir(lint::builtin::UNUSED_ASSIGNMENTS, hir_id, sp,
&format!("value passed to `{}` is never read", name));
self.ir.tcx.struct_span_lint_hir(lint::builtin::UNUSED_ASSIGNMENTS, hir_id, sp,
&format!("value passed to `{}` is never read", name))
.help("maybe it is overwritten before being read?")
.emit();
} else {
self.ir.tcx.lint_hir(lint::builtin::UNUSED_ASSIGNMENTS, hir_id, sp,
&format!("value assigned to `{}` is never read", name));
self.ir.tcx.struct_span_lint_hir(lint::builtin::UNUSED_ASSIGNMENTS, hir_id, sp,
&format!("value assigned to `{}` is never read", name))
.help("maybe it is overwritten before being read?")
.emit();
}
}
}
Expand Down
70 changes: 55 additions & 15 deletions src/librustc/middle/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

pub use self::StabilityLevel::*;

use lint;
use lint::{self, Lint};
use hir::{self, Item, Generics, StructField, Variant, HirId};
use hir::def::Def;
use hir::def_id::{CrateNum, CRATE_DEF_INDEX, DefId, LOCAL_CRATE};
Expand Down Expand Up @@ -562,18 +562,20 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
return EvalResult::Allow;
}

let lint_deprecated = |def_id: DefId, id: NodeId, note: Option<Symbol>| {
let path = self.item_path_str(def_id);

let lint_deprecated = |def_id: DefId,
id: NodeId,
note: Option<Symbol>,
message: &str,
lint: &'static Lint| {
let msg = if let Some(note) = note {
format!("use of deprecated item '{}': {}", path, note)
format!("{}: {}", message, note)
} else {
format!("use of deprecated item '{}'", path)
format!("{}", message)
};

self.lint_node(lint::builtin::DEPRECATED, id, span, &msg);
self.lint_node(lint, id, span, &msg);
if id == ast::DUMMY_NODE_ID {
span_bug!(span, "emitted a deprecated lint with dummy node id: {:?}", def_id);
span_bug!(span, "emitted a {} lint with dummy node id: {:?}", lint.name, def_id);
}
};

Expand All @@ -584,17 +586,39 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
// version, then we should display no warning message.
let deprecated_in_future_version = if let Some(sym) = depr_entry.attr.since {
let since = sym.as_str();
!deprecation_in_effect(&since)
if !deprecation_in_effect(&since) {
Some(since)
} else {
None
}
} else {
false
None
};

let parent_def_id = self.hir().local_def_id(self.hir().get_parent(id));
let skip = deprecated_in_future_version ||
self.lookup_deprecation_entry(parent_def_id)
let skip = self.lookup_deprecation_entry(parent_def_id)
.map_or(false, |parent_depr| parent_depr.same_origin(&depr_entry));
if !skip {
lint_deprecated(def_id, id, depr_entry.attr.note);

if let Some(since) = deprecated_in_future_version {
let path = self.item_path_str(def_id);
let message = format!("use of item '{}' \
that will be deprecated in future version {}",
path,
since);

lint_deprecated(def_id,
id,
depr_entry.attr.note,
&message,
lint::builtin::DEPRECATED_IN_FUTURE);
} else if !skip {
let path = self.item_path_str(def_id);
let message = format!("use of deprecated item '{}'", path);
lint_deprecated(def_id,
id,
depr_entry.attr.note,
&message,
lint::builtin::DEPRECATED);
}
};
}
Expand All @@ -614,8 +638,24 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
if let Some(&Stability{rustc_depr: Some(attr::RustcDeprecation { reason, since }), ..})
= stability {
if let Some(id) = id {
let path = self.item_path_str(def_id);
if deprecation_in_effect(&since.as_str()) {
lint_deprecated(def_id, id, Some(reason));
let message = format!("use of deprecated item '{}'", path);
lint_deprecated(def_id,
id,
Some(reason),
&message,
lint::builtin::DEPRECATED);
} else {
let message = format!("use of item '{}' \
that will be deprecated in future version {}",
path,
since);
lint_deprecated(def_id,
id,
Some(reason),
&message,
lint::builtin::DEPRECATED_IN_FUTURE);
}
}
}
Expand Down
13 changes: 9 additions & 4 deletions src/librustc/util/profiling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,15 @@ macro_rules! define_categories {
}

fn print(&self, lock: &mut StderrLock<'_>) {
writeln!(lock, "| Phase | Time (ms) | Queries | Hits (%) |")
writeln!(lock, "| Phase | Time (ms) \
| Time (%) | Queries | Hits (%)")
.unwrap();
writeln!(lock, "| ---------------- | -------------- | -------------- | -------- |")
writeln!(lock, "| ---------------- | -------------- \
| -------- | -------------- | --------")
.unwrap();

let total_time = ($(self.times.$name + )* 0) as f32;

$(
let (hits, total) = self.query_counts.$name;
let (hits, total) = if total > 0 {
Expand All @@ -78,11 +82,12 @@ macro_rules! define_categories {

writeln!(
lock,
"| {0: <16} | {1: <14} | {2: <14} | {3: <8} |",
"| {0: <16} | {1: <14} | {2: <8.2} | {3: <14} | {4: <8}",
stringify!($name),
self.times.$name / 1_000_000,
((self.times.$name as f32) / total_time) * 100.0,
total,
hits
hits,
).unwrap();
)*
}
Expand Down
10 changes: 3 additions & 7 deletions src/librustc_codegen_llvm/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use rustc::session::config::Sanitizer;
use rustc::ty::TyCtxt;
use rustc::ty::layout::HasTyCtxt;
use rustc::ty::query::Providers;
use rustc_data_structures::small_c_str::SmallCStr;
use rustc_data_structures::sync::Lrc;
use rustc_data_structures::fx::FxHashMap;
use rustc_target::spec::PanicStrategy;
Expand Down Expand Up @@ -129,8 +130,7 @@ pub fn llvm_target_features(sess: &Session) -> impl Iterator<Item = &str> {
}

pub fn apply_target_cpu_attr(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
let cpu = llvm_util::target_cpu(cx.tcx.sess);
let target_cpu = CString::new(cpu).unwrap();
let target_cpu = SmallCStr::new(llvm_util::target_cpu(cx.tcx.sess));
llvm::AddFunctionAttrStringValue(
llfn,
llvm::AttributePlace::Function,
Expand Down Expand Up @@ -220,11 +220,7 @@ pub fn from_fn_attrs(
// Always annotate functions with the target-cpu they are compiled for.
// Without this, ThinLTO won't inline Rust functions into Clang generated
// functions (because Clang annotates functions this way too).
// NOTE: For now we just apply this if -Zcross-lang-lto is specified, since
// it introduce a little overhead and isn't really necessary otherwise.
if cx.tcx.sess.opts.debugging_opts.cross_lang_lto.enabled() {
apply_target_cpu_attr(cx, llfn);
}
apply_target_cpu_attr(cx, llfn);

let features = llvm_target_features(cx.tcx.sess)
.map(|s| s.to_string())
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ either = "1.5.0"
graphviz = { path = "../libgraphviz" }
log = "0.4"
log_settings = "0.1.1"
polonius-engine = "0.5.0"
polonius-engine = "0.6.1"
rustc = { path = "../librustc" }
rustc_target = { path = "../librustc_target" }
rustc_data_structures = { path = "../librustc_data_structures" }
Expand Down
50 changes: 46 additions & 4 deletions src/librustc_mir/borrow_check/nll/invalidation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,14 @@ struct InvalidationGenerator<'cx, 'tcx: 'cx, 'gcx: 'tcx> {
/// Visits the whole MIR and generates invalidates() facts
/// Most of the code implementing this was stolen from borrow_check/mod.rs
impl<'cx, 'tcx, 'gcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx, 'gcx> {
fn visit_statement(&mut self,
block: BasicBlock,
statement: &Statement<'tcx>,
location: Location) {
fn visit_statement(
&mut self,
block: BasicBlock,
statement: &Statement<'tcx>,
location: Location,
) {
self.check_activations(location);

match statement.kind {
StatementKind::Assign(ref lhs, ref rhs) => {
self.consume_rvalue(
Expand Down Expand Up @@ -159,6 +163,8 @@ impl<'cx, 'tcx, 'gcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx, 'gcx> {
terminator: &Terminator<'tcx>,
location: Location
) {
self.check_activations(location);

match terminator.kind {
TerminatorKind::SwitchInt {
ref discr,
Expand Down Expand Up @@ -482,5 +488,41 @@ impl<'cg, 'cx, 'tcx, 'gcx> InvalidationGenerator<'cx, 'tcx, 'gcx> {
let lidx = self.location_table.start_index(l);
self.all_facts.invalidates.push((lidx, b));
}

fn check_activations(
&mut self,
location: Location,
) {
if !self.tcx.two_phase_borrows() {
return;
}

// Two-phase borrow support: For each activation that is newly
// generated at this statement, check if it interferes with
// another borrow.
for &borrow_index in self.borrow_set.activations_at_location(location) {
let borrow = &self.borrow_set[borrow_index];

// only mutable borrows should be 2-phase
assert!(match borrow.kind {
BorrowKind::Shared | BorrowKind::Shallow => false,
BorrowKind::Unique | BorrowKind::Mut { .. } => true,
});

self.access_place(
ContextKind::Activation.new(location),
&borrow.borrowed_place,
(
Deep,
Activation(WriteKind::MutableBorrow(borrow.kind), borrow_index),
),
LocalMutationIsAllowed::No,
);

// We do not need to call `check_if_path_or_subpath_is_moved`
// again, as we already called it when we made the
// initial reservation.
}
}
}

1 change: 0 additions & 1 deletion src/librustc_passes/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ pub mod ast_validation;
pub mod rvalue_promotion;
pub mod hir_stats;
pub mod loops;
mod mir_stats;

__build_diagnostic_array! { librustc_passes, DIAGNOSTICS }

Expand Down
Loading