From 44acea4d880b646caa00a7237ea1a17031dd2116 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sun, 1 Apr 2018 21:48:39 +0300 Subject: AST/HIR: Merge field access expressions for named and numeric fields --- src/test/ui/error-codes/E0609.stderr | 4 ++-- src/test/ui/error-codes/E0611.rs | 22 ---------------------- src/test/ui/error-codes/E0611.stderr | 9 --------- src/test/ui/error-codes/E0612.rs | 16 ---------------- src/test/ui/error-codes/E0612.stderr | 9 --------- src/test/ui/error-codes/ex-E0611.rs | 22 ++++++++++++++++++++++ src/test/ui/error-codes/ex-E0611.stderr | 9 +++++++++ src/test/ui/error-codes/ex-E0612.rs | 16 ++++++++++++++++ src/test/ui/error-codes/ex-E0612.stderr | 9 +++++++++ 9 files changed, 58 insertions(+), 58 deletions(-) delete mode 100644 src/test/ui/error-codes/E0611.rs delete mode 100644 src/test/ui/error-codes/E0611.stderr delete mode 100644 src/test/ui/error-codes/E0612.rs delete mode 100644 src/test/ui/error-codes/E0612.stderr create mode 100644 src/test/ui/error-codes/ex-E0611.rs create mode 100644 src/test/ui/error-codes/ex-E0611.stderr create mode 100644 src/test/ui/error-codes/ex-E0612.rs create mode 100644 src/test/ui/error-codes/ex-E0612.stderr (limited to 'src/test/ui/error-codes') diff --git a/src/test/ui/error-codes/E0609.stderr b/src/test/ui/error-codes/E0609.stderr index 24581889ae9..dd793b29feb 100644 --- a/src/test/ui/error-codes/E0609.stderr +++ b/src/test/ui/error-codes/E0609.stderr @@ -7,10 +7,10 @@ LL | let _ = x.foo; //~ ERROR E0609 = note: available fields are: `x` error[E0609]: no field `1` on type `Bar` - --> $DIR/E0609.rs:21:5 + --> $DIR/E0609.rs:21:7 | LL | y.1; //~ ERROR E0609 - | ^^^ + | ^ unknown field error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0611.rs b/src/test/ui/error-codes/E0611.rs deleted file mode 100644 index 1e392d194b1..00000000000 --- a/src/test/ui/error-codes/E0611.rs +++ /dev/null @@ -1,22 +0,0 @@ -// 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -mod a { - pub struct Foo(u32); - - impl Foo { - pub fn new() -> Foo { Foo(0) } - } -} - -fn main() { - let y = a::Foo::new(); - y.0; //~ ERROR E0611 -} diff --git a/src/test/ui/error-codes/E0611.stderr b/src/test/ui/error-codes/E0611.stderr deleted file mode 100644 index c4b86e76c14..00000000000 --- a/src/test/ui/error-codes/E0611.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0611]: field `0` of tuple-struct `a::Foo` is private - --> $DIR/E0611.rs:21:4 - | -LL | y.0; //~ ERROR E0611 - | ^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0611`. diff --git a/src/test/ui/error-codes/E0612.rs b/src/test/ui/error-codes/E0612.rs deleted file mode 100644 index 429a8bb7eb7..00000000000 --- a/src/test/ui/error-codes/E0612.rs +++ /dev/null @@ -1,16 +0,0 @@ -// 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -struct Foo(u32); - -fn main() { - let y = Foo(0); - y.1; //~ ERROR E0612 -} diff --git a/src/test/ui/error-codes/E0612.stderr b/src/test/ui/error-codes/E0612.stderr deleted file mode 100644 index 18013697a83..00000000000 --- a/src/test/ui/error-codes/E0612.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0612]: attempted out-of-bounds tuple index `1` on type `Foo` - --> $DIR/E0612.rs:15:4 - | -LL | y.1; //~ ERROR E0612 - | ^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0612`. diff --git a/src/test/ui/error-codes/ex-E0611.rs b/src/test/ui/error-codes/ex-E0611.rs new file mode 100644 index 00000000000..4e580242e64 --- /dev/null +++ b/src/test/ui/error-codes/ex-E0611.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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +mod a { + pub struct Foo(u32); + + impl Foo { + pub fn new() -> Foo { Foo(0) } + } +} + +fn main() { + let y = a::Foo::new(); + y.0; //~ ERROR field `0` of struct `a::Foo` is private +} diff --git a/src/test/ui/error-codes/ex-E0611.stderr b/src/test/ui/error-codes/ex-E0611.stderr new file mode 100644 index 00000000000..2f5066542db --- /dev/null +++ b/src/test/ui/error-codes/ex-E0611.stderr @@ -0,0 +1,9 @@ +error[E0616]: field `0` of struct `a::Foo` is private + --> $DIR/ex-E0611.rs:21:4 + | +LL | y.0; //~ ERROR field `0` of struct `a::Foo` is private + | ^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0616`. diff --git a/src/test/ui/error-codes/ex-E0612.rs b/src/test/ui/error-codes/ex-E0612.rs new file mode 100644 index 00000000000..46e26c87e5f --- /dev/null +++ b/src/test/ui/error-codes/ex-E0612.rs @@ -0,0 +1,16 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct Foo(u32); + +fn main() { + let y = Foo(0); + y.1; //~ ERROR no field `1` on type `Foo` +} diff --git a/src/test/ui/error-codes/ex-E0612.stderr b/src/test/ui/error-codes/ex-E0612.stderr new file mode 100644 index 00000000000..a07efc939ab --- /dev/null +++ b/src/test/ui/error-codes/ex-E0612.stderr @@ -0,0 +1,9 @@ +error[E0609]: no field `1` on type `Foo` + --> $DIR/ex-E0612.rs:15:6 + | +LL | y.1; //~ ERROR no field `1` on type `Foo` + | ^ did you mean `0`? + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0609`. -- cgit 1.4.1-3-g733a5