Auto merge of #36255 - Manishearth:rollup, r=Manishearth
Rollup of 7 pull requests - Successful merges: #36070, #36132, #36200, #36212, #36225, #36231, #36234 - Failed merges:
This commit is contained in:
commit
987b47549e
9 changed files with 73 additions and 7 deletions
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
#
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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() {
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
#[link(kind = "dylib")] extern {} //~ ERROR E0459
|
||||
//~| NOTE missing `name` argument
|
||||
|
||||
fn main() {
|
||||
}
|
||||
|
|
|
@ -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
src/test/ui/span/E0493.stderr
Normal file
11
src/test/ui/span/E0493.stderr
Normal file
|
@ -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
|
||||
|
Loading…
Add table
Reference in a new issue