about summary refs log tree commit diff
path: root/tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2025-04-10 05:51:39 +0000
committerGitHub <noreply@github.com>2025-04-10 05:51:39 +0000
commit529bb5f2538c4d6ef294aaa1a31e45f264583dd9 (patch)
tree5c1e484e016c4164bac84fd550ee930223281a45 /tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs
parente0e2a93cf2e36be513c36176d26f14ddb9f24002 (diff)
parent0aa0d074cd1ce3f58eaffcf6019c1a236adc4dc1 (diff)
downloadrust-529bb5f2538c4d6ef294aaa1a31e45f264583dd9.tar.gz
rust-529bb5f2538c4d6ef294aaa1a31e45f264583dd9.zip
Correctly handle bracketed type in `default_constructed_unit_struct` (#14367)
There were two bugs here. Let's assume `T` is a singleton type
implementing `Default` and that `f()` takes a `T`:

- `f(<T>::default())` cannot be replaced by `f(<T)` as it was (incorrect
spans – this is tricky because the type relative path uses a base span
covering only `T`, not `<T>`) (third commit)
- The argument of `f(<_>::default())` is inferred correctly, but cannot
be replaced by `<_>` or `_`, as this cannot be used to infer an instance
of a singleton type (first commit).

The second commit offers better error messages by pointing at the whole
expression.

Fix #12654

changelog: [`default_constructed_unit_struct`]: do not suggest incorrect
fix when using a type surrounded by brackets
Diffstat (limited to 'tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs')
0 files changed, 0 insertions, 0 deletions