Skip to content

Conversation

@yaahc
Copy link
Member

@yaahc yaahc commented Oct 20, 2025

currently mostly a skeleton of a draft so we can collaboratively massage it into shape more easily before filling in with proper reference verbiage.

hoping to take a significant chunk out of #568

@traviscross
Copy link
Contributor

Thanks for posting. Lot of good here. The main thing I'd suggest, by way of helping to sharpen this up, would be to try to write a concise example after each claim, in as many cases as that might make sense, that demonstrates that the claim is true (and would not pass if the claim were false). Aside from the intrinsic benefit of having such examples, I think this might help to focus the text on the language-level effects. (It's not surprising, given the good research you've been doing, that some bits of this currently have some "description of the implementation" flavor.)

Copy link
Member Author

@yaahc yaahc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a fair number of comments are also contained inline in the documents

* .visitation-order
* derive helpers
* not visited when resolving derive macros in the parent scope (starting scope)
* derive helpers compat
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same concern as above about this being deprecated and removed next year.

@rustbot

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. label Oct 21, 2025
@traviscross
Copy link
Contributor

@ehuss and I are looking at this together on the lang-docs office hours call, and we just wanted to express our appreciation to @petrochenkov for having been so responsive with @yaahc on working out the details here. This is a chapter that we've long wanted to exist, and we're thrilled and appreciative that @yaahc is digging in to shape this up.

@yaahc yaahc force-pushed the name-res branch 6 times, most recently from 5397d08 to 1bd3afe Compare October 29, 2025 21:29
@yaahc yaahc force-pushed the name-res branch 9 times, most recently from 80fd707 to 570bedd Compare November 7, 2025 22:43
@yaahc yaahc force-pushed the name-res branch 4 times, most recently from 79bf489 to 71275de Compare November 25, 2025 20:58
@yaahc yaahc force-pushed the name-res branch 5 times, most recently from f8b5ce9 to 74516a6 Compare November 25, 2025 21:38
@yaahc yaahc force-pushed the name-res branch 2 times, most recently from ef0932f to 61a0cf1 Compare November 25, 2025 21:49
@ehuss
Copy link
Contributor

ehuss commented Nov 25, 2025

Something I'm missing is a discussion about blocks, and how they can introduce essentially an anonymous module (ModuleKind::Block). That's important when trying to understand the module tree and how some resolutions and ambiguities resolve differently. I was looking at this example:

mod bar {
    pub struct Name;
}

mod baz {
    pub struct Name;
}

use baz::Name;

pub fn foo() {
    use bar::*;
    Name; // resolves to bar::Name
}

I think the reason it resolves to bar::Name is because it is nested inside an anonymous module. If we were to rewrite this to:

mod bar {
    pub struct Name;
}

mod baz {
    pub struct Name;
}

use baz::Name;
use bar::*;

pub fn foo() {
    Name; // resolves to baz::Name
}

If we were to ignore blocks, and pretend they don't exist from a module-hierarchy perspective, I would expect both these examples to be the same. I'm not sure if I'm understanding this correctly, since resolution within a block still "sees" everything outside of the block (inside it's module).

@yaahc yaahc force-pushed the name-res branch 3 times, most recently from 08596c4 to dceb962 Compare November 25, 2025 23:20
@yaahc yaahc force-pushed the name-res branch 3 times, most recently from ee84f4c to ecea463 Compare November 25, 2025 23:55
Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
Co-authored-by: Eric Huss <eric@huss.org>
Co-authored-by: Tshepang Mbambo <hopsi@tuta.io>
@traviscross
Copy link
Contributor

Thanks to @yaahc for joining us on the lang-docs office hours today to speedrun many revisions to this chapter, which is really shaping up.

github-actions bot pushed a commit to rust-lang/rust-analyzer that referenced this pull request Nov 27, 2025
Add test for derive helper compat collisions

Resolves rust-lang/reference#2055 (comment)

r? `@petrochenkov`
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Nov 27, 2025
Add test for derive helper compat collisions

Resolves rust-lang/reference#2055 (comment)

r? `@petrochenkov`
RalfJung pushed a commit to RalfJung/miri that referenced this pull request Nov 28, 2025
Add test for derive helper compat collisions

Resolves rust-lang/reference#2055 (comment)

r? `@petrochenkov`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: The marked PR is awaiting review from a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants