Auto merge of #91959 - matthiaskrgr:rollup-rhajuvw, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #90521 (Stabilize `destructuring_assignment`)
 - #91479 (Add `[T]::as_simd(_mut)`)
 - #91584 (Improve code for rustdoc-gui tester)
 - #91886 (core: minor `Option` doc correction)
 - #91888 (Handle unordered const/ty generics for object lifetime defaults)
 - #91905 (Fix source code page sidebar on mobile)
 - #91906 (Removed `in_band_lifetimes` from `library\proc_macro`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2021-12-15 09:31:59 +00:00
commit 3ee016ae4d
63 changed files with 272 additions and 424 deletions

View File

@ -9,7 +9,6 @@ use rustc_errors::struct_span_err;
use rustc_hir as hir;
use rustc_hir::def::Res;
use rustc_hir::definitions::DefPathData;
use rustc_session::parse::feature_err;
use rustc_span::hygiene::ExpnId;
use rustc_span::source_map::{respan, DesugaringKind, Span, Spanned};
use rustc_span::symbol::{sym, Ident, Symbol};
@ -962,24 +961,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
self.lower_span(eq_sign_span),
);
}
if !self.sess.features_untracked().destructuring_assignment {
let mut err = feature_err(
&self.sess.parse_sess,
sym::destructuring_assignment,
eq_sign_span,
"destructuring assignments are unstable",
);
err.span_label(lhs.span, "cannot assign to this expression");
if self.is_in_loop_condition {
err.span_suggestion_verbose(
lhs.span.shrink_to_lo(),
"you might have meant to use pattern destructuring",
"let ".to_string(),
rustc_errors::Applicability::MachineApplicable,
);
}
err.emit();
}
let mut assignments = vec![];

View File

@ -52,7 +52,7 @@ use rustc_hir::def::{DefKind, Namespace, PartialRes, PerNS, Res};
use rustc_hir::def_id::{DefId, DefPathHash, LocalDefId, CRATE_DEF_ID};
use rustc_hir::definitions::{DefKey, DefPathData, Definitions};
use rustc_hir::intravisit;
use rustc_hir::{ConstArg, GenericArg, InferKind, ParamName};
use rustc_hir::{ConstArg, GenericArg, ParamName};
use rustc_index::vec::{Idx, IndexVec};
use rustc_query_system::ich::StableHashingContext;
use rustc_session::lint::builtin::BARE_TRAIT_OBJECTS;
@ -1113,7 +1113,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
return GenericArg::Infer(hir::InferArg {
hir_id: self.lower_node_id(ty.id),
span: self.lower_span(ty.span),
kind: InferKind::Type,
});
}
// We parse const arguments as path types as we cannot distinguish them during

View File

@ -724,11 +724,6 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session) {
gate_all!(half_open_range_patterns, "half-open range patterns are unstable");
gate_all!(inline_const, "inline-const is experimental");
gate_all!(inline_const_pat, "inline-const in pattern position is experimental");
if sess.parse_sess.span_diagnostic.err_count() == 0 {
// Errors for `destructuring_assignment` can get quite noisy, especially where `_` is
// involved, so we only emit errors where there are no other parsing errors.
gate_all!(destructuring_assignment, "destructuring assignments are unstable");
}
// All uses of `gate_all!` below this point were added in #65742,
// and subsequently disabled (with the non-early gating readded).

View File

@ -1,6 +1,6 @@
#![feature(crate_visibility_modifier)]
#![feature(decl_macro)]
#![feature(destructuring_assignment)]
#![cfg_attr(bootstrap, feature(destructuring_assignment))]
#![feature(if_let_guard)]
#![feature(let_else)]
#![feature(proc_macro_diagnostic)]

View File

@ -114,6 +114,8 @@ declare_features! (
(accepted, default_type_params, "1.0.0", None, None),
/// Allows `#[deprecated]` attribute.
(accepted, deprecated, "1.9.0", Some(29935), None),
/// Allows the use of destructuring assignments.
(accepted, destructuring_assignment, "1.59.0", Some(71126), None),
/// Allows `#[doc(alias = "...")]`.
(accepted, doc_alias, "1.48.0", Some(50146), None),
/// Allows `..` in tuple (struct) patterns.

View File

@ -356,8 +356,6 @@ declare_features! (
(active, default_type_parameter_fallback, "1.3.0", Some(27336), None),
/// Allows `#[derive(Default)]` and `#[default]` on enums.
(active, derive_default_enum, "1.56.0", Some(86985), None),
/// Allows the use of destructuring assignments.
(active, destructuring_assignment, "1.49.0", Some(71126), None),
/// Tells rustdoc to automatically generate `#[doc(cfg(...))]`.
(active, doc_auto_cfg, "1.58.0", Some(43781), None),
/// Allows `#[doc(cfg(...))]`.

View File

@ -255,23 +255,9 @@ pub struct ConstArg {
pub span: Span,
}
#[derive(Copy, Clone, Encodable, Debug, HashStable_Generic)]
pub enum InferKind {
Const,
Type,
}
impl InferKind {
#[inline]
pub fn is_type(self) -> bool {
matches!(self, InferKind::Type)
}
}
#[derive(Encodable, Debug, HashStable_Generic)]
pub struct InferArg {
pub hir_id: HirId,
pub kind: InferKind,
pub span: Span,
}

View File

@ -1297,7 +1297,6 @@ impl<'a> Parser<'a> {
} else if self.eat_keyword(kw::Let) {
self.parse_let_expr(attrs)
} else if self.eat_keyword(kw::Underscore) {
self.sess.gated_spans.gate(sym::destructuring_assignment, self.prev_token.span);
Ok(self.mk_expr(self.prev_token.span, ExprKind::Underscore, attrs))
} else if !self.unclosed_delims.is_empty() && self.check(&token::Semi) {
// Don't complain about bare semicolons after unclosed braces
@ -2620,7 +2619,6 @@ impl<'a> Parser<'a> {
let exp_span = self.prev_token.span;
// We permit `.. }` on the left-hand side of a destructuring assignment.
if self.check(&token::CloseDelim(close_delim)) {
self.sess.gated_spans.gate(sym::destructuring_assignment, self.prev_token.span);
base = ast::StructRest::Rest(self.prev_token.span.shrink_to_hi());
break;
}

View File

@ -2541,8 +2541,8 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
GenericParamDefKind::Type { object_lifetime_default, .. } => {
Some(object_lifetime_default)
}
GenericParamDefKind::Lifetime
| GenericParamDefKind::Const { .. } => None,
GenericParamDefKind::Const { .. } => Some(Set1::Empty),
GenericParamDefKind::Lifetime => None,
})
.collect()
})
@ -2569,12 +2569,11 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
}
GenericArg::Const(ct) => {
self.visit_anon_const(&ct.value);
i += 1;
}
GenericArg::Infer(inf) => {
self.visit_id(inf.hir_id);
if inf.kind.is_type() {
i += 1;
}
i += 1;
}
}
}

