Skip to content

Commit 70edea2

Browse files
committed
---
yaml --- r: 133815 b: refs/heads/snap-stage3 c: 60d2689 h: refs/heads/master i: 133813: cc1a84e 133811: cadcb0a 133807: fb5385d v: v3
1 parent 2edf05b commit 70edea2

Some content is hidden

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

73 files changed

+818
-510
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 0e784e16840e8a0c623cc6166de26da9334db3d6
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: c4a1c3800b7964fb19f2a32519aaa0fc2c0c87fc
4+
refs/heads/snap-stage3: 60d2689ab20aef8568c5248f7c8b1a5de59a22d2
55
refs/heads/try: 777654cfccbfa39bc7f671d8e9629018ed8ca12d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/configure

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,8 @@ valopt datadir "${CFG_PREFIX}/share" "install data"
453453
valopt infodir "${CFG_PREFIX}/share/info" "install additional info"
454454
valopt mandir "${CFG_PREFIX}/share/man" "install man pages in PATH"
455455

456+
valopt release-channel "source" "the name of the release channel to build"
457+
456458
# On windows we just store the libraries in the bin directory because
457459
# there's no rpath. This is where the build system itself puts libraries;
458460
# --libdir is used to configure the installation directory.
@@ -481,6 +483,23 @@ CFG_BUILD=`echo "${CFG_BUILD}" | sed 's/-pc-mingw32/-w64-mingw32/g'`
481483
CFG_HOST=`echo "${CFG_HOST}" | sed 's/-pc-mingw32/-w64-mingw32/g'`
482484
CFG_TARGET=`echo "${CFG_TARGET}" | sed 's/-pc-mingw32/-w64-mingw32/g'`
483485

486+
# Validate the release channel
487+
case "$CFG_RELEASE_CHANNEL" in
488+
(source | nightly | beta | stable)
489+
;;
490+
(*)
491+
err "release channel must be 'source', 'nightly', 'beta' or 'stable'"
492+
;;
493+
esac
494+
495+
# Continue supporting the old --enable-nightly flag to transition the bots
496+
# XXX Remove me
497+
if [ $CFG_ENABLE_NIGHTLY -eq 1 ]
498+
then
499+
CFG_RELEASE_CHANNEL=nightly
500+
putvar CFG_RELEASE_CHANNEL
501+
fi
502+
484503
step_msg "looking for build programs"
485504

486505
probe_need CFG_PERL perl
@@ -636,7 +655,7 @@ then
636655
# check that gcc, cc and g++ all point to the same compiler.
637656
# note that for xcode 5, g++ points to clang, not clang++
638657
if !((chk_cc gcc clang && chk_cc g++ clang) ||
639-
(chk_cc gcc gcc &&( chk_cc g++ g++ || chk g++ gcc))) then
658+
(chk_cc gcc gcc &&( chk_cc g++ g++ || chk g++ gcc))); then
640659
err "the gcc and g++ in your path point to different compilers.
641660
Check which versions are in your path with gcc --version and g++ --version.
642661
To resolve this problem, either fix your PATH or run configure with --enable-clang"

branches/snap-stage3/man/rustc.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH RUSTC "1" "March 2014" "rustc 0.12.0-pre" "User Commands"
1+
.TH RUSTC "1" "March 2014" "rustc 0.12.0" "User Commands"
22
.SH NAME
33
rustc \- The Rust compiler
44
.SH SYNOPSIS

branches/snap-stage3/man/rustdoc.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH RUSTDOC "1" "March 2014" "rustdoc 0.12.0-pre" "User Commands"
1+
.TH RUSTDOC "1" "March 2014" "rustdoc 0.12.0" "User Commands"
22
.SH NAME
33
rustdoc \- generate documentation from Rust source code
44
.SH SYNOPSIS

branches/snap-stage3/mk/main.mk

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,32 @@
1414

1515
# The version number
1616
CFG_RELEASE_NUM=0.12.0
17-
CFG_RELEASE_LABEL=-pre
1817

1918
CFG_FILENAME_EXTRA=4e7c5e5c
2019

