diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2017-03-22 21:07:02 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2017-03-30 08:18:01 -0400 |
| commit | 8c6156e1d1f7e46c59fd21c878dccbc4526d7e0c (patch) | |
| tree | c4fd161eeacf7bf660a49d83e9d02f6ce95752f4 /src/rustllvm/PassWrapper.cpp | |
| parent | d08a6da1f05dc6f8de4201efe949f1c26704ced0 (diff) | |
| download | rust-8c6156e1d1f7e46c59fd21c878dccbc4526d7e0c.tar.gz rust-8c6156e1d1f7e46c59fd21c878dccbc4526d7e0c.zip | |
have coercion supply back the target type
The `try_coerce` method coerces from a source to a target type, possibly inserting adjustments. It should guarantee that the post-adjustment type is a subtype of the target type (or else that some side-constraint has been registered which will lead to an error). However, it used to return the (possibly adjusted) source as the type of the expression rather than the target. This led to less good downstream errors. To work around this, the code around blocks -- and particular tail expressions in blocks -- had some special case manipulation. However, since that code is now using the more general `CoerceMany` construct (to account for breaks), it can no longer take advantage of that. This lead to some regressions in compile-fail tests were errors were reported at "less good" locations than before. This change modifies coercions to return the target type when successful rather the source type. This extends the behavior from blocks to all coercions. Typically this has limited effect but on a few tests yielded better errors results (and avoided regressions, of course). This change also restores the hint about removing semicolons which went missing (by giving 'force-unit' coercions a chance to add notes etc).
Diffstat (limited to 'src/rustllvm/PassWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
