mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Fix ICE assigning methods to local variables
This just adds some missing match cases in ty and trans Closes #18412
This commit is contained in:
parent
1652a1f2c6
commit
c8b142afb9
@ -833,7 +833,7 @@ fn trans_def<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
|||||||
|
|
||||||
let _icx = push_ctxt("trans_def_lvalue");
|
let _icx = push_ctxt("trans_def_lvalue");
|
||||||
match def {
|
match def {
|
||||||
def::DefFn(..) | def::DefStaticMethod(..) |
|
def::DefFn(..) | def::DefStaticMethod(..) | def::DefMethod(..) |
|
||||||
def::DefStruct(_) | def::DefVariant(..) => {
|
def::DefStruct(_) | def::DefVariant(..) => {
|
||||||
trans_def_fn_unadjusted(bcx, ref_expr, def)
|
trans_def_fn_unadjusted(bcx, ref_expr, def)
|
||||||
}
|
}
|
||||||
@ -1191,10 +1191,12 @@ fn trans_def_fn_unadjusted<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
|||||||
let llfn = match def {
|
let llfn = match def {
|
||||||
def::DefFn(did, _, _) |
|
def::DefFn(did, _, _) |
|
||||||
def::DefStruct(did) | def::DefVariant(_, did, _) |
|
def::DefStruct(did) | def::DefVariant(_, did, _) |
|
||||||
def::DefStaticMethod(did, def::FromImpl(_), _) => {
|
def::DefStaticMethod(did, def::FromImpl(_), _) |
|
||||||
|
def::DefMethod(did, _, def::FromImpl(_)) => {
|
||||||
callee::trans_fn_ref(bcx, did, ExprId(ref_expr.id))
|
callee::trans_fn_ref(bcx, did, ExprId(ref_expr.id))
|
||||||
}
|
}
|
||||||
def::DefStaticMethod(impl_did, def::FromTrait(trait_did), _) => {
|
def::DefStaticMethod(impl_did, def::FromTrait(trait_did), _) |
|
||||||
|
def::DefMethod(impl_did, _, def::FromTrait(trait_did)) => {
|
||||||
meth::trans_static_method_callee(bcx, impl_did,
|
meth::trans_static_method_callee(bcx, impl_did,
|
||||||
trait_did, ref_expr.id)
|
trait_did, ref_expr.id)
|
||||||
}
|
}
|
||||||
|
@ -3631,7 +3631,7 @@ pub fn expr_kind(tcx: &ctxt, expr: &ast::Expr) -> ExprKind {
|
|||||||
def::DefFn(_, _, true) => RvalueDpsExpr,
|
def::DefFn(_, _, true) => RvalueDpsExpr,
|
||||||
|
|
||||||
// Fn pointers are just scalar values.
|
// Fn pointers are just scalar values.
|
||||||
def::DefFn(..) | def::DefStaticMethod(..) => RvalueDatumExpr,
|
def::DefFn(..) | def::DefStaticMethod(..) | def::DefMethod(..) => RvalueDatumExpr,
|
||||||
|
|
||||||
// Note: there is actually a good case to be made that
|
// Note: there is actually a good case to be made that
|
||||||
// DefArg's, particularly those of immediate type, ought to
|
// DefArg's, particularly those of immediate type, ought to
|
||||||
|
Loading…
Reference in New Issue
Block a user