rust/tests
Matthias Krüger 69a8c139f1
Rollup merge of #124840 - bvanjoi:fix-124490, r=petrochenkov
resolve: mark it undetermined if single import is not has any bindings

- Fixes #124490
- Fixes #125013

This issue arises from incorrect resolution updates, for example:

```rust
mod a {
    pub mod b {
        pub mod c {}
    }
}

use a::*;

use b::c;
use c as b;

fn main() {}
```

1. In the first loop, binding `(root, b)` is refer to `root:🅰️:b` due to `use a::*`.
    1. However, binding `(root, c)` isn't defined by `use b::c` during this stage because `use c as b` falls under the `single_imports` of `(root, b)`, where the `imported_module` hasn't been computed yet. This results in marking the `path_res` for `b` as `Indeterminate`.
    2. Then, the `imported_module` for `use c as b` will be recorded.
2. In the second loop, `use b::c` will be processed again:
    1. Firstly, it attempts to find the `path_res` for `(root, b)`.
    2. It will iterate through the `single_imports` of `use b::c`, encounter `use c as b`, attempt to resolve `c` in `root`, and ultimately return `Err(Undetermined)`, thus passing the iterator.
    3. Use the binding `(root, b)` -> `root:🅰️:b` introduced by `use a::*` and ultimately return `root:🅰️:b` as the `path_res` of `b`.
    4. Then define the binding `(root, c)` -> `root:🅰️🅱️:c`.
3. Then process `use c as b`, update the resolution for `(root, b)` to refer to `root:🅰️🅱️:c`, ultimately causing inconsistency.

In my view, step `2.2` has an issue where it should exit early, similar to the behavior when there's no `imported_module`. Therefore, I've added an attribute called `indeterminate` to `ImportData`. This will help us handle only those single imports that have at least one determined binding.

r? ``@petrochenkov``
2024-06-05 18:21:11 +02:00
..
assembly Run rustfmt on tests/assembly/. 2024-05-30 16:15:46 +10:00
auxiliary
codegen Test codegen for repr(packed,simd) -> repr(simd) 2024-06-02 20:15:15 -07:00
codegen-units Run rustfmt on tests/codegen-units/. 2024-05-31 15:56:45 +10:00
coverage coverage: Instrument the RHS value of lazy logical operators 2024-05-30 15:38:46 +10:00
coverage-run-rustdoc
crashes Rollup merge of #124840 - bvanjoi:fix-124490, r=petrochenkov 2024-06-05 18:21:11 +02:00
debuginfo Increase vtable layout size 2024-06-01 07:42:05 -04:00
incremental Update tests/incremental/foreign.rs 2024-05-20 11:13:10 -04:00
mir-opt rustfmt tests/mir-opt. 2024-06-03 14:17:16 +10:00
pretty Create const block DefIds in typeck instead of ast lowering 2024-05-28 13:38:43 +00:00
run-make Rollup merge of #125683 - Oneirical:patience-testing-test, r=jieyouxu 2024-06-05 01:14:30 -07:00
run-make-fulldeps Remove tests/run-make-fulldeps/pretty-expanded 2024-06-05 00:51:09 +10:00
run-pass-valgrind rustfmt tests/run-pass-valgrind/. 2024-06-04 09:53:02 +10:00
rustdoc Update code format and tests 2024-06-04 13:49:39 +02:00
rustdoc-gui
rustdoc-js rustfmt tests/rustdoc-js/. 2024-06-04 14:15:06 +10:00
rustdoc-js-std
rustdoc-json rustfmt tests/rustdoc-json/. 2024-06-04 14:15:19 +10:00
rustdoc-ui Rollup merge of #125667 - oli-obk:taintify, r=TaKO8Ki 2024-06-04 08:52:12 -04:00
ui Rollup merge of #124840 - bvanjoi:fix-124490, r=petrochenkov 2024-06-05 18:21:11 +02:00
ui-fulldeps Make top-level rustc_parse functions fallible. 2024-06-05 10:38:03 +10:00
COMPILER_TESTS.md