View File

@ -878,11 +878,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
"let ".to_string(),
Applicability::MachineApplicable,
);
if !self.sess().features_untracked().destructuring_assignment {
// We already emit an E0658 with a suggestion for `while let`, this is
// redundant output.
err.delay_as_bug();
}
break;
}
hir::Node::Item(_)

View File

@ -136,7 +136,7 @@
#![feature(cfg_target_has_atomic)]
#![feature(const_fn_trait_bound)]
#![feature(const_trait_impl)]
#![feature(destructuring_assignment)]
#![cfg_attr(bootstrap, feature(destructuring_assignment))]
#![feature(dropck_eyepatch)]
#![feature(exclusive_range_pattern)]
#![feature(fundamental)]

View File

@ -512,11 +512,11 @@ use crate::{
#[rustc_diagnostic_item = "Option"]
#[stable(feature = "rust1", since = "1.0.0")]
pub enum Option<T> {
/// No value
/// No value.
#[lang = "None"]
#[stable(feature = "rust1", since = "1.0.0")]
None,
/// Some value `T`
/// Some value of type `T`.
#[lang = "Some"]
#[stable(feature = "rust1", since = "1.0.0")]
Some(#[stable(feature = "rust1", since = "1.0.0")] T),

View File

@ -16,6 +16,8 @@ use crate::option::Option::{None, Some};
use crate::ptr;
use crate::result::Result;
use crate::result::Result::{Err, Ok};
#[cfg(not(miri))] // Miri does not support all SIMD intrinsics
use crate::simd::{self, Simd};
use crate::slice;
#[unstable(
@ -3512,6 +3514,123 @@ impl<T> [T] {
}
}
/// Split a slice into a prefix, a middle of aligned SIMD types, and a suffix.
///
/// This is a safe wrapper around [`slice::align_to`], so has the same weak
/// postconditions as that method. You're only assured that
/// `self.len() == prefix.len() + middle.len() * LANES + suffix.len()`.
///
/// Notably, all of the following are possible:
/// - `prefix.len() >= LANES`.
/// - `middle.is_empty()` despite `self.len() >= 3 * LANES`.
/// - `suffix.len() >= LANES`.
///
/// That said, this is a safe method, so if you're only writing safe code,
/// then this can at most cause incorrect logic, not unsoundness.
///
/// # Panics
///
/// This will panic if the size of the SIMD type is different from
/// `LANES` times that of the scalar.
///
/// At the time of writing, the trait restrictions on `Simd<T, LANES>` keeps
/// that from ever happening, as only power-of-two numbers of lanes are
/// supported. It's possible that, in the future, those restrictions might
/// be lifted in a way that would make it possible to see panics from this
/// method for something like `LANES == 3`.
///
/// # Examples
///
/// ```
/// #![feature(portable_simd)]
///
/// let short = &[1, 2, 3];
/// let (prefix, middle, suffix) = short.as_simd::<4>();
/// assert_eq!(middle, []); // Not enough elements for anything in the middle
///
/// // They might be split in any possible way between prefix and suffix
/// let it = prefix.iter().chain(suffix).copied();
/// assert_eq!(it.collect::<Vec<_>>(), vec![1, 2, 3]);
///
/// fn basic_simd_sum(x: &[f32]) -> f32 {
/// use std::ops::Add;
/// use std::simd::f32x4;
/// let (prefix, middle, suffix) = x.as_simd();
/// let sums = f32x4::from_array([
/// prefix.iter().copied().sum(),
/// 0.0,
/// 0.0,
/// suffix.iter().copied().sum(),
/// ]);
/// let sums = middle.iter().copied().fold(sums, f32x4::add);
/// sums.horizontal_sum()
/// }
///
/// let numbers: Vec<f32> = (1..101).map(|x| x as _).collect();
/// assert_eq!(basic_simd_sum(&numbers[1..99]), 4949.0);
/// ```
#[unstable(feature = "portable_simd", issue = "86656")]
#[cfg(not(miri))] // Miri does not support all SIMD intrinsics
pub fn as_simd<const LANES: usize>(&self) -> (&[T], &[Simd<T, LANES>], &[T])
where
Simd<T, LANES>: AsRef<[T; LANES]>,
T: simd::SimdElement,
simd::LaneCount<LANES>: simd::SupportedLaneCount,
{
// These are expected to always match, as vector types are laid out like
// arrays per <https://llvm.org/docs/LangRef.html#vector-type>, but we
// might as well double-check since it'll optimize away anyhow.
assert_eq!(mem::size_of::<Simd<T, LANES>>(), mem::size_of::<[T; LANES]>());
// SAFETY: The simd types have the same layout as arrays, just with
// potentially-higher alignment, so the de-facto transmutes are sound.
unsafe { self.align_to() }
}
/// Split a slice into a prefix, a middle of aligned SIMD types, and a suffix.
///
/// This is a safe wrapper around [`slice::align_to_mut`], so has the same weak
/// postconditions as that method. You're only assured that
/// `self.len() == prefix.len() + middle.len() * LANES + suffix.len()`.
///
/// Notably, all of the following are possible:
/// - `prefix.len() >= LANES`.
/// - `middle.is_empty()` despite `self.len() >= 3 * LANES`.
/// - `suffix.len() >= LANES`.
///
/// That said, this is a safe method, so if you're only writing safe code,
/// then this can at most cause incorrect logic, not unsoundness.
///
/// This is the mutable version of [`slice::as_simd`]; see that for examples.
///
/// # Panics
///
/// This will panic if the size of the SIMD type is different from
/// `LANES` times that of the scalar.
///
/// At the time of writing, the trait restrictions on `Simd<T, LANES>` keeps
/// that from ever happening, as only power-of-two numbers of lanes are
/// supported. It's possible that, in the future, those restrictions might
/// be lifted in a way that would make it possible to see panics from this
/// method for something like `LANES == 3`.
#[unstable(feature = "portable_simd", issue = "86656")]
#[cfg(not(miri))] // Miri does not support all SIMD intrinsics
pub fn as_simd_mut<const LANES: usize>(&mut self) -> (&mut [T], &mut [Simd<T, LANES>], &mut [T])
where
Simd<T, LANES>: AsMut<[T; LANES]>,
T: simd::SimdElement,
simd::LaneCount<LANES>: simd::SupportedLaneCount,
{
// These are expected to always match, as vector types are laid out like
// arrays per <https://llvm.org/docs/LangRef.html#vector-type>, but we
// might as well double-check since it'll optimize away anyhow.
assert_eq!(mem::size_of::<Simd<T, LANES>>(), mem::size_of::<[T; LANES]>());
// SAFETY: The simd types have the same layout as arrays, just with
// potentially-higher alignment, so the de-facto transmutes are sound.
unsafe { self.align_to_mut() }
}
/// Checks if the elements of this slice are sorted.
///
/// That is, for each element `a` and its following element `b`, `a <= b` must hold. If the

View File

@ -78,7 +78,7 @@ macro_rules! define_handles {
}
}
impl<S: server::Types> Decode<'_, 's, HandleStore<server::MarkedTypes<S>>>
impl<'s, S: server::Types> Decode<'_, 's, HandleStore<server::MarkedTypes<S>>>
for &'s Marked<S::$oty, $oty>
{
fn decode(r: &mut Reader<'_>, s: &'s HandleStore<server::MarkedTypes<S>>) -> Self {
@ -92,7 +92,7 @@ macro_rules! define_handles {
}
}
impl<S: server::Types> DecodeMut<'_, 's, HandleStore<server::MarkedTypes<S>>>
impl<'s, S: server::Types> DecodeMut<'_, 's, HandleStore<server::MarkedTypes<S>>>
for &'s mut Marked<S::$oty, $oty>
{
fn decode(

View File

@ -295,13 +295,13 @@ impl<T, M> Unmark for Marked<T, M> {
self.value
}
}
impl<T, M> Unmark for &'a Marked<T, M> {
impl<'a, T, M> Unmark for &'a Marked<T, M> {
type Unmarked = &'a T;
fn unmark(self) -> Self::Unmarked {
&self.value
}
}
impl<T, M> Unmark for &'a mut Marked<T, M> {
impl<'a, T, M> Unmark for &'a mut Marked<T, M> {
type Unmarked = &'a mut T;
fn unmark(self) -> Self::Unmarked {
&mut self.value
@ -356,8 +356,8 @@ mark_noop! {
(),
bool,
char,
&'a [u8],
&'a str,
&'_ [u8],
&'_ str,
String,
usize,
Delimiter,

View File

@ -79,7 +79,7 @@ macro_rules! rpc_encode_decode {
}
}
impl<S, $($($T: for<'s> DecodeMut<'a, 's, S>),+)?> DecodeMut<'a, '_, S>
impl<'a, S, $($($T: for<'s> DecodeMut<'a, 's, S>),+)?> DecodeMut<'a, '_, S>
for $name $(<$($T),+>)?
{
fn decode(r: &mut Reader<'a>, s: &mut S) -> Self {
@ -176,7 +176,7 @@ impl<S, A: Encode<S>, B: Encode<S>> Encode<S> for (A, B) {
}
}
impl<S, A: for<'s> DecodeMut<'a, 's, S>, B: for<'s> DecodeMut<'a, 's, S>> DecodeMut<'a, '_, S>
impl<'a, S, A: for<'s> DecodeMut<'a, 's, S>, B: for<'s> DecodeMut<'a, 's, S>> DecodeMut<'a, '_, S>
for (A, B)
{
fn decode(r: &mut Reader<'a>, s: &mut S) -> Self {
@ -213,7 +213,7 @@ impl<S> Encode<S> for &[u8] {
}
}
impl<S> DecodeMut<'a, '_, S> for &'a [u8] {
impl<'a, S> DecodeMut<'a, '_, S> for &'a [u8] {
fn decode(r: &mut Reader<'a>, s: &mut S) -> Self {
let len = usize::decode(r, s);
let xs = &r[..len];
@ -228,7 +228,7 @@ impl<S> Encode<S> for &str {
}
}
impl<S> DecodeMut<'a, '_, S> for &'a str {
impl<'a, S> DecodeMut<'a, '_, S> for &'a str {
fn decode(r: &mut Reader<'a>, s: &mut S) -> Self {
str::from_utf8(<&[u8]>::decode(r, s)).unwrap()
}

View File

@ -25,7 +25,6 @@
#![feature(allow_internal_unstable)]
#![feature(decl_macro)]
#![feature(extern_types)]
#![feature(in_band_lifetimes)]
#![feature(negative_impls)]
#![feature(auto_traits)]
#![feature(restricted_std)]

View File

@ -373,7 +373,6 @@ nav.sub {
.source .sidebar.expanded {
overflow-y: auto;
width: 300px;
}
.source .sidebar.expanded > * {
@ -1394,7 +1393,7 @@ pre.rust {
z-index: 10;
}
#source-sidebar {
width: 300px;
width: 100%;
z-index: 1;
overflow: auto;
}
@ -1711,6 +1710,10 @@ details.rustdoc-toggle[open] > summary.hideme::after {
.rustdoc.source .sidebar {
transition: width .5s;
}
.source .sidebar.expanded {
width: 300px;
}
}
@media (max-width: 700px) {
@ -1999,6 +2002,11 @@ details.rustdoc-toggle[open] > summary.hideme::after {
.search-results div.desc, .search-results .result-description, .item-right {
padding-left: 2em;
}
.source .sidebar.expanded {
max-width: 100vw;
width: 100vw;
}
}
@media print {

View File

@ -0,0 +1,32 @@
// The goal of this test is to ensure that the sidebar is working as expected in the source
// code pages.
goto: file://|DOC_PATH|/src/test_docs/lib.rs.html
// First: desktop mode.
size: (1100, 800)
// We check that the sidebar isn't expanded and has the expected width.
assert-css: ("nav.sidebar", {"width": "50px"})
// We now click on the button to expand the sidebar.
click: (10, 10)
// We wait for the sidebar to be expanded (there is a 0.5s animation).
wait-for: 600
assert-css: ("nav.sidebar.expanded", {"width": "300px"})
// We collapse the sidebar.
click: (10, 10)
// We wait for the sidebar to be collapsed (there is a 0.5s animation).
wait-for: 600
// We ensure that the class has been removed.
assert-false: "nav.sidebar.expanded"
assert: "nav.sidebar"
// We now switch to mobile mode.
size: (600, 600)
// We check that the sidebar has the expected width (0 and 1px for the border).
assert-css: ("nav.sidebar", {"width": "1px"})
// We expand the sidebar.
click: "#sidebar-toggle"
assert-css: ("nav.sidebar.expanded", {"width": "600px"})
// We collapse the sidebar.
click: (10, 10)
// We ensure that the class has been removed.
assert-false: "nav.sidebar.expanded"
assert: "nav.sidebar"

View File

@ -1,6 +1,5 @@
// check-pass
#![feature(destructuring_assignment)]
#![feature(more_qualified_paths)]
enum E { V() }

View File

@ -0,0 +1 @@
pub struct Foo<'a, const N: usize, T: 'a + ?Sized>(pub &'a T, [(); N]);

View File

@ -0,0 +1,24 @@
// aux-build:trait_object_lt_defaults_lib.rs
// run-pass
#![allow(dead_code)]
extern crate trait_object_lt_defaults_lib;
// Tests that `A<'a, 3, dyn Test>` is short for `A<'a, 3, dyn Test + 'a>`
// and `Foo<'a, 3, dyn Test>` is short for `Foo<'a, 3, dyn Test + 'a>`
// Test is in `const-generics/defaults` because it relies on param ordering
trait Test {}
struct A<'a, const N: usize, T: ?Sized + 'a>(&'a T, [(); N]);
fn blah<'a>(mut a: A<'a, 3, dyn Test>, arg: &'a (dyn Test + 'a)) {
a.0 = arg;
}
fn other_blah<'a>(
mut a: trait_object_lt_defaults_lib::Foo<'a, 3, dyn Test>,
arg: &'a (dyn Test + 'a),
) {
a.0 = arg;
}
fn main() {}

View File

@ -4,5 +4,4 @@ mod underscore;
fn main() {
underscore!();
//~^ ERROR `_` can only be used on the left-hand side of an assignment
//~| ERROR destructuring assignments are unstable
}

View File

@ -1,18 +1,3 @@
error[E0658]: destructuring assignments are unstable
--> $DIR/underscore.rs:8:9
|
LL | _
| ^
|
::: $DIR/main.rs:5:5
|
LL | underscore!();
| ------------- in this macro invocation
|
= note: see issue #71126 <https://github.com/rust-lang/rust/issues/71126> for more information
= help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable
= note: this error originates in the macro `underscore` (in Nightly builds, run with -Z macro-backtrace for more info)
error: in expressions, `_` can only be used on the left-hand side of an assignment
--> $DIR/underscore.rs:8:9
|
@ -26,6 +11,5 @@ LL | underscore!();
|
= note: this error originates in the macro `underscore` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.

View File

@ -1,12 +1,9 @@
fn main() {
1 = 2; //~ ERROR invalid left-hand side of assignment
1 += 2; //~ ERROR invalid left-hand side of assignment
(1, 2) = (3, 4); //~ ERROR destructuring assignments are unstable
(1, 2) = (3, 4);
//~^ ERROR invalid left-hand side of assignment
//~| ERROR invalid left-hand side of assignment
//~| ERROR invalid left-hand side of assignment
let (a, b) = (1, 2);
(a, b) = (3, 4); //~ ERROR destructuring assignments are unstable
None = Some(3); //~ ERROR invalid left-hand side of assignment
}

View File

@ -1,25 +1,3 @@
error[E0658]: destructuring assignments are unstable
--> $DIR/bad-expr-lhs.rs:4:12
|
LL | (1, 2) = (3, 4);
| ------ ^
| |
| cannot assign to this expression
|
= note: see issue #71126 <https://github.com/rust-lang/rust/issues/71126> for more information
= help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable
error[E0658]: destructuring assignments are unstable
--> $DIR/bad-expr-lhs.rs:9:12
|
LL | (a, b) = (3, 4);
| ------ ^
| |
| cannot assign to this expression
|
= note: see issue #71126 <https://github.com/rust-lang/rust/issues/71126> for more information
= help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable
error[E0070]: invalid left-hand side of assignment
--> $DIR/bad-expr-lhs.rs:2:7
|
@ -53,14 +31,14 @@ LL | (1, 2) = (3, 4);
| cannot assign to this expression
error[E0070]: invalid left-hand side of assignment
--> $DIR/bad-expr-lhs.rs:11:10
--> $DIR/bad-expr-lhs.rs:8:10
|
LL | None = Some(3);
| ---- ^
| |
| cannot assign to this expression
error: aborting due to 7 previous errors
error: aborting due to 5 previous errors
Some errors have detailed explanations: E0067, E0070, E0658.
Some errors have detailed explanations: E0067, E0070.
For more information about an error, try `rustc --explain E0067`.

View File

@ -1,5 +1,3 @@
#![feature(destructuring_assignment)]
fn main() {
let mut x = &0;
let mut y = &0;

View File

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/default-match-bindings-forbidden.rs:6:5
--> $DIR/default-match-bindings-forbidden.rs:4:5
|
LL | (x, y) = &(1, 2);
| ^^^^^^ ------- this expression has type `&({integer}, {integer})`

View File

@ -2,7 +2,6 @@
//! Test that let bindings and destructuring assignments have consistent drop orders
#![feature(destructuring_assignment)]
#![allow(unused_variables, unused_assignments)]
use std::cell::RefCell;

View File

@ -1,7 +1,5 @@
// run-pass
#![feature(destructuring_assignment)]
struct Struct<S, T> {
a: S,
b: T,

View File

@ -3,25 +3,20 @@ struct S { x: u8, y: u8 }
fn main() {
let (a, b) = (1, 2);
(a, b) = (3, 4); //~ ERROR destructuring assignments are unstable
(a, b) = (3, 4);
(a, b) += (3, 4); //~ ERROR invalid left-hand side of assignment
//~| ERROR binary assignment operation `+=` cannot be applied
[a, b] = [3, 4]; //~ ERROR destructuring assignments are unstable
[a, b] = [3, 4];
[a, b] += [3, 4]; //~ ERROR invalid left-hand side of assignment
//~| ERROR binary assignment operation `+=` cannot be applied
let s = S { x: 3, y: 4 };
S { x: a, y: b } = s; //~ ERROR destructuring assignments are unstable
S { x: a, y: b } = s;
S { x: a, y: b } += s; //~ ERROR invalid left-hand side of assignment
//~| ERROR binary assignment operation `+=` cannot be applied
S { x: a, ..s } = S { x: 3, y: 4 };
//~^ ERROR functional record updates are not allowed in destructuring assignments
//~| ERROR destructuring assignments are unstable
let c = 3;
((a, b), c) = ((3, 4), 5); //~ ERROR destructuring assignments are unstable
}

View File

@ -1,64 +1,9 @@
error[E0658]: destructuring assignments are unstable
--> $DIR/note-unsupported.rs:6:12
|
LL | (a, b) = (3, 4);
| ------ ^
| |
| cannot assign to this expression
|
= note: see issue #71126 <https://github.com/rust-lang/rust/issues/71126> for more information
= help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable
error[E0658]: destructuring assignments are unstable
--> $DIR/note-unsupported.rs:10:12
|
LL | [a, b] = [3, 4];
| ------ ^
| |
| cannot assign to this expression
|
= note: see issue #71126 <https://github.com/rust-lang/rust/issues/71126> for more information
= help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable
error[E0658]: destructuring assignments are unstable
--> $DIR/note-unsupported.rs:16:22
|
LL | S { x: a, y: b } = s;
| ---------------- ^
| |
| cannot assign to this expression
|
= note: see issue #71126 <https://github.com/rust-lang/rust/issues/71126> for more information
= help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable
error[E0658]: destructuring assignments are unstable
--> $DIR/note-unsupported.rs:20:21
|
LL | S { x: a, ..s } = S { x: 3, y: 4 };
| --------------- ^
| |
| cannot assign to this expression
|
= note: see issue #71126 <https://github.com/rust-lang/rust/issues/71126> for more information
= help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable
error: functional record updates are not allowed in destructuring assignments
--> $DIR/note-unsupported.rs:20:17
|
LL | S { x: a, ..s } = S { x: 3, y: 4 };
| ^ help: consider removing the trailing pattern
error[E0658]: destructuring assignments are unstable
--> $DIR/note-unsupported.rs:26:17
|
LL | ((a, b), c) = ((3, 4), 5);
| ----------- ^
| |
| cannot assign to this expression
|
= note: see issue #71126 <https://github.com/rust-lang/rust/issues/71126> for more information
= help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable
error[E0368]: binary assignment operation `+=` cannot be applied to type `({integer}, {integer})`
--> $DIR/note-unsupported.rs:7:5
|
@ -124,7 +69,7 @@ LL | S { x: a, y: b } += s;
| |
| cannot assign to this expression
error: aborting due to 12 previous errors
error: aborting due to 7 previous errors
Some errors have detailed explanations: E0067, E0368, E0658.
Some errors have detailed explanations: E0067, E0368.
For more information about an error, try `rustc --explain E0067`.

View File

@ -1,7 +1,5 @@
// run-pass
#![feature(destructuring_assignment)]
fn main() {
let (mut a, mut b);
[a, b] = [0, 1];

View File

@ -1,5 +1,3 @@
#![feature(destructuring_assignment)]
fn main() {
let (mut a, mut b);
[a, .., b, ..] = [0, 1]; //~ ERROR `..` can only be used once per slice pattern

View File

@ -1,5 +1,5 @@
error: `..` can only be used once per slice pattern
--> $DIR/slice_destructure_fail.rs:5:14
--> $DIR/slice_destructure_fail.rs:3:14
|
LL | [a, .., b, ..] = [0, 1];
| -- ^^ can only be used once per slice pattern
@ -7,13 +7,13 @@ LL | [a, .., b, ..] = [0, 1];
| previously used here
error[E0527]: pattern requires 3 elements but array has 2
--> $DIR/slice_destructure_fail.rs:6:3
--> $DIR/slice_destructure_fail.rs:4:3
|
LL | [a, a, b] = [1, 2];
| ^^^^^^^^^ expected 2 elements
error[E0527]: pattern requires 1 element but array has 2
--> $DIR/slice_destructure_fail.rs:7:3
--> $DIR/slice_destructure_fail.rs:5:3
|
LL | [_] = [1, 2];
| ^^^ expected 2 elements

View File

@ -1,6 +1,5 @@
// run-pass
#![feature(destructuring_assignment)]
struct Struct<S, T> {
a: S,
b: T,

View File

@ -1,4 +1,3 @@
#![feature(destructuring_assignment)]
struct Struct<S, T> {
a: S,
b: T,

View File

@ -1,5 +1,5 @@
error: expected identifier, found reserved identifier `_`
--> $DIR/struct_destructure_fail.rs:12:17
--> $DIR/struct_destructure_fail.rs:11:17
|
LL | Struct { a, _ } = Struct { a: 1, b: 2 };
| ------ ^ expected identifier, found reserved identifier
@ -7,25 +7,25 @@ LL | Struct { a, _ } = Struct { a: 1, b: 2 };
| while parsing this struct
error: functional record updates are not allowed in destructuring assignments
--> $DIR/struct_destructure_fail.rs:14:19
--> $DIR/struct_destructure_fail.rs:13:19
|
LL | Struct { a, ..d } = Struct { a: 1, b: 2 };
| ^ help: consider removing the trailing pattern
error: base expression required after `..`
--> $DIR/struct_destructure_fail.rs:16:19
--> $DIR/struct_destructure_fail.rs:15:19
|
LL | Struct { a, .. };
| ^ add a base expression here
error[E0026]: struct `Struct` does not have a field named `c`
--> $DIR/struct_destructure_fail.rs:11:20
--> $DIR/struct_destructure_fail.rs:10:20
|
LL | Struct { a, b, c } = Struct { a: 0, b: 1 };
| ^ struct `Struct` does not have this field
error[E0027]: pattern does not mention field `b`
--> $DIR/struct_destructure_fail.rs:12:5
--> $DIR/struct_destructure_fail.rs:11:5
|
LL | Struct { a, _ } = Struct { a: 1, b: 2 };
| ^^^^^^^^^^^^^^^ missing field `b`

View File

@ -1,7 +1,5 @@
// run-pass
#![feature(destructuring_assignment)]
fn main() {
let (mut a, mut b);
(a, b) = (0, 1);

View File

@ -1,5 +1,3 @@
#![feature(destructuring_assignment)]
const C: i32 = 1;
fn main() {

View File

@ -1,5 +1,5 @@
error: `..` can only be used once per tuple pattern
--> $DIR/tuple_destructure_fail.rs:7:16
--> $DIR/tuple_destructure_fail.rs:5:16
|
LL | (a, .., b, ..) = (0, 1);
| -- ^^ can only be used once per tuple pattern
@ -7,7 +7,7 @@ LL | (a, .., b, ..) = (0, 1);
| previously used here
error[E0308]: mismatched types
--> $DIR/tuple_destructure_fail.rs:8:5
--> $DIR/tuple_destructure_fail.rs:6:5
|
LL | (a, a, b) = (1, 2);
| ^^^^^^^^^ ------ this expression has type `({integer}, {integer})`
@ -18,7 +18,7 @@ LL | (a, a, b) = (1, 2);
found tuple `(_, _, _)`
error[E0070]: invalid left-hand side of assignment
--> $DIR/tuple_destructure_fail.rs:9:13
--> $DIR/tuple_destructure_fail.rs:7:13
|
LL | (C, ..) = (0,1);
| - ^
@ -26,7 +26,7 @@ LL | (C, ..) = (0,1);
| cannot assign to this expression
error[E0308]: mismatched types
--> $DIR/tuple_destructure_fail.rs:10:5
--> $DIR/tuple_destructure_fail.rs:8:5
|
LL | (_,) = (1, 2);
| ^^^^ ------ this expression has type `({integer}, {integer})`

View File

@ -1,7 +1,5 @@
// run-pass
#![feature(destructuring_assignment)]
struct TupleStruct<S, T>(S, T);
impl<S, T> TupleStruct<S, T> {

View File

@ -1,5 +1,3 @@
#![feature(destructuring_assignment)]
struct TupleStruct<S, T>(S, T);
enum Enum<S, T> {

View File

@ -1,5 +1,5 @@
error: `..` can only be used once per tuple struct or variant pattern
--> $DIR/tuple_struct_destructure_fail.rs:25:27
--> $DIR/tuple_struct_destructure_fail.rs:23:27
|
LL | TupleStruct(a, .., b, ..) = TupleStruct(0, 1);
| -- ^^ can only be used once per tuple struct or variant pattern
@ -7,7 +7,7 @@ LL | TupleStruct(a, .., b, ..) = TupleStruct(0, 1);
| previously used here
error: `..` can only be used once per tuple struct or variant pattern
--> $DIR/tuple_struct_destructure_fail.rs:27:35
--> $DIR/tuple_struct_destructure_fail.rs:25:35
|
LL | Enum::SingleVariant(a, .., b, ..) = Enum::SingleVariant(0, 1);
| -- ^^ can only be used once per tuple struct or variant pattern
@ -15,7 +15,7 @@ LL | Enum::SingleVariant(a, .., b, ..) = Enum::SingleVariant(0, 1);
| previously used here
error[E0023]: this pattern has 3 fields, but the corresponding tuple struct has 2 fields
--> $DIR/tuple_struct_destructure_fail.rs:30:17
--> $DIR/tuple_struct_destructure_fail.rs:28:17
|
LL | struct TupleStruct<S, T>(S, T);
| - - tuple struct has 2 fields
@ -24,7 +24,7 @@ LL | TupleStruct(a, a, b) = TupleStruct(1, 2);
| ^ ^ ^ expected 2 fields, found 3
error[E0023]: this pattern has 1 field, but the corresponding tuple struct has 2 fields
--> $DIR/tuple_struct_destructure_fail.rs:32:17
--> $DIR/tuple_struct_destructure_fail.rs:30:17
|
LL | struct TupleStruct<S, T>(S, T);
| - - tuple struct has 2 fields
@ -42,7 +42,7 @@ LL | TupleStruct(..) = TupleStruct(1, 2);
| ~~
error[E0023]: this pattern has 3 fields, but the corresponding tuple variant has 2 fields
--> $DIR/tuple_struct_destructure_fail.rs:34:25
--> $DIR/tuple_struct_destructure_fail.rs:32:25
|
LL | SingleVariant(S, T)
| - - tuple variant has 2 fields
@ -51,7 +51,7 @@ LL | Enum::SingleVariant(a, a, b) = Enum::SingleVariant(1, 2);
| ^ ^ ^ expected 2 fields, found 3
error[E0023]: this pattern has 1 field, but the corresponding tuple variant has 2 fields
--> $DIR/tuple_struct_destructure_fail.rs:36:25
--> $DIR/tuple_struct_destructure_fail.rs:34:25
|
LL | SingleVariant(S, T)
| - - tuple variant has 2 fields
@ -69,7 +69,7 @@ LL | Enum::SingleVariant(..) = Enum::SingleVariant(1, 2);
| ~~
error[E0070]: invalid left-hand side of assignment
--> $DIR/tuple_struct_destructure_fail.rs:40:12
--> $DIR/tuple_struct_destructure_fail.rs:38:12
|
LL | test() = TupleStruct(0, 0);
| ------ ^
@ -77,7 +77,7 @@ LL | test() = TupleStruct(0, 0);
| cannot assign to this expression
error[E0070]: invalid left-hand side of assignment
--> $DIR/tuple_struct_destructure_fail.rs:42:14
--> $DIR/tuple_struct_destructure_fail.rs:40:14
|
LL | (test)() = TupleStruct(0, 0);
| -------- ^
@ -85,7 +85,7 @@ LL | (test)() = TupleStruct(0, 0);
| cannot assign to this expression
error[E0070]: invalid left-hand side of assignment
--> $DIR/tuple_struct_destructure_fail.rs:44:38
--> $DIR/tuple_struct_destructure_fail.rs:42:38
|
LL | <Alias::<isize> as Test>::test() = TupleStruct(0, 0);
| -------------------------------- ^

View File

@ -1,10 +0,0 @@
fn main() {}
struct S { x : u32 }
#[cfg(FALSE)]
fn foo() {
_; //~ ERROR destructuring assignments are unstable
S { x: 5, .. }; //~ ERROR destructuring assignments are unstable
}

View File

@ -1,21 +0,0 @@
error[E0658]: destructuring assignments are unstable
--> $DIR/underscore-range-expr-gating.rs:7:5
|
LL | _;
| ^
|
= note: see issue #71126 <https://github.com/rust-lang/rust/issues/71126> for more information
= help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable
error[E0658]: destructuring assignments are unstable
--> $DIR/underscore-range-expr-gating.rs:9:15
|
LL | S { x: 5, .. };
| ^^
|
= note: see issue #71126 <https://github.com/rust-lang/rust/issues/71126> for more information
= help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0658`.

View File

@ -1,7 +1,5 @@
// run-pass
#![feature(destructuring_assignment)]
#![warn(unused_assignments)]
fn main() {

View File

@ -1,11 +1,11 @@
warning: value assigned to `a` is never read
--> $DIR/warn-unused-duplication.rs:11:6
--> $DIR/warn-unused-duplication.rs:9:6
|
LL | (a, a) = (0, 1);
| ^
|
note: the lint level is defined here
--> $DIR/warn-unused-duplication.rs:5:9
--> $DIR/warn-unused-duplication.rs:3:9
|
LL | #![warn(unused_assignments)]
| ^^^^^^^^^^^^^^^^^^

View File

@ -1,4 +0,0 @@
fn main() {
let (a, b) = (0, 1);
(a, b) = (2, 3); //~ ERROR destructuring assignments are unstable
}

View File

@ -1,14 +0,0 @@
error[E0658]: destructuring assignments are unstable
--> $DIR/feature-gate-destructuring_assignment.rs:3:12
|
LL | (a, b) = (2, 3);
| ------ ^
| |
| cannot assign to this expression
|
= note: see issue #71126 <https://github.com/rust-lang/rust/issues/71126> for more information
= help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.

View File

@ -1,5 +1,4 @@
// run-rustfix
#![feature(destructuring_assignment)]
fn main() {
let value = [7u8];
while let Some(0) = value.get(0) { //~ ERROR invalid left-hand side of assignment

View File

@ -1,5 +1,4 @@
// run-rustfix
#![feature(destructuring_assignment)]
fn main() {
let value = [7u8];
while Some(0) = value.get(0) { //~ ERROR invalid left-hand side of assignment

View File

@ -1,5 +1,5 @@
error[E0070]: invalid left-hand side of assignment
--> $DIR/issue-77218-2.rs:5:19
--> $DIR/issue-77218-2.rs:4:19
|
LL | while Some(0) = value.get(0) {
| - ^

View File

@ -1,6 +1,5 @@
// run-rustfix
fn main() {
let value = [7u8];
while let Some(0) = value.get(0) { //~ ERROR destructuring assignments are unstable
}
while let Some(0) = value.get(0) {} //~ ERROR invalid left-hand side of assignment
}

View File

@ -1,6 +1,5 @@
// run-rustfix
fn main() {
let value = [7u8];
while Some(0) = value.get(0) { //~ ERROR destructuring assignments are unstable
}
while Some(0) = value.get(0) {} //~ ERROR invalid left-hand side of assignment
}

View File

@ -1,18 +1,16 @@
error[E0658]: destructuring assignments are unstable
error[E0070]: invalid left-hand side of assignment
--> $DIR/issue-77218.rs:4:19
|
LL | while Some(0) = value.get(0) {
| ------- ^
| |
| cannot assign to this expression
LL | while Some(0) = value.get(0) {}
| - ^
| |
| cannot assign to this expression
|
= note: see issue #71126 <https://github.com/rust-lang/rust/issues/71126> for more information
= help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable
help: you might have meant to use pattern destructuring
|
LL | while let Some(0) = value.get(0) {
LL | while let Some(0) = value.get(0) {}
| +++
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.
For more information about this error, try `rustc --explain E0070`.

View File

@ -10,16 +10,10 @@ fn main() {
let _: usize = foo(_, _);
//~^ ERROR `_` can only be used on the left-hand side of an assignment
//~| ERROR `_` can only be used on the left-hand side of an assignment
//~| ERROR destructuring assignments are unstable
//~| ERROR destructuring assignments are unstable
let _: S = S(_, _);
//~^ ERROR `_` can only be used on the left-hand side of an assignment
//~| ERROR `_` can only be used on the left-hand side of an assignment
//~| ERROR destructuring assignments are unstable
//~| ERROR destructuring assignments are unstable
let _: usize = T::baz(_, _);
//~^ ERROR `_` can only be used on the left-hand side of an assignment
//~| ERROR `_` can only be used on the left-hand side of an assignment
//~| ERROR destructuring assignments are unstable
//~| ERROR destructuring assignments are unstable
}

View File

@ -1,57 +1,3 @@
error[E0658]: destructuring assignments are unstable
--> $DIR/fn-or-tuple-struct-with-underscore-args.rs:10:24
|
LL | let _: usize = foo(_, _);
| ^
|
= note: see issue #71126 <https://github.com/rust-lang/rust/issues/71126> for more information
= help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable
error[E0658]: destructuring assignments are unstable
--> $DIR/fn-or-tuple-struct-with-underscore-args.rs:10:27
|
LL | let _: usize = foo(_, _);
| ^
|
= note: see issue #71126 <https://github.com/rust-lang/rust/issues/71126> for more information
= help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable
error[E0658]: destructuring assignments are unstable
--> $DIR/fn-or-tuple-struct-with-underscore-args.rs:15:18
|
LL | let _: S = S(_, _);
| ^
|
= note: see issue #71126 <https://github.com/rust-lang/rust/issues/71126> for more information
= help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable
error[E0658]: destructuring assignments are unstable
--> $DIR/fn-or-tuple-struct-with-underscore-args.rs:15:21
|
LL | let _: S = S(_, _);
| ^
|
= note: see issue #71126 <https://github.com/rust-lang/rust/issues/71126> for more information
= help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable
error[E0658]: destructuring assignments are unstable
--> $DIR/fn-or-tuple-struct-with-underscore-args.rs:20:27
|
LL | let _: usize = T::baz(_, _);
| ^
|
= note: see issue #71126 <https://github.com/rust-lang/rust/issues/71126> for more information
= help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable
error[E0658]: destructuring assignments are unstable
--> $DIR/fn-or-tuple-struct-with-underscore-args.rs:20:30
|
LL | let _: usize = T::baz(_, _);
| ^
|
= note: see issue #71126 <https://github.com/rust-lang/rust/issues/71126> for more information
= help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable
error: in expressions, `_` can only be used on the left-hand side of an assignment
--> $DIR/fn-or-tuple-struct-with-underscore-args.rs:10:24
|
@ -65,29 +11,28 @@ LL | let _: usize = foo(_, _);
| ^ `_` not allowed here
error: in expressions, `_` can only be used on the left-hand side of an assignment
--> $DIR/fn-or-tuple-struct-with-underscore-args.rs:15:18
--> $DIR/fn-or-tuple-struct-with-underscore-args.rs:13:18
|
LL | let _: S = S(_, _);
| ^ `_` not allowed here
error: in expressions, `_` can only be used on the left-hand side of an assignment
--> $DIR/fn-or-tuple-struct-with-underscore-args.rs:15:21
--> $DIR/fn-or-tuple-struct-with-underscore-args.rs:13:21
|
LL | let _: S = S(_, _);
| ^ `_` not allowed here
error: in expressions, `_` can only be used on the left-hand side of an assignment
--> $DIR/fn-or-tuple-struct-with-underscore-args.rs:20:27
--> $DIR/fn-or-tuple-struct-with-underscore-args.rs:16:27
|
LL | let _: usize = T::baz(_, _);
| ^ `_` not allowed here
error: in expressions, `_` can only be used on the left-hand side of an assignment
--> $DIR/fn-or-tuple-struct-with-underscore-args.rs:20:30
--> $DIR/fn-or-tuple-struct-with-underscore-args.rs:16:30
|
LL | let _: usize = T::baz(_, _);
| ^ `_` not allowed here
error: aborting due to 12 previous errors
error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0658`.

View File

@ -3,12 +3,9 @@ fn main() {
let bar = None;
if Some(x) = foo {} //~ ERROR cannot find value `x` in this scope
//~^ ERROR mismatched types
//~^^ ERROR destructuring assignments are unstable
if Some(foo) = bar {} //~ ERROR mismatched types
//~^ ERROR destructuring assignments are unstable
if 3 = foo {} //~ ERROR mismatched types
if Some(3) = foo {} //~ ERROR mismatched types
//~^ ERROR destructuring assignments are unstable
//~^^ ERROR invalid left-hand side of assignment
//~^ ERROR invalid left-hand side of assignment
if x = 5 {} //~ ERROR cannot find value `x` in this scope
}

View File

@ -10,7 +10,7 @@ LL | if let Some(x) = foo {}
| +++
error[E0425]: cannot find value `x` in this scope
--> $DIR/if-let-typo.rs:13:8
--> $DIR/if-let-typo.rs:10:8
|
LL | if x = 5 {}
| ^ not found in this scope
@ -20,39 +20,6 @@ help: you might have meant to use pattern matching
LL | if let x = 5 {}
| +++
error[E0658]: destructuring assignments are unstable
--> $DIR/if-let-typo.rs:4:16
|
LL | if Some(x) = foo {}
| ------- ^
| |
| cannot assign to this expression
|
= note: see issue #71126 <https://github.com/rust-lang/rust/issues/71126> for more information
= help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable
error[E0658]: destructuring assignments are unstable
--> $DIR/if-let-typo.rs:7:18
|
LL | if Some(foo) = bar {}
| --------- ^
| |
| cannot assign to this expression
|
= note: see issue #71126 <https://github.com/rust-lang/rust/issues/71126> for more information
= help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable
error[E0658]: destructuring assignments are unstable
--> $DIR/if-let-typo.rs:10:16
|
LL | if Some(3) = foo {}
| ------- ^
| |
| cannot assign to this expression
|
= note: see issue #71126 <https://github.com/rust-lang/rust/issues/71126> for more information
= help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable
error[E0308]: mismatched types
--> $DIR/if-let-typo.rs:4:8
|
@ -60,19 +27,19 @@ LL | if Some(x) = foo {}
| ^^^^^^^^^^^^^ expected `bool`, found `()`
error[E0308]: mismatched types
--> $DIR/if-let-typo.rs:7:8
--> $DIR/if-let-typo.rs:6:8
|
LL | if Some(foo) = bar {}
| ^^^^^^^^^^^^^^^ expected `bool`, found `()`
error[E0308]: mismatched types
--> $DIR/if-let-typo.rs:9:8
--> $DIR/if-let-typo.rs:7:8
|
LL | if 3 = foo {}
| ^^^^^^^ expected `bool`, found `()`
error[E0070]: invalid left-hand side of assignment
--> $DIR/if-let-typo.rs:10:16
--> $DIR/if-let-typo.rs:8:16
|
LL | if Some(3) = foo {}
| - ^
@ -80,12 +47,12 @@ LL | if Some(3) = foo {}
| cannot assign to this expression
error[E0308]: mismatched types
--> $DIR/if-let-typo.rs:10:8
--> $DIR/if-let-typo.rs:8:8
|
LL | if Some(3) = foo {}
| ^^^^^^^^^^^^^ expected `bool`, found `()`
error: aborting due to 10 previous errors
error: aborting due to 7 previous errors
Some errors have detailed explanations: E0070, E0308, E0425, E0658.
Some errors have detailed explanations: E0070, E0308, E0425.
For more information about an error, try `rustc --explain E0070`.

View File

@ -1,7 +1,6 @@
// run-pass
#![feature(generators)]
#![feature(destructuring_assignment)]
#![allow(non_camel_case_types)]
#![allow(dead_code)]

View File

@ -1,14 +1,3 @@
error[E0658]: destructuring assignments are unstable
--> $DIR/ice-6250.rs:12:25
|
LL | Some(reference) = cache.data.get(key) {
| --------------- ^
| |
| cannot assign to this expression
|
= note: see issue #71126 <https://github.com/rust-lang/rust/issues/71126> for more information
= help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable
error[E0601]: `main` function not found in crate `ice_6250`
--> $DIR/ice-6250.rs:4:1
|
@ -41,7 +30,7 @@ error[E0308]: mismatched types
LL | Some(reference) = cache.data.get(key) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `()`
error: aborting due to 4 previous errors
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0308, E0601, E0658.
Some errors have detailed explanations: E0308, E0601.
For more information about an error, try `rustc --explain E0308`.

View File

@ -133,7 +133,7 @@ async function main(argv) {
// Print successful tests too
let debug = false;
// Run tests in sequentially
let no_headless = false;
let headless = true;
const options = new Options();
try {
// This is more convenient that setting fields one by one.
@ -150,7 +150,7 @@ async function main(argv) {
}
if (opts["no_headless"]) {
args.push("--no-headless");
no_headless = true;
headless = false;
}
options.parseArguments(args);
} catch (error) {
@ -172,7 +172,7 @@ async function main(argv) {
}
files.sort();
if (no_headless) {
if (!headless) {
opts["jobs"] = 1;
console.log("`--no-headless` option is active, disabling concurrency for running tests.");
}
@ -181,7 +181,7 @@ async function main(argv) {
if (opts["jobs"] < 1) {
process.setMaxListeners(files.length + 1);
} else if (!no_headless) {
} else if (headless) {
process.setMaxListeners(opts["jobs"] + 1);
}
@ -226,7 +226,7 @@ async function main(argv) {
await Promise.race(tests_queue);
}
}
if (!no_headless && tests_queue.length > 0) {
if (tests_queue.length > 0) {
await Promise.all(tests_queue);
}
status_bar.finish();