summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2024-10-11Disable jump threading UnOp::Not for non-boolMichael Goulet-2/+47
(cherry picked from commit f0bfba258330884df9c9d14a0aafd741ca9bbdc9)
2024-10-11Failing diff testMichael Goulet-0/+58
(cherry picked from commit 9c91a4ef1652e5f01742185f43541ab22e6f01db)
2024-10-08Reject leading unsafe in `cfg!(...)` and `--check-cfg`.Urgau-3/+31
(cherry picked from commit 9cb540a13cb2249754ea3e755cb1472151d061db)
2024-10-08Only add an automatic SONAME for Rust dylibsJosh Stone-6/+10
(cherry picked from commit f46057bf1cc0dc24a0ecd7d87c9c93872e685253)
2024-09-26Don't call extern_crate when local crate name is the same as a dependency ↵Michael Goulet-0/+39
and we have a trait error (cherry picked from commit 9d5d03b7dec8a87c81528e9a1310313fa3f0111e)
2024-09-26Inline expected_inputs_for_expected_output into ↵Michael Goulet-0/+5
check_argument_types/check_expr_struct_fields (cherry picked from commit 95b9ecd6d671637e9e3db55ed31d06882d3cad4d)
2024-09-26Use equality when relating formal and expected type in arg checkingMichael Goulet-0/+19
(cherry picked from commit c3f9c4f4d4bbc83c7de79a09c7ec0e7fda8efc5e)
2024-09-20Limit `run-make` tests using `-Zbuild-std` to nightlyJosh Stone-0/+2
See https://github.com/rust-lang/rust/issues/130634
2024-09-19Check params for unsafety in THIRMichael Goulet-0/+38
(cherry picked from commit 12f2bcde63285bf2b2f9f9ac615d4edf139a3f0e)
2024-09-18Revert warning empty patterns as unreachableNadrieril-446/+81
(cherry picked from commit 5b7be148ea0128daad309cf5a123c868a65d7737)
2024-09-03More robust extension checkingChris Denton-1/+3
2024-08-31Auto merge of #129831 - matthiaskrgr:rollup-befq6zx, r=matthiaskrgrbors-13/+88
Rollup of 11 pull requests Successful merges: - #128523 (Add release notes for 1.81.0) - #129605 (Add missing `needs-llvm-components` directives for run-make tests that need target-specific codegen) - #129650 (Clean up `library/profiler_builtins/build.rs`) - #129651 (skip stage 0 target check if `BOOTSTRAP_SKIP_TARGET_SANITY` is set) - #129684 (Enable Miri to pass pointers through FFI) - #129762 (Update the `wasm-component-ld` binary dependency) - #129782 (couple more crash tests) - #129816 (tidy: say which feature gate has a stability issue mismatch) - #129818 (make the const-unstable-in-stable error more clear) - #129824 (Fix code examples buttons not appearing on click on mobile) - #129826 (library: Fix typo in `core::mem`) r? `@ghost` `@rustbot` modify labels: rollup
2024-08-31Rollup merge of #129818 - RalfJung:const-stability, r=compiler-errorsMatthias Krüger-2/+2
make the const-unstable-in-stable error more clear The default should be to add `rustc_const_unstable`, not `rustc_allow_const_fn_unstable`. Also I discovered our check for missing const stability attributes on stable functions -- but strangely that check only kicks in for "reachable" functions. `check_missing_stability` checks for reachability since all reachable functions must have a stability attribute, but I would say if a function has `#[stable]` it should also have const-stability attributes regardless of reachability.
2024-08-31Rollup merge of #129782 - matthiaskrgr:c, r=jieyouxuMatthias Krüger-0/+54
couple more crash tests r? ```@jieyouxu```
2024-08-31Rollup merge of #129605 - jieyouxu:needs-llvm-components, r=Mark-SimulacrumMatthias Krüger-11/+32
Add missing `needs-llvm-components` directives for run-make tests that need target-specific codegen Without suitable `needs-llvm-components` directives, some run-make tests exercising target-specific codegen can fail if the LLVM used is built without the necessary components. Currently, the list is: ``` tests\run-make\print-target-list tests\run-make\print-to-output tests\run-make\print-cfg tests\run-make\target-without-atomic-cas ``` This PR also skips tidy checks for revisions and `needs-llvm-components` for run-make tests since revisions are not supported. Fixes #129390. Fixes #127895. cc ``@petrochenkov`` who noticed this, thanks! Would be great if you could confirm that this fixes the test errors for you locally.
2024-08-31make the const-unstable-in-stable error more clearRalf Jung-2/+2
2024-08-31Rollup merge of #129760 - cuviper:old-timey, r=compiler-errorsMatthias Krüger-8/+16
Make the "detect-old-time" UI test more representative The test code did have an inference failure, but that would have failed on Rust 1.79 and earlier too. Now it is rewritten to be specifically affected by 1.80's `impl FromIterator<_> for Box<str>`.
2024-08-31Rollup merge of #129757 - saethlin:half-a-recursion, r=compiler-errorsMatthias Krüger-0/+32
Add a test for trait solver overflow in MIR inliner cycle detection This test is a combination of the reproducer posted here: https://github.com/rust-lang/rust/issues/128887#issuecomment-2314198229 and the existing test for polymorphic recursion: https://github.com/rust-lang/rust/blob/784d444733d65c3d305ce5edcbb41e3d0d0aee2e/tests/mir-opt/inline/polymorphic_recursion.rs r? ```@compiler-errors```
2024-08-31Rollup merge of #129711 - lqd:nll-mir-dumps, r=compiler-errorsMatthias Krüger-0/+9
Expand NLL MIR dumps This PR is a first step to clean up and expand NLL MIR dumps: - by restoring the "mir-include-spans" comments which are useful for `-Zdump-mir=nll` - by adding the list of borrows to NLL MIR dumps, where they are introduced in the CFG and in which region Comments in MIR dumps were turned off in #112346, but as shown in #114652 they were still useful for us working with NLL MIR dumps. So this PR pulls `-Z mir-include-spans` into its own options struct, so that passes dumping MIR can override them if need be. The rest of the compiler is not affected, only the "nll" pass dumps have these comments enabled again. The CLI still has priority when specifying the flag, so that we can explicitly turn them off in the `mir-opt` tests to keep blessed dumps easier to work with (which was one of the points of #112346). Then, as part of a couple steps to improve NLL/polonius MIR dumps and `.dot` visualizations, I've also added the list of borrows and where they're introduced. I'm doing all this to help debug some polonius scope issues in my prototype location-sensitive analysis :3. I'll probably add member constraints soon.
2024-08-31Rollup merge of #129659 - RalfJung:const-fn-lang-feat, r=fee1-deadMatthias Krüger-0/+20
const fn stability checking: also check declared language features Fixes https://github.com/rust-lang/rust/issues/129656 `@oli-obk` I assume it is just an oversight that this didn't use `features().declared()`? Or is there a deep reason that this must only check `declared_lib_features`?
2024-08-31const fn stability checking: also check declared language featuresRalf Jung-0/+20
2024-08-31Rollup merge of #129366 - petrochenkov:libsearch, r=jieyouxuMatthias Krüger-0/+18
linker: Synchronize native library search in rustc and linker Also search for static libraries with alternative naming (`libname.a`) on MSVC when producing executables or dynamic libraries, and not just rlibs. This unblocks https://github.com/rust-lang/rust/pull/123436. try-job: x86_64-msvc
2024-08-31Rollup merge of #129123 - aDotInTheVoid:rustdoc-json-self, r=fmeaseMatthias Krüger-0/+58
rustdoc-json: Add test for `Self` type Inspired by #128471, the rustdoc-json suite had no tests in place for the `Self` type. This PR adds one. I've also manually checked locally that this test passes on 29e924841f06bb181d87494eba2783761bc1ddec, confirming that adding `clean::Type::SelfTy` didn't change the JSON output. (potentially adding a self type to json (insead of (ab)using generic) is tracked in #128522) Updates #81359 r? ````````@fmease````````
2024-08-31Rollup merge of #120221 - compiler-errors:statements-are-not-patterns, ↵Matthias Krüger-0/+19
r=nnethercote Don't make statement nonterminals match pattern nonterminals Right now, the heuristic we use to check if a token may begin a pattern nonterminal falls back to `may_be_ident`: https://github.com/rust-lang/rust/blob/ef71f1047e04438181d7cb925a833e2ada6ab390/compiler/rustc_parse/src/parser/nonterminal.rs#L21-L37 This has the unfortunate side effect that a `stmt` nonterminal eagerly matches against a `pat` nonterminal, leading to a parse error: ```rust macro_rules! m { ($pat:pat) => {}; ($stmt:stmt) => {}; } macro_rules! m2 { ($stmt:stmt) => { m! { $stmt } }; } m2! { let x = 1 } ``` This PR fixes it by more accurately reflecting the set of nonterminals that may begin a pattern nonterminal. As a side-effect, I modified `Token::can_begin_pattern` to work correctly and used that in `Parser::nonterminal_may_begin_with`.
2024-08-30couple more crash testsMatthias Krüger-0/+54
2024-08-30add borrows to NLL MIR dumpsRémy Rakic-0/+9
explicitly disable `-Zmir-include-spans` in mir-opt tests This will override the NLL default of true, and keep the blessed dumps easier to work with.
2024-08-29Make the "detect-old-time" UI test more representativeJosh Stone-8/+16
The test code did have an inference failure, but that would have failed on Rust 1.79 and earlier too. Now it is rewritten to be specifically affected by 1.80's `impl FromIterator<_> for Box<str>`.
2024-08-29Add a test for trait solver overflow in MIR inliner cycle detectionBen Kimock-0/+32
2024-08-29Rollup merge of #129690 - Oneirical:run-make-tidbits, r=jieyouxuGuillaume Gomez-56/+43
Add `needs-unwind` compiletest directive to `libtest-thread-limit` and replace some `Path` with `path` in `run-make` Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). This PR does two things: 1. Add this to `libtest-thread-limit` ([Why?](https://github.com/rust-lang/rust/pull/128507#issuecomment-2315158014)) ``` //@ needs-unwind // Reason: this should be ignored in cg_clif (Cranelift) CI and anywhere // else that uses panic=abort. ``` 2. Use `path` instead of `Path` to simplify multiple run-make tests.
2024-08-29Rollup merge of #129316 - dingxiangfei2009:riscv64-imac-scs, r=nnethercoteGuillaume Gomez-0/+17
riscv64imac: allow shadow call stack sanitizer cc `@Darksonn` for shadow call stack sanitizer support on RV64IMAC and RV64GC
2024-08-29Rollup merge of #128970 - DianQK:lint-llvm-ir, r=nikicGuillaume Gomez-3/+4
Add `-Zlint-llvm-ir` This flag is similar to `-Zverify-llvm-ir` and allows us to lint the generated IR. r? compiler
2024-08-29Rollup merge of #123940 - kornelski:remove-derived-debug, r=UrgauGuillaume Gomez-45/+176
debug-fmt-detail option I'd like to propose a new option that makes `#[derive(Debug)]` generate no-op implementations that don't print anything, and makes `{:?}` in format strings a no-op. There are a couple of motivations for this: 1. A more thorough stripping of debug symbols. Binaries stripped of debug symbols still retain some of them through `Debug` implementations. It's hard to avoid that without compiler's help, because debug formatting can be used in many places, including dependencies, and their loggers, asserts, panics, etc. * In my testing it gives about 2% binary size reduction on top of all other binary-minimizing best practices (including `panic_immediate_abort`). There are targets like Web WASM or embedded where users pay attention to binary sizes. * Users distributing closed-source binaries may not want to "leak" any symbol names as a matter of principle. 2. Adds ability to test whether code depends on specifics of the `Debug` format implementation in unwise ways (e.g. trying to get data unavailable via public interface, or using it as a serialization format). Because current Rust's debug implementation doesn't change, there's a risk of it becoming a fragile de-facto API that [won't be possible to change in the future](https://www.hyrumslaw.com/). An option that "breaks" it can act as a [grease](https://www.rfc-editor.org/rfc/rfc8701.html). This implementation is a `-Z fmt-debug=opt` flag that takes: * `full` — the default, current state. * `none` — makes derived `Debug` and `{:?}` no-ops. Explicit `impl Debug for T` implementations are left unharmed, but `{:?}` format won't use them, so they may get dead-code eliminated if they aren't invoked directly. * `shallow` — makes derived `Debug` print only the type's name, without recursing into fields. Fieldless enums print their variant names. `{:?}` works. The `shallow` option is a compromise between minimizing the `Debug` code, and compatibility. There are popular proc-macro crates that use `Debug::fmt` as a way to convert enum values into their Rust source code. There's a corresponding `cfg` flag: `#[cfg(fmt_debug = "none")]` that can be used in user code to react to this setting to minimize custom `Debug` implementations or remove unnecessary formatting helper functions.
2024-08-29Use path instead of Path in some run-make testsOneirical-56/+40
2024-08-29Add needs-unwind compiletest directive to libtest-thread-limitOneirical-0/+3
2024-08-29riscv64imac: allow shadow call stack sanitizerDing Xiang Fei-0/+17
2024-08-29Add `-Zlint-llvm-ir`DianQK-3/+4
2024-08-28Rollup merge of #129494 - tshepang:fmt-threads-sendsync, r=NadrierilJubilee-247/+315
format code in tests/ui/threads-sendsync was thinking of fixing formatting for 1 test in the directory, but found a bunch of them to also be in need
2024-08-28Rollup merge of #129467 - dingxiangfei2009:smart-pointer-relax-pointee, ↵Jubilee-16/+61
r=compiler-errors derive(SmartPointer): assume pointee from the single generic and better error messages Fix #129465 Actually RFC says that `#[pointee]` can be inferred when there is no ambiguity, or there is only one generic type parameter so to say. cc ```@Darksonn``` r? ```@compiler-errors```
2024-08-28Rollup merge of #129343 - estebank:time-version, r=jieyouxuJubilee-0/+19
Emit specific message for time<=0.3.35 ``` error[E0282]: type annotations needed for `Box<_>` --> /home/gh-estebank/.cargo/registry/src/index.crates.io-6f17d22bba15001f/time-0.3.34/src/format_description/parse/mod.rs:83:9 | 83 | let items = format_items | ^^^^^ ... 86 | Ok(items.into()) | ---- type must be known at this point | = note: this is an inference error on `time` caused by a change in Rust 1.80.0; update `time` to version `>=0.3.36` ``` Partially mitigate the fallout from https://github.com/rust-lang/rust/issues/127343. Although the biggest benefit of this would have been if we had had this in 1.80 before it became stable, the long-tail of that change will be felt for a *long* time, so better late than never. We can also emit an even more targeted error instead of this inference failure.
2024-08-28Rollup merge of #128192 - mrkajetanp:feature-detect, r=AmanieuJubilee-10/+11
rustc_target: Add various aarch64 features Add various aarch64 features already supported by LLVM and Linux. Additionally include some comment fixes to ensure consistency of feature names with the Arm ARM. Compiler support for features added to stdarch by https://github.com/rust-lang/stdarch/pull/1614. Tracking issue for unstable aarch64 features is https://github.com/rust-lang/rust/issues/127764. List of added features: - FEAT_CSSC - FEAT_ECV - FEAT_FAMINMAX - FEAT_FLAGM2 - FEAT_FP8 - FEAT_FP8DOT2 - FEAT_FP8DOT4 - FEAT_FP8FMA - FEAT_HBC - FEAT_LSE128 - FEAT_LSE2 - FEAT_LUT - FEAT_MOPS - FEAT_LRCPC3 - FEAT_SVE_B16B16 - FEAT_SVE2p1 - FEAT_WFxT - FEAT_SME - FEAT_SME_F16F16 - FEAT_SME_F64F64 - FEAT_SME_F8F16 - FEAT_SME_F8F32 - FEAT_SME_FA64 - FEAT_SME_I16I64 - FEAT_SME_LUTv2 - FEAT_SME2 - FEAT_SME2p1 - FEAT_SSVE_FP8DOT2 - FEAT_SSVE_FP8DOT4 - FEAT_SSVE_FP8FMA FEAT_FPMR is added in the first commit and then removed in a separate one to highlight it being removed from upstream LLVM 19. The intention is for it to be detectable at runtime through stdarch but not have a corresponding Rust compile-time feature.
2024-08-28Auto merge of #127537 - veluca93:struct_tf, r=BoxyUwUbors-0/+196
Implement a first version of RFC 3525: struct target features This PR is an attempt at implementing https://github.com/rust-lang/rfcs/pull/3525, behind a feature gate `struct_target_features`. There's obviously a few tasks that ought to be done before this is merged; in no particular order: - add proper error messages - add tests - create a tracking issue for the RFC - properly serialize/deserialize the new target_features field in `rmeta` (assuming I even understood that correctly :-)) That said, as I am definitely not a `rustc` expert, I'd like to get some early feedback on the overall approach before fixing those things (and perhaps some pointers for `rmeta`...), hence this early PR :-) Here's an example piece of code that I have been using for testing - with the new code, the calls to intrinsics get correctly inlined: ```rust #![feature(struct_target_features)] use std::arch::x86_64::*; /* // fails to compile #[target_feature(enable = "avx")] struct Invalid(u32); */ #[target_feature(enable = "avx")] struct Avx {} #[target_feature(enable = "sse")] struct Sse(); /* // fails to compile extern "C" fn bad_fun(_: Avx) {} */ /* // fails to compile #[inline(always)] fn inline_fun(_: Avx) {} */ trait Simd { fn do_something(&self); } impl Simd for Avx { fn do_something(&self) { unsafe { println!("{:?}", _mm256_setzero_ps()); } } } impl Simd for Sse { fn do_something(&self) { unsafe { println!("{:?}", _mm_setzero_ps()); } } } struct WithAvx { #[allow(dead_code)] avx: Avx, } impl Simd for WithAvx { fn do_something(&self) { unsafe { println!("{:?}", _mm256_setzero_ps()); } } } #[inline(never)] fn dosomething<S: Simd>(simd: &S) { simd.do_something(); } fn main() { /* // fails to compile Avx {}; */ if is_x86_feature_detected!("avx") { let avx = unsafe { Avx {} }; dosomething(&avx); dosomething(&WithAvx { avx }); } if is_x86_feature_detected!("sse") { dosomething(&unsafe { Sse {} }) } } ``` Tracking: - https://github.com/rust-lang/rust/issues/129107
2024-08-28Emit specific message for `time<0.3.35` inference failureEsteban Küber-0/+19
``` error[E0282]: type annotations needed for `Box<_>` --> ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/time-0.3.34/src/format_description/parse/mod.rs:83:9 | 83 | let items = format_items | ^^^^^ ... 86 | Ok(items.into()) | ---- type must be known at this point | = note: this is an inference error on crate `time` caused by a change in Rust 1.80.0; update `time` to version `>=0.3.35` ``` Partially address #127343.
2024-08-28fmt-debug optionKornel-45/+176
Allows disabling `fmt::Debug` derive and debug formatting.
2024-08-29derive(SmartPointer): assume pointee from the single generic and better ↵Ding Xiang Fei-16/+61
error messages
2024-08-28Rollup merge of #129666 - RalfJung:raw-eq-align, r=compiler-errorsMatthias Krüger-1/+15
interpret: add missing alignment check in raw_eq The intrinsic requires alignment, but we forgot to check for that in Miri and const-eval.
2024-08-28Rollup merge of #129657 - jswrenn:transmute-name, r=compiler-errorsMatthias Krüger-473/+473
Rename `BikeshedIntrinsicFrom` to `TransmuteFrom` As our implementation of MCP411 nears completion and we begin to solicit testing, it's no longer reasonable to expect testers to type or remember `BikeshedIntrinsicFrom`. The name degrades the ease-of-reading of documentation, and the overall experience of using compiler safe transmute. Tentatively, we'll instead adopt `TransmuteFrom`. This name seems to be the one most likely to be stabilized, after discussion on Zulip [1]. We may want to revisit the ordering of `Src` and `Dst` before stabilization, at which point we'd likely consider `TransmuteInto` or `Transmute`. [1] https://rust-lang.zulipchat.com/#narrow/stream/216762-project-safe-transmute/topic/What.20should.20.60BikeshedIntrinsicFrom.60.20be.20named.3F Tracking Issue: https://github.com/rust-lang/rust/issues/99571 r​? `@compiler-errors`
2024-08-28Rollup merge of #129641 - ↵Matthias Krüger-0/+1
notriddle:notriddle/missing-crates-js-resource-suffix, r=GuillaumeGomez rustdoc: fix missing resource suffix on `crates.js` Fixes a regression introduced in #128252.
2024-08-28Rollup merge of #129613 - RalfJung:interpret-target-feat, r=saethlinMatthias Krüger-11/+6
interpret: do not make const-eval query result depend on tcx.sess The check against calling functions with missing target features uses `tcx.sess` to determine which target features are available. However, this can differ between different crates in a crate graph, so the same const-eval query can come to different conclusions about whether a constant evaluates successfully or not -- which is bad, we should consistently get the same result everywhere.
2024-08-28Rollup merge of #129421 - jdonszelmann:naked-repr-align-functions, ↵Matthias Krüger-0/+145
r=workingjubilee,compiler-errors add repr to the allowlist for naked functions Fixes #129412 (combining unstable features #90957 (`#![feature(naked_functions)]`) and #82232 (`#![feature(fn_align)]`)
2024-08-28Implement RFC 3525.Luca Versari-0/+196