-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add some comments to hir::ModuleItems #122771
Conversation
compiler/rustc_middle/src/hir/mod.rs
Outdated
/// Returns all non-associated locally defined items in all modules. | ||
/// | ||
/// Note that this does *not* include associated items of `impl` blocks! It also does not | ||
/// include foreign items. If you want to e.g. get all functions, use `definitions()` below. | ||
pub fn items(&self) -> impl Iterator<Item = ItemId> + '_ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe rename it to free_items
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does that term have any precedent in the compiler?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are 56 results for free function
and 6 results for free const
, among them results in diagnostic messages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and resolve_instance
refers to free item
in debug logging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, free would be a good descriptor here. Let's help establish precedence here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. :)
"free" captures "non-assoc" but doesn't capture "also excludes foreign items". But I think that's less important to capture anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also it seems to include the impl blocks themselves, or did I misunderstand that?
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me with CI happy
@bors r=oli-obk rollup |
add some comments to hir::ModuleItems I've definitely been bitten by this in the past, where I assumed `items()` would give me *all* the items.
add some comments to hir::ModuleItems I've definitely been bitten by this in the past, where I assumed `items()` would give me *all* the items.
…kingjubilee Rollup of 9 pull requests Successful merges: - rust-lang#122222 (deref patterns: bare-bones feature gate and typechecking) - rust-lang#122456 (CFI: Skip non-passed arguments) - rust-lang#122696 (Add bare metal riscv32 target.) - rust-lang#122771 (add some comments to hir::ModuleItems) - rust-lang#122773 (make "expected paren or brace" error translatable) - rust-lang#122795 (Inherit `RUSTC_BOOTSTRAP` when testing wasm) - rust-lang#122799 (Replace closures with `_` when suggesting fully qualified path for method call) - rust-lang#122801 (Fix misc printing issues in emit=stable_mir) - rust-lang#122806 (Make `type_ascribe!` not a built-in) r? `@ghost` `@rustbot` modify labels: rollup
add some comments to hir::ModuleItems I've definitely been bitten by this in the past, where I assumed `items()` would give me *all* the items.
☔ The latest upstream changes (presumably #122568) made this pull request unmergeable. Please resolve the merge conflicts. |
@bors r=oli-obk rollup |
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#122222 (deref patterns: bare-bones feature gate and typechecking) - rust-lang#122358 (Don't ICE when encountering bound regions in generator interior type) - rust-lang#122696 (Add bare metal riscv32 target.) - rust-lang#122773 (make "expected paren or brace" error translatable) - rust-lang#122795 (Inherit `RUSTC_BOOTSTRAP` when testing wasm) - rust-lang#122799 (Replace closures with `_` when suggesting fully qualified path for method call) - rust-lang#122801 (Fix misc printing issues in emit=stable_mir) - rust-lang#122806 (Make `type_ascribe!` not a built-in) Failed merges: - rust-lang#122771 (add some comments to hir::ModuleItems) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#122402 (Make `#[diagnostic::on_unimplemented]` format string parsing more robust) - rust-lang#122644 (pattern analysis: add a custom test harness) - rust-lang#122733 (Strip placeholders from hidden types before remapping generic parameter) - rust-lang#122752 (Interpolated cleanups) - rust-lang#122771 (add some comments to hir::ModuleItems) - rust-lang#122793 (Implement macro-based deref!() syntax for deref patterns) - rust-lang#122810 (Remove `target_override`) - rust-lang#122827 (Remove unnecessary braces from `bug`/`span_bug`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#122771 - RalfJung:module-items, r=oli-obk add some comments to hir::ModuleItems I've definitely been bitten by this in the past, where I assumed `items()` would give me *all* the items.
I've definitely been bitten by this in the past, where I assumed
items()
would give me all the items.