rust/compiler/rustc_middle/src
Aaron Hill a41a13f775
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)
2021-09-16 12:36:19 -05:00
..
dep_graph Update DepNode's size 2021-07-10 21:46:31 +08:00
hir Rollup merge of #88677 - petrochenkov:exportid, r=davidtwco 2021-09-12 03:44:53 -07:00
ich Auto merge of #84373 - cjgillot:resolve-span, r=michaelwoerister,petrochenkov 2021-09-11 23:35:28 +00:00
infer
middle Fix drop handling for if let expressions 2021-09-01 23:47:41 +01:00
mir Add ConstraintCategory::Usage for handling aggregate construction 2021-09-16 12:36:19 -05:00
query Auto merge of #88558 - fee1-dead:const-drop, r=oli-obk 2021-09-15 03:51:03 +00:00
thir add a CastKind to Node::Cast 2021-09-09 01:32:03 +01:00
traits Auto merge of #88558 - fee1-dead:const-drop, r=oli-obk 2021-09-15 03:51:03 +00:00
ty Auto merge of #88558 - fee1-dead:const-drop, r=oli-obk 2021-09-15 03:51:03 +00:00
util
arena.rs Remove unused arena macro args 2021-08-30 13:09:38 +02:00
lib.rs Bump stage0 compiler to 1.56 2021-09-08 20:51:05 -04:00
lint.rs Fix #88256, remove duplicated diagnostic 2021-09-04 19:26:25 +08:00
macros.rs
tests.rs
thir.rs rename mir -> thir around abstract consts 2021-09-09 01:32:03 +01:00