0
0
mirror of https://github.com/rust-lang/rust.git synced 2024-12-01 13:18:54 +01:00
rust/tests/ui/closures/2229_closure_analysis
dianne 2ab8480605 Suggest borrowing arguments in generic positions when trait bounds are satisfied
This subsumes the suggestions to borrow arguments with `AsRef`/`Borrow` bounds and those to borrow
arguments with `Fn` and `FnMut` bounds. It works for other traits implemented on references as well,
such as `std::io::Read`, `std::io::Write`, and `core::fmt::Write`.

Incidentally, by making the logic for suggesting borrowing closures general, this removes some
spurious suggestions to mutably borrow `FnMut` closures in assignments, as well as an unhelpful
suggestion to add a `Clone` constraint to an `impl Fn` argument.
2024-11-13 20:29:40 -08:00
..
diagnostics Suggest borrowing arguments in generic positions when trait bounds are satisfied 2024-11-13 20:29:40 -08:00
match
migrations
optimization
run_pass
array_subslice.rs
array_subslice.stderr
arrays-completely-captured.rs
arrays-completely-captured.stderr
bad-pattern.rs
bad-pattern.stderr
by_value.rs
by_value.stderr
capture-analysis-1.rs
capture-analysis-1.stderr
capture-analysis-2.rs
capture-analysis-2.stderr
capture-analysis-3.rs
capture-analysis-3.stderr
capture-analysis-4.rs
capture-analysis-4.stderr
capture-disjoint-field-struct.rs
capture-disjoint-field-struct.stderr
capture-disjoint-field-tuple.rs
capture-disjoint-field-tuple.stderr
capture-enum-field.rs
capture-enums.rs
capture-enums.stderr
deep-multilevel-struct.rs
deep-multilevel-struct.stderr
deep-multilevel-tuple.rs
deep-multilevel-tuple.stderr
destructure_patterns.rs
destructure_patterns.stderr
feature-gate-capture_disjoint_fields.rs
feature-gate-capture_disjoint_fields.stderr
filter-on-struct-member.rs
filter-on-struct-member.stderr
issue_88118.rs
issue-87378.rs
issue-87378.stderr
issue-87987.rs
issue-87987.stderr
issue-88118-2.rs
issue-88118-2.stderr
issue-88476.rs
issue-88476.stderr
issue-89606.rs
issue-90465.fixed
issue-90465.rs
issue-90465.stderr
issue-92724-needsdrop-query-cycle.rs
issue-118144.rs
issue-118144.stderr
move_closure.rs
move_closure.stderr
multilevel-path-1.rs
multilevel-path-1.stderr
multilevel-path-2.rs
multilevel-path-2.stderr
nested-closure.rs
nested-closure.stderr
path-with-array-access.rs
path-with-array-access.stderr
preserve_field_drop_order2.rs
preserve_field_drop_order2.twenty_eighteen.run.stdout
preserve_field_drop_order2.twenty_twentyone.run.stdout
preserve_field_drop_order.rs
preserve_field_drop_order.stderr
repr_packed.rs
repr_packed.stderr
simple-struct-min-capture.rs
simple-struct-min-capture.stderr
unique-borrows-are-invariant-1.rs
unique-borrows-are-invariant-1.stderr
unique-borrows-are-invariant-2.rs
unique-borrows-are-invariant-2.stderr
unsafe_ptr.rs
unsafe_ptr.stderr
wild_patterns.rs
wild_patterns.stderr