diff options
| author | Matthew Jasper <mjjasper1@gmail.com> | 2019-04-20 18:06:03 +0100 |
|---|---|---|
| committer | Matthew Jasper <mjjasper1@gmail.com> | 2019-12-18 20:09:10 +0000 |
| commit | 35919ace7084e10fce15cb9bb42a9404b63b849d (patch) | |
| tree | 5f47e21ee65f14b8a542b554a7f6b3787f3f5c74 /src/test/ui | |
| parent | 3a19fbf95d3b289f4c17aba910051cd9afd75887 (diff) | |
| download | rust-35919ace7084e10fce15cb9bb42a9404b63b849d.tar.gz rust-35919ace7084e10fce15cb9bb42a9404b63b849d.zip | |
Start generating AddressOf rvalues in MIR
`hir::BorrowKind::Raw` borrows and casting a reference to a raw pointer no longer do a reborrow followed by a cast. Instead we dereference and take the address.
Diffstat (limited to 'src/test/ui')
| -rw-r--r-- | src/test/ui/cast/cast-as-bool.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/cast/cast-as-bool.stderr | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/test/ui/cast/cast-as-bool.rs b/src/test/ui/cast/cast-as-bool.rs index 8130f4dedc9..1aed218aeb4 100644 --- a/src/test/ui/cast/cast-as-bool.rs +++ b/src/test/ui/cast/cast-as-bool.rs @@ -5,5 +5,5 @@ fn main() { let t = (1 + 2) as bool; //~ ERROR cannot cast as `bool` //~| HELP compare with zero instead //~| SUGGESTION (1 + 2) != 0 - let v = "hello" as bool; //~ ERROR cannot cast as `bool` + let v = "hello" as bool; //~ ERROR casting `&'static str` as `bool` is invalid } diff --git a/src/test/ui/cast/cast-as-bool.stderr b/src/test/ui/cast/cast-as-bool.stderr index 30f8459c2e1..15d94ab69d8 100644 --- a/src/test/ui/cast/cast-as-bool.stderr +++ b/src/test/ui/cast/cast-as-bool.stderr @@ -10,12 +10,13 @@ error[E0054]: cannot cast as `bool` LL | let t = (1 + 2) as bool; | ^^^^^^^^^^^^^^^ help: compare with zero instead: `(1 + 2) != 0` -error[E0054]: cannot cast as `bool` +error[E0606]: casting `&'static str` as `bool` is invalid --> $DIR/cast-as-bool.rs:8:13 | LL | let v = "hello" as bool; - | ^^^^^^^^^^^^^^^ unsupported cast + | ^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0054`. +Some errors have detailed explanations: E0054, E0606. +For more information about an error, try `rustc --explain E0054`. |
