Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c4e0cd9

Browse files
committedFeb 26, 2023
Auto merge of #108488 - matthiaskrgr:rollup-i61epcw, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #107941 (Treat `str` as containing `[u8]` for auto trait purposes) - #108299 (Require `literal`s for some `(u)int_impl!` parameters) - #108337 (hir-analysis: make a helpful note) - #108379 (Add `ErrorGuaranteed` to `hir::{Expr,Ty}Kind::Err` variants) - #108418 (Replace parse_[sth]_expr with parse_expr_[sth] function names) - #108424 (rustc_infer: Consolidate obligation elaboration de-duplication) - #108475 (Fix `VecDeque::shrink_to` and add tests.) - #108482 (statically guarantee that current error codes are documented) - #108484 (Remove `from` lang item) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 43ee4d1 + 9c27fc7 commit c4e0cd9

File tree

62 files changed

+492
-427
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+492
-427
lines changed
 

‎Cargo.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,6 +1445,7 @@ name = "error_index_generator"
14451445
version = "0.0.0"
14461446
dependencies = [
14471447
"mdbook",
1448+
"rustc_error_codes",
14481449
]
14491450

14501451
[[package]]

‎compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
8888
let kind = hir::ExprKind::Box(self.lower_expr(&inner));
8989
return hir::Expr { hir_id, kind, span: self.lower_span(e.span) };
9090
} else {
91-
self.tcx.sess.emit_err(RustcBoxAttributeError { span: e.span });
92-
hir::ExprKind::Err
91+
let guar = self.tcx.sess.emit_err(RustcBoxAttributeError { span: e.span });
92+
hir::ExprKind::Err(guar)
9393
}
9494
} else if let Some(legacy_args) = self.resolver.legacy_const_generic_args(f) {
9595
self.lower_legacy_const_generics((**f).clone(), args.clone(), &legacy_args)
@@ -266,8 +266,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
266266
self.lower_expr_range(e.span, e1.as_deref(), e2.as_deref(), *lims)
267267
}
268268
ExprKind::Underscore => {
269-
self.tcx.sess.emit_err(UnderscoreExprLhsAssign { span: e.span });
270-
hir::ExprKind::Err
269+
let guar = self.tcx.sess.emit_err(UnderscoreExprLhsAssign { span: e.span });
270+
hir::ExprKind::Err(guar)
271271
}
272272
ExprKind::Path(qself, path) => {
273273
let qpath = self.lower_qpath(
@@ -299,8 +299,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
299299
let rest = match &se.rest {
300300
StructRest::Base(e) => Some(self.lower_expr(e)),
301301
StructRest::Rest(sp) => {
302-
self.tcx.sess.emit_err(BaseExpressionDoubleDot { span: *sp });
303-
Some(&*self.arena.alloc(self.expr_err(*sp)))
302+
let guar =
303+
self.tcx.sess.emit_err(BaseExpressionDoubleDot { span: *sp });
304+
Some(&*self.arena.alloc(self.expr_err(*sp, guar)))
304305
}
305306
StructRest::None => None,
306307
};
@@ -318,7 +319,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
318319
)
319320
}
320321
ExprKind::Yield(opt_expr) => self.lower_expr_yield(e.span, opt_expr.as_deref()),
321-
ExprKind::Err => hir::ExprKind::Err,
322+
ExprKind::Err => hir::ExprKind::Err(
323+
self.tcx.sess.delay_span_bug(e.span, "lowered ExprKind::Err"),
324+
),
322325
ExprKind::Try(sub_expr) => self.lower_expr_try(e.span, sub_expr),
323326

324327
ExprKind::Paren(_) | ExprKind::ForLoop(..) => unreachable!("already handled"),
@@ -761,7 +764,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
761764
self.expr_ident_mut(span, task_context_ident, task_context_hid)
762765
} else {
763766
// Use of `await` outside of an async context, we cannot use `task_context` here.
764-
self.expr_err(span)
767+
self.expr_err(span, self.tcx.sess.delay_span_bug(span, "no task_context hir id"))
765768
};
766769
let new_unchecked = self.expr_call_lang_item_fn_mut(
767770
span,

0 commit comments

Comments
 (0)
Please sign in to comment.