Skip to content

Commit 40f2a27

Browse files
committed
---
yaml --- r: 235751 b: refs/heads/stable c: 9413a92 h: refs/heads/master i: 235749: 5bd2e0c 235747: 600a033 235743: f504a50 v: v3
1 parent 0b00551 commit 40f2a27

Some content is hidden

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

61 files changed

+1685
-475
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: afae2ff723393b3ab4ccffef6ac7c6d1809e2da0
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: f859507de8c410b648d934d8f5ec1c52daac971d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: d066a7b5069ff857a5bffe7cb5168fe63158144f
32+
refs/heads/stable: 9413a926fcfc88c46ea04534508284a822e1109f
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/doc/trpl/ffi.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ libraries:
340340
Note that frameworks are only available on OSX targets.
341341
342342
The different `kind` values are meant to differentiate how the native library
343-
participates in linkage. From a linkage perspective, the rust compiler creates
343+
participates in linkage. From a linkage perspective, the Rust compiler creates
344344
two flavors of artifacts: partial (rlib/staticlib) and final (dylib/binary).
345345
Native dynamic library and framework dependencies are propagated to the final
346346
artifact boundary, while static library dependencies are not propagated at
@@ -350,9 +350,9 @@ artifact.
350350
A few examples of how this model can be used are:
351351
352352
* A native build dependency. Sometimes some C/C++ glue is needed when writing
353-
some rust code, but distribution of the C/C++ code in a library format is just
353+
some Rust code, but distribution of the C/C++ code in a library format is just
354354
a burden. In this case, the code will be archived into `libfoo.a` and then the
355-
rust crate would declare a dependency via `#[link(name = "foo", kind =
355+
Rust crate would declare a dependency via `#[link(name = "foo", kind =
356356
"static")]`.
357357
358358
Regardless of the flavor of output for the crate, the native static library
@@ -361,7 +361,7 @@ A few examples of how this model can be used are:
361361
362362
* A normal dynamic dependency. Common system libraries (like `readline`) are
363363
available on a large number of systems, and often a static copy of these
364-
libraries cannot be found. When this dependency is included in a rust crate,
364+
libraries cannot be found. When this dependency is included in a Rust crate,
365365
partial targets (like rlibs) will not link to the library, but when the rlib
366366
is included in a final target (like a binary), the native library will be
367367
linked in.

branches/stable/src/doc/trpl/installing-rust.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The first step to using Rust is to install it! There are a number of ways to
44
install Rust, but the easiest is to use the `rustup` script. If you're on Linux
5-
or a Mac, all you need to do is this:
5+
or a Mac, all you need to do is this:
66

77
> Note: you don't need to type in the `$`s, they just indicate the start of
88
> each command. You’ll see many tutorials and examples around the web that
@@ -25,6 +25,12 @@ $ sh rustup.sh
2525
[insecurity]: http://curlpipesh.tumblr.com
2626

2727
If you're on Windows, please download the appropriate [installer][install-page].
28+
**NOTE:** By default, the Windows installer will not add Rust to the %PATH%
29+
system variable. If this is the only version of Rust you are installing and you
30+
want to be able to run it from the command line, click on "Advanced" on the
31+
install dialog and on the "Product Features" page ensure "Add to PATH" is
32+
installed on the local hard drive.
33+
2834

2935
[install-page]: http://www.rust-lang.org/install.html
3036

@@ -87,6 +93,11 @@ rustc 1.0.0 (a59de37e9 2015-05-13)
8793

8894
If you did, Rust has been installed successfully! Congrats!
8995

96+
If you didn't and you're on Windows, check that Rust is in your %PATH% system
97+
variable. If it isn't, run the installer again, select "Change" on the "Change,
98+
repair, or remove installation" page and ensure "Add to PATH" is installed on
99+
the local hard drive.
100+
90101
This installer also installs a copy of the documentation locally, so you can
91102
read it offline. On UNIX systems, `/usr/local/share/doc/rust` is the location.
92103
On Windows, it's in a `share/doc` directory, inside wherever you installed Rust
@@ -101,5 +112,5 @@ resources include [the user’s forum][users], and
101112

102113
[irc]: irc://irc.mozilla.org/#rust
103114
[mibbit]: http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust
104-
[users]: http://users.rust-lang.org/
115+
[users]: http://users.rust-lang.org/
105116
[stackoverflow]: http://stackoverflow.com/questions/tagged/rust

branches/stable/src/doc/trpl/release-channels.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,26 @@ This will help alert the team in case there’s an accidental regression.
4343
Additionally, testing against nightly can catch regressions even sooner, and so
4444
if you don’t mind a third build, we’d appreciate testing against all channels.
4545

46+
As an example, many Rust programmers use [Travis](https://travis-ci.org/) to
47+
test their crates, which is free for open source projects. Travis [supports
48+
Rust directly][travis], and you can use a `.travis.yml` file like this to
49+
test on all channels:
50+
51+
```yaml
52+
language: rust
53+
rust:
54+
- nightly
55+
- beta
56+
- stable
57+
58+
matrix:
59+
allow_failures:
60+
- rust: nightly
61+
```
62+
63+
[travis]: http://docs.travis-ci.com/user/languages/rust/
64+
65+
With this configuration, Travis will test all three channels, but if something
66+
breaks on nightly, it won’t fail your build. A similar configuration is
67+
recommended for any CI system, check the documentation of the one you’re
68+
using for more details.

branches/stable/src/doc/trpl/unsafe.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,14 @@ that you normally can not do. Just three. Here they are:
100100

101101
That’s it. It’s important that `unsafe` does not, for example, ‘turn off the
102102
borrow checker’. Adding `unsafe` to some random Rust code doesn’t change its
103-
semantics, it won’t just start accepting anything.
103+
semantics, it won’t just start accepting anything. But it will let you write
104+
things that _do_ break some of the rules.
104105

105-
But it will let you write things that _do_ break some of the rules. Let’s go
106-
over these three abilities in order.
106+
You will also encounter the `unsafe` keyword when writing bindings to foreign
107+
(non-Rust) interfaces. You're encouraged to write a safe, native Rust interface
108+
around the methods provided by the library.
109+
110+
Let’s go over the basic three abilities listed, in order.
107111

108112
## Access or update a `static mut`
109113

branches/stable/src/libcore/iter.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2555,7 +2555,7 @@ impl<I: RandomAccessIterator, F> RandomAccessIterator for Inspect<I, F>
25552555
#[unstable(feature = "iter_unfold")]
25562556
#[derive(Clone)]
25572557
#[deprecated(since = "1.2.0",
2558-
reason = "has gained enough traction to retain its position \
2558+
reason = "has not gained enough traction to retain its position \
25592559
in the standard library")]
25602560
#[allow(deprecated)]
25612561
pub struct Unfold<St, F> {
@@ -2567,7 +2567,7 @@ pub struct Unfold<St, F> {
25672567

25682568
#[unstable(feature = "iter_unfold")]
25692569
#[deprecated(since = "1.2.0",
2570-
reason = "has gained enough traction to retain its position \
2570+
reason = "has not gained enough traction to retain its position \
25712571
in the standard library")]
25722572
#[allow(deprecated)]
25732573
impl<A, St, F> Unfold<St, F> where F: FnMut(&mut St) -> Option<A> {
@@ -3018,7 +3018,7 @@ type IterateState<T, F> = (F, Option<T>, bool);
30183018
/// from a given seed value.
30193019
#[unstable(feature = "iter_iterate")]
30203020
#[deprecated(since = "1.2.0",
3021-
reason = "has gained enough traction to retain its position \
3021+
reason = "has not gained enough traction to retain its position \
30223022
in the standard library")]
30233023
#[allow(deprecated)]
30243024
pub type Iterate<T, F> = Unfold<IterateState<T, F>, fn(&mut IterateState<T, F>) -> Option<T>>;
@@ -3027,7 +3027,7 @@ pub type Iterate<T, F> = Unfold<IterateState<T, F>, fn(&mut IterateState<T, F>)
30273027
/// repeated applications of the given function `f`.
30283028
#[unstable(feature = "iter_iterate")]
30293029
#[deprecated(since = "1.2.0",
3030-
reason = "has gained enough traction to retain its position \
3030+
reason = "has not gained enough traction to retain its position \
30313031
in the standard library")]
30323032
#[allow(deprecated)]
30333033
pub fn iterate<T, F>(seed: T, f: F) -> Iterate<T, F> where

branches/stable/src/libcore/str/mod.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -871,12 +871,12 @@ impl<'a> DoubleEndedIterator for LinesAny<'a> {
871871
Section: Comparing strings
872872
*/
873873

874-
// share the implementation of the lang-item vs. non-lang-item
875-
// eq_slice.
874+
/// Bytewise slice equality
876875
/// NOTE: This function is (ab)used in rustc::middle::trans::_match
877876
/// to compare &[u8] byte slices that are not necessarily valid UTF-8.
877+
#[lang = "str_eq"]
878878
#[inline]
879-
fn eq_slice_(a: &str, b: &str) -> bool {
879+
fn eq_slice(a: &str, b: &str) -> bool {
880880
// NOTE: In theory n should be libc::size_t and not usize, but libc is not available here
881881
#[allow(improper_ctypes)]
882882
extern { fn memcmp(s1: *const i8, s2: *const i8, n: usize) -> i32; }
@@ -887,15 +887,6 @@ fn eq_slice_(a: &str, b: &str) -> bool {
887887
}
888888
}
889889

890-
/// Bytewise slice equality
891-
/// NOTE: This function is (ab)used in rustc::middle::trans::_match
892-
/// to compare &[u8] byte slices that are not necessarily valid UTF-8.
893-
#[lang = "str_eq"]
894-
#[inline]
895-
fn eq_slice(a: &str, b: &str) -> bool {
896-
eq_slice_(a, b)
897-
}
898-
899890
/*
900891
Section: Misc
901892
*/

branches/stable/src/librustc/diagnostics.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,24 @@ This error indicates that an attempt was made to divide by zero (or take the
335335
remainder of a zero divisor) in a static or constant expression.
336336
"##,
337337

338+
E0030: r##"
339+
When matching against a range, the compiler verifies that the range is
340+
non-empty. Range patterns include both end-points, so this is equivalent to
341+
requiring the start of the range to be less than or equal to the end of the
342+
range.
343+
344+
For example:
345+
346+
```
347+
match 5u32 {
348+
// This range is ok, albeit pointless.
349+
1 ... 1 => ...
350+
// This range is empty, and the compiler can tell.
351+
1000 ... 5 => ...
352+
}
353+
```
354+
"##,
355+
338356
E0079: r##"
339357
Enum variants which contain no data can be given a custom integer
340358
representation. This error indicates that the value provided is not an

branches/stable/src/librustc/middle/check_const.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
use middle::cast::{CastKind};
2828
use middle::const_eval;
29+
use middle::const_eval::EvalHint::ExprTypeChecked;
2930
use middle::def;
3031
use middle::expr_use_visitor as euv;
3132
use middle::infer;
@@ -39,6 +40,7 @@ use syntax::codemap::Span;
3940
use syntax::visit::{self, Visitor};
4041

4142
use std::collections::hash_map::Entry;
43+
use std::cmp::Ordering;
4244

4345
// Const qualification, from partial to completely promotable.
4446
bitflags! {
@@ -365,6 +367,19 @@ impl<'a, 'tcx, 'v> Visitor<'v> for CheckCrateVisitor<'a, 'tcx> {
365367
ast::PatRange(ref start, ref end) => {
366368
self.global_expr(Mode::Const, &**start);
367369
self.global_expr(Mode::Const, &**end);
370+
371+
match const_eval::compare_lit_exprs(self.tcx, start, end) {
372+
Some(Ordering::Less) |
373+
Some(Ordering::Equal) => {}
374+
Some(Ordering::Greater) => {
375+
span_err!(self.tcx.sess, start.span, E0030,
376+
"lower range bound must be less than or equal to upper");
377+
}
378+
None => {
379+
self.tcx.sess.span_bug(
380+
start.span, "literals of different types in range pat");
381+
}
382+
}
368383
}
369384
_ => visit::walk_pat(self, p)
370385
}
@@ -457,7 +472,8 @@ impl<'a, 'tcx, 'v> Visitor<'v> for CheckCrateVisitor<'a, 'tcx> {
457472
match node_ty.sty {
458473
ty::TyUint(_) | ty::TyInt(_) if div_or_rem => {
459474
if !self.qualif.intersects(ConstQualif::NOT_CONST) {
460-
match const_eval::eval_const_expr_partial(self.tcx, ex, None) {
475+
match const_eval::eval_const_expr_partial(
476+
self.tcx, ex, ExprTypeChecked) {
461477
Ok(_) => {}
462478
Err(msg) => {
463479
span_err!(self.tcx.sess, msg.span, E0020,

branches/stable/src/librustc/middle/check_match.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use self::WitnessPreference::*;
1515
use middle::const_eval::{compare_const_vals, ConstVal};
1616
use middle::const_eval::{eval_const_expr, eval_const_expr_partial};
1717
use middle::const_eval::{const_expr_to_pat, lookup_const_by_id};
18+
use middle::const_eval::EvalHint::ExprTypeChecked;
1819
use middle::def::*;
1920
use middle::expr_use_visitor::{ConsumeMode, Delegate, ExprUseVisitor, Init};
2021
use middle::expr_use_visitor::{JustWrite, LoanCause, MutateMode};
@@ -263,7 +264,7 @@ fn check_for_bindings_named_the_same_as_variants(cx: &MatchCheckCtxt, pat: &Pat)
263264
fn check_for_static_nan(cx: &MatchCheckCtxt, pat: &Pat) {
264265
ast_util::walk_pat(pat, |p| {
265266
if let ast::PatLit(ref expr) = p.node {
266-
match eval_const_expr_partial(cx.tcx, &**expr, None) {
267+
match eval_const_expr_partial(cx.tcx, &**expr, ExprTypeChecked) {
267268
Ok(ConstVal::Float(f)) if f.is_nan() => {
268269
span_warn!(cx.tcx.sess, p.span, E0003,
269270
"unmatchable NaN in pattern, \

0 commit comments

Comments
 (0)