0
0
mirror of https://github.com/rust-lang/rust.git synced 2024-12-01 04:21:19 +01:00
rust/tests/ui/closures
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
..
2229_closure_analysis Suggest borrowing arguments in generic positions when trait bounds are satisfied 2024-11-13 20:29:40 -08:00
binder Pass correct HirId to late_bound_vars in diagnostic code 2024-09-26 19:26:08 +02:00
closure-expected-type
deduce-signature
print
add_semicolon_non_block_closure.rs Don't suggest adding return type for closures with default return type 2024-08-28 12:54:39 +08:00
add_semicolon_non_block_closure.stderr Don't suggest adding return type for closures with default return type 2024-08-28 12:54:39 +08:00
cannot-call-unsized-via-ptr-2.rs
cannot-call-unsized-via-ptr-2.stderr
cannot-call-unsized-via-ptr.rs
cannot-call-unsized-via-ptr.stderr
capture-unsized-by-move.rs
capture-unsized-by-move.stderr
capture-unsized-by-ref.rs
closure_cap_coerce_many_fail.rs
closure_cap_coerce_many_fail.stderr
closure_no_cap_coerce_many_check_pass.rs
closure_no_cap_coerce_many_run_pass.rs
closure_no_cap_coerce_many_unsafe_0.rs
closure_no_cap_coerce_many_unsafe_0.stderr
closure_no_cap_coerce_many_unsafe_1.rs
closure_promotion.rs
closure-array-break-length.rs
closure-array-break-length.stderr
closure-bounds-cant-promote-superkind-in-struct.rs
closure-bounds-cant-promote-superkind-in-struct.stderr
closure-bounds-static-cant-capture-borrowed.rs
closure-bounds-static-cant-capture-borrowed.stderr
closure-bounds-subtype.rs
closure-bounds-subtype.stderr
closure-expected.rs
closure-expected.stderr
closure-immutable-outer-variable.fixed
closure-immutable-outer-variable.rs
closure-immutable-outer-variable.rs.fixed
closure-immutable-outer-variable.stderr
closure-move-sync.rs
closure-move-sync.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
closure-no-fn-1.rs
closure-no-fn-1.stderr
closure-no-fn-2.rs
closure-no-fn-2.stderr
closure-no-fn-3.rs
closure-no-fn-3.stderr
closure-no-fn-4.rs
closure-no-fn-4.stderr
closure-no-fn-5.rs
closure-no-fn-5.stderr
closure-referencing-itself-issue-25954.rs
closure-referencing-itself-issue-25954.stderr
closure-reform-bad.rs
closure-reform-bad.stderr
closure-return-type-mismatch.rs Pass correct HirId to late_bound_vars in diagnostic code 2024-09-26 19:26:08 +02:00
closure-return-type-mismatch.stderr Pass correct HirId to late_bound_vars in diagnostic code 2024-09-26 19:26:08 +02:00
closure-return-type-must-be-sized.rs
closure-return-type-must-be-sized.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
closure-wrong-kind.rs
closure-wrong-kind.stderr
coerce-unsafe-closure-to-unsafe-fn-ptr.rs
coerce-unsafe-closure-to-unsafe-fn-ptr.stderr
coerce-unsafe-to-closure.rs
coerce-unsafe-to-closure.stderr remove support for extern-block const intrinsics 2024-11-04 23:27:45 +01:00
deeply-nested_closures.rs
diverging-closure.rs
issue-868.rs
issue-1460.rs
issue-1460.stderr
issue-5239-1.rs
issue-5239-1.stderr
issue-5239-2.rs
issue-6801.rs
issue-6801.stderr
issue-10398.rs
issue-10398.stderr
issue-10682.rs
issue-11873.rs
issue-11873.stderr
issue-22864-1.rs
issue-22864-2.rs
issue-25439.rs
issue-25439.stderr
issue-41366.rs
issue-42463.rs
issue-46742.rs
issue-48109.rs
issue-52437.rs
issue-52437.stderr
issue-67123.rs
issue-67123.stderr
issue-68025.rs
issue-72408-nested-closures-exponential.rs
issue-78720.rs
issue-78720.stderr
issue-80313-mutable-borrow-in-closure.rs
issue-80313-mutable-borrow-in-closure.stderr
issue-80313-mutable-borrow-in-move-closure.rs
issue-80313-mutable-borrow-in-move-closure.stderr
issue-80313-mutation-in-closure.rs
issue-80313-mutation-in-closure.stderr
issue-80313-mutation-in-move-closure.rs
issue-80313-mutation-in-move-closure.stderr
issue-81700-mut-borrow.rs
issue-81700-mut-borrow.stderr
issue-82438-mut-without-upvar.rs
issue-82438-mut-without-upvar.stderr
issue-84044-drop-non-mut.rs
issue-84044-drop-non-mut.stderr
issue-84128.rs
issue-84128.stderr
issue-87461.rs
issue-87461.stderr
issue-87814-1.rs
issue-87814-2.rs
issue-90871.rs
issue-90871.stderr
issue-97607.rs
issue-99565.rs
issue-99565.stderr
issue-101696.rs
issue-102089-multiple-opaque-cast.rs
issue-109188.rs
issue-109188.stderr
issue-111932.rs
issue-111932.stderr rt::Argument: elide lifetimes 2024-10-14 20:24:30 +02:00
issue-113087.rs
issue-113087.stderr
local-type-mix.rs
local-type-mix.stderr
multiple-fn-bounds.rs
multiple-fn-bounds.stderr
old-closure-arg-call-as.rs
old-closure-arg.rs
old-closure-explicit-types.rs
old-closure-expr-precedence.rs
old-closure-expr-precedence.stderr
old-closure-expression-remove-semicolon.fixed
old-closure-expression-remove-semicolon.rs
old-closure-expression-remove-semicolon.stderr
old-closure-fn-coerce.rs
old-closure-iter-1.rs
old-closure-iter-2.rs
once-move-out-on-heap.rs
return-value-lifetime-error.fixed
return-value-lifetime-error.rs
return-value-lifetime-error.stderr
self-supertrait-bounds.rs
semistatement-in-lambda.rs
static-closures-with-nonstatic-return.rs
supertrait-hint-cycle-2.rs
supertrait-hint-cycle-3.rs
supertrait-hint-cycle.rs
supertrait-hint-references-assoc-ty.rs
thir-unsafeck-issue-85871.rs
wrong-closure-arg-suggestion-125325.rs
wrong-closure-arg-suggestion-125325.stderr