Rollup merge of #27244 - Detegr:master, r=eddyb
Hi all. This is my first contribution to Rust and fixes an issue causing an invalid error message to be presented to the user when using unit struct as length of a repeat expression, issue #27008. The solution is based on suggestions by @oli-obk, but as I'm a complete newbie to this, I have no clue if I got them right :) The biggest concern I have is that if the `NodeId` I'm returning is the correct one or not (it's not meaningful in this case but I think it would be nice to get it right).
This commit is contained in:
commit
628654b198
2 changed files with 24 additions and 0 deletions
|
|
@ -967,6 +967,9 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
|
|||
Some(def::DefVariant(enum_def, variant_def, _)) => {
|
||||
(lookup_variant_by_id(tcx, enum_def, variant_def), None)
|
||||
}
|
||||
Some(def::DefStruct(_)) => {
|
||||
return Ok(ConstVal::Struct(e.id))
|
||||
}
|
||||
_ => (None, None)
|
||||
};
|
||||
let const_expr = match const_expr {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue