diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-04-30 19:37:35 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-04-30 19:37:35 +0100 |
commit | 745bd45ddb2f8b6165ab7eacfd482d8530cab05a (patch) | |
tree | 9e36b55112d3ea5f9d913d36597884b82aa87f68 /crates/ra_syntax/test_data/parser/err/0040_illegal_crate_kw_location.rs | |
parent | 861652ffa6b6440a022a353d2e6b9f5ca780d2ec (diff) | |
parent | 513a3615f6d462852c0135dc4ac30a2086e25c5a (diff) |
Merge #4227
4227: Report invalid, nested, multi-segment crate-paths r=matklad a=djrenren
There was a bug in the previous path-validating code that didn't detect multi-segment paths that started with `crate`.
```rust
// Successfully reported
use foo::{crate};
// BUG: was not being reported
use foo::{crate::bar};
```
This was due to my confusion about path-associativity. That is, the path with no qualifier is the innermost path, not the outermost. I've updated the code with a lot of comments to explain what's going on.
This bug was discovered when I found an erroneous `ok` test which I reported here:
https://github.com/rust-analyzer/rust-analyzer/issues/4226
This test now fails and has been modified, hopefully in the spirit of the original test, to be correct. Sorry about submitting the bug in the first place!
Co-authored-by: John Renner <[email protected]>
Diffstat (limited to 'crates/ra_syntax/test_data/parser/err/0040_illegal_crate_kw_location.rs')
-rw-r--r-- | crates/ra_syntax/test_data/parser/err/0040_illegal_crate_kw_location.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/ra_syntax/test_data/parser/err/0040_illegal_crate_kw_location.rs b/crates/ra_syntax/test_data/parser/err/0040_illegal_crate_kw_location.rs index bead4c0b6..508def2c7 100644 --- a/crates/ra_syntax/test_data/parser/err/0040_illegal_crate_kw_location.rs +++ b/crates/ra_syntax/test_data/parser/err/0040_illegal_crate_kw_location.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use ::crate; | 1 | use ::crate; |
2 | use {crate, foo::{crate}}; | 2 | use {crate, foo::{crate::foo::bar::baz}}; |
3 | use hello::crate; | 3 | use hello::crate; |
4 | use hello::crate::there; | 4 | use hello::crate::there; |