about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2024-08-28Auto merge of #129546 - compiler-errors:no-pred-on, r=fee1-deadbors-10/+0
Get rid of `predicates_defined_on` This is the uncontroversial part of #129532. This simply inlines the `predicates_defined_on` into into `predicates_of`. Nothing should change here logically.
2024-08-27Auto merge of #128506 - compiler-errors:by-move-body, r=cjgillotbors-12/+12
Stop storing a special inner body for the coroutine by-move body for async closures ...and instead, just synthesize an item which is treated mostly normally by the MIR pipeline. This PR does a few things: * We synthesize a new `DefId` for the by-move body of a closure, which has its `mir_built` fed with the output of the `ByMoveBody` MIR transformation, and some other relevant queries. * This has the `DefKind::ByMoveBody`, which we use to distinguish it from "real" bodies (that come from HIR) which need to be borrowck'd. Introduce `TyCtxt::is_synthetic_mir` to skip over `mir_borrowck` which is called by `mir_promoted`; borrowck isn't really possible to make work ATM since it heavily relies being called on a body generated from HIR, and is redundant by the construction of the by-move-body. * Remove the special `PassManager` hacks for handling the inner `by_move_body` stored within the coroutine's mir body. Instead, this body is fed like a regular MIR body, so it's goes through all of the `tcx.*_mir` stages normally (build -> promoted -> ...etc... -> optimized) ✨. * Remove the `InstanceKind::ByMoveBody` shim, since now we have a "regular" def id, we can just use `InstanceKind::Item`. This also allows us to remove the corresponding hacks from codegen, such as in `fn_sig_for_fn_abi` ✨. Notable remarks: * ~~I know it's kind of weird to be using `DefKind::Closure` here, since it's not a distinct closure but just a new MIR body. I don't believe it really matters, but I could also use a different `DefKind`... maybe one that we could use for synthetic MIR bodies in general?~~ edit: We're doing this now.
2024-08-27Rollup merge of #129649 - RalfJung:unadjusted-abi-mismatch, r=petrochenkovMatthias Krüger-3/+4
ABI compat check: detect unadjusted ABI mismatches
2024-08-27Rollup merge of #129507 - RalfJung:per-fn-const_precise_live_drops, ↵Matthias Krüger-0/+29
r=wesleywiser make it possible to enable const_precise_live_drops per-function This makes const_precise_live_drops work with rustc_allow_const_fn_unstable so that we can stabilize individual functions that rely on const_precise_live_drops. The goal is that we can use that to stabilize some of https://github.com/rust-lang/rust/issues/67441 without having to stabilize const_precise_live_drops.
2024-08-27ABI compat check: detect unadjusted ABI mismatchesRalf Jung-3/+4
2024-08-27Rollup merge of #129536 - beetrees:f16-f128-inline-asm-aarch64, r=AmanieuTrevor Gross-8/+139
Add `f16` and `f128` inline ASM support for `aarch64` Adds `f16` and `f128` inline ASM support for `aarch64`. SIMD vector types are taken from [the ARM intrinsics list](https://developer.arm.com/architectures/instruction-sets/intrinsics/#f:`@navigationhierarchiesreturnbasetype=[float]&f:@navigationhierarchieselementbitsize=[16]&f:@navigationhierarchiesarchitectures=[A64]).` Based on the work of `@lengrongfu` in #127043. Relevant issue: #125398 Tracking issue: #116909 `@rustbot` label +F-f16_and_f128 try-job: aarch64-gnu try-job: aarch64-apple
2024-08-27Rollup merge of #129490 - randomPoison:trusty-os-support, r=UrgauTrevor Gross-2/+8
Add Trusty OS as tier 3 target This PR adds support for the [Trusty secure operating system](https://source.android.com/docs/security/features/trusty) as a Tier 3 supported target. This upstreams [the patch that we have been using](https://cs.android.com/android/platform/superproject/+/master:external/rust/crates/libc/patches/trusty.patch;l=1;drc=122e586e93a534160230dc10ae3474cf31dd8f7f) internally. This also revives https://github.com/rust-lang/rust/pull/103895 which was closed due to inactivity, and is being resumed now that time allows. And MCP has already been done for adding this platform: rust-lang/compiler-team/issues/568 # Target Tier Policy Acknowledgements > A tier 3 target must have a designated developer or developers (the "target maintainers") on record to be CCed when issues arise regarding the target. (The mechanism to track and CC such developers may evolve over time.) - Nicole LeGare (``@randomPoison)`` - Stephen Crane (``@rinon)`` - As a fallback trusty-dev-team@google.com can be contacted > Targets must use naming consistent with any existing targets; for instance, a target for the same CPU or OS as an existing Rust target should use the same name for that CPU or OS. Targets should normally use the same names and naming conventions as used elsewhere in the broader ecosystem beyond Rust (such as in other toolchains), unless they have a very good reason to diverge. Changing the name of a target can be highly disruptive, especially once the target reaches a higher tier, so getting the name right is important even for a tier 3 target. The two new Trusty targets, `aarch64-unknown-trusty` and `armv7-unknown-trusty` both follow the existing naming convention for similar targets. > Target names should not introduce undue confusion or ambiguity unless absolutely necessary to maintain ecosystem compatibility. For example, if the name of the target makes people extremely likely to form incorrect beliefs about what it targets, the name should be changed or augmented to disambiguate it. 👍 > Tier 3 targets may have unusual requirements to build or use, but must not create legal issues or impose onerous legal terms for the Rust project or for Rust developers or users. There are no known legal issues or license incompatibilities. > Neither this policy nor any decisions made regarding targets shall create any binding agreement or estoppel by any party. If any member of an approving Rust team serves as one of the maintainers of a target, or has any legal or employment requirement (explicit or implicit) that might affect their decisions regarding a target, they must recuse themselves from any approval decisions regarding the target's tier status, though they may otherwise participate in discussions. 👍 > Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate (core for most targets, alloc for targets that can support dynamic memory allocation, std for targets with an operating system or equivalent layer of system-provided functionality), but may leave some code unimplemented (either unavailable or stubbed out as appropriate), whether because the target makes it impossible to implement or challenging to implement. The authors of pull requests are not obligated to avoid calling any portions of the standard library on the basis of a tier 3 target not implementing those portions. This PR only adds the targets for the platform. `std` support will be added once platform support is added to the libc crate, which depends on the language targets being added to rustc. > The target must provide documentation for the Rust community explaining how to build for the target, using cross-compilation if possible. If the target supports running binaries, or running tests (even if they do not pass), the documentation must explain how to run such binaries or tests for the target, using emulation if possible or dedicated hardware if necessary. 👍 > Tier 3 targets must not impose burden on the authors of pull requests, or other developers in the community, to maintain the target. In particular, do not post comments (automated or manual) on a PR that derail or suggest a block on the PR based on a tier 3 target. Do not send automated messages or notifications (via any medium, including via ``@)`` to a PR author or others involved with a PR regarding a tier 3 target, unless they have opted into such messages. 👍 > Patches adding or updating tier 3 targets must not break any existing tier 2 or tier 1 target, and must not knowingly break another tier 3 target without approval of either the compiler team or the maintainers of the other tier 3 target. 👍 > Tier 3 targets must be able to produce assembly using at least one of rustc's supported backends from any host target. (Having support in a fork of the backend is not sufficient, it must be upstream.) 👍
2024-08-27Rollup merge of #128935 - lqd:needs-zstd, r=KobzolTrevor Gross-39/+42
More work on `zstd` compression r? ``@Kobzol`` as we've discussed this. This is a draft to show the current approach of supporting zstd in compiletest, and making the tests using it unconditional. Knowing whether llvm/lld was built with `LLVM_ENABLE_ZSTD` is quite hard, so there are two strategies. There are details in the code, and we can discuss this approach. Until we know the config used to build CI artifacts, it seems our options are somewhat limited in any case. zlib compression seems always enabled, so we only check this in its dedicated test, allowing the test to ignore errors due to zstd not being supported. The zstd test is made unconditional in what it tests, by relying on `needs-llvm-zstd` to be ignored when `llvm.libzstd` isn't enabled in `config.toml`. try-job: x86_64-gnu try-job: x86_64-msvc try-job: x86_64-gnu-distcheck
2024-08-27Rollup merge of #128731 - RalfJung:simd-shuffle-vector, r=workingjubileeTrevor Gross-2/+25
simd_shuffle intrinsic: allow argument to be passed as vector See https://github.com/rust-lang/rust/issues/128738 for context. I'd like to get rid of [this hack](https://github.com/rust-lang/rust/blob/6c0b89dfac65be9a5be12f938f23098ebc36c635/compiler/rustc_codegen_ssa/src/mir/block.rs#L922-L935). https://github.com/rust-lang/rust/pull/128537 almost lets us do that since constant SIMD vectors will then be passed as immediate arguments. However, simd_shuffle for some reason actually takes an *array* as argument, not a vector, so the hack is still required to ensure that the array becomes an immediate (which then later stages of codegen convert into a vector, as that's what LLVM needs). This PR prepares simd_shuffle to also support a vector as the `idx` argument. Once this lands, stdarch can hopefully be updated to pass `idx` as a vector, and then support for arrays can be removed, which finally lets us get rid of that hack.
2024-08-27Rollup merge of #126985 - Mrmaxmeier:dwarf-embed-source, r=davidtwcoTrevor Gross-0/+72
Implement `-Z embed-source` (DWARFv5 source code embedding extension) Implement https://github.com/rust-lang/compiler-team/issues/764 MCP which adds an unstable flag that exposes LLVM's [DWARFv5 source code embedding](https://dwarfstd.org/issues/180201.1.html) support.
2024-08-26Stop using a special inner body for the coroutine by-move body for async ↵Michael Goulet-12/+12
closures
2024-08-27Rollup merge of #129560 - GuillaumeGomez:impl-assoc-type-source-link, ↵Matthias Krüger-1/+27
r=notriddle [rustdoc] Generate source link on impl associated types Currently, impl associated types are generated but don't get a source link. This PR fixes that. Before: ![image](https://github.com/user-attachments/assets/3a22adb5-8b66-4124-9267-7c26eed1aa5e) After: ![Screenshot from 2024-08-25 16-31-36](https://github.com/user-attachments/assets/6e9b35e7-4357-4ecf-8c49-1d8294051283) r? `@notriddle`
2024-08-27Rollup merge of #129340 - stephen-lazaro:u/slazaro/issue-129274, ↵Matthias Krüger-0/+28
r=compiler-errors Remove Duplicate E0381 Label Aims to resolve https://github.com/rust-lang/rust/issues/129274, and adds a test for the case. Essentially, we are duplicating this span for some reason. For now, I'm just using a set to collect the spans rather than the vec. I imagine there's probably no real reason to inspect duplicates in this area, but if I'm wrong I can adjust to collect "seen spans" in just the point where this label is applied. I'm not sure why it's producing duplicate spans. Looks like this has been this way for a while? I think it gives the duplicate label on 1.75.0 for example.
2024-08-27Rollup merge of #129250 - estebank:issue-129205, r=compiler-errorsMatthias Krüger-17/+25
Do not ICE on non-ADT rcvr type when looking for crate version collision When looking for multiple versions of the same crate, do not blindly construct the receiver type. Follow up to #128786. Fixes #129205 Fixes #129216
2024-08-27Rollup merge of #129032 - jswrenn:transmute-method, r=compiler-errorsMatthias Krüger-17/+17
Document & implement the transmutation modeled by `BikeshedIntrinsicFrom` Documents that `BikeshedIntrinsicFrom` models transmute-via-union, which is slightly more expressive than the transmute-via-cast implemented by `transmute_copy`. Additionally, we provide an implementation of transmute-via-union as a method on the `BikeshedIntrinsicFrom` trait with additional documentation on the boundary between trait invariants and caller obligations. Whether or not transmute-via-union is the right kind of transmute to model remains up for discussion [1]. Regardless, it seems wise to document the present behavior. [1] https://rust-lang.zulipchat.com/#narrow/stream/216762-project-safe-transmute/topic/What.20'kind'.20of.20transmute.20to.20model.3F/near/426331967 Tracking Issue: https://github.com/rust-lang/rust/issues/99571 r? `@compiler-errors` cc `@scottmcm,` `@Lokathor`
2024-08-26Remove crashes from type_of on resolution that doesn't have a type_ofMichael Goulet-17/+0
2024-08-26Do not ICE on non-ADT rcvr type when looking for crate version collisionEsteban Küber-0/+25
When looking for multiple versions of the same crate, do not blindly construct the receiver type. Follow up to #128786. Fix #129205.
2024-08-26Rollup merge of #129600 - ↵Matthias Krüger-6/+22
traviscross:TC/tie-impl_trait_overcaptures-to-rust-2024, r=compiler-errors Tie `impl_trait_overcaptures` lint to Rust 2024 The `impl_trait_overcaptures` lint is part of the migration to Rust 2024 and the Lifetime Capture Rules 2024. Now that we've stabilized precise capturing (RFC 3617), let's tie this lint to the `rust_2024_compatibility` lint group. Tracking: - https://github.com/rust-lang/rust/issues/117587 r? `@compiler-errors`
2024-08-26Rollup merge of #129190 - rezwanahmedsami:master, r=tgross35Matthias Krüger-1/+69
Add f16 and f128 to tests/ui/consts/const-float-bits-conv.rs Fixes #129163 try-job: x86_64-msvc try-job: x86_64-mingw try-job: i686-msvc try-job: i686-mingw
2024-08-26Tie `impl_trait_overcaptures` lint to Rust 2024Travis Cross-6/+22
The `impl_trait_overcaptures` lint is part of the migration to Rust 2024 and the Lifetime Capture Rules 2024. Now that we've stabilized precise capturing (RFC 3617), let's tie this lint to the `rust_2024_compatibility` lint group.
2024-08-26Rollup merge of #129553 - RalfJung:const-stability, r=compiler-errorsMatthias Krüger-8/+16
add back test for stable-const-can-only-call-stable-const This got accidentally removed in https://github.com/rust-lang/rust/pull/128596 (file `tests/ui/internal/internal-unstable-const.rs`). The test has little to do with "allow internal unstable" though, so add it in a file that already tests various const stability things. Also tweak the help that suggests to add `rustc_allow_const_fn_unstable` to make it clear that this needs team approval, since it is a fairly big gun.
2024-08-26Rollup merge of #129525 - notriddle:notriddle/fake-variadic-tuple-array, ↵Matthias Krüger-0/+17
r=GuillaumeGomez rustdoc: clean up tuple <-> primitive conversion docs This adds a minor missing feature to `fake_variadic`, so that it can render `impl From<(T,)> for [T; 1]` correctly.
2024-08-26Rollup merge of #129519 - compiler-errors:lowering-flags, r=fmeaseMatthias Krüger-0/+28
Remove redundant flags from `lower_ty_common` that can be inferred from the HIR ...and then get rid of `lower_ty_common`. r? ``@fmease`` or re-roll if you're busy!
2024-08-26Rollup merge of #129405 - surechen:fix_span_x, r=cjgillotMatthias Krüger-29/+12
Fixing span manipulation and indentation of the suggestion introduced by #126187 According to comments: https://github.com/rust-lang/rust/pull/128084#issuecomment-2295254576 https://github.com/rust-lang/rust/pull/126187/files#r1634897691
2024-08-26Rollup merge of #129288 - compiler-errors:unsafe-fn-coercion, r=lcnrMatthias Krüger-0/+14
Use subtyping for `UnsafeFnPointer` coercion, too I overlooked this in #129059, which changed MIR typechecking to use subtyping for other fn pointer coercions. Fixes #129285
2024-08-25expand zstd debuginfo compression testRémy Rakic-10/+23
it now checks zlib and zstd, via rustc and rust-lld
2024-08-25prepare test for expanding scopeRémy Rakic-0/+0
2024-08-25mark `rust-lld-compress-debug-sections` test as needing zstdRémy Rakic-14/+4
also make it fail if there's a compression issue
2024-08-25Remove redundant flags that can be inferred from the HIRMichael Goulet-0/+28
2024-08-25Rollup merge of #129487 - ↵Matthias Krüger-0/+73
GrigorenkoPV:repr_transparent_external_private_fields, r=compiler-errors repr_transparent_external_private_fields: special-case some std types Fixes #129470 ```@rustbot``` label +A-lint +L-repr_transparent_external_private_fields
2024-08-25Add regression test for impl associated types source linkGuillaume Gomez-0/+26
2024-08-25Generate missing source link on impl associated typesGuillaume Gomez-1/+1
2024-08-25Fixing span manipulation and indentation of the suggestion introduced by #126187surechen-29/+12
According to comments: https://github.com/rust-lang/rust/pull/128084#issuecomment-2295254576 https://github.com/rust-lang/rust/pull/126187/files#r1634897691
2024-08-25tweak rustc_allow_const_fn_unstable hint, and add back test for ↵Ralf Jung-8/+16
stable-const-can-only-call-stable-const
2024-08-25make it possible to enable const_precise_live_drops per-functionRalf Jung-0/+29
2024-08-25Auto merge of #129521 - matthiaskrgr:rollup-uigv77m, r=matthiaskrgrbors-409/+455
Rollup of 9 pull requests Successful merges: - #128596 (stabilize const_fn_floating_point_arithmetic) - #129199 (make writes_through_immutable_pointer a hard error) - #129246 (Retroactively feature gate `ConstArgKind::Path`) - #129290 (Pin `cc` to 1.0.105) - #129323 (Implement `ptr::fn_addr_eq`) - #129500 (remove invalid `TyCompat` relation for effects) - #129501 (panicking: improve hint for Miri's RUST_BACKTRACE behavior) - #129505 (interpret: ImmTy: tighten sanity checks in offset logic) - #129510 (Fix `elided_named_lifetimes` in code) r? `@ghost` `@rustbot` modify labels: rollup
2024-08-24Rollup merge of #129430 - lolbinarycat:rustdoc-search-exact-case, r=notriddleTrevor Gross-0/+7
rustdoc: show exact case-sensitive matches first fixes #119480
2024-08-24Rollup merge of #129429 - cjgillot:named-variance, r=compiler-errorsTrevor Gross-132/+134
Print the generic parameter along with the variance in dumps. This allows to make sure we are testing what we think we are testing. While the tests are correct, I discovered that opaque duplicated args are in the reverse declaration order.
2024-08-24Rollup merge of #128735 - jieyouxu:pr-120176-revive, r=cjgillotTrevor Gross-6/+126
Add a special case for `CStr`/`CString` in the `improper_ctypes` lint Revives #120176. Just needed to bless a test and fix an argument, but seemed reasonable to me otherwise. Instead of saying to "consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct", we now tell users to "Use `*const ffi::c_char` instead, and pass the value from `CStr::as_ptr()`" when the type involved is a `CStr` or a `CString`. The suggestion is not made for `&mut CString` or `*mut CString`. r? ``````@cjgillot`````` (since you were the reviewer of the original PR #120176, but feel free to reroll)
2024-08-24Rollup merge of #128524 - ↵Trevor Gross-41/+28
chenyukang:yukang-fix-127930-invalid-outer-style-sugg, r=cjgillot Don't suggest turning crate-level attributes into outer style Fixes #127930
2024-08-24Rollup merge of #128467 - estebank:unsized-args, r=cjgillotTrevor Gross-0/+139
Detect `*` operator on `!Sized` expression The suggestion is new: ``` error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/unsized-str-in-return-expr-arg-and-local.rs:15:9 | LL | let x = *""; | ^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `str` = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature help: references to `!Sized` types like `&str` are `Sized`; consider not dereferencing the expression | LL - let x = *""; LL + let x = ""; | ``` Fix #128199.
2024-08-25Add `f16` and `f128` inline ASM support for `aarch64`beetrees-33/+116
2024-08-24Get rid of predicates_defined_onMichael Goulet-10/+0
2024-08-24Enable f16 in assembly on aarch64 platforms that support itrongfu.leng-4/+52
Signed-off-by: rongfu.leng <lenronfu@gmail.com>
2024-08-24rustdoc: clean up tuple <-> primitive conversion docsMichael Howell-0/+17
This adds a minor missing feature to `fake_variadic`, so that it can render `impl From<(T,)> for [T; 1]` correctly.
2024-08-24Rollup merge of #129500 - fee1-dead-contrib:fxrel, r=compiler-errorsMatthias Krüger-2/+13
remove invalid `TyCompat` relation for effects if the current impl uses `Maybe` (`impl const`), the parent impl must use `Maybe` (`impl const`) as well. I'd like to rename `TyCompat` to `Sub` which is probably clearer. But it would conflict with my other PR. r? ``@rust-lang/project-const-traits``
2024-08-24Rollup merge of #129246 - BoxyUwU:feature_gate_const_arg_path, r=cjgillotMatthias Krüger-184/+383
Retroactively feature gate `ConstArgKind::Path` This puts the lowering introduced by #125915 under a feature gate until we fix the regressions introduced by it. Alternative to whole sale reverting the PR since it didn't seem like a very clean revert and I think this is generally a step in the right direction and don't want to get stuck landing and reverting the PR over and over :) cc #129137 ``@camelid,`` tests taken from there. beta is branching soon so I think it makes sense to not try and rush that fix through since it wont have much time to bake and if it has issues we can't simply revert it on beta. Fixes #128016
2024-08-24Rollup merge of #129199 - RalfJung:writes_through_immutable_pointer, ↵Matthias Krüger-52/+11
r=compiler-errors make writes_through_immutable_pointer a hard error This turns the lint added in https://github.com/rust-lang/rust/pull/118324 into a hard error. This has been reported in cargo's future-compat reports since Rust 1.76 (released in February). Given that const_mut_refs is still unstable, it should be impossible to even hit this error on stable: we did accidentally stabilize some functions that can cause this error, but that got reverted in https://github.com/rust-lang/rust/pull/117905. Still, let's do a crater run just to be sure. Given that this should only affect unstable code, I don't think it needs an FCP, but let's Cc ``@rust-lang/lang`` anyway -- any objection to making this unambiguous UB into a hard error during const-eval? This can be viewed as part of https://github.com/rust-lang/rust/pull/129195 which is already nominated for discussion.
2024-08-24Rollup merge of #128596 - RalfJung:const_fn_floating_point_arithmetic, ↵Matthias Krüger-171/+48
r=nnethercote stabilize const_fn_floating_point_arithmetic Part of https://github.com/rust-lang/rust/issues/128288 Fixes https://github.com/rust-lang/rust/issues/57241 The existing test `tests/ui/consts/const_let_eq_float.rs` ([link](https://github.com/RalfJung/rust/blob/const_fn_floating_point_arithmetic/tests/ui/consts/const_let_eq_float.rs)) covers the basics, and also Miri has extensive tests covering the interpreter's float machinery. Also, that machinery can already be used on stable inside `const`/`static` initializers, just not inside `const fn`. This was explicitly called out in https://github.com/rust-lang/rfcs/pull/3514 so in a sense t-lang just recently already FCP'd this, but let's hear from them whether they want another FCP for the stabilization here or whether that was covered by the FCP for the RFC. Cc ``@rust-lang/lang`` ### Open items - [x] Update the Reference: https://github.com/rust-lang/reference/pull/1566
2024-08-24repr_transparent_external_private_fields: treat `rustc_pub_transparent` ↵Pavel Grigorenko-0/+25
types as local