Skip to content

Commit 9d70ff3

Browse files
committed
Rollup merge of rust-lang#36995 - nrc:stable, r=@nikomatsakis
stabilise ?, attributes on stmts, deprecate Reflect r? @nikomatsakis
2 parents d13b102 + 79b5177 commit 9d70ff3

File tree

55 files changed

+53
-133
lines changed

Some content is hidden

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

55 files changed

+53
-133
lines changed

src/doc/reference.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2472,8 +2472,7 @@ The currently implemented features of the reference compiler are:
24722472
* - `default_type_parameter_fallback` - Allows type parameter defaults to
24732473
influence type inference.
24742474

2475-
* - `stmt_expr_attributes` - Allows attributes on expressions and
2476-
non-item statements.
2475+
* - `stmt_expr_attributes` - Allows attributes on expressions.
24772476

24782477
* - `type_ascription` - Allows type ascription expressions `expr: Type`.
24792478

src/libcore/any.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373

7474
use fmt;
7575
use intrinsics;
76-
use marker::Reflect;
7776

7877
///////////////////////////////////////////////////////////////////////////////
7978
// Any trait
@@ -86,7 +85,7 @@ use marker::Reflect;
8685
///
8786
/// [mod]: index.html
8887
#[stable(feature = "rust1", since = "1.0.0")]
89-
pub trait Any: Reflect + 'static {
88+
pub trait Any: 'static {
9089
/// Gets the `TypeId` of `self`.
9190
///
9291
/// # Examples
@@ -112,7 +111,7 @@ pub trait Any: Reflect + 'static {
112111
}
113112

114113
#[stable(feature = "rust1", since = "1.0.0")]
115-
impl<T: Reflect + 'static + ?Sized > Any for T {
114+
impl<T: 'static + ?Sized > Any for T {
116115
fn get_type_id(&self) -> TypeId { TypeId::of::<T>() }
117116
}
118117

@@ -366,7 +365,7 @@ impl TypeId {
366365
/// }
367366
/// ```
368367
#[stable(feature = "rust1", since = "1.0.0")]
369-
pub fn of<T: ?Sized + Reflect + 'static>() -> TypeId {
368+
pub fn of<T: ?Sized + 'static>() -> TypeId {
370369
TypeId {
371370
t: unsafe { intrinsics::type_id::<T>() },
372371
}

src/libcore/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
#![feature(specialization)]
9090
#![feature(staged_api)]
9191
#![feature(unboxed_closures)]
92-
#![feature(question_mark)]
92+
#![cfg_attr(stage0, feature(question_mark))]
9393
#![feature(never_type)]
9494
#![feature(prelude_import)]
9595

src/libcore/macros.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,9 @@ macro_rules! debug_assert_ne {
255255
/// Helper macro for reducing boilerplate code for matching `Result` together
256256
/// with converting downstream errors.
257257
///
258+
/// Prefer using `?` syntax to `try!`. `?` is built in to the language and is
259+
/// more succinct than `try!`. It is the standard method for error propagation.
260+
///
258261
/// `try!` matches the given `Result`. In case of the `Ok` variant, the
259262
/// expression has the value of the wrapped value.
260263
///

src/libcore/marker.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,11 +587,14 @@ mod impls {
587587
#[unstable(feature = "reflect_marker",
588588
reason = "requires RFC and more experience",
589589
issue = "27749")]
590+
#[rustc_deprecated(since = "1.14.0", reason = "Specialization makes parametricity impossible")]
590591
#[rustc_on_unimplemented = "`{Self}` does not implement `Any`; \
591592
ensure all type parameters are bounded by `Any`"]
592593
pub trait Reflect {}
593594

594595
#[unstable(feature = "reflect_marker",
595596
reason = "requires RFC and more experience",
596597
issue = "27749")]
598+
#[rustc_deprecated(since = "1.14.0", reason = "Specialization makes parametricity impossible")]
599+
#[allow(deprecated)]
597600
impl Reflect for .. { }

src/libgraphviz/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@
295295
#![cfg_attr(not(stage0), deny(warnings))]
296296

297297
#![feature(str_escape)]
298-
#![feature(question_mark)]
298+
#![cfg_attr(stage0, feature(question_mark))]
299299

