diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-11-03 18:00:24 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-03 18:00:24 +0000 |
commit | 8e992e371bbd896c8b605e1ebade5cad80b1b411 (patch) | |
tree | 329a3e626fb05effe7383efb8df3bdf671f7e35c /gcc/rust/util/rust-mapping-common.h | |
parent | 674221a3b27f5455fddc793ec9aaf30a4d858ecb (diff) | |
parent | 1657ee53d578d68c7d807312b1063ffd804d7ef9 (diff) | |
download | gcc-8e992e371bbd896c8b605e1ebade5cad80b1b411.zip gcc-8e992e371bbd896c8b605e1ebade5cad80b1b411.tar.gz gcc-8e992e371bbd896c8b605e1ebade5cad80b1b411.tar.bz2 |
Merge #785
785: rust: track inline module scopes for module file resolution r=CohenArthur a=mathstuf
The set of inline modules is required to find the expected location of a
module file. Track this information with an RAII object
(`InlineModuleStackScope`) and pass it down to any out-of-line modules
so that, when requested, the set of inline modules can be added to the
search path.
Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
---
Note that this does not include a test case because I have no idea how to mark up this for all the warnings that come out (#676):
```diff
diff --git a/gcc/testsuite/rust/compile/missing_middle/sub/mod.rs b/gcc/testsuite/rust/compile/missing_middle/sub/mod.rs
new file mode 100644
index 00000000000..f099d61e04a
--- /dev/null
+++ b/gcc/testsuite/rust/compile/missing_middle/sub/mod.rs
`@@` -0,0 +1,3 `@@`
+pub fn f() -> u32 {
+ 1
+}
diff --git a/gcc/testsuite/rust/compile/mod_missing_middle.rs b/gcc/testsuite/rust/compile/mod_missing_middle.rs
new file mode 100644
index 00000000000..d9cdf0a54f1
--- /dev/null
+++ b/gcc/testsuite/rust/compile/mod_missing_middle.rs
`@@` -0,0 +1,11 `@@`
+pub mod missing_middle {
+ pub mod sub;
+}
```
Observed warnings:
```
/home/boeckb/code/depot/group-compilers/gcc/src-gccrs/gcc/testsuite/rust/compile/missing_middle/sub/mod.rs:1:5: warning: unused name 'f'
/home/boeckb/code/depot/group-compilers/gcc/src-gccrs/gcc/testsuite/rust/compile/mod_missing_middle.rs:2:9: warning: unused name 'sub'
/home/boeckb/code/depot/group-compilers/gcc/src-gccrs/gcc/testsuite/rust/compile/missing_middle/sub/mod.rs:1:5: warning: unused name 'sub::f'
/home/boeckb/code/depot/group-compilers/gcc/src-gccrs/gcc/testsuite/rust/compile/mod_missing_middle.rs:2:9: warning: unused name 'missing_middle::sub'
/home/boeckb/code/depot/group-compilers/gcc/src-gccrs/gcc/testsuite/rust/compile/mod_missing_middle.rs:1:5: warning: unused name 'missing_middle'
/home/boeckb/code/depot/group-compilers/gcc/src-gccrs/gcc/testsuite/rust/compile/missing_middle/sub/mod.rs:1:5: warning: unused name 'missing_middle::sub::f'
```
Fixes: #645
Here is a checklist to help you with your PR.
- \[x] GCC development requires copyright assignment or the Developer's Certificate of Origin sign-off, see https://gcc.gnu.org/contribute.html or https://gcc.gnu.org/dco.html
- \[x] Read contributing guidlines
- \[x] `make check-rust` passes locally
- \[x] Run `clang-format` (leaving to CI)
- \[x] Added any relevant test cases to `gcc/testsuite/rust/` (see above)
Co-authored-by: Ben Boeckel <mathstuf@gmail.com>
Diffstat (limited to 'gcc/rust/util/rust-mapping-common.h')
0 files changed, 0 insertions, 0 deletions