Skip to content

Commit a56d974

Browse files
committed
---
yaml --- r: 214973 b: refs/heads/beta c: 8a39dff h: refs/heads/master i: 214971: 03955e8 v: v3
1 parent a1a796e commit a56d974

File tree

23 files changed

+623
-311
lines changed

23 files changed

+623
-311
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 01ddbe9f33f409a5274d36cd7f0609263eab4764
26+
refs/heads/beta: 8a39dffa7f3afc974073d8f62b9dfcb419e03f4e
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: 8c0aa6d64ebab528f7eb182812007155d6044972
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/configure

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,7 @@ valopt sysconfdir "/etc" "install system configuration files"
582582
valopt datadir "${CFG_PREFIX}/share" "install data"
583583
valopt infodir "${CFG_PREFIX}/share/info" "install additional info"
584584
valopt llvm-root "" "set LLVM root"
585+
valopt python "" "set path to python"
585586
valopt jemalloc-root "" "set directory where libjemalloc_pic.a is located"
586587
valopt build "${DEFAULT_BUILD}" "GNUs ./configure syntax LLVM build triple"
587588
valopt android-cross-path "/opt/ndk_standalone" "Android NDK standalone path"
@@ -695,7 +696,9 @@ putvar CFG_BOOTSTRAP_KEY
695696
step_msg "looking for build programs"
696697

697698
probe_need CFG_CURLORWGET curl wget
698-
probe_need CFG_PYTHON python2.7 python2.6 python2 python
699+
if [ -z "$CFG_PYTHON_PROVIDED" ]; then
700+
probe_need CFG_PYTHON python2.7 python2.6 python2 python
701+
fi
699702

700703
python_version=$($CFG_PYTHON -V 2>&1)
701704
if [ $(echo $python_version | grep -c '^Python 2\.[4567]') -ne 1 ]; then
@@ -849,13 +852,6 @@ then
849852
putvar CFG_LOCAL_RUST_ROOT
850853
fi
851854

852-
# Force freebsd to build with clang; gcc doesn't like us there
853-
if [ $CFG_OSTYPE = unknown-freebsd ]
854-
then
855-
step_msg "on FreeBSD, forcing use of clang"
856-
CFG_ENABLE_CLANG=1
857-
fi
858-
859855
# Force bitrig to build with clang; gcc doesn't like us there
860856
if [ $CFG_OSTYPE = unknown-bitrig ]
861857
then

branches/beta/mk/docs.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ endef
265265
$(foreach crate,$(CRATES),$(eval $(call DEF_LIB_DOC,$(crate))))
266266

267267
COMPILER_DOC_TARGETS := $(CRATES:%=doc/%/index.html)
268-
ifdef CFG_COMPILER_DOCS
268+
ifdef CFG_ENABLE_COMPILER_DOCS
269269
DOC_TARGETS += $(COMPILER_DOC_TARGETS)
270270
else
271271
DOC_TARGETS += $(DOC_CRATES:%=doc/%/index.html)

branches/beta/src/compiletest/runtest.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ use std::fmt;
2424
use std::fs::{self, File};
2525
use std::io::BufReader;
2626
use std::io::prelude::*;
27-
use std::iter::repeat;
2827
use std::net::TcpStream;
2928
use std::path::{Path, PathBuf};
3029
use std::process::{Command, Output, ExitStatus};
@@ -928,12 +927,12 @@ fn check_forbid_output(props: &TestProps,
928927
}
929928
}
930929

931-
fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
930+
fn check_expected_errors(expected_errors: Vec<errors::ExpectedError>,
932931
testfile: &Path,
933932
proc_res: &ProcRes) {
934933

935934
// true if we found the error in question
936-
let mut found_flags: Vec<_> = repeat(false).take(expected_errors.len()).collect();
935+
let mut found_flags = vec![false; expected_errors.len()];
937936

938937
if proc_res.status.success() {
939938
fatal("process did not return an error status");
@@ -954,14 +953,10 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
954953
}
955954
}
956955

957-
// A multi-line error will have followup lines which will always
958-
// start with one of these strings.
956+
// A multi-line error will have followup lines which start with a space
957+
// or open paren.
959958
fn continuation( line: &str) -> bool {
960-
line.starts_with(" expected") ||
961-
line.starts_with(" found") ||
962-
// 1234
963-
// Should have 4 spaces: see issue 18946
964-
line.starts_with("(")
959+
line.starts_with(" ") || line.starts_with("(")
965960
}
966961

