Commit graph

12 commits

Author SHA1 Message Date
Albert Larsan
cf2dff2b1e
Move /src/test to /tests 2023-01-11 09:32:08 +00:00
Jakob Degen
9fb8da8f8f Remove unneeded field from SwitchTargets 2022-12-09 04:53:10 -08:00
b-naber
6118ee343f address review 2022-09-26 14:21:39 +02:00
Jakob Degen
7a1bfc0ba7 Add more // unit-tests to MIR opt tests 2022-08-09 17:32:50 -07:00
Nilstrieb
11c0280798 bless mir opt tests 2022-07-28 14:24:44 +02:00
Ralf Jung
4e7aaf1f44 tweak names and output and bless 2022-07-09 07:43:56 -04:00
Camille GILLOT
e77e4fcf89 Only create a single expansion for each inline integration. 2022-02-27 19:05:56 +01:00
lcnr
ee0b56483f change mir::Constant in mir dumps 2022-02-22 09:38:07 +01:00
Aaron Hill
4d66986e09
Use larger span for adjustments on method calls
Currently, we use a relatively 'small' span for THIR
expressions generated by an 'adjustment' (e.g. an autoderef,
autoborrow, unsizing). As a result, if a borrow generated
by an adustment ends up causing a borrowcheck error, for example:

```rust
let mut my_var = String::new();
let my_ref = &my_var
my_var.push('a');
my_ref;
```

then the span for the mutable borrow may end up referring
to only the base expression (e.g. `my_var`), rather than
the method call which triggered the mutable borrow
(e.g. `my_var.push('a')`)

Due to a quirk of the MIR borrowck implementation,
this doesn't always get exposed in migration mode,
but it does in many cases.

This commit makes THIR building consistently use 'larger'
spans for adjustment expressions

The intent of this change it make it clearer to users
when it's the specific way in which a variable is
used (for example, in a method call) that produdes
a borrowcheck error. For example, an error message
claiming that a 'mutable borrow occurs here' might
be confusing if it just points at a usage of a variable
(e.g. `my_var`), when no `&mut` is in sight. Pointing
at the entire expression should help to emphasize
that the method call itself is responsible for
the mutable borrow.

In several cases, this makes the `#![feature(nll)]` diagnostic
output match up exactly with the default (migration mode) output.
As a result, several `.nll.stderr` files end up getting removed
entirely.
2021-09-25 10:00:41 -05:00
Wesley Wiser
0a42dfc2fa Fix debugger stepping behavior around match expressions
Previously, we would set up the source lines for `match` expressions so
that the code generated to perform the test of the scrutinee was matched
to the line of the arm that required the test and then jump from the arm
block to the "next" block was matched to all of the lines in the `match`
expression.

While that makes sense, it has the side effect of causing strange
stepping behavior in debuggers.

I've changed the source information so that all of the generated tests
are sourced to `match {scrutinee}` and the jumps are sourced to the last
line of the block they are inside. This resolves the weird stepping
behavior in all debuggers and resolves some instances of "ambiguous
symbol" errors in WinDbg preventing the user from setting breakpoints at
`match` expressions.
2021-08-25 15:17:22 -04:00
Tomasz Miąsko
6f49aadabb Disable destination propagation on all mir-opt-levels 2021-03-06 00:00:00 +00:00
Simon Vandel Sillesen
2d1e0adfe9 New pass to deduplicate blocks 2021-02-21 21:51:54 +01:00