1
Fork 0

Fix binding mode problems

This commit is contained in:
Michael Goulet 2025-02-20 18:28:48 +00:00
parent e1819a889a
commit 3d5438accd
67 changed files with 154 additions and 181 deletions

View file

@ -106,7 +106,7 @@ fn anon_const_type_of<'tcx>(icx: &ItemCtxt<'tcx>, def_id: LocalDefId) -> Ty<'tcx
}
}
}
Node::Variant(Variant { disr_expr: Some(ref e), .. }) if e.hir_id == hir_id => {
Node::Variant(Variant { disr_expr: Some(e), .. }) if e.hir_id == hir_id => {
tcx.adt_def(tcx.hir_get_parent_item(hir_id)).repr().discr_type().to_ty(tcx)
}
// Sort of affects the type system, but only for the purpose of diagnostics

View file

@ -1226,11 +1226,10 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
adt_def.variants().iter().find(|s| s.name == variant_name)
{
let mut suggestion = vec![(assoc_ident.span, variant_name.to_string())];
if let hir::Node::Stmt(hir::Stmt {
kind: hir::StmtKind::Semi(ref expr),
..
if let hir::Node::Stmt(&hir::Stmt {
kind: hir::StmtKind::Semi(expr), ..
})
| hir::Node::Expr(ref expr) = tcx.parent_hir_node(hir_ref_id)
| hir::Node::Expr(expr) = tcx.parent_hir_node(hir_ref_id)
&& let hir::ExprKind::Struct(..) = expr.kind
{
match variant.ctor {