about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2024-09-12Rollup merge of #130208 - nnethercote:rslv-lifetime, r=petrochenkovMatthias Krüger-470/+481
Introduce `'ra` lifetime name. `rustc_resolve` allocates many things in `ResolverArenas`. The lifetime used for references into the arena is mostly `'a`, and sometimes `'b`. This commit changes it to `'rslv`, which is much more descriptive. The commit also changes the order of lifetimes on a couple of structs so that '`rslv` is second last, before `'tcx`, and does other minor renamings such as `'r` to `'a`. r? ``@petrochenkov`` cc ``@oli-obk``
2024-09-12Rollup merge of #130101 - RalfJung:const-cleanup, r=fee1-deadMatthias Krüger-3/+3
some const cleanup: remove unnecessary attributes, add const-hack indications I learned that we use `FIXME(const-hack)` on top of the "const-hack" label. That seems much better since it marks the right place in the code and moves around with the code. So I went through the PRs with that label and added appropriate FIXMEs in the code. IMO this means we can then remove the label -- Cc ``@rust-lang/wg-const-eval.`` I also noticed some const stability attributes that don't do anything useful, and removed them. r? ``@fee1-dead``
2024-09-12Auto merge of #130269 - Zalathar:rollup-coxzt2t, r=Zalatharbors-726/+612
Rollup of 8 pull requests Successful merges: - #125060 (Expand documentation of PathBuf, discussing lack of sanitization) - #129367 (Fix default/minimum deployment target for Aarch64 simulator targets) - #130156 (Add test for S_OBJNAME & update test for LF_BUILDINFO cl and cmd) - #130160 (Fix `slice::first_mut` docs) - #130235 (Simplify some nested `if` statements) - #130250 (Fix `clippy::useless_conversion`) - #130252 (Properly report error on `const gen fn`) - #130256 (Re-run coverage tests if `coverage-dump` was modified) r? `@ghost` `@rustbot` modify labels: rollup
2024-09-12Rollup merge of #130252 - compiler-errors:const-gen, r=chenyukangStuart Cook-27/+23
Properly report error on `const gen fn` Fixes #130232 Also removes some (what I thought were unused) functions, and fixes a bug in clippy where we considered `gen fn` to be the same as `fn` because it was only built to consider asyncness.
2024-09-12Rollup merge of #130250 - compiler-errors:useless-conversion, r=jieyouxuStuart Cook-28/+20
Fix `clippy::useless_conversion` Self-explanatory. Probably the last clippy change I'll actually put up since this is the only other one I've actually seen in the wild.
2024-09-12Rollup merge of #130235 - compiler-errors:nested-if, r=michaelwoeristerStuart Cook-669/+561
Simplify some nested `if` statements Applies some but not all instances of `clippy::collapsible_if`. Some ended up looking worse afterwards, though, so I left those out. Also applies instances of `clippy::collapsible_else_if` Review with whitespace disabled please.
2024-09-12Rollup merge of #129367 - madsmtm:fix-apple-aarch64-deployment-targets, ↵Stuart Cook-2/+8
r=jieyouxu Fix default/minimum deployment target for Aarch64 simulator targets The minimum that `rustc` encoded did not match [the version in Clang](https://github.com/llvm/llvm-project/blob/llvmorg-18.1.8/llvm/lib/TargetParser/Triple.cpp#L1900-L1932), and that meant that that when linking, Clang ended up bumping the version. See https://github.com/rust-lang/rust/issues/129432 for more motivation behind this change. Specifically, this PR sets the correct deployment target of the following targets: - `aarch64-apple-ios-sim` from 10.0 to 14.0 - `aarch64-apple-tvos-sim` from 10.0 to 14.0 - `aarch64-apple-watchos-sim` from 5.0 to 7.0 - `aarch64-apple-ios-macabi` from 13.1 to 14.0 I have chosen not to document the `-sim` changes in the platform support docs, as it is fundamentally uninteresting; the normal targets (e.g. `aarch64-apple-ios`) still have the same deployment target, and that's what developers should actually target. r? compiler CC `@BlackHoleFox`
2024-09-12Auto merge of #130249 - compiler-errors:sad-new-solver-coherence, r=lcnrbors-19/+27
Revert "Stabilize `-Znext-solver=coherence`" This is a clean revert of #121848, prepared by running: ``` $ git revert 17b322fa69eed7216dccc9f097eb68237cf62234 -m1 ``` Which effectively reverts: * a138a9261536ac2bdbb7c01a8aa9dc7d43299cae, 69fdd1457d367ce4de044e9784e58a38acf3d847, d93e047c9f1b33892a604273ab3931815f5604a1, 1a893ac648e03732aaa8b5371b602ab683970b0d see: https://rust-lang.zulipchat.com/#narrow/stream/364551-t-types.2Ftrait-system-refactor/topic/nalgebra.20hang Closes #130056 r? lcnr
2024-09-12Auto merge of #129369 - madsmtm:apple-cc-linker-pass-target, r=jieyouxubors-10/+34
Pass deployment target when linking with CC on Apple targets This PR effectively implements what's also being considered in the `cc` crate [here](https://github.com/rust-lang/cc-rs/issues/1030#issuecomment-2051020649), that is: - When linking macOS targets with CC, pass the `-mmacosx-version-min=.` option to specify the desired deployment target. Also, no longer pass `-m32`/`-m64`, these are redundant since we already pass `-arch`. - When linking with CC on iOS, tvOS, watchOS and visionOS, only pass `-target` (we assume for these targets that CC forwards to Clang). This is required to get the linker to emit the correct `LC_BUILD_VERSION` of the final binary. See https://github.com/rust-lang/rust/issues/129432 for more motivation behind this change. r? compiler CC `@BlackHoleFox`
2024-09-12Auto merge of #117465 - paulmenage:small-data-limit, r=compiler-errorsbors-4/+129
Add -Z small-data-threshold This flag allows specifying the threshold size above which LLVM should not consider placing small objects in a `.sdata` or `.sbss` section. Support is indicated in the target options via the small-data-threshold-support target option, which can indicate either an LLVM argument or an LLVM module flag. To avoid duplicate specifications in a large number of targets, the default value for support is DefaultForArch, which is translated to a concrete value according to the target's architecture.
2024-09-11Remove unused functions from ast CoroutineKindMichael Goulet-8/+0
2024-09-11Rollup merge of #130244 - samueltardieu:qmark-expansion-span-fix, r=jieyouxuJubilee-1/+1
Use the same span for attributes and Try expansion of ? This is needed for Clippy to know that the `#[allow(unused)]` attributes added by the expansion of `?` are part of the desugaring, and that they do not come from the user code. rust-lang/rust-clippy#13380 exhibits a manifestation of this problem and will be fixed by this change.
2024-09-11Rollup merge of #130239 - RalfJung:miri-ptr-offset-unsigned, r=compiler-errorsJubilee-1/+8
miri: fix overflow detection for unsigned pointer offset This is the Miri part of https://github.com/rust-lang/rust/pull/130229. This is already UB in codegen so we better make Miri detect it; updating the docs may take time if we have to follow some approval process, but let's make Miri match reality ASAP. r? ``@scottmcm``
2024-09-11Rollup merge of #130114 - eduardosm:needless-returns, r=compiler-errorsJubilee-75/+66
Remove needless returns detected by clippy in the compiler
2024-09-11Rollup merge of #129103 - Nadrieril:dont-warn-empty-unreachable, ↵Jubilee-1/+5
r=compiler-errors Don't warn empty branches unreachable for now The [stabilization](https://github.com/rust-lang/rust/pull/122792) of `min_exhaustive_patterns` updated the `unreachable_pattern` lint to trigger on empty arms too. This has caused some amount of churn, and imposes an unjoyful `#[allow(unreachable_patterns)]` onto library authors who want to stay backwards-compatible. While I think the lint should eventually cover these cases, for transition's sake I'd prefer to revert linting to what it was prior to stabilization, at least for now. Fixes https://github.com/rust-lang/rust/issues/129031. r? ``@compiler-errors``
2024-09-12Introduce `'ra` lifetime name.Nicholas Nethercote-470/+481
`rustc_resolve` allocates many things in `ResolverArenas`. The lifetime used for references into the arena is mostly `'a`, and sometimes `'b`. This commit changes it to `'ra`, which is much more descriptive. The commit also changes the order of lifetimes on a couple of structs so that '`ra` is second last, before `'tcx`, and does other minor renamings such as `'r` to `'a`.
2024-09-11Properly deny const gen/async gen fnsMichael Goulet-21/+25
2024-09-11Revert 'Stabilize -Znext-solver=coherence'Michael Goulet-19/+27
2024-09-11clippy::useless_conversionMichael Goulet-28/+20
2024-09-11Also fix if in elseMichael Goulet-290/+222
2024-09-11Use the same span for attributes and Try expansion of ?Samuel Tardieu-1/+1
This is needed for Clippy to know that the `#[allow(unused)]` attributes added by the expansion of `?` are part of the desugaring, and that they do not come from the user code. rust-lang/rust-clippy#13380 exhibits a manifestation of this problem.
2024-09-11Auto merge of #130237 - matthiaskrgr:rollup-qmgr8i7, r=matthiaskrgrbors-55/+100
Rollup of 9 pull requests Successful merges: - #129260 (Don't suggest adding return type for closures with default return type) - #129520 (Suggest the correct pattern syntax on usage of unit variant pattern for a struct variant) - #129866 (Clarify documentation labelling and definitions for std::collections) - #130123 (Report the `note` when specified in `diagnostic::on_unimplemented`) - #130161 (refactor merge base logic and fix `x fmt`) - #130206 (Map `WSAEDQUOT` to `ErrorKind::FilesystemQuotaExceeded`) - #130207 (Map `ERROR_CANT_RESOLVE_FILENAME` to `ErrorKind::FilesystemLoop`) - #130219 (Fix false positive with `missing_docs` and `#[test]`) - #130221 (Make SearchPath::new public) r? `@ghost` `@rustbot` modify labels: rollup
2024-09-11miri: fix overflow detection for unsigned pointer offsetRalf Jung-1/+8
2024-09-11Rollup merge of #130221 - vetleras:pub_search_path_new, r=chenyukangMatthias Krüger-1/+1
Make SearchPath::new public I'm writing a tool that uses `rustc_interface`, and would like to construct `SearchPath` with its `new` method. As all three fields in `SearchPath` are public anyway, the proposed change should not change the privacy or encapsulation of the struct.
2024-09-11Rollup merge of #130219 - ogoffart:missing-docs-test, r=UrgauMatthias Krüger-4/+5
Fix false positive with `missing_docs` and `#[test]` Since #130025, the compiler don't ignore missing_docs when compiling the tests. But there is now a false positive warning for every `#[test]` For example, this code ```rust //! Crate docs fn just_a_test() {} ``` Would emit this warning when running `cargo test` ``` warning: missing documentation for a constant --> src/lib.rs:5:1 | 4 | #[test] | ------- in this procedural macro expansion 5 | fn just_a_test() {} | ^^^^^^^^^^^^^^^^^^^ ```
2024-09-11Rollup merge of #130123 - FedericoBruzzone:master, r=compiler-errorsMatthias Krüger-5/+9
Report the `note` when specified in `diagnostic::on_unimplemented` Before this PR the `note` field was completely ignored for some reason, now it is shown (I think) correctly during the hir typechecking phase. 1. Report the `note` when specified in `diagnostic::on_unimplemented` 2. Added a test for unimplemented trait diagnostic 3. Added a test for custom unimplemented trait diagnostic Close #130084 P.S. This is my first PR to rustc.
2024-09-11Rollup merge of #129520 - tunawasabi:suggest-adding-struct-pattern-syntax, ↵Matthias Krüger-1/+31
r=compiler-errors Suggest the correct pattern syntax on usage of unit variant pattern for a struct variant Closes #126243 I add a suggestion on usage of unit variant pattern for a struct variant.
2024-09-11Rollup merge of #129260 - wafarm:dont-suggest-closures, r=compiler-errorsMatthias Krüger-44/+54
Don't suggest adding return type for closures with default return type Follow up of #129223 r? ``@compiler-errors``
2024-09-11Simplify some nested if statementsMichael Goulet-379/+339
2024-09-11Auto merge of #130197 - RalfJung:interp-perf, r=saethlinbors-0/+5
interpret: mark some hot functions inline(always) That seems to recover a good part of the perf impact of https://github.com/rust-lang/rust/pull/129778. r? `@saethlin`
2024-09-11Revert warning empty patterns as unreachableNadrieril-1/+5
2024-09-11Auto merge of #130195 - folkertdev:naked-asm-outside-naked-fn, r=Amanieubors-16/+77
disallow `naked_asm!` outside of `#[naked]` functions tracking issue: https://github.com/rust-lang/rust/issues/90957 parent PR: https://github.com/rust-lang/rust/pull/128651 I split this out from the parent PR because it's self-contained and because the analysis has to search through all functions and there might be performance regressions. r? `@Amanieu`
2024-09-11Use `doc(hidden)` instead of `allow(missing_docs)` in the test harnessOlivier Goffart-4/+3
So that it doesn't fail with `forbid(missing_docs)` Fixes #130218
2024-09-11Use `#[doc(hidden)]` instead of `#[allow(missing_docs)]` on the const ↵Olivier Goffart-2/+2
generated for `#[test]`
2024-09-11Make SearchPath::new publicVetle Rasmussen-1/+1
2024-09-11Fix false positive with `missing_docs` and `#[test]`Olivier Goffart-0/+2
Since #130025, the compiler don't ignore missing_docs when compiling the tests. But there is now a false positive warning for every `#[test]` For example, this code ```rust //! Crate docs fn just_a_test() {} ``` Would emit this warning when running `cargo test` ``` warning: missing documentation for a constant --> src/lib.rs:5:1 | 4 | #[test] | ------- in this procedural macro expansion 5 | fn just_a_test() {} | ^^^^^^^^^^^^^^^^^^^ ```
2024-09-11Auto merge of #130194 - lcnr:generalize-cache, r=compiler-errorsbors-9/+9
generalize: track relevant info in cache key This was previously theoretically incomplete as we could incorrectly generalize as if the type was in an invariant context even though we're in a covariant one. Similar with the `in_alias` flag. r? `@compiler-errors`
2024-09-11Auto merge of #130050 - cjgillot:expect-attr-id, r=fee1-deadbors-159/+49
Enumerate lint expectations using AttrId This PR implements the idea I outlined in https://github.com/rust-lang/rust/issues/127884#issuecomment-2240338547 We can uniquely identify a lint expectation `#[expect(lint0, lint1...)]` using the `AttrId` and the index of the lint inside the attribute. This PR uses this property in `check_expectations`. In addition, this PR stops stashing expected diagnostics to wait for the unstable -> stable `LintExpectationId` mapping: if the lint is emitted with an unstable attribute, it must have been emitted by an `eval_always` query (like inside the resolver), so won't be loaded from cache. Decoding an `AttrId` from the on-disk cache ICEs, so we have no risk of accidentally checking an expectation. Fixes https://github.com/rust-lang/rust/issues/127884 cc `@xFrednet`
2024-09-10Auto merge of #129403 - scottmcm:only-array-simd, r=compiler-errorsbors-68/+68
Ban non-array SIMD Nearing the end of https://github.com/rust-lang/compiler-team/issues/621 ! Currently blocked on ~~https://github.com/rust-lang/compiler-builtins/pull/673~~ ~~https://github.com/rust-lang/compiler-builtins/pull/674~~ ~~https://github.com/rust-lang/rust/pull/129400~~ ~~https://github.com/rust-lang/rust/pull/129481~~ for windows.
2024-09-10Report the `note` when specified in `diagnostic::on_unimplemented`FedericoBruzzone-5/+9
Signed-off-by: FedericoBruzzone <federico.bruzzone.i@gmail.com>
2024-09-10interpret: mark some hot functions inline(always)Ralf Jung-0/+5
recovers some of the perf regressions from #129778
2024-09-10Auto merge of #130200 - matthiaskrgr:rollup-2g4ijc5, r=matthiaskrgrbors-702/+671
Rollup of 5 pull requests Successful merges: - #130143 (miri-test-libstd: add missing BOOTSTRAP_ARGS) - #130173 (rustdoc: add two regression tests) - #130175 (`rustc_mir_transform` cleanups 3) - #130184 (coverage: Clean up terminology in counter creation) - #130185 (abi/compatibility test: remove tests inside repr(C) wrappers) r? `@ghost` `@rustbot` modify labels: rollup
2024-09-10Add -Z small-data-thresholdPaul Menage-4/+129
This flag allows specifying the threshold size above which LLVM should not consider placing small objects in a .sdata or .sbss section. Support is indicated in the target options via the small-data-threshold-support target option, which can indicate either an LLVM argument or an LLVM module flag. To avoid duplicate specifications in a large number of targets, the default value for support is DefaultForArch, which is translated to a concrete value according to the target's architecture.
2024-09-10Rollup merge of #130184 - Zalathar:counters, r=compiler-errorsMatthias Krüger-132/+102
coverage: Clean up terminology in counter creation Some of the terminology in this module is confusing, or has drifted out of sync with other parts of the coverage code. This PR therefore renames some variables and methods, and adjusts comments and debug logging statements, to make things clearer and more consistent. No functional changes, other than some small tweaks to debug logging.
2024-09-10Rollup merge of #130175 - nnethercote:rustc_mir_transform-cleanups-3, r=saethlinMatthias Krüger-570/+569
`rustc_mir_transform` cleanups 3 More cleanups in the style of https://github.com/rust-lang/rust/pull/129929. r? `@saethlin`
2024-09-10Auto merge of #130025 - Urgau:missing_docs-expect, r=petrochenkovbors-7/+4
Also emit `missing_docs` lint with `--test` to fulfil expectations This PR removes the "test harness" suppression of the `missing_docs` lint to be able to fulfil `#[expect]` (expectations) as it is now "relevant". I think the goal was to maybe avoid false-positive while linting on public items under `#[cfg(test)]` but with effective visibility we should no longer have any false-positive. Another possibility would be to query the lint level and only emit the lint if it's of expect level, but that is even more hacky. Fixes https://github.com/rust-lang/rust/issues/130021 try-job: x86_64-gnu-aux
2024-09-10generalize: track relevant info in cache keylcnr-9/+9
2024-09-10disallow `naked_asm!` outside of `#[naked]` functionsFolkert de Vries-16/+77
2024-09-10coverage: Avoid referring to "operands" in counter creationZalathar-8/+8
2024-09-10coverage: Avoid referring to out-edges as "branches"Zalathar-97/+80
This makes the graph terminology a bit more consistent, and avoids potential confusion with branch coverage.