diff options
| author | Corey Farwell <coreyf@rwell.org> | 2017-02-09 08:47:34 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-02-09 08:47:34 -0500 |
| commit | e32e2d47d05848a20814adee44e1a47bf5b184fc (patch) | |
| tree | 54fbc909797ad92119f3cc100d1e9c15521b1393 /src/test | |
| parent | f447c2b44369d2d05366944029f96d4aa9f203c6 (diff) | |
| parent | df73bc9c9d550c2517edc3cf49164d9e93c5b152 (diff) | |
| download | rust-e32e2d47d05848a20814adee44e1a47bf5b184fc.tar.gz rust-e32e2d47d05848a20814adee44e1a47bf5b184fc.zip | |
Rollup merge of #39602 - estebank:fix-39544, r=eddyb
Fix ICE when accessing mutably an immutable enum Fix #39544.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/did_you_mean/issue-39544.rs | 22 | ||||
| -rw-r--r-- | src/test/ui/did_you_mean/issue-39544.stderr | 8 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/test/ui/did_you_mean/issue-39544.rs b/src/test/ui/did_you_mean/issue-39544.rs new file mode 100644 index 00000000000..bcdafefa247 --- /dev/null +++ b/src/test/ui/did_you_mean/issue-39544.rs @@ -0,0 +1,22 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +enum X { + Y +} + +struct Z { + x: X +} + +fn main() { + let z = Z { x: X::Y }; + let _ = &mut z.x; +} diff --git a/src/test/ui/did_you_mean/issue-39544.stderr b/src/test/ui/did_you_mean/issue-39544.stderr new file mode 100644 index 00000000000..c0088f39ad3 --- /dev/null +++ b/src/test/ui/did_you_mean/issue-39544.stderr @@ -0,0 +1,8 @@ +error: cannot borrow immutable field `z.x` as mutable + --> $DIR/issue-39544.rs:21:18 + | +21 | let _ = &mut z.x; + | ^^^ + +error: aborting due to previous error + |
