forked from Rust-GCC/gccrs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
1 parent
e1064ca
commit db7d499
Showing
9 changed files
with
126 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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!(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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!(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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!(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// { dg-options "-frust-name-resolution-2.0" } | ||
|
||
pub mod foo { | ||
pub macro bar() {} | ||
} | ||
|
||
use foo::bar; | ||
|
||
fn main() { | ||
bar!(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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!(); | ||
} |