|
| 1 | +error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable |
| 2 | + --> $DIR/external-macro.rs:10:1 |
| 3 | + | |
| 4 | +LL | no_use_pm::pm_rpit!{} |
| 5 | + | ^^^^^^^^^^^^^^^^^^^^^ |
| 6 | + | | |
| 7 | + | mutable borrow occurs here |
| 8 | + | immutable borrow occurs here |
| 9 | + | immutable borrow later used here |
| 10 | + | |
| 11 | +note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules |
| 12 | + --> $DIR/external-macro.rs:10:1 |
| 13 | + | |
| 14 | +LL | no_use_pm::pm_rpit!{} |
| 15 | + | ^^^^^^^^^^^^^^^^^^^^^ |
| 16 | + = note: this error originates in the macro `no_use_pm::pm_rpit` (in Nightly builds, run with -Z macro-backtrace for more info) |
| 17 | +help: use the precise capturing `use<...>` syntax to make the captures explicit |
| 18 | + | |
| 19 | +LL | no_use_pm::pm_rpit!{} + use<> |
| 20 | + | +++++++ |
| 21 | + |
| 22 | +error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable |
| 23 | + --> $DIR/external-macro.rs:13:1 |
| 24 | + | |
| 25 | +LL | no_use_macro::macro_rpit!{} |
| 26 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 27 | + | | |
| 28 | + | mutable borrow occurs here |
| 29 | + | immutable borrow occurs here |
| 30 | + | immutable borrow later used here |
| 31 | + | |
| 32 | +note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules |
| 33 | + --> $DIR/external-macro.rs:13:1 |
| 34 | + | |
| 35 | +LL | no_use_macro::macro_rpit!{} |
| 36 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 37 | + = note: this error originates in the macro `no_use_macro::macro_rpit` (in Nightly builds, run with -Z macro-backtrace for more info) |
| 38 | +help: use the precise capturing `use<...>` syntax to make the captures explicit |
| 39 | + --> $DIR/auxiliary/no-use-macro.rs:7:60 |
| 40 | + | |
| 41 | +LL | fn test_mbe(x: &Vec<i32>) -> impl std::fmt::Display + use<> { |
| 42 | + | +++++++ |
| 43 | + |
| 44 | +error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable |
| 45 | + --> $DIR/external-macro.rs:21:5 |
| 46 | + | |
| 47 | +LL | let element = test_pm(&x); |
| 48 | + | -- immutable borrow occurs here |
| 49 | +LL | x.push(2); |
| 50 | + | ^^^^^^^^^ mutable borrow occurs here |
| 51 | +LL | |
| 52 | +LL | println!("{element}"); |
| 53 | + | --------- immutable borrow later used here |
| 54 | + | |
| 55 | +note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules |
| 56 | + --> $DIR/external-macro.rs:20:19 |
| 57 | + | |
| 58 | +LL | let element = test_pm(&x); |
| 59 | + | ^^^^^^^^^^^ |
| 60 | +help: use the precise capturing `use<...>` syntax to make the captures explicit |
| 61 | + | |
| 62 | +LL | no_use_pm::pm_rpit!{} + use<> |
| 63 | + | +++++++ |
| 64 | + |
| 65 | +error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable |
| 66 | + --> $DIR/external-macro.rs:26:5 |
| 67 | + | |
| 68 | +LL | let element = test_pm(&x); |
| 69 | + | -- immutable borrow occurs here |
| 70 | +... |
| 71 | +LL | x.push(2); |
| 72 | + | ^^^^^^^^^ mutable borrow occurs here |
| 73 | +... |
| 74 | +LL | } |
| 75 | + | - immutable borrow might be used here, when `element` is dropped and runs the destructor for type `impl std::fmt::Display` |
| 76 | + | |
| 77 | +note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules |
| 78 | + --> $DIR/external-macro.rs:20:19 |
| 79 | + | |
| 80 | +LL | let element = test_pm(&x); |
| 81 | + | ^^^^^^^^^^^ |
| 82 | +help: use the precise capturing `use<...>` syntax to make the captures explicit |
| 83 | + | |
| 84 | +LL | no_use_pm::pm_rpit!{} + use<> |
| 85 | + | +++++++ |
| 86 | + |
| 87 | +error: aborting due to 4 previous errors |
| 88 | + |
| 89 | +For more information about this error, try `rustc --explain E0502`. |
0 commit comments