Skip to content

Commit 987b475

Browse files
authored
Auto merge of #36255 - Manishearth:rollup, r=Manishearth
Rollup of 7 pull requests - Successful merges: #36070, #36132, #36200, #36212, #36225, #36231, #36234 - Failed merges:
2 parents e77d86c + 55893f0 commit 987b475

File tree

9 files changed

+73
-7
lines changed

9 files changed

+73
-7
lines changed

src/bootstrap/config.rs

+2
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ struct Rust {
144144
rpath: Option<bool>,
145145
optimize_tests: Option<bool>,
146146
debuginfo_tests: Option<bool>,
147+
codegen_tests: Option<bool>,
147148
}
148149

149150
/// TOML representation of how each build target is configured.
@@ -232,6 +233,7 @@ impl Config {
232233
set(&mut config.rust_optimize, rust.optimize);
233234
set(&mut config.rust_optimize_tests, rust.optimize_tests);
234235
set(&mut config.rust_debuginfo_tests, rust.debuginfo_tests);
236+
set(&mut config.codegen_tests, rust.codegen_tests);
235237
set(&mut config.rust_rpath, rust.rpath);
236238
set(&mut config.debug_jemalloc, rust.debug_jemalloc);
237239
set(&mut config.use_jemalloc, rust.use_jemalloc);

src/bootstrap/config.toml.example

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Sample TOML configuration file for building Rust.
22
#
3+
# To configure rustbuild, copy this file to the directory from which you will be
4+
# running the build, and name it config.toml.
5+
#
36
# All options are commented out by default in this file, and they're commented
47
# out with their default values. The build system by default looks for
58
# `config.toml` in the current directory of a build for build configuration, but
@@ -130,6 +133,10 @@
130133
#optimize-tests = true
131134
#debuginfo-tests = true
132135

136+
# Flag indicating whether codegen tests will be run or not. If you get an error
137+
# saying that the FileCheck executable is missing, you may want to disable this.
138+
#codegen-tests = true
139+
133140
# =============================================================================
134141
# Options for specific targets
135142
#

src/doc/book/nightly-rust.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ binary downloads][install-page].
5454

5555
Oh, we should also mention the officially supported platforms:
5656

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

src/librustc_metadata/creader.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -1056,8 +1056,9 @@ impl<'a> LocalCrateReader<'a> {
10561056
Some("dylib") => cstore::NativeUnknown,
10571057
Some("framework") => cstore::NativeFramework,
10581058
Some(k) => {
1059-
span_err!(self.sess, m.span, E0458,
1060-
"unknown kind: `{}`", k);
1059+
struct_span_err!(self.sess, m.span, E0458,
1060+
"unknown kind: `{}`", k)
1061+
.span_label(m.span, &format!("unknown kind")).emit();
10611062
cstore::NativeUnknown
10621063
}
10631064
None => cstore::NativeUnknown
@@ -1068,8 +1069,9 @@ impl<'a> LocalCrateReader<'a> {
10681069
let n = match n {
10691070
Some(n) => n,
10701071
None => {
1071-
span_err!(self.sess, m.span, E0459,
1072-
"#[link(...)] specified without `name = \"foo\"`");
1072+
struct_span_err!(self.sess, m.span, E0459,
1073+
"#[link(...)] specified without `name = \"foo\"`")
1074+
.span_label(m.span, &format!("missing `name` argument")).emit();
10731075
InternedString::new("foo")
10741076
}
10751077
};

src/librustc_mir/transform/qualify_consts.rs

+33
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use rustc_data_structures::bitvec::BitVector;
1818
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
1919
use rustc::dep_graph::DepNode;
2020
use rustc::hir;
21+
use rustc::hir::map as hir_map;
2122
use rustc::hir::def_id::DefId;
2223
use rustc::hir::intravisit::FnKind;
2324
use rustc::hir::map::blocks::FnLikeNode;
@@ -252,14 +253,46 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> {
252253

253254
let mut err =
254255
struct_span_err!(self.tcx.sess, self.span, E0493, "{}", msg);
256+
255257
if self.mode != Mode::Const {
256258
help!(&mut err,
257259
"in Nightly builds, add `#![feature(drop_types_in_const)]` \
258260
to the crate attributes to enable");
261+
} else {
262+
self.find_drop_implementation_method_span()
263+
.map(|span| err.span_label(span, &format!("destructor defined here")));
264+
265+
err.span_label(self.span, &format!("constants cannot have destructors"));
259266
}
267+
260268
err.emit();
261269
}
262270

271+
fn find_drop_implementation_method_span(&self) -> Option<Span> {
272+
self.tcx.lang_items
273+
.drop_trait()
274+
.and_then(|drop_trait_id| {
275+
let mut span = None;
276+
277+
self.tcx
278+
.lookup_trait_def(drop_trait_id)
279+
.for_each_relevant_impl(self.tcx, self.mir.return_ty, |impl_did| {
280+
self.tcx.map
281+
.as_local_node_id(impl_did)
282+
.and_then(|impl_node_id| self.tcx.map.find(impl_node_id))
283+
.map(|node| {
284+
if let hir_map::NodeItem(item) = node {
285+
if let hir::ItemImpl(_, _, _, _, _, ref methods) = item.node {
286+
span = methods.first().map(|method| method.span);
287+
}
288+
}
289+
});
290+
});
291+
292+
span
293+
})
294+
}
295+
263296
/// Check if an Lvalue with the current qualifications could
264297
/// be consumed, by either an operand or a Deref projection.
265298
fn try_consume(&mut self) -> bool {

src/test/compile-fail/E0458.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
// except according to those terms.
1010

1111
#[link(kind = "wonderful_unicorn")] extern {} //~ ERROR E0458
12-
//~^ ERROR E0459
12+
//~| NOTE unknown kind
13+
//~| ERROR E0459
14+
//~| NOTE missing `name` argument
1315

1416
fn main() {
1517
}

src/test/compile-fail/E0459.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

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

1314
fn main() {
1415
}

src/test/compile-fail/E0493.rs renamed to src/test/ui/span/E0493.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,15 @@ impl Drop for Foo {
1616
fn drop(&mut self) {}
1717
}
1818

19-
const F : Foo = Foo { a : 0 }; //~ ERROR E0493
19+
struct Bar {
20+
a: u32
21+
}
22+
23+
impl Drop for Bar {
24+
fn drop(&mut self) {}
25+
}
26+
27+
const F : Foo = Foo { a : 0 };
2028

2129
fn main() {
2230
}

src/test/ui/span/E0493.stderr

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0493]: constants are not allowed to have destructors
2+
--> $DIR/E0493.rs:27:17
3+
|
4+
16 | fn drop(&mut self) {}
5+
| --------------------- destructor defined here
6+
...
7+
27 | const F : Foo = Foo { a : 0 };
8+
| ^^^^^^^^^^^^^ constants cannot have destructors
9+
10+
error: aborting due to previous error
11+

0 commit comments

Comments
 (0)