about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/impl-trait/precise-capturing/external-macro.rs5
-rw-r--r--tests/ui/impl-trait/precise-capturing/external-macro.stderr89
2 files changed, 1 insertions, 93 deletions
diff --git a/tests/ui/impl-trait/precise-capturing/external-macro.rs b/tests/ui/impl-trait/precise-capturing/external-macro.rs
index 72f72bc7b05..492e8036461 100644
--- a/tests/ui/impl-trait/precise-capturing/external-macro.rs
+++ b/tests/ui/impl-trait/precise-capturing/external-macro.rs
@@ -6,12 +6,11 @@
 //@ aux-crate: no_use_macro=no-use-macro.rs
 //@ edition: 2024
 //@ compile-flags:-Z unstable-options
+//@ check-pass
 
 no_use_pm::pm_rpit!{}
-//~^ ERROR: cannot borrow `x` as mutable
 
 no_use_macro::macro_rpit!{}
-//~^ ERROR: cannot borrow `x` as mutable
 
 fn main() {
     let mut x = vec![];
@@ -19,11 +18,9 @@ fn main() {
 
     let element = test_pm(&x);
     x.push(2);
-    //~^ ERROR: cannot borrow `x` as mutable
     println!("{element}");
 
     let element = test_mbe(&x);
     x.push(2);
-    //~^ ERROR: cannot borrow `x` as mutable
     println!("{element}");
 }
diff --git a/tests/ui/impl-trait/precise-capturing/external-macro.stderr b/tests/ui/impl-trait/precise-capturing/external-macro.stderr
deleted file mode 100644
index 88a142088dd..00000000000
--- a/tests/ui/impl-trait/precise-capturing/external-macro.stderr
+++ /dev/null
@@ -1,89 +0,0 @@
-error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
-  --> $DIR/external-macro.rs:10:1
-   |
-LL | no_use_pm::pm_rpit!{}
-   | ^^^^^^^^^^^^^^^^^^^^^
-   | |
-   | mutable borrow occurs here
-   | immutable borrow occurs here
-   | immutable borrow later used here
-   |
-note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules
-  --> $DIR/external-macro.rs:10:1
-   |
-LL | no_use_pm::pm_rpit!{}
-   | ^^^^^^^^^^^^^^^^^^^^^
-   = note: this error originates in the macro `no_use_pm::pm_rpit` (in Nightly builds, run with -Z macro-backtrace for more info)
-help: use the precise capturing `use<...>` syntax to make the captures explicit
-   |
-LL | no_use_pm::pm_rpit!{} + use<>
-   |                       +++++++
-
-error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
-  --> $DIR/external-macro.rs:13:1
-   |
-LL | no_use_macro::macro_rpit!{}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   | |
-   | mutable borrow occurs here
-   | immutable borrow occurs here
-   | immutable borrow later used here
-   |
-note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules
-  --> $DIR/external-macro.rs:13:1
-   |
-LL | no_use_macro::macro_rpit!{}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   = note: this error originates in the macro `no_use_macro::macro_rpit` (in Nightly builds, run with -Z macro-backtrace for more info)
-help: use the precise capturing `use<...>` syntax to make the captures explicit
-  --> $DIR/auxiliary/no-use-macro.rs:7:60
-   |
-LL |         fn test_mbe(x: &Vec<i32>) -> impl std::fmt::Display + use<> {
-   |                                                             +++++++
-
-error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
-  --> $DIR/external-macro.rs:21:5
-   |
-LL |     let element = test_pm(&x);
-   |                           -- immutable borrow occurs here
-LL |     x.push(2);
-   |     ^^^^^^^^^ mutable borrow occurs here
-LL |
-LL |     println!("{element}");
-   |               --------- immutable borrow later used here
-   |
-note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules
-  --> $DIR/external-macro.rs:20:19
-   |
-LL |     let element = test_pm(&x);
-   |                   ^^^^^^^^^^^
-help: use the precise capturing `use<...>` syntax to make the captures explicit
-   |
-LL | no_use_pm::pm_rpit!{} + use<>
-   |                       +++++++
-
-error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
-  --> $DIR/external-macro.rs:26:5
-   |
-LL |     let element = test_pm(&x);
-   |                           -- immutable borrow occurs here
-...
-LL |     x.push(2);
-   |     ^^^^^^^^^ mutable borrow occurs here
-...
-LL | }
-   | - immutable borrow might be used here, when `element` is dropped and runs the destructor for type `impl std::fmt::Display`
-   |
-note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules
-  --> $DIR/external-macro.rs:20:19
-   |
-LL |     let element = test_pm(&x);
-   |                   ^^^^^^^^^^^
-help: use the precise capturing `use<...>` syntax to make the captures explicit
-   |
-LL | no_use_pm::pm_rpit!{} + use<>
-   |                       +++++++
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0502`.