about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2024-10-30compiler: Switch to rustc_abi in hir_pretty, lint_defs, and mir_buildJubilee Young-23/+23
Completely abandon usage of rustc_target in these crates, as they need no special knowledge of rustc's target tuples.
2024-10-30compiler: Lift `rustc_target::spec::abi::Abi` to `rustc_abi::ExternAbi`Jubilee Young-2/+24
2024-10-30Auto merge of #132371 - workingjubilee:rollup-aqd86tm, r=workingjubileebors-1506/+1580
Rollup of 5 pull requests Successful merges: - #129383 (Remap impl-trait lifetimes on HIR instead of AST lowering) - #132210 (rustdoc: make doctest span tweak a 2024 edition change) - #132246 (Rename `rustc_abi::Abi` to `BackendRepr`) - #132267 (force-recompile library changes on download-rustc="if-unchanged") - #132344 (Merge `HostPolarity` and `BoundConstness`) Failed merges: - #132347 (Remove `ValueAnalysis` and `ValueAnalysisWrapper`.) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-30Rollup merge of #132344 - compiler-errors:same-thing, r=lcnrJubilee-81/+66
Merge `HostPolarity` and `BoundConstness` They're basically the same thing, and I think `BoundConstness` is easier to use. r? fee1-dead or reassign
2024-10-30Rollup merge of #132267 - onur-ozkan:rustc-if-unchanged-force-library, r=KobzolJubilee-20/+27
force-recompile library changes on download-rustc="if-unchanged" This makes the download-rustc="if-unchanged" option more functional and useful for library developers. Implements the second item from [this tracking issue](https://github.com/rust-lang/rust/issues/131744).
2024-10-30Rollup merge of #132246 - workingjubilee:campaign-on-irform, r=compiler-errorsJubilee-646/+876
Rename `rustc_abi::Abi` to `BackendRepr` Remove the confabulation of `rustc_abi::Abi` with what "ABI" actually means by renaming it to `BackendRepr`, and rename `Abi::Aggregate` to `BackendRepr::Memory`. The type never actually represented how things are passed, as that has to have `PassMode` considered, at minimum, but rather it just is how we represented some things to the backend. This conflation arose because LLVM, the primary backend at the time, would lower certain IR forms using certain ABIs. Even that only somewhat was true, as it broke down when one ventured significantly afield of what is described by the System V AMD64 ABI either by using different architectures, ABI-modifying IR annotations, the same architecture **with different ISA extensions enabled**, or other... unexpected delights. Unfortunately both names are still somewhat of a misnomer right now, as people have written code for years based on this misunderstanding. Still, their original names are even moreso, and for better or worse, this backend code hasn't received as much maintenance as the rest of the compiler, lately. Actually arriving at a correct end-state will simply require us to disentangle a lot of code in order to fix, much of it pointlessly repeated in several places. Thus this is not an "actual fix", just a way to deflect further misunderstandings.
2024-10-30Rollup merge of #132210 - notriddle:notriddle/doctest-span-hack, ↵Jubilee-13/+99
r=GuillaumeGomez rustdoc: make doctest span tweak a 2024 edition change Fixes #132203 This is a compatibility hack, because I think the new behavior is better. When an A `include_str!` B, and B `include_str!` C, the path to C should be resolved relative to B, not A. That's how `include!` itself works, so that's how `include_str!` with should work.
2024-10-30Rollup merge of #129383 - cjgillot:opaque-noremap, ↵Jubilee-746/+512
r=compiler-errors,petrochenkov Remap impl-trait lifetimes on HIR instead of AST lowering Current AST->HIR lowering goes out of its way to remap lifetimes for opaque types. This is complicated and leaks into upstream and downstream code. This PR stops trying to be clever during lowering, and prefers to do this remapping during the HIR->ty lowering. The remapping computation easily fits into the bound var resolution code. Its result can be used in by `generics_of` and `hir_ty_lowering::new_opaque` to add the proper parameters and arguments. See an example on the doc for query `opaque_captured_lifetimes`. Based on https://github.com/rust-lang/rust/pull/129244/ Fixes https://github.com/rust-lang/rust/issues/125249 Fixes https://github.com/rust-lang/rust/issues/126850 cc `@compiler-errors` `@spastorino` r? `@petrochenkov`
2024-10-30Ignore Windows due to its differing path syntaxMichael Howell-4/+5
2024-10-30Auto merge of #132361 - jieyouxu:rollup-zburkwr, r=jieyouxubors-186/+836
Rollup of 6 pull requests Successful merges: - #130098 (Reject generic self types.) - #131096 (rustdoc: Remove usage of `allow(unused)` attribute on `no_run` merged doctests) - #132315 (compiletest: improve robustness of LLVM version handling) - #132346 (Some graphviz tweaks) - #132359 (Fix AIX libc call char type from i8 to u8) - #132360 (Un-vacation myself) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-30Merge HostPolarity and BoundConstnessMichael Goulet-81/+66
2024-10-30Actually capture all in-scope lifetimes.Camille GILLOT-93/+75
2024-10-30Promote test.Camille GILLOT-1/+1
2024-10-30Review comments.Camille GILLOT-158/+2
2024-10-30Adapt comments.Camille GILLOT-12/+12
2024-10-30Promote crashes tests to ui.Camille GILLOT-9/+38
2024-10-30Remap impl-trait lifetimes on HIR instead of AST lowering.Camille GILLOT-596/+507
2024-10-30Rollup merge of #132360 - BoxyUwU:hellorustc, r=BoxyUwU许杰友 Jieyou Xu (Joe)-1/+0
Un-vacation myself beep boop
2024-10-30Rollup merge of #132359 - mustartt:henry/match-libc-char-type, r=jieyouxu许杰友 Jieyou Xu (Joe)-1/+1
Fix AIX libc call char type from i8 to u8 There was an update to AIX `libc` default char type from `i8 -> u8`, we should reflect that on the call site to satisfy the type checker. https://github.com/rust-lang/libc/blame/81f0cd3d9715e579c92063f78d0d14da85a31dd1/src/unix/aix/mod.rs#L1
2024-10-30Rollup merge of #132346 - nnethercote:some-graphviz-tweaks, r=cjgillot许杰友 Jieyou Xu (Joe)-53/+58
Some graphviz tweaks r? `@cjgillot`
2024-10-30Rollup merge of #132315 - jieyouxu:extract-llvm-version, r=onur-ozkan许杰友 Jieyou Xu (Joe)-70/+140
compiletest: improve robustness of LLVM version handling Previously, `extract_llvm_versions` did some gymnastics for llvm versions by combining `(major, minor, patch)` into a combined version integer, but that is not very robust and made it difficult to add `max-llvm-major-version`. This PR tries to: - Improve llvm version handling robustness by parsing and representing the version as a semver. We intentionally deviate from strict semver standards by allowing omission of minor and patch versions. They default to `0` when absent. This is for convenience to allow the user to write e.g. `//@ min-llvm-version: 18` instead of having to spell out the full `major.minor.patch` semver string `//@ min-llvm-verison: 18.0.0`. - Adjust some panic messages to include a bit more context about *why* the version string was rejected. Prerequisite for #132310. r? bootstrap (or compiler)
2024-10-30Rollup merge of #131096 - GuillaumeGomez:rm-no_unused, r=notriddle许杰友 Jieyou Xu (Joe)-4/+88
rustdoc: Remove usage of `allow(unused)` attribute on `no_run` merged doctests Fixes [#130681](https://github.com/rust-lang/rust/issues/130681). It fixes the behaviour difference with the current doctests. r? ``@notriddle``
2024-10-30Rollup merge of #130098 - adetaylor:arbitrary-self-types-block-generics, ↵许杰友 Jieyou Xu (Joe)-57/+549
r=wesleywiser Reject generic self types. The RFC for arbitrary self types v2 declares that we should reject "generic" self types. This commit does so. The definition of "generic" was unclear in the RFC, but has been explored in https://github.com/rust-lang/rust/issues/129147 and the conclusion is that "generic" means any `self` type which is a type parameter defined on the method itself, or references to such a type. This approach was chosen because other definitions of "generic" don't work. Specifically, * we can't filter out generic type _arguments_, because that would filter out Rc<Self> and all the other types of smart pointer we want to support; * we can't filter out all type params, because Self itself is a type param, and because existing Rust code depends on other type params declared on the type (as opposed to the method). This PR decides to make a new error code for this case, instead of reusing the existing E0307 error. This makes the code a bit more complex, but it seems we have an opportunity to provide specific diagnostics for this case so we should do so. This PR filters out generic self types whether or not the 'arbitrary self types' feature is enabled. However, it's believed that it can't have any effect on code which uses stable Rust, since there are no stable traits which can be used to indicate a valid generic receiver type, and thus it would have been impossible to write code which could trigger this new error case. It is however possible that this could break existing code which uses either of the unstable `arbitrary_self_types` or `receiver_trait` features. This breakage is intentional; as we move arbitrary self types towards stabilization we don't want to continue to support generic such types. This PR adds lots of extra tests to arbitrary-self-from-method-substs. Most of these are ways to trigger a "type mismatch" error which https://github.com/rust-lang/rust/blob/9b82580c7347f800c2550e6719e4218a60a80b28/compiler/rustc_hir_typeck/src/method/confirm.rs#L519 hopes can be minimized by filtering out generics in this way. We remove a FIXME from confirm.rs suggesting that we make this change. It's still possible to cause type mismatch errors, and a subsequent PR may be able to improve diagnostics in this area, but it's harder to cause these errors without contrived uses of the turbofish. This is a part of the arbitrary self types v2 project, https://github.com/rust-lang/rfcs/pull/3519 https://github.com/rust-lang/rust/issues/44874 r? `@wesleywiser`
2024-10-30the unvacationerBoxy-1/+0
2024-10-30fix libc call from i8 to u8Henry Jiang-1/+1
2024-10-30Switch to comparing indices instead of names.Adrian Taylor-28/+11
2024-10-30Reject generic self types.Adrian Taylor-61/+570
The RFC for arbitrary self types v2 declares that we should reject "generic" self types. This commit does so. The definition of "generic" was unclear in the RFC, but has been explored in https://github.com/rust-lang/rust/issues/129147 and the conclusion is that "generic" means any `self` type which is a type parameter defined on the method itself, or references to such a type. This approach was chosen because other definitions of "generic" don't work. Specifically, * we can't filter out generic type _arguments_, because that would filter out Rc<Self> and all the other types of smart pointer we want to support; * we can't filter out all type params, because Self itself is a type param, and because existing Rust code depends on other type params declared on the type (as opposed to the method). This PR decides to make a new error code for this case, instead of reusing the existing E0307 error. This makes the code a bit more complex, but it seems we have an opportunity to provide specific diagnostics for this case so we should do so. This PR filters out generic self types whether or not the 'arbitrary self types' feature is enabled. However, it's believed that it can't have any effect on code which uses stable Rust, since there are no stable traits which can be used to indicate a valid generic receiver type, and thus it would have been impossible to write code which could trigger this new error case. It is however possible that this could break existing code which uses either of the unstable `arbitrary_self_types` or `receiver_trait` features. This breakage is intentional; as we move arbitrary self types towards stabilization we don't want to continue to support generic such types. This PR adds lots of extra tests to arbitrary-self-from-method-substs. Most of these are ways to trigger a "type mismatch" error which https://github.com/rust-lang/rust/blob/9b82580c7347f800c2550e6719e4218a60a80b28/compiler/rustc_hir_typeck/src/method/confirm.rs#L519 hopes can be minimized by filtering out generics in this way. We remove a FIXME from confirm.rs suggesting that we make this change. It's still possible to cause type mismatch errors, and a subsequent PR may be able to improve diagnostics in this area, but it's harder to cause these errors without contrived uses of the turbofish. This is a part of the arbitrary self types v2 project, https://github.com/rust-lang/rfcs/pull/3519 https://github.com/rust-lang/rust/issues/44874 r? @wesleywiser
2024-10-30Auto merge of #130860 - tmandry:fix-directives, r=jieyouxubors-16/+23
Fix directives for lint-non-snake-case-crate This test fails on targets without unwinding or with `--target-rustcflags=-Cpanic=abort` because the proc macro was compiled as the target, not the host. Some targets were explicitly disabled to pass CI, but these directives are more general. * `needs-dynamic-linking` is self explanatory * `force-host` for proc macros * `no-prefer-dynamic` is apparently also used for proc macros Note that `needs-unwind` can also be useful for situations other than proc macros where unwinding is necessary. r? `@jieyouxu` try-job: test-various
2024-10-30tests: Bless `rustc_abi::Abi::Aggregate` => `::Memory`Jubilee Young-97/+164
2024-10-30tests: cross-compile multi-platform ZST ABI testsJubilee Young-27/+76
This allows them to be blessed, regardless of platform.
2024-10-30Auto merge of #132349 - matthiaskrgr:rollup-9g6s4p2, r=matthiaskrgrbors-1071/+1009
Rollup of 8 pull requests Successful merges: - #129394 (Don't lint `irrefutable_let_patterns` on leading patterns if `else if` let-chains) - #131856 (TypingMode: merge intercrate, reveal, and defining_opaque_types) - #132322 (powerpc64-ibm-aix: update maintainters) - #132327 (Point to Fuchsia team in platform support docs) - #132332 (Use `token_descr` more in error messages) - #132338 (Remove `Engine`) - #132340 (cg_llvm: Consistently use safe wrapper function `set_section`) - #132342 (cg_llvm: Clean up FFI calls for operand bundles) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-30Rollup merge of #132342 - Zalathar:operand-bundle, r=workingjubileeMatthias Krüger-138/+103
cg_llvm: Clean up FFI calls for operand bundles All of these FFI functions have equivalents in the stable LLVM-C API, though `LLVMBuildCallBr` requires a temporary polyfill on LLVM 18. This PR also creates a clear split between `OperandBundleOwned` and `OperandBundle`, and updates the internals of the owner to be a little less terrifying.
2024-10-30Rollup merge of #132340 - Zalathar:set-section, r=compiler-errorsMatthias Krüger-18/+18
cg_llvm: Consistently use safe wrapper function `set_section` Follow-up to #131962 and https://github.com/rust-lang/rust/pull/132260#discussion_r1821626260. To avoid too much scope creep, I've deliberately kept the changes to `LLVMRustGetSliceFromObjectDataByName` as minimal as possible.
2024-10-30Rollup merge of #132338 - nnethercote:rm-Engine, r=nnethercoteMatthias Krüger-205/+139
Remove `Engine` It's just unnecessary plumbing. Removing it results in less code, and simpler code. r? ``@cjgillot``
2024-10-30Rollup merge of #132332 - nnethercote:use-token_descr-more, r=estebankMatthias Krüger-159/+152
Use `token_descr` more in error messages This is the first two commits from #124141, put into their own PR to get things rolling. Commit messages have the details. r? ``@estebank`` cc ``@petrochenkov``
2024-10-30Rollup merge of #132327 - djkoloski:redirect_fuchsia_maintainers, ↵Matthias Krüger-10/+2
r=compiler-errors Point to Fuchsia team in platform support docs This consolidates our docs into a single source of truth for the current Fuchsia maintainers. r? ```@tmandry```
2024-10-30Rollup merge of #132322 - daltenty:daltenty/update-aix-maintainters, ↵Matthias Krüger-2/+2
r=workingjubilee powerpc64-ibm-aix: update maintainters Chaofan (`@ecnelises)` and Kai (`@bzEq)` will be passing over maintainership for the target over to David Tenty (`@daltenty)` and Chris Cambly (`@gilamn5tr)`
2024-10-30Rollup merge of #131856 - lcnr:typing-mode, r=compiler-errorsMatthias Krüger-531/+536
TypingMode: merge intercrate, reveal, and defining_opaque_types This adds `TypingMode` and uses it in most places. We do not yet remove `Reveal` from `param_env`s. This and other future work as tracked in #132279 and via `FIXME`s. Fetching the `TypingMode` of the `InferCtxt` asserts that the `TypingMode` agrees with `ParamEnv::reveal` to make sure we don't introduce any subtle bugs here. This will be unnecessary once `ParamEnv::reveal` no longer exists. As the `TypingMode` is now a part of the query input, I've merged the coherence and non-coherence caches for the new solver. I've also enabled the local `infcx` cache during coherence by clearing the cache when forking it with a different `TypingMode`. #### `TypingMode::from_param_env` I am using this even in cases where I know that the `param_env` will always be `Reveal::UserFacing`. This is to make it easier to correctly refactor this code in the future, any time we use `Reveal::UserFacing` in a body while not defining its opaque types is incorrect and should use a `TypingMode` which only reveals opaques defined by that body instead, cc #124598 r? ``@compiler-errors``
2024-10-30Rollup merge of #129394 - Jarcho:irrefutable_let_patterns, r=NadrierilMatthias Krüger-8/+57
Don't lint `irrefutable_let_patterns` on leading patterns if `else if` let-chains fixes #128661 Is there any preference where the test goes? There looks to be several places it could fit.
2024-10-30compiletest: improve robustness of LLVM version handling许杰友 Jieyou Xu (Joe)-70/+140
2024-10-30Clean up FFI calls for operand bundlesZalathar-138/+103
2024-10-30Auto merge of #132238 - Urgau:midpoint-i64-hackers-impl, r=joboetbors-2/+2
Use Hacker's Delight impl in `i64::midpoint` instead of wide `i128` impl This PR switches `i64::midpoint` and (`isize::midpoint` where `isize == i64`) to using our Hacker's Delight impl instead of wide `i128` implementation. As LLVM seems to be outperformed by the complexity of signed 128-bits number compared to our Hacker's Delight implementation.[^1] It doesn't seems like it's an improvement for the other sizes[^2], so we let them with the wide implementation. [^1]: https://rust.godbolt.org/z/ravE75EYj [^2]: https://rust.godbolt.org/z/fzr171zKh r? libs
2024-10-30Return label from `write_node_label`.Nicholas Nethercote-4/+10
Instead of appending an empty label. Because it's conceptually simpler.
2024-10-30Simplify `graphviz::Formatter`.Nicholas Nethercote-27/+26
`Formatter` currently has a `RefCell<Option<Results>>` field. This is so the `Results` can be temporarily taken and put into a `ResultsCursor` that is used by `BlockFormatter`, and then put back, which is messy. This commit changes `Formatter` to have a `RefCell<ResultsCursor>` and `BlockFormatter` to have a `&mut ResultsCursor`, which greatly simplifies the code at the `Formatter`/`BlockFormatter` interaction point in `Formatter::node_label`. It also means we construct a `ResultsCursor` once per `Formatter`, instead of once per `node_label` call. The commit also: - documents the reason for the `RefCell`; - adds a `Formatter::body` method, replacing the `Formatter::body` field.
2024-10-30Rename `BlockFormatter::results` as `BlockFormatter::cursor`.Nicholas Nethercote-26/+26
Because it's a `ResultsCursor`, not a `Results`. I find this easier to read and understand.
2024-10-30Consistently use safe wrapper function `set_section`Zalathar-18/+18
2024-10-29Fix directives for lint-non-snake-case-crateTyler Mandry-16/+23
This test fails on targets without unwinding because the proc macro was compiled as the target, not the host. Some targets were explicitly disabled to pass CI, but these directives are more general. Fixes Fuchsia tests.
2024-10-30Remove `Engine`.Nicholas Nethercote-102/+80
It's no longer needed. `Engine::iterate_to_fixpoint` can be inlined into `Analysis::iterate_to_fixpoint` and removed. The commit also renames `engine.rs` as `results.rs`.
2024-10-30Remove `Analysis::into_engine`.Nicholas Nethercote-116/+72
This is a standard pattern: ``` MyAnalysis.into_engine(tcx, body).iterate_to_fixpoint() ``` `into_engine` and `iterate_to_fixpoint` are always called in pairs, but sometimes with a builder-style `pass_name` call between them. But a builder-style interface is overkill here. This has been bugging me a for a while. This commit: - Merges `Engine::new` and `Engine::iterate_to_fixpoint`. This removes the need for `Engine` to have fields, leaving it as a trivial type that the next commit will remove. - Renames `Analysis::into_engine` as `Analysis::iterate_to_fixpoint`, gives it an extra argument for the optional pass name, and makes it call `Engine::iterate_to_fixpoint` instead of `Engine::new`. This turns the pattern from above into this: ``` MyAnalysis.iterate_to_fixpoint(tcx, body, None) ``` which is shorter at every call site, and there's less plumbing required to support it.
2024-10-29rust-analyzer: `rustc_abi::Abi` => `BackendRepr`Jubilee Young-11/+11