1
Fork 0

Auto merge of #99362 - JohnTitor:rollup-4d5zo9d, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #94927 (Stabilize `let_chains` in Rust 1.64)
 - #97915 (Implement `fmt::Write` for `OsString`)
 - #99036 (Add `#[test]` to functions in test modules)
 - #99088 (Document and stabilize process_set_process_group)
 - #99302 (add tracking issue to generic member access APIs)
 - #99306 (Stabilize `future_poll_fn`)
 - #99354 (Add regression test for #95829)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2022-07-17 04:11:33 +00:00
commit 1cd72b7343
71 changed files with 669 additions and 1034 deletions

View file

@ -14,7 +14,7 @@
#![feature(const_trait_impl)] #![feature(const_trait_impl)]
#![feature(if_let_guard)] #![feature(if_let_guard)]
#![feature(label_break_value)] #![feature(label_break_value)]
#![feature(let_chains)] #![cfg_attr(bootstrap, feature(let_chains))]
#![feature(min_specialization)] #![feature(min_specialization)]
#![feature(negative_impls)] #![feature(negative_impls)]
#![feature(slice_internals)] #![feature(slice_internals)]

View file

@ -31,7 +31,7 @@
//! in the HIR, especially for multiple identifiers. //! in the HIR, especially for multiple identifiers.
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(let_chains)] #![cfg_attr(bootstrap, feature(let_chains))]
#![feature(let_else)] #![feature(let_else)]
#![feature(never_type)] #![feature(never_type)]
#![recursion_limit = "256"] #![recursion_limit = "256"]

View file

@ -119,33 +119,23 @@ impl<'a> AstValidator<'a> {
/// Emits an error banning the `let` expression provided in the given location. /// Emits an error banning the `let` expression provided in the given location.
fn ban_let_expr(&self, expr: &'a Expr, forbidden_let_reason: ForbiddenLetReason) { fn ban_let_expr(&self, expr: &'a Expr, forbidden_let_reason: ForbiddenLetReason) {
let sess = &self.session; let err = "`let` expressions are not supported here";
if sess.opts.unstable_features.is_nightly_build() { let mut diag = self.session.struct_span_err(expr.span, err);
let err = "`let` expressions are not supported here"; diag.note("only supported directly in conditions of `if` and `while` expressions");
let mut diag = sess.struct_span_err(expr.span, err); match forbidden_let_reason {
diag.note("only supported directly in conditions of `if` and `while` expressions"); ForbiddenLetReason::GenericForbidden => {}
match forbidden_let_reason { ForbiddenLetReason::NotSupportedOr(span) => {
ForbiddenLetReason::GenericForbidden => {} diag.span_note(span, "`||` operators are not supported in let chain expressions");
ForbiddenLetReason::NotSupportedOr(span) => { }
diag.span_note( ForbiddenLetReason::NotSupportedParentheses(span) => {
span, diag.span_note(
"`||` operators are not supported in let chain expressions", span,
); "`let`s wrapped in parentheses are not supported in a context with let \
} chains",
ForbiddenLetReason::NotSupportedParentheses(span) => { );
diag.span_note(
span,
"`let`s wrapped in parentheses are not supported in a context with let \
chains",
);
}
} }
diag.emit();
} else {
sess.struct_span_err(expr.span, "expected expression, found statement (`let`)")
.note("variable declaration using `let` is a statement")
.emit();
} }
diag.emit();
} }
fn check_gat_where( fn check_gat_where(

View file

@ -738,7 +738,6 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session) {
"`if let` guards are experimental", "`if let` guards are experimental",
"you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`" "you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`"
); );
gate_all!(let_chains, "`let` expressions in this position are unstable");
gate_all!( gate_all!(
async_closure, async_closure,
"async closures are unstable", "async closures are unstable",

View file

@ -8,7 +8,7 @@
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(if_let_guard)] #![feature(if_let_guard)]
#![feature(iter_is_partitioned)] #![feature(iter_is_partitioned)]
#![feature(let_chains)] #![cfg_attr(bootstrap, feature(let_chains))]
#![feature(let_else)] #![feature(let_else)]
#![recursion_limit = "256"] #![recursion_limit = "256"]

View file

@ -4,7 +4,7 @@
//! The goal is to move the definition of `MetaItem` and things that don't need to be in `syntax` //! The goal is to move the definition of `MetaItem` and things that don't need to be in `syntax`
//! to this crate. //! to this crate.
#![feature(let_chains)] #![cfg_attr(bootstrap, feature(let_chains))]
#![feature(let_else)] #![feature(let_else)]
#[macro_use] #[macro_use]

View file

@ -2,7 +2,7 @@
#![allow(rustc::potential_query_instability)] #![allow(rustc::potential_query_instability)]
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(let_chains)] #![cfg_attr(bootstrap, feature(let_chains))]
#![feature(let_else)] #![feature(let_else)]
#![feature(min_specialization)] #![feature(min_specialization)]
#![feature(never_type)] #![feature(never_type)]

View file

@ -8,7 +8,7 @@
#![feature(decl_macro)] #![feature(decl_macro)]
#![feature(if_let_guard)] #![feature(if_let_guard)]
#![feature(is_sorted)] #![feature(is_sorted)]
#![feature(let_chains)] #![cfg_attr(bootstrap, feature(let_chains))]
#![feature(let_else)] #![feature(let_else)]
#![feature(proc_macro_internals)] #![feature(proc_macro_internals)]
#![feature(proc_macro_quote)] #![feature(proc_macro_quote)]

View file

@ -6,7 +6,7 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![feature(hash_raw_entry)] #![feature(hash_raw_entry)]
#![feature(let_chains)] #![cfg_attr(bootstrap, feature(let_chains))]
#![feature(let_else)] #![feature(let_else)]
#![feature(extern_types)] #![feature(extern_types)]
#![feature(once_cell)] #![feature(once_cell)]

View file

@ -9,7 +9,7 @@ Rust MIR: a lowered representation of Rust.
#![feature(control_flow_enum)] #![feature(control_flow_enum)]
#![feature(decl_macro)] #![feature(decl_macro)]
#![feature(exact_size_is_empty)] #![feature(exact_size_is_empty)]
#![feature(let_chains)] #![cfg_attr(bootstrap, feature(let_chains))]
#![feature(let_else)] #![feature(let_else)]
#![feature(map_try_insert)] #![feature(map_try_insert)]
#![feature(min_specialization)] #![feature(min_specialization)]

View file

@ -1,4 +1,4 @@
#![feature(let_chains)] #![cfg_attr(bootstrap, feature(let_chains))]
#![feature(once_cell)] #![feature(once_cell)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]

View file

@ -3,7 +3,7 @@
#![feature(associated_type_bounds)] #![feature(associated_type_bounds)]
#![feature(associated_type_defaults)] #![feature(associated_type_defaults)]
#![feature(if_let_guard)] #![feature(if_let_guard)]
#![feature(let_chains)] #![cfg_attr(bootstrap, feature(let_chains))]
#![feature(let_else)] #![feature(let_else)]
#![feature(macro_metavar_expr)] #![feature(macro_metavar_expr)]
#![feature(proc_macro_diagnostic)] #![feature(proc_macro_diagnostic)]

View file

@ -186,6 +186,8 @@ declare_features! (
/// Allows some increased flexibility in the name resolution rules, /// Allows some increased flexibility in the name resolution rules,
/// especially around globs and shadowing (RFC 1560). /// especially around globs and shadowing (RFC 1560).
(accepted, item_like_imports, "1.15.0", Some(35120), None), (accepted, item_like_imports, "1.15.0", Some(35120), None),
/// Allows `if/while p && let q = r && ...` chains.
(accepted, let_chains, "1.64.0", Some(53667), None),
/// Allows `break {expr}` with a value inside `loop`s. /// Allows `break {expr}` with a value inside `loop`s.
(accepted, loop_break_value, "1.19.0", Some(37339), None), (accepted, loop_break_value, "1.19.0", Some(37339), None),
/// Allows use of `?` as the Kleene "at most one" operator in macros. /// Allows use of `?` as the Kleene "at most one" operator in macros.

View file

@ -424,8 +424,6 @@ declare_features! (
(active, label_break_value, "1.28.0", Some(48594), None), (active, label_break_value, "1.28.0", Some(48594), None),
// Allows setting the threshold for the `large_assignments` lint. // Allows setting the threshold for the `large_assignments` lint.
(active, large_assignments, "1.52.0", Some(83518), None), (active, large_assignments, "1.52.0", Some(83518), None),
/// Allows `if/while p && let q = r && ...` chains.
(active, let_chains, "1.37.0", Some(53667), None),
/// Allows `let...else` statements. /// Allows `let...else` statements.
(active, let_else, "1.56.0", Some(87335), None), (active, let_else, "1.56.0", Some(87335), None),
/// Allows `#[link(..., cfg(..))]`. /// Allows `#[link(..., cfg(..))]`.

View file

@ -18,7 +18,7 @@
#![feature(control_flow_enum)] #![feature(control_flow_enum)]
#![feature(extend_one)] #![feature(extend_one)]
#![feature(label_break_value)] #![feature(label_break_value)]
#![feature(let_chains)] #![cfg_attr(bootstrap, feature(let_chains))]
#![feature(let_else)] #![feature(let_else)]
#![feature(min_specialization)] #![feature(min_specialization)]
#![feature(never_type)] #![feature(never_type)]

View file

@ -33,7 +33,7 @@
#![feature(if_let_guard)] #![feature(if_let_guard)]
#![feature(iter_intersperse)] #![feature(iter_intersperse)]
#![feature(iter_order_by)] #![feature(iter_order_by)]
#![feature(let_chains)] #![cfg_attr(bootstrap, feature(let_chains))]
#![feature(let_else)] #![feature(let_else)]
#![feature(never_type)] #![feature(never_type)]
#![recursion_limit = "256"] #![recursion_limit = "256"]

View file

@ -4,7 +4,7 @@
#![feature(generators)] #![feature(generators)]
#![feature(generic_associated_types)] #![feature(generic_associated_types)]
#![feature(iter_from_generator)] #![feature(iter_from_generator)]
#![feature(let_chains)] #![cfg_attr(bootstrap, feature(let_chains))]
#![feature(let_else)] #![feature(let_else)]
#![feature(once_cell)] #![feature(once_cell)]
#![feature(proc_macro_internals)] #![feature(proc_macro_internals)]

View file

@ -40,7 +40,7 @@
#![feature(extern_types)] #![feature(extern_types)]
#![feature(new_uninit)] #![feature(new_uninit)]
#![feature(once_cell)] #![feature(once_cell)]
#![feature(let_chains)] #![cfg_attr(bootstrap, feature(let_chains))]
#![feature(let_else)] #![feature(let_else)]
#![feature(min_specialization)] #![feature(min_specialization)]
#![feature(trusted_len)] #![feature(trusted_len)]

View file

@ -5,7 +5,7 @@
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(control_flow_enum)] #![feature(control_flow_enum)]
#![feature(if_let_guard)] #![feature(if_let_guard)]
#![feature(let_chains)] #![cfg_attr(bootstrap, feature(let_chains))]
#![feature(let_else)] #![feature(let_else)]
#![feature(min_specialization)] #![feature(min_specialization)]
#![feature(once_cell)] #![feature(once_cell)]

View file

@ -1,6 +1,6 @@
#![allow(rustc::potential_query_instability)] #![allow(rustc::potential_query_instability)]
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(let_chains)] #![cfg_attr(bootstrap, feature(let_chains))]
#![feature(let_else)] #![feature(let_else)]
#![feature(map_try_insert)] #![feature(map_try_insert)]
#![feature(min_specialization)] #![feature(min_specialization)]

View file

@ -3,7 +3,7 @@
#![feature(array_windows)] #![feature(array_windows)]
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(if_let_guard)] #![feature(if_let_guard)]
#![feature(let_chains)] #![cfg_attr(bootstrap, feature(let_chains))]
#![feature(let_else)] #![feature(let_else)]
#![feature(never_type)] #![feature(never_type)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]

