rust/tests
Yacin Tmimi 12048e444f fallback to dir_path when relative external mod resolution fails
We only want to fall back if two conditions are met:

1) Initial module resolution is performed relative to some nested
   directory.
2) Module resolution fails because of a ModError::FileNotFound error.

When these conditions are met we can try to fallback to searching for
the module's file relative to the dir_path instead of the nested
relative directory.

Fixes 5198

As demonstrated by 5198, it's possible that a directory name conflicts
with a rust file name. For example, src/lib/ and src/lib.rs.

If src/lib.rs references an external module like ``mod foo;``, then
module resolution will try to resolve ``foo`` to src/lib/foo.rs or
src/lib/foo/mod.rs. Module resolution would fail with a file not
found error if the ``foo`` module were defined at src/foo.rs.

When encountering these kinds of module resolution issues we now fall
back to the current directory and attempt to resolve the module again.

Given the current example, this means that if we can't find the module
``foo`` at src/lib/foo.rs or src/lib/foo/mod.rs, we'll attempt
to resolve the module to src/foo.rs.
2022-02-28 23:13:11 -06:00
..
cargo-fmt Format code 2022-02-15 19:44:53 -06:00
config
coverage
license-template
mod-resolver fallback to dir_path when relative external mod resolution fails 2022-02-28 23:13:11 -06:00
parser
rustfmt fix: formatting in new test 2022-02-15 21:24:39 -06:00
source Leverage itemized blocks to support formatting markdown block quotes 2022-02-11 17:31:06 -06:00
target Leverage itemized blocks to support formatting markdown block quotes 2022-02-11 17:31:06 -06:00
writemode Use <stdin> when emitting stdin as filename (#4298) 2022-01-02 10:06:06 -06:00