Skip to content

Rollup of 7 pull requests #36255

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 15 commits into from
Sep 4, 2016
Merged
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
@@ -144,6 +144,7 @@ struct Rust {
rpath: Option<bool>,
optimize_tests: Option<bool>,
debuginfo_tests: Option<bool>,
codegen_tests: Option<bool>,
}

/// TOML representation of how each build target is configured.
@@ -232,6 +233,7 @@ impl Config {
set(&mut config.rust_optimize, rust.optimize);
set(&mut config.rust_optimize_tests, rust.optimize_tests);
set(&mut config.rust_debuginfo_tests, rust.debuginfo_tests);
set(&mut config.codegen_tests, rust.codegen_tests);
set(&mut config.rust_rpath, rust.rpath);
set(&mut config.debug_jemalloc, rust.debug_jemalloc);
set(&mut config.use_jemalloc, rust.use_jemalloc);
7 changes: 7 additions & 0 deletions src/bootstrap/config.toml.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Sample TOML configuration file for building Rust.
#
# To configure rustbuild, copy this file to the directory from which you will be
# running the build, and name it config.toml.
#
# All options are commented out by default in this file, and they're commented
# out with their default values. The build system by default looks for
# `config.toml` in the current directory of a build for build configuration, but
@@ -130,6 +133,10 @@
#optimize-tests = true
#debuginfo-tests = true

# Flag indicating whether codegen tests will be run or not. If you get an error
# saying that the FileCheck executable is missing, you may want to disable this.
#codegen-tests = true

# =============================================================================
# Options for specific targets
#
2 changes: 1 addition & 1 deletion src/doc/book/nightly-rust.md
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@ binary downloads][install-page].

Oh, we should also mention the officially supported platforms:

* Windows (7, 8, Server 2008 R2)
* Windows (7+)
* Linux (2.6.18 or later, various distributions), x86 and x86-64
* OSX 10.7 (Lion) or greater, x86 and x86-64