21-
ifndef CFG_ENABLE_NIGHTLY
22-
# This is the normal version string
23-
CFG_RELEASE=$(CFG_RELEASE_NUM)$(CFG_RELEASE_LABEL)
24-
CFG_PACKAGE_VERS=$(CFG_RELEASE)
25-
else
26-
# Modify the version label for nightly builds
27-
CFG_RELEASE=$(CFG_RELEASE_NUM)$(CFG_RELEASE_LABEL)-nightly
28-
# When building nightly distributables just reuse the same "rust-nightly" name
29-
# so when we upload we'll always override the previous nighly. This doesn't actually
30-
# impact the version reported by rustc - it's just for file naming.
20+
ifeq ($(CFG_RELEASE_CHANNEL),stable)
21+
# This is the normal semver version string, e.g. "0.12.0", "0.12.0-nightly"
22+
CFG_RELEASE=$(CFG_RELEASE_NUM)
23+
# This is the string used in dist artifact file names, e.g. "0.12.0", "nightly"
24+
CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)
25+
endif
26+
ifeq ($(CFG_RELEASE_CHANNEL),beta)
27+
CFG_RELEASE=$(CFG_RELEASE_NUM)-beta
28+
# When building beta/nightly distributables just reuse the same "beta"
29+
# name so when we upload we'll always override the previous
30+
# nighly. This doesn't actually impact the version reported by rustc -
31+
# it's just for file naming.
32+
CFG_PACKAGE_VERS=beta
33+
endif
34+
ifeq ($(CFG_RELEASE_CHANNEL),nightly)
35+
CFG_RELEASE=$(CFG_RELEASE_NUM)-nightly
3136
CFG_PACKAGE_VERS=nightly
3237
endif
38+
ifeq ($(CFG_RELEASE_CHANNEL),source)
39+
CFG_RELEASE=$(CFG_RELEASE_NUM)-pre
40+
CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)-pre
41+
endif
42+
3343
# The name of the package to use for creating tarballs, installers etc.
3444
CFG_PACKAGE_NAME=rust-$(CFG_PACKAGE_VERS)
3545

