From 7c7fcb254408ccac662186caefbf6c112632107a Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 21 Jun 2021 17:19:46 -0700 Subject: [PATCH 01/13] Add support for OpenSSL 3.0.0 This updates the `openssl` and `openssl-sys` crates to support building the toolchain with system libraries up to OpenSSL 3.0.0. This does not affect the static version used via `openssl-src` in CI builds. ref: https://github.com/sfackler/rust-openssl/pull/1264 --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 86dd4695aa4fe..82574f3463a96 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2420,9 +2420,9 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.33" +version = "0.10.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a61075b62a23fef5a29815de7536d940aa35ce96d18ce0cc5076272db678a577" +checksum = "549430950c79ae24e6d02e0b7404534ecf311d94cc9f861e9e4020187d13d885" dependencies = [ "bitflags", "cfg-if 1.0.0", @@ -2449,9 +2449,9 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.9.61" +version = "0.9.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "313752393519e876837e09e1fa183ddef0be7735868dced3196f4472d536277f" +checksum = "7a7907e3bfa08bb85105209cdfcb6c63d109f8f6c1ed6ca318fff5c1853fbc1d" dependencies = [ "autocfg", "cc", From bf0da4418f061b74b0f3f9e2a2b1310385896355 Mon Sep 17 00:00:00 2001 From: jam1garner <8260240+jam1garner@users.noreply.github.com> Date: Sun, 27 Jun 2021 00:28:07 -0400 Subject: [PATCH 02/13] Fix `future_prelude_collision` false positive --- .../rustc_typeck/src/check/method/prelude2021.rs | 7 +++++++ .../future-prelude-collision-unneeded.rs | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 src/test/ui/rust-2021/future-prelude-collision-unneeded.rs diff --git a/compiler/rustc_typeck/src/check/method/prelude2021.rs b/compiler/rustc_typeck/src/check/method/prelude2021.rs index 4c925a6f23707..e8748dd062f53 100644 --- a/compiler/rustc_typeck/src/check/method/prelude2021.rs +++ b/compiler/rustc_typeck/src/check/method/prelude2021.rs @@ -57,6 +57,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { { return; } + + // if it's an inherent `self` method (not `&self` or `&mut self`), it will take + // precedence over the `TryInto` impl, and thus won't break in 2021 edition + if pick.autoderefs == 0 && pick.autoref_or_ptr_adjustment.is_none() { + return; + } + // Inherent impls only require not relying on autoref and autoderef in order to // ensure that the trait implementation won't be used self.tcx.struct_span_lint_hir( diff --git a/src/test/ui/rust-2021/future-prelude-collision-unneeded.rs b/src/test/ui/rust-2021/future-prelude-collision-unneeded.rs new file mode 100644 index 0000000000000..a4a5b6667df8c --- /dev/null +++ b/src/test/ui/rust-2021/future-prelude-collision-unneeded.rs @@ -0,0 +1,16 @@ +// edition:2018 +// check-pass +#![allow(unused)] +#![deny(future_prelude_collision)] + +struct S; + +impl S { + fn try_into(self) -> S { S } +} + +// See https://github.com/rust-lang/rust/issues/86633 +fn main() { + let s = S; + let s2 = s.try_into(); +} From 7f4e343893332be246ae532a9c6e0bafab5b732e Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Sun, 27 Jun 2021 14:45:54 +0000 Subject: [PATCH 03/13] Add `explain_reason: false` in future_incompatible. This allows supressing the default warning message for future incompatible ints, for lints that already provide a more detailed warning. --- compiler/rustc_lint_defs/src/lib.rs | 6 ++++++ compiler/rustc_middle/src/lint.rs | 11 ++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_lint_defs/src/lib.rs b/compiler/rustc_lint_defs/src/lib.rs index b3d98747dcfa2..98e3a7069c265 100644 --- a/compiler/rustc_lint_defs/src/lib.rs +++ b/compiler/rustc_lint_defs/src/lib.rs @@ -145,6 +145,11 @@ pub struct FutureIncompatibleInfo { /// The reason for the lint used by diagnostics to provide /// the right help message pub reason: FutureIncompatibilityReason, + /// Whether to explain the reason to the user. + /// + /// Set to false for lints that already include a more detailed + /// explanation. + pub explain_reason: bool, /// Information about a future breakage, which will /// be emitted in JSON messages to be displayed by Cargo /// for upstream deps @@ -185,6 +190,7 @@ impl FutureIncompatibleInfo { FutureIncompatibleInfo { reference: "", reason: FutureIncompatibilityReason::FutureReleaseError, + explain_reason: true, future_breakage: None, } } diff --git a/compiler/rustc_middle/src/lint.rs b/compiler/rustc_middle/src/lint.rs index 8180d853f6073..8d0fdf9128a51 100644 --- a/compiler/rustc_middle/src/lint.rs +++ b/compiler/rustc_middle/src/lint.rs @@ -398,9 +398,14 @@ pub fn struct_lint_level<'s, 'd>( it will become a hard error in a future release!" .to_owned() }; - let citation = format!("for more information, see {}", future_incompatible.reference); - err.warn(&explanation); - err.note(&citation); + if future_incompatible.explain_reason { + err.warn(&explanation); + } + if !future_incompatible.reference.is_empty() { + let citation = + format!("for more information, see {}", future_incompatible.reference); + err.note(&citation); + } } // Finally, run `decorate`. This function is also responsible for emitting the diagnostic. From 934e6058eb5b051eac862d611cbc73e58a09e6dd Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Sun, 27 Jun 2021 14:47:26 +0000 Subject: [PATCH 04/13] Turn non_fmt_panic into a future_incompatible edition lint. --- compiler/rustc_lint/src/non_fmt_panic.rs | 9 +++++- src/test/ui/non-fmt-panic.stderr | 36 ++++++++++++++++-------- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/compiler/rustc_lint/src/non_fmt_panic.rs b/compiler/rustc_lint/src/non_fmt_panic.rs index c91dc37b374f8..3ea5a3bcc3b98 100644 --- a/compiler/rustc_lint/src/non_fmt_panic.rs +++ b/compiler/rustc_lint/src/non_fmt_panic.rs @@ -4,6 +4,8 @@ use rustc_errors::{pluralize, Applicability}; use rustc_hir as hir; use rustc_middle::ty; use rustc_parse_format::{ParseMode, Parser, Piece}; +use rustc_session::lint::FutureIncompatibilityReason; +use rustc_span::edition::Edition; use rustc_span::{hygiene, sym, symbol::kw, symbol::SymbolStr, InnerSpan, Span, Symbol}; declare_lint! { @@ -30,6 +32,10 @@ declare_lint! { NON_FMT_PANIC, Warn, "detect single-argument panic!() invocations in which the argument is not a format string", + @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2021), + explain_reason: false, + }; report_in_external_macro } @@ -87,7 +93,8 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc cx.struct_span_lint(NON_FMT_PANIC, arg_span, |lint| { let mut l = lint.build("panic message is not a string literal"); - l.note("this is no longer accepted in Rust 2021"); + l.note("this usage of panic!() is deprecated; it will be a hard error in Rust 2021"); + l.note("for more information, see "); if !span.contains(arg_span) { // No clue where this argument is coming from. l.emit(); diff --git a/src/test/ui/non-fmt-panic.stderr b/src/test/ui/non-fmt-panic.stderr index 3278eb5f0238e..0f451c1e0a9a3 100644 --- a/src/test/ui/non-fmt-panic.stderr +++ b/src/test/ui/non-fmt-panic.stderr @@ -61,7 +61,8 @@ warning: panic message is not a string literal LL | assert!(false, S); | ^ | - = note: this is no longer accepted in Rust 2021 + = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: for more information, see help: add a "{}" format string to Display the message | LL | assert!(false, "{}", S); @@ -85,7 +86,8 @@ warning: panic message is not a string literal LL | panic!(C); | ^ | - = note: this is no longer accepted in Rust 2021 + = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: for more information, see help: add a "{}" format string to Display the message | LL | panic!("{}", C); @@ -101,7 +103,8 @@ warning: panic message is not a string literal LL | panic!(S); | ^ | - = note: this is no longer accepted in Rust 2021 + = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: for more information, see help: add a "{}" format string to Display the message | LL | panic!("{}", S); @@ -117,7 +120,8 @@ warning: panic message is not a string literal LL | std::panic!(123); | ^^^ | - = note: this is no longer accepted in Rust 2021 + = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: for more information, see help: add a "{}" format string to Display the message | LL | std::panic!("{}", 123); @@ -133,7 +137,8 @@ warning: panic message is not a string literal LL | core::panic!(&*"abc"); | ^^^^^^^ | - = note: this is no longer accepted in Rust 2021 + = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: for more information, see help: add a "{}" format string to Display the message | LL | core::panic!("{}", &*"abc"); @@ -181,7 +186,8 @@ warning: panic message is not a string literal LL | fancy_panic::fancy_panic!(S); | ^ | - = note: this is no longer accepted in Rust 2021 + = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: for more information, see warning: panic message is not a string literal --> $DIR/non-fmt-panic.rs:36:12 @@ -189,7 +195,8 @@ warning: panic message is not a string literal LL | panic!(a!()); | ^^^^ | - = note: this is no longer accepted in Rust 2021 + = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: for more information, see help: add a "{}" format string to Display the message | LL | panic!("{}", a!()); @@ -205,7 +212,8 @@ warning: panic message is not a string literal LL | panic!(format!("{}", 1)); | ^^^^^^^^^^^^^^^^ | - = note: this is no longer accepted in Rust 2021 + = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: for more information, see = note: the panic!() macro supports formatting, so there's no need for the format!() macro here help: remove the `format!(..)` macro call | @@ -218,7 +226,8 @@ warning: panic message is not a string literal LL | assert!(false, format!("{}", 1)); | ^^^^^^^^^^^^^^^^ | - = note: this is no longer accepted in Rust 2021 + = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: for more information, see = note: the assert!() macro supports formatting, so there's no need for the format!() macro here help: remove the `format!(..)` macro call | @@ -231,7 +240,8 @@ warning: panic message is not a string literal LL | debug_assert!(false, format!("{}", 1)); | ^^^^^^^^^^^^^^^^ | - = note: this is no longer accepted in Rust 2021 + = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: for more information, see = note: the debug_assert!() macro supports formatting, so there's no need for the format!() macro here help: remove the `format!(..)` macro call | @@ -244,7 +254,8 @@ warning: panic message is not a string literal LL | panic![123]; | ^^^ | - = note: this is no longer accepted in Rust 2021 + = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: for more information, see help: add a "{}" format string to Display the message | LL | panic!["{}", 123]; @@ -260,7 +271,8 @@ warning: panic message is not a string literal LL | panic!{123}; | ^^^ | - = note: this is no longer accepted in Rust 2021 + = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: for more information, see help: add a "{}" format string to Display the message | LL | panic!{"{}", 123}; From 4645679d35378a7134cd8d77e0b2a5164f6ea127 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Sun, 27 Jun 2021 14:45:54 +0000 Subject: [PATCH 05/13] Add `explain_reason: false` in future_incompatible. This allows supressing the default warning message for future incompatible ints, for lints that already provide a more detailed warning. --- compiler/rustc_lint_defs/src/lib.rs | 6 ++++++ compiler/rustc_middle/src/lint.rs | 11 ++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_lint_defs/src/lib.rs b/compiler/rustc_lint_defs/src/lib.rs index b3d98747dcfa2..98e3a7069c265 100644 --- a/compiler/rustc_lint_defs/src/lib.rs +++ b/compiler/rustc_lint_defs/src/lib.rs @@ -145,6 +145,11 @@ pub struct FutureIncompatibleInfo { /// The reason for the lint used by diagnostics to provide /// the right help message pub reason: FutureIncompatibilityReason, + /// Whether to explain the reason to the user. + /// + /// Set to false for lints that already include a more detailed + /// explanation. + pub explain_reason: bool, /// Information about a future breakage, which will /// be emitted in JSON messages to be displayed by Cargo /// for upstream deps @@ -185,6 +190,7 @@ impl FutureIncompatibleInfo { FutureIncompatibleInfo { reference: "", reason: FutureIncompatibilityReason::FutureReleaseError, + explain_reason: true, future_breakage: None, } } diff --git a/compiler/rustc_middle/src/lint.rs b/compiler/rustc_middle/src/lint.rs index 8180d853f6073..8d0fdf9128a51 100644 --- a/compiler/rustc_middle/src/lint.rs +++ b/compiler/rustc_middle/src/lint.rs @@ -398,9 +398,14 @@ pub fn struct_lint_level<'s, 'd>( it will become a hard error in a future release!" .to_owned() }; - let citation = format!("for more information, see {}", future_incompatible.reference); - err.warn(&explanation); - err.note(&citation); + if future_incompatible.explain_reason { + err.warn(&explanation); + } + if !future_incompatible.reference.is_empty() { + let citation = + format!("for more information, see {}", future_incompatible.reference); + err.note(&citation); + } } // Finally, run `decorate`. This function is also responsible for emitting the diagnostic. From 3c95a28f4c21f2728c843a885bc29566115fc813 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Sun, 27 Jun 2021 16:54:48 +0000 Subject: [PATCH 06/13] Make disjoint_capture_migration an edition lint. --- compiler/rustc_lint_defs/src/builtin.rs | 17 +++--- compiler/rustc_typeck/src/check/upvar.rs | 3 +- .../migrations/auto_traits.fixed | 6 +- .../migrations/auto_traits.rs | 6 +- .../migrations/auto_traits.stderr | 9 ++- .../migrations/insignificant_drop.fixed | 21 ++++--- .../migrations/insignificant_drop.rs | 21 ++++--- .../migrations/insignificant_drop.stderr | 60 ++++++++++++------- .../insignificant_drop_attr_migrations.fixed | 6 +- .../insignificant_drop_attr_migrations.rs | 6 +- .../insignificant_drop_attr_migrations.stderr | 12 +++- .../migrations/migrations_rustfix.fixed | 6 +- .../migrations/migrations_rustfix.rs | 6 +- .../migrations/migrations_rustfix.stderr | 10 +++- .../migrations/mir_calls_to_shims.fixed | 2 +- .../migrations/mir_calls_to_shims.rs | 2 +- .../migrations/mir_calls_to_shims.stderr | 3 +- .../migrations/precise.fixed | 4 +- .../migrations/precise.rs | 4 +- .../migrations/precise.stderr | 6 +- .../migrations/significant_drop.fixed | 21 ++++--- .../migrations/significant_drop.rs | 21 ++++--- .../migrations/significant_drop.stderr | 58 +++++++++++------- 23 files changed, 198 insertions(+), 112 deletions(-) diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index 53970b485eecd..40492a3dbb9db 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -3001,8 +3001,7 @@ declare_lint! { declare_lint! { /// The `disjoint_capture_migration` lint detects variables that aren't completely - /// captured when the feature `capture_disjoint_fields` is enabled and it affects the Drop - /// order of at least one path starting at this variable. + /// captured in Rust 2021 and affect the Drop order of at least one path starting at this variable. /// It can also detect when a variable implements a trait, but one of its field does not and /// the field is captured by a closure and used with the assumption that said field implements /// the same trait as the root variable. @@ -3039,8 +3038,8 @@ declare_lint! { /// /// ### Explanation /// - /// In the above example `p.y` will be dropped at the end of `f` instead of with `c` if - /// the feature `capture_disjoint_fields` is enabled. + /// In the above example, `p.y` will be dropped at the end of `f` instead of + /// with `c` in Rust 2021. /// /// ### Example of auto-trait /// @@ -3048,7 +3047,7 @@ declare_lint! { /// #![deny(disjoint_capture_migration)] /// use std::thread; /// - /// struct Pointer (*mut i32); + /// struct Pointer(*mut i32); /// unsafe impl Send for Pointer {} /// /// fn main() { @@ -3064,12 +3063,16 @@ declare_lint! { /// /// ### Explanation /// - /// In the above example `fptr.0` is captured when feature `capture_disjoint_fields` is enabled. + /// In the above example, only `fptr.0` is captured in Rust 2021. /// The field is of type *mut i32 which doesn't implement Send, making the code invalid as the /// field cannot be sent between thread safely. pub DISJOINT_CAPTURE_MIGRATION, Allow, - "Drop reorder and auto traits error because of `capture_disjoint_fields`" + "detects closures affected by Rust 2021 changes", + @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2021), + explain_reason: false, + }; } declare_lint_pass!(UnusedDocComment => [UNUSED_DOC_COMMENTS]); diff --git a/compiler/rustc_typeck/src/check/upvar.rs b/compiler/rustc_typeck/src/check/upvar.rs index 4c9c3954624f5..c79933f504487 100644 --- a/compiler/rustc_typeck/src/check/upvar.rs +++ b/compiler/rustc_typeck/src/check/upvar.rs @@ -494,11 +494,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |lint| { let mut diagnostics_builder = lint.build( format!( - "{} affected for closure because of `capture_disjoint_fields`", + "{} will change in Rust 2021", reasons ) .as_str(), ); + diagnostics_builder.note("for more information, see "); let closure_body_span = self.tcx.hir().span(body_id.hir_id); let (sugg, app) = match self.tcx.sess.source_map().span_to_snippet(closure_body_span) { diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.fixed b/src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.fixed index 93e6cf034055a..ee8dd4b4fc33d 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.fixed +++ b/src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.fixed @@ -11,7 +11,7 @@ fn test_send_trait() { let mut f = 10; let fptr = SendPointer(&mut f as *mut i32); thread::spawn(move || { let _ = &fptr; unsafe { - //~^ ERROR: `Send` trait implementation affected for closure because of `capture_disjoint_fields` + //~^ ERROR: `Send` trait implementation //~| HELP: add a dummy let to cause `fptr` to be fully captured *fptr.0 = 20; } }); @@ -28,7 +28,7 @@ fn test_sync_trait() { let f = CustomInt(&mut f as *mut i32); let fptr = SyncPointer(f); thread::spawn(move || { let _ = &fptr; unsafe { - //~^ ERROR: `Sync`, `Send` trait implementation affected for closure because of `capture_disjoint_fields` + //~^ ERROR: `Sync`, `Send` trait implementation //~| HELP: add a dummy let to cause `fptr` to be fully captured *fptr.0.0 = 20; } }); @@ -49,7 +49,7 @@ impl Clone for U { fn test_clone_trait() { let f = U(S(String::from("Hello World")), T(0)); let c = || { let _ = &f; - //~^ ERROR: `Clone` trait implementation, and drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: `Clone` trait implementation, and drop order //~| HELP: add a dummy let to cause `f` to be fully captured let f_1 = f.1; println!("{:?}", f_1.0); diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.rs b/src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.rs index 2c0dbd017548b..7a6dcc55bbba6 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.rs +++ b/src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.rs @@ -11,7 +11,7 @@ fn test_send_trait() { let mut f = 10; let fptr = SendPointer(&mut f as *mut i32); thread::spawn(move || unsafe { - //~^ ERROR: `Send` trait implementation affected for closure because of `capture_disjoint_fields` + //~^ ERROR: `Send` trait implementation //~| HELP: add a dummy let to cause `fptr` to be fully captured *fptr.0 = 20; }); @@ -28,7 +28,7 @@ fn test_sync_trait() { let f = CustomInt(&mut f as *mut i32); let fptr = SyncPointer(f); thread::spawn(move || unsafe { - //~^ ERROR: `Sync`, `Send` trait implementation affected for closure because of `capture_disjoint_fields` + //~^ ERROR: `Sync`, `Send` trait implementation //~| HELP: add a dummy let to cause `fptr` to be fully captured *fptr.0.0 = 20; }); @@ -49,7 +49,7 @@ impl Clone for U { fn test_clone_trait() { let f = U(S(String::from("Hello World")), T(0)); let c = || { - //~^ ERROR: `Clone` trait implementation, and drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: `Clone` trait implementation, and drop order //~| HELP: add a dummy let to cause `f` to be fully captured let f_1 = f.1; println!("{:?}", f_1.0); diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr index 6e3723b8bdb20..d8420f9652e32 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr @@ -1,4 +1,4 @@ -error: `Send` trait implementation affected for closure because of `capture_disjoint_fields` +error: `Send` trait implementation will change in Rust 2021 --> $DIR/auto_traits.rs:13:19 | LL | thread::spawn(move || unsafe { @@ -14,6 +14,7 @@ note: the lint level is defined here | LL | #![deny(disjoint_capture_migration)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: for more information, see help: add a dummy let to cause `fptr` to be fully captured | LL | thread::spawn(move || { let _ = &fptr; unsafe { @@ -23,7 +24,7 @@ LL | *fptr.0 = 20; LL | } }); | -error: `Sync`, `Send` trait implementation affected for closure because of `capture_disjoint_fields` +error: `Sync`, `Send` trait implementation will change in Rust 2021 --> $DIR/auto_traits.rs:30:19 | LL | thread::spawn(move || unsafe { @@ -34,6 +35,7 @@ LL | | *fptr.0.0 = 20; LL | | }); | |_____^ | + = note: for more information, see help: add a dummy let to cause `fptr` to be fully captured | LL | thread::spawn(move || { let _ = &fptr; unsafe { @@ -43,7 +45,7 @@ LL | *fptr.0.0 = 20; LL | } }); | -error: `Clone` trait implementation, and drop order affected for closure because of `capture_disjoint_fields` +error: `Clone` trait implementation, and drop order will change in Rust 2021 --> $DIR/auto_traits.rs:51:13 | LL | let c = || { @@ -55,6 +57,7 @@ LL | | println!("{:?}", f_1.0); LL | | }; | |_____^ | + = note: for more information, see help: add a dummy let to cause `f` to be fully captured | LL | let c = || { let _ = &f; diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.fixed b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.fixed index 3770e93239a8e..4bc9b19642f61 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.fixed +++ b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.fixed @@ -13,7 +13,8 @@ fn test1_all_need_migration() { let t2 = (String::new(), String::new()); let c = || { let _ = (&t, &t1, &t2); - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t`, `t1`, `t2` to be fully captured let _t = t.0; @@ -32,7 +33,8 @@ fn test2_only_precise_paths_need_migration() { let t2 = (String::new(), String::new()); let c = || { let _ = (&t, &t1); - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t`, `t1` to be fully captured let _t = t.0; let _t1 = t1.0; @@ -48,7 +50,8 @@ fn test3_only_by_value_need_migration() { let t = (String::new(), String::new()); let t1 = (String::new(), String::new()); let c = || { let _ = &t; - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; println!("{}", t1.1); @@ -66,7 +69,8 @@ fn test4_only_non_copy_types_need_migration() { let t1 = (0i32, 0i32); let c = || { let _ = &t; - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; let _t1 = t1.0; @@ -84,7 +88,8 @@ fn test5_only_drop_types_need_migration() { let s = S(0i32, 0i32); let c = || { let _ = &t; - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; let _s = s.0; @@ -99,7 +104,8 @@ fn test6_move_closures_non_copy_types_might_need_migration() { let t = (String::new(), String::new()); let t1 = (String::new(), String::new()); let c = move || { let _ = (&t1, &t); - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t1`, `t` to be fully captured println!("{} {}", t1.1, t.1); }; @@ -114,7 +120,8 @@ fn test7_drop_non_drop_aggregate_need_migration() { let t = (String::new(), String::new(), 0i32); let c = || { let _ = &t; - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; }; diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.rs b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.rs index 2015ab7e9b8cb..446ce43a469de 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.rs +++ b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.rs @@ -13,7 +13,8 @@ fn test1_all_need_migration() { let t2 = (String::new(), String::new()); let c = || { - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t`, `t1`, `t2` to be fully captured let _t = t.0; @@ -32,7 +33,8 @@ fn test2_only_precise_paths_need_migration() { let t2 = (String::new(), String::new()); let c = || { - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t`, `t1` to be fully captured let _t = t.0; let _t1 = t1.0; @@ -48,7 +50,8 @@ fn test3_only_by_value_need_migration() { let t = (String::new(), String::new()); let t1 = (String::new(), String::new()); let c = || { - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; println!("{}", t1.1); @@ -66,7 +69,8 @@ fn test4_only_non_copy_types_need_migration() { let t1 = (0i32, 0i32); let c = || { - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; let _t1 = t1.0; @@ -84,7 +88,8 @@ fn test5_only_drop_types_need_migration() { let s = S(0i32, 0i32); let c = || { - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; let _s = s.0; @@ -99,7 +104,8 @@ fn test6_move_closures_non_copy_types_might_need_migration() { let t = (String::new(), String::new()); let t1 = (String::new(), String::new()); let c = move || { - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t1`, `t` to be fully captured println!("{} {}", t1.1, t.1); }; @@ -114,7 +120,8 @@ fn test7_drop_non_drop_aggregate_need_migration() { let t = (String::new(), String::new(), 0i32); let c = || { - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; }; diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.stderr index 69a99f7a53a53..0dfbcddc2795c 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.stderr @@ -1,4 +1,4 @@ -error: drop order affected for closure because of `capture_disjoint_fields` +error: drop order will change in Rust 2021 --> $DIR/insignificant_drop.rs:15:13 | LL | let c = || { @@ -16,141 +16,155 @@ note: the lint level is defined here | LL | #![deny(disjoint_capture_migration)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: for more information, see help: add a dummy let to cause `t`, `t1`, `t2` to be fully captured | LL | let c = || { let _ = (&t, &t1, &t2); LL | LL | +LL | LL | LL | let _t = t.0; -LL | let _t1 = t1.0; ... -error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/insignificant_drop.rs:34:13 +error: drop order will change in Rust 2021 + --> $DIR/insignificant_drop.rs:35:13 | LL | let c = || { | _____________^ LL | | LL | | -LL | | let _t = t.0; -LL | | let _t1 = t1.0; +LL | | +... | LL | | let _t2 = t2; LL | | }; | |_____^ | + = note: for more information, see help: add a dummy let to cause `t`, `t1` to be fully captured | LL | let c = || { let _ = (&t, &t1); LL | LL | +LL | LL | let _t = t.0; LL | let _t1 = t1.0; -LL | let _t2 = t2; ... -error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/insignificant_drop.rs:50:13 +error: drop order will change in Rust 2021 + --> $DIR/insignificant_drop.rs:52:13 | LL | let c = || { | _____________^ LL | | LL | | +LL | | LL | | let _t = t.0; LL | | println!("{}", t1.1); LL | | }; | |_____^ | + = note: for more information, see help: add a dummy let to cause `t` to be fully captured | LL | let c = || { let _ = &t; LL | LL | +LL | LL | let _t = t.0; LL | println!("{}", t1.1); -LL | }; - | + ... -error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/insignificant_drop.rs:68:13 +error: drop order will change in Rust 2021 + --> $DIR/insignificant_drop.rs:71:13 | LL | let c = || { | _____________^ LL | | LL | | +LL | | LL | | let _t = t.0; LL | | let _t1 = t1.0; LL | | }; | |_____^ | + = note: for more information, see help: add a dummy let to cause `t` to be fully captured | LL | let c = || { let _ = &t; LL | LL | +LL | LL | let _t = t.0; LL | let _t1 = t1.0; -LL | }; - | + ... -error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/insignificant_drop.rs:86:13 +error: drop order will change in Rust 2021 + --> $DIR/insignificant_drop.rs:90:13 | LL | let c = || { | _____________^ LL | | LL | | +LL | | LL | | let _t = t.0; LL | | let _s = s.0; LL | | }; | |_____^ | + = note: for more information, see help: add a dummy let to cause `t` to be fully captured | LL | let c = || { let _ = &t; LL | LL | +LL | LL | let _t = t.0; LL | let _s = s.0; -LL | }; - | + ... -error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/insignificant_drop.rs:101:13 +error: drop order will change in Rust 2021 + --> $DIR/insignificant_drop.rs:106:13 | LL | let c = move || { | _____________^ LL | | LL | | +LL | | LL | | println!("{} {}", t1.1, t.1); LL | | }; | |_____^ | + = note: for more information, see help: add a dummy let to cause `t1`, `t` to be fully captured | LL | let c = move || { let _ = (&t1, &t); LL | LL | +LL | LL | println!("{} {}", t1.1, t.1); LL | }; | -error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/insignificant_drop.rs:116:13 +error: drop order will change in Rust 2021 + --> $DIR/insignificant_drop.rs:122:13 | LL | let c = || { | _____________^ LL | | LL | | +LL | | LL | | let _t = t.0; LL | | }; | |_____^ | + = note: for more information, see help: add a dummy let to cause `t` to be fully captured | LL | let c = || { let _ = &t; LL | LL | +LL | LL | let _t = t.0; LL | }; | diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop_attr_migrations.fixed b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop_attr_migrations.fixed index e89cc2c8fb361..5a781219a72e0 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop_attr_migrations.fixed +++ b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop_attr_migrations.fixed @@ -36,7 +36,8 @@ fn significant_drop_needs_migration() { let t = (SigDrop {}, SigDrop {}); let c = || { let _ = &t; - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; }; @@ -53,7 +54,8 @@ fn generic_struct_with_significant_drop_needs_migration() { // move is used to force i32 to be copied instead of being a ref let c = move || { let _ = &t; - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.1; }; diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop_attr_migrations.rs b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop_attr_migrations.rs index e16cd9d52b78c..d57da3265565e 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop_attr_migrations.rs +++ b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop_attr_migrations.rs @@ -36,7 +36,8 @@ fn significant_drop_needs_migration() { let t = (SigDrop {}, SigDrop {}); let c = || { - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; }; @@ -53,7 +54,8 @@ fn generic_struct_with_significant_drop_needs_migration() { // move is used to force i32 to be copied instead of being a ref let c = move || { - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.1; }; diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop_attr_migrations.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop_attr_migrations.stderr index 2b141656be2a8..d25f8f635be88 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop_attr_migrations.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop_attr_migrations.stderr @@ -1,10 +1,11 @@ -error: drop order affected for closure because of `capture_disjoint_fields` +error: drop order will change in Rust 2021 --> $DIR/insignificant_drop_attr_migrations.rs:38:13 | LL | let c = || { | _____________^ LL | | LL | | +LL | | LL | | let _t = t.0; LL | | }; | |_____^ @@ -14,31 +15,36 @@ note: the lint level is defined here | LL | #![deny(disjoint_capture_migration)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: for more information, see help: add a dummy let to cause `t` to be fully captured | LL | let c = || { let _ = &t; LL | LL | +LL | LL | let _t = t.0; LL | }; | -error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/insignificant_drop_attr_migrations.rs:55:13 +error: drop order will change in Rust 2021 + --> $DIR/insignificant_drop_attr_migrations.rs:56:13 | LL | let c = move || { | _____________^ LL | | LL | | +LL | | LL | | let _t = t.1; LL | | }; | |_____^ | + = note: for more information, see help: add a dummy let to cause `t` to be fully captured | LL | let c = move || { let _ = &t; LL | LL | +LL | LL | let _t = t.1; LL | }; | diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.fixed b/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.fixed index 979c023fc53ac..42b6ce54d3c08 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.fixed +++ b/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.fixed @@ -17,7 +17,8 @@ impl Drop for Foo { fn closure_contains_block() { let t = (Foo(0), Foo(0)); let c = || { let _ = &t; - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; }; @@ -28,7 +29,8 @@ fn closure_contains_block() { fn closure_doesnt_contain_block() { let t = (Foo(0), Foo(0)); let c = || { let _ = &t; t.0 }; - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t` to be fully captured c(); diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.rs b/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.rs index c2a700bd9caa0..ab0ed460fbaf4 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.rs +++ b/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.rs @@ -17,7 +17,8 @@ impl Drop for Foo { fn closure_contains_block() { let t = (Foo(0), Foo(0)); let c = || { - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; }; @@ -28,7 +29,8 @@ fn closure_contains_block() { fn closure_doesnt_contain_block() { let t = (Foo(0), Foo(0)); let c = || t.0; - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t` to be fully captured c(); diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.stderr index a968d3a093b15..7b654f480a372 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.stderr @@ -1,10 +1,11 @@ -error: drop order affected for closure because of `capture_disjoint_fields` +error: drop order will change in Rust 2021 --> $DIR/migrations_rustfix.rs:19:13 | LL | let c = || { | _____________^ LL | | LL | | +LL | | LL | | let _t = t.0; LL | | }; | |_____^ @@ -14,21 +15,24 @@ note: the lint level is defined here | LL | #![deny(disjoint_capture_migration)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: for more information, see help: add a dummy let to cause `t` to be fully captured | LL | let c = || { let _ = &t; LL | LL | +LL | LL | let _t = t.0; LL | }; | -error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/migrations_rustfix.rs:30:13 +error: drop order will change in Rust 2021 + --> $DIR/migrations_rustfix.rs:31:13 | LL | let c = || t.0; | ^^^^^^ | + = note: for more information, see help: add a dummy let to cause `t` to be fully captured | LL | let c = || { let _ = &t; t.0 }; diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.fixed b/src/test/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.fixed index 95463a62185e9..abff6802e9586 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.fixed +++ b/src/test/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.fixed @@ -13,7 +13,7 @@ fn foo_diverges() -> ! { panic!() } fn assert_panics(f: F) where F: FnOnce() { let f = panic::AssertUnwindSafe(f); let result = panic::catch_unwind(move || { let _ = &f; - //~^ ERROR: `UnwindSafe`, `RefUnwindSafe` trait implementation affected for closure because of `capture_disjoint_fields` + //~^ ERROR: `UnwindSafe`, `RefUnwindSafe` trait implementation //~| HELP: add a dummy let to cause `f` to be fully captured f.0() }); diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.rs b/src/test/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.rs index fae7fc87c0285..baa17e85b5217 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.rs +++ b/src/test/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.rs @@ -13,7 +13,7 @@ fn foo_diverges() -> ! { panic!() } fn assert_panics(f: F) where F: FnOnce() { let f = panic::AssertUnwindSafe(f); let result = panic::catch_unwind(move || { - //~^ ERROR: `UnwindSafe`, `RefUnwindSafe` trait implementation affected for closure because of `capture_disjoint_fields` + //~^ ERROR: `UnwindSafe`, `RefUnwindSafe` trait implementation //~| HELP: add a dummy let to cause `f` to be fully captured f.0() }); diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.stderr index bbc8eb9a9cd25..8dca06a836ca3 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.stderr @@ -1,4 +1,4 @@ -error: `UnwindSafe`, `RefUnwindSafe` trait implementation affected for closure because of `capture_disjoint_fields` +error: `UnwindSafe`, `RefUnwindSafe` trait implementation will change in Rust 2021 --> $DIR/mir_calls_to_shims.rs:15:38 | LL | let result = panic::catch_unwind(move || { @@ -14,6 +14,7 @@ note: the lint level is defined here | LL | #![deny(disjoint_capture_migration)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: for more information, see help: add a dummy let to cause `f` to be fully captured | LL | let result = panic::catch_unwind(move || { let _ = &f; diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/precise.fixed b/src/test/ui/closures/2229_closure_analysis/migrations/precise.fixed index 5c93fce92507b..90ea1ed28836d 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/precise.fixed +++ b/src/test/ui/closures/2229_closure_analysis/migrations/precise.fixed @@ -17,7 +17,7 @@ fn test_precise_analysis_drop_paths_not_captured_by_move() { let t = ConstainsDropField(Foo(10), Foo(20)); let c = || { let _ = &t; - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; let _t = &t.1; @@ -40,7 +40,7 @@ fn test_precise_analysis_long_path_missing() { let u = U(T(S, S), T(S, S)); let c = || { let _ = &u; - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order //~| HELP: add a dummy let to cause `u` to be fully captured let _x = u.0.0; let _x = u.0.1; diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/precise.rs b/src/test/ui/closures/2229_closure_analysis/migrations/precise.rs index fb4af00aa0616..cb43230459262 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/precise.rs +++ b/src/test/ui/closures/2229_closure_analysis/migrations/precise.rs @@ -17,7 +17,7 @@ fn test_precise_analysis_drop_paths_not_captured_by_move() { let t = ConstainsDropField(Foo(10), Foo(20)); let c = || { - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; let _t = &t.1; @@ -40,7 +40,7 @@ fn test_precise_analysis_long_path_missing() { let u = U(T(S, S), T(S, S)); let c = || { - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order //~| HELP: add a dummy let to cause `u` to be fully captured let _x = u.0.0; let _x = u.0.1; diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/precise.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/precise.stderr index 0cd191e2c98c5..f010c51f1361e 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/precise.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/precise.stderr @@ -1,4 +1,4 @@ -error: drop order affected for closure because of `capture_disjoint_fields` +error: drop order will change in Rust 2021 --> $DIR/precise.rs:19:13 | LL | let c = || { @@ -15,6 +15,7 @@ note: the lint level is defined here | LL | #![deny(disjoint_capture_migration)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: for more information, see help: add a dummy let to cause `t` to be fully captured | LL | let c = || { let _ = &t; @@ -25,7 +26,7 @@ LL | let _t = &t.1; LL | }; | -error: drop order affected for closure because of `capture_disjoint_fields` +error: drop order will change in Rust 2021 --> $DIR/precise.rs:42:13 | LL | let c = || { @@ -38,6 +39,7 @@ LL | | let _x = u.1.0; LL | | }; | |_____^ | + = note: for more information, see help: add a dummy let to cause `u` to be fully captured | LL | let c = || { let _ = &u; diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.fixed b/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.fixed index 1fa0fb3db2f8d..1c970175d182d 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.fixed +++ b/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.fixed @@ -23,7 +23,8 @@ fn test1_all_need_migration() { let t2 = (Foo(0), Foo(0)); let c = || { let _ = (&t, &t1, &t2); - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t`, `t1`, `t2` to be fully captured let _t = t.0; let _t1 = t1.0; @@ -41,7 +42,8 @@ fn test2_only_precise_paths_need_migration() { let t2 = (Foo(0), Foo(0)); let c = || { let _ = (&t, &t1); - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t`, `t1` to be fully captured let _t = t.0; let _t1 = t1.0; @@ -57,7 +59,8 @@ fn test3_only_by_value_need_migration() { let t = (Foo(0), Foo(0)); let t1 = (Foo(0), Foo(0)); let c = || { let _ = &t; - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; println!("{:?}", t1.1); @@ -74,7 +77,8 @@ fn test4_type_contains_drop_need_migration() { let t = ConstainsDropField(Foo(0), Foo(0)); let c = || { let _ = &t; - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; }; @@ -89,7 +93,8 @@ fn test5_drop_non_drop_aggregate_need_migration() { let t = (Foo(0), Foo(0), 0i32); let c = || { let _ = &t; - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; }; @@ -102,7 +107,8 @@ fn test6_significant_insignificant_drop_aggregate_need_migration() { let t = (Foo(0), String::new()); let c = || { let _ = &t; - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.1; }; @@ -117,7 +123,8 @@ fn test7_move_closures_non_copy_types_might_need_migration() { let t1 = (Foo(0), Foo(0), Foo(0)); let c = move || { let _ = (&t1, &t); - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t1`, `t` to be fully captured println!("{:?} {:?}", t1.1, t.1); }; diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.rs b/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.rs index 1f0efbe1ebc43..c479a6a54f09b 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.rs +++ b/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.rs @@ -23,7 +23,8 @@ fn test1_all_need_migration() { let t2 = (Foo(0), Foo(0)); let c = || { - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t`, `t1`, `t2` to be fully captured let _t = t.0; let _t1 = t1.0; @@ -41,7 +42,8 @@ fn test2_only_precise_paths_need_migration() { let t2 = (Foo(0), Foo(0)); let c = || { - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t`, `t1` to be fully captured let _t = t.0; let _t1 = t1.0; @@ -57,7 +59,8 @@ fn test3_only_by_value_need_migration() { let t = (Foo(0), Foo(0)); let t1 = (Foo(0), Foo(0)); let c = || { - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; println!("{:?}", t1.1); @@ -74,7 +77,8 @@ fn test4_type_contains_drop_need_migration() { let t = ConstainsDropField(Foo(0), Foo(0)); let c = || { - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; }; @@ -89,7 +93,8 @@ fn test5_drop_non_drop_aggregate_need_migration() { let t = (Foo(0), Foo(0), 0i32); let c = || { - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.0; }; @@ -102,7 +107,8 @@ fn test6_significant_insignificant_drop_aggregate_need_migration() { let t = (Foo(0), String::new()); let c = || { - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t` to be fully captured let _t = t.1; }; @@ -117,7 +123,8 @@ fn test7_move_closures_non_copy_types_might_need_migration() { let t1 = (Foo(0), Foo(0), Foo(0)); let c = move || { - //~^ ERROR: drop order affected for closure because of `capture_disjoint_fields` + //~^ ERROR: drop order + //~| NOTE: for more information, see //~| HELP: add a dummy let to cause `t1`, `t` to be fully captured println!("{:?} {:?}", t1.1, t.1); }; diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.stderr index 91e75ffb81a96..873a9100bee4b 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.stderr @@ -1,12 +1,12 @@ -error: drop order affected for closure because of `capture_disjoint_fields` +error: drop order will change in Rust 2021 --> $DIR/significant_drop.rs:25:13 | LL | let c = || { | _____________^ LL | | LL | | -LL | | let _t = t.0; -LL | | let _t1 = t1.0; +LL | | +... | LL | | let _t2 = t2.0; LL | | }; | |_____^ @@ -16,137 +16,153 @@ note: the lint level is defined here | LL | #![deny(disjoint_capture_migration)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: for more information, see help: add a dummy let to cause `t`, `t1`, `t2` to be fully captured | LL | let c = || { let _ = (&t, &t1, &t2); LL | LL | +LL | LL | let _t = t.0; LL | let _t1 = t1.0; -LL | let _t2 = t2.0; ... -error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/significant_drop.rs:43:13 +error: drop order will change in Rust 2021 + --> $DIR/significant_drop.rs:44:13 | LL | let c = || { | _____________^ LL | | LL | | -LL | | let _t = t.0; -LL | | let _t1 = t1.0; +LL | | +... | LL | | let _t2 = t2; LL | | }; | |_____^ | + = note: for more information, see help: add a dummy let to cause `t`, `t1` to be fully captured | LL | let c = || { let _ = (&t, &t1); LL | LL | +LL | LL | let _t = t.0; LL | let _t1 = t1.0; -LL | let _t2 = t2; ... -error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/significant_drop.rs:59:13 +error: drop order will change in Rust 2021 + --> $DIR/significant_drop.rs:61:13 | LL | let c = || { | _____________^ LL | | LL | | +LL | | LL | | let _t = t.0; LL | | println!("{:?}", t1.1); LL | | }; | |_____^ | + = note: for more information, see help: add a dummy let to cause `t` to be fully captured | LL | let c = || { let _ = &t; LL | LL | +LL | LL | let _t = t.0; LL | println!("{:?}", t1.1); -LL | }; - | + ... -error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/significant_drop.rs:76:13 +error: drop order will change in Rust 2021 + --> $DIR/significant_drop.rs:79:13 | LL | let c = || { | _____________^ LL | | LL | | +LL | | LL | | let _t = t.0; LL | | }; | |_____^ | + = note: for more information, see help: add a dummy let to cause `t` to be fully captured | LL | let c = || { let _ = &t; LL | LL | +LL | LL | let _t = t.0; LL | }; | -error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/significant_drop.rs:91:13 +error: drop order will change in Rust 2021 + --> $DIR/significant_drop.rs:95:13 | LL | let c = || { | _____________^ LL | | LL | | +LL | | LL | | let _t = t.0; LL | | }; | |_____^ | + = note: for more information, see help: add a dummy let to cause `t` to be fully captured | LL | let c = || { let _ = &t; LL | LL | +LL | LL | let _t = t.0; LL | }; | -error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/significant_drop.rs:104:13 +error: drop order will change in Rust 2021 + --> $DIR/significant_drop.rs:109:13 | LL | let c = || { | _____________^ LL | | LL | | +LL | | LL | | let _t = t.1; LL | | }; | |_____^ | + = note: for more information, see help: add a dummy let to cause `t` to be fully captured | LL | let c = || { let _ = &t; LL | LL | +LL | LL | let _t = t.1; LL | }; | -error: drop order affected for closure because of `capture_disjoint_fields` - --> $DIR/significant_drop.rs:119:13 +error: drop order will change in Rust 2021 + --> $DIR/significant_drop.rs:125:13 | LL | let c = move || { | _____________^ LL | | LL | | +LL | | LL | | println!("{:?} {:?}", t1.1, t.1); LL | | }; | |_____^ | + = note: for more information, see help: add a dummy let to cause `t1`, `t` to be fully captured | LL | let c = move || { let _ = (&t1, &t); LL | LL | +LL | LL | println!("{:?} {:?}", t1.1, t.1); LL | }; | From f333b4795c53991e513ec06f25f496c9d8075c88 Mon Sep 17 00:00:00 2001 From: Fabian Wolff Date: Mon, 28 Jun 2021 00:56:24 +0200 Subject: [PATCH 07/13] Fix garbled suggestion for missing lifetime specifier --- .../rustc_resolve/src/late/diagnostics.rs | 2 ++ src/test/ui/suggestions/issue-86667.rs | 16 +++++++++++ src/test/ui/suggestions/issue-86667.stderr | 27 +++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 src/test/ui/suggestions/issue-86667.rs create mode 100644 src/test/ui/suggestions/issue-86667.stderr diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index 03b578d4adeec..76979ab50b9e6 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -1962,6 +1962,8 @@ impl<'tcx> LifetimeContext<'_, 'tcx> { hir::GenericParamKind::Type { synthetic: Some(hir::SyntheticTyParamKind::ImplTrait), .. + } | hir::GenericParamKind::Lifetime { + kind: hir::LifetimeParamKind::Elided } ) }) { diff --git a/src/test/ui/suggestions/issue-86667.rs b/src/test/ui/suggestions/issue-86667.rs new file mode 100644 index 0000000000000..6aceb13746937 --- /dev/null +++ b/src/test/ui/suggestions/issue-86667.rs @@ -0,0 +1,16 @@ +// Regression test for #86667, where a garbled suggestion was issued for +// a missing named lifetime parameter. + +// compile-flags: --edition 2018 + +async fn a(s1: &str, s2: &str) -> &str { +//~^ ERROR: missing lifetime specifier [E0106] + s1 +} + +fn b(s1: &str, s2: &str) -> &str { +//~^ ERROR: missing lifetime specifier [E0106] + s1 +} + +fn main() {} diff --git a/src/test/ui/suggestions/issue-86667.stderr b/src/test/ui/suggestions/issue-86667.stderr new file mode 100644 index 0000000000000..77f7f874a4e42 --- /dev/null +++ b/src/test/ui/suggestions/issue-86667.stderr @@ -0,0 +1,27 @@ +error[E0106]: missing lifetime specifier + --> $DIR/issue-86667.rs:6:35 + | +LL | async fn a(s1: &str, s2: &str) -> &str { + | ---- ---- ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `s1` or `s2` +help: consider introducing a named lifetime parameter + | +LL | async fn a<'a>(s1: &'a str, s2: &'a str) -> &'a str { + | ^^^^ ^^^^^^^ ^^^^^^^ ^^^ + +error[E0106]: missing lifetime specifier + --> $DIR/issue-86667.rs:11:29 + | +LL | fn b(s1: &str, s2: &str) -> &str { + | ---- ---- ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `s1` or `s2` +help: consider introducing a named lifetime parameter + | +LL | fn b<'a>(s1: &'a str, s2: &'a str) -> &'a str { + | ^^^^ ^^^^^^^ ^^^^^^^ ^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0106`. From b89ea96660fd403d25b7da5ded5944571b1af268 Mon Sep 17 00:00:00 2001 From: Aman Arora Date: Sun, 27 Jun 2021 02:22:46 -0400 Subject: [PATCH 08/13] Editon 2021 enables precise capture --- .../src/build/expr/as_place.rs | 12 ++- .../arrays-completely-captured.rs | 5 +- .../arrays-completely-captured.stderr | 21 ++-- .../2229_closure_analysis/by_value.rs | 8 +- .../2229_closure_analysis/by_value.stderr | 27 ++---- .../capture-analysis-1.rs | 6 +- .../capture-analysis-1.stderr | 29 ++---- .../capture-analysis-2.rs | 6 +- .../capture-analysis-2.stderr | 23 ++--- .../capture-analysis-3.rs | 6 +- .../capture-analysis-3.stderr | 23 ++--- .../capture-analysis-4.rs | 6 +- .../capture-analysis-4.stderr | 23 ++--- .../capture-disjoint-field-struct.rs | 6 +- .../capture-disjoint-field-struct.stderr | 21 ++-- .../capture-disjoint-field-tuple.rs | 6 +- .../capture-disjoint-field-tuple.stderr | 21 ++-- .../2229_closure_analysis/capture-enums.rs | 6 +- .../capture-enums.stderr | 39 +++----- .../deep-multilevel-struct.rs | 6 +- .../deep-multilevel-struct.stderr | 25 ++--- .../deep-multilevel-tuple.rs | 5 +- .../deep-multilevel-tuple.stderr | 25 ++--- .../destructure_patterns.rs | 6 +- .../destructure_patterns.stderr | 53 +++++------ .../diagnostics/arrays.rs | 5 +- .../diagnostics/arrays.stderr | 25 ++--- .../diagnostics/borrowck/borrowck-1.rs | 3 +- .../diagnostics/borrowck/borrowck-1.stderr | 13 +-- .../diagnostics/borrowck/borrowck-2.rs | 3 +- .../diagnostics/borrowck/borrowck-2.stderr | 13 +-- .../diagnostics/borrowck/borrowck-3.rs | 3 +- .../diagnostics/borrowck/borrowck-3.stderr | 13 +-- .../diagnostics/borrowck/borrowck-4.rs | 3 +- .../diagnostics/borrowck/borrowck-4.stderr | 15 +-- .../borrowck/borrowck-closures-mut-and-imm.rs | 4 +- .../borrowck-closures-mut-and-imm.stderr | 11 +-- .../2229_closure_analysis/diagnostics/box.rs | 5 +- .../diagnostics/box.stderr | 17 +--- .../diagnostics/cant-mutate-imm-borrow.rs | 5 +- .../diagnostics/cant-mutate-imm-borrow.stderr | 13 +-- .../diagnostics/cant-mutate-imm.rs | 3 +- .../diagnostics/cant-mutate-imm.stderr | 15 +-- .../closure-origin-array-diagnostics.rs | 5 +- .../closure-origin-array-diagnostics.stderr | 13 +-- ...losure-origin-multi-variant-diagnostics.rs | 6 +- ...re-origin-multi-variant-diagnostics.stderr | 15 +-- ...osure-origin-single-variant-diagnostics.rs | 6 +- ...e-origin-single-variant-diagnostics.stderr | 15 +-- .../closure-origin-struct-diagnostics.rs | 5 +- .../closure-origin-struct-diagnostics.stderr | 15 +-- .../closure-origin-tuple-diagnostics-1.rs | 5 +- .../closure-origin-tuple-diagnostics-1.stderr | 15 +-- .../closure-origin-tuple-diagnostics.rs | 6 +- .../closure-origin-tuple-diagnostics.stderr | 13 +-- .../diagnostics/liveness.rs | 4 +- .../diagnostics/liveness.stderr | 11 +-- .../liveness_unintentional_copy.rs | 4 +- .../liveness_unintentional_copy.stderr | 11 +-- .../diagnostics/multilevel-path.rs | 4 +- .../diagnostics/multilevel-path.stderr | 11 +-- .../diagnostics/mut_ref.rs | 5 +- .../diagnostics/mut_ref.stderr | 15 +-- .../diagnostics/repr_packed.rs | 5 +- .../diagnostics/repr_packed.stderr | 13 +-- .../diagnostics/simple-struct-min-capture.rs | 5 +- .../simple-struct-min-capture.stderr | 13 +-- .../feature-gate-capture_disjoint_fields.rs | 6 +- ...eature-gate-capture_disjoint_fields.stderr | 21 ++-- .../filter-on-struct-member.rs | 6 +- .../filter-on-struct-member.stderr | 19 +--- .../2229_closure_analysis/move_closure.rs | 6 +- .../2229_closure_analysis/move_closure.stderr | 95 +++++++++---------- .../multilevel-path-1.rs | 6 +- .../multilevel-path-1.stderr | 21 ++-- .../multilevel-path-2.rs | 6 +- .../multilevel-path-2.stderr | 21 ++-- .../2229_closure_analysis/nested-closure.rs | 6 +- .../nested-closure.stderr | 39 +++----- .../path-with-array-access.rs | 6 +- .../path-with-array-access.stderr | 21 ++-- .../pattern-matching-should-fail.rs | 6 +- .../pattern-matching-should-fail.stderr | 27 ++---- .../patterns-capture-analysis.rs | 6 +- .../patterns-capture-analysis.stderr | 55 +++++------ .../2229_closure_analysis/repr_packed.rs | 5 +- .../2229_closure_analysis/repr_packed.stderr | 47 ++++----- .../2229_closure_analysis/run_pass/box.rs | 7 +- .../2229_closure_analysis/run_pass/box.stderr | 11 --- .../run_pass/by_value.rs | 4 +- .../run_pass/by_value.stderr | 11 --- .../run_pass/capture-disjoint-field-struct.rs | 6 +- .../capture-disjoint-field-struct.stderr | 11 --- .../capture-disjoint-field-tuple-mut.rs | 5 +- .../capture-disjoint-field-tuple-mut.stderr | 11 --- .../run_pass/capture-disjoint-field-tuple.rs | 5 +- .../capture-disjoint-field-tuple.stderr | 11 --- .../run_pass/capture_with_wildcard_match.rs | 3 +- .../capture_with_wildcard_match.stderr | 11 --- ...tructure-pattern-closure-within-closure.rs | 5 +- ...ture-pattern-closure-within-closure.stderr | 17 +--- .../run_pass/destructure_patterns.rs | 5 +- .../run_pass/destructure_patterns.stderr | 29 ++---- .../disjoint-capture-in-same-closure.rs | 6 +- .../disjoint-capture-in-same-closure.stderr | 11 --- .../run_pass/drop_then_use_fake_reads.rs | 5 +- .../run_pass/drop_then_use_fake_reads.stderr | 11 --- .../run_pass/filter-on-struct-member.rs | 6 +- .../run_pass/filter-on-struct-member.stderr | 11 --- .../run_pass/fru_syntax.rs | 6 +- .../run_pass/fru_syntax.stderr | 11 --- .../lit-pattern-matching-with-methods.rs | 3 +- .../lit-pattern-matching-with-methods.stderr | 11 --- .../run_pass/move_closure.rs | 4 +- .../run_pass/move_closure.stderr | 11 --- .../run_pass/multilevel-path-1.rs | 5 +- .../run_pass/multilevel-path-1.stderr | 11 --- .../run_pass/multilevel-path-2.rs | 5 +- .../run_pass/multilevel-path-2.stderr | 11 --- .../run_pass/multilevel-path-3.rs | 5 +- .../run_pass/multilevel-path-3.stderr | 11 --- .../2229_closure_analysis/run_pass/mut_ref.rs | 4 +- .../run_pass/mut_ref.stderr | 11 --- .../run_pass/mut_ref_struct_mem.rs | 4 +- .../run_pass/mut_ref_struct_mem.stderr | 11 --- .../run_pass/nested-closure.rs | 6 +- .../run_pass/nested-closure.stderr | 11 --- .../struct-pattern-matching-with-methods.rs | 3 +- ...truct-pattern-matching-with-methods.stderr | 11 --- ...le-struct-pattern-matching-with-methods.rs | 3 +- ...truct-pattern-matching-with-methods.stderr | 11 --- .../run_pass/unsafe_ptr.rs | 4 +- .../run_pass/unsafe_ptr.stderr | 11 --- .../use_of_mutable_borrow_and_fake_reads.rs | 3 +- ...se_of_mutable_borrow_and_fake_reads.stderr | 11 --- .../simple-struct-min-capture.rs | 6 +- .../simple-struct-min-capture.stderr | 23 ++--- .../2229_closure_analysis/unsafe_ptr.rs | 7 +- .../2229_closure_analysis/unsafe_ptr.stderr | 31 +++--- .../2229_closure_analysis/wild_patterns.rs | 6 +- .../wild_patterns.stderr | 41 ++++---- 141 files changed, 462 insertions(+), 1280 deletions(-) delete mode 100644 src/test/ui/closures/2229_closure_analysis/run_pass/box.stderr delete mode 100644 src/test/ui/closures/2229_closure_analysis/run_pass/by_value.stderr delete mode 100644 src/test/ui/closures/2229_closure_analysis/run_pass/capture-disjoint-field-struct.stderr delete mode 100644 src/test/ui/closures/2229_closure_analysis/run_pass/capture-disjoint-field-tuple-mut.stderr delete mode 100644 src/test/ui/closures/2229_closure_analysis/run_pass/capture-disjoint-field-tuple.stderr delete mode 100644 src/test/ui/closures/2229_closure_analysis/run_pass/capture_with_wildcard_match.stderr delete mode 100644 src/test/ui/closures/2229_closure_analysis/run_pass/disjoint-capture-in-same-closure.stderr delete mode 100644 src/test/ui/closures/2229_closure_analysis/run_pass/drop_then_use_fake_reads.stderr delete mode 100644 src/test/ui/closures/2229_closure_analysis/run_pass/filter-on-struct-member.stderr delete mode 100644 src/test/ui/closures/2229_closure_analysis/run_pass/fru_syntax.stderr delete mode 100644 src/test/ui/closures/2229_closure_analysis/run_pass/lit-pattern-matching-with-methods.stderr delete mode 100644 src/test/ui/closures/2229_closure_analysis/run_pass/move_closure.stderr delete mode 100644 src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-1.stderr delete mode 100644 src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-2.stderr delete mode 100644 src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-3.stderr delete mode 100644 src/test/ui/closures/2229_closure_analysis/run_pass/mut_ref.stderr delete mode 100644 src/test/ui/closures/2229_closure_analysis/run_pass/mut_ref_struct_mem.stderr delete mode 100644 src/test/ui/closures/2229_closure_analysis/run_pass/nested-closure.stderr delete mode 100644 src/test/ui/closures/2229_closure_analysis/run_pass/struct-pattern-matching-with-methods.stderr delete mode 100644 src/test/ui/closures/2229_closure_analysis/run_pass/tuple-struct-pattern-matching-with-methods.stderr delete mode 100644 src/test/ui/closures/2229_closure_analysis/run_pass/unsafe_ptr.stderr delete mode 100644 src/test/ui/closures/2229_closure_analysis/run_pass/use_of_mutable_borrow_and_fake_reads.stderr diff --git a/compiler/rustc_mir_build/src/build/expr/as_place.rs b/compiler/rustc_mir_build/src/build/expr/as_place.rs index 5511cd4c73b7d..9d7ac6ef6ac46 100644 --- a/compiler/rustc_mir_build/src/build/expr/as_place.rs +++ b/compiler/rustc_mir_build/src/build/expr/as_place.rs @@ -217,6 +217,10 @@ fn to_upvars_resolved_place_builder<'a, 'tcx>( ty::ClosureKind::FnOnce => {} } + // We won't be building MIR if the closure wasn't local + let closure_hir_id = tcx.hir().local_def_id_to_hir_id(closure_def_id.expect_local()); + let closure_span = tcx.hir().span(closure_hir_id); + let (capture_index, capture) = if let Some(capture_details) = find_capture_matching_projections( typeck_results, @@ -226,7 +230,7 @@ fn to_upvars_resolved_place_builder<'a, 'tcx>( ) { capture_details } else { - if !tcx.features().capture_disjoint_fields { + if !enable_precise_capture(tcx, closure_span) { bug!( "No associated capture found for {:?}[{:#?}] even though \ capture_disjoint_fields isn't enabled", @@ -780,3 +784,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { } } } + +/// Precise capture is enabled if the feature gate `capture_disjoint_fields` is enabled or if +/// user is using Rust Edition 2021 or higher. +fn enable_precise_capture(tcx: TyCtxt<'_>, closure_span: Span) -> bool { + tcx.features().capture_disjoint_fields || closure_span.rust_2021() +} diff --git a/src/test/ui/closures/2229_closure_analysis/arrays-completely-captured.rs b/src/test/ui/closures/2229_closure_analysis/arrays-completely-captured.rs index 131af6a10c898..7a4b21f022365 100644 --- a/src/test/ui/closures/2229_closure_analysis/arrays-completely-captured.rs +++ b/src/test/ui/closures/2229_closure_analysis/arrays-completely-captured.rs @@ -1,7 +1,4 @@ -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| `#[warn(incomplete_features)]` on by default -//~| see issue #53488 +// edition:2021 #![feature(rustc_attrs)] // Ensure that capture analysis results in arrays being completely captured. diff --git a/src/test/ui/closures/2229_closure_analysis/arrays-completely-captured.stderr b/src/test/ui/closures/2229_closure_analysis/arrays-completely-captured.stderr index 2a350f3033192..69ec53447b8a6 100644 --- a/src/test/ui/closures/2229_closure_analysis/arrays-completely-captured.stderr +++ b/src/test/ui/closures/2229_closure_analysis/arrays-completely-captured.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes on expressions are experimental - --> $DIR/arrays-completely-captured.rs:11:17 + --> $DIR/arrays-completely-captured.rs:8:17 | LL | let mut c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,17 +7,8 @@ LL | let mut c = #[rustc_capture_analysis] = note: see issue #15701 for more information = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/arrays-completely-captured.rs:1:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error: First Pass analysis includes: - --> $DIR/arrays-completely-captured.rs:14:5 + --> $DIR/arrays-completely-captured.rs:11:5 | LL | / || { LL | | @@ -29,13 +20,13 @@ LL | | }; | |_____^ | note: Capturing m[] -> MutBorrow - --> $DIR/arrays-completely-captured.rs:17:9 + --> $DIR/arrays-completely-captured.rs:14:9 | LL | m[0] += 10; | ^ error: Min Capture analysis includes: - --> $DIR/arrays-completely-captured.rs:14:5 + --> $DIR/arrays-completely-captured.rs:11:5 | LL | / || { LL | | @@ -47,11 +38,11 @@ LL | | }; | |_____^ | note: Min Capture m[] -> MutBorrow - --> $DIR/arrays-completely-captured.rs:17:9 + --> $DIR/arrays-completely-captured.rs:14:9 | LL | m[0] += 10; | ^ -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/by_value.rs b/src/test/ui/closures/2229_closure_analysis/by_value.rs index 27c8fb1363f17..02a243e050646 100644 --- a/src/test/ui/closures/2229_closure_analysis/by_value.rs +++ b/src/test/ui/closures/2229_closure_analysis/by_value.rs @@ -1,11 +1,7 @@ +// edition:2021 + // Test that we handle derferences properly when only some of the captures are being moved with // `capture_disjoint_fields` enabled. - - -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 #![feature(rustc_attrs)] #[derive(Debug, Default)] diff --git a/src/test/ui/closures/2229_closure_analysis/by_value.stderr b/src/test/ui/closures/2229_closure_analysis/by_value.stderr index 944e4c40a78ef..7014ae6a5e6af 100644 --- a/src/test/ui/closures/2229_closure_analysis/by_value.stderr +++ b/src/test/ui/closures/2229_closure_analysis/by_value.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes on expressions are experimental - --> $DIR/by_value.rs:22:13 + --> $DIR/by_value.rs:18:13 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,17 +7,8 @@ LL | let c = #[rustc_capture_analysis] = note: see issue #15701 for more information = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/by_value.rs:5:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error: First Pass analysis includes: - --> $DIR/by_value.rs:25:5 + --> $DIR/by_value.rs:21:5 | LL | / || { LL | | @@ -29,23 +20,23 @@ LL | | }; | |_____^ | note: Capturing t[(0, 0),Deref,(0, 0)] -> ImmBorrow - --> $DIR/by_value.rs:28:17 + --> $DIR/by_value.rs:24:17 | LL | let p = t.0.0; | ^^^^^ note: Capturing t[(0, 0)] -> ByValue - --> $DIR/by_value.rs:28:17 + --> $DIR/by_value.rs:24:17 | LL | let p = t.0.0; | ^^^^^ note: Capturing t[(1, 0)] -> ImmBorrow - --> $DIR/by_value.rs:32:29 + --> $DIR/by_value.rs:28:29 | LL | println!("{} {:?}", t.1, p); | ^^^ error: Min Capture analysis includes: - --> $DIR/by_value.rs:25:5 + --> $DIR/by_value.rs:21:5 | LL | / || { LL | | @@ -57,16 +48,16 @@ LL | | }; | |_____^ | note: Min Capture t[(0, 0)] -> ByValue - --> $DIR/by_value.rs:28:17 + --> $DIR/by_value.rs:24:17 | LL | let p = t.0.0; | ^^^^^ note: Min Capture t[(1, 0)] -> ImmBorrow - --> $DIR/by_value.rs:32:29 + --> $DIR/by_value.rs:28:29 | LL | println!("{} {:?}", t.1, p); | ^^^ -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/capture-analysis-1.rs b/src/test/ui/closures/2229_closure_analysis/capture-analysis-1.rs index 4368c830e1c61..dc53b31768ec5 100644 --- a/src/test/ui/closures/2229_closure_analysis/capture-analysis-1.rs +++ b/src/test/ui/closures/2229_closure_analysis/capture-analysis-1.rs @@ -1,7 +1,5 @@ -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 +// edition:2021 + #![feature(rustc_attrs)] #[derive(Debug)] diff --git a/src/test/ui/closures/2229_closure_analysis/capture-analysis-1.stderr b/src/test/ui/closures/2229_closure_analysis/capture-analysis-1.stderr index 09255343af0e8..fceafb9c84eeb 100644 --- a/src/test/ui/closures/2229_closure_analysis/capture-analysis-1.stderr +++ b/src/test/ui/closures/2229_closure_analysis/capture-analysis-1.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes on expressions are experimental - --> $DIR/capture-analysis-1.rs:17:13 + --> $DIR/capture-analysis-1.rs:15:13 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,17 +7,8 @@ LL | let c = #[rustc_capture_analysis] = note: see issue #15701 for more information = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/capture-analysis-1.rs:1:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error: First Pass analysis includes: - --> $DIR/capture-analysis-1.rs:20:5 + --> $DIR/capture-analysis-1.rs:18:5 | LL | / || { LL | | @@ -29,28 +20,28 @@ LL | | }; | |_____^ | note: Capturing p[] -> ImmBorrow - --> $DIR/capture-analysis-1.rs:23:26 + --> $DIR/capture-analysis-1.rs:21:26 | LL | println!("{:?}", p); | ^ note: Capturing p[(0, 0)] -> ImmBorrow - --> $DIR/capture-analysis-1.rs:26:26 + --> $DIR/capture-analysis-1.rs:24:26 | LL | println!("{:?}", p.x); | ^^^ note: Capturing q[(0, 0)] -> ImmBorrow - --> $DIR/capture-analysis-1.rs:29:26 + --> $DIR/capture-analysis-1.rs:27:26 | LL | println!("{:?}", q.x); | ^^^ note: Capturing q[] -> ImmBorrow - --> $DIR/capture-analysis-1.rs:31:26 + --> $DIR/capture-analysis-1.rs:29:26 | LL | println!("{:?}", q); | ^ error: Min Capture analysis includes: - --> $DIR/capture-analysis-1.rs:20:5 + --> $DIR/capture-analysis-1.rs:18:5 | LL | / || { LL | | @@ -62,16 +53,16 @@ LL | | }; | |_____^ | note: Min Capture p[] -> ImmBorrow - --> $DIR/capture-analysis-1.rs:23:26 + --> $DIR/capture-analysis-1.rs:21:26 | LL | println!("{:?}", p); | ^ note: Min Capture q[] -> ImmBorrow - --> $DIR/capture-analysis-1.rs:31:26 + --> $DIR/capture-analysis-1.rs:29:26 | LL | println!("{:?}", q); | ^ -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/capture-analysis-2.rs b/src/test/ui/closures/2229_closure_analysis/capture-analysis-2.rs index ab7fce6a43099..99d12f8d8f1db 100644 --- a/src/test/ui/closures/2229_closure_analysis/capture-analysis-2.rs +++ b/src/test/ui/closures/2229_closure_analysis/capture-analysis-2.rs @@ -1,7 +1,5 @@ -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 +// edition:2021 + #![feature(rustc_attrs)] #[derive(Debug)] diff --git a/src/test/ui/closures/2229_closure_analysis/capture-analysis-2.stderr b/src/test/ui/closures/2229_closure_analysis/capture-analysis-2.stderr index 0e48d6b300b72..cb44ca2665293 100644 --- a/src/test/ui/closures/2229_closure_analysis/capture-analysis-2.stderr +++ b/src/test/ui/closures/2229_closure_analysis/capture-analysis-2.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes on expressions are experimental - --> $DIR/capture-analysis-2.rs:16:13 + --> $DIR/capture-analysis-2.rs:14:13 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,17 +7,8 @@ LL | let c = #[rustc_capture_analysis] = note: see issue #15701 for more information = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/capture-analysis-2.rs:1:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error: First Pass analysis includes: - --> $DIR/capture-analysis-2.rs:19:5 + --> $DIR/capture-analysis-2.rs:17:5 | LL | / || { LL | | @@ -29,18 +20,18 @@ LL | | }; | |_____^ | note: Capturing p[(0, 0)] -> ByValue - --> $DIR/capture-analysis-2.rs:22:18 + --> $DIR/capture-analysis-2.rs:20:18 | LL | let _x = p.x; | ^^^ note: Capturing p[] -> ImmBorrow - --> $DIR/capture-analysis-2.rs:25:26 + --> $DIR/capture-analysis-2.rs:23:26 | LL | println!("{:?}", p); | ^ error: Min Capture analysis includes: - --> $DIR/capture-analysis-2.rs:19:5 + --> $DIR/capture-analysis-2.rs:17:5 | LL | / || { LL | | @@ -52,7 +43,7 @@ LL | | }; | |_____^ | note: Min Capture p[] -> ByValue - --> $DIR/capture-analysis-2.rs:22:18 + --> $DIR/capture-analysis-2.rs:20:18 | LL | let _x = p.x; | ^^^ p[] captured as ByValue here @@ -60,6 +51,6 @@ LL | let _x = p.x; LL | println!("{:?}", p); | ^ p[] used here -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/capture-analysis-3.rs b/src/test/ui/closures/2229_closure_analysis/capture-analysis-3.rs index 817ade899e2a0..3f337097dbd2f 100644 --- a/src/test/ui/closures/2229_closure_analysis/capture-analysis-3.rs +++ b/src/test/ui/closures/2229_closure_analysis/capture-analysis-3.rs @@ -1,7 +1,5 @@ -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 +// edition:2021 + #![feature(rustc_attrs)] #[derive(Debug)] diff --git a/src/test/ui/closures/2229_closure_analysis/capture-analysis-3.stderr b/src/test/ui/closures/2229_closure_analysis/capture-analysis-3.stderr index 263e9ca56ebf6..71e7bdc354fb2 100644 --- a/src/test/ui/closures/2229_closure_analysis/capture-analysis-3.stderr +++ b/src/test/ui/closures/2229_closure_analysis/capture-analysis-3.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes on expressions are experimental - --> $DIR/capture-analysis-3.rs:21:13 + --> $DIR/capture-analysis-3.rs:19:13 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,17 +7,8 @@ LL | let c = #[rustc_capture_analysis] = note: see issue #15701 for more information = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/capture-analysis-3.rs:1:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error: First Pass analysis includes: - --> $DIR/capture-analysis-3.rs:24:5 + --> $DIR/capture-analysis-3.rs:22:5 | LL | / || { LL | | @@ -29,18 +20,18 @@ LL | | }; | |_____^ | note: Capturing a[(0, 0),(0, 0)] -> ByValue - --> $DIR/capture-analysis-3.rs:27:18 + --> $DIR/capture-analysis-3.rs:25:18 | LL | let _x = a.b.c; | ^^^^^ note: Capturing a[(0, 0)] -> ImmBorrow - --> $DIR/capture-analysis-3.rs:30:26 + --> $DIR/capture-analysis-3.rs:28:26 | LL | println!("{:?}", a.b); | ^^^ error: Min Capture analysis includes: - --> $DIR/capture-analysis-3.rs:24:5 + --> $DIR/capture-analysis-3.rs:22:5 | LL | / || { LL | | @@ -52,7 +43,7 @@ LL | | }; | |_____^ | note: Min Capture a[(0, 0)] -> ByValue - --> $DIR/capture-analysis-3.rs:27:18 + --> $DIR/capture-analysis-3.rs:25:18 | LL | let _x = a.b.c; | ^^^^^ a[(0, 0)] captured as ByValue here @@ -60,6 +51,6 @@ LL | let _x = a.b.c; LL | println!("{:?}", a.b); | ^^^ a[(0, 0)] used here -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/capture-analysis-4.rs b/src/test/ui/closures/2229_closure_analysis/capture-analysis-4.rs index e8401299b30ad..bc46ec997360b 100644 --- a/src/test/ui/closures/2229_closure_analysis/capture-analysis-4.rs +++ b/src/test/ui/closures/2229_closure_analysis/capture-analysis-4.rs @@ -1,7 +1,5 @@ -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 +// edition:2021 + #![feature(rustc_attrs)] #[derive(Debug)] diff --git a/src/test/ui/closures/2229_closure_analysis/capture-analysis-4.stderr b/src/test/ui/closures/2229_closure_analysis/capture-analysis-4.stderr index f4605c1d51b76..7e6e625bc7d48 100644 --- a/src/test/ui/closures/2229_closure_analysis/capture-analysis-4.stderr +++ b/src/test/ui/closures/2229_closure_analysis/capture-analysis-4.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes on expressions are experimental - --> $DIR/capture-analysis-4.rs:21:13 + --> $DIR/capture-analysis-4.rs:19:13 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,17 +7,8 @@ LL | let c = #[rustc_capture_analysis] = note: see issue #15701 for more information = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/capture-analysis-4.rs:1:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error: First Pass analysis includes: - --> $DIR/capture-analysis-4.rs:24:5 + --> $DIR/capture-analysis-4.rs:22:5 | LL | / || { LL | | @@ -29,18 +20,18 @@ LL | | }; | |_____^ | note: Capturing a[(0, 0)] -> ByValue - --> $DIR/capture-analysis-4.rs:27:18 + --> $DIR/capture-analysis-4.rs:25:18 | LL | let _x = a.b; | ^^^ note: Capturing a[(0, 0),(0, 0)] -> ImmBorrow - --> $DIR/capture-analysis-4.rs:30:26 + --> $DIR/capture-analysis-4.rs:28:26 | LL | println!("{:?}", a.b.c); | ^^^^^ error: Min Capture analysis includes: - --> $DIR/capture-analysis-4.rs:24:5 + --> $DIR/capture-analysis-4.rs:22:5 | LL | / || { LL | | @@ -52,11 +43,11 @@ LL | | }; | |_____^ | note: Min Capture a[(0, 0)] -> ByValue - --> $DIR/capture-analysis-4.rs:27:18 + --> $DIR/capture-analysis-4.rs:25:18 | LL | let _x = a.b; | ^^^ -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.rs b/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.rs index ba4955085372a..6fd1515533160 100644 --- a/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.rs +++ b/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.rs @@ -1,9 +1,5 @@ -// FIXME(arora-aman) add run-pass once 2229 is implemented +// edition:2021 -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 #![feature(rustc_attrs)] struct Point { diff --git a/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.stderr b/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.stderr index 5fac6963afd32..0f64ecf3a0ccb 100644 --- a/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.stderr +++ b/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes on expressions are experimental - --> $DIR/capture-disjoint-field-struct.rs:17:13 + --> $DIR/capture-disjoint-field-struct.rs:13:13 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,17 +7,8 @@ LL | let c = #[rustc_capture_analysis] = note: see issue #15701 for more information = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/capture-disjoint-field-struct.rs:3:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error: First Pass analysis includes: - --> $DIR/capture-disjoint-field-struct.rs:20:5 + --> $DIR/capture-disjoint-field-struct.rs:16:5 | LL | / || { LL | | @@ -29,13 +20,13 @@ LL | | }; | |_____^ | note: Capturing p[(0, 0)] -> ImmBorrow - --> $DIR/capture-disjoint-field-struct.rs:23:24 + --> $DIR/capture-disjoint-field-struct.rs:19:24 | LL | println!("{}", p.x); | ^^^ error: Min Capture analysis includes: - --> $DIR/capture-disjoint-field-struct.rs:20:5 + --> $DIR/capture-disjoint-field-struct.rs:16:5 | LL | / || { LL | | @@ -47,11 +38,11 @@ LL | | }; | |_____^ | note: Min Capture p[(0, 0)] -> ImmBorrow - --> $DIR/capture-disjoint-field-struct.rs:23:24 + --> $DIR/capture-disjoint-field-struct.rs:19:24 | LL | println!("{}", p.x); | ^^^ -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.rs b/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.rs index c1693fbad7986..8d3bb3262fb2b 100644 --- a/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.rs +++ b/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.rs @@ -1,9 +1,5 @@ -// FIXME(arora-aman) add run-pass once 2229 is implemented +// edition:2021 -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 #![feature(rustc_attrs)] fn main() { diff --git a/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.stderr b/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.stderr index 1bfd63f2ace8c..a8ca9622a6a68 100644 --- a/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.stderr +++ b/src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes on expressions are experimental - --> $DIR/capture-disjoint-field-tuple.rs:12:13 + --> $DIR/capture-disjoint-field-tuple.rs:8:13 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,17 +7,8 @@ LL | let c = #[rustc_capture_analysis] = note: see issue #15701 for more information = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/capture-disjoint-field-tuple.rs:3:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error: First Pass analysis includes: - --> $DIR/capture-disjoint-field-tuple.rs:15:5 + --> $DIR/capture-disjoint-field-tuple.rs:11:5 | LL | / || { LL | | @@ -29,13 +20,13 @@ LL | | }; | |_____^ | note: Capturing t[(0, 0)] -> ImmBorrow - --> $DIR/capture-disjoint-field-tuple.rs:18:24 + --> $DIR/capture-disjoint-field-tuple.rs:14:24 | LL | println!("{}", t.0); | ^^^ error: Min Capture analysis includes: - --> $DIR/capture-disjoint-field-tuple.rs:15:5 + --> $DIR/capture-disjoint-field-tuple.rs:11:5 | LL | / || { LL | | @@ -47,11 +38,11 @@ LL | | }; | |_____^ | note: Min Capture t[(0, 0)] -> ImmBorrow - --> $DIR/capture-disjoint-field-tuple.rs:18:24 + --> $DIR/capture-disjoint-field-tuple.rs:14:24 | LL | println!("{}", t.0); | ^^^ -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/capture-enums.rs b/src/test/ui/closures/2229_closure_analysis/capture-enums.rs index 8fb2f7f16d69c..322ae99b86138 100644 --- a/src/test/ui/closures/2229_closure_analysis/capture-enums.rs +++ b/src/test/ui/closures/2229_closure_analysis/capture-enums.rs @@ -1,7 +1,5 @@ -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 +// edition:2021 + #![feature(rustc_attrs)] enum Info { diff --git a/src/test/ui/closures/2229_closure_analysis/capture-enums.stderr b/src/test/ui/closures/2229_closure_analysis/capture-enums.stderr index ebe1dcb98848b..8a6ba8444a80a 100644 --- a/src/test/ui/closures/2229_closure_analysis/capture-enums.stderr +++ b/src/test/ui/closures/2229_closure_analysis/capture-enums.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes on expressions are experimental - --> $DIR/capture-enums.rs:18:13 + --> $DIR/capture-enums.rs:16:13 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | let c = #[rustc_capture_analysis] = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/capture-enums.rs:49:13 + --> $DIR/capture-enums.rs:47:13 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -16,17 +16,8 @@ LL | let c = #[rustc_capture_analysis] = note: see issue #15701 for more information = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/capture-enums.rs:1:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error: First Pass analysis includes: - --> $DIR/capture-enums.rs:21:5 + --> $DIR/capture-enums.rs:19:5 | LL | / || { LL | | @@ -38,28 +29,28 @@ LL | | }; | |_____^ | note: Capturing point[] -> ImmBorrow - --> $DIR/capture-enums.rs:24:41 + --> $DIR/capture-enums.rs:22:41 | LL | if let Info::Point(_, _, str) = point { | ^^^^^ note: Capturing point[(2, 0)] -> ByValue - --> $DIR/capture-enums.rs:24:41 + --> $DIR/capture-enums.rs:22:41 | LL | if let Info::Point(_, _, str) = point { | ^^^^^ note: Capturing meta[] -> ImmBorrow - --> $DIR/capture-enums.rs:31:35 + --> $DIR/capture-enums.rs:29:35 | LL | if let Info::Meta(_, v) = meta { | ^^^^ note: Capturing meta[(1, 1)] -> ByValue - --> $DIR/capture-enums.rs:31:35 + --> $DIR/capture-enums.rs:29:35 | LL | if let Info::Meta(_, v) = meta { | ^^^^ error: Min Capture analysis includes: - --> $DIR/capture-enums.rs:21:5 + --> $DIR/capture-enums.rs:19:5 | LL | / || { LL | | @@ -71,18 +62,18 @@ LL | | }; | |_____^ | note: Min Capture point[] -> ByValue - --> $DIR/capture-enums.rs:24:41 + --> $DIR/capture-enums.rs:22:41 | LL | if let Info::Point(_, _, str) = point { | ^^^^^ note: Min Capture meta[] -> ByValue - --> $DIR/capture-enums.rs:31:35 + --> $DIR/capture-enums.rs:29:35 | LL | if let Info::Meta(_, v) = meta { | ^^^^ error: First Pass analysis includes: - --> $DIR/capture-enums.rs:52:5 + --> $DIR/capture-enums.rs:50:5 | LL | / || { LL | | @@ -94,13 +85,13 @@ LL | | }; | |_____^ | note: Capturing point[(2, 0)] -> ByValue - --> $DIR/capture-enums.rs:55:47 + --> $DIR/capture-enums.rs:53:47 | LL | let SingleVariant::Point(_, _, str) = point; | ^^^^^ error: Min Capture analysis includes: - --> $DIR/capture-enums.rs:52:5 + --> $DIR/capture-enums.rs:50:5 | LL | / || { LL | | @@ -112,11 +103,11 @@ LL | | }; | |_____^ | note: Min Capture point[(2, 0)] -> ByValue - --> $DIR/capture-enums.rs:55:47 + --> $DIR/capture-enums.rs:53:47 | LL | let SingleVariant::Point(_, _, str) = point; | ^^^^^ -error: aborting due to 6 previous errors; 1 warning emitted +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/deep-multilevel-struct.rs b/src/test/ui/closures/2229_closure_analysis/deep-multilevel-struct.rs index f81866bb7e096..3341166e22b92 100644 --- a/src/test/ui/closures/2229_closure_analysis/deep-multilevel-struct.rs +++ b/src/test/ui/closures/2229_closure_analysis/deep-multilevel-struct.rs @@ -1,7 +1,5 @@ -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 +// edition:2021 + #![feature(rustc_attrs)] #![allow(unused)] diff --git a/src/test/ui/closures/2229_closure_analysis/deep-multilevel-struct.stderr b/src/test/ui/closures/2229_closure_analysis/deep-multilevel-struct.stderr index 863f1009131a1..29e1af0431ec6 100644 --- a/src/test/ui/closures/2229_closure_analysis/deep-multilevel-struct.stderr +++ b/src/test/ui/closures/2229_closure_analysis/deep-multilevel-struct.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes on expressions are experimental - --> $DIR/deep-multilevel-struct.rs:36:13 + --> $DIR/deep-multilevel-struct.rs:34:13 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,17 +7,8 @@ LL | let c = #[rustc_capture_analysis] = note: see issue #15701 for more information = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/deep-multilevel-struct.rs:1:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error: First Pass analysis includes: - --> $DIR/deep-multilevel-struct.rs:39:5 + --> $DIR/deep-multilevel-struct.rs:37:5 | LL | / || { LL | | @@ -29,23 +20,23 @@ LL | | }; | |_____^ | note: Capturing p[(0, 0),(0, 0),(0, 0)] -> ImmBorrow - --> $DIR/deep-multilevel-struct.rs:42:18 + --> $DIR/deep-multilevel-struct.rs:40:18 | LL | let x = &p.a.p.x; | ^^^^^^^ note: Capturing p[(1, 0),(1, 0),(1, 0)] -> MutBorrow - --> $DIR/deep-multilevel-struct.rs:44:9 + --> $DIR/deep-multilevel-struct.rs:42:9 | LL | p.b.q.y = 9; | ^^^^^^^ note: Capturing p[] -> ImmBorrow - --> $DIR/deep-multilevel-struct.rs:47:26 + --> $DIR/deep-multilevel-struct.rs:45:26 | LL | println!("{:?}", p); | ^ error: Min Capture analysis includes: - --> $DIR/deep-multilevel-struct.rs:39:5 + --> $DIR/deep-multilevel-struct.rs:37:5 | LL | / || { LL | | @@ -57,7 +48,7 @@ LL | | }; | |_____^ | note: Min Capture p[] -> MutBorrow - --> $DIR/deep-multilevel-struct.rs:44:9 + --> $DIR/deep-multilevel-struct.rs:42:9 | LL | p.b.q.y = 9; | ^^^^^^^ p[] captured as MutBorrow here @@ -65,6 +56,6 @@ LL | p.b.q.y = 9; LL | println!("{:?}", p); | ^ p[] used here -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/deep-multilevel-tuple.rs b/src/test/ui/closures/2229_closure_analysis/deep-multilevel-tuple.rs index fb03a02efa09e..34b0132f3cb0b 100644 --- a/src/test/ui/closures/2229_closure_analysis/deep-multilevel-tuple.rs +++ b/src/test/ui/closures/2229_closure_analysis/deep-multilevel-tuple.rs @@ -1,7 +1,4 @@ -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 +// edition:2021 #![feature(rustc_attrs)] #![allow(unused)] diff --git a/src/test/ui/closures/2229_closure_analysis/deep-multilevel-tuple.stderr b/src/test/ui/closures/2229_closure_analysis/deep-multilevel-tuple.stderr index 252db44473222..e917516765c8f 100644 --- a/src/test/ui/closures/2229_closure_analysis/deep-multilevel-tuple.stderr +++ b/src/test/ui/closures/2229_closure_analysis/deep-multilevel-tuple.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes on expressions are experimental - --> $DIR/deep-multilevel-tuple.rs:11:13 + --> $DIR/deep-multilevel-tuple.rs:8:13 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,17 +7,8 @@ LL | let c = #[rustc_capture_analysis] = note: see issue #15701 for more information = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/deep-multilevel-tuple.rs:1:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error: First Pass analysis includes: - --> $DIR/deep-multilevel-tuple.rs:14:5 + --> $DIR/deep-multilevel-tuple.rs:11:5 | LL | / || { LL | | @@ -29,23 +20,23 @@ LL | | }; | |_____^ | note: Capturing t[(0, 0),(0, 0),(0, 0)] -> ImmBorrow - --> $DIR/deep-multilevel-tuple.rs:17:18 + --> $DIR/deep-multilevel-tuple.rs:14:18 | LL | let x = &t.0.0.0; | ^^^^^^^ note: Capturing t[(1, 0),(1, 0),(1, 0)] -> MutBorrow - --> $DIR/deep-multilevel-tuple.rs:19:9 + --> $DIR/deep-multilevel-tuple.rs:16:9 | LL | t.1.1.1 = 9; | ^^^^^^^ note: Capturing t[] -> ImmBorrow - --> $DIR/deep-multilevel-tuple.rs:22:26 + --> $DIR/deep-multilevel-tuple.rs:19:26 | LL | println!("{:?}", t); | ^ error: Min Capture analysis includes: - --> $DIR/deep-multilevel-tuple.rs:14:5 + --> $DIR/deep-multilevel-tuple.rs:11:5 | LL | / || { LL | | @@ -57,7 +48,7 @@ LL | | }; | |_____^ | note: Min Capture t[] -> MutBorrow - --> $DIR/deep-multilevel-tuple.rs:19:9 + --> $DIR/deep-multilevel-tuple.rs:16:9 | LL | t.1.1.1 = 9; | ^^^^^^^ t[] captured as MutBorrow here @@ -65,6 +56,6 @@ LL | t.1.1.1 = 9; LL | println!("{:?}", t); | ^ t[] used here -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/destructure_patterns.rs b/src/test/ui/closures/2229_closure_analysis/destructure_patterns.rs index 080ca0405b477..9918802334ecc 100644 --- a/src/test/ui/closures/2229_closure_analysis/destructure_patterns.rs +++ b/src/test/ui/closures/2229_closure_analysis/destructure_patterns.rs @@ -1,7 +1,5 @@ -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 +// edition:2021 + #![feature(rustc_attrs)] // Test to ensure Index projections are handled properly during capture analysis diff --git a/src/test/ui/closures/2229_closure_analysis/destructure_patterns.stderr b/src/test/ui/closures/2229_closure_analysis/destructure_patterns.stderr index 06ccc2d7a88b4..b53adb5248161 100644 --- a/src/test/ui/closures/2229_closure_analysis/destructure_patterns.stderr +++ b/src/test/ui/closures/2229_closure_analysis/destructure_patterns.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes on expressions are experimental - --> $DIR/destructure_patterns.rs:12:13 + --> $DIR/destructure_patterns.rs:10:13 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | let c = #[rustc_capture_analysis] = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/destructure_patterns.rs:38:13 + --> $DIR/destructure_patterns.rs:36:13 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | let c = #[rustc_capture_analysis] = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/destructure_patterns.rs:58:13 + --> $DIR/destructure_patterns.rs:56:13 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -25,17 +25,8 @@ LL | let c = #[rustc_capture_analysis] = note: see issue #15701 for more information = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/destructure_patterns.rs:1:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error: First Pass analysis includes: - --> $DIR/destructure_patterns.rs:15:5 + --> $DIR/destructure_patterns.rs:13:5 | LL | / || { LL | | @@ -47,13 +38,13 @@ LL | | }; | |_____^ | note: Capturing arr[Index] -> ByValue - --> $DIR/destructure_patterns.rs:18:29 + --> $DIR/destructure_patterns.rs:16:29 | LL | let [a, b, .., e] = arr; | ^^^ error: Min Capture analysis includes: - --> $DIR/destructure_patterns.rs:15:5 + --> $DIR/destructure_patterns.rs:13:5 | LL | / || { LL | | @@ -65,13 +56,13 @@ LL | | }; | |_____^ | note: Min Capture arr[] -> ByValue - --> $DIR/destructure_patterns.rs:18:29 + --> $DIR/destructure_patterns.rs:16:29 | LL | let [a, b, .., e] = arr; | ^^^ error: First Pass analysis includes: - --> $DIR/destructure_patterns.rs:41:5 + --> $DIR/destructure_patterns.rs:39:5 | LL | / || { LL | | @@ -83,18 +74,18 @@ LL | | }; | |_____^ | note: Capturing p[(0, 0)] -> MutBorrow - --> $DIR/destructure_patterns.rs:44:58 + --> $DIR/destructure_patterns.rs:42:58 | LL | let Point { x: ref mut x, y: _, id: moved_id } = p; | ^ note: Capturing p[(2, 0)] -> ByValue - --> $DIR/destructure_patterns.rs:44:58 + --> $DIR/destructure_patterns.rs:42:58 | LL | let Point { x: ref mut x, y: _, id: moved_id } = p; | ^ error: Min Capture analysis includes: - --> $DIR/destructure_patterns.rs:41:5 + --> $DIR/destructure_patterns.rs:39:5 | LL | / || { LL | | @@ -106,18 +97,18 @@ LL | | }; | |_____^ | note: Min Capture p[(0, 0)] -> MutBorrow - --> $DIR/destructure_patterns.rs:44:58 + --> $DIR/destructure_patterns.rs:42:58 | LL | let Point { x: ref mut x, y: _, id: moved_id } = p; | ^ note: Min Capture p[(2, 0)] -> ByValue - --> $DIR/destructure_patterns.rs:44:58 + --> $DIR/destructure_patterns.rs:42:58 | LL | let Point { x: ref mut x, y: _, id: moved_id } = p; | ^ error: First Pass analysis includes: - --> $DIR/destructure_patterns.rs:61:5 + --> $DIR/destructure_patterns.rs:59:5 | LL | / || { LL | | @@ -129,23 +120,23 @@ LL | | }; | |_____^ | note: Capturing t[(0, 0)] -> MutBorrow - --> $DIR/destructure_patterns.rs:64:54 + --> $DIR/destructure_patterns.rs:62:54 | LL | let (ref mut x, ref ref_str, (moved_s, _)) = t; | ^ note: Capturing t[(1, 0)] -> ImmBorrow - --> $DIR/destructure_patterns.rs:64:54 + --> $DIR/destructure_patterns.rs:62:54 | LL | let (ref mut x, ref ref_str, (moved_s, _)) = t; | ^ note: Capturing t[(2, 0),(0, 0)] -> ByValue - --> $DIR/destructure_patterns.rs:64:54 + --> $DIR/destructure_patterns.rs:62:54 | LL | let (ref mut x, ref ref_str, (moved_s, _)) = t; | ^ error: Min Capture analysis includes: - --> $DIR/destructure_patterns.rs:61:5 + --> $DIR/destructure_patterns.rs:59:5 | LL | / || { LL | | @@ -157,21 +148,21 @@ LL | | }; | |_____^ | note: Min Capture t[(0, 0)] -> MutBorrow - --> $DIR/destructure_patterns.rs:64:54 + --> $DIR/destructure_patterns.rs:62:54 | LL | let (ref mut x, ref ref_str, (moved_s, _)) = t; | ^ note: Min Capture t[(1, 0)] -> ImmBorrow - --> $DIR/destructure_patterns.rs:64:54 + --> $DIR/destructure_patterns.rs:62:54 | LL | let (ref mut x, ref ref_str, (moved_s, _)) = t; | ^ note: Min Capture t[(2, 0),(0, 0)] -> ByValue - --> $DIR/destructure_patterns.rs:64:54 + --> $DIR/destructure_patterns.rs:62:54 | LL | let (ref mut x, ref ref_str, (moved_s, _)) = t; | ^ -error: aborting due to 9 previous errors; 1 warning emitted +error: aborting due to 9 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/arrays.rs b/src/test/ui/closures/2229_closure_analysis/diagnostics/arrays.rs index 0b94317fd7136..93131b2ac4e4d 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/arrays.rs +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/arrays.rs @@ -1,7 +1,6 @@ -// Test that arrays are completely captured by closures by relying on the borrow check diagnostics +// edition:2021 -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete +// Test that arrays are completely captured by closures by relying on the borrow check diagnostics fn arrays_1() { let mut arr = [1, 2, 3, 4, 5]; diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/arrays.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/arrays.stderr index 77e3e71bc6120..a3f2f25e447e1 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/arrays.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/arrays.stderr @@ -1,14 +1,5 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/arrays.rs:3:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error[E0503]: cannot use `arr` because it was mutably borrowed - --> $DIR/arrays.rs:15:5 + --> $DIR/arrays.rs:14:5 | LL | let mut c = || { | -- borrow of `arr` occurs here @@ -22,7 +13,7 @@ LL | c(); | - borrow later used here error[E0503]: cannot use `arr[_]` because it was mutably borrowed - --> $DIR/arrays.rs:15:5 + --> $DIR/arrays.rs:14:5 | LL | let mut c = || { | -- borrow of `arr` occurs here @@ -36,7 +27,7 @@ LL | c(); | - borrow later used here error[E0506]: cannot assign to `arr[_]` because it is borrowed - --> $DIR/arrays.rs:30:5 + --> $DIR/arrays.rs:29:5 | LL | let c = || { | -- borrow of `arr[_]` occurs here @@ -50,7 +41,7 @@ LL | c(); | - borrow later used here error[E0506]: cannot assign to `arr[_]` because it is borrowed - --> $DIR/arrays.rs:44:5 + --> $DIR/arrays.rs:43:5 | LL | let c = || { | -- borrow of `arr[_]` occurs here @@ -64,7 +55,7 @@ LL | c(); | - borrow later used here error[E0503]: cannot use `arr` because it was mutably borrowed - --> $DIR/arrays.rs:58:20 + --> $DIR/arrays.rs:57:20 | LL | let mut c = || { | -- borrow of `arr` occurs here @@ -78,7 +69,7 @@ LL | c(); | - borrow later used here error[E0502]: cannot borrow `arr[_]` as immutable because it is also borrowed as mutable - --> $DIR/arrays.rs:58:20 + --> $DIR/arrays.rs:57:20 | LL | let mut c = || { | -- mutable borrow occurs here @@ -92,7 +83,7 @@ LL | c(); | - mutable borrow later used here error[E0502]: cannot borrow `arr` as immutable because it is also borrowed as mutable - --> $DIR/arrays.rs:74:24 + --> $DIR/arrays.rs:73:24 | LL | let mut c = || { | -- mutable borrow occurs here @@ -105,7 +96,7 @@ LL | println!("{:#?}", &arr[3..2]); LL | c(); | - mutable borrow later used here -error: aborting due to 7 previous errors; 1 warning emitted +error: aborting due to 7 previous errors Some errors have detailed explanations: E0502, E0503, E0506. For more information about an error, try `rustc --explain E0502`. diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-1.rs b/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-1.rs index 2f3358dcd8db7..3664d76c2038f 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-1.rs +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-1.rs @@ -1,5 +1,4 @@ -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete +// edition:2021 #[derive(Debug)] struct Point { diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-1.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-1.stderr index e15067b264d63..341d2bc65634b 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-1.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-1.stderr @@ -1,14 +1,5 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/borrowck-1.rs:1:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error[E0499]: cannot borrow `p` as mutable more than once at a time - --> $DIR/borrowck-1.rs:13:17 + --> $DIR/borrowck-1.rs:12:17 | LL | let y = &mut p.y; | -------- first mutable borrow occurs here @@ -23,6 +14,6 @@ LL | println!("{:?}", p); LL | *y+=1; | ----- first borrow later used here -error: aborting due to previous error; 1 warning emitted +error: aborting due to previous error For more information about this error, try `rustc --explain E0499`. diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-2.rs b/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-2.rs index 06c6a87eb105d..ae416bab65ea5 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-2.rs +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-2.rs @@ -1,5 +1,4 @@ -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete +// edition:2021 #[derive(Debug)] struct Point { diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-2.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-2.stderr index a195b981eaadd..584bb862b2c0a 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-2.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-2.stderr @@ -1,14 +1,5 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/borrowck-2.rs:1:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-2.rs:13:17 + --> $DIR/borrowck-2.rs:12:17 | LL | let y = &p.y; | ---- immutable borrow occurs here @@ -23,6 +14,6 @@ LL | let x = &mut p.x; LL | println!("{}", y); | - immutable borrow later used here -error: aborting due to previous error; 1 warning emitted +error: aborting due to previous error For more information about this error, try `rustc --explain E0502`. diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-3.rs b/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-3.rs index ba998f78c87ac..bdd6cb79b60b0 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-3.rs +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-3.rs @@ -1,5 +1,4 @@ -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete +// edition:2021 #[derive(Debug)] struct Point { diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-3.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-3.stderr index b54c729a307c0..dab1809a381ee 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-3.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-3.stderr @@ -1,14 +1,5 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/borrowck-3.rs:1:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error[E0597]: `p` does not live long enough - --> $DIR/borrowck-3.rs:14:29 + --> $DIR/borrowck-3.rs:13:29 | LL | let mut c = { | ----- borrow later stored here @@ -22,6 +13,6 @@ LL | println!("{:?}", p); LL | }; | - `p` dropped here while still borrowed -error: aborting due to previous error; 1 warning emitted +error: aborting due to previous error For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.rs b/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.rs index 4fab0189c27f8..a2290d850207d 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.rs +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.rs @@ -1,5 +1,4 @@ -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete +// edition:2021 #[derive(Debug)] struct Point { diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.stderr index 905fa3475edd8..29bd4b27d6b07 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.stderr @@ -1,14 +1,5 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/borrowck-4.rs:1:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error[E0373]: closure may outlive the current function, but it borrows `p`, which is owned by the current function - --> $DIR/borrowck-4.rs:11:17 + --> $DIR/borrowck-4.rs:10:17 | LL | let mut c = || { | ^^ may outlive borrowed value `p` @@ -17,7 +8,7 @@ LL | println!("{:?}", p); | - `p` is borrowed here | note: closure is returned here - --> $DIR/borrowck-4.rs:9:14 + --> $DIR/borrowck-4.rs:8:14 | LL | fn foo () -> impl FnMut()->() { | ^^^^^^^^^^^^^^^^ @@ -26,6 +17,6 @@ help: to force the closure to take ownership of `p` (and any other referenced va LL | let mut c = move || { | ^^^^^^^ -error: aborting due to previous error; 1 warning emitted +error: aborting due to previous error For more information about this error, try `rustc --explain E0373`. diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-closures-mut-and-imm.rs b/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-closures-mut-and-imm.rs index b23947ad5d1bf..6a8c9664051df 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-closures-mut-and-imm.rs +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-closures-mut-and-imm.rs @@ -1,8 +1,8 @@ +// edition:2021 + // Tests that two closures cannot simultaneously have mutable // and immutable access to the variable. Issue #6801. -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete #![feature(box_syntax)] #[derive(Debug)] diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-closures-mut-and-imm.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-closures-mut-and-imm.stderr index 58975c6f46fe4..5f1dae2972f9e 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-closures-mut-and-imm.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-closures-mut-and-imm.stderr @@ -1,12 +1,3 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/borrowck-closures-mut-and-imm.rs:4:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable --> $DIR/borrowck-closures-mut-and-imm.rs:17:14 | @@ -25,6 +16,6 @@ LL | }; LL | drop(c2); | -- immutable borrow later used here -error: aborting due to previous error; 1 warning emitted +error: aborting due to previous error For more information about this error, try `rustc --explain E0502`. diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/box.rs b/src/test/ui/closures/2229_closure_analysis/diagnostics/box.rs index 15be1d8c7220d..a110fa4e2cb3e 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/box.rs +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/box.rs @@ -1,7 +1,6 @@ -// Test borrow checker when we precise capture when using boxes +// edition:2021 -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete +// Test borrow checker when we precise capture when using boxes struct MetaData { x: String, name: String } struct Data { m: MetaData } diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/box.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/box.stderr index 174faa33c49ab..2badf0514187e 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/box.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/box.stderr @@ -1,14 +1,5 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/box.rs:3:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error[E0506]: cannot assign to `e.0.0.m.x` because it is borrowed - --> $DIR/box.rs:22:5 + --> $DIR/box.rs:21:5 | LL | let mut c = || { | -- borrow of `e.0.0.m.x` occurs here @@ -22,7 +13,7 @@ LL | c(); | - borrow later used here error[E0502]: cannot borrow `e.0.0.m.x` as immutable because it is also borrowed as mutable - --> $DIR/box.rs:39:20 + --> $DIR/box.rs:38:20 | LL | let mut c = || { | -- mutable borrow occurs here @@ -36,7 +27,7 @@ LL | c(); | - mutable borrow later used here error[E0506]: cannot assign to `e.0.0.m.x` because it is borrowed - --> $DIR/box.rs:56:5 + --> $DIR/box.rs:55:5 | LL | let c = || { | -- borrow of `e.0.0.m.x` occurs here @@ -49,7 +40,7 @@ LL | LL | c(); | - borrow later used here -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 3 previous errors Some errors have detailed explanations: E0502, E0506. For more information about an error, try `rustc --explain E0502`. diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/cant-mutate-imm-borrow.rs b/src/test/ui/closures/2229_closure_analysis/diagnostics/cant-mutate-imm-borrow.rs index 1ea38e260b645..a5b4a19d8c3ff 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/cant-mutate-imm-borrow.rs +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/cant-mutate-imm-borrow.rs @@ -1,9 +1,8 @@ +// edition:2021 + // Test that if we deref an immutable borrow to access a Place, // then we can't mutate the final place. -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete - fn main() { let mut x = (format!(""), format!("X2")); let mut y = (&x, "Y"); diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/cant-mutate-imm-borrow.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/cant-mutate-imm-borrow.stderr index 39a11fb332725..cfe531e17d3d7 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/cant-mutate-imm-borrow.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/cant-mutate-imm-borrow.stderr @@ -1,14 +1,5 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/cant-mutate-imm-borrow.rs:4:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error[E0596]: cannot borrow `z.0.0.0` as mutable, as it is behind a `&` reference - --> $DIR/cant-mutate-imm-borrow.rs:14:17 + --> $DIR/cant-mutate-imm-borrow.rs:13:17 | LL | let mut c = || { | ^^ cannot borrow as mutable @@ -16,6 +7,6 @@ LL | LL | z.0.0.0 = format!("X1"); | ------- mutable borrow occurs due to use of `z.0.0.0` in closure -error: aborting due to previous error; 1 warning emitted +error: aborting due to previous error For more information about this error, try `rustc --explain E0596`. diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/cant-mutate-imm.rs b/src/test/ui/closures/2229_closure_analysis/diagnostics/cant-mutate-imm.rs index 928c866726f71..25ee9a1490e0c 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/cant-mutate-imm.rs +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/cant-mutate-imm.rs @@ -1,5 +1,4 @@ -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete +// edition:2021 // Ensure that diagnostics for mutability error (because the root variable // isn't mutable) work with `capture_disjoint_fields` enabled. diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/cant-mutate-imm.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/cant-mutate-imm.stderr index 9fb8dd4a1c36e..98414fa8a3d5f 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/cant-mutate-imm.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/cant-mutate-imm.stderr @@ -1,14 +1,5 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/cant-mutate-imm.rs:1:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error[E0594]: cannot assign to `z.0.0.0`, as it is not declared as mutable - --> $DIR/cant-mutate-imm.rs:13:9 + --> $DIR/cant-mutate-imm.rs:12:9 | LL | let z = (y, 10); | - help: consider changing this to be mutable: `mut z` @@ -17,7 +8,7 @@ LL | z.0.0.0 = 20; | ^^^^^^^^^^^^ cannot assign error[E0594]: cannot assign to `*bx.0`, as it is not declared as mutable - --> $DIR/cant-mutate-imm.rs:25:9 + --> $DIR/cant-mutate-imm.rs:24:9 | LL | let bx = Box::new(x); | -- help: consider changing this to be mutable: `mut bx` @@ -25,6 +16,6 @@ LL | let bx = Box::new(x); LL | bx.0 = 20; | ^^^^^^^^^ cannot assign -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0594`. diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-array-diagnostics.rs b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-array-diagnostics.rs index cd7c25620a7c4..f3be542e40d7a 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-array-diagnostics.rs +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-array-diagnostics.rs @@ -1,7 +1,4 @@ -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| `#[warn(incomplete_features)]` on by default -//~| see issue #53488 +// edition:2021 // Test that array access is not stored as part of closure kind origin diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-array-diagnostics.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-array-diagnostics.stderr index bd9428771f4c5..bcde35983fc4c 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-array-diagnostics.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-array-diagnostics.stderr @@ -1,14 +1,5 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/closure-origin-array-diagnostics.rs:1:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce` - --> $DIR/closure-origin-array-diagnostics.rs:12:13 + --> $DIR/closure-origin-array-diagnostics.rs:9:13 | LL | let c = || { | ^^ this closure implements `FnOnce`, not `Fn` @@ -18,6 +9,6 @@ LL | }; LL | expect_fn(c); | --------- the requirement to implement `Fn` derives from here -error: aborting due to previous error; 1 warning emitted +error: aborting due to previous error For more information about this error, try `rustc --explain E0525`. diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-multi-variant-diagnostics.rs b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-multi-variant-diagnostics.rs index 2916d8c794f22..aa85b55b15cc7 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-multi-variant-diagnostics.rs +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-multi-variant-diagnostics.rs @@ -1,11 +1,7 @@ -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| `#[warn(incomplete_features)]` on by default -//~| see issue #53488 +// edition:2021 // Check that precise paths are being reported back in the error message. - enum MultiVariant { Point(i32, i32), Meta(i32) diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-multi-variant-diagnostics.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-multi-variant-diagnostics.stderr index de0bfe3bd769f..066c000c832d8 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-multi-variant-diagnostics.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-multi-variant-diagnostics.stderr @@ -1,14 +1,5 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/closure-origin-multi-variant-diagnostics.rs:1:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error[E0382]: use of moved value: `c` - --> $DIR/closure-origin-multi-variant-diagnostics.rs:30:13 + --> $DIR/closure-origin-multi-variant-diagnostics.rs:26:13 | LL | let a = c; | - value moved here @@ -16,11 +7,11 @@ LL | let b = c; | ^ value used here after move | note: closure cannot be moved more than once as it is not `Copy` due to moving the variable `point.0` out of its environment - --> $DIR/closure-origin-multi-variant-diagnostics.rs:20:52 + --> $DIR/closure-origin-multi-variant-diagnostics.rs:16:52 | LL | if let MultiVariant::Point(ref mut x, _) = point { | ^^^^^ -error: aborting due to previous error; 1 warning emitted +error: aborting due to previous error For more information about this error, try `rustc --explain E0382`. diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-single-variant-diagnostics.rs b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-single-variant-diagnostics.rs index 2ed0149b9db7d..bedb103cc4c7b 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-single-variant-diagnostics.rs +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-single-variant-diagnostics.rs @@ -1,9 +1,5 @@ -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| `#[warn(incomplete_features)]` on by default -//~| see issue #53488 +// edition:2021 -// Check that precise paths are being reported back in the error message. enum SingleVariant { Point(i32, i32), diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-single-variant-diagnostics.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-single-variant-diagnostics.stderr index 402f5e4f33e6f..2a6e00850fa8a 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-single-variant-diagnostics.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-single-variant-diagnostics.stderr @@ -1,14 +1,5 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/closure-origin-single-variant-diagnostics.rs:1:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error[E0382]: use of moved value: `c` - --> $DIR/closure-origin-single-variant-diagnostics.rs:21:13 + --> $DIR/closure-origin-single-variant-diagnostics.rs:17:13 | LL | let b = c; | - value moved here @@ -16,11 +7,11 @@ LL | let a = c; | ^ value used here after move | note: closure cannot be moved more than once as it is not `Copy` due to moving the variable `point.0` out of its environment - --> $DIR/closure-origin-single-variant-diagnostics.rs:16:50 + --> $DIR/closure-origin-single-variant-diagnostics.rs:12:50 | LL | let SingleVariant::Point(ref mut x, _) = point; | ^^^^^ -error: aborting due to previous error; 1 warning emitted +error: aborting due to previous error For more information about this error, try `rustc --explain E0382`. diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-struct-diagnostics.rs b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-struct-diagnostics.rs index 103890f1f3537..3277a83c4e147 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-struct-diagnostics.rs +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-struct-diagnostics.rs @@ -1,7 +1,4 @@ -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| `#[warn(incomplete_features)]` on by default -//~| see issue #53488 +// edition:2021 // Check that precise paths are being reported back in the error message. diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-struct-diagnostics.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-struct-diagnostics.stderr index 474d77b7cd208..d7fc51c55eae3 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-struct-diagnostics.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-struct-diagnostics.stderr @@ -1,14 +1,5 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/closure-origin-struct-diagnostics.rs:1:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error[E0382]: use of moved value: `hello` - --> $DIR/closure-origin-struct-diagnostics.rs:24:13 + --> $DIR/closure-origin-struct-diagnostics.rs:21:13 | LL | let b = hello; | ----- value moved here @@ -16,11 +7,11 @@ LL | let c = hello; | ^^^^^ value used here after move | note: closure cannot be moved more than once as it is not `Copy` due to moving the variable `x.y.a` out of its environment - --> $DIR/closure-origin-struct-diagnostics.rs:20:9 + --> $DIR/closure-origin-struct-diagnostics.rs:17:9 | LL | x.y.a += 1; | ^^^^^ -error: aborting due to previous error; 1 warning emitted +error: aborting due to previous error For more information about this error, try `rustc --explain E0382`. diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics-1.rs b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics-1.rs index 6b078d2329c2f..dc3a57ae793e7 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics-1.rs +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics-1.rs @@ -1,7 +1,4 @@ -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| `#[warn(incomplete_features)]` on by default -//~| see issue #53488 +// edition:2021 // Check that precise paths are being reported back in the error message. diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics-1.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics-1.stderr index 716728e96ecbb..63e2d300eb06a 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics-1.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics-1.stderr @@ -1,14 +1,5 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/closure-origin-tuple-diagnostics-1.rs:1:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error[E0382]: use of moved value: `hello` - --> $DIR/closure-origin-tuple-diagnostics-1.rs:15:13 + --> $DIR/closure-origin-tuple-diagnostics-1.rs:12:13 | LL | let b = hello; | ----- value moved here @@ -16,11 +7,11 @@ LL | let c = hello; | ^^^^^ value used here after move | note: closure cannot be moved more than once as it is not `Copy` due to moving the variable `x.0` out of its environment - --> $DIR/closure-origin-tuple-diagnostics-1.rs:11:9 + --> $DIR/closure-origin-tuple-diagnostics-1.rs:8:9 | LL | x.0 += 1; | ^^^ -error: aborting due to previous error; 1 warning emitted +error: aborting due to previous error For more information about this error, try `rustc --explain E0382`. diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics.rs b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics.rs index 0638db607690f..fa1328013db45 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics.rs +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics.rs @@ -1,7 +1,5 @@ -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| `#[warn(incomplete_features)]` on by default -//~| see issue #53488 +// edition:2021 + struct S(String, String); fn expect_fn(_f: F) {} diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics.stderr index 77eb2a94ffb4d..df33c4f1fd6d4 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics.stderr @@ -1,14 +1,5 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/closure-origin-tuple-diagnostics.rs:1:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce` - --> $DIR/closure-origin-tuple-diagnostics.rs:11:13 + --> $DIR/closure-origin-tuple-diagnostics.rs:9:13 | LL | let c = || { | ^^ this closure implements `FnOnce`, not `Fn` @@ -18,6 +9,6 @@ LL | }; LL | expect_fn(c); | --------- the requirement to implement `Fn` derives from here -error: aborting due to previous error; 1 warning emitted +error: aborting due to previous error For more information about this error, try `rustc --explain E0525`. diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/liveness.rs b/src/test/ui/closures/2229_closure_analysis/diagnostics/liveness.rs index 09491f296f667..1cc22fac35282 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/liveness.rs +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/liveness.rs @@ -1,6 +1,6 @@ +// edition:2021 + // check-pass -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete #![allow(unreachable_code)] #![warn(unused)] diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/liveness.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/liveness.stderr index 81bbc4e1dc0c2..4eac5a2d282b0 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/liveness.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/liveness.stderr @@ -1,12 +1,3 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/liveness.rs:2:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - warning: value captured by `a` is never read --> $DIR/liveness.rs:23:9 | @@ -75,5 +66,5 @@ LL | b = Some("e1"); | = help: did you mean to capture by reference instead? -warning: 8 warnings emitted +warning: 7 warnings emitted diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/liveness_unintentional_copy.rs b/src/test/ui/closures/2229_closure_analysis/diagnostics/liveness_unintentional_copy.rs index e2035464dfa8a..10a7d07a1df99 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/liveness_unintentional_copy.rs +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/liveness_unintentional_copy.rs @@ -1,6 +1,6 @@ +// edition:2021 + // check-pass -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete #![warn(unused)] #[derive(Debug)] diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/liveness_unintentional_copy.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/liveness_unintentional_copy.stderr index 35b0c22fc4fb9..f74303e3dd682 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/liveness_unintentional_copy.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/liveness_unintentional_copy.stderr @@ -1,12 +1,3 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/liveness_unintentional_copy.rs:2:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - warning: value assigned to `a` is never read --> $DIR/liveness_unintentional_copy.rs:19:9 | @@ -43,5 +34,5 @@ LL | a += x; | = help: did you mean to capture by reference instead? -warning: 4 warnings emitted +warning: 3 warnings emitted diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/multilevel-path.rs b/src/test/ui/closures/2229_closure_analysis/diagnostics/multilevel-path.rs index 39b04c833e384..fa73ff23f9cd3 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/multilevel-path.rs +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/multilevel-path.rs @@ -1,8 +1,8 @@ +// edition:2021 + // Test that when a borrow checker diagnostics are emitted, it's as precise // as the capture by the closure. -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete #![allow(unused)] struct Point { diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/multilevel-path.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/multilevel-path.stderr index a3d1f550557af..ac4c9c93769ce 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/multilevel-path.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/multilevel-path.stderr @@ -1,12 +1,3 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/multilevel-path.rs:4:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error[E0499]: cannot borrow `w.p.x` as mutable more than once at a time --> $DIR/multilevel-path.rs:23:14 | @@ -21,6 +12,6 @@ LL | LL | c(); | - first borrow later used here -error: aborting due to previous error; 1 warning emitted +error: aborting due to previous error For more information about this error, try `rustc --explain E0499`. diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/mut_ref.rs b/src/test/ui/closures/2229_closure_analysis/diagnostics/mut_ref.rs index 676fde558dfbc..3d5a31e8b8e49 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/mut_ref.rs +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/mut_ref.rs @@ -1,9 +1,8 @@ +// edition:2021 + // Test that we can't mutate a place if we need to deref an imm-borrow // to reach it. -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete - fn imm_mut_ref() { let mut x = String::new(); let y = String::new(); diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/mut_ref.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/mut_ref.stderr index 831e486db82af..dbf8523a3bae1 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/mut_ref.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/mut_ref.stderr @@ -1,14 +1,5 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/mut_ref.rs:4:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error[E0596]: cannot borrow `**ref_mref_x` as mutable, as it is behind a `&` reference - --> $DIR/mut_ref.rs:13:13 + --> $DIR/mut_ref.rs:12:13 | LL | let ref_mref_x = &mref_x; | ------- help: consider changing this to be a mutable reference: `&mut mref_x` @@ -20,7 +11,7 @@ LL | **ref_mref_x = y; | ------------ mutable borrow occurs due to use of `**ref_mref_x` in closure error[E0596]: cannot borrow `**mref_ref_x` as mutable, as it is behind a `&` reference - --> $DIR/mut_ref.rs:27:13 + --> $DIR/mut_ref.rs:26:13 | LL | let c = || { | ^^ cannot borrow as mutable @@ -28,6 +19,6 @@ LL | LL | **mref_ref_x = y; | ------------ mutable borrow occurs due to use of `**mref_ref_x` in closure -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0596`. diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/repr_packed.rs b/src/test/ui/closures/2229_closure_analysis/diagnostics/repr_packed.rs index 82ec60a2e790a..4799f488d7d52 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/repr_packed.rs +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/repr_packed.rs @@ -1,7 +1,6 @@ -// check-pass +// edition:2021 -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete +// check-pass // Given how the closure desugaring is implemented (at least at the time of writing this test), // we don't need to truncate the captured path to a reference into a packed-struct if the field diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/repr_packed.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/repr_packed.stderr index e8cc164be8754..d2466681a0877 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/repr_packed.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/repr_packed.stderr @@ -1,14 +1,5 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/repr_packed.rs:3:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - warning: reference to packed field is unaligned - --> $DIR/repr_packed.rs:25:24 + --> $DIR/repr_packed.rs:24:24 | LL | println!("{}", foo.x); | ^^^^^ @@ -18,5 +9,5 @@ LL | println!("{}", foo.x); = note: for more information, see issue #82523 = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) -warning: 2 warnings emitted +warning: 1 warning emitted diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/simple-struct-min-capture.rs b/src/test/ui/closures/2229_closure_analysis/diagnostics/simple-struct-min-capture.rs index e78d8715e4893..ed2d9a3de00f8 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/simple-struct-min-capture.rs +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/simple-struct-min-capture.rs @@ -1,9 +1,8 @@ +// edition:2021 + // Test that borrow checker error is accurate and that min capture pass of the // closure analysis is working as expected. -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete - #[derive(Debug)] struct Point { x: i32, diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/simple-struct-min-capture.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/simple-struct-min-capture.stderr index f1748fda151c5..32705af3d0166 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/simple-struct-min-capture.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/simple-struct-min-capture.stderr @@ -1,14 +1,5 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/simple-struct-min-capture.rs:4:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error[E0502]: cannot borrow `p` as immutable because it is also borrowed as mutable - --> $DIR/simple-struct-min-capture.rs:23:22 + --> $DIR/simple-struct-min-capture.rs:22:22 | LL | let mut c = || { | -- mutable borrow occurs here @@ -23,6 +14,6 @@ LL | LL | c(); | - mutable borrow later used here -error: aborting due to previous error; 1 warning emitted +error: aborting due to previous error For more information about this error, try `rustc --explain E0502`. diff --git a/src/test/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.rs b/src/test/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.rs index a3222635b626c..269cf76e67351 100644 --- a/src/test/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.rs +++ b/src/test/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.rs @@ -1,7 +1,5 @@ -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 +// edition:2021 + #![feature(rustc_attrs)] fn main() { diff --git a/src/test/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.stderr b/src/test/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.stderr index a031360ed34e1..b936c5ee35a4d 100644 --- a/src/test/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.stderr +++ b/src/test/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes on expressions are experimental - --> $DIR/feature-gate-capture_disjoint_fields.rs:10:13 + --> $DIR/feature-gate-capture_disjoint_fields.rs:8:13 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,17 +7,8 @@ LL | let c = #[rustc_capture_analysis] = note: see issue #15701 for more information = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/feature-gate-capture_disjoint_fields.rs:1:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error: First Pass analysis includes: - --> $DIR/feature-gate-capture_disjoint_fields.rs:13:5 + --> $DIR/feature-gate-capture_disjoint_fields.rs:11:5 | LL | / || { LL | | @@ -29,13 +20,13 @@ LL | | }; | |_____^ | note: Capturing s[] -> ImmBorrow - --> $DIR/feature-gate-capture_disjoint_fields.rs:16:69 + --> $DIR/feature-gate-capture_disjoint_fields.rs:14:69 | LL | println!("This uses new capture analyysis to capture s={}", s); | ^ error: Min Capture analysis includes: - --> $DIR/feature-gate-capture_disjoint_fields.rs:13:5 + --> $DIR/feature-gate-capture_disjoint_fields.rs:11:5 | LL | / || { LL | | @@ -47,11 +38,11 @@ LL | | }; | |_____^ | note: Min Capture s[] -> ImmBorrow - --> $DIR/feature-gate-capture_disjoint_fields.rs:16:69 + --> $DIR/feature-gate-capture_disjoint_fields.rs:14:69 | LL | println!("This uses new capture analyysis to capture s={}", s); | ^ -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/filter-on-struct-member.rs b/src/test/ui/closures/2229_closure_analysis/filter-on-struct-member.rs index 9466e103897fb..bfa3ebcd6d286 100644 --- a/src/test/ui/closures/2229_closure_analysis/filter-on-struct-member.rs +++ b/src/test/ui/closures/2229_closure_analysis/filter-on-struct-member.rs @@ -1,9 +1,5 @@ -// FIXME(arora-aman) add run-pass once 2229 is implemented +// edition:2021 -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 #![feature(rustc_attrs)] struct Filter { diff --git a/src/test/ui/closures/2229_closure_analysis/filter-on-struct-member.stderr b/src/test/ui/closures/2229_closure_analysis/filter-on-struct-member.stderr index e9420fe5a0c3a..10e0d076b4276 100644 --- a/src/test/ui/closures/2229_closure_analysis/filter-on-struct-member.stderr +++ b/src/test/ui/closures/2229_closure_analysis/filter-on-struct-member.stderr @@ -1,35 +1,26 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/filter-on-struct-member.rs:3:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error: First Pass analysis includes: - --> $DIR/filter-on-struct-member.rs:28:13 + --> $DIR/filter-on-struct-member.rs:24:13 | LL | |v| self.filter.allowed(*v), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: Capturing self[Deref,(0, 0)] -> ImmBorrow - --> $DIR/filter-on-struct-member.rs:28:17 + --> $DIR/filter-on-struct-member.rs:24:17 | LL | |v| self.filter.allowed(*v), | ^^^^^^^^^^^ error: Min Capture analysis includes: - --> $DIR/filter-on-struct-member.rs:28:13 + --> $DIR/filter-on-struct-member.rs:24:13 | LL | |v| self.filter.allowed(*v), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: Min Capture self[Deref,(0, 0)] -> ImmBorrow - --> $DIR/filter-on-struct-member.rs:28:17 + --> $DIR/filter-on-struct-member.rs:24:17 | LL | |v| self.filter.allowed(*v), | ^^^^^^^^^^^ -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 2 previous errors diff --git a/src/test/ui/closures/2229_closure_analysis/move_closure.rs b/src/test/ui/closures/2229_closure_analysis/move_closure.rs index f96370eb20315..06db19974eb04 100644 --- a/src/test/ui/closures/2229_closure_analysis/move_closure.rs +++ b/src/test/ui/closures/2229_closure_analysis/move_closure.rs @@ -1,9 +1,7 @@ +// edition:2021 + // Test that move closures drop derefs with `capture_disjoint_fields` enabled. -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 #![feature(rustc_attrs)] fn simple_move_closure() { diff --git a/src/test/ui/closures/2229_closure_analysis/move_closure.stderr b/src/test/ui/closures/2229_closure_analysis/move_closure.stderr index 82aa7ab891260..013cacfb9f2a5 100644 --- a/src/test/ui/closures/2229_closure_analysis/move_closure.stderr +++ b/src/test/ui/closures/2229_closure_analysis/move_closure.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes on expressions are experimental - --> $DIR/move_closure.rs:14:17 + --> $DIR/move_closure.rs:12:17 | LL | let mut c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | let mut c = #[rustc_capture_analysis] = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/move_closure.rs:32:17 + --> $DIR/move_closure.rs:30:17 | LL | let mut c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | let mut c = #[rustc_capture_analysis] = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/move_closure.rs:53:17 + --> $DIR/move_closure.rs:51:17 | LL | let mut c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -26,7 +26,7 @@ LL | let mut c = #[rustc_capture_analysis] = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/move_closure.rs:76:17 + --> $DIR/move_closure.rs:74:17 | LL | let mut c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -35,7 +35,7 @@ LL | let mut c = #[rustc_capture_analysis] = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/move_closure.rs:98:17 + --> $DIR/move_closure.rs:96:17 | LL | let mut c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -44,7 +44,7 @@ LL | let mut c = #[rustc_capture_analysis] = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/move_closure.rs:120:13 + --> $DIR/move_closure.rs:118:13 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -53,7 +53,7 @@ LL | let c = #[rustc_capture_analysis] = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/move_closure.rs:137:13 + --> $DIR/move_closure.rs:135:13 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -62,7 +62,7 @@ LL | let c = #[rustc_capture_analysis] = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/move_closure.rs:154:13 + --> $DIR/move_closure.rs:152:13 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -70,17 +70,8 @@ LL | let c = #[rustc_capture_analysis] = note: see issue #15701 for more information = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/move_closure.rs:3:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error: First Pass analysis includes: - --> $DIR/move_closure.rs:17:5 + --> $DIR/move_closure.rs:15:5 | LL | / move || { LL | | @@ -92,13 +83,13 @@ LL | | }; | |_____^ | note: Capturing t[(0, 0),(0, 0)] -> ByValue - --> $DIR/move_closure.rs:20:9 + --> $DIR/move_closure.rs:18:9 | LL | t.0.0 = "new S".into(); | ^^^^^ error: Min Capture analysis includes: - --> $DIR/move_closure.rs:17:5 + --> $DIR/move_closure.rs:15:5 | LL | / move || { LL | | @@ -110,13 +101,13 @@ LL | | }; | |_____^ | note: Min Capture t[(0, 0),(0, 0)] -> ByValue - --> $DIR/move_closure.rs:20:9 + --> $DIR/move_closure.rs:18:9 | LL | t.0.0 = "new S".into(); | ^^^^^ error: First Pass analysis includes: - --> $DIR/move_closure.rs:35:5 + --> $DIR/move_closure.rs:33:5 | LL | / move || { LL | | @@ -128,13 +119,13 @@ LL | | }; | |_____^ | note: Capturing ref_s[Deref] -> UniqueImmBorrow - --> $DIR/move_closure.rs:38:9 + --> $DIR/move_closure.rs:36:9 | LL | *ref_s += 10; | ^^^^^^ error: Min Capture analysis includes: - --> $DIR/move_closure.rs:35:5 + --> $DIR/move_closure.rs:33:5 | LL | / move || { LL | | @@ -146,13 +137,13 @@ LL | | }; | |_____^ | note: Min Capture ref_s[Deref] -> UniqueImmBorrow - --> $DIR/move_closure.rs:38:9 + --> $DIR/move_closure.rs:36:9 | LL | *ref_s += 10; | ^^^^^^ error: First Pass analysis includes: - --> $DIR/move_closure.rs:56:5 + --> $DIR/move_closure.rs:54:5 | LL | / move || { LL | | @@ -164,13 +155,13 @@ LL | | }; | |_____^ | note: Capturing t[(0, 0),Deref,(0, 0)] -> UniqueImmBorrow - --> $DIR/move_closure.rs:59:9 + --> $DIR/move_closure.rs:57:9 | LL | t.0.0 = "new s".into(); | ^^^^^ error: Min Capture analysis includes: - --> $DIR/move_closure.rs:56:5 + --> $DIR/move_closure.rs:54:5 | LL | / move || { LL | | @@ -182,13 +173,13 @@ LL | | }; | |_____^ | note: Min Capture t[(0, 0),Deref,(0, 0)] -> UniqueImmBorrow - --> $DIR/move_closure.rs:59:9 + --> $DIR/move_closure.rs:57:9 | LL | t.0.0 = "new s".into(); | ^^^^^ error: First Pass analysis includes: - --> $DIR/move_closure.rs:79:5 + --> $DIR/move_closure.rs:77:5 | LL | / move || { LL | | @@ -200,13 +191,13 @@ LL | | }; | |_____^ | note: Capturing t[(0, 0),Deref,(0, 0)] -> ImmBorrow - --> $DIR/move_closure.rs:82:18 + --> $DIR/move_closure.rs:80:18 | LL | let _t = t.0.0; | ^^^^^ error: Min Capture analysis includes: - --> $DIR/move_closure.rs:79:5 + --> $DIR/move_closure.rs:77:5 | LL | / move || { LL | | @@ -218,13 +209,13 @@ LL | | }; | |_____^ | note: Min Capture t[(0, 0),Deref,(0, 0)] -> ImmBorrow - --> $DIR/move_closure.rs:82:18 + --> $DIR/move_closure.rs:80:18 | LL | let _t = t.0.0; | ^^^^^ error: First Pass analysis includes: - --> $DIR/move_closure.rs:101:5 + --> $DIR/move_closure.rs:99:5 | LL | / move || { LL | | @@ -236,18 +227,18 @@ LL | | }; | |_____^ | note: Capturing t[(0, 0),Deref,(0, 0)] -> ImmBorrow - --> $DIR/move_closure.rs:104:18 + --> $DIR/move_closure.rs:102:18 | LL | let _t = t.0.0; | ^^^^^ note: Capturing t[(0, 0)] -> ByValue - --> $DIR/move_closure.rs:104:18 + --> $DIR/move_closure.rs:102:18 | LL | let _t = t.0.0; | ^^^^^ error: Min Capture analysis includes: - --> $DIR/move_closure.rs:101:5 + --> $DIR/move_closure.rs:99:5 | LL | / move || { LL | | @@ -259,13 +250,13 @@ LL | | }; | |_____^ | note: Min Capture t[(0, 0)] -> ByValue - --> $DIR/move_closure.rs:104:18 + --> $DIR/move_closure.rs:102:18 | LL | let _t = t.0.0; | ^^^^^ error: First Pass analysis includes: - --> $DIR/move_closure.rs:123:5 + --> $DIR/move_closure.rs:121:5 | LL | / move || { LL | | @@ -277,18 +268,18 @@ LL | | }; | |_____^ | note: Capturing b[Deref,(0, 0)] -> ByValue - --> $DIR/move_closure.rs:126:18 + --> $DIR/move_closure.rs:124:18 | LL | let _t = b.0; | ^^^ note: Capturing b[] -> ByValue - --> $DIR/move_closure.rs:126:18 + --> $DIR/move_closure.rs:124:18 | LL | let _t = b.0; | ^^^ error: Min Capture analysis includes: - --> $DIR/move_closure.rs:123:5 + --> $DIR/move_closure.rs:121:5 | LL | / move || { LL | | @@ -300,13 +291,13 @@ LL | | }; | |_____^ | note: Min Capture b[] -> ByValue - --> $DIR/move_closure.rs:126:18 + --> $DIR/move_closure.rs:124:18 | LL | let _t = b.0; | ^^^ error: First Pass analysis includes: - --> $DIR/move_closure.rs:140:5 + --> $DIR/move_closure.rs:138:5 | LL | / move || { LL | | @@ -318,13 +309,13 @@ LL | | }; | |_____^ | note: Capturing b[Deref,(0, 0)] -> ByValue - --> $DIR/move_closure.rs:143:24 + --> $DIR/move_closure.rs:141:24 | LL | println!("{}", b.0); | ^^^ error: Min Capture analysis includes: - --> $DIR/move_closure.rs:140:5 + --> $DIR/move_closure.rs:138:5 | LL | / move || { LL | | @@ -336,13 +327,13 @@ LL | | }; | |_____^ | note: Min Capture b[] -> ByValue - --> $DIR/move_closure.rs:143:24 + --> $DIR/move_closure.rs:141:24 | LL | println!("{}", b.0); | ^^^ error: First Pass analysis includes: - --> $DIR/move_closure.rs:157:5 + --> $DIR/move_closure.rs:155:5 | LL | / move || { LL | | @@ -354,13 +345,13 @@ LL | | }; | |_____^ | note: Capturing t[(1, 0),Deref,(0, 0)] -> ByValue - --> $DIR/move_closure.rs:160:24 + --> $DIR/move_closure.rs:158:24 | LL | println!("{}", t.1.0); | ^^^^^ error: Min Capture analysis includes: - --> $DIR/move_closure.rs:157:5 + --> $DIR/move_closure.rs:155:5 | LL | / move || { LL | | @@ -372,11 +363,11 @@ LL | | }; | |_____^ | note: Min Capture t[(1, 0)] -> ByValue - --> $DIR/move_closure.rs:160:24 + --> $DIR/move_closure.rs:158:24 | LL | println!("{}", t.1.0); | ^^^^^ -error: aborting due to 24 previous errors; 1 warning emitted +error: aborting due to 24 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/multilevel-path-1.rs b/src/test/ui/closures/2229_closure_analysis/multilevel-path-1.rs index 7d2d4c104d489..a8a2acfa78d2c 100644 --- a/src/test/ui/closures/2229_closure_analysis/multilevel-path-1.rs +++ b/src/test/ui/closures/2229_closure_analysis/multilevel-path-1.rs @@ -1,7 +1,5 @@ -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 +// edition:2021 + #![feature(rustc_attrs)] #![allow(unused)] diff --git a/src/test/ui/closures/2229_closure_analysis/multilevel-path-1.stderr b/src/test/ui/closures/2229_closure_analysis/multilevel-path-1.stderr index 1c8db7952afe7..29ad1c59198cf 100644 --- a/src/test/ui/closures/2229_closure_analysis/multilevel-path-1.stderr +++ b/src/test/ui/closures/2229_closure_analysis/multilevel-path-1.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes on expressions are experimental - --> $DIR/multilevel-path-1.rs:24:13 + --> $DIR/multilevel-path-1.rs:22:13 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,17 +7,8 @@ LL | let c = #[rustc_capture_analysis] = note: see issue #15701 for more information = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/multilevel-path-1.rs:1:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error: First Pass analysis includes: - --> $DIR/multilevel-path-1.rs:27:5 + --> $DIR/multilevel-path-1.rs:25:5 | LL | / || { LL | | @@ -29,13 +20,13 @@ LL | | }; | |_____^ | note: Capturing w[(0, 0)] -> ImmBorrow - --> $DIR/multilevel-path-1.rs:30:19 + --> $DIR/multilevel-path-1.rs:28:19 | LL | let wp = &w.p; | ^^^ error: Min Capture analysis includes: - --> $DIR/multilevel-path-1.rs:27:5 + --> $DIR/multilevel-path-1.rs:25:5 | LL | / || { LL | | @@ -47,11 +38,11 @@ LL | | }; | |_____^ | note: Min Capture w[(0, 0)] -> ImmBorrow - --> $DIR/multilevel-path-1.rs:30:19 + --> $DIR/multilevel-path-1.rs:28:19 | LL | let wp = &w.p; | ^^^ -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/multilevel-path-2.rs b/src/test/ui/closures/2229_closure_analysis/multilevel-path-2.rs index 540e70138e50e..e21fe318cd105 100644 --- a/src/test/ui/closures/2229_closure_analysis/multilevel-path-2.rs +++ b/src/test/ui/closures/2229_closure_analysis/multilevel-path-2.rs @@ -1,9 +1,5 @@ -// FIXME(arora-aman) add run-pass once 2229 is implemented +// edition:2021 -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 #![feature(rustc_attrs)] #![allow(unused)] diff --git a/src/test/ui/closures/2229_closure_analysis/multilevel-path-2.stderr b/src/test/ui/closures/2229_closure_analysis/multilevel-path-2.stderr index 37287f6b3bc74..929cba113146b 100644 --- a/src/test/ui/closures/2229_closure_analysis/multilevel-path-2.stderr +++ b/src/test/ui/closures/2229_closure_analysis/multilevel-path-2.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes on expressions are experimental - --> $DIR/multilevel-path-2.rs:21:13 + --> $DIR/multilevel-path-2.rs:17:13 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,17 +7,8 @@ LL | let c = #[rustc_capture_analysis] = note: see issue #15701 for more information = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/multilevel-path-2.rs:3:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error: First Pass analysis includes: - --> $DIR/multilevel-path-2.rs:24:5 + --> $DIR/multilevel-path-2.rs:20:5 | LL | / || { LL | | @@ -29,13 +20,13 @@ LL | | }; | |_____^ | note: Capturing w[(0, 0),(0, 0)] -> ImmBorrow - --> $DIR/multilevel-path-2.rs:27:24 + --> $DIR/multilevel-path-2.rs:23:24 | LL | println!("{}", w.p.x); | ^^^^^ error: Min Capture analysis includes: - --> $DIR/multilevel-path-2.rs:24:5 + --> $DIR/multilevel-path-2.rs:20:5 | LL | / || { LL | | @@ -47,11 +38,11 @@ LL | | }; | |_____^ | note: Min Capture w[(0, 0),(0, 0)] -> ImmBorrow - --> $DIR/multilevel-path-2.rs:27:24 + --> $DIR/multilevel-path-2.rs:23:24 | LL | println!("{}", w.p.x); | ^^^^^ -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/nested-closure.rs b/src/test/ui/closures/2229_closure_analysis/nested-closure.rs index 88620550f2e7c..f6775b3a3a5ac 100644 --- a/src/test/ui/closures/2229_closure_analysis/nested-closure.rs +++ b/src/test/ui/closures/2229_closure_analysis/nested-closure.rs @@ -1,9 +1,5 @@ -// FIXME(arora-aman) add run-pass once 2229 is implemented +// edition:2021 -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 #![feature(rustc_attrs)] struct Point { diff --git a/src/test/ui/closures/2229_closure_analysis/nested-closure.stderr b/src/test/ui/closures/2229_closure_analysis/nested-closure.stderr index 21147be3f1d08..013bc74e67e1e 100644 --- a/src/test/ui/closures/2229_closure_analysis/nested-closure.stderr +++ b/src/test/ui/closures/2229_closure_analysis/nested-closure.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes on expressions are experimental - --> $DIR/nested-closure.rs:23:18 + --> $DIR/nested-closure.rs:19:18 | LL | let mut c1 = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | let mut c1 = #[rustc_capture_analysis] = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/nested-closure.rs:33:22 + --> $DIR/nested-closure.rs:29:22 | LL | let mut c2 = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -16,51 +16,42 @@ LL | let mut c2 = #[rustc_capture_analysis] = note: see issue #15701 for more information = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/nested-closure.rs:3:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error: First Pass analysis includes: - --> $DIR/nested-closure.rs:36:9 + --> $DIR/nested-closure.rs:32:9 | LL | || p.y += incr; | ^^^^^^^^^^^^^^ | note: Capturing p[(1, 0)] -> MutBorrow - --> $DIR/nested-closure.rs:36:12 + --> $DIR/nested-closure.rs:32:12 | LL | || p.y += incr; | ^^^ note: Capturing incr[] -> ImmBorrow - --> $DIR/nested-closure.rs:36:19 + --> $DIR/nested-closure.rs:32:19 | LL | || p.y += incr; | ^^^^ error: Min Capture analysis includes: - --> $DIR/nested-closure.rs:36:9 + --> $DIR/nested-closure.rs:32:9 | LL | || p.y += incr; | ^^^^^^^^^^^^^^ | note: Min Capture p[(1, 0)] -> MutBorrow - --> $DIR/nested-closure.rs:36:12 + --> $DIR/nested-closure.rs:32:12 | LL | || p.y += incr; | ^^^ note: Min Capture incr[] -> ImmBorrow - --> $DIR/nested-closure.rs:36:19 + --> $DIR/nested-closure.rs:32:19 | LL | || p.y += incr; | ^^^^ error: First Pass analysis includes: - --> $DIR/nested-closure.rs:26:5 + --> $DIR/nested-closure.rs:22:5 | LL | / || { LL | | @@ -72,18 +63,18 @@ LL | | }; | |_____^ | note: Capturing p[(0, 0)] -> ImmBorrow - --> $DIR/nested-closure.rs:29:24 + --> $DIR/nested-closure.rs:25:24 | LL | println!("{}", p.x); | ^^^ note: Capturing p[(1, 0)] -> MutBorrow - --> $DIR/nested-closure.rs:36:12 + --> $DIR/nested-closure.rs:32:12 | LL | || p.y += incr; | ^^^ error: Min Capture analysis includes: - --> $DIR/nested-closure.rs:26:5 + --> $DIR/nested-closure.rs:22:5 | LL | / || { LL | | @@ -95,16 +86,16 @@ LL | | }; | |_____^ | note: Min Capture p[(0, 0)] -> ImmBorrow - --> $DIR/nested-closure.rs:29:24 + --> $DIR/nested-closure.rs:25:24 | LL | println!("{}", p.x); | ^^^ note: Min Capture p[(1, 0)] -> MutBorrow - --> $DIR/nested-closure.rs:36:12 + --> $DIR/nested-closure.rs:32:12 | LL | || p.y += incr; | ^^^ -error: aborting due to 6 previous errors; 1 warning emitted +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/path-with-array-access.rs b/src/test/ui/closures/2229_closure_analysis/path-with-array-access.rs index 16acd2f3206c9..0c10319314a6f 100644 --- a/src/test/ui/closures/2229_closure_analysis/path-with-array-access.rs +++ b/src/test/ui/closures/2229_closure_analysis/path-with-array-access.rs @@ -1,7 +1,5 @@ -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 +// edition:2021 + #![feature(rustc_attrs)] struct Point { diff --git a/src/test/ui/closures/2229_closure_analysis/path-with-array-access.stderr b/src/test/ui/closures/2229_closure_analysis/path-with-array-access.stderr index 3c8d07ed9ba67..124b7bf6fe270 100644 --- a/src/test/ui/closures/2229_closure_analysis/path-with-array-access.stderr +++ b/src/test/ui/closures/2229_closure_analysis/path-with-array-access.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes on expressions are experimental - --> $DIR/path-with-array-access.rs:25:13 + --> $DIR/path-with-array-access.rs:23:13 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,17 +7,8 @@ LL | let c = #[rustc_capture_analysis] = note: see issue #15701 for more information = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/path-with-array-access.rs:1:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error: First Pass analysis includes: - --> $DIR/path-with-array-access.rs:28:5 + --> $DIR/path-with-array-access.rs:26:5 | LL | / || { LL | | @@ -29,13 +20,13 @@ LL | | }; | |_____^ | note: Capturing pent[(0, 0)] -> ImmBorrow - --> $DIR/path-with-array-access.rs:31:24 + --> $DIR/path-with-array-access.rs:29:24 | LL | println!("{}", pent.points[5].x); | ^^^^^^^^^^^ error: Min Capture analysis includes: - --> $DIR/path-with-array-access.rs:28:5 + --> $DIR/path-with-array-access.rs:26:5 | LL | / || { LL | | @@ -47,11 +38,11 @@ LL | | }; | |_____^ | note: Min Capture pent[(0, 0)] -> ImmBorrow - --> $DIR/path-with-array-access.rs:31:24 + --> $DIR/path-with-array-access.rs:29:24 | LL | println!("{}", pent.points[5].x); | ^^^^^^^^^^^ -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/pattern-matching-should-fail.rs b/src/test/ui/closures/2229_closure_analysis/pattern-matching-should-fail.rs index 609a11a578ae8..0f288ffa95a87 100644 --- a/src/test/ui/closures/2229_closure_analysis/pattern-matching-should-fail.rs +++ b/src/test/ui/closures/2229_closure_analysis/pattern-matching-should-fail.rs @@ -1,7 +1,5 @@ -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| `#[warn(incomplete_features)]` on by default -//~| see issue #53488 +// edition:2021 + #![feature(never_type)] // Should fake read the discriminant and throw an error diff --git a/src/test/ui/closures/2229_closure_analysis/pattern-matching-should-fail.stderr b/src/test/ui/closures/2229_closure_analysis/pattern-matching-should-fail.stderr index c225abb58b731..45641ea3de3e0 100644 --- a/src/test/ui/closures/2229_closure_analysis/pattern-matching-should-fail.stderr +++ b/src/test/ui/closures/2229_closure_analysis/pattern-matching-should-fail.stderr @@ -1,14 +1,5 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/pattern-matching-should-fail.rs:1:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error[E0004]: non-exhaustive patterns: type `u8` is non-empty - --> $DIR/pattern-matching-should-fail.rs:72:23 + --> $DIR/pattern-matching-should-fail.rs:70:23 | LL | let c1 = || match x { }; | ^ @@ -17,13 +8,13 @@ LL | let c1 = || match x { }; = note: the matched value is of type `u8` error[E0381]: use of possibly-uninitialized variable: `x` - --> $DIR/pattern-matching-should-fail.rs:10:23 + --> $DIR/pattern-matching-should-fail.rs:8:23 | LL | let c1 = || match x { }; | ^ use of possibly-uninitialized `x` error[E0381]: borrow of possibly-uninitialized variable: `x` - --> $DIR/pattern-matching-should-fail.rs:17:14 + --> $DIR/pattern-matching-should-fail.rs:15:14 | LL | let c2 = || match x { _ => () }; | ^^ - borrow occurs due to use in closure @@ -31,7 +22,7 @@ LL | let c2 = || match x { _ => () }; | use of possibly-uninitialized `x` error[E0381]: borrow of possibly-uninitialized variable: `variant` - --> $DIR/pattern-matching-should-fail.rs:29:13 + --> $DIR/pattern-matching-should-fail.rs:27:13 | LL | let c = || { | ^^ use of possibly-uninitialized `variant` @@ -40,7 +31,7 @@ LL | match variant { | ------- borrow occurs due to use in closure error[E0381]: borrow of possibly-uninitialized variable: `variant` - --> $DIR/pattern-matching-should-fail.rs:41:13 + --> $DIR/pattern-matching-should-fail.rs:39:13 | LL | let c = || { | ^^ use of possibly-uninitialized `variant` @@ -49,24 +40,24 @@ LL | match variant { | ------- borrow occurs due to use in closure error[E0381]: use of possibly-uninitialized variable: `g` - --> $DIR/pattern-matching-should-fail.rs:57:15 + --> $DIR/pattern-matching-should-fail.rs:55:15 | LL | match g { }; | ^ use of possibly-uninitialized `g` error[E0381]: use of possibly-uninitialized variable: `t` - --> $DIR/pattern-matching-should-fail.rs:60:19 + --> $DIR/pattern-matching-should-fail.rs:58:19 | LL | match t { }; | ^ use of possibly-uninitialized `t` error[E0381]: use of possibly-uninitialized variable: `x` - --> $DIR/pattern-matching-should-fail.rs:72:23 + --> $DIR/pattern-matching-should-fail.rs:70:23 | LL | let c1 = || match x { }; | ^ use of possibly-uninitialized `x` -error: aborting due to 8 previous errors; 1 warning emitted +error: aborting due to 8 previous errors Some errors have detailed explanations: E0004, E0381. For more information about an error, try `rustc --explain E0004`. diff --git a/src/test/ui/closures/2229_closure_analysis/patterns-capture-analysis.rs b/src/test/ui/closures/2229_closure_analysis/patterns-capture-analysis.rs index 0a877dd366c7f..56f5ac44db068 100644 --- a/src/test/ui/closures/2229_closure_analysis/patterns-capture-analysis.rs +++ b/src/test/ui/closures/2229_closure_analysis/patterns-capture-analysis.rs @@ -1,7 +1,5 @@ -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 +// edition:2021 + #![feature(rustc_attrs)] // Should capture the discriminant since a variant of a multivariant enum is diff --git a/src/test/ui/closures/2229_closure_analysis/patterns-capture-analysis.stderr b/src/test/ui/closures/2229_closure_analysis/patterns-capture-analysis.stderr index ad3e96a5753e3..460813333952b 100644 --- a/src/test/ui/closures/2229_closure_analysis/patterns-capture-analysis.stderr +++ b/src/test/ui/closures/2229_closure_analysis/patterns-capture-analysis.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes on expressions are experimental - --> $DIR/patterns-capture-analysis.rs:12:14 + --> $DIR/patterns-capture-analysis.rs:10:14 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | let c = #[rustc_capture_analysis] = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/patterns-capture-analysis.rs:33:14 + --> $DIR/patterns-capture-analysis.rs:31:14 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | let c = #[rustc_capture_analysis] = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/patterns-capture-analysis.rs:54:14 + --> $DIR/patterns-capture-analysis.rs:52:14 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -26,7 +26,7 @@ LL | let c = #[rustc_capture_analysis] = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/patterns-capture-analysis.rs:70:14 + --> $DIR/patterns-capture-analysis.rs:68:14 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -35,7 +35,7 @@ LL | let c = #[rustc_capture_analysis] = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/patterns-capture-analysis.rs:92:14 + --> $DIR/patterns-capture-analysis.rs:90:14 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -44,7 +44,7 @@ LL | let c = #[rustc_capture_analysis] = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/patterns-capture-analysis.rs:116:14 + --> $DIR/patterns-capture-analysis.rs:114:14 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -52,17 +52,8 @@ LL | let c = #[rustc_capture_analysis] = note: see issue #15701 for more information = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/patterns-capture-analysis.rs:1:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error: First Pass analysis includes: - --> $DIR/patterns-capture-analysis.rs:16:5 + --> $DIR/patterns-capture-analysis.rs:14:5 | LL | / || { LL | | @@ -74,13 +65,13 @@ LL | | }; | |_____^ | note: Capturing variant[] -> ImmBorrow - --> $DIR/patterns-capture-analysis.rs:19:15 + --> $DIR/patterns-capture-analysis.rs:17:15 | LL | match variant { | ^^^^^^^ error: Min Capture analysis includes: - --> $DIR/patterns-capture-analysis.rs:16:5 + --> $DIR/patterns-capture-analysis.rs:14:5 | LL | / || { LL | | @@ -92,13 +83,13 @@ LL | | }; | |_____^ | note: Min Capture variant[] -> ImmBorrow - --> $DIR/patterns-capture-analysis.rs:19:15 + --> $DIR/patterns-capture-analysis.rs:17:15 | LL | match variant { | ^^^^^^^ error: First Pass analysis includes: - --> $DIR/patterns-capture-analysis.rs:36:5 + --> $DIR/patterns-capture-analysis.rs:34:5 | LL | / || { LL | | @@ -109,7 +100,7 @@ LL | | }; | |_____^ error: First Pass analysis includes: - --> $DIR/patterns-capture-analysis.rs:57:5 + --> $DIR/patterns-capture-analysis.rs:55:5 | LL | / || { LL | | @@ -120,7 +111,7 @@ LL | | }; | |_____^ error: First Pass analysis includes: - --> $DIR/patterns-capture-analysis.rs:73:5 + --> $DIR/patterns-capture-analysis.rs:71:5 | LL | / || { LL | | @@ -132,18 +123,18 @@ LL | | }; | |_____^ | note: Capturing variant[] -> ImmBorrow - --> $DIR/patterns-capture-analysis.rs:76:15 + --> $DIR/patterns-capture-analysis.rs:74:15 | LL | match variant { | ^^^^^^^ note: Capturing variant[(0, 0)] -> ImmBorrow - --> $DIR/patterns-capture-analysis.rs:76:15 + --> $DIR/patterns-capture-analysis.rs:74:15 | LL | match variant { | ^^^^^^^ error: Min Capture analysis includes: - --> $DIR/patterns-capture-analysis.rs:73:5 + --> $DIR/patterns-capture-analysis.rs:71:5 | LL | / || { LL | | @@ -155,13 +146,13 @@ LL | | }; | |_____^ | note: Min Capture variant[] -> ImmBorrow - --> $DIR/patterns-capture-analysis.rs:76:15 + --> $DIR/patterns-capture-analysis.rs:74:15 | LL | match variant { | ^^^^^^^ error: First Pass analysis includes: - --> $DIR/patterns-capture-analysis.rs:95:5 + --> $DIR/patterns-capture-analysis.rs:93:5 | LL | / || { LL | | @@ -172,7 +163,7 @@ LL | | }; | |_____^ error: First Pass analysis includes: - --> $DIR/patterns-capture-analysis.rs:119:5 + --> $DIR/patterns-capture-analysis.rs:117:5 | LL | / || { LL | | @@ -184,13 +175,13 @@ LL | | }; | |_____^ | note: Capturing variant[] -> ImmBorrow - --> $DIR/patterns-capture-analysis.rs:122:15 + --> $DIR/patterns-capture-analysis.rs:120:15 | LL | match variant { | ^^^^^^^ error: Min Capture analysis includes: - --> $DIR/patterns-capture-analysis.rs:119:5 + --> $DIR/patterns-capture-analysis.rs:117:5 | LL | / || { LL | | @@ -202,11 +193,11 @@ LL | | }; | |_____^ | note: Min Capture variant[] -> ImmBorrow - --> $DIR/patterns-capture-analysis.rs:122:15 + --> $DIR/patterns-capture-analysis.rs:120:15 | LL | match variant { | ^^^^^^^ -error: aborting due to 15 previous errors; 1 warning emitted +error: aborting due to 15 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/repr_packed.rs b/src/test/ui/closures/2229_closure_analysis/repr_packed.rs index 2b9ef2a76bba7..7d472ad020f29 100644 --- a/src/test/ui/closures/2229_closure_analysis/repr_packed.rs +++ b/src/test/ui/closures/2229_closure_analysis/repr_packed.rs @@ -1,7 +1,4 @@ -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| `#[warn(incomplete_features)]` on by default -//~| see issue #53488 +// edition:2021 #![feature(rustc_attrs)] diff --git a/src/test/ui/closures/2229_closure_analysis/repr_packed.stderr b/src/test/ui/closures/2229_closure_analysis/repr_packed.stderr index 0517dd04b6f44..405f66210aa55 100644 --- a/src/test/ui/closures/2229_closure_analysis/repr_packed.stderr +++ b/src/test/ui/closures/2229_closure_analysis/repr_packed.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes on expressions are experimental - --> $DIR/repr_packed.rs:16:17 + --> $DIR/repr_packed.rs:13:17 | LL | let mut c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | let mut c = #[rustc_capture_analysis] = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/repr_packed.rs:47:17 + --> $DIR/repr_packed.rs:44:17 | LL | let mut c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | let mut c = #[rustc_capture_analysis] = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/repr_packed.rs:81:13 + --> $DIR/repr_packed.rs:78:13 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -25,17 +25,8 @@ LL | let c = #[rustc_capture_analysis] = note: see issue #15701 for more information = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/repr_packed.rs:1:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error: First Pass analysis includes: - --> $DIR/repr_packed.rs:19:5 + --> $DIR/repr_packed.rs:16:5 | LL | / || { LL | | @@ -47,18 +38,18 @@ LL | | }; | |_____^ | note: Capturing foo[(0, 0)] -> ImmBorrow - --> $DIR/repr_packed.rs:22:24 + --> $DIR/repr_packed.rs:19:24 | LL | let z1: &u8 = &foo.x; | ^^^^^ note: Capturing foo[(1, 0)] -> MutBorrow - --> $DIR/repr_packed.rs:25:32 + --> $DIR/repr_packed.rs:22:32 | LL | let z2: &mut u8 = &mut foo.y; | ^^^^^ error: Min Capture analysis includes: - --> $DIR/repr_packed.rs:19:5 + --> $DIR/repr_packed.rs:16:5 | LL | / || { LL | | @@ -70,18 +61,18 @@ LL | | }; | |_____^ | note: Min Capture foo[(0, 0)] -> ImmBorrow - --> $DIR/repr_packed.rs:22:24 + --> $DIR/repr_packed.rs:19:24 | LL | let z1: &u8 = &foo.x; | ^^^^^ note: Min Capture foo[(1, 0)] -> MutBorrow - --> $DIR/repr_packed.rs:25:32 + --> $DIR/repr_packed.rs:22:32 | LL | let z2: &mut u8 = &mut foo.y; | ^^^^^ error: First Pass analysis includes: - --> $DIR/repr_packed.rs:50:5 + --> $DIR/repr_packed.rs:47:5 | LL | / || { LL | | @@ -93,13 +84,13 @@ LL | | }; | |_____^ | note: Capturing foo[] -> MutBorrow - --> $DIR/repr_packed.rs:54:33 + --> $DIR/repr_packed.rs:51:33 | LL | let z2: &mut u16 = &mut foo.y; | ^^^^^ error: Min Capture analysis includes: - --> $DIR/repr_packed.rs:50:5 + --> $DIR/repr_packed.rs:47:5 | LL | / || { LL | | @@ -111,13 +102,13 @@ LL | | }; | |_____^ | note: Min Capture foo[] -> MutBorrow - --> $DIR/repr_packed.rs:54:33 + --> $DIR/repr_packed.rs:51:33 | LL | let z2: &mut u16 = &mut foo.y; | ^^^^^ error: First Pass analysis includes: - --> $DIR/repr_packed.rs:84:5 + --> $DIR/repr_packed.rs:81:5 | LL | / || { LL | | @@ -129,18 +120,18 @@ LL | | }; | |_____^ | note: Capturing foo[] -> ImmBorrow - --> $DIR/repr_packed.rs:87:24 + --> $DIR/repr_packed.rs:84:24 | LL | println!("{}", foo.x); | ^^^^^ note: Capturing foo[(0, 0)] -> ByValue - --> $DIR/repr_packed.rs:91:18 + --> $DIR/repr_packed.rs:88:18 | LL | let _z = foo.x; | ^^^^^ error: Min Capture analysis includes: - --> $DIR/repr_packed.rs:84:5 + --> $DIR/repr_packed.rs:81:5 | LL | / || { LL | | @@ -152,7 +143,7 @@ LL | | }; | |_____^ | note: Min Capture foo[] -> ByValue - --> $DIR/repr_packed.rs:87:24 + --> $DIR/repr_packed.rs:84:24 | LL | println!("{}", foo.x); | ^^^^^ foo[] used here @@ -160,6 +151,6 @@ LL | println!("{}", foo.x); LL | let _z = foo.x; | ^^^^^ foo[] captured as ByValue here -error: aborting due to 9 previous errors; 1 warning emitted +error: aborting due to 9 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/box.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/box.rs index 3a66399d02899..73aca288faa88 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/box.rs +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/box.rs @@ -1,13 +1,8 @@ +// edition:2021 // run-pass // Test precise capture when using boxes -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 - - struct MetaData { x: String, name: String } struct Data { m: MetaData } struct BoxedData(Box); diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/box.stderr b/src/test/ui/closures/2229_closure_analysis/run_pass/box.stderr deleted file mode 100644 index 9883c01b946c9..0000000000000 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/box.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/box.rs:5:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/by_value.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/by_value.rs index 9a93e6cf1e1ef..2c828aed528bf 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/by_value.rs +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/by_value.rs @@ -1,11 +1,9 @@ +// edition:2021 // run-pass // Test that ByValue captures compile sucessefully especially when the captures are // derefenced within the closure. -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete - #[derive(Debug, Default)] struct SomeLargeType; struct MuchLargerType([SomeLargeType; 32]); diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/by_value.stderr b/src/test/ui/closures/2229_closure_analysis/run_pass/by_value.stderr deleted file mode 100644 index 98715c6b94365..0000000000000 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/by_value.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/by_value.rs:6:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/capture-disjoint-field-struct.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/capture-disjoint-field-struct.rs index 2c359519b769b..3cb1eb32952d8 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/capture-disjoint-field-struct.rs +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/capture-disjoint-field-struct.rs @@ -1,13 +1,9 @@ +// edition:2021 // run-pass // Test that we can immutably borrow field of an instance of a structure from within a closure, // while having a mutable borrow to another field of the same instance outside the closure. -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 - struct Point { x: i32, y: i32, diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/capture-disjoint-field-struct.stderr b/src/test/ui/closures/2229_closure_analysis/run_pass/capture-disjoint-field-struct.stderr deleted file mode 100644 index 9b0dea770fba2..0000000000000 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/capture-disjoint-field-struct.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/capture-disjoint-field-struct.rs:6:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/capture-disjoint-field-tuple-mut.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/capture-disjoint-field-tuple-mut.rs index 2c6679feabe46..0f79b7ae7b8c6 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/capture-disjoint-field-tuple-mut.rs +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/capture-disjoint-field-tuple-mut.rs @@ -1,12 +1,9 @@ +// edition:2021 // run-pass // Test that we can mutate an element of a tuple from within a closure // while immutably borrowing another element of the same tuple outside the closure. -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 #![feature(rustc_attrs)] fn main() { diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/capture-disjoint-field-tuple-mut.stderr b/src/test/ui/closures/2229_closure_analysis/run_pass/capture-disjoint-field-tuple-mut.stderr deleted file mode 100644 index 28d0915395279..0000000000000 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/capture-disjoint-field-tuple-mut.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/capture-disjoint-field-tuple-mut.rs:6:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/capture-disjoint-field-tuple.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/capture-disjoint-field-tuple.rs index 52f5cef9f01c6..81f0328b9ba5f 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/capture-disjoint-field-tuple.rs +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/capture-disjoint-field-tuple.rs @@ -1,12 +1,9 @@ +// edition:2021 // run-pass // Test that we can immutably borrow an element of a tuple from within a closure, // while having a mutable borrow to another element of the same tuple outside the closure. -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 #![feature(rustc_attrs)] fn main() { diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/capture-disjoint-field-tuple.stderr b/src/test/ui/closures/2229_closure_analysis/run_pass/capture-disjoint-field-tuple.stderr deleted file mode 100644 index 4fb37f85f88b5..0000000000000 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/capture-disjoint-field-tuple.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/capture-disjoint-field-tuple.rs:6:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/capture_with_wildcard_match.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/capture_with_wildcard_match.rs index eaea0dbfb5e8c..cea02fbe15d34 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/capture_with_wildcard_match.rs +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/capture_with_wildcard_match.rs @@ -1,6 +1,5 @@ +// edition:2021 //check-pass -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete fn test1() { let foo : [Vec; 3] = ["String".into(), "String".into(), "String".into()]; diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/capture_with_wildcard_match.stderr b/src/test/ui/closures/2229_closure_analysis/run_pass/capture_with_wildcard_match.stderr deleted file mode 100644 index 2c17a189afbbc..0000000000000 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/capture_with_wildcard_match.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/capture_with_wildcard_match.rs:2:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/destructure-pattern-closure-within-closure.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/destructure-pattern-closure-within-closure.rs index 3ad083a92d569..5c278bff90bb0 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/destructure-pattern-closure-within-closure.rs +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/destructure-pattern-closure-within-closure.rs @@ -1,6 +1,5 @@ -//check-pass -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete +// edition:2021 +// check-pass #![warn(unused)] fn main() { diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/destructure-pattern-closure-within-closure.stderr b/src/test/ui/closures/2229_closure_analysis/run_pass/destructure-pattern-closure-within-closure.stderr index c4abf934123b3..40274c88318c3 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/destructure-pattern-closure-within-closure.stderr +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/destructure-pattern-closure-within-closure.stderr @@ -1,30 +1,21 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/destructure-pattern-closure-within-closure.rs:2:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - warning: unused variable: `t2` - --> $DIR/destructure-pattern-closure-within-closure.rs:14:21 + --> $DIR/destructure-pattern-closure-within-closure.rs:13:21 | LL | let (_, t2) = t; | ^^ help: if this is intentional, prefix it with an underscore: `_t2` | note: the lint level is defined here - --> $DIR/destructure-pattern-closure-within-closure.rs:4:9 + --> $DIR/destructure-pattern-closure-within-closure.rs:3:9 | LL | #![warn(unused)] | ^^^^^^ = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]` warning: unused variable: `g2` - --> $DIR/destructure-pattern-closure-within-closure.rs:11:17 + --> $DIR/destructure-pattern-closure-within-closure.rs:10:17 | LL | let (_, g2) = g; | ^^ help: if this is intentional, prefix it with an underscore: `_g2` -warning: 3 warnings emitted +warning: 2 warnings emitted diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/destructure_patterns.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/destructure_patterns.rs index 65527648b2c99..07adbee03f968 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/destructure_patterns.rs +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/destructure_patterns.rs @@ -1,6 +1,5 @@ -//check-pass -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete +// edition:2021 +// check-pass #![warn(unused)] struct Point { diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/destructure_patterns.stderr b/src/test/ui/closures/2229_closure_analysis/run_pass/destructure_patterns.stderr index fcfe9ee95f185..6523f2b34d537 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/destructure_patterns.stderr +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/destructure_patterns.stderr @@ -1,66 +1,57 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/destructure_patterns.rs:2:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - warning: unused variable: `t1` - --> $DIR/destructure_patterns.rs:15:14 + --> $DIR/destructure_patterns.rs:14:14 | LL | let (t1, t2) = t; | ^^ help: if this is intentional, prefix it with an underscore: `_t1` | note: the lint level is defined here - --> $DIR/destructure_patterns.rs:4:9 + --> $DIR/destructure_patterns.rs:3:9 | LL | #![warn(unused)] | ^^^^^^ = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]` warning: unused variable: `t2` - --> $DIR/destructure_patterns.rs:15:18 + --> $DIR/destructure_patterns.rs:14:18 | LL | let (t1, t2) = t; | ^^ help: if this is intentional, prefix it with an underscore: `_t2` warning: unused variable: `t1` - --> $DIR/destructure_patterns.rs:27:14 + --> $DIR/destructure_patterns.rs:26:14 | LL | let (t1, _) = t; | ^^ help: if this is intentional, prefix it with an underscore: `_t1` warning: unused variable: `t2` - --> $DIR/destructure_patterns.rs:38:17 + --> $DIR/destructure_patterns.rs:37:17 | LL | let (_, t2) = t; | ^^ help: if this is intentional, prefix it with an underscore: `_t2` warning: unused variable: `t` - --> $DIR/destructure_patterns.rs:46:9 + --> $DIR/destructure_patterns.rs:45:9 | LL | let t = (String::from("Hello"), String::from("World")); | ^ help: if this is intentional, prefix it with an underscore: `_t` warning: unused variable: `x` - --> $DIR/destructure_patterns.rs:92:21 + --> $DIR/destructure_patterns.rs:91:21 | LL | let Point { x, y } = p; | ^ help: try ignoring the field: `x: _` warning: unused variable: `x` - --> $DIR/destructure_patterns.rs:84:9 + --> $DIR/destructure_patterns.rs:83:9 | LL | let x = 0; | ^ help: if this is intentional, prefix it with an underscore: `_x` warning: unused variable: `tup` - --> $DIR/destructure_patterns.rs:86:9 + --> $DIR/destructure_patterns.rs:85:9 | LL | let tup = (1, 2); | ^^^ help: if this is intentional, prefix it with an underscore: `_tup` -warning: 9 warnings emitted +warning: 8 warnings emitted diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/disjoint-capture-in-same-closure.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/disjoint-capture-in-same-closure.rs index 3f8e197b7837d..88a9816a05263 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/disjoint-capture-in-same-closure.rs +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/disjoint-capture-in-same-closure.rs @@ -1,10 +1,6 @@ +// edition:2021 // run-pass -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 - // Tests that if a closure uses indivual fields of the same object // then that case is handled properly. diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/disjoint-capture-in-same-closure.stderr b/src/test/ui/closures/2229_closure_analysis/run_pass/disjoint-capture-in-same-closure.stderr deleted file mode 100644 index bba90f8917acc..0000000000000 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/disjoint-capture-in-same-closure.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/disjoint-capture-in-same-closure.rs:3:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/drop_then_use_fake_reads.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/drop_then_use_fake_reads.rs index dae50854d82fb..477fdd613f521 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/drop_then_use_fake_reads.rs +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/drop_then_use_fake_reads.rs @@ -1,6 +1,5 @@ -//check-pass -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete +// edition:2021 +// check-pass #![feature(rustc_attrs)] fn main() { diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/drop_then_use_fake_reads.stderr b/src/test/ui/closures/2229_closure_analysis/run_pass/drop_then_use_fake_reads.stderr deleted file mode 100644 index 7f811875d1363..0000000000000 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/drop_then_use_fake_reads.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/drop_then_use_fake_reads.rs:2:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/filter-on-struct-member.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/filter-on-struct-member.rs index 8c12593430ef0..e19f5ff1bae4d 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/filter-on-struct-member.rs +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/filter-on-struct-member.rs @@ -1,12 +1,8 @@ +// edition:2021 // run-pass // Test disjoint capture within an impl block -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 - struct Filter { div: i32, } diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/filter-on-struct-member.stderr b/src/test/ui/closures/2229_closure_analysis/run_pass/filter-on-struct-member.stderr deleted file mode 100644 index 6930e18992ae2..0000000000000 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/filter-on-struct-member.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/filter-on-struct-member.rs:5:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/fru_syntax.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/fru_syntax.rs index e89cf4550c154..1286613cb13ba 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/fru_syntax.rs +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/fru_syntax.rs @@ -1,13 +1,9 @@ +// edition:2021 // run-pass // Test that functional record update/struct update syntax works inside // a closure when the feature `capture_disjoint_fields` is enabled. -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 - #[derive(Clone)] struct S { a: String, diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/fru_syntax.stderr b/src/test/ui/closures/2229_closure_analysis/run_pass/fru_syntax.stderr deleted file mode 100644 index 7ed73abba8608..0000000000000 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/fru_syntax.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/fru_syntax.rs:6:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/lit-pattern-matching-with-methods.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/lit-pattern-matching-with-methods.rs index 9c086fe4bdfe7..d2375aa69ec25 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/lit-pattern-matching-with-methods.rs +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/lit-pattern-matching-with-methods.rs @@ -1,6 +1,5 @@ +// edition:2021 //check-pass -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete #![warn(unused)] #![feature(rustc_attrs)] #![feature(btree_drain_filter)] diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/lit-pattern-matching-with-methods.stderr b/src/test/ui/closures/2229_closure_analysis/run_pass/lit-pattern-matching-with-methods.stderr deleted file mode 100644 index bc046ecad6867..0000000000000 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/lit-pattern-matching-with-methods.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/lit-pattern-matching-with-methods.rs:2:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/move_closure.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/move_closure.rs index afaafbda01877..65c8a5a7850fe 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/move_closure.rs +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/move_closure.rs @@ -1,10 +1,8 @@ +// edition:2021 // run-pass // Test that move closures compile properly with `capture_disjoint_fields` enabled. -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete - fn simple_ref() { let mut s = 10; let ref_s = &mut s; diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/move_closure.stderr b/src/test/ui/closures/2229_closure_analysis/run_pass/move_closure.stderr deleted file mode 100644 index c1d8ba575d6fd..0000000000000 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/move_closure.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/move_closure.rs:5:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-1.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-1.rs index 142c156bd56e7..b8e464031813b 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-1.rs +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-1.rs @@ -1,3 +1,4 @@ +// edition:2021 // run-pass // Test that closures can catpure paths that are more precise than just one level @@ -7,10 +8,6 @@ // while being able to mutate another path outside the closure, where the two paths are disjoint // after applying two projections on the root variable. -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 #![allow(unused)] struct Point { diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-1.stderr b/src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-1.stderr deleted file mode 100644 index 94b877522f4ae..0000000000000 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-1.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/multilevel-path-1.rs:10:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-2.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-2.rs index d8f7d55d5aa7b..11a324d8a34e3 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-2.rs +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-2.rs @@ -1,9 +1,6 @@ +// edition:2021 // run-pass -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 #![allow(unused)] // If the closures can handle such precison we should be able to read one path in the closure diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-2.stderr b/src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-2.stderr deleted file mode 100644 index 100a0e167c581..0000000000000 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-2.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/multilevel-path-2.rs:3:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-3.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-3.rs index fc3d48ec45810..8fc0efb60b755 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-3.rs +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-3.rs @@ -1,9 +1,6 @@ +// edition:2021 // run-pass -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 #![allow(unused)] // Test that when `capture_disjoint_fields` is enabled we can read a path diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-3.stderr b/src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-3.stderr deleted file mode 100644 index cf5be6a00e9a4..0000000000000 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-3.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/multilevel-path-3.rs:3:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/mut_ref.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/mut_ref.rs index 315622443c3cc..9f0c4d96aa5d9 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/mut_ref.rs +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/mut_ref.rs @@ -1,11 +1,9 @@ +// edition:2021 // run-pass // Test that we can mutate a place through a mut-borrow // that is captured by the closure -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete - // Check that we can mutate when one deref is required fn mut_ref_1() { let mut x = String::new(); diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/mut_ref.stderr b/src/test/ui/closures/2229_closure_analysis/run_pass/mut_ref.stderr deleted file mode 100644 index 4b37a0b405f5e..0000000000000 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/mut_ref.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/mut_ref.rs:6:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/mut_ref_struct_mem.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/mut_ref_struct_mem.rs index 2dba923647a2e..bb784774b8cd4 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/mut_ref_struct_mem.rs +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/mut_ref_struct_mem.rs @@ -1,3 +1,4 @@ +// edition:2021 // run-pass // Test that we can mutate a place through a mut-borrow @@ -6,9 +7,6 @@ // More specifically we test that the if the mutable reference isn't root variable of a capture // but rather accessed while acessing the precise capture. -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete - fn mut_tuple() { let mut t = (10, 10); diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/mut_ref_struct_mem.stderr b/src/test/ui/closures/2229_closure_analysis/run_pass/mut_ref_struct_mem.stderr deleted file mode 100644 index 418ab29098b2a..0000000000000 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/mut_ref_struct_mem.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/mut_ref_struct_mem.rs:9:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/nested-closure.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/nested-closure.rs index 238580929ef11..a80b40bb46957 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/nested-closure.rs +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/nested-closure.rs @@ -1,12 +1,8 @@ +// edition:2021 // run-pass // Test whether if we can do precise capture when using nested clsoure. -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 - struct Point { x: i32, y: i32, diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/nested-closure.stderr b/src/test/ui/closures/2229_closure_analysis/run_pass/nested-closure.stderr deleted file mode 100644 index 293aa82ce9fea..0000000000000 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/nested-closure.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/nested-closure.rs:5:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/struct-pattern-matching-with-methods.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/struct-pattern-matching-with-methods.rs index d260a448926d6..045fe78040a92 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/struct-pattern-matching-with-methods.rs +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/struct-pattern-matching-with-methods.rs @@ -1,6 +1,5 @@ +// edition:2021 //check-pass -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete #![warn(unused)] #![feature(rustc_attrs)] diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/struct-pattern-matching-with-methods.stderr b/src/test/ui/closures/2229_closure_analysis/run_pass/struct-pattern-matching-with-methods.stderr deleted file mode 100644 index 3e4303a3710df..0000000000000 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/struct-pattern-matching-with-methods.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/struct-pattern-matching-with-methods.rs:2:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/tuple-struct-pattern-matching-with-methods.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/tuple-struct-pattern-matching-with-methods.rs index b3bee79254ec4..f3f44433ccf3d 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/tuple-struct-pattern-matching-with-methods.rs +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/tuple-struct-pattern-matching-with-methods.rs @@ -1,6 +1,5 @@ +// edition:2021 //check-pass -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete #[derive(Copy, Clone)] enum PointType { diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/tuple-struct-pattern-matching-with-methods.stderr b/src/test/ui/closures/2229_closure_analysis/run_pass/tuple-struct-pattern-matching-with-methods.stderr deleted file mode 100644 index ded0e37b0f366..0000000000000 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/tuple-struct-pattern-matching-with-methods.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/tuple-struct-pattern-matching-with-methods.rs:2:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/unsafe_ptr.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/unsafe_ptr.rs index f6e9862b26c11..8e4f91c27e224 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/unsafe_ptr.rs +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/unsafe_ptr.rs @@ -1,10 +1,8 @@ +// edition:2021 // run-pass // Test that we can use raw ptrs when using `capture_disjoint_fields`. -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete - #[derive(Debug)] struct S { s: String, diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/unsafe_ptr.stderr b/src/test/ui/closures/2229_closure_analysis/run_pass/unsafe_ptr.stderr deleted file mode 100644 index c64c8b72e8151..0000000000000 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/unsafe_ptr.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/unsafe_ptr.rs:5:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/use_of_mutable_borrow_and_fake_reads.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/use_of_mutable_borrow_and_fake_reads.rs index 0e6da8f4f1889..0206927cc59e9 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/use_of_mutable_borrow_and_fake_reads.rs +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/use_of_mutable_borrow_and_fake_reads.rs @@ -1,6 +1,5 @@ +// edition:2021 //check-pass -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete #![feature(rustc_attrs)] fn main() { diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/use_of_mutable_borrow_and_fake_reads.stderr b/src/test/ui/closures/2229_closure_analysis/run_pass/use_of_mutable_borrow_and_fake_reads.stderr deleted file mode 100644 index 7d16d77bf737e..0000000000000 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/use_of_mutable_borrow_and_fake_reads.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/use_of_mutable_borrow_and_fake_reads.rs:2:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/closures/2229_closure_analysis/simple-struct-min-capture.rs b/src/test/ui/closures/2229_closure_analysis/simple-struct-min-capture.rs index a6b5e12d2ed78..563095d440d24 100644 --- a/src/test/ui/closures/2229_closure_analysis/simple-struct-min-capture.rs +++ b/src/test/ui/closures/2229_closure_analysis/simple-struct-min-capture.rs @@ -1,9 +1,5 @@ -// FIXME(arora-aman) add run-pass once 2229 is implemented +// edition:2021 -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 #![feature(rustc_attrs)] // Test to ensure that min analysis meets capture kind for all paths captured. diff --git a/src/test/ui/closures/2229_closure_analysis/simple-struct-min-capture.stderr b/src/test/ui/closures/2229_closure_analysis/simple-struct-min-capture.stderr index cbbc879219915..05d79797ab3c0 100644 --- a/src/test/ui/closures/2229_closure_analysis/simple-struct-min-capture.stderr +++ b/src/test/ui/closures/2229_closure_analysis/simple-struct-min-capture.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes on expressions are experimental - --> $DIR/simple-struct-min-capture.rs:27:17 + --> $DIR/simple-struct-min-capture.rs:23:17 | LL | let mut c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,17 +7,8 @@ LL | let mut c = #[rustc_capture_analysis] = note: see issue #15701 for more information = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/simple-struct-min-capture.rs:3:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error: First Pass analysis includes: - --> $DIR/simple-struct-min-capture.rs:30:5 + --> $DIR/simple-struct-min-capture.rs:26:5 | LL | / || { LL | | @@ -29,18 +20,18 @@ LL | | }; | |_____^ | note: Capturing p[(0, 0)] -> MutBorrow - --> $DIR/simple-struct-min-capture.rs:33:9 + --> $DIR/simple-struct-min-capture.rs:29:9 | LL | p.x += 10; | ^^^ note: Capturing p[] -> ImmBorrow - --> $DIR/simple-struct-min-capture.rs:36:26 + --> $DIR/simple-struct-min-capture.rs:32:26 | LL | println!("{:?}", p); | ^ error: Min Capture analysis includes: - --> $DIR/simple-struct-min-capture.rs:30:5 + --> $DIR/simple-struct-min-capture.rs:26:5 | LL | / || { LL | | @@ -52,7 +43,7 @@ LL | | }; | |_____^ | note: Min Capture p[] -> MutBorrow - --> $DIR/simple-struct-min-capture.rs:33:9 + --> $DIR/simple-struct-min-capture.rs:29:9 | LL | p.x += 10; | ^^^ p[] captured as MutBorrow here @@ -60,6 +51,6 @@ LL | p.x += 10; LL | println!("{:?}", p); | ^ p[] used here -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/unsafe_ptr.rs b/src/test/ui/closures/2229_closure_analysis/unsafe_ptr.rs index 79d3ecc2d2bed..eab9f9d08a9f6 100644 --- a/src/test/ui/closures/2229_closure_analysis/unsafe_ptr.rs +++ b/src/test/ui/closures/2229_closure_analysis/unsafe_ptr.rs @@ -1,10 +1,9 @@ +// edition:2021 + // Test that we restrict precision of a capture when we access a raw ptr, // i.e. the capture doesn't deref the raw ptr. -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| `#[warn(incomplete_features)]` on by default -//~| see issue #53488 + #![feature(rustc_attrs)] #[derive(Debug)] diff --git a/src/test/ui/closures/2229_closure_analysis/unsafe_ptr.stderr b/src/test/ui/closures/2229_closure_analysis/unsafe_ptr.stderr index 4508b2426e8ff..e740a4d2d6b80 100644 --- a/src/test/ui/closures/2229_closure_analysis/unsafe_ptr.stderr +++ b/src/test/ui/closures/2229_closure_analysis/unsafe_ptr.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes on expressions are experimental - --> $DIR/unsafe_ptr.rs:26:13 + --> $DIR/unsafe_ptr.rs:25:13 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | let c = #[rustc_capture_analysis] = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/unsafe_ptr.rs:46:13 + --> $DIR/unsafe_ptr.rs:45:13 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -16,17 +16,8 @@ LL | let c = #[rustc_capture_analysis] = note: see issue #15701 for more information = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/unsafe_ptr.rs:4:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error: First Pass analysis includes: - --> $DIR/unsafe_ptr.rs:29:6 + --> $DIR/unsafe_ptr.rs:28:6 | LL | / || unsafe { LL | | @@ -38,13 +29,13 @@ LL | | }; | |_____^ | note: Capturing t[(0, 0),Deref,(0, 0)] -> ImmBorrow - --> $DIR/unsafe_ptr.rs:32:26 + --> $DIR/unsafe_ptr.rs:31:26 | LL | println!("{:?}", (*t.0).s); | ^^^^^^^^ error: Min Capture analysis includes: - --> $DIR/unsafe_ptr.rs:29:6 + --> $DIR/unsafe_ptr.rs:28:6 | LL | / || unsafe { LL | | @@ -56,13 +47,13 @@ LL | | }; | |_____^ | note: Min Capture t[(0, 0)] -> ImmBorrow - --> $DIR/unsafe_ptr.rs:32:26 + --> $DIR/unsafe_ptr.rs:31:26 | LL | println!("{:?}", (*t.0).s); | ^^^^^^^^ error: First Pass analysis includes: - --> $DIR/unsafe_ptr.rs:49:5 + --> $DIR/unsafe_ptr.rs:48:5 | LL | / || { LL | | @@ -74,13 +65,13 @@ LL | | }; | |_____^ | note: Capturing p[Deref,(0, 0)] -> ImmBorrow - --> $DIR/unsafe_ptr.rs:52:31 + --> $DIR/unsafe_ptr.rs:51:31 | LL | let x = unsafe { &mut (*p).s }; | ^^^^^^ error: Min Capture analysis includes: - --> $DIR/unsafe_ptr.rs:49:5 + --> $DIR/unsafe_ptr.rs:48:5 | LL | / || { LL | | @@ -92,11 +83,11 @@ LL | | }; | |_____^ | note: Min Capture p[] -> ImmBorrow - --> $DIR/unsafe_ptr.rs:52:31 + --> $DIR/unsafe_ptr.rs:51:31 | LL | let x = unsafe { &mut (*p).s }; | ^^^^^^ -error: aborting due to 6 previous errors; 1 warning emitted +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/wild_patterns.rs b/src/test/ui/closures/2229_closure_analysis/wild_patterns.rs index 90b8033d074a1..7843c251666c5 100644 --- a/src/test/ui/closures/2229_closure_analysis/wild_patterns.rs +++ b/src/test/ui/closures/2229_closure_analysis/wild_patterns.rs @@ -1,7 +1,5 @@ -#![feature(capture_disjoint_fields)] -//~^ WARNING: the feature `capture_disjoint_fields` is incomplete -//~| NOTE: `#[warn(incomplete_features)]` on by default -//~| NOTE: see issue #53488 +// edition:2021 + #![feature(rustc_attrs)] // Test to ensure that we can handle cases where diff --git a/src/test/ui/closures/2229_closure_analysis/wild_patterns.stderr b/src/test/ui/closures/2229_closure_analysis/wild_patterns.stderr index 36be8431be508..c64378091e6e0 100644 --- a/src/test/ui/closures/2229_closure_analysis/wild_patterns.stderr +++ b/src/test/ui/closures/2229_closure_analysis/wild_patterns.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes on expressions are experimental - --> $DIR/wild_patterns.rs:24:13 + --> $DIR/wild_patterns.rs:22:13 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | let c = #[rustc_capture_analysis] = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/wild_patterns.rs:42:13 + --> $DIR/wild_patterns.rs:40:13 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | let c = #[rustc_capture_analysis] = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/wild_patterns.rs:60:13 + --> $DIR/wild_patterns.rs:58:13 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -25,17 +25,8 @@ LL | let c = #[rustc_capture_analysis] = note: see issue #15701 for more information = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable -warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/wild_patterns.rs:1:12 - | -LL | #![feature(capture_disjoint_fields)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #53488 for more information - error: First Pass analysis includes: - --> $DIR/wild_patterns.rs:27:5 + --> $DIR/wild_patterns.rs:25:5 | LL | / || { LL | | @@ -47,13 +38,13 @@ LL | | }; | |_____^ | note: Capturing p[(0, 0)] -> ImmBorrow - --> $DIR/wild_patterns.rs:31:37 + --> $DIR/wild_patterns.rs:29:37 | LL | let Point { x: _x, y: _ } = p; | ^ error: Min Capture analysis includes: - --> $DIR/wild_patterns.rs:27:5 + --> $DIR/wild_patterns.rs:25:5 | LL | / || { LL | | @@ -65,13 +56,13 @@ LL | | }; | |_____^ | note: Min Capture p[(0, 0)] -> ImmBorrow - --> $DIR/wild_patterns.rs:31:37 + --> $DIR/wild_patterns.rs:29:37 | LL | let Point { x: _x, y: _ } = p; | ^ error: First Pass analysis includes: - --> $DIR/wild_patterns.rs:45:5 + --> $DIR/wild_patterns.rs:43:5 | LL | / || { LL | | @@ -83,13 +74,13 @@ LL | | }; | |_____^ | note: Capturing t[(0, 0)] -> ByValue - --> $DIR/wild_patterns.rs:49:23 + --> $DIR/wild_patterns.rs:47:23 | LL | let (_x, _) = t; | ^ error: Min Capture analysis includes: - --> $DIR/wild_patterns.rs:45:5 + --> $DIR/wild_patterns.rs:43:5 | LL | / || { LL | | @@ -101,13 +92,13 @@ LL | | }; | |_____^ | note: Min Capture t[(0, 0)] -> ByValue - --> $DIR/wild_patterns.rs:49:23 + --> $DIR/wild_patterns.rs:47:23 | LL | let (_x, _) = t; | ^ error: First Pass analysis includes: - --> $DIR/wild_patterns.rs:63:5 + --> $DIR/wild_patterns.rs:61:5 | LL | / || { LL | | @@ -119,13 +110,13 @@ LL | | }; | |_____^ | note: Capturing arr[Index] -> ByValue - --> $DIR/wild_patterns.rs:67:23 + --> $DIR/wild_patterns.rs:65:23 | LL | let [_x, _] = arr; | ^^^ error: Min Capture analysis includes: - --> $DIR/wild_patterns.rs:63:5 + --> $DIR/wild_patterns.rs:61:5 | LL | / || { LL | | @@ -137,11 +128,11 @@ LL | | }; | |_____^ | note: Min Capture arr[] -> ByValue - --> $DIR/wild_patterns.rs:67:23 + --> $DIR/wild_patterns.rs:65:23 | LL | let [_x, _] = arr; | ^^^ -error: aborting due to 9 previous errors; 1 warning emitted +error: aborting due to 9 previous errors For more information about this error, try `rustc --explain E0658`. From 10a37bf847c1f24bfc321cebc550d1811eea3a9b Mon Sep 17 00:00:00 2001 From: Aman Arora Date: Sun, 27 Jun 2021 21:28:31 -0400 Subject: [PATCH 09/13] fixup! Editon 2021 enables precise capture --- compiler/rustc_mir_build/src/build/expr/as_place.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/compiler/rustc_mir_build/src/build/expr/as_place.rs b/compiler/rustc_mir_build/src/build/expr/as_place.rs index 9d7ac6ef6ac46..bedb8b1c58b82 100644 --- a/compiler/rustc_mir_build/src/build/expr/as_place.rs +++ b/compiler/rustc_mir_build/src/build/expr/as_place.rs @@ -246,8 +246,7 @@ fn to_upvars_resolved_place_builder<'a, 'tcx>( return Err(from_builder); }; - let closure_ty = typeck_results - .node_type(tcx.hir().local_def_id_to_hir_id(closure_def_id.expect_local())); + let closure_ty = typeck_results.node_type(closure_hir_id); let substs = match closure_ty.kind() { ty::Closure(_, substs) => ty::UpvarSubsts::Closure(substs), From 83a2bc31b9f68d8ba5fe2854bf38df5e564c575b Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 23 Apr 2021 16:43:18 +0200 Subject: [PATCH 10/13] Add new tool to check HTML: * Make html-checker run by default on rust compiler docs as well * Ensure html-checker is run on CI * Lazify tidy binary presence check --- Cargo.lock | 7 ++ Cargo.toml | 1 + src/bootstrap/builder.rs | 1 + src/bootstrap/doc.rs | 4 +- src/bootstrap/test.rs | 45 ++++++++- src/bootstrap/tool.rs | 1 + .../host-x86_64/x86_64-gnu-tools/Dockerfile | 3 +- src/tools/html-checker/Cargo.toml | 12 +++ src/tools/html-checker/main.rs | 96 +++++++++++++++++++ 9 files changed, 166 insertions(+), 4 deletions(-) create mode 100644 src/tools/html-checker/Cargo.toml create mode 100644 src/tools/html-checker/main.rs diff --git a/Cargo.lock b/Cargo.lock index 65ad130d5599d..d57d17a3581fd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1578,6 +1578,13 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "html-checker" +version = "0.1.0" +dependencies = [ + "walkdir", +] + [[package]] name = "html5ever" version = "0.25.1" diff --git a/Cargo.toml b/Cargo.toml index 327afe35c2fb9..4c00a7dc99ea9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,6 +34,7 @@ members = [ "src/tools/unicode-table-generator", "src/tools/expand-yaml-anchors", "src/tools/jsondocck", + "src/tools/html-checker", ] exclude = [ diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index e2f605257bd95..b4c5a2abc9c90 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -450,6 +450,7 @@ impl<'a> Builder<'a> { test::RustdocTheme, test::RustdocUi, test::RustdocJson, + test::HtmlCheck, // Run bootstrap close to the end as it's unlikely to fail test::Bootstrap, // Run run-make last, since these won't pass without make on Windows diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index d2fabf9967f2f..634332df86352 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -501,8 +501,8 @@ impl Step for Std { #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct Rustc { - stage: u32, - target: TargetSelection, + pub stage: u32, + pub target: TargetSelection, } impl Step for Rustc { diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 92ac3b364f6f1..64b3ee7c359e7 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -9,7 +9,7 @@ use std::fmt; use std::fs; use std::iter; use std::path::{Path, PathBuf}; -use std::process::Command; +use std::process::{Command, Stdio}; use build_helper::{self, output, t}; @@ -161,6 +161,49 @@ You can skip linkcheck with --exclude src/tools/linkchecker" } } +fn check_if_tidy_is_installed() -> bool { + Command::new("tidy") + .arg("--version") + .stdout(Stdio::null()) + .status() + .map_or(false, |status| status.success()) +} + +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct HtmlCheck { + target: TargetSelection, +} + +impl Step for HtmlCheck { + type Output = (); + const DEFAULT: bool = true; + const ONLY_HOSTS: bool = true; + + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { + let run = run.path("src/tools/html-checker"); + run.lazy_default_condition(Box::new(check_if_tidy_is_installed)) + } + + fn make_run(run: RunConfig<'_>) { + run.builder.ensure(HtmlCheck { target: run.target }); + } + + fn run(self, builder: &Builder<'_>) { + if !check_if_tidy_is_installed() { + eprintln!("not running HTML-check tool because `tidy` is missing"); + eprintln!( + "Note that `tidy` is not the in-tree `src/tools/tidy` but needs to be installed" + ); + panic!("Cannot run html-check tests"); + } + // Ensure that a few different kinds of documentation are available. + builder.default_doc(&[]); + builder.ensure(crate::doc::Rustc { target: self.target, stage: builder.top_stage }); + + try_run(builder, builder.tool_cmd(Tool::HtmlChecker).arg(builder.doc_out(self.target))); + } +} + #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub struct Cargotest { stage: u32, diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index 9d75ad0918a79..aa7fe658df320 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -376,6 +376,7 @@ bootstrap_tool!( ExpandYamlAnchors, "src/tools/expand-yaml-anchors", "expand-yaml-anchors"; LintDocs, "src/tools/lint-docs", "lint-docs"; JsonDocCk, "src/tools/jsondocck", "jsondocck"; + HtmlChecker, "src/tools/html-checker", "html-checker"; ); #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, Ord, PartialOrd)] diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile index 35d274da673b8..faed1761fa45c 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile @@ -12,7 +12,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ cmake \ libssl-dev \ sudo \ - xz-utils + xz-utils \ + tidy # Install dependencies for chromium browser RUN apt-get install -y \ diff --git a/src/tools/html-checker/Cargo.toml b/src/tools/html-checker/Cargo.toml new file mode 100644 index 0000000000000..fe35df823b656 --- /dev/null +++ b/src/tools/html-checker/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "html-checker" +version = "0.1.0" +authors = ["Guillaume Gomez "] +edition = "2018" + +[[bin]] +name = "html-checker" +path = "main.rs" + +[dependencies] +walkdir = "2" diff --git a/src/tools/html-checker/main.rs b/src/tools/html-checker/main.rs new file mode 100644 index 0000000000000..a93191191cc09 --- /dev/null +++ b/src/tools/html-checker/main.rs @@ -0,0 +1,96 @@ +use std::env; +use std::path::Path; +use std::process::{Command, Output}; + +fn check_html_file(file: &Path) -> usize { + let to_mute = &[ + // "disabled" on or "autocomplete" on . When the fix is merged upstream, + // this warning can be used again. + "REPEATED_ATTRIBUTE", + // FIXME: mdbook uses "align" attribute on , which is not allowed. + "MISMATCHED_ATTRIBUTE_WARN", + // FIXME: mdbook doesn't add "alt" attribute on images. + "MISSING_ATTRIBUTE", + // FIXME: mdbook doesn't escape `&` (in "&String" for example). + "UNKNOWN_ENTITY", + // Compiler docs have some inlined