10 changes: 8 additions & 2 deletions src/librustc/session/config.rs
Original file line number Diff line number Diff line change
@@ -849,9 +849,13 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
ls: bool = (false, parse_bool, [UNTRACKED],
"list the symbols defined by a library crate"),
save_analysis: bool = (false, parse_bool, [UNTRACKED],
"write syntax and type analysis (in JSON format) information in addition to normal output"),
"write syntax and type analysis (in JSON format) information, in \
addition to normal output"),
save_analysis_csv: bool = (false, parse_bool, [UNTRACKED],
"write syntax and type analysis (in CSV format) information in addition to normal output"),
"write syntax and type analysis (in CSV format) information, in addition to normal output"),
save_analysis_api: bool = (false, parse_bool, [UNTRACKED],
"write syntax and type analysis information for opaque libraries (in JSON format), \
in addition to normal output"),
print_move_fragments: bool = (false, parse_bool, [UNTRACKED],
"print out move-fragment data for every fn"),
flowgraph_print_loans: bool = (false, parse_bool, [UNTRACKED],
@@ -2365,6 +2369,8 @@ mod tests {
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
opts.debugging_opts.save_analysis_csv = true;
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
opts.debugging_opts.save_analysis_api = true;
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
opts.debugging_opts.print_move_fragments = true;
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
opts.debugging_opts.flowgraph_print_loans = true;
3 changes: 2 additions & 1 deletion src/librustc_driver/driver.rs
Original file line number Diff line number Diff line change
@@ -250,7 +250,8 @@ fn keep_hygiene_data(sess: &Session) -> bool {
fn keep_ast(sess: &Session) -> bool {
sess.opts.debugging_opts.keep_ast ||
sess.opts.debugging_opts.save_analysis ||
sess.opts.debugging_opts.save_analysis_csv
sess.opts.debugging_opts.save_analysis_csv ||
sess.opts.debugging_opts.save_analysis_api
}

/// The name used for source code that doesn't originate in a file
5 changes: 4 additions & 1 deletion src/librustc_driver/lib.rs
Original file line number Diff line number Diff line change
@@ -555,14 +555,17 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls {

fn save_analysis(sess: &Session) -> bool {
sess.opts.debugging_opts.save_analysis ||
sess.opts.debugging_opts.save_analysis_csv
sess.opts.debugging_opts.save_analysis_csv ||
sess.opts.debugging_opts.save_analysis_api
}

fn save_analysis_format(sess: &Session) -> save::Format {
if sess.opts.debugging_opts.save_analysis {
save::Format::Json
} else if sess.opts.debugging_opts.save_analysis_csv {
save::Format::Csv
} else if sess.opts.debugging_opts.save_analysis_api {
save::Format::JsonApi
} else {
unreachable!();
}
10 changes: 6 additions & 4 deletions src/librustc_metadata/creader.rs
Original file line number Diff line number Diff line change
@@ -1056,8 +1056,9 @@ impl<'a> LocalCrateReader<'a> {
Some("dylib") => cstore::NativeUnknown,
Some("framework") => cstore::NativeFramework,
Some(k) => {
span_err!(self.sess, m.span, E0458,
"unknown kind: `{}`", k);
struct_span_err!(self.sess, m.span, E0458,
"unknown kind: `{}`", k)
.span_label(m.span, &format!("unknown kind")).emit();
cstore::NativeUnknown
}
None => cstore::NativeUnknown
@@ -1068,8 +1069,9 @@ impl<'a> LocalCrateReader<'a> {
let n = match n {
Some(n) => n,
None => {
span_err!(self.sess, m.span, E0459,
"#[link(...)] specified without `name = \"foo\"`");
struct_span_err!(self.sess, m.span, E0459,
"#[link(...)] specified without `name = \"foo\"`")
.span_label(m.span, &format!("missing `name` argument")).emit();
InternedString::new("foo")
}
};
33 changes: 33 additions & 0 deletions src/librustc_mir/transform/qualify_consts.rs
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ use rustc_data_structures::bitvec::BitVector;
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
use rustc::dep_graph::DepNode;
use rustc::hir;
use rustc::hir::map as hir_map;
use rustc::hir::def_id::DefId;
use rustc::hir::intravisit::FnKind;
use rustc::hir::map::blocks::FnLikeNode;
@@ -252,14 +253,46 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> {

let mut err =
struct_span_err!(self.tcx.sess, self.span, E0493, "{}", msg);

if self.mode != Mode::Const {
help!(&mut err,
"in Nightly builds, add `#![feature(drop_types_in_const)]` \
to the crate attributes to enable");
} else {
self.find_drop_implementation_method_span()
.map(|span| err.span_label(span, &format!("destructor defined here")));

err.span_label(self.span, &format!("constants cannot have destructors"));
}

err.emit();
}

fn find_drop_implementation_method_span(&self) -> Option<Span> {
self.tcx.lang_items
.drop_trait()
.and_then(|drop_trait_id| {
let mut span = None;

self.tcx
.lookup_trait_def(drop_trait_id)
.for_each_relevant_impl(self.tcx, self.mir.return_ty, |impl_did| {
self.tcx.map
.as_local_node_id(impl_did)
.and_then(|impl_node_id| self.tcx.map.find(impl_node_id))
.map(|node| {
if let hir_map::NodeItem(item) = node {
if let hir::ItemImpl(_, _, _, _, _, ref methods) = item.node {
span = methods.first().map(|method| method.span);
}
}
});
});

span
})
}

/// Check if an Lvalue with the current qualifications could
/// be consumed, by either an operand or a Deref projection.
fn try_consume(&mut self) -> bool {
56 changes: 50 additions & 6 deletions src/librustc_save_analysis/data.rs
Original file line number Diff line number Diff line change
@@ -13,8 +13,9 @@
//! The `Dump` trait can be used together with `DumpVisitor` in order to
//! retrieve the data from a crate.

use rustc::hir;
use rustc::hir::def_id::DefId;
use syntax::ast::{CrateNum, NodeId};
use syntax::ast::{self, CrateNum, NodeId};
use syntax_pos::Span;

pub struct CrateData {
@@ -76,6 +77,35 @@ pub enum Data {
VariableRefData(VariableRefData),
}

#[derive(Eq, PartialEq, Clone, Copy, Debug, RustcEncodable)]
pub enum Visibility {
Public,
Restricted,
Inherited,
}

impl<'a> From<&'a ast::Visibility> for Visibility {
fn from(v: &'a ast::Visibility) -> Visibility {
match *v {
ast::Visibility::Public => Visibility::Public,
ast::Visibility::Crate(_) => Visibility::Restricted,
ast::Visibility::Restricted { .. } => Visibility::Restricted,
ast::Visibility::Inherited => Visibility::Inherited,
}
}
}

impl<'a> From<&'a hir::Visibility> for Visibility {
fn from(v: &'a hir::Visibility) -> Visibility {
match *v {
hir::Visibility::Public => Visibility::Public,
hir::Visibility::Crate => Visibility::Restricted,
hir::Visibility::Restricted { .. } => Visibility::Restricted,
hir::Visibility::Inherited => Visibility::Inherited,
}
}
}

/// Data for the prelude of a crate.
#[derive(Debug, RustcEncodable)]
pub struct CratePreludeData {
@@ -103,7 +133,7 @@ pub struct EnumData {
pub span: Span,
pub scope: NodeId,
pub variants: Vec<NodeId>,

pub visibility: Visibility,
}

/// Data for extern crates.
@@ -135,6 +165,8 @@ pub struct FunctionData {
pub span: Span,
pub scope: NodeId,
pub value: String,
pub visibility: Visibility,
pub parent: Option<NodeId>,
}

/// Data about a function call.
@@ -215,6 +247,7 @@ pub struct MethodData {
pub scope: NodeId,
pub value: String,
pub decl_id: Option<DefId>,
pub visibility: Visibility,
}

/// Data for modules.
@@ -227,6 +260,7 @@ pub struct ModData {
pub scope: NodeId,
pub filename: String,
pub items: Vec<NodeId>,
pub visibility: Visibility,
}

/// Data for a reference to a module.
@@ -248,6 +282,7 @@ pub struct StructData {
pub scope: NodeId,
pub value: String,
pub fields: Vec<NodeId>,
pub visibility: Visibility,
}

#[derive(Debug, RustcEncodable)]
@@ -258,7 +293,8 @@ pub struct StructVariantData {
pub qualname: String,
pub type_value: String,
pub value: String,
pub scope: NodeId
pub scope: NodeId,
pub parent: Option<NodeId>,
}

#[derive(Debug, RustcEncodable)]
@@ -270,6 +306,7 @@ pub struct TraitData {
pub scope: NodeId,
pub value: String,
pub items: Vec<NodeId>,
pub visibility: Visibility,
}

#[derive(Debug, RustcEncodable)]
@@ -280,7 +317,8 @@ pub struct TupleVariantData {
pub qualname: String,
pub type_value: String,
pub value: String,
pub scope: NodeId
pub scope: NodeId,
pub parent: Option<NodeId>,
}

/// Data for a typedef.
@@ -291,6 +329,8 @@ pub struct TypeDefData {
pub span: Span,
pub qualname: String,
pub value: String,
pub visibility: Visibility,
pub parent: Option<NodeId>,
}

/// Data for a reference to a type or trait.
@@ -308,15 +348,17 @@ pub struct UseData {
pub span: Span,
pub name: String,
pub mod_id: Option<DefId>,
pub scope: NodeId
pub scope: NodeId,
pub visibility: Visibility,
}

#[derive(Debug, RustcEncodable)]
pub struct UseGlobData {
pub id: NodeId,
pub span: Span,
pub names: Vec<String>,
pub scope: NodeId
pub scope: NodeId,
pub visibility: Visibility,
}

/// Data for local and global variables (consts and statics).
@@ -328,8 +370,10 @@ pub struct VariableData {
pub qualname: String,
pub span: Span,
pub scope: NodeId,
pub parent: Option<NodeId>,
pub value: String,
pub type_value: String,
pub visibility: Visibility,
}

#[derive(Debug, RustcEncodable)]
Loading