Skip to content

Commit 1a13cb4

Browse files
committed
---
yaml --- r: 271995 b: refs/heads/master c: 3c4d5f9 h: refs/heads/master i: 271993: 5f9ff6d 271991: 861e5b9
1 parent 8d191c6 commit 1a13cb4

File tree

220 files changed

+3206
-2091
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

220 files changed

+3206
-2091
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: d69a5982de0aa65bac47954fb75ef25df8350e6f
2+
refs/heads/master: 3c4d5f92281eefecba5885d09e4981691bbb8e0b
33
refs/heads/snap-stage3: 235d77457d80b549dad3ac36d94f235208a1eafb
44
refs/heads/try: 49312a405e14a449b98fe0056b12a40ac128be4a
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

trunk/CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ which includes important information about what platform you're on, what
7171
version of Rust you're using, etc.
7272

7373
Sometimes, a backtrace is helpful, and so including that is nice. To get
74-
a backtrace, set the `RUST_BACKTRACE` environment variable. The easiest way
74+
a backtrace, set the `RUST_BACKTRACE` environment variable to a value
75+
other than `0`. The easiest way
7576
to do this is to invoke `rustc` like this:
7677

7778
```bash

trunk/configure

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,7 @@ opt inject-std-version 1 "inject the current compiler version of libstd into pro
608608
opt llvm-version-check 1 "check if the LLVM version is supported, build anyway"
609609
opt rustbuild 0 "use the rust and cargo based build system"
610610
opt orbit 0 "get MIR where it belongs - everywhere; most importantly, in orbit"
611+
opt codegen-tests 1 "run the src/test/codegen tests"
611612

612613
# Optimization and debugging options. These may be overridden by the release channel, etc.
613614
opt_nosave optimize 1 "build optimized rust code"
@@ -1497,7 +1498,9 @@ do
14971498
LLVM_INST_DIR=$CFG_LLVM_ROOT
14981499
do_reconfigure=0
14991500
# Check that LLVm FileCheck is available. Needed for the tests
1500-
need_cmd $LLVM_INST_DIR/bin/FileCheck
1501+
if [ -z "$CFG_DISABLE_CODEGEN_TESTS" ]; then
1502+
need_cmd $LLVM_INST_DIR/bin/FileCheck
1503+
fi
15011504
fi
15021505

15031506
if [ ${do_reconfigure} -ne 0 ]

trunk/man/rustc.1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,15 +268,15 @@ the maximum number of threads used for this purpose.
268268

269269
.TP
270270
\fBRUST_TEST_NOCAPTURE\fR
271-
A synonym for the --nocapture flag.
271+
If set to a value other than "0", a synonym for the --nocapture flag.
272272

273273
.TP
274274
\fBRUST_MIN_STACK\fR
275275
Sets the minimum stack size for new threads.
276276

277277
.TP
278278
\fBRUST_BACKTRACE\fR
279-
If set, produces a backtrace in the output of a program which panics.
279+
If set to a value different than "0", produces a backtrace in the output of a program which panics.
280280

281281
.SH "EXAMPLES"
282282
To build an executable from a source file with a main function:

trunk/mk/tests.mk

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,15 @@ check-stage$(1)-T-$(2)-H-$(3)-exec: \
305305
check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec \
306306
check-stage$(1)-T-$(2)-H-$(3)-debuginfo-gdb-exec \
307307
check-stage$(1)-T-$(2)-H-$(3)-debuginfo-lldb-exec \
308-
check-stage$(1)-T-$(2)-H-$(3)-codegen-exec \
309-
check-stage$(1)-T-$(2)-H-$(3)-codegen-units-exec \
310308
check-stage$(1)-T-$(2)-H-$(3)-doc-exec \
311309
check-stage$(1)-T-$(2)-H-$(3)-pretty-exec
312310

311+
ifndef CFG_DISABLE_CODEGEN_TESTS
312+
check-stage$(1)-T-$(2)-H-$(3)-exec: \
313+
check-stage$(1)-T-$(2)-H-$(3)-codegen-exec \
314+
check-stage$(1)-T-$(2)-H-$(3)-codegen-units-exec
315+
endif
316+
313317
# Only test the compiler-dependent crates when the target is
314318
# able to build a compiler (when the target triple is in the set of host triples)
315319
ifneq ($$(findstring $(2),$$(CFG_HOST)),)

trunk/src/bootstrap/build/mod.rs

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,13 @@ impl Build {
326326
if !target.contains("msvc") {
327327
cargo.env(format!("CC_{}", target), self.cc(target))
328328
.env(format!("AR_{}", target), self.ar(target))
329-
.env(format!("CFLAGS_{}", target), self.cflags(target));
329+
.env(format!("CFLAGS_{}", target), self.cflags(target).join(" "));
330+
}
331+
332+
// If we're building for OSX, inform the compiler and the linker that
333+
// we want to build a compiler runnable on 10.7
334+
if target.contains("apple-darwin") {
335+
cargo.env("MACOSX_DEPLOYMENT_TARGET", "10.7");
330336
}
331337

332338
// Environment variables *required* needed throughout the build
@@ -497,11 +503,20 @@ impl Build {
497503
self.cc[target].0.path()
498504
}
499505

500-
fn cflags(&self, target: &str) -> String {
501-
self.cc[target].0.args().iter()
502-
.map(|s| s.to_string_lossy())
503-
.collect::<Vec<_>>()
504-
.join(" ")
506+
fn cflags(&self, target: &str) -> Vec<String> {
507+
let mut base = self.cc[target].0.args().iter()
508+
.map(|s| s.to_string_lossy().into_owned())
509+
.collect::<Vec<_>>();
510+
511+
// If we're compiling on OSX then we add a few unconditional flags
512+
// indicating that we want libc++ (more filled out than libstdc++) and
513+
// we want to compile for 10.7. This way we can ensure that
514+
// LLVM/jemalloc/etc are all properly compiled.
515+
if target.contains("apple-darwin") {
516+
base.push("-stdlib=libc++".into());
517+
base.push("-mmacosx-version-min=10.7".into());
518+
}
519+
return base
505520
}
506521

507522
fn ar(&self, target: &str) -> &Path {

trunk/src/bootstrap/build/native.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ pub fn llvm(build: &Build, target: &str) {
8686
.define("CMAKE_CXX_COMPILER", build.cxx(target));
8787
}
8888
cfg.build_arg("-j").build_arg(build.jobs().to_string());
89+
90+
cfg.define("CMAKE_C_FLAGS", build.cflags(target).join(" "));
91+
cfg.define("CMAKE_CXX_FLAGS", build.cflags(target).join(" "));
8992
}
9093

9194
// FIXME: we don't actually need to build all LLVM tools and all LLVM

trunk/src/compiletest/compiletest.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,10 @@ pub fn test_opts(config: &Config) -> test::TestOpts {
263263
logfile: config.logfile.clone(),
264264
run_tests: true,
265265
bench_benchmarks: true,
266-
nocapture: env::var("RUST_TEST_NOCAPTURE").is_ok(),
266+
nocapture: match env::var("RUST_TEST_NOCAPTURE") {
267+
Ok(val) => &val != "0",
268+
Err(_) => false
269+
},
267270
color: test::AutoColor,
268271
}
269272
}

trunk/src/doc/book/functions.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,19 @@ stack backtrace:
246246
13: 0x0 - <unknown>
247247
```
248248

249+
If you need to override an already set `RUST_BACKTRACE`,
250+
in cases when you cannot just unset the variable,
251+
then set it to `0` to avoid getting a backtrace.
252+
Any other value(even no value at all) turns on backtrace.
253+
254+
```text
255+
$ export RUST_BACKTRACE=1
256+
...
257+
$ RUST_BACKTRACE=0 ./diverges
258+
thread '<main>' panicked at 'This function never returns!', hello.rs:2
259+
note: Run with `RUST_BACKTRACE=1` for a backtrace.
260+
```
261+
249262
`RUST_BACKTRACE` also works with Cargo’s `run` command:
250263

251264
```text

trunk/src/libcollections/btree/map.rs

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,12 @@ pub struct Values<'a, K: 'a, V: 'a> {
285285
inner: Iter<'a, K, V>,
286286
}
287287

288+
/// A mutable iterator over a BTreeMap's values.
289+
#[unstable(feature = "map_values_mut", reason = "recently added", issue = "32551")]
290+
pub struct ValuesMut<'a, K: 'a, V: 'a> {
291+
inner: IterMut<'a, K, V>,
292+
}
293+
288294
/// An iterator over a sub-range of BTreeMap's entries.
289295
pub struct Range<'a, K: 'a, V: 'a> {
290296
front: Handle<NodeRef<marker::Immut<'a>, K, V, marker::Leaf>, marker::Edge>,
@@ -1006,6 +1012,33 @@ impl<'a, K, V> Iterator for Range<'a, K, V> {
10061012
}
10071013
}
10081014

1015+
#[unstable(feature = "map_values_mut", reason = "recently added", issue = "32551")]
1016+
impl<'a, K, V> Iterator for ValuesMut<'a, K, V> {
1017+
type Item = &'a mut V;
1018+
1019+
fn next(&mut self) -> Option<&'a mut V> {
1020+
self.inner.next().map(|(_, v)| v)
1021+
}
1022+
1023+
fn size_hint(&self) -> (usize, Option<usize>) {
1024+
self.inner.size_hint()
1025+
}
1026+
}
1027+
1028+
#[unstable(feature = "map_values_mut", reason = "recently added", issue = "32551")]
1029+
impl<'a, K, V> DoubleEndedIterator for ValuesMut<'a, K, V> {
1030+
fn next_back(&mut self) -> Option<&'a mut V> {
1031+
self.inner.next_back().map(|(_, v)| v)
1032+
}
1033+
}
1034+
1035+
#[unstable(feature = "map_values_mut", reason = "recently added", issue = "32551")]
1036+
impl<'a, K, V> ExactSizeIterator for ValuesMut<'a, K, V> {
1037+
fn len(&self) -> usize {
1038+
self.inner.len()
1039+
}
1040+
}
1041+
10091042
impl<'a, K, V> Range<'a, K, V> {
10101043
unsafe fn next_unchecked(&mut self) -> (&'a K, &'a V) {
10111044
let handle = self.front;
@@ -1403,6 +1436,33 @@ impl<K, V> BTreeMap<K, V> {
14031436
Values { inner: self.iter() }
14041437
}
14051438

1439+
/// Gets a mutable iterator over the values of the map, in order by key.
1440+
///
1441+
/// # Examples
1442+
///
1443+
/// Basic usage:
1444+
///
1445+
/// ```
1446+
/// # #![feature(map_values_mut)]
1447+
/// use std::collections::BTreeMap;
1448+
///
1449+
/// let mut a = BTreeMap::new();
1450+
/// a.insert(1, String::from("hello"));
1451+
/// a.insert(2, String::from("goodbye"));
1452+
///
1453+
/// for value in a.values_mut() {
1454+
/// value.push_str("!");
1455+
/// }
1456+
///
1457+
/// let values: Vec<String> = a.values().cloned().collect();
1458+
/// assert_eq!(values, [String::from("hello!"),
1459+
/// String::from("goodbye!")]);
1460+
/// ```
1461+
#[unstable(feature = "map_values_mut", reason = "recently added", issue = "32551")]
1462+
pub fn values_mut<'a>(&'a mut self) -> ValuesMut<'a, K, V> {
1463+
ValuesMut { inner: self.iter_mut() }
1464+
}
1465+
14061466
/// Returns the number of elements in the map.
14071467
///
14081468
/// # Examples