300300
use self::LabelText::*;
301301

src/librustc/diagnostics.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,30 +1327,6 @@ let x: i32 = "I am not a number!";
13271327
// |
13281328
// type `i32` assigned to variable `x`
13291329
```
1330-
1331-
Another situation in which this occurs is when you attempt to use the `try!`
1332-
macro inside a function that does not return a `Result<T, E>`:
1333-
1334-
```compile_fail,E0308
1335-
use std::fs::File;
1336-
1337-
fn main() {
1338-
let mut f = try!(File::create("foo.txt"));
1339-
}
1340-
```
1341-
1342-
This code gives an error like this:
1343-
1344-
```text
1345-
<std macros>:5:8: 6:42 error: mismatched types:
1346-
expected `()`,
1347-
found `core::result::Result<_, _>`
1348-
(expected (),
1349-
found enum `core::result::Result`) [E0308]
1350-
```
1351-
1352-
`try!` returns a `Result<T, E>`, and so the function must. But `main()` has
1353-
`()` as its return type, hence the error.
13541330
"##,
13551331

13561332
E0309: r##"

src/librustc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#![feature(rustc_private)]
4141
#![feature(slice_patterns)]
4242
#![feature(staged_api)]
43-
#![feature(question_mark)]
43+
#![cfg_attr(stage0, feature(question_mark))]
4444
#![cfg_attr(test, feature(test))]
4545

4646
extern crate arena;

src/librustc_back/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#![feature(rustc_private)]
3838
#![feature(staged_api)]
3939
#![feature(step_by)]
40-
#![feature(question_mark)]
40+
#![cfg_attr(stage0, feature(question_mark))]
4141
#![cfg_attr(test, feature(test, rand))]
4242

4343
extern crate syntax;

src/librustc_borrowck/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#![feature(staged_api)]
2727
#![feature(associated_consts)]
2828
#![feature(nonzero)]
29-
#![feature(question_mark)]
29+
#![cfg_attr(stage0, feature(question_mark))]
3030
#[macro_use] extern crate log;
3131
#[macro_use] extern crate syntax;
3232
extern crate syntax_pos;

src/librustc_const_eval/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#![feature(staged_api)]
2828
#![feature(rustc_diagnostic_macros)]
2929
#![feature(slice_patterns)]
30-
#![feature(question_mark)]
30+
#![cfg_attr(stage0, feature(question_mark))]
3131
#![feature(box_patterns)]
3232
#![feature(box_syntax)]
3333

src/librustc_const_math/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
#![feature(rustc_private)]
2727
#![feature(staged_api)]
28-
#![feature(question_mark)]
28+
#![cfg_attr(stage0, feature(question_mark))]
2929

3030
#[macro_use] extern crate log;
3131
#[macro_use] extern crate syntax;

src/librustc_driver/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#![feature(rustc_private)]
3232
#![feature(set_stdio)]
3333
#![feature(staged_api)]
34-
#![feature(question_mark)]
34+
#![cfg_attr(stage0, feature(question_mark))]
3535

3636
extern crate arena;
3737
extern crate flate;

src/librustc_errors/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#![allow(unused_attributes)]
2222
#![feature(rustc_private)]
2323
#![feature(staged_api)]
24-
#![feature(question_mark)]
24+
#![cfg_attr(stage0, feature(question_mark))]
2525
#![feature(range_contains)]
2626
#![feature(libc)]
2727
#![feature(unicode)]

src/librustc_incremental/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#![cfg_attr(not(stage0), deny(warnings))]
2121

2222
#![feature(dotdot_in_tuple_patterns)]
23-
#![feature(question_mark)]
23+
#![cfg_attr(stage0, feature(question_mark))]
2424
#![feature(rustc_private)]
2525
#![feature(staged_api)]
2626
#![feature(rand)]

src/librustc_metadata/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#![feature(dotdot_in_tuple_patterns)]
2424
#![feature(proc_macro_internals)]
2525
#![feature(proc_macro_lib)]
26-
#![feature(question_mark)]
26+
#![cfg_attr(stage0, feature(question_mark))]
2727
#![feature(quote)]
2828
#![feature(rustc_diagnostic_macros)]
2929
#![feature(rustc_private)]

src/librustc_mir/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
2626
#![feature(rustc_diagnostic_macros)]
2727
#![feature(rustc_private)]
2828
#![feature(staged_api)]
29-
#![feature(question_mark)]
29+
#![cfg_attr(stage0, feature(question_mark))]
3030

3131
#[macro_use] extern crate log;
3232
extern crate graphviz as dot;

src/librustc_trans/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#![feature(slice_patterns)]
3737
#![feature(staged_api)]
3838
#![feature(unicode)]
39-
#![feature(question_mark)]
39+
#![cfg_attr(stage0, feature(question_mark))]
4040

4141
use rustc::dep_graph::WorkProduct;
4242

src/librustc_typeck/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ This API is completely unstable and subject to change.
8282
#![feature(rustc_diagnostic_macros)]
8383
#![feature(rustc_private)]
8484
#![feature(staged_api)]
85-
#![feature(question_mark)]
85+
#![cfg_attr(stage0, feature(question_mark))]
8686

8787
#[macro_use] extern crate log;
8888
#[macro_use] extern crate syntax;

src/librustdoc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#![feature(staged_api)]
2929
#![feature(test)]
3030
#![feature(unicode)]
31-
#![feature(question_mark)]
31+
#![cfg_attr(stage0, feature(question_mark))]
3232

3333
extern crate arena;
3434
extern crate getopts;

src/libserialize/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Core encoding and decoding interfaces.
3535
#![feature(specialization)]
3636
#![feature(staged_api)]
3737
#![feature(unicode)]
38-
#![feature(question_mark)]
38+
#![cfg_attr(stage0, feature(question_mark))]
3939
#![cfg_attr(test, feature(test))]
4040

4141
// test harness access

src/libstd/error.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,14 @@ use any::TypeId;
5555
use cell;
5656
use char;
5757
use fmt::{self, Debug, Display};
58-
use marker::Reflect;
5958
use mem::transmute;
6059
use num;
6160
use str;
6261
use string;
6362

6463
/// Base functionality for all errors in Rust.
6564
#[stable(feature = "rust1", since = "1.0.0")]
66-
pub trait Error: Debug + Display + Reflect {
65+
pub trait Error: Debug + Display {
6766
/// A short description of the error.
6867
///
6968
/// The description should not contain newlines or sentence-ending

src/libstd/io/buffered.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
1313
use io::prelude::*;
1414

15-
use marker::Reflect;
1615
use cmp;
1716
use error;
1817
use fmt;
@@ -578,7 +577,7 @@ impl<W> From<IntoInnerError<W>> for Error {
578577
}
579578

580579
#[stable(feature = "rust1", since = "1.0.0")]
581-
impl<W: Reflect + Send + fmt::Debug> error::Error for IntoInnerError<W> {
580+
impl<W: Send + fmt::Debug> error::Error for IntoInnerError<W> {
582581
fn description(&self) -> &str {
583582
error::Error::description(self.error())
584583
}

src/libstd/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,9 @@
255255
#![feature(panic_unwind)]
256256
#![feature(placement_in_syntax)]
257257
#![feature(prelude_import)]
258-
#![feature(question_mark)]
258+
#![cfg_attr(stage0, feature(question_mark))]
259259
#![feature(rand)]
260260
#![feature(raw)]
261-
#![feature(reflect_marker)]
262261
#![feature(repr_simd)]
263262
#![feature(rustc_attrs)]
264263
#![feature(shared)]

src/libstd/sync/mpsc/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,6 @@ use error;
270270
use fmt;
271271
use mem;
272272
use cell::UnsafeCell;
273-
use marker::Reflect;
274273
use time::{Duration, Instant};
275274

276275
#[unstable(feature = "mpsc_select", issue = "27800")]
@@ -1163,7 +1162,7 @@ impl<T> fmt::Display for SendError<T> {
11631162
}
11641163

11651164
#[stable(feature = "rust1", since = "1.0.0")]
1166-
impl<T: Send + Reflect> error::Error for SendError<T> {
1165+
impl<T: Send> error::Error for SendError<T> {
11671166
fn description(&self) -> &str {
11681167
"sending on a closed channel"
11691168
}
@@ -1198,7 +1197,7 @@ impl<T> fmt::Display for TrySendError<T> {
11981197
}
11991198

12001199
#[stable(feature = "rust1", since = "1.0.0")]
1201-
impl<T: Send + Reflect> error::Error for TrySendError<T> {
1200+
impl<T: Send> error::Error for TrySendError<T> {
12021201

12031202
fn description(&self) -> &str {
12041203
match *self {

src/libstd/sys/common/poison.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
use error::{Error};
1212
use fmt;
13-
use marker::Reflect;
1413
use sync::atomic::{AtomicBool, Ordering};
1514
use thread;
1615

@@ -117,7 +116,7 @@ impl<T> fmt::Display for PoisonError<T> {
117116
}
118117

119118
#[stable(feature = "rust1", since = "1.0.0")]
120-
impl<T: Reflect> Error for PoisonError<T> {
119+
impl<T> Error for PoisonError<T> {
121120
fn description(&self) -> &str {
122121
"poisoned lock: another task failed inside"
123122
}
@@ -174,7 +173,7 @@ impl<T> fmt::Display for TryLockError<T> {
174173
}
175174

176175
#[stable(feature = "rust1", since = "1.0.0")]
177-
impl<T: Reflect> Error for TryLockError<T> {
176+
impl<T> Error for TryLockError<T> {
178177
fn description(&self) -> &str {
179178
match *self {
180179
TryLockError::Poisoned(ref p) => p.description(),

src/libsyntax/config.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ impl<'a> StripUnconfigured<'a> {
153153
}
154154

155155
// Visit attributes on expression and statements (but not attributes on items in blocks).
156-
fn visit_stmt_or_expr_attrs(&mut self, attrs: &[ast::Attribute]) {
156+
fn visit_expr_attrs(&mut self, attrs: &[ast::Attribute]) {
157157
// flag the offending attributes
158158
for attr in attrs.iter() {
159159
if !self.features.map(|features| features.stmt_expr_attributes).unwrap_or(true) {
@@ -227,7 +227,7 @@ impl<'a> StripUnconfigured<'a> {
227227
}
228228

229229
pub fn configure_expr(&mut self, expr: P<ast::Expr>) -> P<ast::Expr> {
230-
self.visit_stmt_or_expr_attrs(expr.attrs());
230+
self.visit_expr_attrs(expr.attrs());
231231

232232
// If an expr is valid to cfg away it will have been removed by the
233233
// outer stmt or expression folder before descending in here.
@@ -245,7 +245,6 @@ impl<'a> StripUnconfigured<'a> {
245245
}
246246

247247
pub fn configure_stmt(&mut self, stmt: ast::Stmt) -> Option<ast::Stmt> {
248-
self.visit_stmt_or_expr_attrs(stmt.attrs());
249248
self.configure(stmt)
250249
}
251250
}

src/libsyntax/feature_gate.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,6 @@ declare_features! (
253253
// a...b and ...b
254254
(active, inclusive_range_syntax, "1.7.0", Some(28237)),
255255

256-
// `expr?`
257-
(active, question_mark, "1.9.0", Some(31436)),
258-
259256
// impl specialization (RFC 1210)
260257
(active, specialization, "1.7.0", Some(31844)),
261258

@@ -348,6 +345,8 @@ declare_features! (
348345
(accepted, while_let, "1.0.0", None),
349346
// Allows `#[deprecated]` attribute
350347
(accepted, deprecated, "1.9.0", Some(29935)),
348+
// `expr?`
349+
(accepted, question_mark, "1.14.0", Some(31436)),
351350
);
352351
// (changing above list without updating src/doc/reference.md makes @cmr sad)
353352

@@ -1072,9 +1071,6 @@ impl<'a> Visitor for PostExpansionVisitor<'a> {
10721071
e.span,
10731072
"inclusive range syntax is experimental");
10741073
}
1075-
ast::ExprKind::Try(..) => {
1076-
gate_feature_post!(&self, question_mark, e.span, "the `?` operator is not stable");
1077-
}
10781074
ast::ExprKind::InPlace(..) => {
10791075
gate_feature_post!(&self, placement_in_syntax, e.span, EXPLAIN_PLACEMENT_IN);
10801076
}

0 commit comments

Comments
 (0)