diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2018-01-25 15:52:15 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-01-25 15:52:15 +0100 |
| commit | a809da3feea30c2897f0e4fe6c90c34b09aa9641 (patch) | |
| tree | e8a2a4a4c03af7a7128515543e793240fb9130e6 /src/rustllvm/RustWrapper.cpp | |
| parent | 3a863a3f456bf64658256d05cf51df61e957d74b (diff) | |
| parent | 65b1e86aed22bfcd3a4ce27da9be2b14c7d5738e (diff) | |
| download | rust-a809da3feea30c2897f0e4fe6c90c34b09aa9641.tar.gz rust-a809da3feea30c2897f0e4fe6c90c34b09aa9641.zip | |
Rollup merge of #47702 - etaoins:fix-into-cast-paren-precedence, r=petrochenkov
Fix into() cast paren check precedence As discussed in #47699 the logic for determining if an expression needs parenthesis when suggesting an `.into()` cast is incorrect. Two broken examples from nightly are: ``` error[E0308]: mismatched types --> main.rs:4:10 | 4 | test(foo as i8); | ^^^^^^^^^ expected i32, found i8 help: you can cast an `i8` to `i32`, which will sign-extend the source value | 4 | test(foo as i8.into()); | ``` ``` error[E0308]: mismatched types --> main.rs:4:10 | 4 | test(*foo); | ^^^^ expected i32, found i8 help: you can cast an `i8` to `i32`, which will sign-extend the source value | 4 | test(*foo.into()); | ``` As suggested by @petrochenkov switch the precedence check to `PREC_POSTFIX`. This catches both `as` and unary operators. Fixes #47699. r? @petrochenkov
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
