Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
202 commits
Select commit Hold shift + click to select a range
17eddd4
Misc. `fmt_type` cleanups
yotamofek Jun 7, 2026
59ce79b
cleanup `FlushSubnormals` implementation
folkertdev Jul 4, 2026
6242e73
Use a faster formulation of swizzle_dyn_precise on AVX-512 VBMI.
Shnatsel Jul 30, 2026
ad8134f
Merge pull request portable-simd#545 from Shnatsel/swizzle-dyn-avx512
programmerjake Jul 30, 2026
1cb81f8
Merge pull request #538 from folkertdev/cleanup-flush-subnormals
calebzulawski Aug 28, 2026
e0ffcc6
Install cargo tools with locked dependencies
konstin Aug 20, 2026
96897c6
Merge pull request portable-simd#547 from konstin/konsti/cargo-instal…
programmerjake Aug 28, 2026
269d780
Use a more optimal formulation of swizzle_dyn for AVX2
Shnatsel Aug 29, 2026
ead325d
Merge pull request #548 from Shnatsel/faster-avx2-swizzle
calebzulawski Sep 1, 2026
aabc2df
Remove outdated windows-gnu test ignores
mati865 Sep 9, 2026
db29b79
Switch the default branch to main
Kobzol Sep 16, 2026
057493b
Merge pull request #549 from Kobzol/switch-to-main
ubiratansoares Sep 16, 2026
46b5af2
remove LLVM workaround
malezjaa Oct 14, 2026
41b0783
ci: Pin `actions/checkout` to 4.4.0 hash
hashcatHitman Oct 24, 2026
dbf7d1e
ci: Pin `peaceiris/actions-gh-pages` to 3.9.3 hash
hashcatHitman Oct 24, 2026
d8e5ef0
ci: Pin `taiki-e/install-action` to 2.87.31 hash
hashcatHitman Oct 24, 2026
d1781c3
ci: Disable credential persistence
hashcatHitman Oct 24, 2026
df35988
ci: Expand `matrix.target` in `env`
hashcatHitman Oct 24, 2026
d2bff3c
ci: Expand `matrix.target_feature` in `env`
hashcatHitman Oct 24, 2026
fb065b7
ci: Expand `matrix.shard` in `env`
hashcatHitman Oct 24, 2026
abfbb71
ci: Disable all permissions by default
hashcatHitman Oct 24, 2026
2ef9513
ci: Set the default shell to `bash`
hashcatHitman Oct 24, 2026
d04b237
ci: Grant minimum required permissions
hashcatHitman Oct 24, 2026
db420d1
Merge pull request #551 from malezjaa/remove-workaround-for-llvm
calebzulawski Oct 24, 2026
4825e5f
Use trusted pointee types in lgamma shims
darkraider01 Oct 24, 2026
b2a1832
Use the checked pointer type for TCP FIONBIO
darkraider01 Oct 24, 2026
a4c2773
Fix round docs
calebzulawski Oct 24, 2026
fe057c5
Fix ord operations on masks
calebzulawski Oct 25, 2026
ac0cad3
use deref_pointer instead of deref_pointer_as in unix/foreign_items.rs
mehmettoplu-rs Oct 25, 2026
fa0cf88
Add windows workaround
calebzulawski Oct 25, 2026
56cad56
Merge pull request #554 from rust-lang/fix-round-docs
programmerjake Oct 25, 2026
655b455
Update src/shims/unix/foreign_items.rs
mehmettoplu-rs Oct 25, 2026
8195e4f
use deref_pointer instead of deref_pointer_as in unix sync shims
programskillforverification Oct 24, 2026
f87f855
use deref_pointer instead of deref_pointer_as
programskillforverification Oct 25, 2026
39c8950
Merge pull request #553 from hashcatHitman/zizmor
calebzulawski Oct 25, 2026
d3a3a26
Merge pull request #5480 from programskillforverification/deref-point…
RalfJung Oct 25, 2026
bf5d406
Merge pull request #5481 from programskillforverification/deref-point…
RalfJung Oct 25, 2026
d8e5d00
retire the arm32 CI job
RalfJung Oct 25, 2026
ab82fcd
Merge pull request #5482 from mehmettoplu-rs/deref-pointer-unix-forei…
RalfJung Oct 25, 2026
8ae73fb
socket-tcp tests: give freebsd VM more time to yield
RalfJung Oct 25, 2026
d11f41f
use fixed-schedule and run-native in a few more tests
RalfJung Oct 25, 2026
fdf9ded
ensure that pthread_(mutex,cond)attr_t are initialized
RalfJung Oct 25, 2026
7cc5c73
freebsd seems to always wake up at least one thread
RalfJung Oct 25, 2026
d81e811
macos wait_on_address: remove OS_SYNC_WAIT_ON_ADDRESS_SHARED support
RalfJung Oct 25, 2026
e215be2
Merge pull request #5487 from RalfJung/test-schedules
RalfJung Oct 25, 2026
210ee03
reorganize the logic of which targets get how much test coverage
RalfJung Oct 25, 2026
21deb4f
Merge pull request #5488 from RalfJung/arm32-nomore
RalfJung Oct 25, 2026
664fc09
Merge pull request #555 from rust-lang/mask-ord
calebzulawski Oct 26, 2026
599e4b1
use deref_pointer instead of deref_pointer_as
programskillforverification Oct 26, 2026
fd71a95
add back i686-pc-windows-msvc tests
RalfJung Oct 26, 2026
7fe0de8
test benchmarks on more targets
RalfJung Oct 26, 2026
35489bb
run float tests natively
RalfJung Oct 26, 2026
0443fdf
make mse benchmark work on big-endian
RalfJung Oct 26, 2026
5b347ae
float test can only work with enough f16/f128 support
RalfJung Oct 26, 2026
0aa8efa
Merge pull request #5490 from RalfJung/ci
RalfJung Oct 26, 2026
33ea505
Merge pull request #5483 from darkraider01/math
RalfJung Oct 26, 2026
bed2fac
Merge pull request #5484 from darkraider01/tcp
RalfJung Oct 26, 2026
892dbb1
Merge pull request #5491 from RalfJung/float-tests
RalfJung Oct 26, 2026
3828f39
Prepare for merging from rust-lang/rust
RalfJung Oct 26, 2026
4a52704
Merge ref 'aaf324d50a7d' from rust-lang/rust
RalfJung Oct 26, 2026
08cdf6b
Merge pull request #5495 from RalfJung/rustup
RalfJung Oct 26, 2026
f6025d8
float native testing: fix cfg
RalfJung Oct 26, 2026
5a5b55a
we do not actually need the ports mirrors currently
RalfJung Oct 26, 2026
5dfc6a6
Merge pull request #5498 from RalfJung/ports-mirrors
RalfJung Oct 26, 2026
4ce4bb9
linux-futex: add a bit more wait time slack
RalfJung Oct 26, 2026
de141e0
Merge pull request #5496 from RalfJung/float-native
RalfJung Oct 26, 2026
de4a9db
Add libc direct tests for pread64, pwrite64, lseek and lseek64
mehmettoplu-rs Oct 22, 2026
2c397b9
CI: move the solaris test
RalfJung Oct 27, 2026
0f5c8dd
Merge pull request #5469 from mehmettoplu-rs/test-offset-64
RalfJung Oct 27, 2026
49e14fd
Merge pull request #5502 from RalfJung/ci
RalfJung Oct 27, 2026
f225f6a
use errno_check and errno_result in random
josetorrs Oct 22, 2026
f4a6d1c
Merge pull request #5460 from josetorrs/use-errno-in-random
RalfJung Oct 27, 2026
b374b3b
use deref_pointer instead of deref_pointer_as
mehmettoplu-rs Oct 27, 2026
184c45a
return proper error on invalid FD numbers in dup
RalfJung Oct 27, 2026
cdf35cb
Merge pull request #5506 from RalfJung/fd-num-validity
RalfJung Oct 27, 2026
84b4c08
Merge pull request #5492 from programskillforverification/deref-point…
RalfJung Oct 27, 2026
af6f181
use deref_pointer instead of deref_pointer_as
programskillforverification Oct 28, 2026
4b8cd4a
revert dispatch semaphore changes
mehmettoplu-rs Oct 28, 2026
9b90971
Merge pull request #5505 from mehmettoplu-rs/deref-pointer-macos-sync
RalfJung Oct 28, 2026
234870b
Merge pull request #5508 from programskillforverification/deref-point…
RalfJung Oct 28, 2026
0956c58
Use trusted pointee types in virtual socket shims
darkraider01 Oct 28, 2026
8814698
Merge pull request #5510 from darkraider01/deref-pointer-virtual-socket
RalfJung Oct 28, 2026
df20c6f
adjust how we handle c-style arrays
RalfJung Oct 28, 2026
5aa759b
Merge pull request #5512 from RalfJung/c-arrays
RalfJung Oct 28, 2026
41dd3ec
Prepare for merging from rust-lang/rust
Oct 29, 2026
78e8fab
Merge ref '92ffebeceaa0' from rust-lang/rust
Oct 29, 2026
3304e1b
Merge pull request #5513 from rust-lang/rustup-2026-10-29
RalfJung Oct 29, 2026
0a2b28d
replace some this → ecx
RalfJung Oct 29, 2026
734bb76
Merge pull request #5514 from RalfJung/ecx
RalfJung Oct 29, 2026
64e0eb2
Use trusted pointee types in socket address shims
darkraider01 Oct 28, 2026
1fa4513
Remove deref_pointer_as helper
darkraider01 Oct 29, 2026
0cbd5f6
Merge pull request #5511 from darkraider01/deref-pointer-socket-address
RalfJung Oct 29, 2026
f441736
Add direct libc tests for mkdir and rmdir
eduardorittner Oct 22, 2026
e1cd26c
Prepare for merging from rust-lang/rust
Oct 30, 2026
6bb08c3
Merge ref '92b5b8c87c61' from rust-lang/rust
Oct 30, 2026
8817e5b
remove stabilized feature
RalfJung Oct 30, 2026
eca64fd
cargo update
RalfJung Oct 30, 2026
4a75e84
detect when 'exit' is called more than once
RalfJung Oct 30, 2026
81d71b4
Merge pull request #5519 from rust-lang/rustup-2026-10-30
RalfJung Oct 30, 2026
479acc7
Merge pull request #5521 from RalfJung/cargo-update
RalfJung Oct 30, 2026
9dd16b1
Implement `Duration::display_seconds`
frank-king Oct 30, 2026
00f3ea7
Add shared non-blocking socket tests, implement `ioctl` using `fcntl`
WhySoBad Oct 26, 2026
455b5db
Merge pull request #5468 from eduardorittner/test-dir-ops
RalfJung Oct 30, 2026
78bb6a8
Merge pull request #5497 from WhySoBad/udp-ioctl
RalfJung Oct 30, 2026
544faa8
return EINVAL to avoid ICE
programskillforverification Oct 30, 2026
ce01075
tweak test and add one for read as well
RalfJung Oct 31, 2026
8cb4e98
Merge pull request #5524 from programskillforverification/readv-write…
RalfJung Oct 31, 2026
7a1e8cf
add support for libc::pause
RalfJung Oct 31, 2026
48e8c79
Merge pull request #5525 from RalfJung/pause
RalfJung Oct 31, 2026
6ca69b5
ci: Pin `actions/checkout` to 6.1.0 hash
hashcatHitman Oct 30, 2026
3cc5569
ci: Pin `actions/cache` to 5.1.0 hash
hashcatHitman Oct 30, 2026
ac7f376
ci: Pin `actions/upload-artifact` to 7.0.2 hash
hashcatHitman Oct 30, 2026
163e212
ci: Pin `actions/download-artifact` to 8.0.2 hash
hashcatHitman Oct 30, 2026
3d9d957
ci: Pin `actions/create-github-app-token` to 3.3.0 hash
hashcatHitman Oct 30, 2026
3da6f2d
ci: Pin `vmactions/freebsd-vm` to 1.5.9 hash
hashcatHitman Oct 30, 2026
918f0a7
ci: Disable credential persistence
hashcatHitman Oct 30, 2026
92743af
ci: Use dedicated self-repository syntax
hashcatHitman Oct 30, 2026
b24e3d0
ci: Move permissions documentation
hashcatHitman Oct 30, 2026
6f19d79
ci: Expand `inputs.toolchain_flags` in `env`
hashcatHitman Oct 30, 2026
dcae5c9
ci: Expand `github.event_name` in `env`
hashcatHitman Oct 30, 2026
028b636
ci: Expand `matrix.gcc_cross` in `env`
hashcatHitman Oct 30, 2026
61ec13c
ci: Prefer shell expansion for `matrix.host_target`
hashcatHitman Oct 30, 2026
f60f05c
ci: Expand `matrix.multiarch` in `env`
hashcatHitman Oct 30, 2026
ebbe7e5
ci: Expand `toJson(needs)` in `env`
hashcatHitman Oct 30, 2026
38453bf
genmc: Fix GenMC API for RMWs
michaliskok Oct 31, 2026
e70f72d
genmc: Do not truncate integers returned by GenMC
Oct 28, 2026
fb60d17
Enable MacOS support for GenMC mode.
Patrick-6 Sep 5, 2025
9293708
ci: Restrict GitHub app token permissions
hashcatHitman Oct 31, 2026
6c35669
Merge pull request #5522 from hashcatHitman/zizmor
RalfJung Oct 31, 2026
9f41e8f
genmc: Update the documented compiler requirements
michaliskok Oct 31, 2026
39ee16a
genmc/build: Update GenMC to v0.20.0
michaliskok Oct 31, 2026
983461b
Merge pull request #5527 from michaliskok/genmc-rmw-and-macos-fixes
RalfJung Oct 31, 2026
f35c100
run a bunch more tests natively
RalfJung Oct 31, 2026
7a3797b
Merge pull request #5530 from RalfJung/native
RalfJung Oct 31, 2026
2d34e1b
rustdoc: Qualify all `ItemKind` variants with `ItemKind`
fmease Oct 2, 2026
ed7cbf4
rustdoc: Drop `Item` suffix from all `ItemKind` variants
fmease Sep 17, 2026
e384d7b
Introduce helper `ItemKind::unstripped`
fmease Oct 11, 2026
a3612ea
rustdoc: Collapse `ProvidedAssocConstant` & `ImplAssocConstant` into …
fmease Sep 17, 2026
8b1d9a1
rustdoc: Consolidate `RequiredAssocConstant` & `AssocConstant`
fmease Sep 17, 2026
6752475
rustdoc: Remove unnecessary abstraction `AssocConstValue`
fmease Sep 17, 2026
e2b1c8a
rustdoc: Collapse `RequiredAssocFunction` & `AssocFunction`
fmease Sep 17, 2026
9fbd7a8
rustdoc: Collapse `RequiredAssocType` & `AssocType`
fmease Sep 17, 2026
9ef3bc0
rustdoc: Reduce rightward drift in `render_impl`
fmease Oct 8, 2026
7f1a9e9
replace sync obj by more general meta obj mechanism
RalfJung Oct 31, 2026
09000be
make pthread_mutexattr, pthread_condattr also opaque meta objs
RalfJung Nov 1, 2026
69f9fe1
socket_address: ptr_to_mplace is more clear than .offset here
RalfJung Nov 1, 2026
80f45ee
Merge pull request #5531 from RalfJung/meta-obj
RalfJung Nov 1, 2026
b239c81
ci: Allow manual dispatch of `cron-rustc-pull`
hashcatHitman Nov 1, 2026
d1a39d4
ci: Configure `git` to use the app token in `cron-rustc-pull`
hashcatHitman Nov 1, 2026
fc9518d
Prepare for merging from rust-lang/rust
RalfJung Nov 1, 2026
2023805
Merge ref '349bba62f183' from rust-lang/rust
RalfJung Nov 1, 2026
4c06fe4
Merge pull request #5520 from RalfJung/exit-twice
RalfJung Nov 1, 2026
21af5c4
silence an incorrect clippy lint
RalfJung Nov 1, 2026
f941d77
update CONTRIBUTING guidance regarding force pushes
RalfJung Oct 31, 2026
6c1e1a2
Merge pull request #5539 from hashcatHitman/fix-rustc-pull
RalfJung Nov 1, 2026
e44dc45
fix time accounting in a futex test
RalfJung Nov 1, 2026
8cf4179
Merge pull request #5538 from RalfJung/rustup
RalfJung Nov 1, 2026
27ad6be
Tweak "value not found" error to show more context
estebank Oct 4, 2026
4d5ce17
Show item when mentioning field
estebank Oct 4, 2026
49b87db
Avoid unnecessary matching
estebank Nov 2, 2026
a5bdfc0
Tweak stmt macro expansion in expression context
estebank Aug 13, 2026
b58387e
Reword message
estebank Nov 2, 2026
024eb50
Merge pull request #5528 from RalfJung/force-pushes
RalfJung Nov 2, 2026
815b602
fix permission bits reported by stat on non-Unix hosts
programskillforverification Nov 1, 2026
221d21e
expand more of the tests
RalfJung Nov 2, 2026
8eb247e
Merge pull request #5536 from programskillforverification/fix-windows…
RalfJung Nov 2, 2026
42a6ec6
add issue reference for why we have GVN disabled
RalfJung Nov 2, 2026
54f781d
Merge pull request #5542 from RalfJung/gvn-comment
RalfJung Nov 2, 2026
9d3b644
Initial josh-sync configuration
Kobzol Nov 2, 2026
2e55898
Prepare for merging from rust-lang/rust
Kobzol Nov 2, 2026
e293557
Merge ref '3e92e1a2d20b' (nightly-2026-11-02) from rust-lang/rust
Kobzol Nov 2, 2026
72c8c55
Fix Cargo lint
Kobzol Oct 19, 2026
afccefc
Fix deprecation lint
Kobzol Sep 21, 2026
a76fdc7
Merge pull request #550 from Kobzol/first-josh-pull
programmerjake Nov 2, 2026
4650447
fix futex implementations skipping SC fence
RalfJung Nov 2, 2026
22e9eb3
Be clearer on origin of assoc item in the code
estebank Nov 2, 2026
8759806
Add regression test for issue 156423
LorenzoTettamanti Oct 23, 2026
c40e039
shims/fs test: also call stream_position
RalfJung Nov 2, 2026
9087481
another case of wrong time accounting
RalfJung Nov 2, 2026
b83e84c
Merge pull request #5546 from RalfJung/test-stream-position
RalfJung Nov 2, 2026
a201f04
Merge pull request #5545 from RalfJung/futex-sc-fence
RalfJung Nov 2, 2026
740523c
update lockfile
RalfJung Nov 2, 2026
35094d2
Factorize and add glob paths checking for `[autolabel]` `trigger_files`
Urgau Oct 27, 2026
1d05550
Add regression test for associated const equality param out of range ICE
zakrad Nov 2, 2026
46cff54
Autolabel library modules
clarfonthey Oct 27, 2026
ce2305e
add TrySendError::into_inner
malezjaa Nov 2, 2026
bd7601b
Refine multiline check in suggest_missing_semicolon_before_array
hu-jeff Aug 17, 2026
b19e1b7
Add FIXMEs to `recover_from_missing_semicolon_before_array`
fmease Nov 2, 2026
1971ad0
Move `recover_from_missing_semicolon_before_array`
fmease Nov 2, 2026
35d6a99
Rollup merge of #165331 - RalfJung:miri, r=RalfJung
JonathanBrouwer Nov 2, 2026
10a2314
Rollup merge of #165356 - folkertdev:portable-simd-2026-11-02, r=folk…
JonathanBrouwer Nov 2, 2026
dec8a6d
Rollup merge of #162916 - fmease:rustdoc-better-item-kinds, r=lolbina…
JonathanBrouwer Nov 2, 2026
bf132d1
Rollup merge of #161035 - estebank:issue-30597, r=fmease
JonathanBrouwer Nov 2, 2026
fd447b9
Rollup merge of #163762 - estebank:not-found-tweak, r=fmease
JonathanBrouwer Nov 2, 2026
c0c24b4
Rollup merge of #164786 - LorenzoTettamanti:main, r=nikic
JonathanBrouwer Nov 2, 2026
61c0c07
Rollup merge of #165103 - malezjaa:try-send-error-into-inner, r=Mark-…
JonathanBrouwer Nov 2, 2026
c23b4f3
Rollup merge of #157584 - yotamofek:pr/rustdoc/misc-fmt_type-cleanups…
JonathanBrouwer Nov 2, 2026
df02bb3
Rollup merge of #161207 - hu-jeff:fix-comma-indexing-expression, r=fm…
JonathanBrouwer Nov 2, 2026
f76930f
Rollup merge of #162070 - zakrad:regr-test-145824, r=fmease
JonathanBrouwer Nov 2, 2026
7a5f929
Rollup merge of #162537 - mati865:delete-outdated-mingw-ignores, r=fm…
JonathanBrouwer Nov 2, 2026
b71140a
Rollup merge of #165015 - clarfonthey:autolabel-libs, r=clarfonthey,U…
JonathanBrouwer Nov 2, 2026
9aab48c
Rollup merge of #165181 - frank-king:feat/duration-display-seconds, r…
JonathanBrouwer Nov 2, 2026
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
1 change: 0 additions & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2562,7 +2562,6 @@ dependencies = [
"ipc-channel",
"libc",
"libffi",
"libffi-sys",
"libloading",
"measureme",
"mio",
Expand Down
24 changes: 14 additions & 10 deletions compiler/rustc_expand/src/mbe/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,18 +408,22 @@ pub(super) fn emit_frag_parse_err(
Err(err) => err.cancel(),
Ok(_) => {
e.note(
"the macro call doesn't expand to an expression, but it can expand to a statement",
"the macro call doesn't expand to an expression, but it can expand to a \
statement",
);

if parser.token == token::Semi {
if let Ok(snippet) = parser.psess.source_map().span_to_snippet(site_span) {
e.span_suggestion_verbose(
site_span,
"surround the macro invocation with `{}` to interpret the expansion as a statement",
format!("{{ {snippet}; }}"),
Applicability::MaybeIncorrect,
);
}
if parser.token == token::Semi
|| matches!(parser.token.kind, token::TokenKind::OpenInvisible(_))
{
e.multipart_suggestion(
"invoke the macro in a new block with a single statement to interpret the \
expansion as a statement",
vec![
(site_span.shrink_to_lo(), "{ ".to_string()),
(site_span.shrink_to_hi(), "; }".to_string()),
],
Applicability::MaybeIncorrect,
);
} else {
e.span_suggestion_verbose(
site_span.shrink_to_hi(),
Expand Down
44 changes: 1 addition & 43 deletions compiler/rustc_parse/src/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,7 @@ impl<'a> Parser<'a> {
let open_delim_span = self.token.span;
self.bump(); // `[`
let index = self.parse_expr()?;
self.suggest_missing_semicolon_before_array(prev_token.span, open_delim_span)?;
self.recover_from_missing_semicolon_before_array(prev_token.span, open_delim_span)?;
self.expect(exp!(CloseBracket)).map_err(|mut err| {
if prev_token.is_non_reserved_ident() {
err.span_suggestion_verbose(
Expand Down Expand Up @@ -2135,48 +2135,6 @@ impl<'a> Parser<'a> {
}
}

fn suggest_missing_semicolon_before_array(
&self,
prev_span: Span,
open_delim_span: Span,
) -> PResult<'a, ()> {
if !self.may_recover() {
return Ok(());
}

if self.token == token::Comma {
if !self.psess.source_map().is_multiline(prev_span.until(self.token.span)) {
return Ok(());
}
let mut snapshot = self.create_snapshot_for_diagnostic();
snapshot.bump();
match snapshot.parse_seq_to_before_end(
exp!(CloseBracket),
SeqSep::trailing_allowed(exp!(Comma)),
|p| p.parse_expr(),
) {
Ok(_)
// When the close delim is `)`, `token.kind` is expected to be `token::CloseParen`,
// but the actual `token.kind` is `token::CloseBracket`.
// This is because the `token.kind` of the close delim is treated as the same as
// that of the open delim in `TokenTreesReader::parse_token_tree`, even if the delimiters of them are different.
// Therefore, `token.kind` should not be compared here.
if snapshot
.span_to_snippet(snapshot.token.span)
.is_ok_and(|snippet| snippet == "]") =>
{
return Err(self.dcx().create_err(crate::diagnostics::MissingSemicolonBeforeArray {
open_delim: open_delim_span,
semicolon: prev_span.shrink_to_hi(),
}));
}
Ok(_) => (),
Err(err) => err.cancel(),
}
}
Ok(())
}

/// Parses a block or unsafe block.
pub(super) fn parse_expr_block(
&mut self,
Expand Down
56 changes: 55 additions & 1 deletion compiler/rustc_parse/src/parser/expr/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use rustc_ast_pretty::pprust;
use rustc_errors::{Applicability, Diag, PResult};
use rustc_span::{Span, Spanned, respan, sym};

use crate::parser::Parser;
use crate::parser::{Parser, SeqSep};
use crate::{diagnostics, exp};

impl<'a> Parser<'a> {
Expand Down Expand Up @@ -294,6 +294,60 @@ impl<'a> Parser<'a> {
}
}
}

pub(super) fn recover_from_missing_semicolon_before_array(
&self,
prev_span: Span,
open_delim_span: Span,
) -> PResult<'a, ()> {
if !self.may_recover()
|| self.token != token::Comma
// Only make this suggestion if the `[` is not on the same line as the last token of
// the expression preceding it, which is a sign that it is not intended as an
// index expression.
|| !self.psess.source_map().is_multiline(prev_span.until(open_delim_span))
{
return Ok(());
}

let mut snapshot = self.create_snapshot_for_diagnostic();
snapshot.bump();
match snapshot.parse_seq_to_before_end(
exp!(CloseBracket),
SeqSep::trailing_allowed(exp!(Comma)),
|p| p.parse_expr(),
) {
Ok(_)
// When the close delim is `)`, `token.kind` is expected to be `token::CloseParen`,
// but the actual `token.kind` is `token::CloseBracket`. This is because the
// `token.kind` of the close delim is treated as the same as that of the open delim
// in `TokenTreesReader::parse_token_tree`, even if the delimiters of them are
// different. Therefore, `token.kind` should not be compared here.
if snapshot
.span_to_snippet(snapshot.token.span)
.is_ok_and(|snippet| snippet == "]") =>
{
// FIXME: This is way to assertive for a diagnostic with so many false positives!
// Just `expect(Comma)` and modify the diagnostic with a note that says sth.
// along the lines of "consider adding a `;` here if you meant the `[...]` to
// denote an array instead of an index".
// FIXME: In most cases there certainly isn't a "missing `;`". E.g., if we're nested
// in an expression like `(x[y, z])` or `match x[y, z] {}`. Requiring that
// we're not under `Restriction::STMT_EXPR` isn't sufficient by the way since
// we could still be part of a match arm body *and* it would prevent us from
// suggesting a `;` in cases like `let x = y[z, w];`.
Err(self.dcx().create_err(crate::diagnostics::MissingSemicolonBeforeArray {
open_delim: open_delim_span,
semicolon: prev_span.shrink_to_hi(),
}))
}
Ok(_) => Ok(()),
Err(err) => {
err.cancel();
Ok(())
}
}
}
}

/// Whether this operator could be used to follow a complete statement expression unambiguously
Expand Down
11 changes: 9 additions & 2 deletions compiler/rustc_resolve/src/late.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5144,10 +5144,17 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
partial_res
}

fn self_type_is_available(&mut self) -> bool {
fn self_type_is_available(&mut self) -> Option<DefId> {
let binding = self
.maybe_resolve_ident_in_lexical_scope(Ident::with_dummy_span(kw::SelfUpper), TypeNS);
if let Some(LateDecl::RibDef(res)) = binding { res != Res::Err } else { false }
if let Some(LateDecl::RibDef(
Res::SelfTyAlias { alias_to, .. } | Res::SelfTyParam { trait_: alias_to },
)) = binding
{
Some(alias_to)
} else {
None
}
}

fn self_value_is_available(&mut self, self_span: Span) -> bool {
Expand Down
Loading
Loading