gcc/testsuite/ChangeLog:
* rust/compile/name_resolution13.rs: Add new module and remove compile
step.
* rust/compile/name_resolution14.rs: New test.
* rust/compile/name_resolution15.rs: New test.
* rust/compile/name_resolution16.rs: New test.
* rust/compile/name_resolution17.rs: New test.
* rust/compile/name_resolution18.rs: New test.
* rust/compile/name_resolution19.rs: New test.
* rust/compile/name_resolution20.rs: New test.
* rust/compile/name_resolution21.rs: New test.
---
.../rust/compile/name_resolution13.rs | 6 +++++-
.../rust/compile/name_resolution14.rs | 15 ++++++++++++++
.../rust/compile/name_resolution15.rs | 20 +++++++++++++++++++
.../rust/compile/name_resolution16.rs | 18 +++++++++++++++++
.../rust/compile/name_resolution17.rs | 10 ++++++++++
.../rust/compile/name_resolution18.rs | 15 ++++++++++++++
.../rust/compile/name_resolution19.rs | 20 +++++++++++++++++++
.../rust/compile/name_resolution20.rs | 11 ++++++++++
.../rust/compile/name_resolution21.rs | 12 +++++++++++
9 files changed, 126 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/rust/compile/name_resolution14.rs
create mode 100644 gcc/testsuite/rust/compile/name_resolution15.rs
create mode 100644 gcc/testsuite/rust/compile/name_resolution16.rs
create mode 100644 gcc/testsuite/rust/compile/name_resolution17.rs
create mode 100644 gcc/testsuite/rust/compile/name_resolution18.rs
create mode 100644 gcc/testsuite/rust/compile/name_resolution19.rs
create mode 100644 gcc/testsuite/rust/compile/name_resolution20.rs
create mode 100644 gcc/testsuite/rust/compile/name_resolution21.rs
@@ -1,4 +1,8 @@
-// { dg-additional-options "-frust-name-resolution-2.0 -frust-compile-until=lowering" }
+// { dg-options "-frust-name-resolution-2.0" }
+
+pub mod foo {
+ pub macro bar() {}
+}
fn foo() {
let b = 10;
new file mode 100644
@@ -0,0 +1,15 @@
+// { dg-options "-frust-name-resolution-2.0" }
+
+pub mod foo {
+ pub macro bar() {}
+}
+
+use foo::biz; // { dg-error "unresolved import .foo::biz. .E0433." }
+
+use foo::{bar, baz, biz};
+// { dg-error "unresolved import .foo::baz. .E0433." "" { target *-*-* } .-1 }
+// { dg-error "unresolved import .foo::biz. .E0433." "" { target *-*-* } .-2 }
+
+fn main() {
+ bar!();
+}
new file mode 100644
@@ -0,0 +1,20 @@
+// { dg-additional-options "-frust-name-resolution-2.0" }
+#![feature(decl_macro)]
+
+pub mod foo {
+ pub struct Foo {
+ pub a: i32,
+ }
+ pub fn Foo() {}
+ pub macro Foo() {{}}
+}
+
+pub use foo::Foo;
+
+use self::Foo as Fo;
+
+fn main() {
+ let _a = Fo();
+ let _b = Fo { a: 15 };
+ let _c = Fo!();
+}
new file mode 100644
@@ -0,0 +1,18 @@
+// { dg-additional-options "-frust-name-resolution-2.0" }
+#![feature(decl_macro)]
+
+pub mod foo {
+ pub struct Foo {
+ pub a: i32,
+ }
+ pub fn Foo() {}
+ pub macro Foo() {{}}
+}
+
+pub use foo::Foo;
+
+fn main() {
+ let _a = Foo();
+ let _b = Foo { a: 15 };
+ let _c = Foo!();
+}
new file mode 100644
@@ -0,0 +1,10 @@
+// { dg-options "-frust-name-resolution-2.0" }
+
+struct Foo;
+fn Foo() {} // { dg-error ".Foo. defined multiple times" }
+
+struct Marker;
+struct Bar {
+ a: Marker,
+}
+fn Bar() {} // ok, since `Bar` is not a value here
new file mode 100644
@@ -0,0 +1,15 @@
+// { dg-options "-frust-name-resolution-2.0" }
+
+struct Marker;
+
+struct Foo {
+ a: Marker,
+}
+
+pub mod foo {
+ struct Foo {
+ b: Marker,
+ }
+}
+
+use foo::Foo; // { dg-error ".Foo. defined multiple times" }
new file mode 100644
@@ -0,0 +1,20 @@
+struct Marker;
+
+fn foo(a: Marker, b: Marker) -> Marker {
+ let a = b;
+
+ a
+}
+
+fn bar() {
+ let a = 15;
+
+ fn inner() {
+ // inner functions cannot capture dynamic environment
+ let b = a; // { dg-error "cannot find value .a. in this scope" }
+ }
+}
+
+fn main() {
+ let m = foo(Marker, Marker);
+}
new file mode 100644
@@ -0,0 +1,11 @@
+// { dg-options "-frust-name-resolution-2.0" }
+
+pub mod foo {
+ pub macro bar() {}
+}
+
+use foo::bar;
+
+fn main() {
+ bar!();
+}
new file mode 100644
@@ -0,0 +1,12 @@
+// { dg-additional-options "-frust-name-resolution-2.0" }
+
+pub mod foo {
+ pub macro bar() {}
+}
+
+use foo::bar;
+use foo::bar; // { dg-error ".bar. defined multiple times" }
+
+fn main() {
+ bar!();
+}