Skip to content

Commit dc4a3ac

Browse files
committed
---
yaml --- r: 212079 b: refs/heads/tmp c: 81a413b h: refs/heads/master i: 212077: f83cf86 212075: 65a7eeb 212071: d88ed04 212063: 3144c7b v: v3
1 parent 15700f0 commit dc4a3ac

Some content is hidden

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

50 files changed

+44
-423
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3232
refs/heads/beta: 62e70d35be3fe532c26a400b499c58a18f18dd3a
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
35-
refs/heads/tmp: 253fb5bd8b7b5b433f67c88c4d9a89130743b059
35+
refs/heads/tmp: 81a413bb011ef7051073bc0c1cea735f45e64ce8
3636
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3737
refs/tags/homu-tmp: b77d60adb019bb5de05e884a99f3290ec4694137
3838
refs/heads/gate: 97c84447b65164731087ea82685580cc81424412

branches/tmp/src/doc/style/features/functions-and-methods/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ for any operation that is clearly associated with a particular
2020
type.
2121

2222
Methods have numerous advantages over functions:
23-
2423
* They do not need to be imported or qualified to be used: all you
2524
need is a value of the appropriate type.
2625
* Their invocation performs autoborrowing (including mutable borrows).

branches/tmp/src/doc/style/features/functions-and-methods/input.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ fn foo(a: u8) { ... }
159159
Note that
160160
[`ascii::Ascii`](http://static.rust-lang.org/doc/master/std/ascii/struct.Ascii.html)
161161
is a _wrapper_ around `u8` that guarantees the highest bit is zero; see
162-
[newtype patterns](../types/newtype.md) for more details on creating typesafe wrappers.
162+
[newtype patterns]() for more details on creating typesafe wrappers.
163163
164164
Static enforcement usually comes at little run-time cost: it pushes the
165165
costs to the boundaries (e.g. when a `u8` is first converted into an

branches/tmp/src/doc/style/features/let.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Prefer
3434

3535
```rust
3636
let foo = match bar {
37-
Baz => 0,
37+
Baz => 0,
3838
Quux => 1
3939
};
4040
```
@@ -44,7 +44,7 @@ over
4444
```rust
4545
let foo;
4646
match bar {
47-
Baz => {
47+
Baz => {
4848
foo = 0;
4949
}
5050
Quux => {
@@ -61,8 +61,8 @@ conditional expression.
6161
Prefer
6262

6363
```rust
64-
let v = s.iter().map(|x| x * 2)
65-
.collect::<Vec<_>>();
64+
s.iter().map(|x| x * 2)
65+
.collect::<Vec<_>>()
6666
```
6767

6868
over

branches/tmp/src/doc/style/ownership/builders.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ If `T` is such a data structure, consider introducing a `T` _builder_:
1616
value. When possible, choose a better name: e.g. `Command` is the builder for
1717
`Process`.
1818
2. The builder constructor should take as parameters only the data _required_ to
19-
make a `T`.
19+
to make a `T`.
2020
3. The builder should offer a suite of convenient methods for configuration,
2121
including setting up compound inputs (like slices) incrementally.
2222
These methods should return `self` to allow chaining.

branches/tmp/src/doc/trpl/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ language would.
1515

1616
[rust]: http://rust-lang.org
1717

18-
“The Rust Programming Language” is split into seven sections. This introduction
18+
“The Rust Programming Language” is split into eight sections. This introduction
1919
is the first. After this:
2020

2121
* [Getting started][gs] - Set up your computer for Rust development.

branches/tmp/src/doc/trpl/glossary.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ In the example above `x` and `y` have arity 2. `z` has arity 3.
1919

2020
When a compiler is compiling your program, it does a number of different
2121
things. One of the things that it does is turn the text of your program into an
22-
‘abstract syntax tree’, or ‘AST’. This tree is a representation of the
22+
‘abstract syntax tree’, or‘AST’. This tree is a representation of the
2323
structure of your program. For example, `2 + 3` can be turned into a tree:
2424

2525
```text

branches/tmp/src/doc/trpl/lifetimes.md

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -134,29 +134,8 @@ x: &'a i32,
134134
# }
135135
```
136136

137-
uses it. So why do we need a lifetime here? We need to ensure that any reference
138-
to a `Foo` cannot outlive the reference to an `i32` it contains.
139-
140-
If you have multiple references, you can use the same lifetime multiple times:
141-
142-
```rust
143-
fn x_or_y<'a>(x: &'a str, y: &'a str) -> &'a str {
144-
# x
145-
# }
146-
```
147-
148-
This says that `x` and `y` both are alive for the same scope, and that the
149-
return value is also alive for that scope. If you wanted `x` and `y` to have
150-
different lifetimes, you can use multiple lifetime parameters:
151-
152-
```rust
153-
fn x_or_y<'a, 'b>(x: &'a str, y: &'b str) -> &'a str {
154-
# x
155-
# }
156-
```
157-
158-
In this example, `x` and `y` have different valid scopes, but the return value
159-
has the same lifetime as `x`.
137+
uses it. So why do we need a lifetime here? We need to ensure that any
138+
reference to the contained `i32` does not outlive the containing `Foo`.
160139

161140
## Thinking in scopes
162141

branches/tmp/src/doc/trpl/method-syntax.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Functions are great, but if you want to call a bunch of them on some data, it
44
can be awkward. Consider this code:
55

66
```rust,ignore
7-
baz(bar(foo));
7+
baz(bar(foo)));
88
```
99

1010
We would read this left-to right, and so we see ‘baz bar foo’. But this isn’t the

branches/tmp/src/doc/trpl/traits.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ fn bar<T, K>(x: T, y: K) where T: Clone, K: Clone + Debug {
285285

286286
fn main() {
287287
foo("Hello", "world");
288-
bar("Hello", "world");
288+
bar("Hello", "workd");
289289
}
290290
```
291291

branches/tmp/src/libcollectionstest/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#![feature(collections)]
1515
#![feature(collections_drain)]
1616
#![feature(core)]
17-
#![feature(const_fn)]
1817
#![feature(hash)]
1918
#![feature(rand)]
2019
#![feature(rustc_private)]

branches/tmp/src/libcore/mem.rs

Lines changed: 6 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -52,61 +52,20 @@ pub use intrinsics::transmute;
5252
/// * `mpsc::{Sender, Receiver}` cycles (they use `Arc` internally)
5353
/// * Panicking destructors are likely to leak local resources
5454
///
55-
/// # When To Use
56-
///
57-
/// There's only a few reasons to use this function. They mainly come
58-
/// up in unsafe code or FFI code.
59-
///
60-
/// * You have an uninitialized value, perhaps for performance reasons, and
61-
/// need to prevent the destructor from running on it.
62-
/// * You have two copies of a value (like `std::mem::swap`), but need the
63-
/// destructor to only run once to prevent a double free.
64-
/// * Transferring resources across FFI boundries.
65-
///
6655
/// # Example
6756
///
68-
/// Leak some heap memory by never deallocating it.
69-
///
70-
/// ```rust
57+
/// ```rust,no_run
7158
/// use std::mem;
59+
/// use std::fs::File;
7260
///
61+
/// // Leak some heap memory by never deallocating it
7362
/// let heap_memory = Box::new(3);
7463
/// mem::forget(heap_memory);
75-
/// ```
76-
///
77-
/// Leak an I/O object, never closing the file.
78-
///
79-
/// ```rust,no_run
80-
/// use std::mem;
81-
/// use std::fs::File;
8264
///
65+
/// // Leak an I/O object, never closing the file
8366
/// let file = File::open("foo.txt").unwrap();
8467
/// mem::forget(file);
8568
/// ```
86-
///
87-
/// The swap function uses forget to good effect.
88-
///
89-
/// ```rust
90-
/// use std::mem;
91-
/// use std::ptr;
92-
///
93-
/// fn swap<T>(x: &mut T, y: &mut T) {
94-
/// unsafe {
95-
/// // Give ourselves some scratch space to work with
96-
/// let mut t: T = mem::uninitialized();
97-
///
98-
/// // Perform the swap, `&mut` pointers never alias
99-
/// ptr::copy_nonoverlapping(&*x, &mut t, 1);
100-
/// ptr::copy_nonoverlapping(&*y, x, 1);
101-
/// ptr::copy_nonoverlapping(&t, y, 1);
102-
///
103-
/// // y and t now point to the same thing, but we need to completely
104-
/// // forget `t` because we do not want to run the destructor for `T`
105-
/// // on its value, which is still owned somewhere outside this function.
106-
/// mem::forget(t);
107-
/// }
108-
/// }
109-
/// ```
11069
#[stable(feature = "rust1", since = "1.0.0")]
11170
pub fn forget<T>(t: T) {
11271
unsafe { intrinsics::forget(t) }
@@ -308,9 +267,8 @@ pub fn swap<T>(x: &mut T, y: &mut T) {
308267
ptr::copy_nonoverlapping(&*y, x, 1);
309268
ptr::copy_nonoverlapping(&t, y, 1);
310269

311-
// y and t now point to the same thing, but we need to completely
312-
// forget `t` because we do not want to run the destructor for `T`
313-
// on its value, which is still owned somewhere outside this function.
270+
// y and t now point to the same thing, but we need to completely forget `t`
271+
// because it's no longer relevant.
314272
forget(t);
315273
}
316274
}

branches/tmp/src/libcoretest/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#![feature(box_syntax)]
1515
#![feature(unboxed_closures)]
1616
#![feature(core)]
17-
#![feature(const_fn)]
1817
#![feature(test)]
1918
#![feature(rand)]
2019
#![feature(unicode)]

branches/tmp/src/liblog/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@
173173
#![feature(staged_api)]
174174
#![feature(box_syntax)]
175175
#![feature(core)]
176-
#![feature(const_fn)]
177176
#![feature(std_misc)]
178177

179178
use std::boxed;

branches/tmp/src/librustc/diagnostics.rs

Lines changed: 6 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,9 @@ const Y: i32 = A;
196196
"##,
197197

198198
E0015: r##"
199-
The only functions that can be called in static or constant expressions are
200-
`const` functions. Rust currently does not support more general compile-time
201-
function execution.
202-
203-
See [RFC 911] for more details on the design of `const fn`s.
204-
205-
[RFC 911]: https://github.com/rust-lang/rfcs/blob/master/text/0911-const-fn.md
199+
The only function calls allowed in static or constant expressions are enum
200+
variant constructors or struct constructors (for unit or tuple structs). This
201+
is because Rust currently does not support compile-time function execution.
206202
"##,
207203

208204
E0018: r##"
@@ -846,53 +842,6 @@ struct Foo<T: 'static> {
846842
foo: &'static T
847843
}
848844
```
849-
"##,
850-
851-
E0378: r##"
852-
Method calls that aren't calls to inherent `const` methods are disallowed
853-
in statics, constants, and constant functions.
854-
855-
For example:
856-
857-
```
858-
const BAZ: i32 = Foo(25).bar(); // error, `bar` isn't `const`
859-
860-
struct Foo(i32);
861-
862-
impl Foo {
863-
const fn foo(&self) -> i32 {
864-
self.bar() // error, `bar` isn't `const`
865-
}
866-
867-
fn bar(&self) -> i32 { self.0 }
868-
}
869-
```
870-
871-
For more information about `const fn`'s, see [RFC 911].
872-
873-
[RFC 911]: https://github.com/rust-lang/rfcs/blob/master/text/0911-const-fn.md
874-
"##,
875-
876-
E0394: r##"
877-
From [RFC 246]:
878-
879-
> It is illegal for a static to reference another static by value. It is
880-
> required that all references be borrowed.
881-
882-
[RFC 246]: https://github.com/rust-lang/rfcs/pull/246
883-
"##,
884-
885-
E0397: r##"
886-
It is not allowed for a mutable static to allocate or have destructors. For
887-
example:
888-
889-
```
890-
// error: mutable statics are not allowed to have boxes
891-
static mut FOO: Option<Box<usize>> = None;
892-
893-
// error: mutable statics are not allowed to have destructors
894-
static mut BAR: Option<Vec<i32>> = None;
895-
```
896845
"##
897846

898847
}
@@ -942,6 +891,9 @@ register_diagnostics! {
942891
E0315, // cannot invoke closure outside of its lifetime
943892
E0316, // nested quantification of lifetimes
944893
E0370, // discriminant overflow
894+
E0378, // method calls limited to constant inherent methods
895+
E0394, // cannot refer to other statics by value, use the address-of
896+
// operator or a constant instead
945897
E0395, // pointer comparison in const-expr
946898
E0396 // pointer dereference in const-expr
947899
}

branches/tmp/src/librustc/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#![feature(box_patterns)]
3030
#![feature(box_syntax)]
3131
#![feature(collections)]
32-
#![feature(const_fn)]
3332
#![feature(core)]
3433
#![feature(duration)]
3534
#![feature(duration_span)]

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

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -199,32 +199,8 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> {
199199
}
200200

201201
/// Returns true if the call is to a const fn or method.
202-
fn handle_const_fn_call(&mut self,
203-
expr: &ast::Expr,
204-
def_id: ast::DefId,
205-
ret_ty: Ty<'tcx>)
206-
-> bool {
202+
fn handle_const_fn_call(&mut self, def_id: ast::DefId, ret_ty: Ty<'tcx>) -> bool {
207203
if let Some(fn_like) = const_eval::lookup_const_fn_by_id(self.tcx, def_id) {
208-
if
209-
// we are in a static/const initializer
210-
self.mode != Mode::Var &&
211-
212-
// feature-gate is not enabled
213-
!self.tcx.sess.features.borrow().const_fn &&
214-
215-
// this doesn't come from a macro that has #[allow_internal_unstable]
216-
!self.tcx.sess.codemap().span_allows_unstable(expr.span)
217-
{
218-
self.tcx.sess.span_err(
219-
expr.span,
220-
&format!("const fns are an unstable feature"));
221-
fileline_help!(
222-
self.tcx.sess,
223-
expr.span,
224-
"in Nightly builds, add `#![feature(const_fn)]` to the crate \
225-
attributes to enable");
226-
}
227-
228204
let qualif = self.fn_like(fn_like.kind(),
229205
fn_like.decl(),
230206
fn_like.body(),
@@ -273,13 +249,13 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> {
273249
let suffix = if tcontents.has_dtor() {
274250
"destructors"
275251
} else if tcontents.owns_owned() {
276-
"boxes"
252+
"owned pointers"
277253
} else {
278254
return
279255
};
280256

281-
span_err!(self.tcx.sess, e.span, E0397,
282-
"mutable statics are not allowed to have {}", suffix);
257+
self.tcx.sess.span_err(e.span, &format!("mutable statics are not allowed \
258+
to have {}", suffix));
283259
}
284260

285261
fn check_static_type(&self, e: &ast::Expr) {
@@ -681,7 +657,7 @@ fn check_expr<'a, 'tcx>(v: &mut CheckCrateVisitor<'a, 'tcx>,
681657
}
682658
Some(def::DefMethod(did, def::FromImpl(_))) |
683659
Some(def::DefFn(did, _)) => {
684-
v.handle_const_fn_call(e, did, node_ty)
660+
v.handle_const_fn_call(did, node_ty)
685661
}
686662
_ => false
687663
};
@@ -701,7 +677,7 @@ fn check_expr<'a, 'tcx>(v: &mut CheckCrateVisitor<'a, 'tcx>,
701677
_ => None
702678
};
703679
let is_const = match method_did {
704-
Some(did) => v.handle_const_fn_call(e, did, node_ty),
680+
Some(did) => v.handle_const_fn_call(did, node_ty),
705681
None => false
706682
};
707683
if !is_const {

branches/tmp/src/librustc_trans/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#![feature(box_syntax)]
3131
#![feature(collections)]
3232
#![feature(core)]
33-
#![feature(const_fn)]
3433
#![feature(libc)]
3534
#![feature(quote)]
3635
#![feature(rustc_diagnostic_macros)]

0 commit comments

Comments
 (0)