From f4880a0f2fa2e0a6581f6f06fd45b51484569473 Mon Sep 17 00:00:00 2001 From: jackh726 Date: Wed, 15 Jul 2026 15:46:53 +0000 Subject: [PATCH 1/3] Add -Zpolonius=nll option and use it in tests. --- compiler/rustc_borrowck/src/dataflow.rs | 2 +- .../src/diagnostics/explain_borrow.rs | 8 ++++- compiler/rustc_borrowck/src/polonius/dump.rs | 2 +- .../src/type_check/liveness/mod.rs | 9 +++++- compiler/rustc_borrowck/src/type_check/mod.rs | 9 +++++- compiler/rustc_session/src/config.rs | 9 ++++-- compiler/rustc_session/src/options.rs | 7 +++- ...-hide-lifetime-for-swap.edition2015.stderr | 2 +- ...-hide-lifetime-for-swap.edition2024.stderr | 2 +- ...de-lifetime-for-swap.polonius_alpha.stderr | 2 +- .../gat-hide-lifetime-for-swap.rs | 2 ++ ...me-in-type-arg-for-swap.edition2015.stderr | 2 +- ...me-in-type-arg-for-swap.edition2024.stderr | 2 +- ...in-type-arg-for-swap.polonius_alpha.stderr | 2 +- .../gat-hide-lifetime-in-type-arg-for-swap.rs | 2 ++ .../gat-outlives-env.edition2015.stderr | 2 +- .../gat-outlives-env.edition2024.stderr | 2 +- .../gat-outlives-env.polonius_alpha.stderr | 2 +- .../alias-liveness/gat-outlives-env.rs | 2 ++ .../gat-outlives-implied.edition2024.stderr | 2 +- ...gat-outlives-implied.polonius_alpha.stderr | 2 +- .../alias-liveness/gat-outlives-implied.rs | 1 + ...-hide-lifetime-for-swap.edition2015.stderr | 4 +-- ...-hide-lifetime-for-swap.edition2024.stderr | 4 +-- ...de-lifetime-for-swap.polonius_alpha.stderr | 4 +-- .../rpit-hide-lifetime-for-swap.rs | 2 ++ ...me-in-type-arg-for-swap.edition2015.stderr | 2 +- ...me-in-type-arg-for-swap.edition2024.stderr | 2 +- ...in-type-arg-for-swap.polonius_alpha.stderr | 2 +- ...rpit-hide-lifetime-in-type-arg-for-swap.rs | 2 ++ ...-hide-lifetime-for-swap.edition2015.stderr | 2 +- ...-hide-lifetime-for-swap.edition2024.stderr | 2 +- ...de-lifetime-for-swap.polonius_alpha.stderr | 2 +- .../rpitit-hide-lifetime-for-swap.rs | 2 ++ .../drop/dropck-normalize-errors.nll.stderr | 32 +++++++++---------- .../dropck-normalize-errors.polonius.stderr | 26 +++++++-------- tests/ui/drop/dropck-normalize-errors.rs | 1 + tests/ui/nll/get_default.legacy.stderr | 2 +- tests/ui/nll/get_default.nll.stderr | 6 ++-- tests/ui/nll/get_default.polonius.stderr | 2 +- tests/ui/nll/get_default.rs | 1 + tests/ui/nll/issue-46589.nll.stderr | 2 +- tests/ui/nll/issue-46589.polonius.stderr | 2 +- tests/ui/nll/issue-46589.rs | 1 + ...ng-lending-iterator-issue-92985.nll.stderr | 2 +- .../filtering-lending-iterator-issue-92985.rs | 1 + ...ng-updating-cursor-issue-108704.nll.stderr | 2 +- ...dating-cursor-issue-108704.polonius.stderr | 2 +- .../iterating-updating-cursor-issue-108704.rs | 1 + ...ing-updating-cursor-issue-57165.nll.stderr | 4 +-- ...pdating-cursor-issue-57165.polonius.stderr | 4 +-- .../iterating-updating-cursor-issue-57165.rs | 1 + ...ing-updating-cursor-issue-63908.nll.stderr | 2 +- ...pdating-cursor-issue-63908.polonius.stderr | 2 +- .../iterating-updating-cursor-issue-63908.rs | 1 + .../iterating-updating-mutref.nll.stderr | 2 +- .../nll/polonius/iterating-updating-mutref.rs | 1 + ...nsitive-constraints-issue-70044.nll.stderr | 2 +- ...ion-insensitive-constraints-issue-70044.rs | 1 + ...insensitive-scopes-issue-116657.nll.stderr | 6 ++-- ...sitive-scopes-issue-116657.polonius.stderr | 6 ++-- ...ocation-insensitive-scopes-issue-116657.rs | 1 + ...insensitive-scopes-issue-117146.nll.stderr | 10 +++--- ...sitive-scopes-issue-117146.polonius.stderr | 10 +++--- ...ocation-insensitive-scopes-issue-117146.rs | 1 + .../location-insensitive-scopes-liveness.rs | 5 +-- .../nll-problem-case-2-issue-92038.nll.stderr | 2 +- .../nll-problem-case-2-issue-92038.rs | 1 + ...nll-problem-case-3-issue-112087.nll.stderr | 2 +- .../nll-problem-case-3-issue-112087.rs | 1 + ...nll-problem-case-3-issue-123839.nll.stderr | 2 +- .../nll-problem-case-3-issue-123839.rs | 1 + ...nll-problem-case-3-issue-124070.nll.stderr | 2 +- .../nll-problem-case-3-issue-124070.rs | 1 + ...nll-problem-case-3-issue-124254.nll.stderr | 4 +-- .../nll-problem-case-3-issue-124254.rs | 1 + .../nll-problem-case-3-issue-21906.nll.stderr | 14 ++++---- .../nll-problem-case-3-issue-21906.rs | 1 + .../nll-problem-case-3-issue-51526.nll.stderr | 2 +- .../nll-problem-case-3-issue-51526.rs | 1 + .../nll-problem-case-3-issue-51545.nll.stderr | 2 +- .../nll-problem-case-3-issue-51545.rs | 1 + .../nll-problem-case-3-issue-54663.nll.stderr | 2 +- .../nll-problem-case-3-issue-54663.rs | 1 + .../nll-problem-case-3-issue-58787.nll.stderr | 18 +++++------ .../nll-problem-case-3-issue-58787.rs | 1 + .../nll-problem-case-3-issue-68934.nll.stderr | 2 +- .../nll-problem-case-3-issue-68934.rs | 1 + .../wf/hir-wf-check-erase-regions.nll.stderr | 8 ++--- ...hir-wf-check-erase-regions.polonius.stderr | 6 ++-- tests/ui/wf/hir-wf-check-erase-regions.rs | 1 + 91 files changed, 195 insertions(+), 130 deletions(-) diff --git a/compiler/rustc_borrowck/src/dataflow.rs b/compiler/rustc_borrowck/src/dataflow.rs index 0bc06ade95ea1..72231e24e8af7 100644 --- a/compiler/rustc_borrowck/src/dataflow.rs +++ b/compiler/rustc_borrowck/src/dataflow.rs @@ -433,7 +433,7 @@ impl<'a, 'tcx> Borrows<'a, 'tcx> { borrow_set: &'a BorrowSet<'tcx>, ) -> Self { let borrows_out_of_scope_at_location = - if !tcx.sess.opts.unstable_opts.polonius.is_next_enabled() { + if !tcx.sess.opts.unstable_opts.polonius.is_next_enabled(tcx.sess.is_nightly_build()) { calculate_borrows_out_of_scope_at_location(body, regioncx, borrow_set) } else { PoloniusOutOfScopePrecomputer::compute(body, regioncx, borrow_set) diff --git a/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs b/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs index 1b633aefc22f8..ac6dea7274714 100644 --- a/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs +++ b/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs @@ -632,7 +632,13 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> { if let Some(polonius_context) = self.polonius_context { polonius_context.boring_nll_locals.contains(&local) } else { - assert!(!tcx.sess.opts.unstable_opts.polonius.is_next_enabled()); + assert!( + !tcx.sess + .opts + .unstable_opts + .polonius + .is_next_enabled(tcx.sess.is_nightly_build()) + ); // Boring locals are never the cause of a borrow explanation in NLLs. false diff --git a/compiler/rustc_borrowck/src/polonius/dump.rs b/compiler/rustc_borrowck/src/polonius/dump.rs index 5285f724b02ec..dc849f172675b 100644 --- a/compiler/rustc_borrowck/src/polonius/dump.rs +++ b/compiler/rustc_borrowck/src/polonius/dump.rs @@ -25,7 +25,7 @@ pub(crate) fn dump_polonius_mir<'tcx>( polonius_context: Option<&PoloniusContext>, ) { let tcx = infcx.tcx; - if !tcx.sess.opts.unstable_opts.polonius.is_next_enabled() { + if !tcx.sess.opts.unstable_opts.polonius.is_next_enabled(tcx.sess.is_nightly_build()) { return; } diff --git a/compiler/rustc_borrowck/src/type_check/liveness/mod.rs b/compiler/rustc_borrowck/src/type_check/liveness/mod.rs index 442c37e26ec18..cbff0865be782 100644 --- a/compiler/rustc_borrowck/src/type_check/liveness/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/liveness/mod.rs @@ -45,7 +45,14 @@ pub(super) fn generate<'tcx>( // unlike NLLs. // We do record these regions in the polonius context, since they're used to differentiate // relevant and boring locals, which is a key distinction used later in diagnostics. - if typeck.tcx().sess.opts.unstable_opts.polonius.is_next_enabled() { + if typeck + .tcx() + .sess + .opts + .unstable_opts + .polonius + .is_next_enabled(typeck.tcx().sess.is_nightly_build()) + { let (_, boring_locals) = compute_relevant_live_locals(typeck.tcx(), &free_regions, typeck.body); typeck.polonius_context.as_mut().unwrap().boring_nll_locals = diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs index 9c4b1f998dcee..a1654074d8b29 100644 --- a/compiler/rustc_borrowck/src/type_check/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/mod.rs @@ -138,7 +138,14 @@ pub(crate) fn type_check<'tcx>( debug!(?normalized_inputs_and_output); - let polonius_context = if infcx.tcx.sess.opts.unstable_opts.polonius.is_next_enabled() { + let polonius_context = if infcx + .tcx + .sess + .opts + .unstable_opts + .polonius + .is_next_enabled(infcx.tcx.sess.is_nightly_build()) + { Some(PoloniusContext::default()) } else { None diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 8ed01315ade53..35bd884d163b6 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -3425,9 +3425,12 @@ impl PatchableFunctionEntry { /// or future prototype. #[derive(Clone, Copy, PartialEq, Hash, Debug, Default)] pub enum Polonius { - /// The default value: disabled. + /// The default value: diabled. #[default] - Off, + Default, + + /// Polonius is disabled, only use NLL. + NLL, /// Legacy version, using datalog and the `polonius-engine` crate. Historical value for `-Zpolonius`. Legacy, @@ -3443,7 +3446,7 @@ impl Polonius { } /// Returns whether the "next" version of polonius is enabled - pub fn is_next_enabled(&self) -> bool { + pub fn is_next_enabled(&self, _is_nightly: bool) -> bool { matches!(self, Polonius::Next) } } diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 6f3a505c2c26f..e5bbfc5786ab1 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -847,7 +847,8 @@ mod desc { components: `crto`, `libc`, `unwind`, `linker`, `sanitizers`, `mingw`"; pub(crate) const parse_linker_features: &str = "a list of enabled (`+` prefix) and disabled (`-` prefix) features: `lld`"; - pub(crate) const parse_polonius: &str = "either no value or `legacy` (the default), or `next`"; + pub(crate) const parse_polonius: &str = + "either no value or one of `legacy` (the default), `nll`, or `next`"; pub(crate) const parse_annotate_moves: &str = "either a boolean (`yes`, `no`, `on`, `off`, etc.), or a size limit in bytes"; pub(crate) const parse_stack_protector: &str = @@ -942,6 +943,10 @@ pub mod parse { *slot = Polonius::Next; true } + Some("nll") => { + *slot = Polonius::NLL; + true + } _ => false, } } diff --git a/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-for-swap.edition2015.stderr b/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-for-swap.edition2015.stderr index 3c31169a8675d..59d7bf0b938d5 100644 --- a/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-for-swap.edition2015.stderr +++ b/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-for-swap.edition2015.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local variable `x` - --> $DIR/gat-hide-lifetime-for-swap.rs:33:5 + --> $DIR/gat-hide-lifetime-for-swap.rs:35:5 | LL | h.hide_ref(&mut res).swap(h.hide_ref(&mut &x)); | -- `x` is borrowed here diff --git a/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-for-swap.edition2024.stderr b/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-for-swap.edition2024.stderr index 3c31169a8675d..59d7bf0b938d5 100644 --- a/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-for-swap.edition2024.stderr +++ b/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-for-swap.edition2024.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local variable `x` - --> $DIR/gat-hide-lifetime-for-swap.rs:33:5 + --> $DIR/gat-hide-lifetime-for-swap.rs:35:5 | LL | h.hide_ref(&mut res).swap(h.hide_ref(&mut &x)); | -- `x` is borrowed here diff --git a/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-for-swap.polonius_alpha.stderr b/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-for-swap.polonius_alpha.stderr index 3c31169a8675d..59d7bf0b938d5 100644 --- a/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-for-swap.polonius_alpha.stderr +++ b/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-for-swap.polonius_alpha.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local variable `x` - --> $DIR/gat-hide-lifetime-for-swap.rs:33:5 + --> $DIR/gat-hide-lifetime-for-swap.rs:35:5 | LL | h.hide_ref(&mut res).swap(h.hide_ref(&mut &x)); | -- `x` is borrowed here diff --git a/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-for-swap.rs b/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-for-swap.rs index 9cbaa5102f015..a48949eb920bd 100644 --- a/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-for-swap.rs +++ b/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-for-swap.rs @@ -2,6 +2,8 @@ //@ ignore-compare-mode-polonius (explicit revisions) //@ [edition2015] edition: 2015 //@ [edition2024] edition: 2024 +//@ [edition2015] compile-flags: -Zpolonius=nll +//@ [edition2024] compile-flags: -Zpolonius=nll //@ [polonius_alpha] edition: 2024 //@ [polonius_alpha] compile-flags: -Zpolonius=next diff --git a/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-in-type-arg-for-swap.edition2015.stderr b/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-in-type-arg-for-swap.edition2015.stderr index ccc8dfbe5fc88..e9703c4302af7 100644 --- a/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-in-type-arg-for-swap.edition2015.stderr +++ b/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-in-type-arg-for-swap.edition2015.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local variable `x` - --> $DIR/gat-hide-lifetime-in-type-arg-for-swap.rs:33:5 + --> $DIR/gat-hide-lifetime-in-type-arg-for-swap.rs:35:5 | LL | h.hide(&mut res).swap(h.hide(&mut &x)); | -- `x` is borrowed here diff --git a/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-in-type-arg-for-swap.edition2024.stderr b/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-in-type-arg-for-swap.edition2024.stderr index ccc8dfbe5fc88..e9703c4302af7 100644 --- a/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-in-type-arg-for-swap.edition2024.stderr +++ b/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-in-type-arg-for-swap.edition2024.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local variable `x` - --> $DIR/gat-hide-lifetime-in-type-arg-for-swap.rs:33:5 + --> $DIR/gat-hide-lifetime-in-type-arg-for-swap.rs:35:5 | LL | h.hide(&mut res).swap(h.hide(&mut &x)); | -- `x` is borrowed here diff --git a/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-in-type-arg-for-swap.polonius_alpha.stderr b/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-in-type-arg-for-swap.polonius_alpha.stderr index ccc8dfbe5fc88..e9703c4302af7 100644 --- a/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-in-type-arg-for-swap.polonius_alpha.stderr +++ b/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-in-type-arg-for-swap.polonius_alpha.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local variable `x` - --> $DIR/gat-hide-lifetime-in-type-arg-for-swap.rs:33:5 + --> $DIR/gat-hide-lifetime-in-type-arg-for-swap.rs:35:5 | LL | h.hide(&mut res).swap(h.hide(&mut &x)); | -- `x` is borrowed here diff --git a/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-in-type-arg-for-swap.rs b/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-in-type-arg-for-swap.rs index 3513bd432a9c6..816787203ceee 100644 --- a/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-in-type-arg-for-swap.rs +++ b/tests/ui/borrowck/alias-liveness/gat-hide-lifetime-in-type-arg-for-swap.rs @@ -2,6 +2,8 @@ //@ ignore-compare-mode-polonius (explicit revisions) //@ [edition2015] edition: 2015 //@ [edition2024] edition: 2024 +//@ [edition2015] compile-flags: -Zpolonius=nll +//@ [edition2024] compile-flags: -Zpolonius=nll //@ [polonius_alpha] edition: 2024 //@ [polonius_alpha] compile-flags: -Zpolonius=next diff --git a/tests/ui/borrowck/alias-liveness/gat-outlives-env.edition2015.stderr b/tests/ui/borrowck/alias-liveness/gat-outlives-env.edition2015.stderr index 9b71acde986f7..9d1fb541a9c8f 100644 --- a/tests/ui/borrowck/alias-liveness/gat-outlives-env.edition2015.stderr +++ b/tests/ui/borrowck/alias-liveness/gat-outlives-env.edition2015.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `t` as mutable more than once at a time - --> $DIR/gat-outlives-env.rs:49:13 + --> $DIR/gat-outlives-env.rs:51:13 | LL | let a = t.changes(static_unit); | - first mutable borrow occurs here diff --git a/tests/ui/borrowck/alias-liveness/gat-outlives-env.edition2024.stderr b/tests/ui/borrowck/alias-liveness/gat-outlives-env.edition2024.stderr index 9b71acde986f7..9d1fb541a9c8f 100644 --- a/tests/ui/borrowck/alias-liveness/gat-outlives-env.edition2024.stderr +++ b/tests/ui/borrowck/alias-liveness/gat-outlives-env.edition2024.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `t` as mutable more than once at a time - --> $DIR/gat-outlives-env.rs:49:13 + --> $DIR/gat-outlives-env.rs:51:13 | LL | let a = t.changes(static_unit); | - first mutable borrow occurs here diff --git a/tests/ui/borrowck/alias-liveness/gat-outlives-env.polonius_alpha.stderr b/tests/ui/borrowck/alias-liveness/gat-outlives-env.polonius_alpha.stderr index 9b71acde986f7..9d1fb541a9c8f 100644 --- a/tests/ui/borrowck/alias-liveness/gat-outlives-env.polonius_alpha.stderr +++ b/tests/ui/borrowck/alias-liveness/gat-outlives-env.polonius_alpha.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `t` as mutable more than once at a time - --> $DIR/gat-outlives-env.rs:49:13 + --> $DIR/gat-outlives-env.rs:51:13 | LL | let a = t.changes(static_unit); | - first mutable borrow occurs here diff --git a/tests/ui/borrowck/alias-liveness/gat-outlives-env.rs b/tests/ui/borrowck/alias-liveness/gat-outlives-env.rs index 1c1b728e486b1..75d4798d4f767 100644 --- a/tests/ui/borrowck/alias-liveness/gat-outlives-env.rs +++ b/tests/ui/borrowck/alias-liveness/gat-outlives-env.rs @@ -2,6 +2,8 @@ //@ ignore-compare-mode-polonius (explicit revisions) //@ [edition2015] edition: 2015 //@ [edition2024] edition: 2024 +//@ [edition2015] compile-flags: -Zpolonius=nll +//@ [edition2024] compile-flags: -Zpolonius=nll //@ [polonius_alpha] edition: 2024 //@ [polonius_alpha] compile-flags: -Zpolonius=next diff --git a/tests/ui/borrowck/alias-liveness/gat-outlives-implied.edition2024.stderr b/tests/ui/borrowck/alias-liveness/gat-outlives-implied.edition2024.stderr index 9317846041925..2d733d142f0f6 100644 --- a/tests/ui/borrowck/alias-liveness/gat-outlives-implied.edition2024.stderr +++ b/tests/ui/borrowck/alias-liveness/gat-outlives-implied.edition2024.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `cluster` because it is borrowed - --> $DIR/gat-outlives-implied.rs:19:9 + --> $DIR/gat-outlives-implied.rs:20:9 | LL | let changes = self.changes(&cluster); | -------- `cluster` is borrowed here diff --git a/tests/ui/borrowck/alias-liveness/gat-outlives-implied.polonius_alpha.stderr b/tests/ui/borrowck/alias-liveness/gat-outlives-implied.polonius_alpha.stderr index 9317846041925..2d733d142f0f6 100644 --- a/tests/ui/borrowck/alias-liveness/gat-outlives-implied.polonius_alpha.stderr +++ b/tests/ui/borrowck/alias-liveness/gat-outlives-implied.polonius_alpha.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `cluster` because it is borrowed - --> $DIR/gat-outlives-implied.rs:19:9 + --> $DIR/gat-outlives-implied.rs:20:9 | LL | let changes = self.changes(&cluster); | -------- `cluster` is borrowed here diff --git a/tests/ui/borrowck/alias-liveness/gat-outlives-implied.rs b/tests/ui/borrowck/alias-liveness/gat-outlives-implied.rs index a9443fccc76b4..6550c5646ba74 100644 --- a/tests/ui/borrowck/alias-liveness/gat-outlives-implied.rs +++ b/tests/ui/borrowck/alias-liveness/gat-outlives-implied.rs @@ -1,6 +1,7 @@ //@ revisions: edition2024 polonius_alpha //@ ignore-compare-mode-polonius (explicit revisions) //@ edition: 2024 +//@ [edition2024] compile-flags: -Zpolonius=nll //@ [polonius_alpha] compile-flags: -Zpolonius=next // Tests that liveness for regions in associated types considers outlives diff --git a/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-for-swap.edition2015.stderr b/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-for-swap.edition2015.stderr index ac839b0c5dc48..ef28e406130e1 100644 --- a/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-for-swap.edition2015.stderr +++ b/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-for-swap.edition2015.stderr @@ -1,5 +1,5 @@ error[E0700]: hidden type for `impl Swap + 'a` captures lifetime that does not appear in bounds - --> $DIR/rpit-hide-lifetime-for-swap.rs:36:5 + --> $DIR/rpit-hide-lifetime-for-swap.rs:38:5 | LL | fn hide_ref<'a, 'b, T: 'static>(x: &'a mut &'b T) -> impl Swap + 'a { | -- -------------- opaque type defined here @@ -14,7 +14,7 @@ LL | fn hide_ref<'a, 'b, T: 'static>(x: &'a mut &'b T) -> impl Swap + 'a + use<' | ++++++++++++++++ error[E0700]: hidden type for `impl Swap + 'a` captures lifetime that does not appear in bounds - --> $DIR/rpit-hide-lifetime-for-swap.rs:53:5 + --> $DIR/rpit-hide-lifetime-for-swap.rs:55:5 | LL | fn hide_rc_refcell<'a, 'b: 'a, T: 'static>(x: Rc>) -> impl Swap + 'a { | -- -------------- opaque type defined here diff --git a/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-for-swap.edition2024.stderr b/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-for-swap.edition2024.stderr index 17916dac8afd7..bca6b764d371a 100644 --- a/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-for-swap.edition2024.stderr +++ b/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-for-swap.edition2024.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local variable `x` - --> $DIR/rpit-hide-lifetime-for-swap.rs:44:5 + --> $DIR/rpit-hide-lifetime-for-swap.rs:46:5 | LL | hide_ref(&mut res).swap(hide_ref(&mut &x)); | -- `x` is borrowed here @@ -7,7 +7,7 @@ LL | res | ^^^ returns a value referencing data owned by the current function error[E0597]: `x` does not live long enough - --> $DIR/rpit-hide-lifetime-for-swap.rs:60:38 + --> $DIR/rpit-hide-lifetime-for-swap.rs:62:38 | LL | let x = [1, 2, 3]; | - binding `x` declared here diff --git a/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-for-swap.polonius_alpha.stderr b/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-for-swap.polonius_alpha.stderr index 17916dac8afd7..bca6b764d371a 100644 --- a/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-for-swap.polonius_alpha.stderr +++ b/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-for-swap.polonius_alpha.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local variable `x` - --> $DIR/rpit-hide-lifetime-for-swap.rs:44:5 + --> $DIR/rpit-hide-lifetime-for-swap.rs:46:5 | LL | hide_ref(&mut res).swap(hide_ref(&mut &x)); | -- `x` is borrowed here @@ -7,7 +7,7 @@ LL | res | ^^^ returns a value referencing data owned by the current function error[E0597]: `x` does not live long enough - --> $DIR/rpit-hide-lifetime-for-swap.rs:60:38 + --> $DIR/rpit-hide-lifetime-for-swap.rs:62:38 | LL | let x = [1, 2, 3]; | - binding `x` declared here diff --git a/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-for-swap.rs b/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-for-swap.rs index e03d4452dd085..c0af9f02d9f6c 100644 --- a/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-for-swap.rs +++ b/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-for-swap.rs @@ -2,6 +2,8 @@ //@ ignore-compare-mode-polonius (explicit revisions) //@ [edition2015] edition: 2015 //@ [edition2024] edition: 2024 +//@ [edition2015] compile-flags: -Zpolonius=nll +//@ [edition2024] compile-flags: -Zpolonius=nll //@ [polonius_alpha] edition: 2024 //@ [polonius_alpha] compile-flags: -Zpolonius=next diff --git a/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-in-type-arg-for-swap.edition2015.stderr b/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-in-type-arg-for-swap.edition2015.stderr index aa7fc52d7d463..40450ab13a262 100644 --- a/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-in-type-arg-for-swap.edition2015.stderr +++ b/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-in-type-arg-for-swap.edition2015.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local variable `x` - --> $DIR/rpit-hide-lifetime-in-type-arg-for-swap.rs:33:5 + --> $DIR/rpit-hide-lifetime-in-type-arg-for-swap.rs:35:5 | LL | hide(&lock, &mut res).swap(hide(&lock, &mut &x)); | -- `x` is borrowed here diff --git a/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-in-type-arg-for-swap.edition2024.stderr b/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-in-type-arg-for-swap.edition2024.stderr index aa7fc52d7d463..40450ab13a262 100644 --- a/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-in-type-arg-for-swap.edition2024.stderr +++ b/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-in-type-arg-for-swap.edition2024.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local variable `x` - --> $DIR/rpit-hide-lifetime-in-type-arg-for-swap.rs:33:5 + --> $DIR/rpit-hide-lifetime-in-type-arg-for-swap.rs:35:5 | LL | hide(&lock, &mut res).swap(hide(&lock, &mut &x)); | -- `x` is borrowed here diff --git a/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-in-type-arg-for-swap.polonius_alpha.stderr b/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-in-type-arg-for-swap.polonius_alpha.stderr index aa7fc52d7d463..40450ab13a262 100644 --- a/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-in-type-arg-for-swap.polonius_alpha.stderr +++ b/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-in-type-arg-for-swap.polonius_alpha.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local variable `x` - --> $DIR/rpit-hide-lifetime-in-type-arg-for-swap.rs:33:5 + --> $DIR/rpit-hide-lifetime-in-type-arg-for-swap.rs:35:5 | LL | hide(&lock, &mut res).swap(hide(&lock, &mut &x)); | -- `x` is borrowed here diff --git a/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-in-type-arg-for-swap.rs b/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-in-type-arg-for-swap.rs index 35d51fe791a84..9b5c59c23b779 100644 --- a/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-in-type-arg-for-swap.rs +++ b/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-in-type-arg-for-swap.rs @@ -2,6 +2,8 @@ //@ ignore-compare-mode-polonius (explicit revisions) //@ [edition2015] edition: 2015 //@ [edition2024] edition: 2024 +//@ [edition2015] compile-flags: -Zpolonius=nll +//@ [edition2024] compile-flags: -Zpolonius=nll //@ [polonius_alpha] edition: 2024 //@ [polonius_alpha] compile-flags: -Zpolonius=next diff --git a/tests/ui/borrowck/alias-liveness/rpitit-hide-lifetime-for-swap.edition2015.stderr b/tests/ui/borrowck/alias-liveness/rpitit-hide-lifetime-for-swap.edition2015.stderr index 0c2e1d3c7817a..f68ebd1610a13 100644 --- a/tests/ui/borrowck/alias-liveness/rpitit-hide-lifetime-for-swap.edition2015.stderr +++ b/tests/ui/borrowck/alias-liveness/rpitit-hide-lifetime-for-swap.edition2015.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local variable `x` - --> $DIR/rpitit-hide-lifetime-for-swap.rs:31:5 + --> $DIR/rpitit-hide-lifetime-for-swap.rs:33:5 | LL | h.hide_ref(&mut res).swap(h.hide_ref(&mut &x)); | -- `x` is borrowed here diff --git a/tests/ui/borrowck/alias-liveness/rpitit-hide-lifetime-for-swap.edition2024.stderr b/tests/ui/borrowck/alias-liveness/rpitit-hide-lifetime-for-swap.edition2024.stderr index 0c2e1d3c7817a..f68ebd1610a13 100644 --- a/tests/ui/borrowck/alias-liveness/rpitit-hide-lifetime-for-swap.edition2024.stderr +++ b/tests/ui/borrowck/alias-liveness/rpitit-hide-lifetime-for-swap.edition2024.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local variable `x` - --> $DIR/rpitit-hide-lifetime-for-swap.rs:31:5 + --> $DIR/rpitit-hide-lifetime-for-swap.rs:33:5 | LL | h.hide_ref(&mut res).swap(h.hide_ref(&mut &x)); | -- `x` is borrowed here diff --git a/tests/ui/borrowck/alias-liveness/rpitit-hide-lifetime-for-swap.polonius_alpha.stderr b/tests/ui/borrowck/alias-liveness/rpitit-hide-lifetime-for-swap.polonius_alpha.stderr index 0c2e1d3c7817a..f68ebd1610a13 100644 --- a/tests/ui/borrowck/alias-liveness/rpitit-hide-lifetime-for-swap.polonius_alpha.stderr +++ b/tests/ui/borrowck/alias-liveness/rpitit-hide-lifetime-for-swap.polonius_alpha.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local variable `x` - --> $DIR/rpitit-hide-lifetime-for-swap.rs:31:5 + --> $DIR/rpitit-hide-lifetime-for-swap.rs:33:5 | LL | h.hide_ref(&mut res).swap(h.hide_ref(&mut &x)); | -- `x` is borrowed here diff --git a/tests/ui/borrowck/alias-liveness/rpitit-hide-lifetime-for-swap.rs b/tests/ui/borrowck/alias-liveness/rpitit-hide-lifetime-for-swap.rs index ee20d00ae77cb..ff7dffea86923 100644 --- a/tests/ui/borrowck/alias-liveness/rpitit-hide-lifetime-for-swap.rs +++ b/tests/ui/borrowck/alias-liveness/rpitit-hide-lifetime-for-swap.rs @@ -2,6 +2,8 @@ //@ ignore-compare-mode-polonius (explicit revisions) //@ [edition2015] edition: 2015 //@ [edition2024] edition: 2024 +//@ [edition2015] compile-flags: -Zpolonius=nll +//@ [edition2024] compile-flags: -Zpolonius=nll //@ [polonius_alpha] edition: 2024 //@ [polonius_alpha] compile-flags: -Zpolonius=next diff --git a/tests/ui/drop/dropck-normalize-errors.nll.stderr b/tests/ui/drop/dropck-normalize-errors.nll.stderr index 39ec4033eab2f..a4c13b03d2f72 100644 --- a/tests/ui/drop/dropck-normalize-errors.nll.stderr +++ b/tests/ui/drop/dropck-normalize-errors.nll.stderr @@ -1,54 +1,54 @@ error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not satisfied in `ADecoder<'a>` - --> $DIR/dropck-normalize-errors.rs:19:28 + --> $DIR/dropck-normalize-errors.rs:20:28 | LL | fn make_a_decoder<'a>() -> ADecoder<'a> { | ^^^^^^^^^^^^ unsatisfied trait bound | help: within `ADecoder<'a>`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` - --> $DIR/dropck-normalize-errors.rs:14:1 + --> $DIR/dropck-normalize-errors.rs:15:1 | LL | struct NonImplementedStruct; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one - --> $DIR/dropck-normalize-errors.rs:11:1 + --> $DIR/dropck-normalize-errors.rs:12:1 | LL | trait NonImplementedTrait { | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: required because it appears within the type `BDecoder` - --> $DIR/dropck-normalize-errors.rs:30:12 + --> $DIR/dropck-normalize-errors.rs:31:12 | LL | pub struct BDecoder { | ^^^^^^^^ note: required because it appears within the type `ADecoder<'a>` - --> $DIR/dropck-normalize-errors.rs:16:12 + --> $DIR/dropck-normalize-errors.rs:17:12 | LL | pub struct ADecoder<'a> { | ^^^^^^^^ = note: the return type of a function must have a statically known size error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not satisfied in `BDecoder` - --> $DIR/dropck-normalize-errors.rs:27:20 + --> $DIR/dropck-normalize-errors.rs:28:20 | LL | type Decoder = BDecoder; | ^^^^^^^^ unsatisfied trait bound | help: within `BDecoder`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` - --> $DIR/dropck-normalize-errors.rs:14:1 + --> $DIR/dropck-normalize-errors.rs:15:1 | LL | struct NonImplementedStruct; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one - --> $DIR/dropck-normalize-errors.rs:11:1 + --> $DIR/dropck-normalize-errors.rs:12:1 | LL | trait NonImplementedTrait { | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: required because it appears within the type `BDecoder` - --> $DIR/dropck-normalize-errors.rs:30:12 + --> $DIR/dropck-normalize-errors.rs:31:12 | LL | pub struct BDecoder { | ^^^^^^^^ note: required by a bound in `Decode::Decoder` - --> $DIR/dropck-normalize-errors.rs:8:5 + --> $DIR/dropck-normalize-errors.rs:9:5 | LL | type Decoder; | ^^^^^^^^^^^^^ required by this bound in `Decode::Decoder` @@ -58,35 +58,35 @@ LL | type Decoder: ?Sized; | ++++++++ error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not satisfied - --> $DIR/dropck-normalize-errors.rs:31:22 + --> $DIR/dropck-normalize-errors.rs:32:22 | LL | non_implemented: ::Assoc, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | help: the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` - --> $DIR/dropck-normalize-errors.rs:14:1 + --> $DIR/dropck-normalize-errors.rs:15:1 | LL | struct NonImplementedStruct; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one - --> $DIR/dropck-normalize-errors.rs:11:1 + --> $DIR/dropck-normalize-errors.rs:12:1 | LL | trait NonImplementedTrait { | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not satisfied - --> $DIR/dropck-normalize-errors.rs:19:28 + --> $DIR/dropck-normalize-errors.rs:20:28 | LL | fn make_a_decoder<'a>() -> ADecoder<'a> { | ^^^^^^^^^^^^ unsatisfied trait bound | help: the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` - --> $DIR/dropck-normalize-errors.rs:14:1 + --> $DIR/dropck-normalize-errors.rs:15:1 | LL | struct NonImplementedStruct; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one - --> $DIR/dropck-normalize-errors.rs:11:1 + --> $DIR/dropck-normalize-errors.rs:12:1 | LL | trait NonImplementedTrait { | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/drop/dropck-normalize-errors.polonius.stderr b/tests/ui/drop/dropck-normalize-errors.polonius.stderr index 3d72801b34363..65592030ae5e1 100644 --- a/tests/ui/drop/dropck-normalize-errors.polonius.stderr +++ b/tests/ui/drop/dropck-normalize-errors.polonius.stderr @@ -1,54 +1,54 @@ error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not satisfied in `ADecoder<'a>` - --> $DIR/dropck-normalize-errors.rs:19:28 + --> $DIR/dropck-normalize-errors.rs:20:28 | LL | fn make_a_decoder<'a>() -> ADecoder<'a> { | ^^^^^^^^^^^^ unsatisfied trait bound | help: within `ADecoder<'a>`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` - --> $DIR/dropck-normalize-errors.rs:14:1 + --> $DIR/dropck-normalize-errors.rs:15:1 | LL | struct NonImplementedStruct; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one - --> $DIR/dropck-normalize-errors.rs:11:1 + --> $DIR/dropck-normalize-errors.rs:12:1 | LL | trait NonImplementedTrait { | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: required because it appears within the type `BDecoder` - --> $DIR/dropck-normalize-errors.rs:30:12 + --> $DIR/dropck-normalize-errors.rs:31:12 | LL | pub struct BDecoder { | ^^^^^^^^ note: required because it appears within the type `ADecoder<'a>` - --> $DIR/dropck-normalize-errors.rs:16:12 + --> $DIR/dropck-normalize-errors.rs:17:12 | LL | pub struct ADecoder<'a> { | ^^^^^^^^ = note: the return type of a function must have a statically known size error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not satisfied in `BDecoder` - --> $DIR/dropck-normalize-errors.rs:27:20 + --> $DIR/dropck-normalize-errors.rs:28:20 | LL | type Decoder = BDecoder; | ^^^^^^^^ unsatisfied trait bound | help: within `BDecoder`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` - --> $DIR/dropck-normalize-errors.rs:14:1 + --> $DIR/dropck-normalize-errors.rs:15:1 | LL | struct NonImplementedStruct; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one - --> $DIR/dropck-normalize-errors.rs:11:1 + --> $DIR/dropck-normalize-errors.rs:12:1 | LL | trait NonImplementedTrait { | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: required because it appears within the type `BDecoder` - --> $DIR/dropck-normalize-errors.rs:30:12 + --> $DIR/dropck-normalize-errors.rs:31:12 | LL | pub struct BDecoder { | ^^^^^^^^ note: required by a bound in `Decode::Decoder` - --> $DIR/dropck-normalize-errors.rs:8:5 + --> $DIR/dropck-normalize-errors.rs:9:5 | LL | type Decoder; | ^^^^^^^^^^^^^ required by this bound in `Decode::Decoder` @@ -58,18 +58,18 @@ LL | type Decoder: ?Sized; | ++++++++ error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not satisfied - --> $DIR/dropck-normalize-errors.rs:31:22 + --> $DIR/dropck-normalize-errors.rs:32:22 | LL | non_implemented: ::Assoc, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | help: the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` - --> $DIR/dropck-normalize-errors.rs:14:1 + --> $DIR/dropck-normalize-errors.rs:15:1 | LL | struct NonImplementedStruct; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one - --> $DIR/dropck-normalize-errors.rs:11:1 + --> $DIR/dropck-normalize-errors.rs:12:1 | LL | trait NonImplementedTrait { | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/drop/dropck-normalize-errors.rs b/tests/ui/drop/dropck-normalize-errors.rs index 2ade63f27c5f6..6bcecda74636c 100644 --- a/tests/ui/drop/dropck-normalize-errors.rs +++ b/tests/ui/drop/dropck-normalize-errors.rs @@ -2,6 +2,7 @@ //@ ignore-compare-mode-polonius (explicit revisions) //@ revisions: nll polonius +//@ [nll] compile-flags: -Zpolonius=nll //@ [polonius] compile-flags: -Zpolonius=next trait Decode<'a> { diff --git a/tests/ui/nll/get_default.legacy.stderr b/tests/ui/nll/get_default.legacy.stderr index 699250312dc6b..256a640fa374b 100644 --- a/tests/ui/nll/get_default.legacy.stderr +++ b/tests/ui/nll/get_default.legacy.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable - --> $DIR/get_default.rs:35:17 + --> $DIR/get_default.rs:36:17 | LL | fn err(map: &mut Map) -> &String { | - let's call the lifetime of this reference `'1` diff --git a/tests/ui/nll/get_default.nll.stderr b/tests/ui/nll/get_default.nll.stderr index 9b5976ca7170e..690da73738deb 100644 --- a/tests/ui/nll/get_default.nll.stderr +++ b/tests/ui/nll/get_default.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable - --> $DIR/get_default.rs:24:17 + --> $DIR/get_default.rs:25:17 | LL | fn ok(map: &mut Map) -> &String { | - let's call the lifetime of this reference `'1` @@ -14,7 +14,7 @@ LL | map.set(String::new()); // Ideally, this would not error. | ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable - --> $DIR/get_default.rs:35:17 + --> $DIR/get_default.rs:36:17 | LL | fn err(map: &mut Map) -> &String { | - let's call the lifetime of this reference `'1` @@ -29,7 +29,7 @@ LL | return v; | - returning this value requires that `*map` is borrowed for `'1` error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable - --> $DIR/get_default.rs:40:17 + --> $DIR/get_default.rs:41:17 | LL | fn err(map: &mut Map) -> &String { | - let's call the lifetime of this reference `'1` diff --git a/tests/ui/nll/get_default.polonius.stderr b/tests/ui/nll/get_default.polonius.stderr index 699250312dc6b..256a640fa374b 100644 --- a/tests/ui/nll/get_default.polonius.stderr +++ b/tests/ui/nll/get_default.polonius.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable - --> $DIR/get_default.rs:35:17 + --> $DIR/get_default.rs:36:17 | LL | fn err(map: &mut Map) -> &String { | - let's call the lifetime of this reference `'1` diff --git a/tests/ui/nll/get_default.rs b/tests/ui/nll/get_default.rs index c3c09e9c2c553..e5203b7ca2be5 100644 --- a/tests/ui/nll/get_default.rs +++ b/tests/ui/nll/get_default.rs @@ -3,6 +3,7 @@ //@ ignore-compare-mode-polonius (explicit revisions) //@ revisions: nll polonius legacy +//@ [nll] compile-flags: -Zpolonius=nll //@ [polonius] compile-flags: -Z polonius=next //@ [legacy] compile-flags: -Z polonius=legacy diff --git a/tests/ui/nll/issue-46589.nll.stderr b/tests/ui/nll/issue-46589.nll.stderr index f2d08d1f4c834..c2a76b7c3f368 100644 --- a/tests/ui/nll/issue-46589.nll.stderr +++ b/tests/ui/nll/issue-46589.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `**other` as mutable more than once at a time - --> $DIR/issue-46589.rs:25:21 + --> $DIR/issue-46589.rs:26:21 | LL | *other = match (*other).get_self() { | -------- first mutable borrow occurs here diff --git a/tests/ui/nll/issue-46589.polonius.stderr b/tests/ui/nll/issue-46589.polonius.stderr index f2d08d1f4c834..c2a76b7c3f368 100644 --- a/tests/ui/nll/issue-46589.polonius.stderr +++ b/tests/ui/nll/issue-46589.polonius.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `**other` as mutable more than once at a time - --> $DIR/issue-46589.rs:25:21 + --> $DIR/issue-46589.rs:26:21 | LL | *other = match (*other).get_self() { | -------- first mutable borrow occurs here diff --git a/tests/ui/nll/issue-46589.rs b/tests/ui/nll/issue-46589.rs index 9a23f61b8cb8d..9311172d8e546 100644 --- a/tests/ui/nll/issue-46589.rs +++ b/tests/ui/nll/issue-46589.rs @@ -1,6 +1,7 @@ //@ ignore-compare-mode-polonius (explicit revisions) //@ revisions: nll polonius legacy //@ [nll] known-bug: #46589 +//@ [nll] compile-flags: -Zpolonius=nll //@ [polonius] known-bug: #46589 //@ [polonius] compile-flags: -Zpolonius=next //@ [legacy] check-pass diff --git a/tests/ui/nll/polonius/filtering-lending-iterator-issue-92985.nll.stderr b/tests/ui/nll/polonius/filtering-lending-iterator-issue-92985.nll.stderr index d5c85a2af239a..a0c5083bb4d5d 100644 --- a/tests/ui/nll/polonius/filtering-lending-iterator-issue-92985.nll.stderr +++ b/tests/ui/nll/polonius/filtering-lending-iterator-issue-92985.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `self.iter` as mutable more than once at a time - --> $DIR/filtering-lending-iterator-issue-92985.rs:49:32 + --> $DIR/filtering-lending-iterator-issue-92985.rs:50:32 | LL | fn next(&mut self) -> Option> { | - let's call the lifetime of this reference `'1` diff --git a/tests/ui/nll/polonius/filtering-lending-iterator-issue-92985.rs b/tests/ui/nll/polonius/filtering-lending-iterator-issue-92985.rs index 27da62ef00b49..6d65092b0f6a5 100644 --- a/tests/ui/nll/polonius/filtering-lending-iterator-issue-92985.rs +++ b/tests/ui/nll/polonius/filtering-lending-iterator-issue-92985.rs @@ -12,6 +12,7 @@ //@ ignore-compare-mode-polonius (explicit revisions) //@ revisions: nll polonius legacy //@ [nll] known-bug: #92985 +//@ [nll] compile-flags: -Z polonius=nll //@ [polonius] check-pass //@ [polonius] compile-flags: -Z polonius=next //@ [legacy] check-pass diff --git a/tests/ui/nll/polonius/iterating-updating-cursor-issue-108704.nll.stderr b/tests/ui/nll/polonius/iterating-updating-cursor-issue-108704.nll.stderr index b768f60590cb0..374e806ba0347 100644 --- a/tests/ui/nll/polonius/iterating-updating-cursor-issue-108704.nll.stderr +++ b/tests/ui/nll/polonius/iterating-updating-cursor-issue-108704.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `*elements` as mutable more than once at a time - --> $DIR/iterating-updating-cursor-issue-108704.rs:41:26 + --> $DIR/iterating-updating-cursor-issue-108704.rs:42:26 | LL | for (idx, el) in elements.iter_mut().enumerate() { | ^^^^^^^^ diff --git a/tests/ui/nll/polonius/iterating-updating-cursor-issue-108704.polonius.stderr b/tests/ui/nll/polonius/iterating-updating-cursor-issue-108704.polonius.stderr index b768f60590cb0..374e806ba0347 100644 --- a/tests/ui/nll/polonius/iterating-updating-cursor-issue-108704.polonius.stderr +++ b/tests/ui/nll/polonius/iterating-updating-cursor-issue-108704.polonius.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `*elements` as mutable more than once at a time - --> $DIR/iterating-updating-cursor-issue-108704.rs:41:26 + --> $DIR/iterating-updating-cursor-issue-108704.rs:42:26 | LL | for (idx, el) in elements.iter_mut().enumerate() { | ^^^^^^^^ diff --git a/tests/ui/nll/polonius/iterating-updating-cursor-issue-108704.rs b/tests/ui/nll/polonius/iterating-updating-cursor-issue-108704.rs index 673efa8f2259a..f6f2aadde0854 100644 --- a/tests/ui/nll/polonius/iterating-updating-cursor-issue-108704.rs +++ b/tests/ui/nll/polonius/iterating-updating-cursor-issue-108704.rs @@ -6,6 +6,7 @@ //@ ignore-compare-mode-polonius (explicit revisions) //@ revisions: nll polonius legacy //@ [nll] known-bug: #108704 +//@ [nll] compile-flags: -Z polonius=nll //@ [polonius] known-bug: #108704 //@ [polonius] compile-flags: -Z polonius=next //@ [legacy] check-pass diff --git a/tests/ui/nll/polonius/iterating-updating-cursor-issue-57165.nll.stderr b/tests/ui/nll/polonius/iterating-updating-cursor-issue-57165.nll.stderr index 34b04e707dbd4..545a9b588b2f1 100644 --- a/tests/ui/nll/polonius/iterating-updating-cursor-issue-57165.nll.stderr +++ b/tests/ui/nll/polonius/iterating-updating-cursor-issue-57165.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `p.0` as mutable more than once at a time - --> $DIR/iterating-updating-cursor-issue-57165.rs:30:20 + --> $DIR/iterating-updating-cursor-issue-57165.rs:31:20 | LL | while let Some(now) = p { | ^^^ - first borrow used here, in later iteration of loop @@ -7,7 +7,7 @@ LL | while let Some(now) = p { | `p.0` was mutably borrowed here in the previous iteration of the loop error[E0503]: cannot use `*p` because it was mutably borrowed - --> $DIR/iterating-updating-cursor-issue-57165.rs:30:27 + --> $DIR/iterating-updating-cursor-issue-57165.rs:31:27 | LL | while let Some(now) = p { | --- ^ diff --git a/tests/ui/nll/polonius/iterating-updating-cursor-issue-57165.polonius.stderr b/tests/ui/nll/polonius/iterating-updating-cursor-issue-57165.polonius.stderr index 34b04e707dbd4..545a9b588b2f1 100644 --- a/tests/ui/nll/polonius/iterating-updating-cursor-issue-57165.polonius.stderr +++ b/tests/ui/nll/polonius/iterating-updating-cursor-issue-57165.polonius.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `p.0` as mutable more than once at a time - --> $DIR/iterating-updating-cursor-issue-57165.rs:30:20 + --> $DIR/iterating-updating-cursor-issue-57165.rs:31:20 | LL | while let Some(now) = p { | ^^^ - first borrow used here, in later iteration of loop @@ -7,7 +7,7 @@ LL | while let Some(now) = p { | `p.0` was mutably borrowed here in the previous iteration of the loop error[E0503]: cannot use `*p` because it was mutably borrowed - --> $DIR/iterating-updating-cursor-issue-57165.rs:30:27 + --> $DIR/iterating-updating-cursor-issue-57165.rs:31:27 | LL | while let Some(now) = p { | --- ^ diff --git a/tests/ui/nll/polonius/iterating-updating-cursor-issue-57165.rs b/tests/ui/nll/polonius/iterating-updating-cursor-issue-57165.rs index 9670fc77e6faa..1c77271683aed 100644 --- a/tests/ui/nll/polonius/iterating-updating-cursor-issue-57165.rs +++ b/tests/ui/nll/polonius/iterating-updating-cursor-issue-57165.rs @@ -6,6 +6,7 @@ //@ ignore-compare-mode-polonius (explicit revisions) //@ revisions: nll polonius legacy //@ [nll] known-bug: #57165 +//@ [nll] compile-flags: -Z polonius=nll //@ [polonius] known-bug: #57165 //@ [polonius] compile-flags: -Z polonius=next //@ [legacy] check-pass diff --git a/tests/ui/nll/polonius/iterating-updating-cursor-issue-63908.nll.stderr b/tests/ui/nll/polonius/iterating-updating-cursor-issue-63908.nll.stderr index b76e4ff639878..86cf11544f8c1 100644 --- a/tests/ui/nll/polonius/iterating-updating-cursor-issue-63908.nll.stderr +++ b/tests/ui/nll/polonius/iterating-updating-cursor-issue-63908.nll.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `*node_ref` because it is borrowed - --> $DIR/iterating-updating-cursor-issue-63908.rs:43:5 + --> $DIR/iterating-updating-cursor-issue-63908.rs:44:5 | LL | fn remove_last_node_iterative(mut node_ref: &mut List) { | - let's call the lifetime of this reference `'1` diff --git a/tests/ui/nll/polonius/iterating-updating-cursor-issue-63908.polonius.stderr b/tests/ui/nll/polonius/iterating-updating-cursor-issue-63908.polonius.stderr index b76e4ff639878..86cf11544f8c1 100644 --- a/tests/ui/nll/polonius/iterating-updating-cursor-issue-63908.polonius.stderr +++ b/tests/ui/nll/polonius/iterating-updating-cursor-issue-63908.polonius.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `*node_ref` because it is borrowed - --> $DIR/iterating-updating-cursor-issue-63908.rs:43:5 + --> $DIR/iterating-updating-cursor-issue-63908.rs:44:5 | LL | fn remove_last_node_iterative(mut node_ref: &mut List) { | - let's call the lifetime of this reference `'1` diff --git a/tests/ui/nll/polonius/iterating-updating-cursor-issue-63908.rs b/tests/ui/nll/polonius/iterating-updating-cursor-issue-63908.rs index 6682926c5237a..309252be3efa8 100644 --- a/tests/ui/nll/polonius/iterating-updating-cursor-issue-63908.rs +++ b/tests/ui/nll/polonius/iterating-updating-cursor-issue-63908.rs @@ -6,6 +6,7 @@ //@ ignore-compare-mode-polonius (explicit revisions) //@ revisions: nll polonius legacy //@ [nll] known-bug: #63908 +//@ [nll] compile-flags: -Z polonius=nll //@ [polonius] known-bug: #63908 //@ [polonius] compile-flags: -Z polonius=next //@ [legacy] check-pass diff --git a/tests/ui/nll/polonius/iterating-updating-mutref.nll.stderr b/tests/ui/nll/polonius/iterating-updating-mutref.nll.stderr index 941c736d8d258..1040903d1a40c 100644 --- a/tests/ui/nll/polonius/iterating-updating-mutref.nll.stderr +++ b/tests/ui/nll/polonius/iterating-updating-mutref.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `self.buf_read` as mutable more than once at a time - --> $DIR/iterating-updating-mutref.rs:61:23 + --> $DIR/iterating-updating-mutref.rs:62:23 | LL | pub fn next<'a>(&'a mut self) -> &'a str { | -- lifetime `'a` defined here diff --git a/tests/ui/nll/polonius/iterating-updating-mutref.rs b/tests/ui/nll/polonius/iterating-updating-mutref.rs index a315bf66279c6..10e14440e01ef 100644 --- a/tests/ui/nll/polonius/iterating-updating-mutref.rs +++ b/tests/ui/nll/polonius/iterating-updating-mutref.rs @@ -10,6 +10,7 @@ //@ ignore-compare-mode-polonius (explicit revisions) //@ revisions: nll polonius legacy //@ [nll] known-bug: #46859 +//@ [nll] compile-flags: -Z polonius=nll //@ [polonius] check-pass //@ [polonius] compile-flags: -Z polonius=next //@ [legacy] check-pass diff --git a/tests/ui/nll/polonius/location-insensitive-constraints-issue-70044.nll.stderr b/tests/ui/nll/polonius/location-insensitive-constraints-issue-70044.nll.stderr index edb5bf5df413e..e39e13904ae43 100644 --- a/tests/ui/nll/polonius/location-insensitive-constraints-issue-70044.nll.stderr +++ b/tests/ui/nll/polonius/location-insensitive-constraints-issue-70044.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `one` as immutable because it is also borrowed as mutable - --> $DIR/location-insensitive-constraints-issue-70044.rs:22:20 + --> $DIR/location-insensitive-constraints-issue-70044.rs:23:20 | LL | let mut y = &mut one; | -------- mutable borrow occurs here diff --git a/tests/ui/nll/polonius/location-insensitive-constraints-issue-70044.rs b/tests/ui/nll/polonius/location-insensitive-constraints-issue-70044.rs index f59ce5170ad4e..6efb947d8108f 100644 --- a/tests/ui/nll/polonius/location-insensitive-constraints-issue-70044.rs +++ b/tests/ui/nll/polonius/location-insensitive-constraints-issue-70044.rs @@ -4,6 +4,7 @@ //@ ignore-compare-mode-polonius (explicit revisions) //@ revisions: nll polonius legacy +//@ [nll] compile-flags: -Z polonius=nll //@ [polonius] check-pass //@ [polonius] compile-flags: -Z polonius=next //@ [legacy] check-pass diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.nll.stderr b/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.nll.stderr index cdf394505a25b..bdab4f12cc276 100644 --- a/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.nll.stderr +++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.nll.stderr @@ -1,5 +1,5 @@ error[E0046]: not all trait items implemented, missing: `call` - --> $DIR/location-insensitive-scopes-issue-116657.rs:18:1 + --> $DIR/location-insensitive-scopes-issue-116657.rs:19:1 | LL | fn call(x: Self) -> Self::Output; | --------------------------------- `call` from trait @@ -8,7 +8,7 @@ LL | impl Callable for T { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `call` in implementation error: unconstrained opaque type - --> $DIR/location-insensitive-scopes-issue-116657.rs:22:19 + --> $DIR/location-insensitive-scopes-issue-116657.rs:23:19 | LL | type Output = impl PlusOne; | ^^^^^^^^^^^^ @@ -16,7 +16,7 @@ LL | type Output = impl PlusOne; = note: `Output` must be used in combination with a concrete type within the same impl error[E0700]: hidden type for `impl PlusOne` captures lifetime that does not appear in bounds - --> $DIR/location-insensitive-scopes-issue-116657.rs:28:5 + --> $DIR/location-insensitive-scopes-issue-116657.rs:29:5 | LL | fn test<'a>(y: &'a mut i32) -> impl PlusOne { | -- ------------ opaque type defined here diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.polonius.stderr b/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.polonius.stderr index cdf394505a25b..bdab4f12cc276 100644 --- a/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.polonius.stderr +++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.polonius.stderr @@ -1,5 +1,5 @@ error[E0046]: not all trait items implemented, missing: `call` - --> $DIR/location-insensitive-scopes-issue-116657.rs:18:1 + --> $DIR/location-insensitive-scopes-issue-116657.rs:19:1 | LL | fn call(x: Self) -> Self::Output; | --------------------------------- `call` from trait @@ -8,7 +8,7 @@ LL | impl Callable for T { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `call` in implementation error: unconstrained opaque type - --> $DIR/location-insensitive-scopes-issue-116657.rs:22:19 + --> $DIR/location-insensitive-scopes-issue-116657.rs:23:19 | LL | type Output = impl PlusOne; | ^^^^^^^^^^^^ @@ -16,7 +16,7 @@ LL | type Output = impl PlusOne; = note: `Output` must be used in combination with a concrete type within the same impl error[E0700]: hidden type for `impl PlusOne` captures lifetime that does not appear in bounds - --> $DIR/location-insensitive-scopes-issue-116657.rs:28:5 + --> $DIR/location-insensitive-scopes-issue-116657.rs:29:5 | LL | fn test<'a>(y: &'a mut i32) -> impl PlusOne { | -- ------------ opaque type defined here diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.rs b/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.rs index 73626271b290a..432b42a59ab3e 100644 --- a/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.rs +++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.rs @@ -2,6 +2,7 @@ // different loan scopes when a member constraint was not ultimately applied. //@ revisions: nll polonius +//@ [nll] compile-flags: -Zpolonius=nll //@ [polonius] compile-flags: -Zpolonius=next #![feature(impl_trait_in_assoc_type)] diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr index 0734eba1496d7..46e4fbea0d952 100644 --- a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr +++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `a` does not live long enough - --> $DIR/location-insensitive-scopes-issue-117146.rs:10:18 + --> $DIR/location-insensitive-scopes-issue-117146.rs:11:18 | LL | let a = (); | - binding `a` declared here @@ -14,18 +14,18 @@ LL | } | - `a` dropped here while still borrowed | note: due to a current limitation of the type system, this implies a `'static` lifetime - --> $DIR/location-insensitive-scopes-issue-117146.rs:20:11 + --> $DIR/location-insensitive-scopes-issue-117146.rs:21:11 | LL | fn bad &()>(_: F) {} | ^^^^^^^^^^^^^^ note: requirement that the value outlives `'static` introduced here - --> $DIR/location-insensitive-scopes-issue-117146.rs:20:22 + --> $DIR/location-insensitive-scopes-issue-117146.rs:21:22 | LL | fn bad &()>(_: F) {} | ^^^ error: implementation of `Fn` is not general enough - --> $DIR/location-insensitive-scopes-issue-117146.rs:13:5 + --> $DIR/location-insensitive-scopes-issue-117146.rs:14:5 | LL | bad(&b); | ^^^^^^^ implementation of `Fn` is not general enough @@ -38,7 +38,7 @@ LL | let b = |_: &()| &a; | +++++ error: implementation of `FnOnce` is not general enough - --> $DIR/location-insensitive-scopes-issue-117146.rs:13:5 + --> $DIR/location-insensitive-scopes-issue-117146.rs:14:5 | LL | bad(&b); | ^^^^^^^ implementation of `FnOnce` is not general enough diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr index 0734eba1496d7..46e4fbea0d952 100644 --- a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr +++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr @@ -1,5 +1,5 @@ error[E0597]: `a` does not live long enough - --> $DIR/location-insensitive-scopes-issue-117146.rs:10:18 + --> $DIR/location-insensitive-scopes-issue-117146.rs:11:18 | LL | let a = (); | - binding `a` declared here @@ -14,18 +14,18 @@ LL | } | - `a` dropped here while still borrowed | note: due to a current limitation of the type system, this implies a `'static` lifetime - --> $DIR/location-insensitive-scopes-issue-117146.rs:20:11 + --> $DIR/location-insensitive-scopes-issue-117146.rs:21:11 | LL | fn bad &()>(_: F) {} | ^^^^^^^^^^^^^^ note: requirement that the value outlives `'static` introduced here - --> $DIR/location-insensitive-scopes-issue-117146.rs:20:22 + --> $DIR/location-insensitive-scopes-issue-117146.rs:21:22 | LL | fn bad &()>(_: F) {} | ^^^ error: implementation of `Fn` is not general enough - --> $DIR/location-insensitive-scopes-issue-117146.rs:13:5 + --> $DIR/location-insensitive-scopes-issue-117146.rs:14:5 | LL | bad(&b); | ^^^^^^^ implementation of `Fn` is not general enough @@ -38,7 +38,7 @@ LL | let b = |_: &()| &a; | +++++ error: implementation of `FnOnce` is not general enough - --> $DIR/location-insensitive-scopes-issue-117146.rs:13:5 + --> $DIR/location-insensitive-scopes-issue-117146.rs:14:5 | LL | bad(&b); | ^^^^^^^ implementation of `FnOnce` is not general enough diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.rs b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.rs index c828a37521e0e..4a16a3e98032a 100644 --- a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.rs +++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.rs @@ -3,6 +3,7 @@ // region. //@ revisions: nll polonius +//@ [nll] compile-flags: -Zpolonius=nll //@ [polonius] compile-flags: -Zpolonius=next fn main() { diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-liveness.rs b/tests/ui/nll/polonius/location-insensitive-scopes-liveness.rs index 677b7aa1df860..8d277e26ae04b 100644 --- a/tests/ui/nll/polonius/location-insensitive-scopes-liveness.rs +++ b/tests/ui/nll/polonius/location-insensitive-scopes-liveness.rs @@ -6,10 +6,11 @@ // regions were marked live later, and live loans were not recomputed at this point. //@ ignore-compare-mode-polonius (explicit revisions) -//@ revisions: polonius_next polonius +//@ revisions: nll polonius_next polonius //@ check-pass +//@ [nll] compile-flags: -Zpolonius=nll //@ [polonius_next] compile-flags: -Z polonius=next -//@ [polonius] compile-flags: -Z polonius +//@ [polonius] compile-flags: -Z polonius=legacy // minimized from wavefc-cli-3.0.0 fn repro1() { diff --git a/tests/ui/nll/polonius/nll-problem-case-2-issue-92038.nll.stderr b/tests/ui/nll/polonius/nll-problem-case-2-issue-92038.nll.stderr index 62d66a900adbc..db94a6a437726 100644 --- a/tests/ui/nll/polonius/nll-problem-case-2-issue-92038.nll.stderr +++ b/tests/ui/nll/polonius/nll-problem-case-2-issue-92038.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `*a` as mutable more than once at a time - --> $DIR/nll-problem-case-2-issue-92038.rs:16:26 + --> $DIR/nll-problem-case-2-issue-92038.rs:17:26 | LL | fn reborrow(a: &mut u8) -> &mut u8 { | - let's call the lifetime of this reference `'1` diff --git a/tests/ui/nll/polonius/nll-problem-case-2-issue-92038.rs b/tests/ui/nll/polonius/nll-problem-case-2-issue-92038.rs index 4b55e67e7e0d8..083ab86ac1984 100644 --- a/tests/ui/nll/polonius/nll-problem-case-2-issue-92038.rs +++ b/tests/ui/nll/polonius/nll-problem-case-2-issue-92038.rs @@ -6,6 +6,7 @@ //@ ignore-compare-mode-polonius (explicit revisions) //@ revisions: nll polonius legacy +//@ [nll] compile-flags: -Z polonius=nll //@ [polonius] check-pass //@ [polonius] compile-flags: -Z polonius=next //@ [legacy] check-pass diff --git a/tests/ui/nll/polonius/nll-problem-case-3-issue-112087.nll.stderr b/tests/ui/nll/polonius/nll-problem-case-3-issue-112087.nll.stderr index 16b5d8f714847..682999f3397e2 100644 --- a/tests/ui/nll/polonius/nll-problem-case-3-issue-112087.nll.stderr +++ b/tests/ui/nll/polonius/nll-problem-case-3-issue-112087.nll.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `*opt` because it is borrowed - --> $DIR/nll-problem-case-3-issue-112087.rs:23:5 + --> $DIR/nll-problem-case-3-issue-112087.rs:24:5 | LL | fn issue_112087<'a>(opt: &'a mut Option, b: bool) -> Result<&'a mut Option, &'a mut i32> { | -- lifetime `'a` defined here diff --git a/tests/ui/nll/polonius/nll-problem-case-3-issue-112087.rs b/tests/ui/nll/polonius/nll-problem-case-3-issue-112087.rs index d7270f6bfa7a3..a299c4a8f2ef7 100644 --- a/tests/ui/nll/polonius/nll-problem-case-3-issue-112087.rs +++ b/tests/ui/nll/polonius/nll-problem-case-3-issue-112087.rs @@ -8,6 +8,7 @@ //@ ignore-compare-mode-polonius (explicit revisions) //@ revisions: nll polonius legacy //@ [nll] known-bug: #112087 +//@ [nll] compile-flags: -Z polonius=nll //@ [polonius] check-pass //@ [polonius] compile-flags: -Z polonius=next //@ [legacy] check-pass diff --git a/tests/ui/nll/polonius/nll-problem-case-3-issue-123839.nll.stderr b/tests/ui/nll/polonius/nll-problem-case-3-issue-123839.nll.stderr index 541789b7f17e4..a34c9b4b30bd0 100644 --- a/tests/ui/nll/polonius/nll-problem-case-3-issue-123839.nll.stderr +++ b/tests/ui/nll/polonius/nll-problem-case-3-issue-123839.nll.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `self.status` because it is borrowed - --> $DIR/nll-problem-case-3-issue-123839.rs:37:9 + --> $DIR/nll-problem-case-3-issue-123839.rs:38:9 | LL | fn foo(self: &mut Self) -> Result<(), &str> { | - let's call the lifetime of this reference `'1` diff --git a/tests/ui/nll/polonius/nll-problem-case-3-issue-123839.rs b/tests/ui/nll/polonius/nll-problem-case-3-issue-123839.rs index a738dace73d70..968c906594f57 100644 --- a/tests/ui/nll/polonius/nll-problem-case-3-issue-123839.rs +++ b/tests/ui/nll/polonius/nll-problem-case-3-issue-123839.rs @@ -8,6 +8,7 @@ //@ ignore-compare-mode-polonius (explicit revisions) //@ revisions: nll polonius legacy //@ [nll] known-bug: #123839 +//@ [nll] compile-flags: -Z polonius=nll //@ [polonius] check-pass //@ [polonius] compile-flags: -Z polonius=next //@ [legacy] check-pass diff --git a/tests/ui/nll/polonius/nll-problem-case-3-issue-124070.nll.stderr b/tests/ui/nll/polonius/nll-problem-case-3-issue-124070.nll.stderr index 7c2a383e89c6a..dbea37ea19bfc 100644 --- a/tests/ui/nll/polonius/nll-problem-case-3-issue-124070.nll.stderr +++ b/tests/ui/nll/polonius/nll-problem-case-3-issue-124070.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `self.field` as immutable because it is also borrowed as mutable - --> $DIR/nll-problem-case-3-issue-124070.rs:28:16 + --> $DIR/nll-problem-case-3-issue-124070.rs:29:16 | LL | fn f(&mut self) -> &str { | - let's call the lifetime of this reference `'1` diff --git a/tests/ui/nll/polonius/nll-problem-case-3-issue-124070.rs b/tests/ui/nll/polonius/nll-problem-case-3-issue-124070.rs index ddf331db8bbbf..17a9b586a12bb 100644 --- a/tests/ui/nll/polonius/nll-problem-case-3-issue-124070.rs +++ b/tests/ui/nll/polonius/nll-problem-case-3-issue-124070.rs @@ -8,6 +8,7 @@ //@ ignore-compare-mode-polonius (explicit revisions) //@ revisions: nll polonius legacy //@ [nll] known-bug: #124070 +//@ [nll] compile-flags: -Z polonius=nll //@ [polonius] check-pass //@ [polonius] compile-flags: -Z polonius=next //@ [legacy] check-pass diff --git a/tests/ui/nll/polonius/nll-problem-case-3-issue-124254.nll.stderr b/tests/ui/nll/polonius/nll-problem-case-3-issue-124254.nll.stderr index bd5f1203f313f..8da10c78c7ff9 100644 --- a/tests/ui/nll/polonius/nll-problem-case-3-issue-124254.nll.stderr +++ b/tests/ui/nll/polonius/nll-problem-case-3-issue-124254.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `list[_]` as mutable more than once at a time - --> $DIR/nll-problem-case-3-issue-124254.rs:30:5 + --> $DIR/nll-problem-case-3-issue-124254.rs:31:5 | LL | fn find_lowest_or_first_empty_pos(list: &mut [Option]) -> &mut Option { | - let's call the lifetime of this reference `'1` @@ -14,7 +14,7 @@ LL | &mut list[lowest_idx] | ^^^^^^^^^^^^^^^^^^^^^ second mutable borrow occurs here error[E0503]: cannot use `*list` because it was mutably borrowed - --> $DIR/nll-problem-case-3-issue-124254.rs:30:10 + --> $DIR/nll-problem-case-3-issue-124254.rs:31:10 | LL | fn find_lowest_or_first_empty_pos(list: &mut [Option]) -> &mut Option { | - let's call the lifetime of this reference `'1` diff --git a/tests/ui/nll/polonius/nll-problem-case-3-issue-124254.rs b/tests/ui/nll/polonius/nll-problem-case-3-issue-124254.rs index e3bc2c2febc55..aec4966a974d1 100644 --- a/tests/ui/nll/polonius/nll-problem-case-3-issue-124254.rs +++ b/tests/ui/nll/polonius/nll-problem-case-3-issue-124254.rs @@ -6,6 +6,7 @@ //@ ignore-compare-mode-polonius (explicit revisions) //@ revisions: nll polonius legacy //@ [nll] known-bug: #124254 +//@ [nll] compile-flags: -Z polonius=nll //@ [polonius] check-pass //@ [polonius] compile-flags: -Z polonius=next //@ [legacy] check-pass diff --git a/tests/ui/nll/polonius/nll-problem-case-3-issue-21906.nll.stderr b/tests/ui/nll/polonius/nll-problem-case-3-issue-21906.nll.stderr index 0ab90faabcf0f..7c55b95eeedc3 100644 --- a/tests/ui/nll/polonius/nll-problem-case-3-issue-21906.nll.stderr +++ b/tests/ui/nll/polonius/nll-problem-case-3-issue-21906.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `*map` as mutable more than once at a time - --> $DIR/nll-problem-case-3-issue-21906.rs:26:13 + --> $DIR/nll-problem-case-3-issue-21906.rs:27:13 | LL | fn from_the_rfc<'r, K: Hash + Eq + Copy, V: Default>( | -- lifetime `'r` defined here @@ -17,7 +17,7 @@ LL | | } | |_____- returning this value requires that `*map` is borrowed for `'r` error[E0499]: cannot borrow `*map` as mutable more than once at a time - --> $DIR/nll-problem-case-3-issue-21906.rs:27:13 + --> $DIR/nll-problem-case-3-issue-21906.rs:28:13 | LL | fn from_the_rfc<'r, K: Hash + Eq + Copy, V: Default>( | -- lifetime `'r` defined here @@ -36,7 +36,7 @@ LL | | } | |_____- returning this value requires that `*map` is borrowed for `'r` error[E0499]: cannot borrow `*map` as mutable more than once at a time - --> $DIR/nll-problem-case-3-issue-21906.rs:45:41 + --> $DIR/nll-problem-case-3-issue-21906.rs:46:41 | LL | fn get_priority_mut_entry<'a, K, V>( | -- lifetime `'a` defined here @@ -49,7 +49,7 @@ LL | Entry::Vacant(_vacant) => match map.entry(key2) { | ^^^ second mutable borrow occurs here error[E0499]: cannot borrow `*self` as mutable more than once at a time - --> $DIR/nll-problem-case-3-issue-21906.rs:64:21 + --> $DIR/nll-problem-case-3-issue-21906.rs:65:21 | LL | fn two(&mut self) -> &i32 { | - let's call the lifetime of this reference `'1` @@ -61,7 +61,7 @@ LL | return k; | - returning this value requires that `*self` is borrowed for `'1` error[E0502]: cannot borrow `x.data` as immutable because it is also borrowed as mutable - --> $DIR/nll-problem-case-3-issue-21906.rs:82:22 + --> $DIR/nll-problem-case-3-issue-21906.rs:83:22 | LL | fn foo(x: &mut Foo) -> Option<&mut i32> { | - let's call the lifetime of this reference `'1` @@ -74,7 +74,7 @@ LL | println!("{:?}", x.data); | ^^^^^^ immutable borrow occurs here error[E0499]: cannot borrow `*vec` as mutable more than once at a time - --> $DIR/nll-problem-case-3-issue-21906.rs:97:9 + --> $DIR/nll-problem-case-3-issue-21906.rs:98:9 | LL | fn f(vec: &mut Vec) -> &u8 { | - let's call the lifetime of this reference `'1` @@ -88,7 +88,7 @@ LL | vec.push(10); | ^^^ second mutable borrow occurs here error[E0502]: cannot borrow `*vec` as immutable because it is also borrowed as mutable - --> $DIR/nll-problem-case-3-issue-21906.rs:98:9 + --> $DIR/nll-problem-case-3-issue-21906.rs:99:9 | LL | fn f(vec: &mut Vec) -> &u8 { | - let's call the lifetime of this reference `'1` diff --git a/tests/ui/nll/polonius/nll-problem-case-3-issue-21906.rs b/tests/ui/nll/polonius/nll-problem-case-3-issue-21906.rs index 45b56e32522f0..f6bfeb620472c 100644 --- a/tests/ui/nll/polonius/nll-problem-case-3-issue-21906.rs +++ b/tests/ui/nll/polonius/nll-problem-case-3-issue-21906.rs @@ -8,6 +8,7 @@ //@ ignore-compare-mode-polonius (explicit revisions) //@ revisions: nll polonius legacy //@ [nll] known-bug: #21906 +//@ [nll] compile-flags: -Z polonius=nll //@ [polonius] check-pass //@ [polonius] compile-flags: -Z polonius=next //@ [legacy] check-pass diff --git a/tests/ui/nll/polonius/nll-problem-case-3-issue-51526.nll.stderr b/tests/ui/nll/polonius/nll-problem-case-3-issue-51526.nll.stderr index 9a740a0edc741..a50eb24d19cba 100644 --- a/tests/ui/nll/polonius/nll-problem-case-3-issue-51526.nll.stderr +++ b/tests/ui/nll/polonius/nll-problem-case-3-issue-51526.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `*queue` as mutable because it is also borrowed as immutable - --> $DIR/nll-problem-case-3-issue-51526.rs:26:9 + --> $DIR/nll-problem-case-3-issue-51526.rs:27:9 | LL | fn next(queue: &mut VecDeque, above: u32) -> Option<&u32> { | - let's call the lifetime of this reference `'1` diff --git a/tests/ui/nll/polonius/nll-problem-case-3-issue-51526.rs b/tests/ui/nll/polonius/nll-problem-case-3-issue-51526.rs index 3cf211586b23b..fd3c189596617 100644 --- a/tests/ui/nll/polonius/nll-problem-case-3-issue-51526.rs +++ b/tests/ui/nll/polonius/nll-problem-case-3-issue-51526.rs @@ -8,6 +8,7 @@ //@ ignore-compare-mode-polonius (explicit revisions) //@ revisions: nll polonius legacy //@ [nll] known-bug: #51526 +//@ [nll] compile-flags: -Z polonius=nll //@ [polonius] check-pass //@ [polonius] compile-flags: -Z polonius=next //@ [legacy] check-pass diff --git a/tests/ui/nll/polonius/nll-problem-case-3-issue-51545.nll.stderr b/tests/ui/nll/polonius/nll-problem-case-3-issue-51545.nll.stderr index c6a0e1b282f99..17cf2e310fd25 100644 --- a/tests/ui/nll/polonius/nll-problem-case-3-issue-51545.nll.stderr +++ b/tests/ui/nll/polonius/nll-problem-case-3-issue-51545.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `*o` as mutable more than once at a time - --> $DIR/nll-problem-case-3-issue-51545.rs:17:17 + --> $DIR/nll-problem-case-3-issue-51545.rs:18:17 | LL | fn borrow(o: &mut Option) -> Option<&mut i32> { | - let's call the lifetime of this reference `'1` diff --git a/tests/ui/nll/polonius/nll-problem-case-3-issue-51545.rs b/tests/ui/nll/polonius/nll-problem-case-3-issue-51545.rs index 786a8b564b9f8..2a7d9cac25149 100644 --- a/tests/ui/nll/polonius/nll-problem-case-3-issue-51545.rs +++ b/tests/ui/nll/polonius/nll-problem-case-3-issue-51545.rs @@ -6,6 +6,7 @@ //@ ignore-compare-mode-polonius (explicit revisions) //@ revisions: nll polonius legacy //@ [nll] known-bug: #51545 +//@ [nll] compile-flags: -Z polonius=nll //@ [polonius] check-pass //@ [polonius] compile-flags: -Z polonius=next //@ [legacy] check-pass diff --git a/tests/ui/nll/polonius/nll-problem-case-3-issue-54663.nll.stderr b/tests/ui/nll/polonius/nll-problem-case-3-issue-54663.nll.stderr index fd6fa7632d5d4..475fb026e1da7 100644 --- a/tests/ui/nll/polonius/nll-problem-case-3-issue-54663.nll.stderr +++ b/tests/ui/nll/polonius/nll-problem-case-3-issue-54663.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time - --> $DIR/nll-problem-case-3-issue-54663.rs:20:9 + --> $DIR/nll-problem-case-3-issue-54663.rs:21:9 | LL | fn foo(x: &mut u8) -> Option<&u8> { | - let's call the lifetime of this reference `'1` diff --git a/tests/ui/nll/polonius/nll-problem-case-3-issue-54663.rs b/tests/ui/nll/polonius/nll-problem-case-3-issue-54663.rs index b4d571fb9c795..f1679f135e515 100644 --- a/tests/ui/nll/polonius/nll-problem-case-3-issue-54663.rs +++ b/tests/ui/nll/polonius/nll-problem-case-3-issue-54663.rs @@ -8,6 +8,7 @@ //@ ignore-compare-mode-polonius (explicit revisions) //@ revisions: nll polonius legacy //@ [nll] known-bug: #54663 +//@ [nll] compile-flags: -Z polonius=nll //@ [polonius] check-pass //@ [polonius] compile-flags: -Z polonius=next //@ [legacy] check-pass diff --git a/tests/ui/nll/polonius/nll-problem-case-3-issue-58787.nll.stderr b/tests/ui/nll/polonius/nll-problem-case-3-issue-58787.nll.stderr index 53002892df1c0..c444f9cf82257 100644 --- a/tests/ui/nll/polonius/nll-problem-case-3-issue-58787.nll.stderr +++ b/tests/ui/nll/polonius/nll-problem-case-3-issue-58787.nll.stderr @@ -1,5 +1,5 @@ error[E0503]: cannot use `list.0` because it was mutably borrowed - --> $DIR/nll-problem-case-3-issue-58787.rs:34:11 + --> $DIR/nll-problem-case-3-issue-58787.rs:35:11 | LL | Some(ref mut d) => { | --------- `list.0.0` is borrowed here @@ -11,7 +11,7 @@ LL | match list.0 { | borrow later used here error[E0499]: cannot borrow `list.0.0` as mutable more than once at a time - --> $DIR/nll-problem-case-3-issue-58787.rs:35:14 + --> $DIR/nll-problem-case-3-issue-58787.rs:36:14 | LL | Some(ref mut d) => { | --------- first mutable borrow occurs here @@ -23,7 +23,7 @@ LL | Some(ref mut d) => { | first borrow later used here error[E0503]: cannot use `list.0` because it was mutably borrowed - --> $DIR/nll-problem-case-3-issue-58787.rs:41:11 + --> $DIR/nll-problem-case-3-issue-58787.rs:42:11 | LL | Some(ref mut d) => { | --------- `list.0.0` is borrowed here @@ -35,7 +35,7 @@ LL | match list { | borrow later used here error[E0499]: cannot borrow `list.0.0` as mutable more than once at a time - --> $DIR/nll-problem-case-3-issue-58787.rs:42:19 + --> $DIR/nll-problem-case-3-issue-58787.rs:43:19 | LL | Some(ref mut d) => { | --------- first mutable borrow occurs here @@ -47,7 +47,7 @@ LL | List(Some(d)) => { | first borrow later used here error[E0503]: cannot use `list.0` because it was mutably borrowed - --> $DIR/nll-problem-case-3-issue-58787.rs:50:11 + --> $DIR/nll-problem-case-3-issue-58787.rs:51:11 | LL | List(Some(d)) => { | - `list.0.0` is borrowed here @@ -59,7 +59,7 @@ LL | match list { | borrow later used here error[E0499]: cannot borrow `list.0.0` as mutable more than once at a time - --> $DIR/nll-problem-case-3-issue-58787.rs:51:19 + --> $DIR/nll-problem-case-3-issue-58787.rs:52:19 | LL | List(Some(d)) => { | - first mutable borrow occurs here @@ -71,7 +71,7 @@ LL | List(Some(d)) => { | first borrow later used here error[E0499]: cannot borrow `list.0` as mutable more than once at a time - --> $DIR/nll-problem-case-3-issue-58787.rs:57:11 + --> $DIR/nll-problem-case-3-issue-58787.rs:58:11 | LL | List(Some(d)) => { | - first mutable borrow occurs here @@ -83,7 +83,7 @@ LL | match &mut list.0 { | first borrow later used here error[E0499]: cannot borrow `list.0` as mutable more than once at a time - --> $DIR/nll-problem-case-3-issue-58787.rs:66:11 + --> $DIR/nll-problem-case-3-issue-58787.rs:67:11 | LL | match &mut list.0 { | ----------- first mutable borrow occurs here @@ -95,7 +95,7 @@ LL | match &mut list.0 { | first borrow later used here error[E0506]: cannot assign to `list.0` because it is borrowed - --> $DIR/nll-problem-case-3-issue-58787.rs:73:5 + --> $DIR/nll-problem-case-3-issue-58787.rs:74:5 | LL | match &mut list.0 { | ----------- `list.0` is borrowed here diff --git a/tests/ui/nll/polonius/nll-problem-case-3-issue-58787.rs b/tests/ui/nll/polonius/nll-problem-case-3-issue-58787.rs index 75552e24219a0..c508bfa339173 100644 --- a/tests/ui/nll/polonius/nll-problem-case-3-issue-58787.rs +++ b/tests/ui/nll/polonius/nll-problem-case-3-issue-58787.rs @@ -8,6 +8,7 @@ //@ ignore-compare-mode-polonius (explicit revisions) //@ revisions: nll polonius legacy //@ [nll] known-bug: #58787 +//@ [nll] compile-flags: -Z polonius=nll //@ [polonius] check-pass //@ [polonius] compile-flags: -Z polonius=next //@ [legacy] check-pass diff --git a/tests/ui/nll/polonius/nll-problem-case-3-issue-68934.nll.stderr b/tests/ui/nll/polonius/nll-problem-case-3-issue-68934.nll.stderr index 212355790bf96..067b3f21a957d 100644 --- a/tests/ui/nll/polonius/nll-problem-case-3-issue-68934.nll.stderr +++ b/tests/ui/nll/polonius/nll-problem-case-3-issue-68934.nll.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of value because it is borrowed - --> $DIR/nll-problem-case-3-issue-68934.rs:35:14 + --> $DIR/nll-problem-case-3-issue-68934.rs:36:14 | LL | fn deep_fetch(&mut self, value: Either) -> Result<&mut Self, (&mut Self, Either)> { | - let's call the lifetime of this reference `'1` diff --git a/tests/ui/nll/polonius/nll-problem-case-3-issue-68934.rs b/tests/ui/nll/polonius/nll-problem-case-3-issue-68934.rs index ba9415101169b..fd498ec12fcd1 100644 --- a/tests/ui/nll/polonius/nll-problem-case-3-issue-68934.rs +++ b/tests/ui/nll/polonius/nll-problem-case-3-issue-68934.rs @@ -8,6 +8,7 @@ //@ ignore-compare-mode-polonius (explicit revisions) //@ revisions: nll polonius legacy //@ [nll] known-bug: #68934 +//@ [nll] compile-flags: -Z polonius=nll //@ [polonius] check-pass //@ [polonius] compile-flags: -Z polonius=next //@ [legacy] check-pass diff --git a/tests/ui/wf/hir-wf-check-erase-regions.nll.stderr b/tests/ui/wf/hir-wf-check-erase-regions.nll.stderr index 853e443ead71d..dc2e8147a159c 100644 --- a/tests/ui/wf/hir-wf-check-erase-regions.nll.stderr +++ b/tests/ui/wf/hir-wf-check-erase-regions.nll.stderr @@ -1,5 +1,5 @@ error[E0277]: `&'a T` is not an iterator - --> $DIR/hir-wf-check-erase-regions.rs:11:21 + --> $DIR/hir-wf-check-erase-regions.rs:12:21 | LL | type IntoIter = std::iter::Flatten>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&'a T` is not an iterator @@ -12,7 +12,7 @@ note: required by a bound in `std::iter::IntoIterator::IntoIter` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL error[E0277]: `&'a T` is not an iterator - --> $DIR/hir-wf-check-erase-regions.rs:11:5 + --> $DIR/hir-wf-check-erase-regions.rs:12:5 | LL | type IntoIter = std::iter::Flatten>; | ^^^^^^^^^^^^^ `&'a T` is not an iterator @@ -25,7 +25,7 @@ note: required by a bound in `Flatten` --> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL error[E0277]: `&'a T` is not an iterator - --> $DIR/hir-wf-check-erase-regions.rs:15:27 + --> $DIR/hir-wf-check-erase-regions.rs:16:27 | LL | fn into_iter(self) -> Self::IntoIter { | ^^^^^^^^^^^^^^ `&'a T` is not an iterator @@ -38,7 +38,7 @@ note: required by a bound in `Flatten` --> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL error[E0277]: `&T` is not an iterator - --> $DIR/hir-wf-check-erase-regions.rs:15:27 + --> $DIR/hir-wf-check-erase-regions.rs:16:27 | LL | fn into_iter(self) -> Self::IntoIter { | ^^^^^^^^^^^^^^ `&T` is not an iterator diff --git a/tests/ui/wf/hir-wf-check-erase-regions.polonius.stderr b/tests/ui/wf/hir-wf-check-erase-regions.polonius.stderr index 8a172ef4929ec..e2bb67269a529 100644 --- a/tests/ui/wf/hir-wf-check-erase-regions.polonius.stderr +++ b/tests/ui/wf/hir-wf-check-erase-regions.polonius.stderr @@ -1,5 +1,5 @@ error[E0277]: `&'a T` is not an iterator - --> $DIR/hir-wf-check-erase-regions.rs:11:21 + --> $DIR/hir-wf-check-erase-regions.rs:12:21 | LL | type IntoIter = std::iter::Flatten>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&'a T` is not an iterator @@ -12,7 +12,7 @@ note: required by a bound in `std::iter::IntoIterator::IntoIter` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL error[E0277]: `&'a T` is not an iterator - --> $DIR/hir-wf-check-erase-regions.rs:11:5 + --> $DIR/hir-wf-check-erase-regions.rs:12:5 | LL | type IntoIter = std::iter::Flatten>; | ^^^^^^^^^^^^^ `&'a T` is not an iterator @@ -25,7 +25,7 @@ note: required by a bound in `Flatten` --> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL error[E0277]: `&'a T` is not an iterator - --> $DIR/hir-wf-check-erase-regions.rs:15:27 + --> $DIR/hir-wf-check-erase-regions.rs:16:27 | LL | fn into_iter(self) -> Self::IntoIter { | ^^^^^^^^^^^^^^ `&'a T` is not an iterator diff --git a/tests/ui/wf/hir-wf-check-erase-regions.rs b/tests/ui/wf/hir-wf-check-erase-regions.rs index ef9132697efc8..40612353bd45f 100644 --- a/tests/ui/wf/hir-wf-check-erase-regions.rs +++ b/tests/ui/wf/hir-wf-check-erase-regions.rs @@ -3,6 +3,7 @@ //@ ignore-compare-mode-polonius (explicit revisions) //@ revisions: nll polonius +//@ [nll] compile-flags: -Zpolonius=nll //@ [polonius] compile-flags: -Zpolonius=next pub struct Table([Option; N]); From 0006999261461e6aff394961dbb8daf5112cff58 Mon Sep 17 00:00:00 2001 From: jackh726 Date: Wed, 15 Jul 2026 15:59:00 +0000 Subject: [PATCH 2/3] Enable polonius alpha on nightly --- compiler/rustc_session/src/config.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 35bd884d163b6..15973f4fbff10 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -3425,7 +3425,7 @@ impl PatchableFunctionEntry { /// or future prototype. #[derive(Clone, Copy, PartialEq, Hash, Debug, Default)] pub enum Polonius { - /// The default value: diabled. + /// The default value: (next on nightly, off on stable) #[default] Default, @@ -3446,8 +3446,9 @@ impl Polonius { } /// Returns whether the "next" version of polonius is enabled - pub fn is_next_enabled(&self, _is_nightly: bool) -> bool { - matches!(self, Polonius::Next) + pub fn is_next_enabled(&self, is_nightly: bool) -> bool { + // We're enabling next on nightly if a different option was not explicitly specified. + matches!(self, Polonius::Next) || (is_nightly && matches!(self, Polonius::Default)) } } From f7d91a722085d79bba4c48c196419c212d2a2a2f Mon Sep 17 00:00:00 2001 From: jackh726 Date: Wed, 22 Jul 2026 18:07:42 +0000 Subject: [PATCH 3/3] Switch from compiler to bootstrap. --- compiler/rustc_borrowck/src/dataflow.rs | 2 +- .../src/diagnostics/explain_borrow.rs | 8 +------- compiler/rustc_borrowck/src/polonius/dump.rs | 2 +- .../src/type_check/liveness/mod.rs | 9 +-------- compiler/rustc_borrowck/src/type_check/mod.rs | 9 +-------- compiler/rustc_session/src/config.rs | 17 +++++++++-------- src/bootstrap/src/core/build_steps/compile.rs | 6 ++++++ 7 files changed, 20 insertions(+), 33 deletions(-) diff --git a/compiler/rustc_borrowck/src/dataflow.rs b/compiler/rustc_borrowck/src/dataflow.rs index 72231e24e8af7..0bc06ade95ea1 100644 --- a/compiler/rustc_borrowck/src/dataflow.rs +++ b/compiler/rustc_borrowck/src/dataflow.rs @@ -433,7 +433,7 @@ impl<'a, 'tcx> Borrows<'a, 'tcx> { borrow_set: &'a BorrowSet<'tcx>, ) -> Self { let borrows_out_of_scope_at_location = - if !tcx.sess.opts.unstable_opts.polonius.is_next_enabled(tcx.sess.is_nightly_build()) { + if !tcx.sess.opts.unstable_opts.polonius.is_next_enabled() { calculate_borrows_out_of_scope_at_location(body, regioncx, borrow_set) } else { PoloniusOutOfScopePrecomputer::compute(body, regioncx, borrow_set) diff --git a/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs b/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs index ac6dea7274714..1b633aefc22f8 100644 --- a/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs +++ b/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs @@ -632,13 +632,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> { if let Some(polonius_context) = self.polonius_context { polonius_context.boring_nll_locals.contains(&local) } else { - assert!( - !tcx.sess - .opts - .unstable_opts - .polonius - .is_next_enabled(tcx.sess.is_nightly_build()) - ); + assert!(!tcx.sess.opts.unstable_opts.polonius.is_next_enabled()); // Boring locals are never the cause of a borrow explanation in NLLs. false diff --git a/compiler/rustc_borrowck/src/polonius/dump.rs b/compiler/rustc_borrowck/src/polonius/dump.rs index dc849f172675b..5285f724b02ec 100644 --- a/compiler/rustc_borrowck/src/polonius/dump.rs +++ b/compiler/rustc_borrowck/src/polonius/dump.rs @@ -25,7 +25,7 @@ pub(crate) fn dump_polonius_mir<'tcx>( polonius_context: Option<&PoloniusContext>, ) { let tcx = infcx.tcx; - if !tcx.sess.opts.unstable_opts.polonius.is_next_enabled(tcx.sess.is_nightly_build()) { + if !tcx.sess.opts.unstable_opts.polonius.is_next_enabled() { return; } diff --git a/compiler/rustc_borrowck/src/type_check/liveness/mod.rs b/compiler/rustc_borrowck/src/type_check/liveness/mod.rs index cbff0865be782..442c37e26ec18 100644 --- a/compiler/rustc_borrowck/src/type_check/liveness/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/liveness/mod.rs @@ -45,14 +45,7 @@ pub(super) fn generate<'tcx>( // unlike NLLs. // We do record these regions in the polonius context, since they're used to differentiate // relevant and boring locals, which is a key distinction used later in diagnostics. - if typeck - .tcx() - .sess - .opts - .unstable_opts - .polonius - .is_next_enabled(typeck.tcx().sess.is_nightly_build()) - { + if typeck.tcx().sess.opts.unstable_opts.polonius.is_next_enabled() { let (_, boring_locals) = compute_relevant_live_locals(typeck.tcx(), &free_regions, typeck.body); typeck.polonius_context.as_mut().unwrap().boring_nll_locals = diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs index a1654074d8b29..9c4b1f998dcee 100644 --- a/compiler/rustc_borrowck/src/type_check/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/mod.rs @@ -138,14 +138,7 @@ pub(crate) fn type_check<'tcx>( debug!(?normalized_inputs_and_output); - let polonius_context = if infcx - .tcx - .sess - .opts - .unstable_opts - .polonius - .is_next_enabled(infcx.tcx.sess.is_nightly_build()) - { + let polonius_context = if infcx.tcx.sess.opts.unstable_opts.polonius.is_next_enabled() { Some(PoloniusContext::default()) } else { None diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 15973f4fbff10..1819285d80530 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -3423,12 +3423,8 @@ impl PatchableFunctionEntry { /// `-Zpolonius` values, enabling the borrow checker polonius analysis, and which version: legacy, /// or future prototype. -#[derive(Clone, Copy, PartialEq, Hash, Debug, Default)] +#[derive(Clone, Copy, PartialEq, Hash, Debug)] pub enum Polonius { - /// The default value: (next on nightly, off on stable) - #[default] - Default, - /// Polonius is disabled, only use NLL. NLL, @@ -3439,6 +3435,12 @@ pub enum Polonius { Next, } +impl Default for Polonius { + fn default() -> Self { + if option_env!("CFG_DEFAULT_POLONIUS_NEXT").is_some() { Self::Next } else { Self::NLL } + } +} + impl Polonius { /// Returns whether the legacy version of polonius is enabled pub fn is_legacy_enabled(&self) -> bool { @@ -3446,9 +3448,8 @@ impl Polonius { } /// Returns whether the "next" version of polonius is enabled - pub fn is_next_enabled(&self, is_nightly: bool) -> bool { - // We're enabling next on nightly if a different option was not explicitly specified. - matches!(self, Polonius::Next) || (is_nightly && matches!(self, Polonius::Default)) + pub fn is_next_enabled(&self) -> bool { + matches!(self, Polonius::Next) } } diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index 1248438e93605..8fa0af242efb5 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -1395,6 +1395,12 @@ pub fn rustc_cargo_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetS cargo.env("RUSTC_VERIFY_LLVM_IR", "1"); } + let nightly = builder.config.channel == "nightly" || builder.config.channel == "dev"; + if nightly { + // We want to enable Polonius Alpha by default on nighty + cargo.env("CFG_DEFAULT_POLONIUS_NEXT", "1"); + } + // These conditionals represent a tension between three forces: // - For non-check builds, we need to define some LLVM-related environment // variables, requiring LLVM to have been built.