Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull upstream master 2023 10 12 #48

Merged
merged 654 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
654 commits
Select commit Hold shift + click to select a range
5048f81
fix to register analysis pass from llvm plugin
van-ema Oct 6, 2023
bf1356e
Fix problems of Reserved -> Frozen
Vanille-N Sep 20, 2023
dcc4001
Fix `items_after_test_module` for non root modules, add applicable su…
Alexendoo Oct 4, 2023
7654d4b
compiler: always use var_os("RUST_BACKTRACE")
tamird Oct 6, 2023
2753052
compiler: always use var_os("RUST_BACKTRACE")
tamird Oct 6, 2023
a081007
rustc_driver: avoid fallible conversions
tamird Oct 6, 2023
e1e880e
Do not use host floats in `simd_{ceil,floor,round,trunc}`
eduardosm Oct 6, 2023
48d2770
Improve `redundant_locals` help message
koka831 Oct 6, 2023
5aeb6a3
rustc_codegen_ssa: use try_canonicalize in rpath
tamird Oct 6, 2023
3cac3de
rustc_metadata: use try_canonicalize
tamird Oct 6, 2023
279127c
Auto merge of #11611 - Alexendoo:items-after-test-module-check-crate,…
bors Oct 6, 2023
64fa0c3
Auto merge of #115304 - Enselic:trailing-gt, r=cjgillot
bors Oct 6, 2023
3c511bb
Auto merge of #3067 - Vanille-N:spurious-incremental, r=RalfJung
bors Oct 6, 2023
7217c0f
Auto merge of #11628 - koka831:fix/11625, r=blyxyas
bors Oct 6, 2023
82c3064
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Oct 6, 2023
50754da
Bump nightly version -> 2023-10-06
flip1995 Oct 6, 2023
b8677e5
Bump Clippy version -> 0.1.75
flip1995 Oct 6, 2023
b105fb4
Auto merge of #11629 - flip1995:rustup, r=flip1995
bors Oct 6, 2023
3c8c3ad
Merge commit 'b105fb4c39bc1a010807a6c076193cef8d93c109' into clippyup
flip1995 Oct 6, 2023
375ff3e
Auto merge of #3110 - eduardosm:rounding-without-host-floats, r=RalfJung
bors Oct 6, 2023
27d6a57
Preserve DebugInfo in DeadStoreElimination.
cjgillot Jan 12, 2023
b704697
Bless incremental tests.
cjgillot Sep 26, 2023
6233d44
Update Cargo.lock
flip1995 Oct 6, 2023
4483ac2
Fix windows test that has different stderr output
estebank Oct 5, 2023
ea56007
Preparing for merge from rustc
RalfJung Oct 6, 2023
100ea2b
Merge from rustc
RalfJung Oct 6, 2023
3b08930
Auto merge of #3112 - RalfJung:rustup, r=RalfJung
bors Oct 6, 2023
fa248cd
add some comments explaining how the required_consts stuff fits together
RalfJung Oct 6, 2023
31be8cc
Auto merge of #116489 - flip1995:clippyup, r=Manishearth
bors Oct 6, 2023
3706e6f
Use `io_error_more` on WASI
ShE3py Oct 6, 2023
94bc9c7
Auto merge of #114811 - estebank:impl-ambiguity, r=wesleywiser
bors Oct 6, 2023
4dfa5e5
Rollup merge of #114564 - scottmcm:when-to-from, r=dtolnay
matthiaskrgr Oct 6, 2023
fdb136a
Rollup merge of #116297 - RalfJung:hooks, r=oli-obk
matthiaskrgr Oct 6, 2023
81192f2
Rollup merge of #116423 - eltociear:patch-22, r=flip1995
matthiaskrgr Oct 6, 2023
25fbd13
Rollup merge of #116466 - nnethercote:rustc_transmute, r=oli-obk
matthiaskrgr Oct 6, 2023
9796dfd
Rollup merge of #116474 - nnethercote:rustc_assorted, r=spastorino
matthiaskrgr Oct 6, 2023
f8dae0c
Rollup merge of #116481 - scottmcm:tweak-combinators, r=cuviper
matthiaskrgr Oct 6, 2023
7f0cf8c
Rollup merge of #116484 - peterjoel:once-doc-clarify, r=cuviper
matthiaskrgr Oct 6, 2023
4ea6e7f
Rename `flag` to `arg`
Kobzol Oct 6, 2023
9607540
Auto merge of #116492 - matthiaskrgr:rollup-xzfhmq1, r=matthiaskrgr
bors Oct 6, 2023
91114d6
Show values of C-like variants even if not defined by the user
GuillaumeGomez Oct 6, 2023
3abef68
Add tvOS to target_os for register_dtor
simlay Oct 6, 2023
8fdb0a9
Auto merge of #114709 - ShE3py:wasi-io-error-more, r=workingjubilee
bors Oct 6, 2023
6d1c3a4
Rollup merge of #116277 - RalfJung:post-mono, r=oli-obk
workingjubilee Oct 6, 2023
c9f6ac4
Rollup merge of #116277 - RalfJung:post-mono, r=oli-obk
workingjubilee Oct 6, 2023
0d68e41
Rollup merge of #116400 - estebank:issue-78585, r=WaffleLapkin
workingjubilee Oct 6, 2023
5268120
Rollup merge of #116458 - bjorn3:fix_global_asm_test, r=workingjubilee
workingjubilee Oct 6, 2023
4b102b0
Rollup merge of #116500 - simlay:tvos-support-for-register_dtor, r=wo…
workingjubilee Oct 6, 2023
93b6a36
Auto merge of #116501 - workingjubilee:rollup-fpzov6m, r=workingjubilee
bors Oct 7, 2023
8c7d232
Update docs for mips target tier demotion.
ehuss Oct 7, 2023
4ea5190
Auto merge of #116318 - pitaj:android-backtrace-build, r=workingjubilee
bors Oct 7, 2023
d322243
Preparing for merge from rustc
Oct 7, 2023
722736a
Merge from rustc
Oct 7, 2023
dca90f7
Remove unnecessary tmp variable in default_read_exact
Wilfred Oct 7, 2023
1c42857
Auto merge of #3113 - rust-lang:rustup-2023-10-07, r=saethlin
bors Oct 7, 2023
fc01a74
Auto merge of #109214 - tosti007:std_collection_hash_new_rework, r=wo…
bors Oct 7, 2023
5aecfe4
update lockfile
RalfJung Oct 7, 2023
a04b7a3
allow option-ext as a tool dependency (MPL licensed)
RalfJung Oct 7, 2023
f96541e
tests/run-make: Remove wrong blessing advice
Enselic Oct 7, 2023
88966c4
tests/run-make: Move RUSTC_TEST_OP to tools.mk
Enselic Oct 7, 2023
d9a7afe
tests/run-make: Use RUSTC_TEST_OP in more places
Enselic Oct 7, 2023
0f3d72a
Auto merge of #116508 - RalfJung:miri, r=RalfJung
bors Oct 7, 2023
41d24cc
rustc_monomorphize: Move limit check into check_move_size()
Enselic Oct 1, 2023
56e4715
rustc_monomorphize: Introduce check_fn_args_move_size()
Enselic Oct 1, 2023
d087c6f
Auto merge of #116457 - RalfJung:try_eval_scalar_int, r=cjgillot
bors Oct 7, 2023
48e2462
Auto merge of #115583 - RalfJung:packed-unsized, r=lcnr
bors Oct 7, 2023
e759603
Consistently use eprintln inside the build system
bjorn3 Oct 7, 2023
9e15f36
Only display enum variants integer values if one of them has a value set
GuillaumeGomez Oct 6, 2023
1994d0b
Update enum-variant-value test
GuillaumeGomez Oct 6, 2023
de70a77
Correctly handle cross-crate C-like variants
GuillaumeGomez Oct 7, 2023
b0badc1
Add cross-crate C-like variant test
GuillaumeGomez Oct 7, 2023
91db3bd
Auto merge of #116310 - Enselic:check_fn_args_move_size, r=oli-obk
bors Oct 7, 2023
935a091
Auto merge of #116330 - RalfJung:dont-key-on-allocid, r=oli-obk
bors Oct 7, 2023
598e29b
Auto merge of #100806 - timvermeulen:split_inclusive_double_ended_bou…
bors Oct 7, 2023
7ecb09d
linker: Remove unstable legacy CLI linker flavors
petrochenkov Oct 7, 2023
cf21a08
Auto merge of #116437 - nnethercote:rustc_features, r=Nilstrieb
bors Oct 7, 2023
b3fecae
Fix 128-bit non-native integers comparison
antoyo Oct 7, 2023
97c81e1
Auto merge of #116416 - Kobzol:ci-host-llvm-17-0-2, r=Mark-Simulacrum
bors Oct 7, 2023
e9addfd
Auto merge of #114623 - Kobzol:opt-dist-gha-summaries, r=Mark-Simulacrum
bors Oct 8, 2023
fdf32ee
Auto merge of #116450 - Kobzol:automation-try-bors-ci, r=Mark-Simulacrum
bors Oct 8, 2023
1516ca1
Auto merge of #116486 - van-ema:master, r=nikic
bors Oct 8, 2023
e08de86
Auto merge of #116487 - tamird:avoid-unwrap-absolute, r=bjorn3
bors Oct 8, 2023
fea943d
Auto merge of #116487 - tamird:avoid-unwrap-absolute, r=bjorn3
bors Oct 8, 2023
b563595
linker: Remove `-Zgcc-ld` option
petrochenkov Oct 7, 2023
6d27169
Auto merge of #116509 - Enselic:rustc-test-op, r=Mark-Simulacrum
bors Oct 8, 2023
ab039f7
Auto merge of #116514 - petrochenkov:nogccld, r=lqd
bors Oct 8, 2023
710c073
delay a bug when encountering an ambiguity in MIR typeck
aliemjay Oct 8, 2023
1906ec5
Sync from rust 97c81e1b537088f1881c8894ee8579812ed9b6d1
bjorn3 Oct 8, 2023
8109344
Rustup to rustc 1.75.0-nightly (97c81e1b5 2023-10-07)
bjorn3 Oct 8, 2023
07147f3
Fix inline asm on macOS
bjorn3 Oct 7, 2023
91e5bd8
Skip cpuid shim when inline asm support is enabled
bjorn3 Oct 7, 2023
2672876
Run inline asm rustc tests on CI
bjorn3 Oct 7, 2023
5be0b22
improve the suggestion of generic_bound_failure
aliemjay Sep 8, 2023
996ffcb
always show and explain sub region
aliemjay Sep 17, 2023
a883063
remove trailing dots
aliemjay Oct 8, 2023
89d610c
Add RUSTFLAGS_BOOTSTRAP to RUSTFLAGS for bootstrap compilation
onur-ozkan Oct 8, 2023
1e3c8f1
Auto merge of #116183 - cjgillot:debug-dse-always, r=oli-obk
bors Oct 8, 2023
cc5db2c
Merge pull request #1397 from bjorn3/inline_asm_tweaks
bjorn3 Oct 8, 2023
005ec2e
Do not run optimizations on trivial MIR.
cjgillot Oct 8, 2023
4f4a413
Auto merge of #116454 - tmiasko:small-dominators, r=cjgillot
bors Oct 8, 2023
b3c10d4
Fix 128-bit non-native integers negation
antoyo Oct 7, 2023
d484836
Merge pull request #349 from rust-lang/fix/128-bit-ints-operations
antoyo Oct 8, 2023
bf9a1c8
Auto merge of #116515 - petrochenkov:nolegflavor, r=lqd
bors Oct 8, 2023
c567e59
Merge branch 'master' into sync_from_rust_2023_10_08
antoyo Oct 8, 2023
237be9e
Update to nightly-2023-10-08
antoyo Oct 8, 2023
5e1b0cb
add test for const-eval error in dead code during monomorphization
RalfJung Oct 5, 2023
37f080e
Also consider call and yield as MIR SSA.
cjgillot Jul 20, 2023
098fc97
Make FnDef 1-ZST in LLVM debuginfo.
cjgillot Sep 18, 2023
9d211b0
Ignore MSVC in test.
cjgillot Oct 8, 2023
6796c57
miri: make NaN generation non-deterministic
RalfJung Oct 8, 2023
71285c1
prepare stabilization of modern linker-flavors
lqd Sep 20, 2023
acc3b61
move `LinkSelfContainedComponents` to `rustc_target`
lqd Sep 20, 2023
2ce46f8
move single component parsing to dedicated function
lqd Sep 20, 2023
5b9aa26
implement opt out `-Clink-self-contained=-linker`
lqd Sep 20, 2023
6f54cbf
add `IntoIterator` impl for self-contained linking components
lqd Sep 21, 2023
1394874
consistency check for self-contained linking components CLI options
lqd Sep 21, 2023
d634cc5
add test for `-Clink-self-contained` consistency
lqd Sep 21, 2023
0387015
Drop mips*-unknown-linux-gnu* to tier 3
workingjubilee Jul 3, 2023
14cdb38
Drop mips*-unknown-linux-musl* to tier 3
workingjubilee Aug 26, 2023
31cb61b
Drop all MIPS targets from CI
workingjubilee Oct 8, 2023
37fda98
Auto merge of #116468 - nnethercote:rustc_serialize, r=Mark-Simulacrum
bors Oct 9, 2023
1f48cbc
Auto merge of #116096 - cjgillot:debuginfo-fndef-size, r=nikic
bors Oct 9, 2023
23a3b9e
Fix suggestion span involving wrongly placed generic arg on enum vari…
gurry Oct 9, 2023
28ee5da
rustdoc: show crate name beside small logo
notriddle Sep 18, 2023
957c5db
compiletest: add a way to specify params with spaces
notriddle Sep 19, 2023
6d6fa79
rustdoc: clean up the layout for annotated version numbers
notriddle Sep 19, 2023
c6e6ecb
rustdoc: remove rust logo from non-Rust crates
notriddle Sep 19, 2023
7c10c6f
rustdoc: fix rustdoc-gui tests for logo changes
notriddle Sep 20, 2023
b0d76a7
rustdoc: align crate name with search bar
notriddle Sep 21, 2023
47c4632
rustdoc: clean up the In [name] up-pointer
notriddle Sep 23, 2023
7bb2c96
rustdoc: add missing macros to sibling nav sidebar
notriddle Sep 23, 2023
8222335
Clean up subversion layout
notriddle Sep 23, 2023
47ebffa
Simplify some mir passes by using let chains
DaniPopes Oct 9, 2023
615d738
ensure unary minus propagates NaN payloads exactly
RalfJung Oct 8, 2023
093b9d5
Auto merge of #116533 - cjgillot:skip-trivial-mir, r=oli-obk
bors Oct 9, 2023
14d29be
Support AIX in Rust standard library
ecnelises Apr 3, 2023
08deb0d
float-to-float casts also have non-deterministic NaN results
RalfJung Oct 9, 2023
4ff6e87
return crates instead of a crate
ouz-a Oct 8, 2023
88198c7
Sync from rust bf9a1c8a193fc373897196321215794c8bebbeec
bjorn3 Oct 9, 2023
81dc066
Rustup to rustc 1.75.0-nightly (bf9a1c8a1 2023-10-08)
bjorn3 Oct 9, 2023
169055f
Merge commit '81dc066758ec150b43822d4a0c84aae20fe10f40' into sync_cg_…
bjorn3 Oct 9, 2023
3ed3765
Remove no longer used dependency from the list of allowed dependencies
bjorn3 Oct 9, 2023
bbc2304
Make BTreeMap::new_in const
Kritzefitz Oct 9, 2023
d60b43c
Make BTreeSet::new_in const
Kritzefitz Oct 9, 2023
7ed044c
Auto merge of #115238 - workingjubilee:ich-entferne-welke-blumen, r=n…
bors Oct 9, 2023
0f27c1b
defids are indexmapped
ouz-a Oct 9, 2023
5f079dd
alloc id is indexmapped
ouz-a Oct 9, 2023
77df2cd
spans are now indexmapped
ouz-a Oct 9, 2023
2e000eb
add test
ouz-a Oct 9, 2023
592163f
Extend impl's def_span to include where clauses
compiler-errors Oct 6, 2023
4b6fc8b
Improve code
GuillaumeGomez Oct 9, 2023
1210aac
Add more complex test cases for enum discriminant display
GuillaumeGomez Oct 9, 2023
be581d9
Auto merge of #116142 - GuillaumeGomez:enum-variant-display, r=fmease
bors Oct 9, 2023
389747c
Rollup merge of #115882 - aliemjay:diag-name-region-1, r=compiler-errors
matthiaskrgr Oct 9, 2023
374c885
Rollup merge of #116537 - gurry:116473-ice-sugg-overlap, r=compiler-e…
matthiaskrgr Oct 9, 2023
2266e79
Rollup merge of #116543 - ouz-a:crate_return_vec, r=oli-obk
matthiaskrgr Oct 9, 2023
148f5c1
Rollup merge of #116549 - DaniPopes:miropts-let-chains, r=oli-obk
matthiaskrgr Oct 9, 2023
ea5cac0
Rollup merge of #116556 - bjorn3:sync_cg_clif-2023-10-09, r=bjorn3
matthiaskrgr Oct 9, 2023
27a5146
Rollup merge of #116561 - ouz-a:testfor_115517, r=compiler-errors
matthiaskrgr Oct 9, 2023
bd7e5b9
Fix bitcast with different sizes
antoyo Oct 9, 2023
e7f7fb8
Fix tests
antoyo Oct 9, 2023
317783a
Auto merge of #116569 - matthiaskrgr:rollup-ni0jdd6, r=matthiaskrgr
bors Oct 9, 2023
ad56374
Add missing panic_in_cleanup
antoyo Oct 9, 2023
3fe5358
Add missing comma in alloc_system
antoyo Oct 9, 2023
7083439
Fix UI tests
antoyo Oct 9, 2023
7962b96
Update books
rustbot Oct 9, 2023
a00ea0b
Fix unchecked_sadd
antoyo Oct 9, 2023
cdddcd3
Auto merge of #116532 - onur-ozkan:enable-rustflags-bootstrap-on-boot…
bors Oct 9, 2023
a7532da
Fix unchecked_ssub, unchecked_smul, and unchecked_umul
antoyo Oct 9, 2023
3f9ab7a
Pass more host flags using `RUSTC_HOST_FLAGS`
Kobzol Oct 6, 2023
daac011
Suggest labeling block if `break` is in bare block
estebank Oct 3, 2023
5c17b8b
Move some tests around
estebank Oct 3, 2023
c30d57b
fix
estebank Oct 4, 2023
11a0cce
Merge pull request #350 from rust-lang/sync_from_rust_2023_10_08
antoyo Oct 9, 2023
30290c8
Merge commit '11a0cceab966e5ff1058ddbcab5977e8a1d6d290' into subtree-…
antoyo Oct 9, 2023
2cbac9c
Fix checks
antoyo Oct 9, 2023
59edd67
Auto merge of #116497 - compiler-errors:impl-span, r=cjgillot
bors Oct 9, 2023
06c5ac4
Use IntoDynSyncSend
antoyo Oct 9, 2023
15c1a6b
Add a ui test with an assertion that has a really long condition.
nnethercote Oct 9, 2023
7528fdc
Don't `escape_debug` the condition of `assert!`.
nnethercote Oct 9, 2023
d23dc20
Account for macros
estebank Oct 9, 2023
fa6d1e7
Auto merge of #109882 - ecnelises:aix_std, r=workingjubilee
bors Oct 10, 2023
2dcc828
use env variable to control thread ids in rustc_log
SparrowLii Oct 10, 2023
972ab88
coverage: Move initial MIR span extraction into a submodule
Zalathar Oct 1, 2023
4b471df
coverage: Disconnect span extraction from `CoverageSpansGenerator`
Zalathar Oct 1, 2023
6c44425
coverage: Remove enum `CoverageStatement`
Zalathar Oct 1, 2023
84d44dd
Auto merge of #116366 - estebank:issue-103982, r=oli-obk
bors Oct 10, 2023
f214497
coverage: Replace `ShortCircuitPreorder` with a single function
Zalathar Oct 10, 2023
5d62945
coverage: Unbox and simplify `bcb_filtered_successors`
Zalathar Oct 10, 2023
091bb74
Auto merge of #116548 - nnethercote:assert-long-condition, r=matthewj…
bors Oct 10, 2023
2de4546
-Zmir-enable-passes: document that this may enable unsound passes
RalfJung Oct 10, 2023
d805b26
add some comments explaining why MIR opts are marked as unsound
RalfJung Oct 10, 2023
5c37696
Auto merge of #116409 - Zalathar:span-extraction, r=oli-obk
bors Oct 10, 2023
c70ef36
reorder files in solve
lcnr Oct 10, 2023
0bcb058
add new wrapper for FxIndexMap
ouz-a Oct 10, 2023
061c330
Auto merge of #116551 - RalfJung:nondet-nan, r=oli-obk
bors Oct 10, 2023
0bc5696
Rollup merge of #116586 - SparrowLii:parallel_log, r=oli-obk
matthiaskrgr Oct 10, 2023
f4de82c
Rollup merge of #116589 - Zalathar:successors, r=oli-obk
matthiaskrgr Oct 10, 2023
de4980c
Rollup merge of #116595 - RalfJung:mir-enable-passes, r=oli-obk
matthiaskrgr Oct 10, 2023
da42858
Rollup merge of #116596 - lcnr:normalize-subdir, r=compiler-errors
matthiaskrgr Oct 10, 2023
5b88d65
Auto merge of #116598 - matthiaskrgr:rollup-6xra4jx, r=matthiaskrgr
bors Oct 10, 2023
4be9cfa
Rollup merge of #109422 - notriddle:notriddle/impl-disambiguate-searc…
GuillaumeGomez Oct 10, 2023
0e5e04b
Rollup merge of #116250 - estebank:closure-arg-inference-span, r=petr…
GuillaumeGomez Oct 10, 2023
bbaf6bd
Rollup merge of #116444 - RalfJung:broken-unused-const, r=oli-obk
GuillaumeGomez Oct 10, 2023
fccf9ec
Rollup merge of #116503 - ehuss:fix-mips-tier, r=Amanieu
GuillaumeGomez Oct 10, 2023
b72db84
Rollup merge of #116559 - Kritzefitz:btree-new-in-const, r=Amanieu
GuillaumeGomez Oct 10, 2023
100713e
Rollup merge of #116560 - ouz-a:efficient_ids, r=oli-obk
GuillaumeGomez Oct 10, 2023
49dd50b
Rollup merge of #116574 - rustbot:docs-update, r=ehuss
GuillaumeGomez Oct 10, 2023
c30b28b
Auto merge of #116605 - GuillaumeGomez:rollup-12ba2o6, r=GuillaumeGomez
bors Oct 10, 2023
b61a6d5
Remove unused dominator iterator
tmiasko Oct 10, 2023
d627cf0
Auto merge of #113915 - cjgillot:ssa-call, r=tmiasko
bors Oct 10, 2023
ba02a99
Document `diagnostic_namespace` feature
mejrs Oct 10, 2023
dcf89f4
Auto merge of #116578 - antoyo:subtree-update_cg_gcc_2023-10-09, r=bj…
bors Oct 11, 2023
7774141
update cargo
weihanglo Oct 11, 2023
38654ad
Rollup merge of #95967 - CAD97:from-utf16, r=dtolnay
aliemjay Oct 11, 2023
a7042a9
Rollup merge of #116530 - aliemjay:ice-on-ambiguity, r=compiler-errors
aliemjay Oct 11, 2023
494e971
Rollup merge of #116611 - mejrs:diagnostic_namespace, r=ehuss
aliemjay Oct 11, 2023
88a929b
Rollup merge of #116612 - tmiasko:rm-dom-iter, r=cjgillot
aliemjay Oct 11, 2023
36cbf94
Auto merge of #116621 - aliemjay:rollup-0e2of3c, r=aliemjay
bors Oct 11, 2023
c5e1702
Add tests
Nadrieril Oct 10, 2023
1e1174b
Rework error handling when lowering range endpoints
Nadrieril Oct 10, 2023
1baf8bf
Fix range overflow checking
Nadrieril Oct 11, 2023
dcdddb7
Fix span of overflow lint for negated literals
Nadrieril Oct 11, 2023
2e7e0fb
Auto merge of #116622 - weihanglo:update-cargo, r=weihanglo
bors Oct 11, 2023
6d05c43
Auto merge of #115948 - notriddle:notriddle/logo-lockup, r=fmease
bors Oct 11, 2023
156da98
Auto merge of #112818 - Benjamin-L:add-slice_split_once, r=cuviper
bors Oct 11, 2023
50b6f46
small cleanup
fee1-dead Oct 11, 2023
a314707
Prevent showing methods from blanket impls of not available foreign t…
GuillaumeGomez Oct 11, 2023
efac0b9
Add regression test for #115480
GuillaumeGomez Oct 11, 2023
2d37b00
Handle private dep at the same level as masked crates
GuillaumeGomez Oct 11, 2023
71704c4
Auto merge of #116623 - Nadrieril:validate-range-endpoints, r=oli-obk
bors Oct 11, 2023
5aa23be
Auto merge of #116014 - lqd:mcp510-2-electric-boogaloo, r=petrochenkov
bors Oct 11, 2023
d1fd11f
Prevent spurious `unreachable pattern` lints
oli-obk Sep 18, 2023
e83467c
Avoid emitting the non_exhaustive error if other errors already occurred
oli-obk Sep 19, 2023
eca786c
Remember the `ErrorReported` used to silence follow up errors instead…
oli-obk Sep 28, 2023
3c23df4
Auto merge of #115937 - oli-obk:spurious_unreachable_pattern, r=Nadri…
bors Oct 11, 2023
c1691db
Auto merge of #113218 - lqd:polonius-scopes, r=jackh726
bors Oct 11, 2023
8ddc0df
Rollup merge of #116219 - compiler-errors:relate-alias-ty-with-varian…
matthiaskrgr Oct 11, 2023
9b7e0af
Rollup merge of #116315 - cjgillot:cpl-clean, r=petrochenkov
matthiaskrgr Oct 11, 2023
3712ea8
Rollup merge of #116436 - compiler-errors:structurally-normalize-for-…
matthiaskrgr Oct 11, 2023
d213983
Rollup merge of #116597 - GuillaumeGomez:foreign-blanket-impl, r=notr…
matthiaskrgr Oct 11, 2023
8374805
Rollup merge of #116627 - fee1-dead-contrib:cleanup, r=spastorino
matthiaskrgr Oct 11, 2023
9d2eb66
Use structured suggestion for #113174
estebank Jul 8, 2023
475c71d
Auto merge of #116640 - matthiaskrgr:rollup-xt9r5ir, r=matthiaskrgr
bors Oct 11, 2023
9d1e4b7
Auto merge of #116448 - Kobzol:bootstrap-host-flags, r=onur-ozkan,pet…
bors Oct 11, 2023
f562931
Auto merge of #116506 - Wilfred:remove_tmp_var, r=workingjubilee
bors Oct 12, 2023
3d575a2
Auto merge of #113487 - estebank:sugg-113174, r=oli-obk
bors Oct 12, 2023
5862a96
remove excluded files from upstream
Dajamante Oct 12, 2023
6474efc
pull new changes from upstream
Dajamante Oct 12, 2023
f90bceb
blessing 4 failing tests
Dajamante Oct 13, 2023
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
13 changes: 8 additions & 5 deletions compiler/rustc_middle/src/thir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -581,13 +581,13 @@ pub enum BindingMode {
ByRef(BorrowKind),
}

