minor tweaks
This commit is contained in:
parent
f92294f76b
commit
3206960ec6
8 changed files with 19 additions and 21 deletions
|
|
@ -558,14 +558,13 @@ impl<'a> State<'a> {
|
|||
self.word(",");
|
||||
self.space();
|
||||
|
||||
let (&first, rest) =
|
||||
fields.split_first().expect("offset_of! should have at least 1 field");
|
||||
if let Some((&first, rest)) = fields.split_first() {
|
||||
self.print_ident(first);
|
||||
|
||||
self.print_ident(first);
|
||||
|
||||
for &field in rest {
|
||||
self.word(".");
|
||||
self.print_ident(field);
|
||||
for &field in rest {
|
||||
self.word(".");
|
||||
self.print_ident(field);
|
||||
}
|
||||
}
|
||||
|
||||
self.end();
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
// FIXME: This should be a span_bug (#80742)
|
||||
self.tcx.sess.delay_span_bug(
|
||||
self.frame().current_span(),
|
||||
&format!("Nullary MIR operator called for unsized type {}", ty),
|
||||
&format!("{null_op:?} MIR operator called for unsized type {ty}"),
|
||||
);
|
||||
throw_inval!(SizeOfUnsizedType(ty));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1557,14 +1557,13 @@ impl<'a> State<'a> {
|
|||
self.word(",");
|
||||
self.space();
|
||||
|
||||
let (&first, rest) =
|
||||
fields.split_first().expect("offset_of! should have at least 1 field");
|
||||
if let Some((&first, rest)) = fields.split_first() {
|
||||
self.print_ident(first);
|
||||
|
||||
self.print_ident(first);
|
||||
|
||||
for &field in rest {
|
||||
self.word(".");
|
||||
self.print_ident(field);
|
||||
for &field in rest {
|
||||
self.word(".");
|
||||
self.print_ident(field);
|
||||
}
|
||||
}
|
||||
|
||||
self.word(")");
|
||||
|
|
|
|||
|
|
@ -3084,6 +3084,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
{
|
||||
let field_ty = self.field_ty(expr.span, field, substs);
|
||||
|
||||
// FIXME: DSTs with static alignment should be allowed
|
||||
self.require_type_is_sized(field_ty, expr.span, traits::MiscObligation);
|
||||
|
||||
if field.vis.is_accessible_from(def_scope, self.tcx) {
|
||||
|
|
|
|||
|
|
@ -53,7 +53,8 @@ impl Category {
|
|||
| ExprKind::Borrow { .. }
|
||||
| ExprKind::AddressOf { .. }
|
||||
| ExprKind::Yield { .. }
|
||||
| ExprKind::Call { .. } => Some(Category::Rvalue(RvalueFunc::Into)),
|
||||
| ExprKind::Call { .. }
|
||||
| ExprKind::InlineAsm { .. } => Some(Category::Rvalue(RvalueFunc::Into)),
|
||||
|
||||
ExprKind::Array { .. }
|
||||
| ExprKind::Tuple { .. }
|
||||
|
|
@ -67,7 +68,6 @@ impl Category {
|
|||
| ExprKind::Assign { .. }
|
||||
| ExprKind::AssignOp { .. }
|
||||
| ExprKind::ThreadLocalRef(_)
|
||||
| ExprKind::InlineAsm { .. }
|
||||
| ExprKind::OffsetOf { .. } => Some(Category::Rvalue(RvalueFunc::AsRvalue)),
|
||||
|
||||
ExprKind::ConstBlock { .. }
|
||||
|
|
|
|||
|
|
@ -520,7 +520,7 @@ impl<'a, 'tcx> ThirPrinter<'a, 'tcx> {
|
|||
print_indented!(self, "}", depth_lvl);
|
||||
}
|
||||
OffsetOf { container, fields } => {
|
||||
print_indented!(self, "InlineAsm {", depth_lvl);
|
||||
print_indented!(self, "OffsetOf {", depth_lvl);
|
||||
print_indented!(self, format!("container: {:?}", container), depth_lvl + 1);
|
||||
print_indented!(self, "fields: [", depth_lvl + 1);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue