Skip to content

Commit d317b6e

Browse files
committed
---
yaml --- r: 218975 b: refs/heads/snap-stage3 c: eb6a70c h: refs/heads/master i: 218973: efbdd39 218971: fb0f82f 218967: 2faa4a9 218959: 1feb75a 218943: 5255f33 v: v3
1 parent 13e8f57 commit d317b6e

File tree

19 files changed

+241
-211
lines changed

19 files changed

+241
-211
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: c044791d80ea0dc5c4b57b6030a67b69f8510239
3-
refs/heads/snap-stage3: 536c244be35110482c817e728d476162ddae09b0
3+
refs/heads/snap-stage3: eb6a70cbabbc74699e2b0331fef91be1fadad1bd
44
refs/heads/try: b53c0f93eedcdedd4fd89bccc5a3a09d1c5cd23e
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/snap-stage3/configure

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,6 +1307,12 @@ CFG_LLVM_SRC_DIR=${CFG_SRC_DIR}src/llvm/
13071307
for t in $CFG_HOST
13081308
do
13091309
do_reconfigure=1
1310+
is_msvc=0
1311+
case "$t" in
1312+
(*-msvc)
1313+
is_msvc=1
1314+
;;
1315+
esac
13101316

13111317
if [ -z $CFG_LLVM_ROOT ]
13121318
then
@@ -1326,7 +1332,13 @@ do
13261332
LLVM_ASSERTION_OPTS="--disable-assertions"
13271333
else
13281334
LLVM_ASSERTION_OPTS="--enable-assertions"
1329-
LLVM_INST_DIR=${LLVM_INST_DIR}+Asserts
1335+
1336+
# Apparently even if we request assertions be enabled for MSVC,
1337+
# LLVM's CMake build system ignore this and outputs in `Release`
1338+
# anyway.
1339+
if [ ${is_msvc} -eq 0 ]; then
1340+
LLVM_INST_DIR=${LLVM_INST_DIR}+Asserts
1341+
fi
13301342
fi
13311343
else
13321344
msg "not reconfiguring LLVM, external LLVM root"
@@ -1356,14 +1368,7 @@ do
13561368
done
13571369
fi
13581370

1359-
use_cmake=0
1360-
case "$t" in
1361-
(*-msvc)
1362-
use_cmake=1
1363-
;;
1364-
esac
1365-
1366-
if [ ${do_reconfigure} -ne 0 ] && [ ${use_cmake} -ne 0 ]
1371+
if [ ${do_reconfigure} -ne 0 ] && [ ${is_msvc} -ne 0 ]
13671372
then
13681373
msg "configuring LLVM for $t with cmake"
13691374

@@ -1388,7 +1393,7 @@ do
13881393
need_ok "LLVM cmake configure failed"
13891394
fi
13901395

1391-
if [ ${do_reconfigure} -ne 0 ] && [ ${use_cmake} -eq 0 ]
1396+
if [ ${do_reconfigure} -ne 0 ] && [ ${is_msvc} -eq 0 ]
13921397
then
13931398
# LLVM's configure doesn't recognize the new Windows triples yet
13941399
gnu_t=$(to_gnu_triple $t)

branches/snap-stage3/src/doc/index.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ series of small examples.
2525
If you need help with something, or just want to talk about Rust with others,
2626
there are a few places you can do that:
2727

28-
The Rust IRC channels on [irc.mozilla.org](http://irc.mozilla.org/) are the
28+
The Rust IRC channels on [irc.mozilla.org](irc://irc.mozilla.org/) are the
2929
fastest way to get help.
3030
[`#rust`](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust) is
3131
the general discussion channel, and you'll find people willing to help you with
@@ -40,15 +40,15 @@ There's also
4040
[`#rust-internals`](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-internals), which is for discussion of the development of Rust itself.
4141

4242
You can also get help on [Stack
43-
Overflow](http://stackoverflow.com/questions/tagged/rust). Searching for your
43+
Overflow](https://stackoverflow.com/questions/tagged/rust). Searching for your
4444
problem might reveal someone who has asked it before!
4545

46-
There is an active [subreddit](http://reddit.com/r/rust) with lots of
46+
There is an active [subreddit](https://reddit.com/r/rust) with lots of
4747
discussion and news about Rust.
4848

49-
There is also a [user forum](http://users.rust-lang.org), for all
50-
user-oriented discussion, and a [developer
51-
forum](http://internals.rust-lang.org/), where the development of Rust
49+
There is also a [user forum](https://users.rust-lang.org), for all
50+
user-oriented discussion, and a [developer
51+
forum](https://internals.rust-lang.org/), where the development of Rust
5252
itself is discussed.
5353

5454
# Specification
@@ -61,7 +61,7 @@ the language in as much detail as possible is in [the reference](reference.html)
6161
Rust is still a young language, so there isn't a ton of tooling yet, but the
6262
tools we have are really nice.
6363

64-
[Cargo](http://crates.io) is Rust's package manager, and its website contains
64+
[Cargo](https://crates.io) is Rust's package manager, and its website contains
6565
lots of good documentation.
6666

6767
[`rustdoc`](book/documentation.html) is used to generate documentation for Rust code.

branches/snap-stage3/src/doc/trpl/for-loops.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,45 @@ so our loop will print `0` through `9`, not `10`.
4141
Rust does not have the “C-style” `for` loop on purpose. Manually controlling
4242
each element of the loop is complicated and error prone, even for experienced C
4343
developers.
44+
45+
# Enumerate
46+
47+
When you need to keep track of how many times you already looped, you can use the `.enumerate()` function.
48+
49+
## On ranges:
50+
51+
```rust
52+
for (i,j) in (5..10).enumerate() {
53+
println!("i = {} and j = {}", i, j);
54+
}
55+
```
56+
57+
Outputs:
58+
59+
```text
60+
i = 0 and j = 5
61+
i = 1 and j = 6
62+
i = 2 and j = 7
63+
i = 3 and j = 8
64+
i = 4 and j = 9
65+
```
66+
67+
Don't forget to add the parentheses around the range.
68+
69+
## On iterators:
70+
71+
```rust
72+
# let lines = "hello\nworld".lines();
73+
for (linenumber, line) in lines.enumerate() {
74+
println!("{}: {}", linenumber, line);
75+
}
76+
```
77+
78+
Outputs:
79+
80+
```text
81+
0: Content of line one
82+
1: Content of line two
83+
2: Content of line tree
84+
3: Content of line four
85+
```

branches/snap-stage3/src/doc/trpl/macros.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ more" match. Both forms optionally include a separator, which can be any token
224224
except `+` or `*`.
225225

226226
This system is based on
227-
"[Macro-by-Example](http://www.cs.indiana.edu/ftp/techreports/TR206.pdf)"
227+
"[Macro-by-Example](https://www.cs.indiana.edu/ftp/techreports/TR206.pdf)"
228228
(PDF link).
229229

230230
# Hygiene
@@ -319,7 +319,7 @@ syntax context where it was introduced. It’s as though the variable `state`
319319
inside `main` is painted a different "color" from the variable `state` inside
320320
the macro, and therefore they don’t conflict.
321321

322-
[hygienic macro system]: http://en.wikipedia.org/wiki/Hygienic_macro
322+
[hygienic macro system]: https://en.wikipedia.org/wiki/Hygienic_macro
323323

324324
This also restricts the ability of macros to introduce new bindings at the
325325
invocation site. Code such as the following will not work:
@@ -622,7 +622,7 @@ invocation gives you another opportunity to pattern-match the macro’s
622622
arguments.
623623

624624
As an extreme example, it is possible, though hardly advisable, to implement
625-
the [Bitwise Cyclic Tag](http://esolangs.org/wiki/Bitwise_Cyclic_Tag) automaton
625+
the [Bitwise Cyclic Tag](https://esolangs.org/wiki/Bitwise_Cyclic_Tag) automaton
626626
within Rust’s macro system.
627627

628628
```rust

branches/snap-stage3/src/doc/trpl/references-and-borrowing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ First, any borrow must last for a smaller scope than the owner. Second, you may
155155
have one or the other of these two kinds of borrows, but not both at the same
156156
time:
157157

158-
* 0 to N references (`&T`) to a resource.
158+
* one or more references (`&T`) to a resource.
159159
* exactly one mutable reference (`&mut T`)
160160

161161

branches/snap-stage3/src/libcollections/linked_list.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,13 @@ impl<T> LinkedList<T> {
609609
length: len - at
610610
};
611611

612+
// Swap split_node.next with list_head (which is None), nulling out split_node.next,
613+
// as it is the new tail.
612614
mem::swap(&mut split_node.resolve().unwrap().next, &mut splitted_list.list_head);
615+
// Null out list_head.prev. Note this `unwrap` won't fail because if at == len
616+
// we already branched out at the top of the fn to return the empty list.
617+
splitted_list.list_head.as_mut().unwrap().prev = Rawlink::none();
618+
// Fix the tail ptr
613619
self.list_tail = split_node;
614620
self.length = at;
615621

@@ -1075,6 +1081,26 @@ mod tests {
10751081
}
10761082
}
10771083

1084+
#[test]
1085+
fn test_26021() {
1086+
use std::iter::ExactSizeIterator;
1087+
// There was a bug in split_off that failed to null out the RHS's head's prev ptr.
1088+
// This caused the RHS's dtor to walk up into the LHS at drop and delete all of
1089+
// its nodes.
1090+
//
1091+
// https://github.com/rust-lang/rust/issues/26021
1092+
let mut v1 = LinkedList::new();
1093+
v1.push_front(1u8);
1094+
v1.push_front(1u8);
1095+
v1.push_front(1u8);
1096+
v1.push_front(1u8);
1097+
let _ = v1.split_off(3); // Dropping this now should not cause laundry consumption
1098+
assert_eq!(v1.len(), 3);
1099+
1100+
assert_eq!(v1.iter().len(), 3);
1101+
assert_eq!(v1.iter().collect::<Vec<_>>().len(), 3);
1102+
}
1103+
10781104
#[cfg(test)]
10791105
fn fuzz_test(sz: i32) {
10801106
let mut m: LinkedList<_> = LinkedList::new();

branches/snap-stage3/src/librustc/middle/subst.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -448,20 +448,6 @@ impl<T> VecPerParamSpace<T> {
448448
self.self_limit)
449449
}
450450

451-
pub fn map_move<U, F>(self, mut pred: F) -> VecPerParamSpace<U> where
452-
F: FnMut(T) -> U,
453-
{
454-
let SeparateVecsPerParamSpace {
455-
types: t,
456-
selfs: s,
457-
fns: f
458-
} = self.split();
459-
460-
VecPerParamSpace::new(t.into_iter().map(|p| pred(p)).collect(),
461-
s.into_iter().map(|p| pred(p)).collect(),
462-
f.into_iter().map(|p| pred(p)).collect())
463-
}
464-
465451
pub fn split(self) -> SeparateVecsPerParamSpace<T> {
466452
let VecPerParamSpace { type_limit, self_limit, content } = self;
467453

branches/snap-stage3/src/librustc/middle/traits/fulfill.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ fn process_predicate<'a,'tcx>(selcx: &mut SelectionContext<'a,'tcx>,
329329
false
330330
}
331331
Ok(Some(s)) => {
332-
s.map_move_nested(|p| new_obligations.push(p));
332+
new_obligations.append(&mut s.nested_obligations());
333333
true
334334
}
335335
Err(selection_err) => {

0 commit comments

Comments
 (0)