diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2017-05-27 16:31:43 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2017-05-27 16:31:43 +0200 |
| commit | 8be89f534aae247d5e3008fa3ac782fca9b8609f (patch) | |
| tree | 83a6a524bdd930c5a57cb38302845990e5763638 /src/test | |
| parent | 3e7908f616745573a11ad7dfad245f12be0069da (diff) | |
| download | rust-8be89f534aae247d5e3008fa3ac782fca9b8609f.tar.gz rust-8be89f534aae247d5e3008fa3ac782fca9b8609f.zip | |
Add new error codes
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/compile-fail/E0596.rs | 14 | ||||
| -rw-r--r-- | src/test/compile-fail/E0597.rs | 19 |
2 files changed, 33 insertions, 0 deletions
diff --git a/src/test/compile-fail/E0596.rs b/src/test/compile-fail/E0596.rs new file mode 100644 index 00000000000..1f1af69d977 --- /dev/null +++ b/src/test/compile-fail/E0596.rs @@ -0,0 +1,14 @@ +// 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. + +fn main() { + let x = 1; + let y = &mut x; //~ ERROR E0596 +} diff --git a/src/test/compile-fail/E0597.rs b/src/test/compile-fail/E0597.rs new file mode 100644 index 00000000000..00ef14a8e2a --- /dev/null +++ b/src/test/compile-fail/E0597.rs @@ -0,0 +1,19 @@ +// 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. + +struct Foo<'a> { + x: Option<&'a u32>, +} + +fn main() { + let mut x = Foo { x: None }; + let y = 0; + x.x = Some(&y); +} //~ `y` does not live long enough [E0597] |
