Skip to content

Commit

Permalink
Auto merge of rust-lang#36255 - Manishearth:rollup, r=Manishearth
Browse files Browse the repository at this point in the history
Rollup of 7 pull requests

- Successful merges: rust-lang#36070, rust-lang#36132, rust-lang#36200, rust-lang#36212, rust-lang#36225, rust-lang#36231, rust-lang#36234
- Failed merges:
  • Loading branch information
bors committed Sep 4, 2016
2 parents e77d86c + 55893f0 commit 987b475
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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);
Expand Down
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
Expand Down Expand Up @@ -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
#
Expand Down
2 changes: 1 addition & 1 deletion src/doc/book/nightly-rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 6 additions & 4 deletions src/librustc_metadata/creader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
}
};
Expand Down
33 changes: 33 additions & 0 deletions src/librustc_mir/transform/qualify_consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion src/test/compile-fail/E0458.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
// except according to those terms.

#[link(kind = "wonderful_unicorn")] extern {} //~ ERROR E0458
//~^ ERROR E0459
//~| NOTE unknown kind
//~| ERROR E0459
//~| NOTE missing `name` argument

fn main() {
}
1 change: 1 addition & 0 deletions src/test/compile-fail/E0459.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// except according to those terms.

#[link(kind = "dylib")] extern {} //~ ERROR E0459
//~| NOTE missing `name` argument

fn main() {
}
10 changes: 9 additions & 1 deletion src/test/compile-fail/E0493.rs → src/test/ui/span/E0493.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@ impl Drop for Foo {
fn drop(&mut self) {}
}

const F : Foo = Foo { a : 0 }; //~ ERROR E0493
struct Bar {
a: u32
}

impl Drop for Bar {
fn drop(&mut self) {}
}

const F : Foo = Foo { a : 0 };

fn main() {
}
11 changes: 11 additions & 0 deletions src/test/ui/span/E0493.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error[E0493]: constants are not allowed to have destructors
--> $DIR/E0493.rs:27:17
|
16 | fn drop(&mut self) {}
| --------------------- destructor defined here
...
27 | const F : Foo = Foo { a : 0 };
| ^^^^^^^^^^^^^ constants cannot have destructors

error: aborting due to previous error

0 comments on commit 987b475

Please sign in to comment.