#[derive(Clone, Debug, HashStable)]
#[derive(Clone, Debug, HashStable, TypeVisitable)]
pub struct FieldPat<'tcx> {
pub field: FieldIdx,
pub pattern: Box<Pat<'tcx>>,
}

#[derive(Clone, Debug, HashStable)]
#[derive(Clone, Debug, HashStable, TypeVisitable)]
pub struct Pat<'tcx> {
pub ty: Ty<'tcx>,
pub span: Span,
Expand Down Expand Up @@ -664,7 +664,7 @@ impl<'tcx> IntoDiagnosticArg for Pat<'tcx> {
}
}

#[derive(Clone, Debug, HashStable)]
#[derive(Clone, Debug, HashStable, TypeVisitable)]
pub struct Ascription<'tcx> {
pub annotation: CanonicalUserTypeAnnotation<'tcx>,
/// Variance to use when relating the `user_ty` to the **type of the value being
Expand All @@ -688,7 +688,7 @@ pub struct Ascription<'tcx> {
pub variance: ty::Variance,
}

#[derive(Clone, Debug, HashStable)]
#[derive(Clone, Debug, HashStable, TypeVisitable)]
pub enum PatKind<'tcx> {
/// A wildcard pattern: `_`.
Wild,
Expand All @@ -702,7 +702,9 @@ pub enum PatKind<'tcx> {
Binding {
mutability: Mutability,
name: Symbol,
#[type_visitable(ignore)]
mode: BindingMode,
#[type_visitable(ignore)]
var: LocalVarId,
ty: Ty<'tcx>,
subpattern: Option<Box<Pat<'tcx>>>,
Expand Down Expand Up @@ -771,10 +773,11 @@ pub enum PatKind<'tcx> {
},
}