967962
// Scan and extract our error/warning messages,

branches/beta/src/doc/reference.md

Lines changed: 140 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,9 +1943,6 @@ macro scope.
19431943
- `simd` - on certain tuple structs, derive the arithmetic operators, which
19441944
lower to the target's SIMD instructions, if any; the `simd` feature gate
19451945
is necessary to use this attribute.
1946-
- `static_assert` - on statics whose type is `bool`, terminates compilation
1947-
with an error if it is not initialized to `true`. To use this, the `static_assert`
1948-
feature gate must be enabled.
19491946
- `unsafe_no_drop_flag` - on structs, remove the flag that prevents
19501947
destructors from being run twice. Destructors might be run multiple times on
19511948
the same object with this attribute. To use this, the `unsafe_no_drop_flag` feature
@@ -2301,12 +2298,6 @@ The currently implemented features of the reference compiler are:
23012298
crate. Stability markers are also attributes: `#[stable]`,
23022299
`#[unstable]`, and `#[deprecated]` are the three levels.
23032300

2304-
* `static_assert` - The `#[static_assert]` functionality is experimental and
2305-
unstable. The attribute can be attached to a `static` of
2306-
type `bool` and the compiler will error if the `bool` is
2307-
`false` at compile time. This version of this functionality
2308-
is unintuitive and suboptimal.
2309-
23102301
* `start` - Allows use of the `#[start]` attribute, which changes the entry point
23112302
into a Rust program. This capability, especially the signature for the
23122303
annotated function, is subject to change.
@@ -3608,6 +3599,146 @@ The notation `&self` is a shorthand for `self: &Self`. In this case,
36083599
in the impl, `Self` refers to the value of type `String` that is the
36093600
receiver for a call to the method `make_string`.
36103601

