about summary refs log tree commit diff
path: root/tests/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-07-01 13:46:00 +0200
committerGitHub <noreply@github.com>2023-07-01 13:46:00 +0200
commitb63bc0645f13b360983c4cb38a1757fd5a5b058b (patch)
tree565f518a81347c2f69ba9d8c42fccb6c1b1773b1 /tests/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs
parente5bb341f0e1db4e4407f129d9834f9ada2030b7c (diff)
parent549f48d0ede94ab53056830cf9d5189c0445428e (diff)
downloadrust-b63bc0645f13b360983c4cb38a1757fd5a5b058b.tar.gz
rust-b63bc0645f13b360983c4cb38a1757fd5a5b058b.zip
Rollup merge of #113168 - bvanjoi:fix-85992, r=petrochenkov
fix(resolve): skip assertion judgment when NonModule is dummy

Fixes #85992

## Why #85992 panic

During `resolve_imports`, the `path_res` of the import `issue_85992_extern_2::Outcome` is pointing to `external::issue_85992_extern_2` instead of `crate::issue_85992_extern_2`. As a result `import.imported_module.set` had been executed.

Attached 1: the state of `early_resolve_ident_in_lexical_scope` during the `resolve_imports` for `use issue_85992_extern_2::Outcome` is as follows:

|iter in `visit_scopes`  | `scope` | `result.binding` |
| -    | -               | -                                                            |
| init | -               | -                                                            |
| 0    | `CrateRoot`     | Err(Determined)     |
| 1    | `ExternPrelude` | pointing to the `issue_85992_extern_2`(external) |

However, during finalization for `issue_85992_extern_2::Outcome`, the `innermost_result` was pointed to `crate::issue_85992_extern_2` and no ambiguity was generated, leading to a panic.

Attached 2: the state of `early_resolve_ident_in_lexical_scope` during the `finalize_import` for `use issue_85992_extern_2::Outcome` is as follows:

|iter in `visit_scopes`  | `scope` | `result.binding` | `innermost_result` |
| -    | -               | -                                                            | -                     |
| init | -               | -                                                            | `None`                |
| 0    | `CrateRoot`     | pointing to `use crate::issue_85992_extern_2` **(introdcued by dummy)**    | same as `result` but with a `Some` wapper|
| 1    | `ExternPrelude` | pointing to the `issue_85992_extern_2`(external) | smae as above |

## Try to solve

Skip assertion judgment when `NonModule` is dummy

r? `@petrochenkov`
Diffstat (limited to 'tests/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs')
0 files changed, 0 insertions, 0 deletions