Skip to content

Commit 162fb13

Browse files
committed
---
yaml --- r: 209941 b: refs/heads/try c: 6365080 h: refs/heads/master i: 209939: f74734e v: v3
1 parent cf50dc5 commit 162fb13

File tree

10 files changed

+110
-42
lines changed

10 files changed

+110
-42
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 3e561f05c00cd180ec02db4ccab2840a4aba93d2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
5-
refs/heads/try: 24ef90527351bb1a52c8b54e948cdbba8db3eef6
5+
refs/heads/try: 6365080c5cd27b74ec87420c351a3e7bdcff988e
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/doc/grammar.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,16 @@ explicit codepoint lists. [^inputformat]
9696
## Special Unicode Productions
9797

9898
The following productions in the Rust grammar are defined in terms of Unicode
99-
properties: `ident`, `non_null`, `non_star`, `non_eol`, `non_slash_or_star`,
100-
`non_single_quote` and `non_double_quote`.
99+
properties: `ident`, `non_null`, `non_eol`, `non_single_quote` and
100+
`non_double_quote`.
101101

102102
### Identifiers
103103

104-
The `ident` production is any nonempty Unicode string of the following form:
104+
The `ident` production is any nonempty Unicode[^non_ascii_idents] string of
105+
the following form:
106+
107+
[^non_ascii_idents]: Non-ASCII characters in identifiers are currently feature
108+
gated. This is expected to improve soon.
105109

106110
- The first character has property `XID_start`
107111
- The remaining characters have property `XID_continue`
@@ -118,8 +122,6 @@ Some productions are defined by exclusion of particular Unicode characters:
118122

119123
- `non_null` is any single Unicode character aside from `U+0000` (null)
120124
- `non_eol` is `non_null` restricted to exclude `U+000A` (`'\n'`)
121-
- `non_star` is `non_null` restricted to exclude `U+002A` (`*`)
122-
- `non_slash_or_star` is `non_null` restricted to exclude `U+002F` (`/`) and `U+002A` (`*`)
123125
- `non_single_quote` is `non_null` restricted to exclude `U+0027` (`'`)
124126
- `non_double_quote` is `non_null` restricted to exclude `U+0022` (`"`)
125127

branches/try/src/doc/reference.md

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,9 @@ explicit code point lists. [^inputformat]
6565
provided to the grammar verifier, restricted to ASCII range, when verifying the
6666
grammar in this document.
6767

68-
## Special Unicode Productions
68+
## Identifiers
6969

70-
The following productions in the Rust grammar are defined in terms of Unicode
71-
properties: `ident`, `non_null`, `non_eol`, `non_single_quote` and `non_double_quote`.
72-
73-
### Identifiers
74-
75-
The `ident` production is any nonempty Unicode[^non_ascii_idents] string of the following form:
70+
An identifier is any nonempty Unicode[^non_ascii_idents] string of the following form:
7671