View file

@ -2341,16 +2341,9 @@ impl<'a> Parser<'a> {
/// Parses the condition of a `if` or `while` expression. /// Parses the condition of a `if` or `while` expression.
fn parse_cond_expr(&mut self) -> PResult<'a, P<Expr>> { fn parse_cond_expr(&mut self) -> PResult<'a, P<Expr>> {
let cond = self.with_let_management(true, |local_self| { self.with_let_management(true, |local_self| {
local_self.parse_expr_res(Restrictions::NO_STRUCT_LITERAL, None) local_self.parse_expr_res(Restrictions::NO_STRUCT_LITERAL, None)
})?; })
if let ExprKind::Let(..) = cond.kind {
// Remove the last feature gating of a `let` expression since it's stable.
self.sess.gated_spans.ungate_last(sym::let_chains, cond.span);
}
Ok(cond)
} }
// Checks if `let` is in an invalid position like `let x = let y = 1;` or // Checks if `let` is in an invalid position like `let x = let y = 1;` or
@ -2389,7 +2382,6 @@ impl<'a> Parser<'a> {
this.parse_assoc_expr_with(1 + prec_let_scrutinee_needs_par(), None.into()) this.parse_assoc_expr_with(1 + prec_let_scrutinee_needs_par(), None.into())
})?; })?;
let span = lo.to(expr.span); let span = lo.to(expr.span);
self.sess.gated_spans.gate(sym::let_chains, span);
Ok(self.mk_expr(span, ExprKind::Let(pat, expr, span), attrs)) Ok(self.mk_expr(span, ExprKind::Let(pat, expr, span), attrs))
} }
@ -2695,15 +2687,11 @@ impl<'a> Parser<'a> {
pub(super) fn parse_arm(&mut self) -> PResult<'a, Arm> { pub(super) fn parse_arm(&mut self) -> PResult<'a, Arm> {
// Used to check the `let_chains` and `if_let_guard` features mostly by scaning // Used to check the `let_chains` and `if_let_guard` features mostly by scaning
// `&&` tokens. // `&&` tokens.
fn check_let_expr(expr: &Expr) -> (bool, bool) { fn check_let_expr(expr: &Expr) -> bool {
match expr.kind { match expr.kind {
ExprKind::Binary(_, ref lhs, ref rhs) => { ExprKind::Binary(_, ref lhs, ref rhs) => check_let_expr(lhs) || check_let_expr(rhs),
let lhs_rslt = check_let_expr(lhs); ExprKind::Let(..) => true,
let rhs_rslt = check_let_expr(rhs); _ => false,
(lhs_rslt.0 || rhs_rslt.0, false)
}
ExprKind::Let(..) => (true, true),
_ => (false, true),
} }
} }
let attrs = self.parse_outer_attributes()?; let attrs = self.parse_outer_attributes()?;
@ -2718,12 +2706,8 @@ impl<'a> Parser<'a> {
let guard = if this.eat_keyword(kw::If) { let guard = if this.eat_keyword(kw::If) {
let if_span = this.prev_token.span; let if_span = this.prev_token.span;
let cond = this.with_let_management(true, |local_this| local_this.parse_expr())?; let cond = this.with_let_management(true, |local_this| local_this.parse_expr())?;
let (has_let_expr, does_not_have_bin_op) = check_let_expr(&cond); let has_let_expr = check_let_expr(&cond);
if has_let_expr { if has_let_expr {
if does_not_have_bin_op {
// Remove the last feature gating of a `let` expression since it's stable.
this.sess.gated_spans.ungate_last(sym::let_chains, cond.span);
}
let span = if_span.to(cond.span); let span = if_span.to(cond.span);
this.sess.gated_spans.gate(sym::if_let_guard, span); this.sess.gated_spans.gate(sym::if_let_guard, span);
} }

View file

@ -7,7 +7,7 @@
#![allow(rustc::potential_query_instability)] #![allow(rustc::potential_query_instability)]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![feature(iter_intersperse)] #![feature(iter_intersperse)]
#![feature(let_chains)] #![cfg_attr(bootstrap, feature(let_chains))]
#![feature(let_else)] #![feature(let_else)]
#![feature(map_try_insert)] #![feature(map_try_insert)]
#![feature(min_specialization)] #![feature(min_specialization)]

View file

@ -10,7 +10,7 @@
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(drain_filter)] #![feature(drain_filter)]
#![feature(if_let_guard)] #![feature(if_let_guard)]
#![feature(let_chains)] #![cfg_attr(bootstrap, feature(let_chains))]
#![feature(let_else)] #![feature(let_else)]
#![feature(never_type)] #![feature(never_type)]
#![recursion_limit = "256"] #![recursion_limit = "256"]

View file

@ -1,5 +1,5 @@
#![feature(if_let_guard)] #![feature(if_let_guard)]
#![feature(let_chains)] #![cfg_attr(bootstrap, feature(let_chains))]
#![feature(let_else)] #![feature(let_else)]
#![feature(min_specialization)] #![feature(min_specialization)]
#![feature(never_type)] #![feature(never_type)]

View file

@ -17,7 +17,7 @@
#![feature(drain_filter)] #![feature(drain_filter)]
#![feature(hash_drain_filter)] #![feature(hash_drain_filter)]
#![feature(label_break_value)] #![feature(label_break_value)]
#![feature(let_chains)] #![cfg_attr(bootstrap, feature(let_chains))]
#![feature(let_else)] #![feature(let_else)]
#![feature(if_let_guard)] #![feature(if_let_guard)]
#![feature(never_type)] #![feature(never_type)]

View file

@ -65,7 +65,7 @@ This API is completely unstable and subject to change.
#![feature(is_sorted)] #![feature(is_sorted)]
#![feature(iter_intersperse)] #![feature(iter_intersperse)]
#![feature(label_break_value)] #![feature(label_break_value)]
#![feature(let_chains)] #![cfg_attr(bootstrap, feature(let_chains))]
#![feature(let_else)] #![feature(let_else)]
#![feature(min_specialization)] #![feature(min_specialization)]
#![feature(never_type)] #![feature(never_type)]

View file

@ -15,7 +15,7 @@ use crate::task::{Context, Poll};
/// # Examples /// # Examples
/// ///
/// ``` /// ```
/// #![feature(future_join, future_poll_fn)] /// #![feature(future_join)]
/// ///
/// use std::future::join; /// use std::future::join;
/// ///
@ -31,7 +31,7 @@ use crate::task::{Context, Poll};
/// `join!` is variadic, so you can pass any number of futures: /// `join!` is variadic, so you can pass any number of futures:
/// ///
/// ``` /// ```
/// #![feature(future_join, future_poll_fn)] /// #![feature(future_join)]
/// ///
/// use std::future::join; /// use std::future::join;
/// ///

View file

@ -37,7 +37,7 @@ pub use pending::{pending, Pending};
#[stable(feature = "future_readiness_fns", since = "1.48.0")] #[stable(feature = "future_readiness_fns", since = "1.48.0")]
pub use ready::{ready, Ready}; pub use ready::{ready, Ready};
#[unstable(feature = "future_poll_fn", issue = "72302")] #[stable(feature = "future_poll_fn", since = "1.64.0")]
pub use poll_fn::{poll_fn, PollFn}; pub use poll_fn::{poll_fn, PollFn};
/// This type is needed because: /// This type is needed because:

View file

@ -10,7 +10,6 @@ use crate::task::{Context, Poll};
/// # Examples /// # Examples
/// ///
/// ``` /// ```
/// #![feature(future_poll_fn)]
/// # async fn run() { /// # async fn run() {
/// use core::future::poll_fn; /// use core::future::poll_fn;
/// use std::task::{Context, Poll}; /// use std::task::{Context, Poll};
@ -23,7 +22,7 @@ use crate::task::{Context, Poll};
/// assert_eq!(read_future.await, "Hello, World!".to_owned()); /// assert_eq!(read_future.await, "Hello, World!".to_owned());
/// # } /// # }
/// ``` /// ```
#[unstable(feature = "future_poll_fn", issue = "72302")] #[stable(feature = "future_poll_fn", since = "1.64.0")]
pub fn poll_fn<T, F>(f: F) -> PollFn<F> pub fn poll_fn<T, F>(f: F) -> PollFn<F>
where where
F: FnMut(&mut Context<'_>) -> Poll<T>, F: FnMut(&mut Context<'_>) -> Poll<T>,
@ -36,22 +35,22 @@ where
/// This `struct` is created by [`poll_fn()`]. See its /// This `struct` is created by [`poll_fn()`]. See its
/// documentation for more. /// documentation for more.
#[must_use = "futures do nothing unless you `.await` or poll them"] #[must_use = "futures do nothing unless you `.await` or poll them"]
#[unstable(feature = "future_poll_fn", issue = "72302")] #[stable(feature = "future_poll_fn", since = "1.64.0")]
pub struct PollFn<F> { pub struct PollFn<F> {
f: F, f: F,
} }
#[unstable(feature = "future_poll_fn", issue = "72302")] #[stable(feature = "future_poll_fn", since = "1.64.0")]
impl<F> Unpin for PollFn<F> {} impl<F> Unpin for PollFn<F> {}
#[unstable(feature = "future_poll_fn", issue = "72302")] #[stable(feature = "future_poll_fn", since = "1.64.0")]
impl<F> fmt::Debug for PollFn<F> { impl<F> fmt::Debug for PollFn<F> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("PollFn").finish() f.debug_struct("PollFn").finish()
} }
} }
#[unstable(feature = "future_poll_fn", issue = "72302")] #[stable(feature = "future_poll_fn", since = "1.64.0")]
impl<T, F> Future for PollFn<F> impl<T, F> Future for PollFn<F>
where where
F: FnMut(&mut Context<'_>) -> Poll<T>, F: FnMut(&mut Context<'_>) -> Poll<T>,

View file

@ -32,7 +32,6 @@
#![feature(fmt_internals)] #![feature(fmt_internals)]
#![feature(float_minimum_maximum)] #![feature(float_minimum_maximum)]
#![feature(future_join)] #![feature(future_join)]
#![feature(future_poll_fn)]
#![feature(generic_assert_internals)] #![feature(generic_assert_internals)]
#![feature(array_try_from_fn)] #![feature(array_try_from_fn)]
#![feature(hasher_prefixfree_extras)] #![feature(hasher_prefixfree_extras)]

View file

@ -364,12 +364,12 @@ pub trait Error: Debug + Display {
/// assert!(core::ptr::eq(&error.backtrace, backtrace_ref)); /// assert!(core::ptr::eq(&error.backtrace, backtrace_ref));
/// } /// }
/// ``` /// ```
#[unstable(feature = "error_generic_member_access", issue = "none")] #[unstable(feature = "error_generic_member_access", issue = "99301")]
#[allow(unused_variables)] #[allow(unused_variables)]
fn provide<'a>(&'a self, req: &mut Demand<'a>) {} fn provide<'a>(&'a self, req: &mut Demand<'a>) {}
} }
#[unstable(feature = "error_generic_member_access", issue = "none")] #[unstable(feature = "error_generic_member_access", issue = "99301")]
impl Provider for dyn Error + 'static { impl Provider for dyn Error + 'static {
fn provide<'a>(&'a self, req: &mut Demand<'a>) { fn provide<'a>(&'a self, req: &mut Demand<'a>) {
self.provide(req) self.provide(req)
@ -912,13 +912,13 @@ impl dyn Error + 'static {
} }
/// Request a reference of type `T` as context about this error. /// Request a reference of type `T` as context about this error.
#[unstable(feature = "error_generic_member_access", issue = "none")] #[unstable(feature = "error_generic_member_access", issue = "99301")]
pub fn request_ref<T: ?Sized + 'static>(&self) -> Option<&T> { pub fn request_ref<T: ?Sized + 'static>(&self) -> Option<&T> {
core::any::request_ref(self) core::any::request_ref(self)
} }
/// Request a value of type `T` as context about this error. /// Request a value of type `T` as context about this error.
#[unstable(feature = "error_generic_member_access", issue = "none")] #[unstable(feature = "error_generic_member_access", issue = "99301")]
pub fn request_value<T: 'static>(&self) -> Option<T> { pub fn request_value<T: 'static>(&self) -> Option<T> {
core::any::request_value(self) core::any::request_value(self)
} }
@ -947,13 +947,13 @@ impl dyn Error + 'static + Send {
} }
/// Request a reference of type `T` as context about this error. /// Request a reference of type `T` as context about this error.
#[unstable(feature = "error_generic_member_access", issue = "none")] #[unstable(feature = "error_generic_member_access", issue = "99301")]
pub fn request_ref<T: ?Sized + 'static>(&self) -> Option<&T> { pub fn request_ref<T: ?Sized + 'static>(&self) -> Option<&T> {
<dyn Error + 'static>::request_ref(self) <dyn Error + 'static>::request_ref(self)
} }
/// Request a value of type `T` as context about this error. /// Request a value of type `T` as context about this error.
#[unstable(feature = "error_generic_member_access", issue = "none")] #[unstable(feature = "error_generic_member_access", issue = "99301")]
pub fn request_value<T: 'static>(&self) -> Option<T> { pub fn request_value<T: 'static>(&self) -> Option<T> {
<dyn Error + 'static>::request_value(self) <dyn Error + 'static>::request_value(self)
} }
@ -982,13 +982,13 @@ impl dyn Error + 'static + Send + Sync {
} }
/// Request a reference of type `T` as context about this error. /// Request a reference of type `T` as context about this error.
#[unstable(feature = "error_generic_member_access", issue = "none")] #[unstable(feature = "error_generic_member_access", issue = "99301")]
pub fn request_ref<T: ?Sized + 'static>(&self) -> Option<&T> { pub fn request_ref<T: ?Sized + 'static>(&self) -> Option<&T> {
<dyn Error + 'static>::request_ref(self) <dyn Error + 'static>::request_ref(self)
} }
/// Request a value of type `T` as context about this error. /// Request a value of type `T` as context about this error.
#[unstable(feature = "error_generic_member_access", issue = "none")] #[unstable(feature = "error_generic_member_access", issue = "99301")]
pub fn request_value<T: 'static>(&self) -> Option<T> { pub fn request_value<T: 'static>(&self) -> Option<T> {
<dyn Error + 'static>::request_value(self) <dyn Error + 'static>::request_value(self)
} }

