about summary refs log tree commit diff
path: root/tests/rustdoc-js-std/parser-errors.js
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-06-14 06:25:48 +0200
committerGitHub <noreply@github.com>2023-06-14 06:25:48 +0200
commit98f6e9644bc008df72eeacbd6d8ba34fcda6422b (patch)
tree896681cef5ebf0ce2a853eb6a10cdbb1ee1fb590 /tests/rustdoc-js-std/parser-errors.js
parent6fc50dacd4a7949898d77cf14b7047bf17b76921 (diff)
parentf7330eb752cdd83a9b944d1d64a092c7d2454c17 (diff)
downloadrust-98f6e9644bc008df72eeacbd6d8ba34fcda6422b.tar.gz
rust-98f6e9644bc008df72eeacbd6d8ba34fcda6422b.zip
Rollup merge of #112495 - bvanjoi:fix-109153, r=petrochenkov
fix(resolve): update shadowed_glob more precision

- Fixes #109153
- Fixes #109962

## Why does it panic?

We use #109153 as an illustration.

The process of `resolve_imports` is:

| Iter | resolve     | resolution of **`(Mod(root), Ident(bar) in type ns)`** |
| -    | -           | -      |
| 0 | `use foo::*`   | `binding` -> foo::bar, `shallowed_glob` -> `None` |
| 1 | `use bar::bar` | `binding` -> foo::bar::bar, `shallowed_glob` -> foo::bar    |
| 2 | `use bar::*`   | `binding` -> foo::bar::bar, `shallowed_glob` -> foo::bar::bar::bar |

So during `finalize_import`, the `root::bar` in `use bar::bar` had been pointed to `foo::bar::bar::bar`, which is different from the `initial_module` valued of `foo::bar`, therefore, the panic had been triggered.

## Try to solve it

~I think #109153 should check-pass rather than throw an ambiguous error. Following this idea, there are two ways to solve this problem:~

~1. Give up the `initial_module` and update `import.imported_module` after each resolution update. However, I think this method may have too much impact.~
~2. Do not update the `shadowed_glob` when it is defined.~

~To be honest, I am not sure if this is the right way to solve this ICE. Perhaps there is a better resolution.~

Edit: we had made the `resolution.shadowed_glob` update more detailed.

r? `@petrochenkov`
Diffstat (limited to 'tests/rustdoc-js-std/parser-errors.js')
0 files changed, 0 insertions, 0 deletions