Auto merge of #57879 - Centril:rollup, r=Centril
Rollup of 9 pull requests Successful merges: - #57380 (Fix Instant/Duration math precision & associativity on Windows) - #57606 (Get rid of the fake stack frame for reading from constants) - #57803 (Several changes to libunwind for SGX target) - #57846 (rustdoc: fix ICE from loading proc-macro stubs) - #57860 (Add os::fortanix_sgx::ffi module) - #57861 (Don't export table by default in wasm) - #57863 (Add suggestion for incorrect field syntax.) - #57867 (Fix std::future::from_generator documentation) - #57873 (Stabilize no_panic_pow) Failed merges: r? @ghost
This commit is contained in:
commit
278067d34d
28 changed files with 432 additions and 172 deletions
|
@ -2319,8 +2319,24 @@ impl<'a> Parser<'a> {
|
|||
let lo = self.span;
|
||||
|
||||
// Check if a colon exists one ahead. This means we're parsing a fieldname.
|
||||
let (fieldname, expr, is_shorthand) = if self.look_ahead(1, |t| t == &token::Colon) {
|
||||
let (fieldname, expr, is_shorthand) = if self.look_ahead(1, |t| {
|
||||
t == &token::Colon || t == &token::Eq
|
||||
}) {
|
||||
let fieldname = self.parse_field_name()?;
|
||||
|
||||
// Check for an equals token. This means the source incorrectly attempts to
|
||||
// initialize a field with an eq rather than a colon.
|
||||
if self.token == token::Eq {
|
||||
self.diagnostic()
|
||||
.struct_span_err(self.span, "expected `:`, found `=`")
|
||||
.span_suggestion_with_applicability(
|
||||
fieldname.span.shrink_to_hi().to(self.span),
|
||||
"replace equals symbol with a colon",
|
||||
":".to_string(),
|
||||
Applicability::MachineApplicable,
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
self.bump(); // `:`
|
||||
(fieldname, self.parse_expr()?, false)
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue