Improve eval_order_dependence output

This commit is contained in:
Cameron Steffen 2021-05-05 14:44:32 -05:00
parent a8f28b6365
commit 2b38399920
2 changed files with 5 additions and 5 deletions

View File

@ -305,7 +305,7 @@ fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {
self.cx,
EVAL_ORDER_DEPENDENCE,
expr.span,
"unsequenced read of a variable",
&format!("unsequenced read of `{}`", self.cx.tcx.hir().name(self.var)),
Some(self.write_expr.span),
"whether read occurs before this write depends on evaluation order",
);

View File

@ -1,4 +1,4 @@
error: unsequenced read of a variable
error: unsequenced read of `x`
--> $DIR/eval_order_dependence.rs:15:9
|
LL | } + x;
@ -11,7 +11,7 @@ note: whether read occurs before this write depends on evaluation order
LL | x = 1;
| ^^^^^
error: unsequenced read of a variable
error: unsequenced read of `x`
--> $DIR/eval_order_dependence.rs:18:5
|
LL | x += {
@ -23,7 +23,7 @@ note: whether read occurs before this write depends on evaluation order
LL | x = 20;
| ^^^^^^
error: unsequenced read of a variable
error: unsequenced read of `x`
--> $DIR/eval_order_dependence.rs:31:12
|
LL | a: x,
@ -35,7 +35,7 @@ note: whether read occurs before this write depends on evaluation order
LL | x = 6;
| ^^^^^
error: unsequenced read of a variable
error: unsequenced read of `x`
--> $DIR/eval_order_dependence.rs:40:9
|
LL | x += {