7772
[^non_ascii_idents]: Non-ASCII characters in identifiers are currently feature
7873
gated. This is expected to improve soon.
@@ -86,40 +81,34 @@ that does _not_ occur in the set of [keywords](#keywords).
8681
> character ranges used to form the more familiar C and Java language-family
8782
> identifiers.
8883
89-
### Delimiter-restricted productions
90-
91-
Some productions are defined by exclusion of particular Unicode characters:
92-
93-
- `non_null` is any single Unicode character aside from `U+0000` (null)
94-
- `non_eol` is `non_null` restricted to exclude `U+000A` (`'\n'`)
95-
- `non_single_quote` is `non_null` restricted to exclude `U+0027` (`'`)
96-
- `non_double_quote` is `non_null` restricted to exclude `U+0022` (`"`)
97-
9884
## Comments
9985

100-
Comments in Rust code follow the general C++ style of line and block-comment
101-
forms. Nested block comments are supported.
86+
Comments in Rust code follow the general C++ style of line (`//`) and
87+
block-comment (`/* ... */`) forms. Nested block comments are supported.
10288

10389
Line comments beginning with exactly _three_ slashes (`///`), and block
10490
comments beginning with exactly one repeated asterisk in the block-open
10591
sequence (`/**`), are interpreted as a special syntax for `doc`
10692
[attributes](#attributes). That is, they are equivalent to writing
107-
`#[doc="..."]` around the body of the comment (this includes the comment
108-
characters themselves, i.e. `/// Foo` turns into `#[doc="/// Foo"]`).
93+
`#[doc="..."]` around the body of the comment, i.e., `/// Foo` turns into
94+
`#[doc="Foo"]`.
10995

11096
Line comments beginning with `//!` and block comments beginning with `/*!` are
11197
doc comments that apply to the parent of the comment, rather than the item
11298
that follows. That is, they are equivalent to writing `#![doc="..."]` around
113-
the body of the comment. `//!` comments are usually used to display
114-
information on the crate index page.
99+
the body of the comment. `//!` comments are usually used to document
100+
modules that occupy a source file.
115101

116102
Non-doc comments are interpreted as a form of whitespace.
117103

118104
## Whitespace
119105

120-
The `whitespace_char` production is any nonempty Unicode string consisting of
121-
any of the following Unicode characters: `U+0020` (space, `' '`), `U+0009`
122-
(tab, `'\t'`), `U+000A` (LF, `'\n'`), `U+000D` (CR, `'\r'`).
106+
Whitespace is any non-empty string containing any the following characters:
107+
108+
- `U+0020` (space, `' '`)
109+
- `U+0009` (tab, `'\t'`)
110+
- `U+000A` (LF, `'\n'`)
111+
- `U+000D` (CR, `'\r'`)
123112

124113
Rust is a "free-form" language, meaning that all forms of whitespace serve only
125114
to separate _tokens_ in the grammar, and have no semantic significance.

branches/try/src/doc/trpl/vectors.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,4 @@ Vectors have many more useful methods, which you can read about in [their
5656
API documentation][vec].
5757

5858
[vec]: ../std/vec/index.html
59+
[generic]: generics.html

branches/try/src/librustc/session/mod.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ pub struct Session {
5757
pub crate_metadata: RefCell<Vec<String>>,
5858
pub features: RefCell<feature_gate::Features>,
5959

60+
pub delayed_span_bug: RefCell<Option<(codemap::Span, String)>>,
61+
6062
/// The maximum recursion limit for potentially infinitely recursive
6163
/// operations such as auto-dereference and monomorphization.
6264
pub recursion_limit: Cell<usize>,
@@ -114,7 +116,15 @@ impl Session {
114116
self.diagnostic().handler().has_errors()
115117
}
116118
pub fn abort_if_errors(&self) {
117-
self.diagnostic().handler().abort_if_errors()
119+
self.diagnostic().handler().abort_if_errors();
120+
121+
let delayed_bug = self.delayed_span_bug.borrow();
122+
match *delayed_bug {
123+
Some((span, ref errmsg)) => {
124+
self.diagnostic().span_bug(span, errmsg);
125+
},
126+
_ => {}
127+
}
118128
}
119129
pub fn span_warn(&self, sp: Span, msg: &str) {
120130
if self.can_print_warnings {
@@ -171,6 +181,11 @@ impl Session {
171181
None => self.bug(msg),
172182
}
173183
}
184+
/// Delay a span_bug() call until abort_if_errors()
185+
pub fn delay_span_bug(&self, sp: Span, msg: &str) {
186+
let mut delayed = self.delayed_span_bug.borrow_mut();
187+
*delayed = Some((sp, msg.to_string()));
188+
}
174189
pub fn span_bug(&self, sp: Span, msg: &str) -> ! {
175190
self.diagnostic().span_bug(sp, msg)
176191
}
@@ -402,6 +417,7 @@ pub fn build_session_(sopts: config::Options,
402417
plugin_llvm_passes: RefCell::new(Vec::new()),
403418
crate_types: RefCell::new(Vec::new()),
404419
crate_metadata: RefCell::new(Vec::new()),
420+
delayed_span_bug: RefCell::new(None),
405421
features: RefCell::new(feature_gate::Features::new()),
406422
recursion_limit: Cell::new(64),
407423
can_print_warnings: can_print_warnings

branches/try/src/librustc_typeck/check/regionck.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -562,11 +562,7 @@ fn visit_expr(rcx: &mut Rcx, expr: &ast::Expr) {
562562
}
563563
Err(..) => {
564564
let tcx = rcx.fcx.tcx();
565-
if tcx.sess.has_errors() {
566-
// cannot run dropck; okay b/c in error state anyway.
567-
} else {
568-
tcx.sess.span_bug(expr.span, "cat_expr_unadjusted Errd");
569-
}
565+
tcx.sess.delay_span_bug(expr.span, "cat_expr_unadjusted Errd");
570566
}
571567
}
572568
}
@@ -583,11 +579,7 @@ fn visit_expr(rcx: &mut Rcx, expr: &ast::Expr) {
583579
}
584580
Err(..) => {
585581
let tcx = rcx.fcx.tcx();
586-
if tcx.sess.has_errors() {
587-
// cannot run dropck; okay b/c in error state anyway.
588-
} else {
589-
tcx.sess.span_bug(expr.span, "cat_expr Errd");
590-
}
582+
tcx.sess.delay_span_bug(expr.span, "cat_expr Errd");
591583
}
592584
}
593585

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() { }
12+
13+
// Before these errors would ICE as "cat_expr Errd" because the errors
14+
// were unknown when the bug was triggered.
15+
16+
fn unconstrained_type() {
17+
[];
18+
//~^ ERROR cannot determine a type for this expression: unconstrained type
19+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use std::any::Any;
12+
fn main()
13+
{
14+
fn bar(x:i32) ->i32 { 3*x };
15+
let b:Box<Any> = Box::new(bar as fn(_)->_);
16+
b.downcast_ref::<fn(_)->_>();
17+
//~^ ERROR cannot determine a type for this expression: unconstrained type
18+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {
12+
"".chars().fold(|_, _| (), ());
13+
//~^ ERROR cannot determine a type for this expression: unconstrained type
14+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {
12+
use std::mem::{transmute, swap};
13+
let a = 1;
14+
let b = 2;
15+
unsafe {swap::<&mut _>(transmute(&a), transmute(&b))};
16+
//~^ ERROR cannot determine a type for this expression: unconstrained type
17+
}

0 commit comments

Comments
 (0)