From: Pierre-Emmanuel Patry <[email protected]>

Top level module should collide with extern crate names and the error
should be reported on the module, not the extern crate because the latter
may not have a source location given it may have been injected.

gcc/testsuite/ChangeLog:

        * rust/minicore/top_core_modules.rs: New test.
        * rust/minicore/top_core_modules_core/lib.rs: New test.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
---
This change was merged into the gccrs repository and is posted here for
upstream visibility and potential drive-by review, as requested by GCC
release managers.
Each commit email contains a link to its details on github from where you can
find the Pull-Request and associated discussions.


Commit on github: 
https://github.com/Rust-GCC/gccrs/commit/b8e80ba0bb0e4902ad8e4b06fe56478750c89b83

The commit has NOT been mentioned in any issue.

The commit has been mentioned in the following pull-request(s):
 - https://github.com/Rust-GCC/gccrs/pull/4758

 gcc/testsuite/rust/minicore/top_core_modules.rs          | 4 ++++
 gcc/testsuite/rust/minicore/top_core_modules_core/lib.rs | 4 ++++
 2 files changed, 8 insertions(+)
 create mode 100644 gcc/testsuite/rust/minicore/top_core_modules.rs
 create mode 100644 gcc/testsuite/rust/minicore/top_core_modules_core/lib.rs

diff --git a/gcc/testsuite/rust/minicore/top_core_modules.rs 
b/gcc/testsuite/rust/minicore/top_core_modules.rs
new file mode 100644
index 000000000..380ef314b
--- /dev/null
+++ b/gcc/testsuite/rust/minicore/top_core_modules.rs
@@ -0,0 +1,4 @@
+#![feature(no_std)]
+#![no_std]
+
+mod core {} // { dg-error ".core. defined multiple times" }
diff --git a/gcc/testsuite/rust/minicore/top_core_modules_core/lib.rs 
b/gcc/testsuite/rust/minicore/top_core_modules_core/lib.rs
new file mode 100644
index 000000000..210881f59
--- /dev/null
+++ b/gcc/testsuite/rust/minicore/top_core_modules_core/lib.rs
@@ -0,0 +1,4 @@
+#![feature(no_core)]
+#![no_core]
+
+pub struct Titi;
-- 
2.55.0

Reply via email to