Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2ade671
[AIX] handle libunwind native_libs
daltenty Nov 7, 2024
7fc4b96
tests: Add regression test for self referential struct with cow as la…
Enselic Nov 26, 2024
685f189
Stabilize `extended_varargs_abi_support`
Soveu Apr 23, 2024
90ad2ad
Improve span handling in `parse_expr_bottom`.
nnethercote Nov 28, 2024
43c12ed
Bump `ruzstd` to 0.7.3
paolobarbolini Nov 28, 2024
8574f37
Do not call `extern_crate` on current trait on crate mismatch errors
estebank Nov 28, 2024
0c8e36b
Fix target_feature handling in freg of LoongArch inline assembly
taiki-e Nov 28, 2024
727f6a6
Add +forced-atomics feature to esp32s2
MabezDev Nov 28, 2024
c76f1f0
Doc comment custom MIR debuginfo.
cjgillot Oct 21, 2023
6e449e1
refine mir debuginfo docs
RalfJung Nov 29, 2024
e97e15d
Use rmake `diff` output in test
estebank Nov 29, 2024
998ff2f
Move the `crate-loading` test to use `diff` output
estebank Nov 29, 2024
ce98bf3
simplify how the `hir_typeck_pass_to_variadic_function` diagnostic is…
Nov 29, 2024
a9cb2d6
Add a comment
daltenty Nov 29, 2024
dd99f11
Rollup merge of #116161 - Soveu:varargs2, r=cjgillot
jieyouxu Nov 30, 2024
5192810
Rollup merge of #132750 - daltenty:daltenty/libs, r=jieyouxu
jieyouxu Nov 30, 2024
f1d9ba8
Rollup merge of #133488 - Enselic:recurse-2, r=BoxyUwU
jieyouxu Nov 30, 2024
5ec505f
Rollup merge of #133569 - paolobarbolini:ruzstd-0.7.3, r=Mark-Simulacrum
jieyouxu Nov 30, 2024
70e71f5
Rollup merge of #133585 - estebank:issue-133563, r=jieyouxu
jieyouxu Nov 30, 2024
ab4588a
Rollup merge of #133587 - taiki-e:loongarch-asm-freg, r=Amanieu
jieyouxu Nov 30, 2024
46f826c
Rollup merge of #133599 - esp-rs:target/esp32s2-forced-atomics, r=Ama…
jieyouxu Nov 30, 2024
c112195
Rollup merge of #133620 - dev-ardi:simplify-hir_typeck_pass_to_variad…
jieyouxu Nov 30, 2024
ea72c19
Rollup merge of #133623 - nnethercote:parse_expr_bottom-spans, r=comp…
jieyouxu Nov 30, 2024
6512836
Rollup merge of #133625 - RalfJung:custom-mir-debug-info, r=compiler-…
jieyouxu Nov 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve span handling in parse_expr_bottom.
`parse_expr_bottom` stores `this.token.span` in `lo`, but then fails to
use it in many places where it could. This commit fixes that, and
likewise (to a smaller extent) in `parse_ty_common`.
  • Loading branch information
nnethercote committed Nov 28, 2024
commit 90ad2adfea5a7f4baebb083cd3a190fa491d0ec8
5 changes: 2 additions & 3 deletions compiler/rustc_parse/src/parser/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1990,7 +1990,6 @@ impl<'a> Parser<'a> {
/// `await? <expr>`, `await(<expr>)`, and `await { <expr> }`.
pub(super) fn recover_incorrect_await_syntax(
&mut self,
lo: Span,
await_sp: Span,
) -> PResult<'a, P<Expr>> {
let (hi, expr, is_question) = if self.token == token::Not {
Expand All @@ -1999,8 +1998,8 @@ impl<'a> Parser<'a> {
} else {
self.recover_await_prefix(await_sp)?
};
let (sp, guar) = self.error_on_incorrect_await(lo, hi, &expr, is_question);
let expr = self.mk_expr_err(lo.to(sp), guar);
let (sp, guar) = self.error_on_incorrect_await(await_sp, hi, &expr, is_question);
let expr = self.mk_expr_err(await_sp.to(sp), guar);
self.maybe_recover_from_bad_qpath(expr)
}

Expand Down
19 changes: 8 additions & 11 deletions compiler/rustc_parse/src/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1446,34 +1446,31 @@ impl<'a> Parser<'a> {
this.parse_expr_closure()
} else {
assert!(this.eat_keyword(kw::For));
this.parse_expr_for(None, this.prev_token.span)
this.parse_expr_for(None, lo)
}
} else if this.eat_keyword(kw::While) {
this.parse_expr_while(None, this.prev_token.span)
this.parse_expr_while(None, lo)
} else if let Some(label) = this.eat_label() {
this.parse_expr_labeled(label, true)
} else if this.eat_keyword(kw::Loop) {
let sp = this.prev_token.span;
this.parse_expr_loop(None, this.prev_token.span).map_err(|mut err| {
err.span_label(sp, "while parsing this `loop` expression");
this.parse_expr_loop(None, lo).map_err(|mut err| {
err.span_label(lo, "while parsing this `loop` expression");
err
})
} else if this.eat_keyword(kw::Match) {
let match_sp = this.prev_token.span;
this.parse_expr_match().map_err(|mut err| {
err.span_label(match_sp, "while parsing this `match` expression");
err.span_label(lo, "while parsing this `match` expression");
err
})
} else if this.eat_keyword(kw::Unsafe) {
let sp = this.prev_token.span;
this.parse_expr_block(None, lo, BlockCheckMode::Unsafe(ast::UserProvided)).map_err(
|mut err| {
err.span_label(sp, "while parsing this `unsafe` expression");
err.span_label(lo, "while parsing this `unsafe` expression");
err
},
)
} else if this.check_inline_const(0) {
this.parse_const_block(lo.to(this.token.span), false)
this.parse_const_block(lo, false)
} else if this.may_recover() && this.is_do_catch_block() {
this.recover_do_catch()
} else if this.is_try_block() {
Expand Down Expand Up @@ -1514,7 +1511,7 @@ impl<'a> Parser<'a> {
this.parse_expr_closure()
}
} else if this.eat_keyword_noexpect(kw::Await) {
this.recover_incorrect_await_syntax(lo, this.prev_token.span)
this.recover_incorrect_await_syntax(lo)
} else {
this.parse_expr_lit()
}
Expand Down
11 changes: 4 additions & 7 deletions compiler/rustc_parse/src/parser/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ impl<'a> Parser<'a> {
// Function pointer type
self.parse_ty_bare_fn(lo, ThinVec::new(), None, recover_return_sign)?
} else if self.check_keyword(kw::For) {
let for_span = self.token.span;
// Function pointer type or bound list (trait object type) starting with a poly-trait.
// `for<'lt> [unsafe] [extern "ABI"] fn (&'lt S) -> T`
// `for<'lt> Trait1<'lt> + Trait2 + 'a`
Expand Down Expand Up @@ -302,7 +301,7 @@ impl<'a> Parser<'a> {
kw: kw.name.as_str(),
sugg: errors::TransposeDynOrImplSugg {
removal_span,
insertion_span: for_span.shrink_to_lo(),
insertion_span: lo.shrink_to_lo(),
kw: kw.name.as_str(),
},
});
Expand Down Expand Up @@ -345,16 +344,14 @@ impl<'a> Parser<'a> {
// FIXME(c_variadic): Should we just allow `...` syntactically
// anywhere in a type and use semantic restrictions instead?
// NOTE: This may regress certain MBE calls if done incorrectly.
let guar = self
.dcx()
.emit_err(NestedCVariadicType { span: lo.to(self.prev_token.span) });
let guar = self.dcx().emit_err(NestedCVariadicType { span: lo });
TyKind::Err(guar)
}
}
} else {
let msg = format!("expected type, found {}", super::token_descr(&self.token));
let mut err = self.dcx().struct_span_err(self.token.span, msg);
err.span_label(self.token.span, "expected type");
let mut err = self.dcx().struct_span_err(lo, msg);
err.span_label(lo, "expected type");
return Err(err);
};

Expand Down
Loading