summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2023-12-15temporarily revert "ice on ambguity in mir typeck"Ali MJ Al-Nasrawy-12/+4
Reverts #116530 (cherry picked from commit 5fdb648fc3a672140f3fc8f98ee3268ed3fe5389)
2023-11-30Update compiler/rustc_codegen_llvm/src/lib.rsWesley Wiser-1/+1
Co-authored-by: Josh Stone <cuviper@gmail.com> (cherry picked from commit 10110787154154cddfaaacdeebd7a4406223a25b)
2023-11-30Dispose llvm::TargetMachines prior to llvm::Context being disposedWesley Wiser-6/+18
If the TargetMachine is disposed after the Context is disposed, it can lead to use after frees in some cases. I've observed this happening occasionally on code compiled for aarch64-pc-windows-msvc using `-Zstack-protector=strong` but other users have reported AVs from host aarch64-pc-windows-msvc compilers as well. (cherry picked from commit 3323e4dc04e57cc64ac77dbff2f6bf50ac6832f0)
2023-11-30ConstProp: Remove const when rvalue check fails.Alona Enraght-Moony-1/+6
(cherry picked from commit 9121a41450e905fe5a12c11c955acc14ab1f92fe)
2023-11-30Fix coroutine validation for mixed panic strategyTomasz Miąsko-11/+4
Validation introduced in #113124 allows UnwindAction::Continue and TerminatorKind::Resume to occur only in functions with ABI that can unwind. The function ABI depends on the panic strategy, which can vary across crates. Usually MIR is built and validated in the same crate. The coroutine drop glue thus far was an exception. As a result validation could fail when mixing different panic strategies. Avoid the problem by executing AbortUnwindingCalls along with the validation. (cherry picked from commit 5161b22143bf9a726cfd69d19bef11552d0ed519)
2023-11-30Build pre-coroutine-transform coroutine bodyMichael Goulet-11/+1
(cherry picked from commit 0ba7d19769c068729761eba72e779b53101a19bc)
2023-11-18coverage: Avoid creating malformed macro name spansZalathar-0/+6
This method is trying to detect macro invocations, so that it can split a span into two parts just after the `!` of the invocation. Under some circumstances (probably involving nested macros), it gets confused and produces a span that is larger than the original span, and possibly extends outside its enclosing function and even into an adjacent file. In extreme cases, that can result in malformed coverage mappings that cause `llvm-cov` to fail. For now, we at least want to detect these egregious cases and avoid them, so that coverage reports can still be produced.
2023-11-12Substitute version placeholdersMark Rousskov-5/+5
2023-11-10Auto merge of #115229 - iSwapna:issue-115222-fix, r=estebankbors-2/+34
On method chain expression failure, look for missing method in earlier segments of the chain This PR tries to fix the issue: https://github.com/rust-lang/rust/issues/115222 As suggested by `@estebank` , I did the following: 1. Add new test `tests/ui/structs/method-chain-expression-failure.rs` 2. In `compiler/rusct_hir_tycheck/src/method/suggest.rs` walking up the method chain and calling `probe_for_name` with the method name. But the call fails to return `Ok`.
2023-11-10Recurse over the method chain and maintain a stack to peek at previous ↵Swapna Iyer-2/+34
receiver to align spans
2023-11-10Merge commit 'c84d1871dc4456539b7b578830268ab3539915d0' into ↵bjorn3-67/+961
sync_cg_clif-2023-11-10
2023-11-10Rollup merge of #117743 - sjwang05:issue-117720, r=estebankMatthias Krüger-4/+20
Suggest removing `;` for `;` within let-chains Fixes #117720
2023-11-10Rollup merge of #117741 - eltociear:patch-23, r=compiler-errorsMatthias Krüger-1/+1
Fix typo in internal.rs covert -> convert
2023-11-09Auto merge of #117727 - saethlin:inline-derived-fmt, r=nnethercotebors-1/+1
Emit #[inline] on derive(Debug) While working on https://github.com/rust-lang/rust/pull/116583 I noticed that the `cross_crate_inlinable` query identifies a lot of derived `Debug` impls as a MIR body that's little more than a call, which suggests they may be a good candidate for `#[inline]`. So here I've implemented that change specifically. It seems to provide a nice improvement to build times.
2023-11-09Emit #[inline] on derive(Debug)Ben Kimock-1/+1
2023-11-09Auto merge of #117712 - lcnr:expand-coroutine, r=jackh726bors-70/+85
generator layout: ignore fake borrows fixes #117059 We emit fake shallow borrows in case the scrutinee place uses a `Deref` and there is a match guard. This is necessary to prevent the match guard from mutating the scrutinee: https://github.com/rust-lang/rust/blob/fab1054e1742790c22ccc92a625736d658363677/compiler/rustc_mir_build/src/build/matches/mod.rs#L1250-L1265 These fake borrows end up impacting the generator witness computation in `mir_generator_witnesses`, which causes the issue in #117059. This PR now completely ignores fake borrows during this computation. This is sound as thse are always removed after analysis and the actual computation of the generator layout happens afterwards. Only the second commit impacts behavior, and could be backported by itself. r? types
2023-11-09Auto merge of #117734 - nnethercote:rm-Zstrip, r=davidtwcobors-12/+2
Remove `-Z strip`. It was stabilized as `-C strip` in November 2021. The unstable option was kept around as a temporary measure to ease the transition. Two years is more than enough! r? `@tmandry`
2023-11-09Auto merge of #117632 - Nilstrieb:icup, r=davidtwcobors-874/+200
Update ICU4X This updates all ICU4X crates and regenerates rustc_baked_icu_data. Since the new unicode license under which they are licensed does not have an SPDX identifier yet, we define some exceptions. The license has to be reviewed to make sure it is still fine to use here, but I assume that is the case. I also added an exception for rustc_icu_data to the unexplained ignore doctest tidy lint. This is a bit hacky but the whole style.rs in tidy is a mess so I didn't want to touch it more than this small hack. part of #112865 r? `@davidtwco` `@wesleywiser` `@Manishearth`
2023-11-09Suggest fix for ; within let-chainssjwang05-4/+20
2023-11-09Fix typo in internal.rsIkko Eltociear Ashimine-1/+1
covert -> convert
2023-11-09Rollup merge of #117694 - jmillikin:core-io-borrowed-buf, r=m-ou-seTakayuki Maeda-0/+1
Move `BorrowedBuf` and `BorrowedCursor` from `std:io` to `core::io` Tracking issue: https://github.com/rust-lang/rust/issues/117693 ACP: https://github.com/rust-lang/libs-team/issues/290
2023-11-09Rollup merge of #117645 - compiler-errors:auto-trait-subst, r=petrochenkovTakayuki Maeda-6/+15
Extend builtin/auto trait args with error when they have >1 argument Reuse `extend_with_error` to add error args to any auto trait (or built-in trait like `Copy` that is defined incorrectly) that has additional non-`Self` args. Fixes #117628
2023-11-09Auto merge of #117557 - Zoxc:panic-prio, r=petrochenkovbors-14/+30
Make `FatalErrorMarker` lower priority than other panics This makes `FatalErrorMarker` lower priority than other panics in a parallel sections. If any other panics occur, they will be unwound instead of `FatalErrorMarker`. This ensures `rustc` will exit with the correct error code on ICEs. This fixes https://github.com/rust-lang/rust/issues/116659.
2023-11-09Remove `-Z strip`.Nicholas Nethercote-12/+2
It was stabilized as `-C strip` in November 2021. The unstable option was kept around as a temporary measure to ease the transition. Two years is more than enough!
2023-11-09Move `BorrowedBuf` and `BorrowedCursor` from `std:io` to `core::io`John Millikin-0/+1
Assigned new feature name `core_io_borrowed_buf` to distinguish from the `Read::read_buf` functionality in `std::io`.
2023-11-08rename `BorrowKind::Shallow` to `Fake`lcnr-68/+75
also adds some comments
2023-11-08generator layout: ignore fake borrowslcnr-3/+8
2023-11-08Auto merge of #116930 - RalfJung:raw-ptr-match, r=davidtwcobors-44/+63
patterns: reject raw pointers that are not just integers Matching against `0 as *const i32` is fine, matching against `&42 as *const i32` is not. This extends the existing check against function pointers and wide pointers: we now uniformly reject all these pointer types during valtree construction, and then later lint because of that. See [here](https://github.com/rust-lang/rust/pull/116930#issuecomment-1784654073) for some more explanation and context. Also fixes https://github.com/rust-lang/rust/issues/116929. Cc `@oli-obk` `@lcnr`
2023-11-08avoid unnecessary nested conditionalsRalf Jung-11/+9
2023-11-08Auto merge of #117716 - GuillaumeGomez:rollup-83gnhll, r=GuillaumeGomezbors-478/+516
Rollup of 5 pull requests Successful merges: - #117263 (handle the case when the change-id isn't found) - #117282 (Recover from incorrectly ordered/duplicated function keywords) - #117679 (tests/rustdoc-json: Avoid needless use of `no_core` and `lang_items`) - #117702 (target: move base and target specifications) - #117713 (Add test for reexported hidden item with `--document-hidden-items`) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-08Rollup merge of #117702 - davidtwco:target-tier-refactors, r=petrochenkovGuillaume Gomez-475/+479
target: move base and target specifications Follow-up to #116004. In anticipation of later PRs where we'll want to add tidy checks to ensure that, for each target, we have a test or a platform support document or something like that, this PR moves target specifications into a directory on their own so that we can just list the files in this directory to get a list of all targets. - Base specifications are moved to `rustc_target::spec::base`. - Target specifications are moved to `rustc_target::spec::targets`. - All the other source files containing types used in the target specs remain in `rustc_target::spec`. - `rustc_target/src/spec/abi.rs` is moved to `rustc_target/src/spec/abi/mod.rs` (where there was already a `tests.rs`) for uniformity. r? ``@petrochenkov``
2023-11-08Rollup merge of #117282 - clubby789:recover-wrong-function-header, r=TaKO8KiGuillaume Gomez-3/+37
Recover from incorrectly ordered/duplicated function keywords Fixes #115714
2023-11-08Auto merge of #117560 - lqd:issue-117146, r=matthewjasperbors-13/+14
Compute polonius loan scopes over the region graph In issue #117146 a loan flows into an SCC containing a placeholder, and whose representative is an existential region. Since we currently compute loan scopes by looking at SCCs and their representatives only, polonius would compute kill points for this loan here whereas NLLs would not of course. There are a few ways to fix this: - don't try to be efficient by doing the computation over SCCs, and simply look for free regions and placeholders in the successors of the issuing region. - change how the SCC representatives are picked, biasing towards placeholders over existential regions. They *shouldn't* matter much, but some downstream code may subtly depend on the current scheme (though no tests fail if we do such a change). This is for unrelated reasons also the way #116891 changes the representative computation. So that PR would also fix issue #117146. - try to remove placeholders from the main path, and contain them to a pre-pass + a post-pass kind of polonius leak check. If possible, it would fix this issue by turning an outlives constraints to a placeholder into a constraint to 'static. This should also fix the issue, as the representative would be the free region in the SCC. We want to prototype this change to see if it's possible to try to simplify the borrowck main path from having to deal with placeholders and higher-ranked subtyping 🤞. I'd like to take advantage of fuzzing and a crater run sooner rather than later, so that we grow more confidence that the 2 models are indeed equivalent empirically. Therefore this PR implements option 1 to fix the issue now. We can take care of efficiency later after validation, and once we implement option 3 (which could also impact option 2 and that associated PR, maybe the lack of placeholders could remove the need to change the representative computation) to traverse SCCs and their representative again. (Or we maybe will have some kind of naive position-dependent outlives propagation by then and this code would have been changed) Fixes #117146. r? `@matthewjasper`
2023-11-08Auto merge of #117706 - matthiaskrgr:rollup-lscx7dg, r=matthiaskrgrbors-43/+97
Rollup of 7 pull requests Successful merges: - #114316 (Add AIX platform support document) - #117531 (rustdoc: properly elide cross-crate host effect args) - #117650 (Add -Zcross-crate-inline-threshold=yes) - #117663 (bump some deps) - #117667 (Document clippy_config in nightly-rustc docs) - #117698 (Clarify `space_between`) - #117700 (coverage: Rename the `run-coverage` test mode to `coverage-run`) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-08instrument constituent types computationlcnr-0/+3
2023-11-08Rollup merge of #117698 - nnethercote:space_between-2, r=petrochenkovMatthias Krüger-30/+42
Clarify `space_between` r? ``@petrochenkov``
2023-11-08Rollup merge of #117650 - saethlin:inline-me-please, r=davidtwcoMatthias Krüger-13/+55
Add -Zcross-crate-inline-threshold=yes ``@thomcc`` says this would be useful for > seeing if it makes a difference in some code if i do it when building the sysroot, since -Zbuild-std + lto helps more than it seems like it should And I've changed the possible values as a reference to ``@Manishearth`` saying > LLVM's inlining heuristic is "yes".
2023-11-08Auto merge of #117542 - compiler-errors:only-normalize-predicate, r=lcnrbors-2/+8
Only use `normalize_param_env` when normalizing predicate in `check_item_bounds` Only use the `normalize_param_env` when normalizing the item bound predicate in `check_item_bounds`, instead of using it when processing this obligation as well. This causes <BUG> to reoccur, but hopefully with better caching in the future, we can fix this would having such bad effects on perf. This PR also fixes #117598. It turns out that the GAT predicate that we install is actually wrong -- given code like: ``` impl<'r> HasValueRef<'r> for Any { type Database = Any; } ``` We currently generate a predicate that looks like `<Any as HasValueRef<'r>>::Database = Any`, where `'r` is an early-bound variable. Really this GAT assumption should be universally quantified over the impl's args, i.e. `for<'r> <Any as HasValueRef<'r>>::Database = Any`, but then we'd need the binder to also include all the WC of the impl as well, which we don't support yet, lol.
2023-11-08rustc_target: move file for uniformityDavid Wood-0/+0
Signed-off-by: David Wood <david@davidtw.co>
2023-11-08targets: move target specs to spec/targetsDavid Wood-26/+26
Signed-off-by: David Wood <david@davidtw.co>
2023-11-08target: move base specs to spec/baseDavid Wood-449/+453
Signed-off-by: David Wood <david@davidtw.co>
2023-11-08Clarify `space_between`.Nicholas Nethercote-30/+42
To avoid `!matches!(...)`, which is hard to think about. Instead every case now uses direct pattern matching and returns true or false. Also add a couple of cases to the `stringify.rs` test that currently print badly.
2023-11-08Only use normalize_param_env when normalizing predicate in check_item_boundsMichael Goulet-2/+8
2023-11-08Rollup merge of #117655 - compiler-errors:method-tweaks, r=estebankMatthias Krüger-158/+138
Method suggestion code tweaks I was rummaging around the method suggestion code after https://github.com/rust-lang/rust/pull/117006#discussion_r1384153722 and saw a few things to simplify. This is two unrelated commits, both in the same file. Review them separately, if you'd like. r? estebank
2023-11-08Rollup merge of #117625 - nnethercote:clippy-perf, r=cuviperMatthias Krüger-8/+4
Fix some clippy perf lints `@matthiaskrgr` gave me the output of a clippy run with perf lints enabled. This PR fixes ones that I thought were worth fixing. r? `@cuviper`
2023-11-08Rollup merge of #116399 - WaffleLapkin:erase_small_things, r=cjgillotMatthias Krüger-6/+16
Small changes w/ `query::Erase<_>` r? `@cjgillot` cc `@Zoxc`
2023-11-08Rollup merge of #113925 - clubby789:const-ctor-repeat, r=estebankMatthias Krüger-19/+71
Improve diagnostic for const ctors in array repeat expressions Fixes #113912
2023-11-07Add -Zcross-crate-inline-threshold=yesBen Kimock-13/+55
2023-11-08rustc: minor changes suggested by clippy perf lints.Nicholas Nethercote-8/+4
2023-11-07Add an explanation for `transmute_unchecked`Maybe Waffle-0/+9