trunk/src/libcollectionstest/btree/map.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,21 @@ fn test_iter_rev() {
114114
test(size, map.into_iter().rev());
115115
}
116116

117+
#[test]
118+
fn test_values_mut() {
119+
let mut a = BTreeMap::new();
120+
a.insert(1, String::from("hello"));
121+
a.insert(2, String::from("goodbye"));
122+
123+
for value in a.values_mut() {
124+
value.push_str("!");
125+
}
126+
127+
let values: Vec<String> = a.values().cloned().collect();
128+
assert_eq!(values, [String::from("hello!"),
129+
String::from("goodbye!")]);
130+
}
131+
117132
#[test]
118133
fn test_iter_mixed() {
119134
let size = 10000;

trunk/src/libcollectionstest/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#![feature(enumset)]
2323
#![feature(iter_arith)]
2424
#![feature(map_entry_keys)]
25+
#![feature(map_values_mut)]
2526
#![feature(pattern)]
2627
#![feature(rand)]
2728
#![feature(set_recovery)]

trunk/src/libcore/num/dec2flt/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ from_str_float_impl!(f64);
154154
/// for [`f32`] and [`f64`].
155155
///
156156
/// [`FromStr`]: ../str/trait.FromStr.html
157-
/// [`f32`]: ../primitive.f32.html
158-
/// [`f64`]: ../primitive.f64.html
157+
/// [`f32`]: ../../std/primitive.f32.html
158+
/// [`f64`]: ../../std/primitive.f64.html
159159
#[derive(Debug, Clone, PartialEq)]
160160
#[stable(feature = "rust1", since = "1.0.0")]
161161
pub struct ParseFloatError {

trunk/src/librustc/cfg/construct.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -583,13 +583,11 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
583583
return *l;
584584
}
585585
}
586-
self.tcx.sess.span_bug(expr.span,
587-
&format!("no loop scope for id {}", loop_id));
586+
span_bug!(expr.span, "no loop scope for id {}", loop_id);
588587
}
589588

