about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
diff options
context:
space:
mode:
authorAaron Hill <aa1ronham@gmail.com>2021-09-06 16:59:24 -0500
committerAaron Hill <aa1ronham@gmail.com>2021-09-16 12:36:19 -0500
commita41a13f775dfbc73b7c99e92619fd301ffcc4a53 (patch)
treec0ae453e59484fe40289ade4a2db9d5242cfb6db /compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
parent2b5ddf36fdc784106b3a064d93dd054c32b1f10f (diff)
downloadrust-a41a13f775dfbc73b7c99e92619fd301ffcc4a53.tar.gz
rust-a41a13f775dfbc73b7c99e92619fd301ffcc4a53.zip
Add `ConstraintCategory::Usage` for handling aggregate construction
In some cases, we emit borrowcheck diagnostics pointing
at a particular field expression in a struct expression
(e.g. `MyStruct { field: my_expr }`). However, this
behavior currently relies on us choosing the
`ConstraintCategory::Boring` with the 'correct' span.
When adding additional variants to `ConstraintCategory`,
(or changing existing usages away from `ConstraintCategory::Boring`),
the current behavior can easily get broken, since a non-boring
constraint will get chosen over a boring one.

To make the diagnostic output less fragile, this commit
adds a `ConstraintCategory::Usage` variant. We use this variant
for the temporary assignments created for each field of
an aggregate we are constructing.

Using this new variant, we can emit a message mentioning
"this usage", emphasizing the fact that the error message
is related to the specific use site (in the struct expression).

This is preparation for additional work on improving NLL error messages
(see #57374)
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp')
0 files changed, 0 insertions, 0 deletions