Skip to content

Remove unused tuple fields #99729

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 2 commits into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
40 changes: 18 additions & 22 deletions compiler/rustc_infer/src/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2410,9 +2410,9 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
#[derive(Debug)]
enum SubOrigin<'hir> {
GAT(&'hir hir::Generics<'hir>),
Impl(&'hir hir::Generics<'hir>),
Trait(&'hir hir::Generics<'hir>),
Fn(&'hir hir::Generics<'hir>),
Impl,
Trait,
Fn,
Unknown,
}
let sub_origin = 'origin: {
Expand All @@ -2427,34 +2427,30 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
kind: hir::ImplItemKind::TyAlias(..),
generics,
..
}) => SubOrigin::GAT(generics),
Node::ImplItem(hir::ImplItem {
kind: hir::ImplItemKind::Fn(..),
generics,
..
}) => SubOrigin::Fn(generics),
Node::TraitItem(hir::TraitItem {
})
| Node::TraitItem(hir::TraitItem {
kind: hir::TraitItemKind::Type(..),
generics,
..
}) => SubOrigin::GAT(generics),
Node::TraitItem(hir::TraitItem {
kind: hir::TraitItemKind::Fn(..),
generics,
Node::ImplItem(hir::ImplItem {
kind: hir::ImplItemKind::Fn(..),
..
}) => SubOrigin::Fn(generics),
Node::Item(hir::Item {
kind: hir::ItemKind::Trait(_, _, generics, _, _),
})
| Node::TraitItem(hir::TraitItem {
kind: hir::TraitItemKind::Fn(..),
..
}) => SubOrigin::Trait(generics),
})
| Node::Item(hir::Item {
kind: hir::ItemKind::Fn(..), ..
}) => SubOrigin::Fn,
Node::Item(hir::Item {
kind: hir::ItemKind::Impl(hir::Impl { generics, .. }),
kind: hir::ItemKind::Trait(..),
..
}) => SubOrigin::Impl(generics),
}) => SubOrigin::Trait,
Node::Item(hir::Item {
kind: hir::ItemKind::Fn(_, generics, _),
..
}) => SubOrigin::Fn(generics),
kind: hir::ItemKind::Impl(..), ..
}) => SubOrigin::Impl,
_ => continue,
};
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_resolve/src/build_reduced_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
let crate_root = self.r.resolve_crate_root(source.ident);
let crate_name = match crate_root.kind {
ModuleKind::Def(.., name) => name,
ModuleKind::Block(..) => unreachable!(),
ModuleKind::Block => unreachable!(),
};
// HACK(eddyb) unclear how good this is, but keeping `$crate`
// in `source` breaks `src/test/ui/imports/import-crate-var.rs`,
Expand Down Expand Up @@ -936,7 +936,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
if self.block_needs_anonymous_module(block) {
let module = self.r.new_module(
Some(parent),
ModuleKind::Block(block.id),
ModuleKind::Block,
expansion.to_expn_id(),
block.span,
parent.no_implicit_prelude,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ impl<'a> Resolver<'a> {

let container = match parent.kind {
ModuleKind::Def(kind, _, _) => kind.descr(parent.def_id()),
ModuleKind::Block(..) => "block",
ModuleKind::Block => "block",
};

let old_noun = match old_binding.is_import() {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_resolve/src/ident.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ impl<'a> Resolver<'a> {
return Some((self.expn_def_scope(ctxt.remove_mark()), None));
}

if let ModuleKind::Block(..) = module.kind {
if let ModuleKind::Block = module.kind {
return Some((module.parent.unwrap().nearest_item_scope(), None));
}

Expand Down Expand Up @@ -333,7 +333,7 @@ impl<'a> Resolver<'a> {
};

match module.kind {
ModuleKind::Block(..) => {} // We can see through blocks
ModuleKind::Block => {} // We can see through blocks
_ => break,
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/src/late/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1434,7 +1434,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
// Items from this module
self.r.add_module_candidates(module, &mut names, &filter_fn);

if let ModuleKind::Block(..) = module.kind {
if let ModuleKind::Block = module.kind {
// We can see through blocks
} else {
// Items from the prelude
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_resolve/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ enum ModuleKind {
/// f(); // Resolves to (1)
/// }
/// ```
Block(NodeId),
Block,
/// Any module with a name.
///
/// This could be:
Expand All @@ -453,7 +453,7 @@ impl ModuleKind {
/// Get name of the module.
pub fn name(&self) -> Option<Symbol> {
match self {
ModuleKind::Block(..) => None,
ModuleKind::Block => None,
ModuleKind::Def(.., name) => Some(*name),
}
}
Expand Down Expand Up @@ -529,7 +529,7 @@ impl<'a> ModuleData<'a> {
) -> Self {
let is_foreign = match kind {
ModuleKind::Def(_, def_id, _) => !def_id.is_local(),
ModuleKind::Block(_) => false,
ModuleKind::Block => false,
};
ModuleData {
parent,
Expand Down