#[derive(Clone, Debug, PartialEq, HashStable)]
#[derive(Clone, Debug, PartialEq, HashStable, TypeVisitable)]
pub struct PatRange<'tcx> {
pub lo: mir::Const<'tcx>,
pub hi: mir::Const<'tcx>,
#[type_visitable(ignore)]
pub end: RangeEnd,
}

Expand Down
8 changes: 7 additions & 1 deletion compiler/rustc_mir_build/src/thir/pattern/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use rustc_hir::HirId;
use rustc_middle::thir::visit::{self, Visitor};
use rustc_middle::thir::*;
use rustc_middle::ty::print::with_no_trimmed_paths;
use rustc_middle::ty::{self, AdtDef, Ty, TyCtxt};
use rustc_middle::ty::{self, AdtDef, Ty, TyCtxt, TypeVisitableExt};
use rustc_session::lint::builtin::{
BINDINGS_WITH_VARIANT_NAME, IRREFUTABLE_LET_PATTERNS, UNREACHABLE_PATTERNS,
};
Expand Down Expand Up @@ -682,6 +682,12 @@ fn non_exhaustive_match<'p, 'tcx>(
arms: &[ArmId],
expr_span: Span,
) -> ErrorGuaranteed {
for &arm in arms {
if let Err(err) = thir[arm].pattern.error_reported() {
return err;
}
}

let is_empty_match = arms.is_empty();
let non_empty_enum = match scrut_ty.kind() {
ty::Adt(def, _) => def.is_enum() && !def.variants().is_empty(),
Expand Down
85 changes: 48 additions & 37 deletions compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use rustc_middle::mir;
use rustc_middle::thir::{FieldPat, Pat, PatKind};
use rustc_middle::ty::{self, Ty, TyCtxt, ValTree};
use rustc_session::lint;
use rustc_span::Span;
use rustc_span::{ErrorGuaranteed, Span};
use rustc_target::abi::{FieldIdx, VariantIdx};
use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt;
use rustc_trait_selection::traits::{self, ObligationCause};
Expand Down Expand Up @@ -48,7 +48,7 @@ struct ConstToPat<'tcx> {
// This tracks if we emitted some hard error for a given const value, so that
// we will not subsequently issue an irrelevant lint for the same const
// value.
saw_const_match_error: Cell<bool>,
saw_const_match_error: Cell<Option<ErrorGuaranteed>>,

// This tracks if we emitted some diagnostic for a given const value, so that
// we will not subsequently issue an irrelevant lint for the same const
Expand Down Expand Up @@ -84,7 +84,7 @@ impl<'tcx> ConstToPat<'tcx> {
span,
infcx,
param_env: pat_ctxt.param_env,
saw_const_match_error: Cell::new(false),
saw_const_match_error: Cell::new(None),
saw_const_match_lint: Cell::new(false),
behind_reference: Cell::new(false),
treat_byte_string_as_slice: pat_ctxt
Expand Down Expand Up @@ -154,7 +154,7 @@ impl<'tcx> ConstToPat<'tcx> {
}),
};

if !self.saw_const_match_error.get() {
if self.saw_const_match_error.get().is_none() {
// If we were able to successfully convert the const to some pat (possibly with some
// lints, but no errors), double-check that all types in the const implement
// `Structural` and `PartialEq`.
Expand All @@ -180,23 +180,26 @@ impl<'tcx> ConstToPat<'tcx> {

if let Some(non_sm_ty) = structural {
if !self.type_has_partial_eq_impl(cv.ty()) {
if let ty::Adt(def, ..) = non_sm_ty.kind() {
let e = if let ty::Adt(def, ..) = non_sm_ty.kind() {
if def.is_union() {
let err = UnionPattern { span: self.span };
self.tcx().sess.emit_err(err);
self.tcx().sess.emit_err(err)
} else {
// fatal avoids ICE from resolution of nonexistent method (rare case).
self.tcx()
.sess
.emit_fatal(TypeNotStructural { span: self.span, non_sm_ty });
.emit_fatal(TypeNotStructural { span: self.span, non_sm_ty })
}
} else {
let err = InvalidPattern { span: self.span, non_sm_ty };
self.tcx().sess.emit_err(err);
}
self.tcx().sess.emit_err(err)
};
// All branches above emitted an error. Don't print any more lints.
// The pattern we return is irrelevant since we errored.
return Box::new(Pat { span: self.span, ty: cv.ty(), kind: PatKind::Wild });
// We errored. Signal that in the pattern, so that follow up errors can be silenced.
let kind = PatKind::Constant {
value: mir::Const::Ty(ty::Const::new_error(self.tcx(), e, cv.ty())),
};
return Box::new(Pat { span: self.span, ty: cv.ty(), kind });
} else if !self.saw_const_match_lint.get() {
if let Some(mir_structural_match_violation) = mir_structural_match_violation {
match non_sm_ty.kind() {
Expand Down Expand Up @@ -330,7 +333,7 @@ impl<'tcx> ConstToPat<'tcx> {
// Backwards compatibility hack because we can't cause hard errors on these
// types, so we compare them via `PartialEq::eq` at runtime.
ty::Adt(..) if !self.type_marked_structural(ty) && self.behind_reference.get() => {
if !self.saw_const_match_error.get() && !self.saw_const_match_lint.get() {
if self.saw_const_match_error.get().is_none() && !self.saw_const_match_lint.get() {
self.saw_const_match_lint.set(true);
tcx.emit_spanned_lint(
lint::builtin::INDIRECT_STRUCTURAL_MATCH,
Expand All @@ -345,18 +348,18 @@ impl<'tcx> ConstToPat<'tcx> {
return Err(FallbackToOpaqueConst);
}
ty::FnDef(..) => {
self.saw_const_match_error.set(true);
tcx.sess.emit_err(InvalidPattern { span, non_sm_ty: ty });
// We errored, so the pattern we generate is irrelevant.
PatKind::Wild
let e = tcx.sess.emit_err(InvalidPattern { span, non_sm_ty: ty });
self.saw_const_match_error.set(Some(e));
// We errored. Signal that in the pattern, so that follow up errors can be silenced.
PatKind::Constant { value: mir::Const::Ty(ty::Const::new_error(tcx, e, ty)) }
}
ty::Adt(adt_def, _) if !self.type_marked_structural(ty) => {
debug!("adt_def {:?} has !type_marked_structural for cv.ty: {:?}", adt_def, ty,);
self.saw_const_match_error.set(true);
let err = TypeNotStructural { span, non_sm_ty: ty };
tcx.sess.emit_err(err);
// We errored, so the pattern we generate is irrelevant.
PatKind::Wild
let e = tcx.sess.emit_err(err);
self.saw_const_match_error.set(Some(e));
// We errored. Signal that in the pattern, so that follow up errors can be silenced.
PatKind::Constant { value: mir::Const::Ty(ty::Const::new_error(tcx, e, ty)) }
}
ty::Adt(adt_def, args) if adt_def.is_enum() => {
let (&variant_index, fields) = cv.unwrap_branch().split_first().unwrap();
Expand Down Expand Up @@ -416,7 +419,9 @@ impl<'tcx> ConstToPat<'tcx> {
// instead of a hard error.
ty::Adt(_, _) if !self.type_marked_structural(*pointee_ty) => {
if self.behind_reference.get() {
if !self.saw_const_match_error.get() && !self.saw_const_match_lint.get() {
if self.saw_const_match_error.get().is_none()
&& !self.saw_const_match_lint.get()
{
self.saw_const_match_lint.set(true);
tcx.emit_spanned_lint(
lint::builtin::INDIRECT_STRUCTURAL_MATCH,
Expand All @@ -427,14 +432,20 @@ impl<'tcx> ConstToPat<'tcx> {
}
return Err(FallbackToOpaqueConst);
} else {
if !self.saw_const_match_error.get() {
self.saw_const_match_error.set(true);
if let Some(e) = self.saw_const_match_error.get() {
// We already errored. Signal that in the pattern, so that follow up errors can be silenced.
PatKind::Constant {
value: mir::Const::Ty(ty::Const::new_error(tcx, e, ty)),
}
} else {
let err = TypeNotStructural { span, non_sm_ty: *pointee_ty };
tcx.sess.emit_err(err);
let e = tcx.sess.emit_err(err);
self.saw_const_match_error.set(Some(e));
// We errored. Signal that in the pattern, so that follow up errors can be silenced.
PatKind::Constant {
value: mir::Const::Ty(ty::Const::new_error(tcx, e, ty)),
}
}
tcx.sess.delay_span_bug(span, "`saw_const_match_error` set but no error?");
// We errored, so the pattern we generate is irrelevant.
PatKind::Wild
}
}
// All other references are converted into deref patterns and then recursively
Expand All @@ -443,11 +454,11 @@ impl<'tcx> ConstToPat<'tcx> {
_ => {
if !pointee_ty.is_sized(tcx, param_env) && !pointee_ty.is_slice() {
let err = UnsizedPattern { span, non_sm_ty: *pointee_ty };
tcx.sess.emit_err(err);

// FIXME: introduce PatKind::Error to silence follow up diagnostics due to unreachable patterns.
// We errored, so the pattern we generate is irrelevant.
PatKind::Wild
let e = tcx.sess.emit_err(err);
// We errored. Signal that in the pattern, so that follow up errors can be silenced.
PatKind::Constant {
value: mir::Const::Ty(ty::Const::new_error(tcx, e, ty)),
}
} else {
let old = self.behind_reference.replace(true);
// `b"foo"` produces a `&[u8; 3]`, but you can't use constants of array type when
Expand All @@ -474,15 +485,15 @@ impl<'tcx> ConstToPat<'tcx> {
}
ty::FnPtr(..) | ty::RawPtr(..) => unreachable!(),
_ => {
self.saw_const_match_error.set(true);
let err = InvalidPattern { span, non_sm_ty: ty };
tcx.sess.emit_err(err);
// We errored, so the pattern we generate is irrelevant.
PatKind::Wild
let e = tcx.sess.emit_err(err);
self.saw_const_match_error.set(Some(e));
// We errored. Signal that in the pattern, so that follow up errors can be silenced.
PatKind::Constant { value: mir::Const::Ty(ty::Const::new_error(tcx, e, ty)) }
}
};

if !self.saw_const_match_error.get()
if self.saw_const_match_error.get().is_none()
&& !self.saw_const_match_lint.get()
&& mir_structural_match_violation
// FIXME(#73448): Find a way to bring const qualification into parity with
Expand Down
6 changes: 6 additions & 0 deletions compiler/rustc_type_ir/src/structural_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ impl<I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for &[T] {
}
}

impl<I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for Box<[T]> {
fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> ControlFlow<V::BreakTy> {
self.iter().try_for_each(|t| t.visit_with(visitor))
}
}

impl<I: Interner, T: TypeFoldable<I>, Ix: Idx> TypeFoldable<I> for IndexVec<Ix, T> {
fn try_fold_with<F: FallibleTypeFolder<I>>(self, folder: &mut F) -> Result<Self, F::Error> {
self.try_map_id(|x| x.try_fold_with(folder))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,17 @@ LL | WHAT_A_TYPE => 0,
= note: the traits must be derived, manual `impl`s are not sufficient
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details

error: aborting due to previous error
error[E0015]: cannot match on `TypeId` in constant functions
--> $DIR/typeid-equality-by-subtyping.rs:18:9
|
LL | WHAT_A_TYPE => 0,
| ^^^^^^^^^^^
|
= note: `TypeId` cannot be compared in compile-time, and therefore cannot be used in `match`es
note: impl defined here, but it is not `const`
--> $SRC_DIR/core/src/any.rs:LL:COL
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0015`.
1 change: 0 additions & 1 deletion tests/ui/consts/const_in_pattern/issue-78057.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ fn main() {
FOO => {},
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
_ => {}
//~^ ERROR unreachable pattern
}
}
17 changes: 1 addition & 16 deletions tests/ui/consts/const_in_pattern/issue-78057.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,5 @@ LL | FOO => {},
= note: the traits must be derived, manual `impl`s are not sufficient
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details

error: unreachable pattern
--> $DIR/issue-78057.rs:14:9
|
LL | FOO => {},
| --- matches any value
LL |
LL | _ => {}
| ^ unreachable pattern
|
note: the lint level is defined here
--> $DIR/issue-78057.rs:1:9
|
LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors
error: aborting due to previous error

4 changes: 2 additions & 2 deletions tests/ui/pattern/non-structural-match-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

fn main() {
match loop {} {
const { || {} } => {}, //~ ERROR cannot be used in patterns
const { || {} } => {} //~ ERROR cannot be used in patterns
}
match loop {} {
const { async {} } => {}, //~ ERROR cannot be used in patterns
const { async {} } => {} //~ ERROR cannot be used in patterns
}
}
4 changes: 2 additions & 2 deletions tests/ui/pattern/non-structural-match-types.stderr
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error: `{closure@$DIR/non-structural-match-types.rs:9:17: 9:19}` cannot be used in patterns
--> $DIR/non-structural-match-types.rs:9:9
|
LL | const { || {} } => {},
LL | const { || {} } => {}
| ^^^^^^^^^^^^^^^

error: `{async block@$DIR/non-structural-match-types.rs:12:17: 12:25}` cannot be used in patterns
--> $DIR/non-structural-match-types.rs:12:9
|
LL | const { async {} } => {},
LL | const { async {} } => {}
| ^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors
Expand Down
Loading