resolve: Make disambiguators for underscore bindings module-local#144013
Merged
bors merged 1 commit intorust-lang:masterfrom Jul 18, 2025
Merged
resolve: Make disambiguators for underscore bindings module-local#144013bors merged 1 commit intorust-lang:masterfrom
bors merged 1 commit intorust-lang:masterfrom
Conversation
Collaborator
petrochenkov
commented
Jul 16, 2025
| // FIXME: Adjust hygiene for idents from globs, like for glob imports. | ||
| if let Some(overriding_keys) = this.impl_binding_keys.get(&impl_def_id) | ||
| && overriding_keys.contains(&BindingKey::new(ident.normalize_to_macros_2_0(), ns)) | ||
| && overriding_keys.contains(&BindingKey::new(ident, ns)) |
Contributor
Author
There was a problem hiding this comment.
Drive-by cleanup, the normalization already happens inside BindingKey::new.
oli-obk
approved these changes
Jul 16, 2025
Contributor
oli-obk
left a comment
There was a problem hiding this comment.
r=me with nit and comment
6a70a41 to
998df3a
Compare
Contributor
Author
|
Didn't rename any |
Collaborator
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Jul 18, 2025
resolve: Make disambiguators for underscore bindings module-local Disambiguators attached to underscore name bindings (like `const _: u8 = something;`) do not need to be globally unique, they just need to be unique inside the module in which they live, because the bindings in a module are basically kept as `Map<BindingKey, SomeData>`. Also, the specific values of the disambiguators are not important, so a glob import of `const _` may have a different disambiguator than the original `const _` itself. So in this PR the disambiguator is just set to the current number of bindings in the module. This removes one more piece of global mutable state from resolver and unblocks rust-lang#143884.
bors
added a commit
that referenced
this pull request
Jul 18, 2025
Rollup of 12 pull requests Successful merges: - #143280 (Remove duplicate error about raw underscore lifetime) - #143649 (Add test for `default_field_values` and `const_default`) - #143699 (Make `AsyncDrop` check that it's being implemented on a local ADT) - #143704 (Be a bit more careful around exotic cycles in in the inliner) - #143908 (`tests/ui`: A New Order [0/28] ) - #143909 (docs(alloc::fmt): Make type optional, instead of matching empty string) - #143925 (Make slice comparisons const) - #143997 (Use $crate in macros for rustc_public (aka stable_mir)) - #144013 (resolve: Make disambiguators for underscore bindings module-local) - #144029 (Fix wrong messages from methods with the same name from different traits) - #144063 (Add myself to the `infra-ci` reviewer group and adjust some infra auto-labels) - #144069 (ci: use windows 22 for all free runners) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
that referenced
this pull request
Jul 18, 2025
Rollup of 11 pull requests Successful merges: - #143280 (Remove duplicate error about raw underscore lifetime) - #143649 (Add test for `default_field_values` and `const_default`) - #143699 (Make `AsyncDrop` check that it's being implemented on a local ADT) - #143908 (`tests/ui`: A New Order [0/28] ) - #143909 (docs(alloc::fmt): Make type optional, instead of matching empty string) - #143925 (Make slice comparisons const) - #143997 (Use $crate in macros for rustc_public (aka stable_mir)) - #144013 (resolve: Make disambiguators for underscore bindings module-local) - #144029 (Fix wrong messages from methods with the same name from different traits) - #144063 (Add myself to the `infra-ci` reviewer group and adjust some infra auto-labels) - #144069 (ci: use windows 22 for all free runners) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
that referenced
this pull request
Jul 18, 2025
Rollup merge of #144013 - petrochenkov:disambunder, r=oli-obk resolve: Make disambiguators for underscore bindings module-local Disambiguators attached to underscore name bindings (like `const _: u8 = something;`) do not need to be globally unique, they just need to be unique inside the module in which they live, because the bindings in a module are basically kept as `Map<BindingKey, SomeData>`. Also, the specific values of the disambiguators are not important, so a glob import of `const _` may have a different disambiguator than the original `const _` itself. So in this PR the disambiguator is just set to the current number of bindings in the module. This removes one more piece of global mutable state from resolver and unblocks #143884.
This was referenced Jul 19, 2025
github-actions bot
pushed a commit
to rust-lang/miri
that referenced
this pull request
Jul 20, 2025
Prepare revert of 144013 This is a possible revert for rust-lang/rust#144013 causing issue rust-lang/rust#144168 (imo p-crit) to give us time to figure out a correct fix for rust-lang/rust#144013 without pressure. Feel free to close if it's an easy fix instead: r? `@petrochenkov`
Contributor
Author
|
Second attempt - #144272. |
Muscraft
pushed a commit
to Muscraft/rust
that referenced
this pull request
Jul 21, 2025
resolve: Make disambiguators for underscore bindings module-local Disambiguators attached to underscore name bindings (like `const _: u8 = something;`) do not need to be globally unique, they just need to be unique inside the module in which they live, because the bindings in a module are basically kept as `Map<BindingKey, SomeData>`. Also, the specific values of the disambiguators are not important, so a glob import of `const _` may have a different disambiguator than the original `const _` itself. So in this PR the disambiguator is just set to the current number of bindings in the module. This removes one more piece of global mutable state from resolver and unblocks rust-lang#143884.
Muscraft
pushed a commit
to Muscraft/rust
that referenced
this pull request
Jul 21, 2025
Prepare revert of 144013 This is a possible revert for rust-lang#144013 causing issue rust-lang#144168 (imo p-crit) to give us time to figure out a correct fix for rust-lang#144013 without pressure. Feel free to close if it's an easy fix instead: r? `@petrochenkov`
Muscraft
pushed a commit
to Muscraft/rust
that referenced
this pull request
Jul 21, 2025
…iaskrgr Rollup of 11 pull requests Successful merges: - rust-lang#143280 (Remove duplicate error about raw underscore lifetime) - rust-lang#143649 (Add test for `default_field_values` and `const_default`) - rust-lang#143699 (Make `AsyncDrop` check that it's being implemented on a local ADT) - rust-lang#143908 (`tests/ui`: A New Order [0/28] ) - rust-lang#143909 (docs(alloc::fmt): Make type optional, instead of matching empty string) - rust-lang#143925 (Make slice comparisons const) - rust-lang#143997 (Use $crate in macros for rustc_public (aka stable_mir)) - rust-lang#144013 (resolve: Make disambiguators for underscore bindings module-local) - rust-lang#144029 (Fix wrong messages from methods with the same name from different traits) - rust-lang#144063 (Add myself to the `infra-ci` reviewer group and adjust some infra auto-labels) - rust-lang#144069 (ci: use windows 22 for all free runners) r? `@ghost` `@rustbot` modify labels: rollup
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Jul 22, 2025
resolve: Make disambiguators for underscore bindings module-local (take 2) The difference with rust-lang#144013 can be seen in the second commit. Now we just keep a separate disambiguator counter in every `Module`, instead of a global counter in `Resolver`. This will be ok for parallel import resolution because we'll need to lock the module anyway when updating `resolutions` and other fields in it. And for external modules the disabmiguator could be just passed as an argument to `define_extern`, without using any cells or locks, once rust-lang#143884 lands. Unblocks rust-lang#143884.
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Jul 23, 2025
resolve: Make disambiguators for underscore bindings module-local (take 2) The difference with rust-lang#144013 can be seen in the second commit. Now we just keep a separate disambiguator counter in every `Module`, instead of a global counter in `Resolver`. This will be ok for parallel import resolution because we'll need to lock the module anyway when updating `resolutions` and other fields in it. And for external modules the disabmiguator could be just passed as an argument to `define_extern`, without using any cells or locks, once rust-lang#143884 lands. Unblocks rust-lang#143884.
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Jul 23, 2025
resolve: Make disambiguators for underscore bindings module-local (take 2) The difference with rust-lang#144013 can be seen in the second commit. Now we just keep a separate disambiguator counter in every `Module`, instead of a global counter in `Resolver`. This will be ok for parallel import resolution because we'll need to lock the module anyway when updating `resolutions` and other fields in it. And for external modules the disabmiguator could be just passed as an argument to `define_extern`, without using any cells or locks, once rust-lang#143884 lands. Unblocks rust-lang#143884.
bors
added a commit
that referenced
this pull request
Jul 24, 2025
resolve: Make disambiguators for underscore bindings module-local (take 2) The difference with #144013 can be seen in the second commit. Now we just keep a separate disambiguator counter in every `Module`, instead of a global counter in `Resolver`. This will be ok for parallel import resolution because we'll need to lock the module anyway when updating `resolutions` and other fields in it. And for external modules the disabmiguator could be just passed as an argument to `define_extern`, without using any cells or locks, once #143884 lands. Unblocks #143884.
github-actions bot
pushed a commit
to rust-lang/miri
that referenced
this pull request
Jul 25, 2025
resolve: Make disambiguators for underscore bindings module-local (take 2) The difference with rust-lang/rust#144013 can be seen in the second commit. Now we just keep a separate disambiguator counter in every `Module`, instead of a global counter in `Resolver`. This will be ok for parallel import resolution because we'll need to lock the module anyway when updating `resolutions` and other fields in it. And for external modules the disabmiguator could be just passed as an argument to `define_extern`, without using any cells or locks, once rust-lang/rust#143884 lands. Unblocks rust-lang/rust#143884.
rust-cloud-vms bot
pushed a commit
to makai410/rustc_public
that referenced
this pull request
Aug 16, 2025
Rollup of 11 pull requests Successful merges: - rust-lang/rust#143280 (Remove duplicate error about raw underscore lifetime) - rust-lang/rust#143649 (Add test for `default_field_values` and `const_default`) - rust-lang/rust#143699 (Make `AsyncDrop` check that it's being implemented on a local ADT) - rust-lang/rust#143908 (`tests/ui`: A New Order [0/28] ) - rust-lang/rust#143909 (docs(alloc::fmt): Make type optional, instead of matching empty string) - rust-lang/rust#143925 (Make slice comparisons const) - rust-lang/rust#143997 (Use $crate in macros for rustc_public (aka stable_mir)) - rust-lang/rust#144013 (resolve: Make disambiguators for underscore bindings module-local) - rust-lang/rust#144029 (Fix wrong messages from methods with the same name from different traits) - rust-lang/rust#144063 (Add myself to the `infra-ci` reviewer group and adjust some infra auto-labels) - rust-lang/rust#144069 (ci: use windows 22 for all free runners) r? `@ghost` `@rustbot` modify labels: rollup
rust-cloud-vms bot
pushed a commit
to makai410/rustc_public
that referenced
this pull request
Aug 16, 2025
resolve: Make disambiguators for underscore bindings module-local (take 2) The difference with rust-lang/rust#144013 can be seen in the second commit. Now we just keep a separate disambiguator counter in every `Module`, instead of a global counter in `Resolver`. This will be ok for parallel import resolution because we'll need to lock the module anyway when updating `resolutions` and other fields in it. And for external modules the disabmiguator could be just passed as an argument to `define_extern`, without using any cells or locks, once rust-lang/rust#143884 lands. Unblocks rust-lang/rust#143884.
rust-cloud-vms bot
pushed a commit
to makai410/rustc_public
that referenced
this pull request
Aug 20, 2025
Rollup of 11 pull requests Successful merges: - rust-lang/rust#143280 (Remove duplicate error about raw underscore lifetime) - rust-lang/rust#143649 (Add test for `default_field_values` and `const_default`) - rust-lang/rust#143699 (Make `AsyncDrop` check that it's being implemented on a local ADT) - rust-lang/rust#143908 (`tests/ui`: A New Order [0/28] ) - rust-lang/rust#143909 (docs(alloc::fmt): Make type optional, instead of matching empty string) - rust-lang/rust#143925 (Make slice comparisons const) - rust-lang/rust#143997 (Use $crate in macros for rustc_public (aka stable_mir)) - rust-lang/rust#144013 (resolve: Make disambiguators for underscore bindings module-local) - rust-lang/rust#144029 (Fix wrong messages from methods with the same name from different traits) - rust-lang/rust#144063 (Add myself to the `infra-ci` reviewer group and adjust some infra auto-labels) - rust-lang/rust#144069 (ci: use windows 22 for all free runners) r? `@ghost` `@rustbot` modify labels: rollup
rust-cloud-vms bot
pushed a commit
to makai410/rustc_public
that referenced
this pull request
Aug 20, 2025
resolve: Make disambiguators for underscore bindings module-local (take 2) The difference with rust-lang/rust#144013 can be seen in the second commit. Now we just keep a separate disambiguator counter in every `Module`, instead of a global counter in `Resolver`. This will be ok for parallel import resolution because we'll need to lock the module anyway when updating `resolutions` and other fields in it. And for external modules the disabmiguator could be just passed as an argument to `define_extern`, without using any cells or locks, once rust-lang/rust#143884 lands. Unblocks rust-lang/rust#143884.
makai410
pushed a commit
to makai410/rust
that referenced
this pull request
Nov 8, 2025
resolve: Make disambiguators for underscore bindings module-local Disambiguators attached to underscore name bindings (like `const _: u8 = something;`) do not need to be globally unique, they just need to be unique inside the module in which they live, because the bindings in a module are basically kept as `Map<BindingKey, SomeData>`. Also, the specific values of the disambiguators are not important, so a glob import of `const _` may have a different disambiguator than the original `const _` itself. So in this PR the disambiguator is just set to the current number of bindings in the module. This removes one more piece of global mutable state from resolver and unblocks rust-lang#143884.
makai410
pushed a commit
to makai410/rust
that referenced
this pull request
Nov 8, 2025
…iaskrgr Rollup of 11 pull requests Successful merges: - rust-lang#143280 (Remove duplicate error about raw underscore lifetime) - rust-lang#143649 (Add test for `default_field_values` and `const_default`) - rust-lang#143699 (Make `AsyncDrop` check that it's being implemented on a local ADT) - rust-lang#143908 (`tests/ui`: A New Order [0/28] ) - rust-lang#143909 (docs(alloc::fmt): Make type optional, instead of matching empty string) - rust-lang#143925 (Make slice comparisons const) - rust-lang#143997 (Use $crate in macros for rustc_public (aka stable_mir)) - rust-lang#144013 (resolve: Make disambiguators for underscore bindings module-local) - rust-lang#144029 (Fix wrong messages from methods with the same name from different traits) - rust-lang#144063 (Add myself to the `infra-ci` reviewer group and adjust some infra auto-labels) - rust-lang#144069 (ci: use windows 22 for all free runners) r? `@ghost` `@rustbot` modify labels: rollup
makai410
pushed a commit
to makai410/rust
that referenced
this pull request
Nov 8, 2025
resolve: Make disambiguators for underscore bindings module-local (take 2) The difference with rust-lang#144013 can be seen in the second commit. Now we just keep a separate disambiguator counter in every `Module`, instead of a global counter in `Resolver`. This will be ok for parallel import resolution because we'll need to lock the module anyway when updating `resolutions` and other fields in it. And for external modules the disabmiguator could be just passed as an argument to `define_extern`, without using any cells or locks, once rust-lang#143884 lands. Unblocks rust-lang#143884.
makai410
pushed a commit
to makai410/rust
that referenced
this pull request
Nov 10, 2025
resolve: Make disambiguators for underscore bindings module-local Disambiguators attached to underscore name bindings (like `const _: u8 = something;`) do not need to be globally unique, they just need to be unique inside the module in which they live, because the bindings in a module are basically kept as `Map<BindingKey, SomeData>`. Also, the specific values of the disambiguators are not important, so a glob import of `const _` may have a different disambiguator than the original `const _` itself. So in this PR the disambiguator is just set to the current number of bindings in the module. This removes one more piece of global mutable state from resolver and unblocks rust-lang#143884.
makai410
pushed a commit
to makai410/rust
that referenced
this pull request
Nov 10, 2025
…iaskrgr Rollup of 11 pull requests Successful merges: - rust-lang#143280 (Remove duplicate error about raw underscore lifetime) - rust-lang#143649 (Add test for `default_field_values` and `const_default`) - rust-lang#143699 (Make `AsyncDrop` check that it's being implemented on a local ADT) - rust-lang#143908 (`tests/ui`: A New Order [0/28] ) - rust-lang#143909 (docs(alloc::fmt): Make type optional, instead of matching empty string) - rust-lang#143925 (Make slice comparisons const) - rust-lang#143997 (Use $crate in macros for rustc_public (aka stable_mir)) - rust-lang#144013 (resolve: Make disambiguators for underscore bindings module-local) - rust-lang#144029 (Fix wrong messages from methods with the same name from different traits) - rust-lang#144063 (Add myself to the `infra-ci` reviewer group and adjust some infra auto-labels) - rust-lang#144069 (ci: use windows 22 for all free runners) r? `@ghost` `@rustbot` modify labels: rollup
makai410
pushed a commit
to makai410/rust
that referenced
this pull request
Nov 10, 2025
resolve: Make disambiguators for underscore bindings module-local (take 2) The difference with rust-lang#144013 can be seen in the second commit. Now we just keep a separate disambiguator counter in every `Module`, instead of a global counter in `Resolver`. This will be ok for parallel import resolution because we'll need to lock the module anyway when updating `resolutions` and other fields in it. And for external modules the disabmiguator could be just passed as an argument to `define_extern`, without using any cells or locks, once rust-lang#143884 lands. Unblocks rust-lang#143884.
makai410
pushed a commit
to makai410/rustc_public
that referenced
this pull request
Nov 16, 2025
Rollup of 11 pull requests Successful merges: - rust-lang/rust#143280 (Remove duplicate error about raw underscore lifetime) - rust-lang/rust#143649 (Add test for `default_field_values` and `const_default`) - rust-lang/rust#143699 (Make `AsyncDrop` check that it's being implemented on a local ADT) - rust-lang/rust#143908 (`tests/ui`: A New Order [0/28] ) - rust-lang/rust#143909 (docs(alloc::fmt): Make type optional, instead of matching empty string) - rust-lang/rust#143925 (Make slice comparisons const) - rust-lang/rust#143997 (Use $crate in macros for rustc_public (aka stable_mir)) - rust-lang/rust#144013 (resolve: Make disambiguators for underscore bindings module-local) - rust-lang/rust#144029 (Fix wrong messages from methods with the same name from different traits) - rust-lang/rust#144063 (Add myself to the `infra-ci` reviewer group and adjust some infra auto-labels) - rust-lang/rust#144069 (ci: use windows 22 for all free runners) r? `@ghost` `@rustbot` modify labels: rollup
makai410
pushed a commit
to makai410/rustc_public
that referenced
this pull request
Nov 16, 2025
resolve: Make disambiguators for underscore bindings module-local (take 2) The difference with rust-lang/rust#144013 can be seen in the second commit. Now we just keep a separate disambiguator counter in every `Module`, instead of a global counter in `Resolver`. This will be ok for parallel import resolution because we'll need to lock the module anyway when updating `resolutions` and other fields in it. And for external modules the disabmiguator could be just passed as an argument to `define_extern`, without using any cells or locks, once rust-lang/rust#143884 lands. Unblocks rust-lang/rust#143884.
Kobzol
pushed a commit
to Kobzol/rustc_codegen_cranelift
that referenced
this pull request
Dec 29, 2025
resolve: Make disambiguators for underscore bindings module-local (take 2) The difference with rust-lang/rust#144013 can be seen in the second commit. Now we just keep a separate disambiguator counter in every `Module`, instead of a global counter in `Resolver`. This will be ok for parallel import resolution because we'll need to lock the module anyway when updating `resolutions` and other fields in it. And for external modules the disabmiguator could be just passed as an argument to `define_extern`, without using any cells or locks, once rust-lang/rust#143884 lands. Unblocks rust-lang/rust#143884.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Disambiguators attached to underscore name bindings (like
const _: u8 = something;) do not need to be globally unique, they just need to be unique inside the module in which they live, because the bindings in a module are basically kept asMap<BindingKey, SomeData>.Also, the specific values of the disambiguators are not important, so a glob import of
const _may have a different disambiguator than the originalconst _itself.So in this PR the disambiguator is just set to the current number of bindings in the module.
This removes one more piece of global mutable state from resolver and unblocks #143884.