Skip to content

Commit aeb4342

Browse files
committed
---
yaml --- r: 236593 b: refs/heads/tmp c: d5f2d3b h: refs/heads/master i: 236591: 6a896a7 v: v3
1 parent 475de0d commit aeb4342

File tree

187 files changed

+1093
-1310
lines changed

Some content is hidden

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

187 files changed

+1093
-1310
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2626
refs/heads/beta: d2e13e822a73e0ea46ae9e21afdd3155fc997f6d
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
28-
refs/heads/tmp: c9c79084b0b60766b5e330074206b27007b237c0
28+
refs/heads/tmp: d5f2d3b1773d70bf3d32b94ad2a2bf3125bf743e
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: f859507de8c410b648d934d8f5ec1c52daac971d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828

branches/tmp/configure

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,12 +1295,6 @@ $ pacman -R cmake && pacman -S mingw-w64-x86_64-cmake
12951295
putvar CFG_MSVC_LIB_PATH_${bits}
12961296
;;
12971297

1298-
*-rumprun-netbsd)
1299-
step_msg "targeting rumprun-netbsd, disabling jemalloc"
1300-
CFG_DISABLE_JEMALLOC=1
1301-
putvar CFG_DISABLE_JEMALLOC
1302-
;;
1303-
13041298
*)
13051299
;;
13061300
esac

branches/tmp/mk/cfg/x86_64-rumprun-netbsd.mk

Lines changed: 0 additions & 24 deletions
This file was deleted.