branches/snap-stage3/src/doc/guide-tasks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ fn partial_sum(start: uint) -> f64 {
235235
}
236236
237237
fn main() {
238-
let mut futures = Vec::from_fn(1000, |ind| Future::spawn( proc() { partial_sum(ind) }));
238+
let mut futures = Vec::from_fn(200, |ind| Future::spawn( proc() { partial_sum(ind) }));
239239
240240
let mut final_res = 0f64;
241241
for ft in futures.iter_mut() {

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

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@ $ curl -s https://static.rust-lang.org/rustup.sh | sudo sh
2929
(If you're concerned about `curl | sudo sh`, please keep reading. Disclaimer
3030
below.)
3131

32-
If you're on Windows, please [download this .exe and run
33-
it](https://static.rust-lang.org/dist/rust-nightly-install.exe).
32+
If you're on Windows, please download either the [32-bit
33+
installer](https://static.rust-lang.org/dist/rust-nightly-i686-w64-mingw32.exe)
34+
or the [64-bit
35+
installer](https://static.rust-lang.org/dist/rust-nightly-x86_64-w64-mingw32.exe)
36+
and run it.
3437

3538
If you decide you don't want Rust anymore, we'll be a bit sad, but that's okay.
3639
Not every programming language is great for everyone. Just pass an argument to
@@ -185,8 +188,8 @@ Next up is this line:
185188
This line does all of the work in our little program. There are a number of
186189
details that are important here. The first is that it's indented with four
187190
spaces, not tabs. Please configure your editor of choice to insert four spaces
188-
with the tab key. We provide some sample configurations for various editors
189-
[here](https://github.com/rust-lang/rust/tree/master/src/etc).
191+
with the tab key. We provide some [sample configurations for various
192+
editors](https://github.com/rust-lang/rust/tree/master/src/etc).
190193

191194
The second point is the `println!()` part. This is calling a Rust **macro**,
192195
which is how metaprogramming is done in Rust. If it were a function instead, it
@@ -392,14 +395,10 @@ By the way, in these examples, `i` indicates that the number is an integer.
392395

393396
Rust is a statically typed language, which means that we specify our types up
394397
front. So why does our first example compile? Well, Rust has this thing called
395-
"[Hindley-Milner type
396-
inference](http://en.wikipedia.org/wiki/Hindley%E2%80%93Milner_type_system)",
397-
named after some really smart type theorists. If you clicked that link, don't
398-
be scared: what this means for you is that Rust will attempt to infer the types
399-
in your program, and it's pretty good at it. If it can infer the type, Rust
398+
"type inference." If it can figure out what the type of something is, Rust
400399
doesn't require you to actually type it out.
401400

402-
We can add the type if we want to. Types come after a colon (`:`):
401+
We can add the type if we want to, though. Types come after a colon (`:`):
403402

404403
```{rust}
405404
let x: int = 5;
@@ -1281,15 +1280,15 @@ two main looping constructs: `for` and `while`.
12811280

12821281
The `for` loop is used to loop a particular number of times. Rust's `for` loops
12831282
work a bit differently than in other systems languages, however. Rust's `for`
1284-
loop doesn't look like this C `for` loop:
1283+
loop doesn't look like this "C style" `for` loop:
12851284

1286-
```{ignore,c}
1285+
```{c}
12871286
for (x = 0; x < 10; x++) {
12881287
printf( "%d\n", x );
12891288
}
12901289
```
12911290

1292-
It looks like this:
1291+
Instead, it looks like this:
12931292

12941293
```{rust}
12951294
for x in range(0i, 10i) {
@@ -1312,10 +1311,9 @@ valid for the loop body. Once the body is over, the next value is fetched from
13121311
the iterator, and we loop another time. When there are no more values, the
13131312
`for` loop is over.
13141313

1315-
In our example, the `range` function is a function, provided by Rust, that
1316-
takes a start and an end position, and gives an iterator over those values. The
1317-
upper bound is exclusive, though, so our loop will print `0` through `9`, not
1318-
`10`.
1314+
In our example, `range` is a function that takes a start and an end position,
1315+
and gives an iterator over those values. The upper bound is exclusive, though,
1316+
so our loop will print `0` through `9`, not `10`.
13191317

13201318
Rust does not have the "C style" `for` loop on purpose. Manually controlling
13211319
each element of the loop is complicated and error prone, even for experienced C
@@ -4273,7 +4271,7 @@ very common with iterators: we can ignore unnecessary bounds checks, but still
42734271
know that we're safe.
42744272

42754273
There's another detail here that's not 100% clear because of how `println!`
4276-
works. `num` is actually of type `&int`, that is, it's a reference to an `int`,
4274+
works. `num` is actually of type `&int`. That is, it's a reference to an `int`,
42774275
not an `int` itself. `println!` handles the dereferencing for us, so we don't
42784276
see it. This code works fine too:
42794277

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ There are questions that are asked quite often, and so we've made FAQs for them:
8686

8787
# The standard library
8888

89-
You can find function-level documentation for the entire standard library
90-
[here](std/index.html). There's a list of crates on the left with more specific
91-
sections, or you can use the search bar at the top to search for something if
92-
you know its name.
89+
We have [API documentation for the entire standard
90+
library](std/index.html). There's a list of crates on the left with more
91+
specific sections, or you can use the search bar at the top to search for
92+
something if you know its name.
9393

9494
# External documentation
9595

branches/snap-stage3/src/etc/kate/rust.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<!ENTITY rustIdent "[a-zA-Z_][a-zA-Z_0-9]*">
88
<!ENTITY rustIntSuf "([iu](8|16|32|64)?)?">
99
]>
10-
<language name="Rust" version="0.12.0-pre" kateversion="2.4" section="Sources" extensions="*.rs" mimetype="text/x-rust" priority="15">
10+
<language name="Rust" version="0.12.0" kateversion="2.4" section="Sources" extensions="*.rs" mimetype="text/x-rust" priority="15">
1111
<highlighting>
1212
<list name="fn">
1313
<item> fn </item>

branches/snap-stage3/src/etc/licenseck.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
"test/bench/shootout-mandelbrot.rs", # BSD
5050
"test/bench/shootout-meteor.rs", # BSD
5151
"test/bench/shootout-nbody.rs", # BSD
52-
"test/bench/shootout-pidigits.rs", # BSD
5352
"test/bench/shootout-regex-dna.rs", # BSD
5453
"test/bench/shootout-reverse-complement.rs", # BSD
5554
"test/bench/shootout-threadring.rs", # BSD

branches/snap-stage3/src/libcore/str.rs

Lines changed: 90 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,76 @@ struct TwoWaySearcher {
419419
memory: uint
420420
}
421421

422-
// This is the Two-Way search algorithm, which was introduced in the paper:
423-
// Crochemore, M., Perrin, D., 1991, Two-way string-matching, Journal of the ACM 38(3):651-675.
422+
/*
423+
This is the Two-Way search algorithm, which was introduced in the paper:
424+
Crochemore, M., Perrin, D., 1991, Two-way string-matching, Journal of the ACM 38(3):651-675.
425+
426+
Here's some background information.
427+
428+
A *word* is a string of symbols. The *length* of a word should be a familiar
429+
notion, and here we denote it for any word x by |x|.
430+
(We also allow for the possibility of the *empty word*, a word of length zero).
431+
432+
If x is any non-empty word, then an integer p with 0 < p <= |x| is said to be a
433+
*period* for x iff for all i with 0 <= i <= |x| - p - 1, we have x[i] == x[i+p].
434+
For example, both 1 and 2 are periods for the string "aa". As another example,
435+
the only period of the string "abcd" is 4.
436+
437+
We denote by period(x) the *smallest* period of x (provided that x is non-empty).
438+
This is always well-defined since every non-empty word x has at least one period,
439+
|x|. We sometimes call this *the period* of x.
440+
441+
If u, v and x are words such that x = uv, where uv is the concatenation of u and
442+
v, then we say that (u, v) is a *factorization* of x.
443+
444+
Let (u, v) be a factorization for a word x. Then if w is a non-empty word such
445+
that both of the following hold
446+
447+
- either w is a suffix of u or u is a suffix of w
448+
- either w is a prefix of v or v is a prefix of w
449+
450+
then w is said to be a *repetition* for the factorization (u, v).
451+
452+
Just to unpack this, there are four possibilities here. Let w = "abc". Then we
453+
might have:
454+
455+
- w is a suffix of u and w is a prefix of v. ex: ("lolabc", "abcde")
456+
- w is a suffix of u and v is a prefix of w. ex: ("lolabc", "ab")
457+
- u is a suffix of w and w is a prefix of v. ex: ("bc", "abchi")
458+
- u is a suffix of w and v is a prefix of w. ex: ("bc", "a")
459+
460+
Note that the word vu is a repetition for any factorization (u,v) of x = uv,
461+
so every factorization has at least one repetition.
462+
463+
If x is a string and (u, v) is a factorization for x, then a *local period* for
464+
(u, v) is an integer r such that there is some word w such that |w| = r and w is
465+
a repetition for (u, v).
466+
467+
We denote by local_period(u, v) the smallest local period of (u, v). We sometimes
468+
call this *the local period* of (u, v). Provided that x = uv is non-empty, this
469+
is well-defined (because each non-empty word has at least one factorization, as
470+
noted above).
471+
472+
It can be proven that the following is an equivalent definition of a local period
473+
for a factorization (u, v): any positive integer r such that x[i] == x[i+r] for
474+
all i such that |u| - r <= i <= |u| - 1 and such that both x[i] and x[i+r] are
475+
defined. (i.e. i > 0 and i + r < |x|).
476+
477+
Using the above reformulation, it is easy to prove that
478+
479+
1 <= local_period(u, v) <= period(uv)
480+
481+
A factorization (u, v) of x such that local_period(u,v) = period(x) is called a
482+
*critical factorization*.
483+
484+
The algorithm hinges on the following theorem, which is stated without proof:
485+
486+
**Critical Factorization Theorem** Any word x has at least one critical
487+
factorization (u, v) such that |u| < period(x).
488+
489+
The purpose of maximal_suffix is to find such a critical factorization.
490+
491+
*/
424492
impl TwoWaySearcher {
425493
fn new(needle: &[u8]) -> TwoWaySearcher {
426494
let (crit_pos1, period1) = TwoWaySearcher::maximal_suffix(needle, false);
@@ -436,15 +504,19 @@ impl TwoWaySearcher {
436504
period = period2;
437505
}
438506

507+
// This isn't in the original algorithm, as far as I'm aware.
439508
let byteset = needle.iter()
440509
.fold(0, |a, &b| (1 << ((b & 0x3f) as uint)) | a);
441510

442-
// The logic here (calculating crit_pos and period, the final if statement to see which
443-
// period to use for the TwoWaySearcher) is essentially an implementation of the
444-
// "small-period" function from the paper (p. 670)
511+
// A particularly readable explanation of what's going on here can be found
512+
// in Crochemore and Rytter's book "Text Algorithms", ch 13. Specifically
513+
// see the code for "Algorithm CP" on p. 323.
445514
//
446-
// In the paper they check whether `needle.slice_to(crit_pos)` is a suffix of
447-
// `needle.slice(crit_pos, crit_pos + period)`, which is precisely what this does
515+
// What's going on is we have some critical factorization (u, v) of the
516+
// needle, and we want to determine whether u is a suffix of
517+
// v.slice_to(period). If it is, we use "Algorithm CP1". Otherwise we use
518+
// "Algorithm CP2", which is optimized for when the period of the needle
519+
// is large.
448520
if needle.slice_to(crit_pos) == needle.slice(period, period + crit_pos) {
449521
TwoWaySearcher {
450522
crit_pos: crit_pos,
@@ -466,6 +538,11 @@ impl TwoWaySearcher {
466538
}
467539
}
468540

541+
// One of the main ideas of Two-Way is that we factorize the needle into
542+
// two halves, (u, v), and begin trying to find v in the haystack by scanning
543+
// left to right. If v matches, we try to match u by scanning right to left.
544+
// How far we can jump when we encounter a mismatch is all based on the fact
545+
// that (u, v) is a critical factorization for the needle.
469546
#[inline]
470547
fn next(&mut self, haystack: &[u8], needle: &[u8], long_period: bool) -> Option<(uint, uint)> {
471548
'search: loop {
@@ -479,6 +556,9 @@ impl TwoWaySearcher {
479556
((haystack[self.position + needle.len() - 1] & 0x3f)
480557
as uint)) & 1 == 0 {
481558
self.position += needle.len();
559+
if !long_period {
560+
self.memory = 0;
561+
}
482562
continue 'search;
483563
}
484564

@@ -517,9 +597,9 @@ impl TwoWaySearcher {
517597
}
518598
}
519599

520-
// returns (i, p) where i is the "critical position", the starting index of
521-
// of maximal suffix, and p is the period of the suffix
522-
// see p. 668 of the paper
600+
// Computes a critical factorization (u, v) of `arr`.
601+
// Specifically, returns (i, p), where i is the starting index of v in some
602+
// critical factorization (u, v) and p = period(v)
523603
#[inline]
524604
fn maximal_suffix(arr: &[u8], reversed: bool) -> (uint, uint) {
525605
let mut left = -1; // Corresponds to i in the paper

branches/snap-stage3/src/libcoretest/str.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ fn strslice_issue_16589() {
2626
check_contains_all_substrings("012345678901234567890123456789bcdabcdabcd");
2727
}
2828

29+
#[test]
30+
fn strslice_issue_16878() {
31+
assert!(!"1234567ah012345678901ah".contains("hah"));
32+
assert!(!"00abc01234567890123456789abc".contains("bcabc"));
33+
}
34+
2935

3036
#[test]
3137
fn test_strslice_contains() {

branches/snap-stage3/src/libnum/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@
4646
#![feature(default_type_params)]
4747

4848
#![crate_name = "num"]
49-
#![experimental]
49+
#![deprecated = "This is now a cargo package located at: \
50+
https://github.com/rust-lang/num"]
51+
#![allow(deprecated)]
5052
#![crate_type = "rlib"]
5153
#![crate_type = "dylib"]
5254
#![license = "MIT/ASL2"]

0 commit comments

Comments
 (0)