3602+
## Subtyping
3603+
3604+
Subtyping is implicit and can occur at any stage in type checking or
3605+
inference. Subtyping in Rust is very restricted and occurs only due to
3606+
variance with respect to lifetimes and between types with higher ranked
3607+
lifetimes. If we were to erase lifetimes from types, then the only subtyping
3608+
would be due to type equality.
3609+
3610+
Consider the following example: string literals always have `'static`
3611+
lifetime. Nevertheless, we can assign `s` to `t`:
3612+
3613+
```
3614+
fn bar<'a>() {
3615+
let s: &'static str = "hi";
3616+
let t: &'a str = s;
3617+
}
3618+
```
3619+
Since `'static` "lives longer" than `'a`, `&'static str` is a subtype of
3620+
`&'a str`.
3621+
3622+
## Type coercions
3623+
3624+
Coercions are defined in [RFC401]. A coercion is implicit and has no syntax.
3625+
3626+
[RFC401]: https://github.com/rust-lang/rfcs/blob/master/text/0401-coercions.md
3627+
3628+
### Coercion sites
3629+
3630+
A coercion can only occur at certain coercion sites in a program; these are
3631+
typically places where the desired type is explicit or can be dervied by
3632+
propagation from explicit types (without type inference). Possible coercion
3633+
sites are:
3634+
3635+
* `let` statements where an explicit type is given.
3636+
3637+
In `let _: U = e;`, `e` is coerced to have type `U`.
3638+
3639+
* `static` and `const` statements (similar to `let` statements).
3640+
3641+
* arguments for function calls.
3642+
3643+
The value being coerced is the
3644+
actual parameter and it is coerced to the type of the formal parameter. For
3645+
example, let `foo` be defined as `fn foo(x: U) { ... }` and call it as
3646+
`foo(e);`. Then `e` is coerced to have type `U`;
3647+
3648+
* instantiations of struct or variant fields.
3649+
3650+
Assume we have a `struct
3651+
Foo { x: U }` and instantiate it as `Foo { x: e }`. Then `e` is coerced to
3652+
have type `U`.
3653+
3654+
* function results (either the final line of a block if it is not semicolon
3655+
terminated or any expression in a `return` statement).
3656+
3657+
In `fn foo() -> U { e }`, `e` is coerced to to have type `U`.
3658+
3659+
If the expression in one of these coercion sites is a coercion-propagating
3660+
expression, then the relevant sub-expressions in that expression are also
3661+
coercion sites. Propagation recurses from these new coercion sites.
3662+
Propagating expressions and their relevant sub-expressions are:
3663+
3664+
* array literals, where the array has type `[U; n]`. Each sub-expression in
3665+
the array literal is a coercion site for coercion to type `U`.
3666+
3667+
* array literals with repeating syntax, where the array has type `[U; n]`. The
3668+
repeated sub-expression is a coercion site for coercion to type `U`.
3669+
3670+
* tuples, where a tuple is a coercion site to type `(U_0, U_1, ..., U_n)`.
3671+
Each sub-expression is a coercion site to the respective type, e.g. the
3672+
zeroth sub-expression is a coercion site to type `U_0`.
3673+
3674+
* parenthesised sub-expressions (`(e)`). If the expression has type `U`, then
3675+
the sub-expression is a coercion site to `U`.
3676+
3677+
* blocks. If a block has type `U`, then the last expression in the block (if
3678+
it is not semicolon-terminated) is a coercion site to `U`. This includes
3679+
blocks which are part of control flow statements, such as `if`/`else`, if
3680+
the block has a known type.
3681+
3682+
### Coercion types
3683+
3684+
Coercion is allowed between the following types:
3685+
3686+
* `T` to `U` if `T` is a subtype of `U` (*reflexive case*).
3687+
3688+
* `T_1` to `T_3` where `T_1` coerces to `T_2` and `T_2` coerces to `T_3`
3689+
(*transitive case*).
3690+
3691+
Note that this is not fully supported yet
3692+
3693+
* `&mut T` to `&T`.
3694+
3695+
* `*mut T` to `*const T`.
3696+
3697+
* `&T` to `*const T`.
3698+
3699+
* `&mut T` to `*mut T`.
3700+
3701+
* `&T` to `&U` if `T` implements `Deref<Target = U>`. For example:
3702+
```
3703+
use std::ops::Deref;
3704+
3705+
struct CharContainer {
3706+
value: char
3707+
}
3708+
3709+
impl Deref for CharContainer {
3710+
type Target = char;
3711+
3712+
fn deref<'a>(&'a self) -> &'a char {
3713+
&self.value
3714+
}
3715+
}
3716+
3717+
fn foo(arg: &char) {}
3718+
3719+
fn main() {
3720+
let x = &mut CharContainer { value: 'y' };
3721+
foo(x); //&mut CharContainer is coerced to &char.
3722+
}
3723+
```
3724+
* `&mut T` to `&mut U` if `T` implements `DerefMut<Target = U>`.
3725+
3726+
* TyCtor(`T`) to TyCtor(coerce_inner(`T`)), where TyCtor(`T`) is one of
3727+
- `&T`
3728+
- `&mut T`
3729+
- `*const T`
3730+
- `*mut T`
3731+
- `Box<T>`
3732+
3733+
and where
3734+
- coerce_inner(`[T, ..n]`) = `[T]`
3735+
- coerce_inner(`T`) = `U` where `T` is a concrete type which implements the
3736+
trait `U`.
3737+
3738+
In the future, coerce_inner will be recursively extended to tuples and
3739+
structs. In addition, coercions from sub-traits to super-traits will be
3740+
added. See [RFC401] for more details.
3741+
36113742
# Special traits
36123743
36133744
Several traits define special evaluation behavior.

branches/beta/src/doc/trpl/mutability.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ b.x = 10; // error: cannot assign to immutable field `b.x`
159159

160160
[struct]: structs.html
161161

162-
However, by using `Cell<T>`, you can emulate field-level mutability:
162+
However, by using [`Cell<T>`][cell], you can emulate field-level mutability:
163163

164164
```rust
165165
use std::cell::Cell;
@@ -176,4 +176,6 @@ point.y.set(7);
176176
println!("y: {:?}", point.y);
177177
```
178178

179+
[cell]: ../std/cell/struct.Cell.html
180+
179181
This will print `y: Cell { value: 7 }`. We’ve successfully updated `y`.

branches/beta/src/librustc_back/target/freebsd_base.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ pub fn opts() -> TargetOptions {
1818
executables: true,
1919
morestack: true,
2020
has_rpath: true,
21-
pre_link_args: vec!(
22-
"-L/usr/local/lib".to_string(),
23-
"-L/usr/local/lib/gcc46".to_string(),
24-
"-L/usr/local/lib/gcc44".to_string(),
25-
),
2621

2722
.. Default::default()
2823
}

0 commit comments

Comments
 (0)