#![feature(specialization)]
#![feature(staged_api)]
#![feature(unboxed_closures)]
-#![feature(question_mark)]
+#![cfg_attr(stage0, feature(question_mark))]
#![feature(never_type)]
#![feature(prelude_import)]
/// Helper macro for reducing boilerplate code for matching `Result` together
/// with converting downstream errors.
///
+/// Prefer using `?` syntax to `try!`. `?` is built in to the language and is
+/// more succinct than `try!`, it is the standard method for error propogation.
+///
/// `try!` matches the given `Result`. In case of the `Ok` variant, the
/// expression has the value of the wrapped value.
///
#![cfg_attr(not(stage0), deny(warnings))]
#![feature(str_escape)]
-#![feature(question_mark)]
+#![cfg_attr(stage0, feature(question_mark))]
use self::LabelText::*;
-Subproject commit b474785561d58efbd27add9d22339dcabad742ad
+Subproject commit 5a17b4a733a22d445fdd63326f826fcd8a584328
// |
// type `i32` assigned to variable `x`
```
-
-Another situation in which this occurs is when you attempt to use the `try!`
-macro inside a function that does not return a `Result<T, E>`:
-
-```compile_fail,E0308
-use std::fs::File;
-
-fn main() {
- let mut f = try!(File::create("foo.txt"));
-}
-```
-
-This code gives an error like this:
-
-```text
-<std macros>:5:8: 6:42 error: mismatched types:
- expected `()`,
- found `core::result::Result<_, _>`
- (expected (),
- found enum `core::result::Result`) [E0308]
-```
-
-`try!` returns a `Result<T, E>`, and so the function must. But `main()` has
-`()` as its return type, hence the error.
"##,
E0309: r##"
#![feature(rustc_private)]
#![feature(slice_patterns)]
#![feature(staged_api)]
-#![feature(question_mark)]
+#![cfg_attr(stage0, feature(question_mark))]
#![cfg_attr(test, feature(test))]
extern crate arena;
#![feature(rustc_private)]
#![feature(staged_api)]
#![feature(step_by)]
-#![feature(question_mark)]
+#![cfg_attr(stage0, feature(question_mark))]
#![cfg_attr(test, feature(test, rand))]
extern crate syntax;
#![feature(staged_api)]
#![feature(associated_consts)]
#![feature(nonzero)]
-#![feature(question_mark)]
+#![cfg_attr(stage0, feature(question_mark))]
#[macro_use] extern crate log;
#[macro_use] extern crate syntax;
extern crate syntax_pos;
#![feature(staged_api)]
#![feature(rustc_diagnostic_macros)]
#![feature(slice_patterns)]
-#![feature(question_mark)]
+#![cfg_attr(stage0, feature(question_mark))]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(rustc_private)]
#![feature(staged_api)]
-#![feature(question_mark)]
+#![cfg_attr(stage0, feature(question_mark))]
#[macro_use] extern crate log;
#[macro_use] extern crate syntax;
#![feature(rustc_private)]
#![feature(set_stdio)]
#![feature(staged_api)]
-#![feature(question_mark)]
+#![cfg_attr(stage0, feature(question_mark))]
extern crate arena;
extern crate flate;
#![allow(unused_attributes)]
#![feature(rustc_private)]
#![feature(staged_api)]
-#![feature(question_mark)]
+#![cfg_attr(stage0, feature(question_mark))]
#![feature(range_contains)]
#![feature(libc)]
#![feature(unicode)]
#![cfg_attr(not(stage0), deny(warnings))]
#![feature(dotdot_in_tuple_patterns)]
-#![feature(question_mark)]
+#![cfg_attr(stage0, feature(question_mark))]
#![feature(rustc_private)]
#![feature(staged_api)]
#![feature(rand)]
#![feature(dotdot_in_tuple_patterns)]
#![feature(proc_macro_internals)]
#![feature(proc_macro_lib)]
-#![feature(question_mark)]
+#![cfg_attr(stage0, feature(question_mark))]
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]
#![feature(staged_api)]
-#![feature(question_mark)]
+#![cfg_attr(stage0, feature(question_mark))]
#[macro_use] extern crate log;
extern crate graphviz as dot;
#![feature(slice_patterns)]
#![feature(staged_api)]
#![feature(unicode)]
-#![feature(question_mark)]
+#![cfg_attr(stage0, feature(question_mark))]
use rustc::dep_graph::WorkProduct;
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]
#![feature(staged_api)]
-#![feature(question_mark)]
+#![cfg_attr(stage0, feature(question_mark))]
#[macro_use] extern crate log;
#[macro_use] extern crate syntax;
#![feature(staged_api)]
#![feature(test)]
#![feature(unicode)]
-#![feature(question_mark)]
+#![cfg_attr(stage0, feature(question_mark))]
extern crate arena;
extern crate getopts;
#![feature(specialization)]
#![feature(staged_api)]
#![feature(unicode)]
-#![feature(question_mark)]
+#![cfg_attr(stage0, feature(question_mark))]
#![cfg_attr(test, feature(test))]
// test harness access
#![feature(panic_unwind)]
#![feature(placement_in_syntax)]
#![feature(prelude_import)]
-#![feature(question_mark)]
+#![cfg_attr(stage0, feature(question_mark))]
#![feature(rand)]
#![feature(raw)]
#![feature(reflect_marker)]
// a...b and ...b
(active, inclusive_range_syntax, "1.7.0", Some(28237)),
- // `expr?`
- (active, question_mark, "1.9.0", Some(31436)),
-
// impl specialization (RFC 1210)
(active, specialization, "1.7.0", Some(31844)),
(accepted, while_let, "1.0.0", None),
// Allows `#[deprecated]` attribute
(accepted, deprecated, "1.9.0", Some(29935)),
+ // `expr?`
+ (accepted, question_mark, "1.14.0", Some(31436)),
);
// (changing above list without updating src/doc/reference.md makes @cmr sad)
e.span,
"inclusive range syntax is experimental");
}
- ast::ExprKind::Try(..) => {
- gate_feature_post!(&self, question_mark, e.span, "the `?` operator is not stable");
- }
ast::ExprKind::InPlace(..) => {
gate_feature_post!(&self, placement_in_syntax, e.span, EXPLAIN_PLACEMENT_IN);
}
#![feature(staged_api)]
#![feature(str_escape)]
#![feature(unicode)]
-#![feature(question_mark)]
+#![cfg_attr(stage0, feature(question_mark))]
#![feature(rustc_diagnostic_macros)]
#![feature(specialization)]
#![allow(unused_attributes)]
#![feature(rustc_private)]
#![feature(staged_api)]
-#![feature(question_mark)]
+#![cfg_attr(stage0, feature(question_mark))]
#![feature(specialization)]
use std::cell::{Cell, RefCell};
#![cfg_attr(windows, feature(libc))]
// Handle rustfmt skips
#![feature(custom_attribute)]
-#![feature(question_mark)]
+#![cfg_attr(stage0, feature(question_mark))]
#![allow(unused_attributes)]
use std::io::prelude::*;
#![feature(rustc_private)]
#![feature(set_stdio)]
#![feature(staged_api)]
-#![feature(question_mark)]
+#![cfg_attr(stage0, feature(question_mark))]
#![feature(panic_unwind)]
extern crate getopts;
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-macro_rules! id {
- ($e:expr) => { $e }
-}
-
-fn main() {
- id!(x?); //~ error: the `?` operator is not stable (see issue #31436)
- y?; //~ error: the `?` operator is not stable (see issue #31436)
-}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(question_mark)]
-
// Make sure that the span of try shorthand does not include the trailing
// semicolon;
fn a() -> Result<i32, ()> {
- Err(5)?; //~ ERROR 16:5: 16:12
+ Err(5)?; //~ ERROR 14:5: 14:12
Ok(1)
}
#![allow(unused_must_use)]
#![allow(unused_features)]
#![feature(box_syntax)]
-#![feature(question_mark)]
use std::fmt::{self, Write};
use std::usize;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(conservative_impl_trait, question_mark)]
+#![feature(conservative_impl_trait)]
struct State;
type Error = ();
// pretty-expanded FIXME #23616
-#![feature(question_mark)]
-
use std::fs::File;
use std::io::{self, BufReader, Read};
// Regression test for #20797.
-#![feature(question_mark)]
-
use std::default::Default;
use std::io;
use std::fs;
// Regression test for #21400 which itself was extracted from
// stackoverflow.com/questions/28031155/is-my-borrow-checker-drunk/28031580
-#![feature(question_mark)]
-
fn main() {
let mut t = Test;
assert_eq!(t.method1("one"), Ok(1));
// This test verifies that the expansion is hygienic, i.e. it's not affected by other `val` and
// `err` bindings that may be in scope.
-#![feature(question_mark)]
-
use std::num::ParseIntError;
fn main() {
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(question_mark)]
-
use std::fs::File;
use std::io::{Read, self};
use std::num::ParseIntError;
#![feature(box_syntax)]
#![feature(rustc_private)]
#![feature(test)]
-#![feature(question_mark)]
#![feature(libc)]
#![deny(warnings)]
// except according to those terms.
#![feature(rustc_private, rustdoc)]
-#![feature(question_mark)]
extern crate syntax;
extern crate rustdoc;
//! A few whitelisted exceptions are allowed as there's known bugs in rustdoc,
//! but this should catch the majority of "broken link" cases.
-#![feature(question_mark)]
-
extern crate url;
use std::env;
#![feature(rustc_private)]
#![feature(rustdoc)]
-#![feature(question_mark)]
extern crate rustdoc;
extern crate rustc_back;