rust/compiler/rustc_middle/src/mir
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
..
interpret interpreter PointerArithmetic: use new Size helper methods 2021-09-11 12:21:10 -04:00
coverage.rs Translate counters from Rust 1-based to LLVM 0-based counter ids 2021-04-02 17:16:36 -07:00
generic_graph.rs Move the dataflow framework to its own crate. 2021-09-07 19:57:07 +02:00
generic_graphviz.rs Move the dataflow framework to its own crate. 2021-09-07 19:57:07 +02:00
graph_cyclic_cache.rs Cache result of 2020-12-20 10:29:26 +01:00
graphviz.rs Move the dataflow framework to its own crate. 2021-09-07 19:57:07 +02:00
mod.rs Add ConstraintCategory::Usage for handling aggregate construction 2021-09-16 12:36:19 -05:00
mono.rs Truncate hex stable crate id to 8 characters (32 bits) 2021-07-06 11:36:23 +02:00
patch.rs Move the dataflow framework to its own crate. 2021-09-07 19:57:07 +02:00
predecessors.rs words 2020-11-16 22:42:09 +01:00
pretty.rs Move the dataflow framework to its own crate. 2021-09-07 19:57:07 +02:00
query.rs Add ConstraintCategory::Usage for handling aggregate construction 2021-09-16 12:36:19 -05:00
spanview.rs Move the dataflow framework to its own crate. 2021-09-07 19:57:07 +02:00
tcx.rs Introduce NullOp::AlignOf 2021-09-13 00:08:35 +01:00
terminator.rs rustc: Fill out remaining parts of C-unwind ABI 2021-08-03 07:06:19 -07:00
traversal.rs Remove (lots of) dead code 2021-03-27 22:16:33 -04:00
type_foldable.rs Remove box syntax from rustc_middle 2021-08-18 09:25:26 +02:00
visit.rs Various pattern cleanups 2021-08-25 20:24:39 +02:00