branches/tmp/src/compiletest/compiletest.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ fn extract_gdb_version(full_version_line: Option<String>) -> Option<String> {
348348
if !full_version_line.trim().is_empty() => {
349349
let full_version_line = full_version_line.trim();
350350

351-
// used to be a regex "(^|[^0-9])([0-9]\.[0-9]+)"
351+
// used to be a regex "(^|[^0-9])([0-9]\.[0-9])([^0-9]|$)"
352352
for (pos, c) in full_version_line.char_indices() {
353353
if !c.is_digit(10) { continue }
354354
if pos + 2 >= full_version_line.len() { continue }
@@ -357,12 +357,11 @@ fn extract_gdb_version(full_version_line: Option<String>) -> Option<String> {
357357
if pos > 0 && full_version_line.char_at_reverse(pos).is_digit(10) {
358358
continue
359359
}
360-
let mut end = pos + 3;
361-
while end < full_version_line.len() &&
362-
full_version_line.char_at(end).is_digit(10) {
363-
end += 1;
360+
if pos + 3 < full_version_line.len() &&
361+
full_version_line.char_at(pos + 3).is_digit(10) {
362+
continue
364363
}
365-
return Some(full_version_line[pos..end].to_owned());
364+
return Some(full_version_line[pos..pos+3].to_owned());
366365
}
367366
println!("Could not extract GDB version from line '{}'",
368367
full_version_line);

branches/tmp/src/doc/grammar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ provides only one kind of material:
99

1010
This document does not serve as an introduction to the language. Background
1111
familiarity with the language is assumed. A separate [guide] is available to
12-
help acquire such background.
12+
help acquire such background familiarity.
1313

1414
This document also does not serve as a reference to the [standard] library
1515
included in the language distribution. Those libraries are documented

branches/tmp/src/doc/reference.md

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ There are several kinds of item:
674674
* [modules](#modules)
675675
* [functions](#functions)
676676
* [type definitions](grammar.html#type-definitions)
677-
* [structs](#structs)
677+
* [structures](#structures)
678678
* [enumerations](#enumerations)
679679
* [constant items](#constant-items)
680680
* [static items](#static-items)
@@ -900,10 +900,9 @@ fn main() {}
900900

901901
### Functions
902902

903-
A _function item_ defines a sequence of [statements](#statements) and a
904-
final [expression](#expressions), along with a name and a set of
905-
parameters. Other than a name, all these are optional.
906-
Functions are declared with the keyword `fn`. Functions may declare a
903+
A _function item_ defines a sequence of [statements](#statements) and an
904+
optional final [expression](#expressions), along with a name and a set of
905+
parameters. Functions are declared with the keyword `fn`. Functions declare a
907906
set of *input* [*variables*](#variables) as parameters, through which the caller
908907
passes arguments into the function, and the *output* [*type*](#types)
909908
of the value the function will return to its caller on completion.
@@ -922,7 +921,7 @@ An example of a function:
922921

923922
```
924923
fn add(x: i32, y: i32) -> i32 {
925-
x + y
924+
return x + y;
926925
}
927926
```
928927

@@ -1156,7 +1155,7 @@ type Point = (u8, u8);
11561155
let p: Point = (41, 68);
11571156
```
11581157

1159-
### Structs
1158+
### Structures
11601159

11611160
A _structure_ is a nominal [structure type](#structure-types) defined with the
11621161
keyword `struct`.
@@ -2093,8 +2092,6 @@ The following configurations must be defined by the implementation:
20932092
* `target_pointer_width = "..."` - Target pointer width in bits. This is set
20942093
to `"32"` for targets with 32-bit pointers, and likewise set to `"64"` for
20952094
64-bit pointers.
2096-
* `target_vendor = "..."` - Vendor of the target, for example `apple`, `pc`, or
2097-
simply `"unknown"`.
20982095
* `test` - Enabled when compiling the test harness (using the `--test` flag).
20992096
* `unix` - See `target_family`.
21002097
* `windows` - See `target_family`.
@@ -2271,7 +2268,7 @@ The currently implemented features of the reference compiler are:
22712268
* `advanced_slice_patterns` - See the [match expressions](#match-expressions)
22722269
section for discussion; the exact semantics of
22732270
slice patterns are subject to change, so some types
2274-
are still unstable.
2271+
are still unstable.
22752272

22762273
* `slice_patterns` - OK, actually, slice patterns are just scary and
22772274
completely unstable.
@@ -2292,9 +2289,6 @@ The currently implemented features of the reference compiler are:
22922289
* `box_syntax` - Allows use of `box` expressions, the exact semantics of which
22932290
is subject to change.
22942291

2295-
* `cfg_target_vendor` - Allows conditional compilation using the `target_vendor`
2296-
matcher which is subject to change.
2297-
22982292
* `concat_idents` - Allows use of the `concat_idents` macro, which is in many
22992293
ways insufficient for concatenating identifiers, and may be
23002294
removed entirely for something more wholesome.
@@ -2620,21 +2614,21 @@ comma:
26202614
### Structure expressions
26212615

26222616
There are several forms of structure expressions. A _structure expression_
2623-
consists of the [path](#paths) of a [structure item](#structs), followed by
2617+
consists of the [path](#paths) of a [structure item](#structures), followed by
26242618
a brace-enclosed list of one or more comma-separated name-value pairs,
26252619
providing the field values of a new instance of the structure. A field name
26262620
can be any identifier, and is separated from its value expression by a colon.
26272621
The location denoted by a structure field is mutable if and only if the
26282622
enclosing structure is mutable.
26292623

26302624
A _tuple structure expression_ consists of the [path](#paths) of a [structure
2631-
item](#structs), followed by a parenthesized list of one or more
2625+
item](#structures), followed by a parenthesized list of one or more
26322626
comma-separated expressions (in other words, the path of a structure item
26332627
followed by a tuple expression). The structure item must be a tuple structure
26342628
item.
26352629

26362630
A _unit-like structure expression_ consists only of the [path](#paths) of a
2637-
[structure item](#structs).
2631+
[structure item](#structures).
26382632

26392633
The following are examples of structure expressions:
26402634

@@ -3151,7 +3145,7 @@ if` condition is evaluated. If all `if` and `else if` conditions evaluate to
31513145

31523146
A `match` expression branches on a *pattern*. The exact form of matching that
31533147
occurs depends on the pattern. Patterns consist of some combination of
3154-
literals, destructured arrays or enum constructors, structs and tuples,
3148+
literals, destructured arrays or enum constructors, structures and tuples,
31553149
variable binding specifications, wildcards (`..`), and placeholders (`_`). A
31563150
`match` expression has a *head expression*, which is the value to compare to
31573151
the patterns. The type of the patterns must equal the type of the head
@@ -3475,7 +3469,7 @@ named reference to an [`enum` item](#enumerations).
34753469
### Recursive types
34763470

34773471
Nominal types &mdash; [enumerations](#enumerated-types) and
3478-
[structs](#structure-types) &mdash; may be recursive. That is, each `enum`
3472+
[structures](#structure-types) &mdash; may be recursive. That is, each `enum`
34793473
constructor or `struct` field may refer, directly or indirectly, to the
34803474
enclosing `enum` or `struct` type itself. Such recursion has restrictions:
34813475

@@ -3503,7 +3497,7 @@ let a: List<i32> = List::Cons(7, Box::new(List::Cons(13, Box::new(List::Nil))));
35033497
### Pointer types
35043498

35053499
All pointers in Rust are explicit first-class values. They can be copied,
3506-
stored into data structs, and returned from functions. There are two
3500+
stored into data structures, and returned from functions. There are two
35073501
varieties of pointer in Rust:
35083502

35093503
* References (`&`)
@@ -3903,7 +3897,7 @@ references to boxes are dropped.
39033897
### Variables
39043898

39053899
A _variable_ is a component of a stack frame, either a named function parameter,
3906-
an anonymous [temporary](#lvalues-rvalues-and-temporaries), or a named local
3900+
an anonymous [temporary](#lvalues,-rvalues-and-temporaries), or a named local
39073901
variable.
39083902

39093903
A _local variable_ (or *stack-local* allocation) holds a value directly,
@@ -4042,6 +4036,10 @@ In general, `--crate-type=bin` or `--crate-type=lib` should be sufficient for
40424036
all compilation needs, and the other options are just available if more
40434037
fine-grained control is desired over the output format of a Rust crate.
40444038

4039+
# Appendix: Rationales and design trade-offs
4040+
4041+
*TODO*.
4042+
40454043
# Appendix: Influences
40464044

40474045
Rust is not a particularly original language, with design elements coming from

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

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,8 @@ fn factory() -> &(Fn(i32) -> i32) {
411411
```
412412

413413
Right. Because we have a reference, we need to give it a lifetime. But
414-
our `factory()` function takes no arguments, so
415-
[elision](lifetimes.html#lifetime-elision) doesn’t kick in here. Then what
416-
choices do we have? Try `'static`:
414+
our `factory()` function takes no arguments, so elision doesn’t kick in
415+
here. What lifetime can we choose? `'static`:
417416

418417
```rust,ignore
419418
fn factory() -> &'static (Fn(i32) -> i32) {
@@ -433,7 +432,7 @@ But we get another error:
433432
```text
434433
error: mismatched types:
435434
expected `&'static core::ops::Fn(i32) -> i32`,
436-
found `[closure@<anon>:7:9: 7:20]`
435+
found `[closure <anon>:7:9: 7:20]`
437436
(expected &-ptr,
438437
found closure) [E0308]
439438
|x| x + num
@@ -442,17 +441,21 @@ error: mismatched types:
442441
```
443442

444443
This error is letting us know that we don’t have a `&'static Fn(i32) -> i32`,
445-
we have a `[closure@<anon>:7:9: 7:20]`. Wait, what?
444+
we have a `[closure <anon>:7:9: 7:20]`. Wait, what?
446445

447446
Because each closure generates its own environment `struct` and implementation
448447
of `Fn` and friends, these types are anonymous. They exist just solely for
449-
this closure. So Rust shows them as `closure@<anon>`, rather than some
448+
this closure. So Rust shows them as `closure <anon>`, rather than some
450449
autogenerated name.
451450

452-
The error also points out that the return type is expected to be a reference,
453-
but what we are trying to return is not. Further, we cannot directly assign a
454-
`'static` lifetime to an object. So we'll take a different approach and return
455-
a "trait object" by `Box`ing up the `Fn`. This _almost_ works:
451+
But why doesn’t our closure implement `&'static Fn`? Well, as we discussed before,
452+
closures borrow their environment. And in this case, our environment is based
453+
on a stack-allocated `5`, the `num` variable binding. So the borrow has a lifetime
454+
of the stack frame. So if we returned this closure, the function call would be
455+
over, the stack frame would go away, and our closure is capturing an environment
456+
of garbage memory!
457+
458+
So what to do? This _almost_ works:
456459

457460
```rust,ignore
458461
fn factory() -> Box<Fn(i32) -> i32> {
@@ -468,7 +471,7 @@ assert_eq!(6, answer);
468471
# }
469472
```
470473

471-
There’s just one last problem:
474+
We use a trait object, by `Box`ing up the `Fn`. There’s just one last problem:
472475

473476
```text
474477
error: closure may outlive the current function, but it borrows `num`,
@@ -477,12 +480,8 @@ Box::new(|x| x + num)
477480
^~~~~~~~~~~
478481
```
479482

480-
Well, as we discussed before, closures borrow their environment. And in this
481-
case, our environment is based on a stack-allocated `5`, the `num` variable
482-
binding. So the borrow has a lifetime of the stack frame. So if we returned
483-
this closure, the function call would be over, the stack frame would go away,
484-
and our closure is capturing an environment of garbage memory! With one last
485-
fix, we can make this work:
483+
We still have a reference to the parent stack frame. With one last fix, we can
484+
make this work:
486485

487486
```rust
488487
fn factory() -> Box<Fn(i32) -> i32> {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -349,9 +349,9 @@ fn frob<'a, 'b>(s: &'a str, t: &'b str) -> &str; // Expanded: Output lifetime is
349349
fn get_mut(&mut self) -> &mut T; // elided
350350
fn get_mut<'a>(&'a mut self) -> &'a mut T; // expanded
351351
352-
fn args<T:ToCStr>(&mut self, args: &[T]) -> &mut Command; // elided
353-
fn args<'a, 'b, T:ToCStr>(&'a mut self, args: &'b [T]) -> &'a mut Command; // expanded
352+
fn args<T:ToCStr>(&mut self, args: &[T]) -> &mut Command // elided
353+
fn args<'a, 'b, T:ToCStr>(&'a mut self, args: &'b [T]) -> &'a mut Command // expanded
354354
355355
fn new(buf: &mut [u8]) -> BufWriter; // elided
356-
fn new<'a>(buf: &'a mut [u8]) -> BufWriter<'a>; // expanded
356+
fn new<'a>(buf: &'a mut [u8]) -> BufWriter<'a> // expanded
357357
```

branches/tmp/src/grammar/verify.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use syntax::parse::lexer::TokenAndSpan;
3535

3636
fn parse_token_list(file: &str) -> HashMap<String, token::Token> {
3737
fn id() -> token::Token {
38-
token::Ident(ast::Ident::with_empty_ctxt(Name(0))), token::Plain)
38+
token::Ident(ast::Ident { name: Name(0), ctxt: 0, }, token::Plain)
3939
}
4040

4141
let mut res = HashMap::new();
@@ -75,7 +75,7 @@ fn parse_token_list(file: &str) -> HashMap<String, token::Token> {
7575
"RPAREN" => token::CloseDelim(token::Paren),
7676
"SLASH" => token::BinOp(token::Slash),
7777
"COMMA" => token::Comma,
78-
"LIFETIME" => token::Lifetime(ast::Ident::with_empty_ctxt(Name(0))),
78+
"LIFETIME" => token::Lifetime(ast::Ident { name: Name(0), ctxt: 0 }),
7979
"CARET" => token::BinOp(token::Caret),
8080
"TILDE" => token::Tilde,
8181
"IDENT" => id(),
@@ -208,9 +208,9 @@ fn parse_antlr_token(s: &str, tokens: &HashMap<String, token::Token>, surrogate_
208208
token::Literal(token::ByteStr(..), n) => token::Literal(token::ByteStr(nm), n),
209209
token::Literal(token::ByteStrRaw(..), n) => token::Literal(token::ByteStrRaw(fix(content),
210210
count(content)), n),
211-
token::Ident(..) => token::Ident(ast::Ident::with_empty_ctxt(nm)),
211+
token::Ident(..) => token::Ident(ast::Ident { name: nm, ctxt: 0 },
212212
token::ModName),
213-
token::Lifetime(..) => token::Lifetime(ast::Ident::with_empty_ctxt(nm)),
213+
token::Lifetime(..) => token::Lifetime(ast::Ident { name: nm, ctxt: 0 }),
214214
ref t => t.clone()
215215
};
216216

0 commit comments

Comments
 (0)