about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2024-09-13Auto merge of #107251 - dingxiangfei2009:let-chain-rescope, r=jieyouxubors-14/+783
Rescope temp lifetime in if-let into IfElse with migration lint Tracking issue #124085 This PR shortens the temporary lifetime to cover only the pattern matching and consequent branch of a `if let`. At the expression location, means that the lifetime is shortened from previously the deepest enclosing block or statement in Edition 2021. This warrants an Edition change. Coming with the Edition change, this patch also implements an edition lint to warn about the change and a safe rewrite suggestion to preserve the 2021 semantics in most cases. Related to #103108. Related crater runs: https://github.com/rust-lang/rust/pull/129466.
2024-09-13Auto merge of #129137 - camelid:lazy-def-macro-const, r=BoxyUwUbors-164/+46
Fix anon const def-creation when macros are involved Fixes #128016. Ever since #125915, some `ast::AnonConst`s turn into `hir::ConstArgKind::Path`s, which don't have associated `DefId`s. To deal with the fact that we don't have resolution information in `DefCollector`, we decided to implement a process where if the anon const *appeared* to be trivial (i.e., `N` or `{ N }`), we would avoid creating a def for it in `DefCollector`. If later, in AST lowering, we realized it turned out to be a unit struct literal, or we were lowering it to something that didn't use `hir::ConstArg`, we'd create its def there. However, let's say we have a macro `m!()` that expands to a reference to a free constant `FOO`. If we use `m!()` in the body of an anon const (e.g., `Foo<{ m!() }>`), then in def collection, it appears to be a nontrivial anon const and we create a def. But the macro expands to something that looks like a trivial const arg, but is not, so in AST lowering we "fix" the mistake we assumed def collection made and create a def for it. This causes a duplicate definition ICE. The long-term fix for this is to delay the creation of defs for all expression-like nodes until AST lowering (see #128844 for an incomplete attempt at this). This would avoid issues like this one that are caused by hacky workarounds. However, doing this uncovers a pre-existing bug with opaque types that is quite involved to fix (see #129023). In the meantime, this PR fixes the bug by delaying def creation for anon consts whose bodies are macro invocations until after we expand the macro and know what is inside it. This is accomplished by adding information to create the anon const's def to the data in `Resolver.invocation_parents`. r? `@BoxyUwU`
2024-09-13simplify the suggestion notesDing Xiang Fei-263/+70
2024-09-12Re-enable `ConstArgKind::Path` lowering by defaultNoah Lev-164/+46
...and remove the `const_arg_path` feature gate as a result. It was only a stopgap measure to fix the regression that the new lowering introduced (which should now be fixed by this PR).
2024-09-12Rollup merge of #130276 - compiler-errors:nalgebra-hang, r=lcnrMatthias Krüger-0/+23
Add test for nalgebra hang in coherence r? lcnr
2024-09-12Rollup merge of #130273 - lcnr:overflow-no-constraints, r=compiler-errorsMatthias Krüger-0/+2
more eagerly discard constraints on overflow We always discard the results of overflowing goals inside of the trait solver. We previously did so when instantiating the response in `evaluate_goal`. Canonicalizing results only to later discard them is also inefficient :shrug: It's simpler and nicer to debug to eagerly discard constraints inside of the query itself. r? ``@compiler-errors``
2024-09-12Rollup merge of #130101 - RalfJung:const-cleanup, r=fee1-deadMatthias Krüger-3/+1
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-12Add test for nalgebra hang in coherenceMichael Goulet-0/+23
2024-09-12Auto merge of #130269 - Zalathar:rollup-coxzt2t, r=Zalatharbors-31/+78
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-12more eagerly discard constraints on overflowlcnr-0/+2
2024-09-12Rollup merge of #130252 - compiler-errors:const-gen, r=chenyukangStuart Cook-0/+32
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 #130156 - nebulark:test_buildinfo, r=jieyouxuStuart Cook-19/+30
Add test for S_OBJNAME & update test for LF_BUILDINFO cl and cmd Update the unit test for checking cl and cmd in LF_BUILDINFO. With llvm-pdbutil we can now more specifically check if the string appears at the right location instead of just checking whether the string exists at all. Context: https://github.com/rust-lang/rust/issues/96475
2024-09-12Rollup merge of #129367 - madsmtm:fix-apple-aarch64-deployment-targets, ↵Stuart Cook-12/+16
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-373/+551
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-6/+4
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-0/+92
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-11Rollup merge of #129835 - RalfJung:float-tests, r=workingjubileeJubilee-248/+251
enable const-float-classify test, and test_next_up/down on 32bit x86 The test_next_up/down tests have been disabled on all 32bit x86 targets, which goes too far -- they should definitely work on our (tier 1) i686 target, it is only without SSE that we might run into trouble due to https://github.com/rust-lang/rust/issues/114479. However, I cannot reproduce that trouble any more -- maybe that got fixed by https://github.com/rust-lang/rust/pull/123351? The const-float-classify test relied on const traits "because we can", and got disabled when const traits got removed. That's an unfortunate reduction in test coverage of our float functionality, so let's restore the test in a way that does not rely on const traits. The const-float tests are actually testing runtime behavior as well, and I don't think that runtime behavior is covered anywhere else. Probably they shouldn't be called "const-float", but we don't have a `tests/ui/float` folder... should I create one and move them there? Are there any other ui tests that should be moved there? I also removed some FIXME referring to not use x87 for Rust-to-Rust-calls -- that has happened in #123351 so this got fixed indeed. Does that mean we can simplify all that float code again? I am not sure how to test it. Is running the test suite with an i586 target enough? Cc ```@tgross35``` ```@workingjubilee```
2024-09-11Rollup merge of #129103 - Nadrieril:dont-warn-empty-unreachable, ↵Jubilee-464/+91
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-11Properly deny const gen/async gen fnsMichael Goulet-0/+32
2024-09-11Revert 'Stabilize -Znext-solver=coherence'Michael Goulet-373/+551
2024-09-11Rollup merge of #130219 - ogoffart:missing-docs-test, r=UrgauMatthias Krüger-2/+10
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-0/+53
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-0/+55
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-29/+20
Don't suggest adding return type for closures with default return type Follow up of #129223 r? ``@compiler-errors``
2024-09-11Revert warning empty patterns as unreachableNadrieril-464/+91
2024-09-11Auto merge of #130195 - folkertdev:naked-asm-outside-naked-fn, r=Amanieubors-0/+55
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-2/+4
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-3/+3
generated for `#[test]`
2024-09-11Fix false positive with `missing_docs` and `#[test]`Olivier Goffart-0/+6
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-7/+7
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-8/+23
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-10clean up internal comments about float semanticsRalf Jung-0/+1
- remove an outdated FIXME - add reference to floating-point semantics issue Co-authored-by: Jubilee <workingjubilee@gmail.com>
2024-09-10enable and extend float-classify testRalf Jung-126/+128
2024-09-10move float tests into their own dirJubilee Young-0/+0
2024-09-10Auto merge of #129403 - scottmcm:only-array-simd, r=compiler-errorsbors-1051/+764
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-0/+53
Signed-off-by: FedericoBruzzone <federico.bruzzone.i@gmail.com>
2024-09-10Auto merge of #130200 - matthiaskrgr:rollup-2g4ijc5, r=matthiaskrgrbors-41/+63
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-11downgrade borrowck suggestion level due to possible span conflictDing Xiang Fei-34/+79
2024-09-11coalesce lint suggestions that can intersectDing Xiang Fei-47/+353
2024-09-11rescope temp lifetime in let-chain into IfElseDing Xiang Fei-14/+625
apply rules by span edition
2024-09-10Add -Z small-data-thresholdPaul Menage-0/+92
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 #130185 - RalfJung:abi-compat-repr-c-wrappers, r=compiler-errorsMatthias Krüger-41/+11
abi/compatibility test: remove tests inside repr(C) wrappers When I wrote the test I assumed we'd guarantee ABI compatibility to be "structural" wrt `repr(C)` types, i.e. if two `repr(C)` types have all their fields be pairwise ABI-compatible then the types are ABI-compatible. That got removed from the ABI compatibility docs before they landed, though, so let's also remove it from this test.
2024-09-10Rollup merge of #130173 - fmease:rustdoc-regression-tests, r=notriddleMatthias Krüger-0/+52
rustdoc: add two regression tests They were basically copy/pasted from `tests/ui/` to `tests/rustdoc-ui/`. Not sure if it's worth adding these, I can just close these issues as is if you want. This brings the number of https://github.com/rust-lang/rust/labels/T-rustdoc + https://github.com/rust-lang/rust/labels/E-needs-test from 3 down to 1. The remaining one – #103004 — is a nasty one to retroactively find a proper(!) test for. Fixes #98250. Fixes #107872. r? rustdoc
2024-09-10Add test for S_OBJNAME and update test for LF_BUILDINFO cl and cmd forFlorian Schmiderer-19/+30
pdb files.
2024-09-10Auto merge of #130025 - Urgau:missing_docs-expect, r=petrochenkovbors-0/+33
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-7/+7
2024-09-10disallow `naked_asm!` outside of `#[naked]` functionsFolkert de Vries-0/+55
2024-09-10abi/compatibility test: remove tests inside repr(C) wrappersRalf Jung-41/+11
2024-09-10Auto merge of #129337 - EtomicBomb:rfc, r=notriddlebors-0/+518
rustdoc rfc#3662 changes under unstable flags * All new functionality is under unstable options * Adds `--merge=shared|none|finalize` flags * Adds `--parts-out-dir=<crate specific directory>` for `--merge=none` to write cross-crate info file for a single crate * Adds `--include-parts-dir=<previously specified directory>` for `--merge=finalize` to write cross-crate info files * `tests/rustdoc/` tests for the new flags
2024-09-09Ban non-array SIMDScott McMurray-1051/+764