590589
r => {
591-
self.tcx.sess.span_bug(expr.span,
592-
&format!("bad entry `{:?}` in def_map for label", r));
590+
span_bug!(expr.span, "bad entry `{:?}` in def_map for label", r);
593591
}
594592
}
595593
}

trunk/src/librustc/dep_graph/edges.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ impl DepGraphEdges {
122122
{
123123
match self.current_node() {
124124
Some(open_node) => self.add_edge_from_open_node(open_node, op),
125-
None => panic!("no current node, cannot add edge into dependency graph")
125+
None => bug!("no current node, cannot add edge into dependency graph")
126126
}
127127
}
128128

trunk/src/librustc/dep_graph/thread.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ impl DepGraphThreadData {
148148

149149
// Outline this too.
150150
fn invalid_message(&self, string: &str) {
151-
panic!("{}; see src/librustc/dep_graph/README.md for more information", string)
151+
bug!("{}; see src/librustc/dep_graph/README.md for more information", string)
152152
}
153153
}
154154

trunk/src/librustc/front/map/blocks.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,21 +231,21 @@ impl<'a> FnLikeNode<'a> {
231231
span: i.span,
232232
attrs: &i.attrs,
233233
}),
234-
_ => panic!("item FnLikeNode that is not fn-like"),
234+
_ => bug!("item FnLikeNode that is not fn-like"),
235235
},
236236
map::NodeTraitItem(ti) => match ti.node {
237237
ast::MethodTraitItem(ref sig, Some(ref body)) => {
238238
method(ti.id, ti.name, sig, None, body, ti.span, &ti.attrs)
239239
}
240-
_ => panic!("trait method FnLikeNode that is not fn-like"),
240+
_ => bug!("trait method FnLikeNode that is not fn-like"),
241241
},
242242
map::NodeImplItem(ii) => {
243243
match ii.node {
244244
ast::ImplItemKind::Method(ref sig, ref body) => {
245245
method(ii.id, ii.name, sig, Some(ii.vis), body, ii.span, &ii.attrs)
246246
}
247247
_ => {
248-
panic!("impl method FnLikeNode that is not fn-like")
248+
bug!("impl method FnLikeNode that is not fn-like")
249249
}
250250
}
251251
}
@@ -256,9 +256,9 @@ impl<'a> FnLikeNode<'a> {
256256
e.id,
257257
e.span,
258258
e.attrs.as_attr_slice())),
259-
_ => panic!("expr FnLikeNode that is not fn-like"),
259+
_ => bug!("expr FnLikeNode that is not fn-like"),
260260
},
261-
_ => panic!("other FnLikeNode that is not fn-like"),
261+
_ => bug!("other FnLikeNode that is not fn-like"),
262262
}
263263
}
264264
}

0 commit comments

Comments
 (0)