View file

@ -643,6 +643,14 @@ impl Hash for OsString {
} }
} }
#[stable(feature = "os_string_fmt_write", since = "1.64.0")]
impl fmt::Write for OsString {
fn write_str(&mut self, s: &str) -> fmt::Result {
self.push(s);
Ok(())
}
}
impl OsStr { impl OsStr {
/// Coerces into an `OsStr` slice. /// Coerces into an `OsStr` slice.
/// ///

View file

@ -243,7 +243,7 @@
#![feature(intra_doc_pointers)] #![feature(intra_doc_pointers)]
#![feature(label_break_value)] #![feature(label_break_value)]
#![feature(lang_items)] #![feature(lang_items)]
#![feature(let_chains)] #![cfg_attr(bootstrap, feature(let_chains))]
#![feature(let_else)] #![feature(let_else)]
#![feature(linkage)] #![feature(linkage)]
#![feature(min_specialization)] #![feature(min_specialization)]

View file

@ -148,9 +148,36 @@ pub trait CommandExt: Sealed {
where where
S: AsRef<OsStr>; S: AsRef<OsStr>;
/// Sets the process group ID of the child process. Translates to a `setpgid` call in the child /// Sets the process group ID (PGID) of the child process. Equivalent to a
/// process. /// `setpgid` call in the child process, but may be more efficient.
#[unstable(feature = "process_set_process_group", issue = "93857")] ///
/// Process groups determine which processes receive signals.
///
/// # Examples
///
/// Pressing Ctrl-C in a terminal will send SIGINT to all processes in
/// the current foreground process group. By spawning the `sleep`
/// subprocess in a new process group, it will not receive SIGINT from the
/// terminal.
///
/// The parent process could install a signal handler and manage the
/// subprocess on its own terms.
///
/// A process group ID of 0 will use the process ID as the PGID.
///
/// ```no_run
/// use std::process::Command;
/// use std::os::unix::process::CommandExt;
///
/// Command::new("sleep")
/// .arg("10")
/// .process_group(0)
/// .spawn()?
/// .wait()?;
/// #
/// # Ok::<_, Box<dyn std::error::Error>>(())
/// ```
#[stable(feature = "process_set_process_group", since = "1.64.0")]
fn process_group(&mut self, pgroup: i32) -> &mut process::Command; fn process_group(&mut self, pgroup: i32) -> &mut process::Command;
} }

View file

@ -9,7 +9,7 @@
#![feature(control_flow_enum)] #![feature(control_flow_enum)]
#![feature(box_syntax)] #![feature(box_syntax)]
#![feature(drain_filter)] #![feature(drain_filter)]
#![feature(let_chains)] #![cfg_attr(bootstrap, feature(let_chains))]
#![feature(let_else)] #![feature(let_else)]
#![feature(test)] #![feature(test)]
#![feature(never_type)] #![feature(never_type)]

View file

@ -1,7 +1,5 @@
// check-pass // check-pass
#![feature(let_chains)]
#[cfg(FALSE)] #[cfg(FALSE)]
fn foo() { fn foo() {
#[attr] #[attr]

View file

@ -4,7 +4,6 @@
fn a() { fn a() {
if let x = 1 && i = 2 {} if let x = 1 && i = 2 {}
//~^ ERROR cannot find value `i` in this scope //~^ ERROR cannot find value `i` in this scope
//~| ERROR `let` expressions in this position are unstable
//~| ERROR mismatched types //~| ERROR mismatched types
//~| ERROR `let` expressions are not supported here //~| ERROR `let` expressions are not supported here
} }

View file

@ -13,7 +13,7 @@ LL | if let x = 1 && i = 2 {}
| ^ not found in this scope | ^ not found in this scope
error[E0425]: cannot find value `i` in this scope error[E0425]: cannot find value `i` in this scope
--> $DIR/bad-if-let-suggestion.rs:13:9 --> $DIR/bad-if-let-suggestion.rs:12:9
| |
LL | fn a() { LL | fn a() {
| ------ similarly named function `a` defined here | ------ similarly named function `a` defined here
@ -22,7 +22,7 @@ LL | if (i + j) = i {}
| ^ help: a function with a similar name exists: `a` | ^ help: a function with a similar name exists: `a`
error[E0425]: cannot find value `j` in this scope error[E0425]: cannot find value `j` in this scope
--> $DIR/bad-if-let-suggestion.rs:13:13 --> $DIR/bad-if-let-suggestion.rs:12:13
| |
LL | fn a() { LL | fn a() {
| ------ similarly named function `a` defined here | ------ similarly named function `a` defined here
@ -31,7 +31,7 @@ LL | if (i + j) = i {}
| ^ help: a function with a similar name exists: `a` | ^ help: a function with a similar name exists: `a`
error[E0425]: cannot find value `i` in this scope error[E0425]: cannot find value `i` in this scope
--> $DIR/bad-if-let-suggestion.rs:13:18 --> $DIR/bad-if-let-suggestion.rs:12:18
| |
LL | fn a() { LL | fn a() {
| ------ similarly named function `a` defined here | ------ similarly named function `a` defined here
@ -40,7 +40,7 @@ LL | if (i + j) = i {}
| ^ help: a function with a similar name exists: `a` | ^ help: a function with a similar name exists: `a`
error[E0425]: cannot find value `x` in this scope error[E0425]: cannot find value `x` in this scope
--> $DIR/bad-if-let-suggestion.rs:20:8 --> $DIR/bad-if-let-suggestion.rs:19:8
| |
LL | fn a() { LL | fn a() {
| ------ similarly named function `a` defined here | ------ similarly named function `a` defined here
@ -48,22 +48,13 @@ LL | fn a() {
LL | if x[0] = 1 {} LL | if x[0] = 1 {}
| ^ help: a function with a similar name exists: `a` | ^ help: a function with a similar name exists: `a`
error[E0658]: `let` expressions in this position are unstable
--> $DIR/bad-if-let-suggestion.rs:5:8
|
LL | if let x = 1 && i = 2 {}
| ^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/bad-if-let-suggestion.rs:5:8 --> $DIR/bad-if-let-suggestion.rs:5:8
| |
LL | if let x = 1 && i = 2 {} LL | if let x = 1 && i = 2 {}
| ^^^^^^^^^^^^^^^^^^ expected `bool`, found `()` | ^^^^^^^^^^^^^^^^^^ expected `bool`, found `()`
error: aborting due to 8 previous errors error: aborting due to 7 previous errors
Some errors have detailed explanations: E0308, E0425, E0658. Some errors have detailed explanations: E0308, E0425.
For more information about an error, try `rustc --explain E0308`. For more information about an error, try `rustc --explain E0308`.

10
src/test/ui/extern/issue-95829.rs vendored Normal file
View file

@ -0,0 +1,10 @@
// edition:2018
extern {
async fn L() { //~ ERROR: incorrect function inside `extern` block
//~^ ERROR: functions in `extern` blocks cannot have qualifiers
async fn M() {}
}
}
fn main() {}

32
src/test/ui/extern/issue-95829.stderr vendored Normal file
View file

@ -0,0 +1,32 @@
error: incorrect function inside `extern` block
--> $DIR/issue-95829.rs:4:14
|
LL | extern {
| ------ `extern` blocks define existing foreign functions and functions inside of them cannot have a body
LL | async fn L() {
| ______________^___-
| | |
| | cannot have a body
LL | |
LL | | async fn M() {}
LL | | }
| |_____- help: remove the invalid body: `;`
|
= help: you might have meant to write a function accessible through FFI, which can be done by writing `extern fn` outside of the `extern` block
= note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html
error: functions in `extern` blocks cannot have qualifiers
--> $DIR/issue-95829.rs:4:14
|
LL | extern {
| ------ in this `extern` block
LL | async fn L() {
| ^
|
help: remove the qualifiers
|
LL | fn L() {
| ~~
error: aborting due to 2 previous errors

View file

@ -8,76 +8,94 @@ fn a() {}
fn b() {} fn b() {}
mod test { mod test {
use super::a; //~ ERROR unused import: `super::a` use super::a;
#[test]
fn foo() { fn foo() {
use crate::b; //~ ERROR unused import: `crate::b` a();
use crate::b; //~ ERROR unused import: `crate::b`
} }
} }
mod tests { mod tests {
use super::a; //~ ERROR unused import: `super::a` use super::a;
#[test]
fn foo() { fn foo() {
use crate::b; //~ ERROR unused import: `crate::b` a();
use crate::b; //~ ERROR unused import: `crate::b`
} }
} }
mod test_a { mod test_a {
use super::a; //~ ERROR unused import: `super::a` use super::a;
#[test]
fn foo() { fn foo() {
use crate::b; //~ ERROR unused import: `crate::b` a();
use crate::b; //~ ERROR unused import: `crate::b`
} }
} }
mod a_test { mod a_test {
use super::a; //~ ERROR unused import: `super::a` use super::a;
#[test]
fn foo() { fn foo() {
use crate::b; //~ ERROR unused import: `crate::b` a();
use crate::b; //~ ERROR unused import: `crate::b`
} }
} }
mod tests_a { mod tests_a {
use super::a; //~ ERROR unused import: `super::a` use super::a;
#[test]
fn foo() { fn foo() {
use crate::b; //~ ERROR unused import: `crate::b` a();
use crate::b; //~ ERROR unused import: `crate::b`
} }
} }
mod a_tests { mod a_tests {
use super::a; //~ ERROR unused import: `super::a` use super::a;
#[test]
fn foo() { fn foo() {
use crate::b; //~ ERROR unused import: `crate::b` a();
use crate::b; //~ ERROR unused import: `crate::b`
} }
} }
mod fastest_search { mod fastest_search {
use super::a; //~ ERROR unused import: `super::a` use super::a;
#[test]
fn foo() { fn foo() {
use crate::b; //~ ERROR unused import: `crate::b` a();
use crate::b; //~ ERROR unused import: `crate::b`
} }
} }
#[cfg(test)] #[cfg(test)]
mod test_has_attr { mod test_has_attr {
use super::a; //~ ERROR unused import: `super::a` use super::a;
#[test]
fn foo() { fn foo() {
use crate::b; //~ ERROR unused import: `crate::b` a();
use crate::b; //~ ERROR unused import: `crate::b`
} }
} }
mod test_has_no_attr { mod test_has_no_attr {
#[cfg(test)] #[cfg(test)]
use super::a; //~ ERROR unused import: `super::a` use super::a;
#[test]
fn foo() { fn foo() {
use crate::b; //~ ERROR unused import: `crate::b` a();
use crate::b; //~ ERROR unused import: `crate::b`
} }
} }

View file

@ -10,113 +10,59 @@ note: the lint level is defined here
LL | #![deny(unused_imports)] LL | #![deny(unused_imports)]
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
error: unused import: `super::a`
--> $DIR/unused-imports-in-test-mode.rs:11:9
|
LL | use super::a;
| ^^^^^^^^
error: unused import: `crate::b` error: unused import: `crate::b`
--> $DIR/unused-imports-in-test-mode.rs:14:13 --> $DIR/unused-imports-in-test-mode.rs:16:13
| |
LL | use crate::b; LL | use crate::b;
| ^^^^^^^^ | ^^^^^^^^
error: unused import: `super::a`
--> $DIR/unused-imports-in-test-mode.rs:19:9
|
LL | use super::a;
| ^^^^^^^^
error: unused import: `crate::b` error: unused import: `crate::b`
--> $DIR/unused-imports-in-test-mode.rs:22:13 --> $DIR/unused-imports-in-test-mode.rs:26:13
| |
LL | use crate::b; LL | use crate::b;
| ^^^^^^^^ | ^^^^^^^^
error: unused import: `super::a`
--> $DIR/unused-imports-in-test-mode.rs:27:9
|
LL | use super::a;
| ^^^^^^^^
error: unused import: `crate::b` error: unused import: `crate::b`
--> $DIR/unused-imports-in-test-mode.rs:30:13 --> $DIR/unused-imports-in-test-mode.rs:36:13
| |
LL | use crate::b; LL | use crate::b;
| ^^^^^^^^ | ^^^^^^^^
error: unused import: `super::a`
--> $DIR/unused-imports-in-test-mode.rs:35:9
|
LL | use super::a;
| ^^^^^^^^
error: unused import: `crate::b`
--> $DIR/unused-imports-in-test-mode.rs:38:13
|
LL | use crate::b;
| ^^^^^^^^
error: unused import: `super::a`
--> $DIR/unused-imports-in-test-mode.rs:43:9
|
LL | use super::a;
| ^^^^^^^^
error: unused import: `crate::b` error: unused import: `crate::b`
--> $DIR/unused-imports-in-test-mode.rs:46:13 --> $DIR/unused-imports-in-test-mode.rs:46:13
| |
LL | use crate::b; LL | use crate::b;
| ^^^^^^^^ | ^^^^^^^^
error: unused import: `super::a`
--> $DIR/unused-imports-in-test-mode.rs:51:9
|
LL | use super::a;
| ^^^^^^^^
error: unused import: `crate::b` error: unused import: `crate::b`
--> $DIR/unused-imports-in-test-mode.rs:54:13 --> $DIR/unused-imports-in-test-mode.rs:56:13
| |
LL | use crate::b; LL | use crate::b;
| ^^^^^^^^ | ^^^^^^^^
error: unused import: `super::a`
--> $DIR/unused-imports-in-test-mode.rs:59:9
|
LL | use super::a;
| ^^^^^^^^
error: unused import: `crate::b` error: unused import: `crate::b`
--> $DIR/unused-imports-in-test-mode.rs:62:13 --> $DIR/unused-imports-in-test-mode.rs:66:13
| |
LL | use crate::b; LL | use crate::b;
| ^^^^^^^^ | ^^^^^^^^
error: unused import: `super::a`
--> $DIR/unused-imports-in-test-mode.rs:68:9
|
LL | use super::a;
| ^^^^^^^^
error: unused import: `crate::b` error: unused import: `crate::b`
--> $DIR/unused-imports-in-test-mode.rs:71:13 --> $DIR/unused-imports-in-test-mode.rs:76:13
| |
LL | use crate::b; LL | use crate::b;
| ^^^^^^^^ | ^^^^^^^^
error: unused import: `super::a`
--> $DIR/unused-imports-in-test-mode.rs:77:9
|
LL | use super::a;
| ^^^^^^^^
error: unused import: `crate::b` error: unused import: `crate::b`
--> $DIR/unused-imports-in-test-mode.rs:80:13 --> $DIR/unused-imports-in-test-mode.rs:87:13
| |
LL | use crate::b; LL | use crate::b;
| ^^^^^^^^ | ^^^^^^^^
error: aborting due to 19 previous errors error: unused import: `crate::b`
--> $DIR/unused-imports-in-test-mode.rs:98:13
|
LL | use crate::b;
| ^^^^^^^^
error: aborting due to 10 previous errors

View file

@ -6,58 +6,83 @@ fn a() {}
fn b() {} fn b() {}
mod test { mod test {
use super::a; //~ ERROR unused import: `super::a` use super::a; //~ ERROR unused import: `super::a`
#[test]
fn foo() { fn foo() {
use crate::b; //~ ERROR unused import: `crate::b` a();
use crate::b;
} }
} }
mod tests { mod tests {
use super::a; //~ ERROR unused import: `super::a` use super::a; //~ ERROR unused import: `super::a`
#[test]
fn foo() { fn foo() {
use crate::b; //~ ERROR unused import: `crate::b` a();
use crate::b;
} }
} }
mod test_a { mod test_a {
use super::a; //~ ERROR unused import: `super::a` use super::a; //~ ERROR unused import: `super::a`
#[test]
fn foo() { fn foo() {
use crate::b; //~ ERROR unused import: `crate::b` a();
use crate::b;
} }
} }
mod a_test { mod a_test {
use super::a; //~ ERROR unused import: `super::a` use super::a; //~ ERROR unused import: `super::a`
#[test]
fn foo() { fn foo() {
use crate::b; //~ ERROR unused import: `crate::b` a();
use crate::b;
} }
} }
mod tests_a { mod tests_a {
use super::a; //~ ERROR unused import: `super::a` use super::a; //~ ERROR unused import: `super::a`
#[test]
fn foo() { fn foo() {
use crate::b; //~ ERROR unused import: `crate::b` a();
use crate::b;
} }
} }
mod a_tests { mod a_tests {
use super::a; //~ ERROR unused import: `super::a` use super::a; //~ ERROR unused import: `super::a`
#[test]
fn foo() { fn foo() {
use crate::b; //~ ERROR unused import: `crate::b` a();
use crate::b;
} }
} }
mod fastest_search { mod fastest_search {
use super::a; //~ ERROR unused import: `super::a` use super::a; //~ ERROR unused import: `super::a`
#[test]
fn foo() { fn foo() {
use crate::b; //~ ERROR unused import: `crate::b` a();
use crate::b;
}
}
#[cfg(test)]
mod test_has_attr {
use super::a;
#[test]
fn foo() {
a();
use crate::b;
} }
} }

View file

@ -22,114 +22,42 @@ help: consider adding a `#[cfg(test)]` to the containing module
LL | mod test { LL | mod test {
| ^^^^^^^^ | ^^^^^^^^
error: unused import: `crate::b`
--> $DIR/unused-imports-in-test-module.rs:12:13
|
LL | use crate::b;
| ^^^^^^^^
|
help: consider adding a `#[cfg(test)]` to the containing module
--> $DIR/unused-imports-in-test-module.rs:8:1
|
LL | mod test {
| ^^^^^^^^
error: unused import: `super::a` error: unused import: `super::a`
--> $DIR/unused-imports-in-test-module.rs:17:9 --> $DIR/unused-imports-in-test-module.rs:19:9
| |
LL | use super::a; LL | use super::a;
| ^^^^^^^^ | ^^^^^^^^
| |
help: consider adding a `#[cfg(test)]` to the containing module help: consider adding a `#[cfg(test)]` to the containing module
--> $DIR/unused-imports-in-test-module.rs:16:1 --> $DIR/unused-imports-in-test-module.rs:18:1
|
LL | mod tests {
| ^^^^^^^^^
error: unused import: `crate::b`
--> $DIR/unused-imports-in-test-module.rs:20:13
|
LL | use crate::b;
| ^^^^^^^^
|
help: consider adding a `#[cfg(test)]` to the containing module
--> $DIR/unused-imports-in-test-module.rs:16:1
| |
LL | mod tests { LL | mod tests {
| ^^^^^^^^^ | ^^^^^^^^^
error: unused import: `super::a` error: unused import: `super::a`
--> $DIR/unused-imports-in-test-module.rs:25:9 --> $DIR/unused-imports-in-test-module.rs:29:9
| |
LL | use super::a; LL | use super::a;
| ^^^^^^^^ | ^^^^^^^^
| |
help: consider adding a `#[cfg(test)]` to the containing module help: consider adding a `#[cfg(test)]` to the containing module
--> $DIR/unused-imports-in-test-module.rs:24:1 --> $DIR/unused-imports-in-test-module.rs:28:1
|
LL | mod test_a {
| ^^^^^^^^^^
error: unused import: `crate::b`
--> $DIR/unused-imports-in-test-module.rs:28:13
|
LL | use crate::b;
| ^^^^^^^^
|
help: consider adding a `#[cfg(test)]` to the containing module
--> $DIR/unused-imports-in-test-module.rs:24:1
| |
LL | mod test_a { LL | mod test_a {
| ^^^^^^^^^^ | ^^^^^^^^^^
error: unused import: `super::a` error: unused import: `super::a`
--> $DIR/unused-imports-in-test-module.rs:33:9 --> $DIR/unused-imports-in-test-module.rs:39:9
| |
LL | use super::a; LL | use super::a;
| ^^^^^^^^ | ^^^^^^^^
| |
help: consider adding a `#[cfg(test)]` to the containing module help: consider adding a `#[cfg(test)]` to the containing module
--> $DIR/unused-imports-in-test-module.rs:32:1 --> $DIR/unused-imports-in-test-module.rs:38:1
| |
LL | mod a_test { LL | mod a_test {
| ^^^^^^^^^^ | ^^^^^^^^^^
error: unused import: `crate::b`
--> $DIR/unused-imports-in-test-module.rs:36:13
|
LL | use crate::b;
| ^^^^^^^^
|
help: consider adding a `#[cfg(test)]` to the containing module
--> $DIR/unused-imports-in-test-module.rs:32:1
|
LL | mod a_test {
| ^^^^^^^^^^
error: unused import: `super::a`
--> $DIR/unused-imports-in-test-module.rs:41:9
|
LL | use super::a;
| ^^^^^^^^
|
help: consider adding a `#[cfg(test)]` to the containing module
--> $DIR/unused-imports-in-test-module.rs:40:1
|
LL | mod tests_a {
| ^^^^^^^^^^^
error: unused import: `crate::b`
--> $DIR/unused-imports-in-test-module.rs:44:13
|
LL | use crate::b;
| ^^^^^^^^
|
help: consider adding a `#[cfg(test)]` to the containing module
--> $DIR/unused-imports-in-test-module.rs:40:1
|
LL | mod tests_a {
| ^^^^^^^^^^^
error: unused import: `super::a` error: unused import: `super::a`
--> $DIR/unused-imports-in-test-module.rs:49:9 --> $DIR/unused-imports-in-test-module.rs:49:9
| |
@ -139,32 +67,26 @@ LL | use super::a;
help: consider adding a `#[cfg(test)]` to the containing module help: consider adding a `#[cfg(test)]` to the containing module
--> $DIR/unused-imports-in-test-module.rs:48:1 --> $DIR/unused-imports-in-test-module.rs:48:1
| |
LL | mod a_tests { LL | mod tests_a {
| ^^^^^^^^^^^ | ^^^^^^^^^^^
error: unused import: `crate::b` error: unused import: `super::a`
--> $DIR/unused-imports-in-test-module.rs:52:13 --> $DIR/unused-imports-in-test-module.rs:59:9
| |
LL | use crate::b; LL | use super::a;
| ^^^^^^^^ | ^^^^^^^^
| |
help: consider adding a `#[cfg(test)]` to the containing module help: consider adding a `#[cfg(test)]` to the containing module
--> $DIR/unused-imports-in-test-module.rs:48:1 --> $DIR/unused-imports-in-test-module.rs:58:1
| |
LL | mod a_tests { LL | mod a_tests {
| ^^^^^^^^^^^ | ^^^^^^^^^^^
error: unused import: `super::a` error: unused import: `super::a`
--> $DIR/unused-imports-in-test-module.rs:57:9 --> $DIR/unused-imports-in-test-module.rs:69:9
| |
LL | use super::a; LL | use super::a;
| ^^^^^^^^ | ^^^^^^^^
error: unused import: `crate::b` error: aborting due to 8 previous errors
--> $DIR/unused-imports-in-test-module.rs:60:13
|
LL | use crate::b;
| ^^^^^^^^
error: aborting due to 15 previous errors

View file

@ -1,6 +1,5 @@
struct Bug<A = [(); (let a = (), 1).1]> { struct Bug<A = [(); (let a = (), 1).1]> {
//~^ `let` expressions are not supported here //~^ `let` expressions are not supported here
//~| `let` expressions in this position are unstable [E0658]
//~| expected expression, found `let` statement //~| expected expression, found `let` statement
a: A a: A
} }

View file

@ -12,15 +12,5 @@ LL | struct Bug<A = [(); (let a = (), 1).1]> {
| |
= note: only supported directly in conditions of `if` and `while` expressions = note: only supported directly in conditions of `if` and `while` expressions
error[E0658]: `let` expressions in this position are unstable error: aborting due to 2 previous errors
--> $DIR/issue-92893.rs:1:22
|
LL | struct Bug<A = [(); (let a = (), 1).1]> {
| ^^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0658`.

View file

@ -4,7 +4,6 @@
// See `mir_drop_order.rs` for more information // See `mir_drop_order.rs` for more information
#![feature(let_chains)]
#![allow(irrefutable_let_patterns)] #![allow(irrefutable_let_patterns)]
use std::cell::RefCell; use std::cell::RefCell;

View file

@ -8,47 +8,33 @@ fn _if_let_guard() {
//~^ ERROR `if let` guards are experimental //~^ ERROR `if let` guards are experimental
() if (let 0 = 1) => {} () if (let 0 = 1) => {}
//~^ ERROR `let` expressions in this position are unstable //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
() if (((let 0 = 1))) => {} () if (((let 0 = 1))) => {}
//~^ ERROR `let` expressions in this position are unstable //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
() if true && let 0 = 1 => {} () if true && let 0 = 1 => {}
//~^ ERROR `if let` guards are experimental //~^ ERROR `if let` guards are experimental
//~| ERROR `let` expressions in this position are unstable
() if let 0 = 1 && true => {} () if let 0 = 1 && true => {}
//~^ ERROR `if let` guards are experimental //~^ ERROR `if let` guards are experimental
//~| ERROR `let` expressions in this position are unstable
() if (let 0 = 1) && true => {} () if (let 0 = 1) && true => {}
//~^ ERROR `let` expressions in this position are unstable //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
() if true && (let 0 = 1) => {} () if true && (let 0 = 1) => {}
//~^ ERROR `let` expressions in this position are unstable //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
() if (let 0 = 1) && (let 0 = 1) => {} () if (let 0 = 1) && (let 0 = 1) => {}
//~^ ERROR `let` expressions in this position are unstable //~^ ERROR expected expression, found `let` statement
//~| ERROR `let` expressions in this position are unstable
//~| ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement //~| ERROR expected expression, found `let` statement
() if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {} () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
//~^ ERROR `if let` guards are experimental //~^ ERROR `if let` guards are experimental
//~| ERROR `let` expressions in this position are unstable
//~| ERROR `let` expressions in this position are unstable
//~| ERROR `let` expressions in this position are unstable
//~| ERROR `let` expressions in this position are unstable
//~| ERROR `let` expressions in this position are unstable
//~| ERROR expected expression, found `let` statement //~| ERROR expected expression, found `let` statement
() if let Range { start: _, end: _ } = (true..true) && false => {} () if let Range { start: _, end: _ } = (true..true) && false => {}
//~^ ERROR `if let` guards are experimental //~^ ERROR `if let` guards are experimental
//~| ERROR `let` expressions in this position are unstable
_ => {} _ => {}
} }
@ -64,11 +50,9 @@ fn _macros() {
} }
} }
use_expr!((let 0 = 1 && 0 == 0)); use_expr!((let 0 = 1 && 0 == 0));
//~^ ERROR `let` expressions in this position are unstable //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
use_expr!((let 0 = 1)); use_expr!((let 0 = 1));
//~^ ERROR `let` expressions in this position are unstable //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
match () { match () {
#[cfg(FALSE)] #[cfg(FALSE)]
() if let 0 = 1 => {} () if let 0 = 1 => {}

View file

@ -5,55 +5,55 @@ LL | () if (let 0 = 1) => {}
| ^^^ | ^^^
error: expected expression, found `let` statement error: expected expression, found `let` statement
--> $DIR/feature-gate.rs:14:18 --> $DIR/feature-gate.rs:13:18
| |
LL | () if (((let 0 = 1))) => {} LL | () if (((let 0 = 1))) => {}
| ^^^ | ^^^
error: expected expression, found `let` statement error: expected expression, found `let` statement
--> $DIR/feature-gate.rs:26:16 --> $DIR/feature-gate.rs:22:16
| |
LL | () if (let 0 = 1) && true => {} LL | () if (let 0 = 1) && true => {}
| ^^^ | ^^^
error: expected expression, found `let` statement error: expected expression, found `let` statement
--> $DIR/feature-gate.rs:30:24 --> $DIR/feature-gate.rs:25:24
| |
LL | () if true && (let 0 = 1) => {} LL | () if true && (let 0 = 1) => {}
| ^^^ | ^^^
error: expected expression, found `let` statement error: expected expression, found `let` statement
--> $DIR/feature-gate.rs:34:16 --> $DIR/feature-gate.rs:28:16
| |
LL | () if (let 0 = 1) && (let 0 = 1) => {} LL | () if (let 0 = 1) && (let 0 = 1) => {}
| ^^^ | ^^^
error: expected expression, found `let` statement error: expected expression, found `let` statement
--> $DIR/feature-gate.rs:34:31 --> $DIR/feature-gate.rs:28:31
| |
LL | () if (let 0 = 1) && (let 0 = 1) => {} LL | () if (let 0 = 1) && (let 0 = 1) => {}
| ^^^ | ^^^
error: expected expression, found `let` statement error: expected expression, found `let` statement
--> $DIR/feature-gate.rs:40:42 --> $DIR/feature-gate.rs:32:42
| |
LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {} LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
| ^^^ | ^^^
error: expected expression, found `let` statement error: expected expression, found `let` statement
--> $DIR/feature-gate.rs:66:16 --> $DIR/feature-gate.rs:52:16
| |
LL | use_expr!((let 0 = 1 && 0 == 0)); LL | use_expr!((let 0 = 1 && 0 == 0));
| ^^^ | ^^^
error: expected expression, found `let` statement error: expected expression, found `let` statement
--> $DIR/feature-gate.rs:69:16 --> $DIR/feature-gate.rs:54:16
| |
LL | use_expr!((let 0 = 1)); LL | use_expr!((let 0 = 1));
| ^^^ | ^^^
error: no rules expected the token `let` error: no rules expected the token `let`
--> $DIR/feature-gate.rs:78:15 --> $DIR/feature-gate.rs:62:15
| |
LL | macro_rules! use_expr { LL | macro_rules! use_expr {
| --------------------- when calling this macro | --------------------- when calling this macro
@ -72,7 +72,7 @@ LL | () if let 0 = 1 => {}
= help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>` = help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`
error[E0658]: `if let` guards are experimental error[E0658]: `if let` guards are experimental
--> $DIR/feature-gate.rs:18:12 --> $DIR/feature-gate.rs:16:12
| |
LL | () if true && let 0 = 1 => {} LL | () if true && let 0 = 1 => {}
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
@ -82,7 +82,7 @@ LL | () if true && let 0 = 1 => {}
= help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>` = help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`
error[E0658]: `if let` guards are experimental error[E0658]: `if let` guards are experimental
--> $DIR/feature-gate.rs:22:12 --> $DIR/feature-gate.rs:19:12
| |
LL | () if let 0 = 1 && true => {} LL | () if let 0 = 1 && true => {}
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
@ -92,7 +92,7 @@ LL | () if let 0 = 1 && true => {}
= help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>` = help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`
error[E0658]: `if let` guards are experimental error[E0658]: `if let` guards are experimental
--> $DIR/feature-gate.rs:40:12 --> $DIR/feature-gate.rs:32:12
| |
LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {} LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -102,7 +102,7 @@ LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 =
= help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>` = help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`
error[E0658]: `if let` guards are experimental error[E0658]: `if let` guards are experimental
--> $DIR/feature-gate.rs:49:12 --> $DIR/feature-gate.rs:36:12
| |
LL | () if let Range { start: _, end: _ } = (true..true) && false => {} LL | () if let Range { start: _, end: _ } = (true..true) && false => {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -112,7 +112,7 @@ LL | () if let Range { start: _, end: _ } = (true..true) && false => {}
= help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>` = help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`
error[E0658]: `if let` guards are experimental error[E0658]: `if let` guards are experimental
--> $DIR/feature-gate.rs:74:12 --> $DIR/feature-gate.rs:58:12
| |
LL | () if let 0 = 1 => {} LL | () if let 0 = 1 => {}
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
@ -121,150 +121,6 @@ LL | () if let 0 = 1 => {}
= help: add `#![feature(if_let_guard)]` to the crate attributes to enable = help: add `#![feature(if_let_guard)]` to the crate attributes to enable
= help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>` = help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`
error[E0658]: `let` expressions in this position are unstable error: aborting due to 16 previous errors
--> $DIR/feature-gate.rs:10:16
|
LL | () if (let 0 = 1) => {}
| ^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
--> $DIR/feature-gate.rs:14:18
|
LL | () if (((let 0 = 1))) => {}
| ^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
--> $DIR/feature-gate.rs:18:23
|
LL | () if true && let 0 = 1 => {}
| ^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
--> $DIR/feature-gate.rs:22:15
|
LL | () if let 0 = 1 && true => {}
| ^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
--> $DIR/feature-gate.rs:26:16
|
LL | () if (let 0 = 1) && true => {}
| ^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
--> $DIR/feature-gate.rs:30:24
|
LL | () if true && (let 0 = 1) => {}
| ^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
--> $DIR/feature-gate.rs:34:16
|
LL | () if (let 0 = 1) && (let 0 = 1) => {}
| ^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
--> $DIR/feature-gate.rs:34:31
|
LL | () if (let 0 = 1) && (let 0 = 1) => {}
| ^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
--> $DIR/feature-gate.rs:40:15
|
LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
| ^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
--> $DIR/feature-gate.rs:40:28
|
LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
| ^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
--> $DIR/feature-gate.rs:40:42
|
LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
| ^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
--> $DIR/feature-gate.rs:40:55
|
LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
| ^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
--> $DIR/feature-gate.rs:40:68
|
LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
| ^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
--> $DIR/feature-gate.rs:49:15
|
LL | () if let Range { start: _, end: _ } = (true..true) && false => {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
--> $DIR/feature-gate.rs:66:16
|
LL | use_expr!((let 0 = 1 && 0 == 0));
| ^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
--> $DIR/feature-gate.rs:69:16
|
LL | use_expr!((let 0 = 1));
| ^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error: aborting due to 32 previous errors
For more information about this error, try `rustc --explain E0658`. For more information about this error, try `rustc --explain E0658`.

View file

@ -0,0 +1,30 @@
// check-pass
#![allow(irrefutable_let_patterns)]
use std::ops::Range;
fn _if() {
if let 0 = 1 {}
if true && let 0 = 1 {}
if let 0 = 1 && true {}
if let Range { start: _, end: _ } = (true..true) && false {}
if let 1 = 1 && let true = { true } && false {
}
}
fn _while() {
while let 0 = 1 {}
while true && let 0 = 1 {}
while let 0 = 1 && true {}
while let Range { start: _, end: _ } = (true..true) && false {}
}
fn main() {}

View file

@ -1,6 +1,5 @@
// run-pass // run-pass
#![feature(let_chains)]
#![allow(irrefutable_let_patterns)] #![allow(irrefutable_let_patterns)]
fn main() { fn main() {

View file

@ -17,8 +17,6 @@
// //
// To that end, we check some positions which is not part of the language above. // To that end, we check some positions which is not part of the language above.
#![feature(let_chains)] // Avoid inflating `.stderr` with overzealous gates in this test.
#![allow(irrefutable_let_patterns)] #![allow(irrefutable_let_patterns)]
use std::ops::Range; use std::ops::Range;
@ -100,6 +98,12 @@ fn _macros() {
//~^ ERROR `let` expressions are not supported here //~^ ERROR `let` expressions are not supported here
//~| ERROR `let` expressions are not supported here //~| ERROR `let` expressions are not supported here
//~| ERROR expected expression, found `let` statement //~| ERROR expected expression, found `let` statement
use_expr!(true && let 0 = 1);
//~^ ERROR expected expression, found `let` statement
macro_rules! noop_expr { ($e:expr) => {}; }
noop_expr!((let 0 = 1));
//~^ ERROR expected expression, found `let` statement
} }
fn nested_within_if_expr() { fn nested_within_if_expr() {
@ -467,4 +471,7 @@ fn with_parenthesis() {
([1, 2, 3][let _ = ()]) ([1, 2, 3][let _ = ()])
//~^ ERROR expected expression, found `let` statement //~^ ERROR expected expression, found `let` statement
} }
#[cfg(FALSE)] (let 0 = 1);
//~^ ERROR expected expression, found `let` statement
} }

View file

@ -1,4 +1,4 @@
#![feature(let_chains, let_else)] #![feature(let_else)]
fn main() { fn main() {
let opt = Some(1i32); let opt = Some(1i32);

View file

@ -1,62 +0,0 @@
// gate-test-let_chains
// Here we test feature gating for ´let_chains`.
// See `disallowed-positions.rs` for the grammar
// defining the language for gated allowed positions.
#![allow(irrefutable_let_patterns)]
use std::ops::Range;
fn _if() {
if let 0 = 1 {} // Stable!
if true && let 0 = 1 {}
//~^ ERROR `let` expressions in this position are unstable [E0658]
if let 0 = 1 && true {}
//~^ ERROR `let` expressions in this position are unstable [E0658]
if let Range { start: _, end: _ } = (true..true) && false {}
//~^ ERROR `let` expressions in this position are unstable [E0658]
if let 1 = 1 && let true = { true } && false {
//~^ ERROR `let` expressions in this position are unstable [E0658]
//~| ERROR `let` expressions in this position are unstable [E0658]
}
}
fn _while() {
while let 0 = 1 {} // Stable!
while true && let 0 = 1 {}
//~^ ERROR `let` expressions in this position are unstable [E0658]
while let 0 = 1 && true {}
//~^ ERROR `let` expressions in this position are unstable [E0658]
while let Range { start: _, end: _ } = (true..true) && false {}
//~^ ERROR `let` expressions in this position are unstable [E0658]
}
fn _macros() {
macro_rules! noop_expr { ($e:expr) => {}; }
noop_expr!((let 0 = 1));
//~^ ERROR `let` expressions in this position are unstable [E0658]
//~| ERROR expected expression, found `let` statement
macro_rules! use_expr {
($e:expr) => {
if $e {}
while $e {}
}
}
#[cfg(FALSE)] (let 0 = 1);
//~^ ERROR `let` expressions in this position are unstable [E0658]
//~| ERROR expected expression, found `let` statement
use_expr!(let 0 = 1);
//~^ ERROR no rules expected the token `let`
}
fn main() {}

View file

@ -1,114 +0,0 @@
error: expected expression, found `let` statement
--> $DIR/feature-gate.rs:55:20
|
LL | #[cfg(FALSE)] (let 0 = 1);
| ^^^
error: expected expression, found `let` statement
--> $DIR/feature-gate.rs:45:17
|
LL | noop_expr!((let 0 = 1));
| ^^^
error: no rules expected the token `let`
--> $DIR/feature-gate.rs:58:15
|
LL | macro_rules! use_expr {
| --------------------- when calling this macro
...
LL | use_expr!(let 0 = 1);
| ^^^ no rules expected this token in macro call
error[E0658]: `let` expressions in this position are unstable
--> $DIR/feature-gate.rs:14:16
|
LL | if true && let 0 = 1 {}
| ^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
--> $DIR/feature-gate.rs:17:8
|
LL | if let 0 = 1 && true {}
| ^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
--> $DIR/feature-gate.rs:20:8
|
LL | if let Range { start: _, end: _ } = (true..true) && false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
--> $DIR/feature-gate.rs:23:8
|
LL | if let 1 = 1 && let true = { true } && false {
| ^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
--> $DIR/feature-gate.rs:23:21
|
LL | if let 1 = 1 && let true = { true } && false {
| ^^^^^^^^^^^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
--> $DIR/feature-gate.rs:32:19
|
LL | while true && let 0 = 1 {}
| ^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
--> $DIR/feature-gate.rs:35:11
|
LL | while let 0 = 1 && true {}
| ^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
--> $DIR/feature-gate.rs:38:11
|
LL | while let Range { start: _, end: _ } = (true..true) && false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
--> $DIR/feature-gate.rs:55:20
|
LL | #[cfg(FALSE)] (let 0 = 1);
| ^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
--> $DIR/feature-gate.rs:45:17
|
LL | noop_expr!((let 0 = 1));
| ^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error: aborting due to 13 previous errors
For more information about this error, try `rustc --explain E0658`.

View file

@ -1,5 +1,3 @@
#![feature(let_chains)]
fn main() { fn main() {
let _opt = Some(1i32); let _opt = Some(1i32);

View file

@ -1,35 +1,35 @@
error: expected expression, found `let` statement error: expected expression, found `let` statement
--> $DIR/invalid-let-in-a-valid-let-context.rs:8:19 --> $DIR/invalid-let-in-a-valid-let-context.rs:6:19
| |
LL | let _ = &&let Some(x) = Some(42); LL | let _ = &&let Some(x) = Some(42);
| ^^^ | ^^^
error: expected expression, found `let` statement error: expected expression, found `let` statement
--> $DIR/invalid-let-in-a-valid-let-context.rs:13:47 --> $DIR/invalid-let-in-a-valid-let-context.rs:11:47
| |
LL | if let Some(elem) = _opt && [1, 2, 3][let _ = &&let Some(x) = Some(42)] = 1 { LL | if let Some(elem) = _opt && [1, 2, 3][let _ = &&let Some(x) = Some(42)] = 1 {
| ^^^ | ^^^
error: expected expression, found `let` statement error: expected expression, found `let` statement
--> $DIR/invalid-let-in-a-valid-let-context.rs:13:57 --> $DIR/invalid-let-in-a-valid-let-context.rs:11:57
| |
LL | if let Some(elem) = _opt && [1, 2, 3][let _ = &&let Some(x) = Some(42)] = 1 { LL | if let Some(elem) = _opt && [1, 2, 3][let _ = &&let Some(x) = Some(42)] = 1 {
| ^^^ | ^^^
error: expected expression, found `let` statement error: expected expression, found `let` statement
--> $DIR/invalid-let-in-a-valid-let-context.rs:23:23 --> $DIR/invalid-let-in-a-valid-let-context.rs:21:23
| |
LL | [1, 2, 3][let _ = ()]; LL | [1, 2, 3][let _ = ()];
| ^^^ | ^^^
error: expected expression, found `let` statement error: expected expression, found `let` statement
--> $DIR/invalid-let-in-a-valid-let-context.rs:32:47 --> $DIR/invalid-let-in-a-valid-let-context.rs:30:47
| |
LL | if let Some(elem) = _opt && [1, 2, 3][let _ = ()] = 1 { LL | if let Some(elem) = _opt && [1, 2, 3][let _ = ()] = 1 {
| ^^^ | ^^^
error: expected expression, found `let` statement error: expected expression, found `let` statement
--> $DIR/invalid-let-in-a-valid-let-context.rs:40:21 --> $DIR/invalid-let-in-a-valid-let-context.rs:38:21
| |
LL | let x = let y = 1; LL | let x = let y = 1;
| ^^^ | ^^^

View file

@ -1,7 +1,7 @@
// revisions: allowed disallowed // revisions: allowed disallowed
//[allowed] check-pass //[allowed] check-pass
#![feature(if_let_guard, let_chains)] #![feature(if_let_guard)]
#![cfg_attr(allowed, allow(irrefutable_let_patterns))] #![cfg_attr(allowed, allow(irrefutable_let_patterns))]
#![cfg_attr(disallowed, deny(irrefutable_let_patterns))] #![cfg_attr(disallowed, deny(irrefutable_let_patterns))]

View file

@ -1,7 +1,5 @@
// check-pass // check-pass
#![feature(let_chains)]
fn main() { fn main() {
let x = Some(vec!["test"]); let x = Some(vec!["test"]);

View file

@ -1,7 +1,5 @@
// check-pass // check-pass
#![feature(let_chains)]
fn main() { fn main() {
let opt = Some("foo bar"); let opt = Some("foo bar");

View file

@ -2,7 +2,6 @@ fn main() {
match true { match true {
_ if let true = true && true => {} _ if let true = true && true => {}
//~^ ERROR `if let` guards are //~^ ERROR `if let` guards are
//~| ERROR `let` expressions in this
_ => {} _ => {}
} }
} }

View file

@ -8,15 +8,6 @@ LL | _ if let true = true && true => {}
= help: add `#![feature(if_let_guard)]` to the crate attributes to enable = help: add `#![feature(if_let_guard)]` to the crate attributes to enable
= help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>` = help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`
error[E0658]: `let` expressions in this position are unstable error: aborting due to previous error
--> $DIR/issue-93150.rs:3:14
|
LL | _ if let true = true && true => {}
| ^^^^^^^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0658`. For more information about this error, try `rustc --explain E0658`.

View file

@ -1,6 +1,6 @@
// run-pass // run-pass
#![feature(if_let_guard, let_chains)] #![feature(if_let_guard)]
fn check_if_let(opt: Option<Option<Option<i32>>>, value: i32) -> bool { fn check_if_let(opt: Option<Option<Option<i32>>>, value: i32) -> bool {
if let Some(first) = opt if let Some(first) = opt

View file

@ -1,4 +1,4 @@
#![feature(let_chains)] #![cfg_attr(bootstrap, feature(let_chains))]
#![feature(let_else)] #![feature(let_else)]
#![feature(once_cell)] #![feature(once_cell)]
#![feature(rustc_private)] #![feature(rustc_private)]

View file

@ -4,7 +4,7 @@
#![feature(control_flow_enum)] #![feature(control_flow_enum)]
#![feature(drain_filter)] #![feature(drain_filter)]
#![feature(iter_intersperse)] #![feature(iter_intersperse)]
#![feature(let_chains)] #![cfg_attr(bootstrap, feature(let_chains))]
#![feature(let_else)] #![feature(let_else)]
#![feature(lint_reasons)] #![feature(lint_reasons)]
#![feature(never_type)] #![feature(never_type)]

View file

@ -1,7 +1,7 @@
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(control_flow_enum)] #![feature(control_flow_enum)]
#![feature(let_else)] #![feature(let_else)]
#![feature(let_chains)] #![cfg_attr(bootstrap, feature(let_chains))]
#![feature(lint_reasons)] #![feature(lint_reasons)]
#![feature(once_cell)] #![feature(once_cell)]
#![feature(rustc_private)] #![feature(rustc_private)]

View file

@ -1,5 +1,4 @@
// run-rustfix // run-rustfix
#![feature(let_chains)]
#![allow( #![allow(
unused, unused,
clippy::assign_op_pattern, clippy::assign_op_pattern,

View file

@ -1,5 +1,4 @@
// run-rustfix // run-rustfix
#![feature(let_chains)]
#![allow( #![allow(
unused, unused,
clippy::assign_op_pattern, clippy::assign_op_pattern,

View file

@ -1,5 +1,5 @@
error: unneeded late initialization error: unneeded late initialization
--> $DIR/needless_late_init.rs:23:5 --> $DIR/needless_late_init.rs:22:5
| |
LL | let a; LL | let a;
| ^^^^^^ created here | ^^^^^^ created here
@ -13,7 +13,7 @@ LL | let a = "zero";
| ~~~~~ | ~~~~~
error: unneeded late initialization error: unneeded late initialization
--> $DIR/needless_late_init.rs:26:5 --> $DIR/needless_late_init.rs:25:5
| |
LL | let b; LL | let b;
| ^^^^^^ created here | ^^^^^^ created here
@ -27,7 +27,7 @@ LL | let b = 1;
| ~~~~~ | ~~~~~
error: unneeded late initialization error: unneeded late initialization
--> $DIR/needless_late_init.rs:27:5 --> $DIR/needless_late_init.rs:26:5
| |
LL | let c; LL | let c;
| ^^^^^^ created here | ^^^^^^ created here
@ -41,7 +41,7 @@ LL | let c = 2;
| ~~~~~ | ~~~~~
error: unneeded late initialization error: unneeded late initialization
--> $DIR/needless_late_init.rs:31:5 --> $DIR/needless_late_init.rs:30:5
| |
LL | let d: usize; LL | let d: usize;
| ^^^^^^^^^^^^^ created here | ^^^^^^^^^^^^^ created here
@ -54,7 +54,7 @@ LL | let d: usize = 1;
| ~~~~~~~~~~~~ | ~~~~~~~~~~~~
error: unneeded late initialization error: unneeded late initialization
--> $DIR/needless_late_init.rs:34:5 --> $DIR/needless_late_init.rs:33:5
| |
LL | let e; LL | let e;
| ^^^^^^ created here | ^^^^^^ created here
@ -67,7 +67,7 @@ LL | let e = format!("{}", d);
| ~~~~~ | ~~~~~
error: unneeded late initialization error: unneeded late initialization
--> $DIR/needless_late_init.rs:39:5 --> $DIR/needless_late_init.rs:38:5
| |
LL | let a; LL | let a;
| ^^^^^^ | ^^^^^^
@ -88,7 +88,7 @@ LL | };
| + | +
error: unneeded late initialization error: unneeded late initialization
--> $DIR/needless_late_init.rs:48:5 --> $DIR/needless_late_init.rs:47:5
| |
LL | let b; LL | let b;
| ^^^^^^ | ^^^^^^
@ -109,7 +109,7 @@ LL | };
| + | +
error: unneeded late initialization error: unneeded late initialization
--> $DIR/needless_late_init.rs:55:5 --> $DIR/needless_late_init.rs:54:5
| |
LL | let d; LL | let d;
| ^^^^^^ | ^^^^^^
@ -130,7 +130,7 @@ LL | };
| + | +
error: unneeded late initialization error: unneeded late initialization
--> $DIR/needless_late_init.rs:63:5 --> $DIR/needless_late_init.rs:62:5
| |
LL | let e; LL | let e;
| ^^^^^^ | ^^^^^^
@ -151,7 +151,7 @@ LL | };
| + | +
error: unneeded late initialization error: unneeded late initialization
--> $DIR/needless_late_init.rs:70:5 --> $DIR/needless_late_init.rs:69:5
| |
LL | let f; LL | let f;
| ^^^^^^ | ^^^^^^
@ -167,7 +167,7 @@ LL + 1 => "three",
| |
error: unneeded late initialization error: unneeded late initialization
--> $DIR/needless_late_init.rs:76:5 --> $DIR/needless_late_init.rs:75:5
| |
LL | let g: usize; LL | let g: usize;
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
@ -187,7 +187,7 @@ LL | };
| + | +
error: unneeded late initialization error: unneeded late initialization
--> $DIR/needless_late_init.rs:84:5 --> $DIR/needless_late_init.rs:83:5
| |
LL | let x; LL | let x;
| ^^^^^^ created here | ^^^^^^ created here
@ -201,7 +201,7 @@ LL | let x = 1;
| ~~~~~ | ~~~~~
error: unneeded late initialization error: unneeded late initialization
--> $DIR/needless_late_init.rs:88:5 --> $DIR/needless_late_init.rs:87:5
| |
LL | let x; LL | let x;
| ^^^^^^ created here | ^^^^^^ created here
@ -215,7 +215,7 @@ LL | let x = SignificantDrop;
| ~~~~~ | ~~~~~
error: unneeded late initialization error: unneeded late initialization
--> $DIR/needless_late_init.rs:92:5 --> $DIR/needless_late_init.rs:91:5
| |
LL | let x; LL | let x;
| ^^^^^^ created here | ^^^^^^ created here
@ -229,7 +229,7 @@ LL | let x = SignificantDrop;
| ~~~~~ | ~~~~~
error: unneeded late initialization error: unneeded late initialization
--> $DIR/needless_late_init.rs:111:5 --> $DIR/needless_late_init.rs:110:5
| |
LL | let a; LL | let a;
| ^^^^^^ | ^^^^^^
@ -250,7 +250,7 @@ LL | };
| + | +
error: unneeded late initialization error: unneeded late initialization
--> $DIR/needless_late_init.rs:128:5 --> $DIR/needless_late_init.rs:127:5
| |
LL | let a; LL | let a;
| ^^^^^^ | ^^^^^^