Skip to content

Retire ItemLikeVisitor trait #96825

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

Merged
merged 30 commits into from
May 17, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
bd2b210
Remove CheckConstTraitVisitor
kckeiks May 3, 2022
0026034
replace usage of visit_item_likes_in_modules with hir_module_items query
kckeiks May 3, 2022
52f833a
remove LifeSeeder
kckeiks May 3, 2022
dab0e75
remove DiagnosticItemCollector
kckeiks May 3, 2022
fb73ae2
remove ItemLikeVisitor impl for EntryContext
kckeiks May 3, 2022
b1f0209
optimize find_item to fetch Item only when needed
kckeiks May 3, 2022
0ef16fe
remove OuterVisitor
kckeiks May 4, 2022
45c37da
remove LayoutTest
kckeiks May 4, 2022
0a029e2
remove CollectPrivateImplItemsVisitor
kckeiks May 4, 2022
90685c6
check def_kind before fetching item
kckeiks May 4, 2022
eea16de
replace hir().def_kind for def_kind query in rustc_passes
kckeiks May 4, 2022
e8ef5bf
remove TraitVisitor
kckeiks May 4, 2022
e166409
remove Visitor impl for PrivateItemsInPublicInterfacesChecker
kckeiks May 5, 2022
cdba1dc
add module_items
kckeiks May 7, 2022
52d721c
remove TestItemNamesVisitor
kckeiks May 7, 2022
885b90b
remove DebuggerVisualizerCollector
kckeiks May 7, 2022
0b7dd95
remove HirVisitor
kckeiks May 7, 2022
93616dd
remove ItemLikeVisitor and DeepVisitor
kckeiks May 7, 2022
7e44078
update comments about visitor strategy
kckeiks May 7, 2022
f975d05
rename visit item-like methods
kckeiks May 7, 2022
2e98879
change back to using tcx.hir() visit-item method
kckeiks May 7, 2022
cad1fd2
update rustdoc code to use new method name
kckeiks May 7, 2022
df11942
change for_each_module's parameter to FnMut
kckeiks May 9, 2022
91223ac
use for_each_module instead of iterating over Item's
kckeiks May 9, 2022
433a5f1
avoid converting to DefId from LocalDefId when using query
kckeiks May 9, 2022
17e86d9
remove unnecessary methods from HirIdValidator
kckeiks May 9, 2022
f1c256d
remove redundant branch
kckeiks May 9, 2022
959636d
avoid fetching HIR when handling Impl assoc items
kckeiks May 12, 2022
f77658b
use opt_item_name to pattern match items with names
kckeiks May 12, 2022
48fd666
allocate string only when error will be emitted
kckeiks May 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use opt_item_name to pattern match items with names
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
  • Loading branch information
kckeiks committed May 14, 2022
commit f77658b470deb558ef3a270ca154a8afad230600
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1995,7 +1995,7 @@ impl<'tcx> TyCtxt<'tcx> {
}

/// Look up the name of a definition across crates. This does not look at HIR.
fn opt_item_name(self, def_id: DefId) -> Option<Symbol> {
pub fn opt_item_name(self, def_id: DefId) -> Option<Symbol> {
if let Some(cnum) = def_id.as_crate_root() {
Some(self.crate_name(cnum))
} else {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_passes/src/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ fn entry_point_type(ctxt: &EntryContext<'_>, id: ItemId, at_root: bool) -> Entry
} else if ctxt.tcx.sess.contains_name(attrs, sym::rustc_main) {
EntryPointType::MainAttr
} else {
let item = ctxt.tcx.hir().item(id);
if item.ident.name == sym::main {
if let Some(name) = ctxt.tcx.opt_item_name(id.def_id.to_def_id())
&& name == sym::main {
if at_root {
// This is a top-level function so can be `main`.
EntryPointType::MainNamed
Expand Down