Skip to content

Commit 07a9dae

Browse files
committed
Auto merge of #61602 - pietroalbini:beta-rollup, r=pietroalbini
[beta] Rollup backports Rolled up: * [beta] Permit unwinding through FFI by default #61569 Cherry-picked: * upgrade rustdoc's `pulldown-cmark` to 0.5.2 #60802 * Fix overflowing literal lint in loops #61098 * Revert edition-guide toolstate override #61110 * Turn turbo 🐟 🍨 into an error #61189 * Bump hashbrown to 0.4.0 #61388 * Fix regression 61475 #61500 r? @ghost
2 parents 0ff088c + 60dae64 commit 07a9dae

File tree

22 files changed

+165
-93
lines changed

22 files changed

+165
-93
lines changed

Cargo.lock

+10-21
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ dependencies = [
409409
"itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
410410
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
411411
"matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
412-
"pulldown-cmark 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
412+
"pulldown-cmark 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
413413
"quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
414414
"regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
415415
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1068,7 +1068,7 @@ dependencies = [
10681068

10691069
[[package]]
10701070
name = "hashbrown"
1071-
version = "0.3.0"
1071+
version = "0.4.0"
10721072
source = "registry+https://github.com/rust-lang/crates.io-index"
10731073
dependencies = [
10741074
"compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2001,23 +2001,13 @@ dependencies = [
20012001

20022002
[[package]]
20032003
name = "pulldown-cmark"
2004-
version = "0.4.1"
2005-
source = "registry+https://github.com/rust-lang/crates.io-index"
2006-
dependencies = [
2007-
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
2008-
"memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
2009-
"unicase 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
2010-
]
2011-
2012-
[[package]]
2013-
name = "pulldown-cmark"
2014-
version = "0.5.0"
2004+
version = "0.5.2"
20152005
source = "registry+https://github.com/rust-lang/crates.io-index"
20162006
dependencies = [
20172007
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
20182008
"getopts 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)",
20192009
"memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
2020-
"unicase 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
2010+
"unicase 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
20212011
]
20222012

20232013
[[package]]
@@ -3062,7 +3052,7 @@ version = "0.0.0"
30623052
dependencies = [
30633053
"minifier 0.0.30 (registry+https://github.com/rust-lang/crates.io-index)",
30643054
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
3065-
"pulldown-cmark 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
3055+
"pulldown-cmark 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
30663056
"tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
30673057
]
30683058

@@ -3302,7 +3292,7 @@ dependencies = [
33023292
"core 0.0.0",
33033293
"dlmalloc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
33043294
"fortanix-sgx-abi 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
3305-
"hashbrown 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
3295+
"hashbrown 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
33063296
"libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
33073297
"panic_abort 0.0.0",
33083298
"panic_unwind 0.0.0",
@@ -3824,7 +3814,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
38243814

38253815
[[package]]
38263816
name = "unicase"
3827-
version = "2.3.0"
3817+
version = "2.4.0"
38283818
source = "registry+https://github.com/rust-lang/crates.io-index"
38293819
dependencies = [
38303820
"version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -4147,7 +4137,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
41474137
"checksum globset 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ef4feaabe24a0a658fd9cf4a9acf6ed284f045c77df0f49020ba3245cfb7b454"
41484138
"checksum handlebars 0.32.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d89ec99d1594f285d4590fc32bac5f75cdab383f1123d504d27862c644a807dd"
41494139
"checksum handlebars 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d82e5750d8027a97b9640e3fefa66bbaf852a35228e1c90790efd13c4b09c166"
4150-
"checksum hashbrown 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "570178d5e4952010d138b0f1d581271ff3a02406d990f887d1e87e3d6e43b0ac"
4140+
"checksum hashbrown 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9529213c67695ca2d146e6f263b7b72df8fa973368beadf767e8ed80c03f2f36"
41514141
"checksum heck 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea04fa3ead4e05e51a7c806fc07271fdbde4e246a6c6d1efd52e72230b771b82"
41524142
"checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77"
41534143
"checksum home 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "80dff82fb58cfbbc617fb9a9184b010be0529201553cda50ad04372bc2333aff"
@@ -4241,8 +4231,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
42414231
"checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09"
42424232
"checksum proptest 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "24f5844db2f839e97e3021980975f6ebf8691d9b9b2ca67ed3feb38dc3edb52c"
42434233
"checksum pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d6fdf85cda6cadfae5428a54661d431330b312bc767ddbc57adbedc24da66e32"
4244-
"checksum pulldown-cmark 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d1b74cc784b038a9921fd1a48310cc2e238101aa8ae0b94201e2d85121dd68b5"
4245-
"checksum pulldown-cmark 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "157737d41407de9c5e0563a991d085117d60ae729af2cc1bf28d6dfbc97bcc1f"
4234+
"checksum pulldown-cmark 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "051e60ace841b3bfecd402fe5051c06cb3bec4a6e6fdd060a37aa8eb829a1db3"
42464235
"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0"
42474236
"checksum quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "07589615d719a60c8dd8a4622e7946465dfef20d1a428f969e3443e7386d5f45"
42484237
"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
@@ -4354,7 +4343,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
43544343
"checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169"
43554344
"checksum ucd-trie 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "71a9c5b1fe77426cf144cc30e49e955270f5086e31a6441dfa8b32efc09b9d77"
43564345
"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86"
4357-
"checksum unicase 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "41d17211f887da8e4a70a45b9536f26fc5de166b81e2d5d80de4a17fd22553bd"
4346+
"checksum unicase 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a84e5511b2a947f3ae965dcb29b13b7b1691b6e7332cf5dbc1744138d5acb7f6"
43584347
"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
43594348
"checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25"
43604349
"checksum unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa6024fc12ddfd1c6dbc14a80fa2324d4568849869b779f6bd37e5e4c03344d1"

src/ci/docker/x86_64-gnu-tools/checktools.sh

+1-3
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ status_check() {
7474
check_dispatch $1 beta nomicon src/doc/nomicon
7575
check_dispatch $1 beta reference src/doc/reference
7676
check_dispatch $1 beta rust-by-example src/doc/rust-by-example
77-
# Temporarily disabled until
78-
# https://github.com/rust-lang/rust/issues/60459 is fixed.
79-
# check_dispatch $1 beta edition-guide src/doc/edition-guide
77+
check_dispatch $1 beta edition-guide src/doc/edition-guide
8078
check_dispatch $1 beta rls src/tools/rls
8179
check_dispatch $1 beta rustfmt src/tools/rustfmt
8280
check_dispatch $1 beta clippy-driver src/tools/clippy

src/librustc/lint/mod.rs

+16-15
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use crate::util::nodemap::NodeMap;
3535
use errors::{DiagnosticBuilder, DiagnosticId};
3636
use std::{hash, ptr};
3737
use syntax::ast;
38-
use syntax::source_map::{MultiSpan, ExpnFormat};
38+
use syntax::source_map::{MultiSpan, ExpnFormat, CompilerDesugaringKind};
3939
use syntax::early_buffered_lints::BufferedEarlyLintId;
4040
use syntax::edition::Edition;
4141
use syntax::symbol::{Symbol, sym};
@@ -881,21 +881,22 @@ pub fn in_external_macro(sess: &Session, span: Span) -> bool {
881881
};
882882

883883
match info.format {
884-
ExpnFormat::MacroAttribute(..) => return true, // definitely a plugin
885-
ExpnFormat::CompilerDesugaring(_) => return true, // well, it's "external"
886-
ExpnFormat::MacroBang(..) => {} // check below
887-
}
888-
889-
let def_site = match info.def_site {
890-
Some(span) => span,
891-
// no span for the def_site means it's an external macro
892-
None => return true,
893-
};
884+
ExpnFormat::MacroAttribute(..) => true, // definitely a plugin
885+
ExpnFormat::CompilerDesugaring(CompilerDesugaringKind::ForLoop) => false,
886+
ExpnFormat::CompilerDesugaring(_) => true, // well, it's "external"
887+
ExpnFormat::MacroBang(..) => {
888+
let def_site = match info.def_site {
889+
Some(span) => span,
890+
// no span for the def_site means it's an external macro
891+
None => return true,
892+
};
894893

895-
match sess.source_map().span_to_snippet(def_site) {
896-
Ok(code) => !code.starts_with("macro_rules"),
897-
// no snippet = external macro or compiler-builtin expansion
898-
Err(_) => true,
894+
match sess.source_map().span_to_snippet(def_site) {
895+
Ok(code) => !code.starts_with("macro_rules"),
896+
// no snippet = external macro or compiler-builtin expansion
897+
Err(_) => true,
898+
}
899+
}
899900
}
900901
}
901902

src/librustc_mir/build/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ fn should_abort_on_panic<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
604604
// This is a special case: some functions have a C abi but are meant to
605605
// unwind anyway. Don't stop them.
606606
match unwind_attr {
607-
None => true,
607+
None => false, // FIXME(#58794)
608608
Some(UnwindAttr::Allowed) => false,
609609
Some(UnwindAttr::Aborts) => true,
610610
}

src/librustc_typeck/check/mod.rs

+33-34
Original file line numberDiff line numberDiff line change
@@ -5195,7 +5195,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
51955195
&self,
51965196
res: Res,
51975197
span: Span,
5198-
) -> Result<(DefKind, DefId, Ty<'tcx>), ErrorReported> {
5198+
) -> Result<Res, ErrorReported> {
51995199
let tcx = self.tcx;
52005200
if let Res::SelfCtor(impl_def_id) = res {
52015201
let ty = self.impl_self_ty(span, impl_def_id).ty;
@@ -5205,11 +5205,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
52055205
Some(adt_def) if adt_def.has_ctor() => {
52065206
let variant = adt_def.non_enum_variant();
52075207
let ctor_def_id = variant.ctor_def_id.unwrap();
5208-
Ok((
5209-
DefKind::Ctor(CtorOf::Struct, variant.ctor_kind),
5210-
ctor_def_id,
5211-
tcx.type_of(ctor_def_id),
5212-
))
5208+
Ok(Res::Def(DefKind::Ctor(CtorOf::Struct, variant.ctor_kind), ctor_def_id))
52135209
}
52145210
_ => {
52155211
let mut err = tcx.sess.struct_span_err(span,
@@ -5236,15 +5232,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
52365232
}
52375233
}
52385234
} else {
5239-
match res {
5240-
Res::Def(kind, def_id) => {
5241-
// The things we are substituting into the type should not contain
5242-
// escaping late-bound regions, and nor should the base type scheme.
5243-
let ty = tcx.type_of(def_id);
5244-
Ok((kind, def_id, ty))
5245-
}
5246-
_ => span_bug!(span, "unexpected res in rewrite_self_ctor: {:?}", res),
5247-
}
5235+
Ok(res)
52485236
}
52495237
}
52505238

@@ -5267,27 +5255,21 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
52675255

52685256
let tcx = self.tcx;
52695257

5270-
match res {
5271-
Res::Local(hid) | Res::Upvar(hid, ..) => {
5272-
let ty = self.local_ty(span, hid).decl_ty;
5273-
let ty = self.normalize_associated_types_in(span, &ty);
5274-
self.write_ty(hir_id, ty);
5275-
return (ty, res);
5276-
}
5277-
_ => {}
5278-
}
5279-
5280-
let (kind, def_id, ty) = match self.rewrite_self_ctor(res, span) {
5281-
Ok(result) => result,
5258+
let res = match self.rewrite_self_ctor(res, span) {
5259+
Ok(res) => res,
52825260
Err(ErrorReported) => return (tcx.types.err, res),
52835261
};
5284-
let path_segs =
5285-
AstConv::def_ids_for_value_path_segments(self, segments, self_ty, kind, def_id);
5262+
let path_segs = match res {
5263+
Res::Local(_) | Res::Upvar(..) => Vec::new(),
5264+
Res::Def(kind, def_id) =>
5265+
AstConv::def_ids_for_value_path_segments(self, segments, self_ty, kind, def_id),
5266+
_ => bug!("instantiate_value_path on {:?}", res),
5267+
};
52865268

52875269
let mut user_self_ty = None;
52885270
let mut is_alias_variant_ctor = false;
5289-
match kind {
5290-
DefKind::Ctor(CtorOf::Variant, _) => {
5271+
match res {
5272+
Res::Def(DefKind::Ctor(CtorOf::Variant, _), _) => {
52915273
if let Some(self_ty) = self_ty {
52925274
let adt_def = self_ty.ty_adt_def().unwrap();
52935275
user_self_ty = Some(UserSelfTy {
@@ -5297,8 +5279,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
52975279
is_alias_variant_ctor = true;
52985280
}
52995281
}
5300-
DefKind::Method
5301-
| DefKind::AssociatedConst => {
5282+
Res::Def(DefKind::Method, def_id)
5283+
| Res::Def(DefKind::AssociatedConst, def_id) => {
53025284
let container = tcx.associated_item(def_id).container;
53035285
debug!("instantiate_value_path: def_id={:?} container={:?}", def_id, container);
53045286
match container {
@@ -5338,6 +5320,17 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
53385320
None
53395321
}
53405322
}));
5323+
5324+
match res {
5325+
Res::Local(hid) | Res::Upvar(hid, ..) => {
5326+
let ty = self.local_ty(span, hid).decl_ty;
5327+
let ty = self.normalize_associated_types_in(span, &ty);
5328+
self.write_ty(hir_id, ty);
5329+
return (ty, res);
5330+
}
5331+
_ => {}
5332+
}
5333+
53415334
if generics_has_err {
53425335
// Don't try to infer type parameters when prohibited generic arguments were given.
53435336
user_self_ty = None;
@@ -5375,6 +5368,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
53755368
tcx.generics_of(*def_id).has_self
53765369
}).unwrap_or(false);
53775370

5371+
let def_id = res.def_id();
5372+
5373+
// The things we are substituting into the type should not contain
5374+
// escaping late-bound regions, and nor should the base type scheme.
5375+
let ty = tcx.type_of(def_id);
5376+
53785377
let substs = AstConv::create_substs_for_generic_args(
53795378
tcx,
53805379
def_id,
@@ -5491,7 +5490,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
54915490
ty_substituted);
54925491
self.write_substs(hir_id, substs);
54935492

5494-
(ty_substituted, Res::Def(kind, def_id))
5493+
(ty_substituted, res)
54955494
}
54965495

54975496
fn check_rustc_args_require_const(&self,

src/librustdoc/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ name = "rustdoc"
99
path = "lib.rs"
1010

1111
[dependencies]
12-
pulldown-cmark = { version = "0.4.1", default-features = false }
12+
pulldown-cmark = { version = "0.5.2", default-features = false }
1313
minifier = "0.0.30"
1414
tempfile = "3"
1515
parking_lot = "0.7"

src/librustdoc/html/markdown.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -351,9 +351,11 @@ impl<'a, 'b, 'ids, I: Iterator<Item = Event<'a>>> Iterator for HeadingLinks<'a,
351351
if let Some(Event::Start(Tag::Header(level))) = event {
352352
let mut id = String::new();
353353
for event in &mut self.inner {
354-
match event {
354+
match &event {
355355
Event::End(Tag::Header(..)) => break,
356-
Event::Text(ref text) => id.extend(text.chars().filter_map(slugify)),
356+
Event::Text(text) | Event::Code(text) => {
357+
id.extend(text.chars().filter_map(slugify));
358+
}
357359
_ => {},
358360
}
359361
self.buf.push_back(event);
@@ -402,7 +404,6 @@ fn check_if_allowed_tag(t: &Tag<'_>) -> bool {
402404
| Tag::Item
403405
| Tag::Emphasis
404406
| Tag::Strong
405-
| Tag::Code
406407
| Tag::Link(..)
407408
| Tag::BlockQuote => true,
408409
_ => false,
@@ -790,9 +791,8 @@ pub fn plain_summary_line_full(md: &str, limit_length: bool) -> String {
790791
let next_event = next_event.unwrap();
791792
let (ret, is_in) = match next_event {
792793
Event::Start(Tag::Paragraph) => (None, 1),
793-
Event::Start(Tag::Code) => (Some("`".to_owned()), 1),
794-
Event::End(Tag::Code) => (Some("`".to_owned()), -1),
795794
Event::Start(Tag::Header(_)) => (None, 1),
795+
Event::Code(code) => (Some(format!("`{}`", code)), 0),
796796
Event::Text(ref s) if self.is_in > 0 => (Some(s.as_ref().to_owned()), 0),
797797
Event::End(Tag::Paragraph) | Event::End(Tag::Header(_)) => (None, -1),
798798
_ => (None, 0),

src/libstd/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ libc = { version = "0.2.51", default-features = false, features = ['rustc-dep-of
2222
compiler_builtins = { version = "0.1.14" }
2323
profiler_builtins = { path = "../libprofiler_builtins", optional = true }
2424
unwind = { path = "../libunwind" }
25-
hashbrown = { version = "0.3.0", features = ['rustc-dep-of-std'] }
25+
hashbrown = { version = "0.4.0", features = ['rustc-dep-of-std'] }
2626
rustc-demangle = { version = "0.1.10", features = ['rustc-dep-of-std'] }
2727
backtrace-sys = { version = "0.1.24", features = ["rustc-dep-of-std"], optional = true }
2828

src/libsyntax/parse/parser.rs

+11-7
Original file line numberDiff line numberDiff line change
@@ -888,10 +888,10 @@ impl<'a> Parser<'a> {
888888
}
889889
_ => {
890890
Err(if self.prev_token_kind == PrevTokenKind::DocComment {
891-
self.span_fatal_err(self.prev_span, Error::UselessDocComment)
892-
} else {
893-
self.expected_ident_found()
894-
})
891+
self.span_fatal_err(self.prev_span, Error::UselessDocComment)
892+
} else {
893+
self.expected_ident_found()
894+
})
895895
}
896896
}
897897
}
@@ -2039,8 +2039,8 @@ impl<'a> Parser<'a> {
20392039
path = self.parse_path(PathStyle::Type)?;
20402040
path_span = path_lo.to(self.prev_span);
20412041
} else {
2042-
path = ast::Path { segments: Vec::new(), span: syntax_pos::DUMMY_SP };
20432042
path_span = self.span.to(self.span);
2043+
path = ast::Path { segments: Vec::new(), span: path_span };
20442044
}
20452045

20462046
// See doc comment for `unmatched_angle_bracket_count`.
@@ -3357,7 +3357,11 @@ impl<'a> Parser<'a> {
33573357
// want to keep their span info to improve diagnostics in these cases in a later stage.
33583358
(true, Some(AssocOp::Multiply)) | // `{ 42 } *foo = bar;` or `{ 42 } * 3`
33593359
(true, Some(AssocOp::Subtract)) | // `{ 42 } -5`
3360-
(true, Some(AssocOp::Add)) => { // `{ 42 } + 42
3360+
(true, Some(AssocOp::LAnd)) | // `{ 42 } &&x` (#61475)
3361+
(true, Some(AssocOp::Add)) // `{ 42 } + 42
3362+
// If the next token is a keyword, then the tokens above *are* unambiguously incorrect:
3363+
// `if x { a } else { b } && if y { c } else { d }`
3364+
if !self.look_ahead(1, |t| t.is_reserved_ident()) => {
33613365
// These cases are ambiguous and can't be identified in the parser alone
33623366
let sp = self.sess.source_map().start_point(self.span);
33633367
self.sess.ambiguous_block_expr_parse.borrow_mut().insert(sp, lhs.span);
@@ -5848,7 +5852,7 @@ impl<'a> Parser<'a> {
58485852
let mut where_clause = WhereClause {
58495853
id: ast::DUMMY_NODE_ID,
58505854
predicates: Vec::new(),
5851-
span: syntax_pos::DUMMY_SP,
5855+
span: self.prev_span.to(self.prev_span),
58525856
};
58535857

58545858
if !self.eat_keyword(keywords::Where) {

0 commit comments

Comments
 (0)