about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2025-01-06Rollup merge of #135139 - c410-f3r:8-years-rfc, r=jhprattJacob Pratt-23/+3
[generic_assert] Constify methods used by the formatting system cc #44838 Starts the "constification" of all the elements required to allow the execution of the formatting system in constant environments. ```rust const _: () = { panic!("{:?}", 1i32); }; ``` Further stuff is blocked by #133999.
2025-01-06Rollup merge of #135126 - klensy:deprecated-and-do-nothing, r=jieyouxuJacob Pratt-4/+28
mark deprecated option as deprecated in rustc_session to remove copypasta and small refactor This marks deprecated options as deprecated via flag in options table in rustc_session, which removes copypasted deprecation text from rustc_driver_impl. This also adds warning for deprecated `-C ar` option, which didn't emitted any warnings before. Makes `inline_threshold` `[UNTRACKED]`, as it do nothing. Adds few tests. See individual commits.
2025-01-06Rollup merge of #135116 - camelid:sidebar-case, r=fmeaseJacob Pratt-2/+2
rustdoc: Fix mismatched capitalization in sidebar Previously, the main content used "Aliased Type", while the sidebar said "Aliased type". Now, they both say "Aliased Type", which is the more common capitalization in Rustdoc. See the following link for an example. https://doc.rust-lang.org/1.83.0/std/io/type.Result.html
2025-01-06Rollup merge of #135090 - compiler-errors:invalid-tuple-ctor-projection, ↵Jacob Pratt-0/+58
r=lqd,jieyouxu Suggest to replace tuple constructor through projection See the code example. when `Self::Assoc` normalizes to a struct that has a tuple constructor, you cannot construct the type via `Self::Assoc(field, field)`. Instead, suggest to replace it with the correct named struct. Fixes #120871
2025-01-06Rollup merge of #134744 - compiler-errors:transmute-non-wf, r=lcnrJacob Pratt-0/+92
Don't ice on bad transmute in typeck in new solver Old trait solver ends up getting its infcx tainted because we try to normalize the type, but the new trait solver doesn't. This means we try to compute the stalled transmute obligations, which tries to normalize a type an ICEs. Let's make this a delayed bug. r? lcnr
2025-01-06Rollup merge of #132345 - compiler-errors:fx-diag, r=lcnrJacob Pratt-8/+29
Improve diagnostics for `HostEffectPredicate` in the new solver Adds derived cause for host effect predicates. Some diagnostics regress, but that's connected to the fact that our predicate visitor doesn't play well with aliases just yet.
2025-01-06Rollup merge of #131830 - hoodmane:emscripten-wasm-eh, r=workingjubileeJacob Pratt-0/+91
Add support for wasm exception handling to Emscripten target This is a draft because we need some additional setting for the Emscripten target to select between the old exception handling and the new exception handling. I don't know how to add a setting like that, would appreciate advice from Rust folks. We could maybe choose to use the new exception handling if `Ctarget-feature=+exception-handling` is passed? I tried this but I get errors from llvm so I'm not doing it right.
2025-01-06rustdoc: Fix mismatched capitalization in sidebarNoah Lev-2/+2
Previously, the main content used "Aliased Type", while the sidebar said "Aliased type". Now, they both say "Aliased Type", which is the more common capitalization in Rustdoc. See the following link for an example. https://doc.rust-lang.org/1.83.0/std/io/type.Result.html
2025-01-06Rollup merge of #135153 - crystalstall:master, r=workingjubileeMatthias Krüger-1/+1
chore: remove redundant words in comment
2025-01-06Rollup merge of #134951 - compiler-errors:double-trait-err-msg, r=davidtwcoMatthias Krüger-0/+63
Suppress host effect predicates if underlying trait doesn't hold Don't report two errors for when the (`HostEffectPredicate`) `T: const Trait` isn't implemented because (`TraitPredicate`) `T: Trait` doesn't even hold.
2025-01-06Rollup merge of #134771 - compiler-errors:const-arg-has-type-err, r=lcnrMatthias Krüger-2/+22
Report correct `SelectionError` for `ConstArgHasType` in new solver fulfill r? ``@BoxyUwU``
2025-01-06Rollup merge of #134742 - compiler-errors:post-borrowck-analysis, r=lcnrMatthias Krüger-0/+2
Use `PostBorrowckAnalysis` in `check_coroutine_obligations` This currently errors with: ``` error: concrete type differs from previous defining opaque type use --> tests/ui/coroutine/issue-52304.rs:10:21 | 10 | pub fn example() -> impl Coroutine { | ^^^^^^^^^^^^^^ expected `{example::{closure#0} upvar_tys=() resume_ty=() yield_ty=&'{erased} i32 return_ty=() witness={example::{closure#0}}}`, got `{example::{closure#0} upvar_tys=() resume_ty=() yield_ty=&'static i32 return_ty=() witness={example::{closure#0}}}` | = note: previous use here ``` This is because we end up redefining the opaque in `check_coroutine_obligations` but with the `yield_ty = &'erased i32` from hir typeck, which causes the *equality* check for opaques to fail. The coroutine obligtions in question (when `-Znext-solver` is enabled) are: ``` Binder { value: TraitPredicate(<Opaque(DefId(0:5 ~ issue_52304[4c6d]::example::{opaque#0}), []) as std::marker::Sized>, polarity:Positive), bound_vars: [] } Binder { value: AliasRelate(Term::Ty(Alias(Opaque, AliasTy { args: [], def_id: DefId(0:5 ~ issue_52304[4c6d]::example::{opaque#0}), .. })), Equate, Term::Ty(Coroutine(DefId(0:6 ~ issue_52304[4c6d]::example::{closure#0}), [(), (), &'{erased} i32, (), CoroutineWitness(DefId(0:6 ~ issue_52304[4c6d]::example::{closure#0}), []), ()]))), bound_vars: [] } Binder { value: AliasRelate(Term::Ty(Coroutine(DefId(0:6 ~ issue_52304[4c6d]::example::{closure#0}), [(), (), &'{erased} i32, (), CoroutineWitness(DefId(0:6 ~ issue_52304[4c6d]::example::{closure#0}), []), ()])), Subtype, Term::Ty(Alias(Opaque, AliasTy { args: [], def_id: DefId(0:5 ~ issue_52304[4c6d]::example::{opaque#0}), .. }))), bound_vars: [] } ``` Ignoring the fact that we end up stalling some really dumb obligations here (lol), I think it makes more sense for us to be using post borrowck analysis for this check anyways. r? lcnr
2025-01-06Suggest to replace tuple constructor through projectionMichael Goulet-0/+58
2025-01-06Recurse on GAT where clauses in fulfillment error proof tree visitorMichael Goulet-18/+14
2025-01-06Don't ice on bad transmute in typeck in new solverMichael Goulet-0/+92
2025-01-06Add derived causes for host effect predicatesMichael Goulet-8/+33
2025-01-06add deprecated and do nothing flag to options tableklensy-4/+28
inline_threshold mark deprecated no-stack-check print deprecation message for -Car too inline_threshold deprecated and do nothing: make in untracked make OptionDesc struct from tuple
2025-01-06Auto merge of #135112 - tgross35:combine-select-unpredictable-test, r=the8472bors-36/+38
Merge the intrinsic and user tests for `select_unpredictable` [1] mentions that having a single test with `-Zmerge-functions=disabled` is preferable to having two separate tests. Apply that to the new `select_unpredictable` test here. [1]: https://github.com/rust-lang/rust/pull/133964#issuecomment-2569693325
2025-01-06Add support for wasm exception handling to Emscripten targetHood Chatham-0/+91
Gated behind an unstable `-Z emscripten-wasm-eh` flag
2025-01-06Auto merge of #135151 - matthiaskrgr:rollup-2vy1hwl, r=matthiaskrgrbors-9/+13
Rollup of 6 pull requests Successful merges: - #135111 (Add doc aliases for `libm` and IEEE names) - #135129 (triagebot: label `src/doc/rustc-dev-guide` changes with `A-rustc-dev-guide`) - #135132 (dev guide ping group and set adhoc reviewers to compiler) - #135145 (Mention `unnameable_types` in `unreachable_pub` documentation.) - #135147 (A few borrowck tweaks to improve 2024 edition migration lints) - #135150 (move footnote to ordinary comment) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-06chore: remove redundant words in commentcrystalstall-1/+1
Signed-off-by: crystalstall <crystalruby@qq.com>
2025-01-06Rollup merge of #135147 - compiler-errors:borrowck-tweaks, r=chenyukangMatthias Krüger-9/+13
A few borrowck tweaks to improve 2024 edition migration lints See first two commits' changes to test outputs. Test coverage in this area is kinda weak, but I think it affects more cases than this (like the craters that will begin to trigger the `tail_expr_drop_order` tests in #134523). Third commit is a drive-by change that removes a deref hack from `UseSpans` which doesn't really improve diagnostics much.
2025-01-06Auto merge of #135085 - knickish:m68k_unknown_none, r=workingjubileebors-0/+3
add m68k-unknown-none-elf target r? `@workingjubilee` The existing `m68k-unknown-linux-gnu` target builds `std` by default, requires atomics, and has a base cpu with an fpu. A smaller/more embedded target is desirable both to have a baseline target for the ISA, as well to make debugging easier for working on the llvm backend. Currently this target is using the `M68010` as the minimum CPU due, but as missing features are merged into the `M68k` llvm backend I am hoping to lower this further. I have been able to build very small crates using a toolchain built against this target (together with a later version of `object`) using the configuration described in the target platform-support documentation, although getting anything of substantial complexity to build quickly hits errors in the llvm backend
2025-01-06Remove CallKind::Deref hack from UseSpansMichael Goulet-6/+6
It's not really necessary
2025-01-06Improve find_self_call with reborrowed receiverMichael Goulet-1/+6
2025-01-06Improve span when temporary receiver is dropped in edition 2024Michael Goulet-2/+1
2025-01-05[generic_assert] Constify methods used by the formatting systemCaio-23/+3
2025-01-05Auto merge of #134794 - RalfJung:abi-required-target-features, r=workingjubileebors-23/+45
Add a notion of "some ABIs require certain target features" I think I finally found the right shape for the data and checks that I recently added in https://github.com/rust-lang/rust/pull/133099, https://github.com/rust-lang/rust/pull/133417, https://github.com/rust-lang/rust/pull/134337: we have a notion of "this ABI requires the following list of target features, and it is incompatible with the following list of target features". Both `-Ctarget-feature` and `#[target_feature]` are updated to ensure we follow the rules of the ABI. This removes all the "toggleability" stuff introduced before, though we do keep the notion of a fully "forbidden" target feature -- this is needed to deal with target features that are actual ABI switches, and hence are needed to even compute the list of required target features. We always explicitly (un)set all required and in-conflict features, just to avoid potential trouble caused by the default features of whatever the base CPU is. We do this *before* applying `-Ctarget-feature` to maintain backward compatibility; this poses a slight risk of missing some implicit feature dependencies in LLVM but has the advantage of not breaking users that deliberately toggle ABI-relevant target features. They get a warning but the feature does get toggled the way they requested. For now, our logic supports x86, ARM, and RISC-V (just like the previous logic did). Unsurprisingly, RISC-V is the nicest. ;) As a side-effect this also (unstably) allows *enabling* `x87` when that is harmless. I used the opportunity to mark SSE2 as required on x86-64, to better match the actual logic in LLVM and because all x86-64 chips do have SSE2. This infrastructure also prepares us for requiring SSE on x86-32 when we want to use that for our ABI (and for float semantics sanity), see https://github.com/rust-lang/rust/issues/133611, but no such change is happening in this PR. r? `@workingjubilee`
2025-01-05Expand the `select_unpredictable` test for ZSTsTrevor Gross-0/+5
For ZSTs there is no selection that needs to take place, so assert that no `select` statement is emitted.
2025-01-05Auto merge of #135074 - wzssyqa:mips-mti, r=oli-obkbors-4/+10
Target: Add mips mti baremetal support Do the same thing as gcc, which use the vendor `mti` to mark the toolchain as MIPS32r2 default. We support both big endian and little endian flavor: mips-mti-none-elf mipsel-mti-none-elf
2025-01-05fix testsYunQiang Su-3/+3
2025-01-05Merge the intrinsic and user tests for `select_unpredictable`Trevor Gross-36/+33
[1] mentions that having a single test with `-Zmerge-functions=disabled` is preferable to having two separate tests. Apply that to the new `select_unpredicatble` test here. [1]: https://github.com/rust-lang/rust/pull/133964#issuecomment-2569693325
2025-01-04Rollup merge of #135088 - maurer:force-asm, r=nikicJubilee-0/+4
Force code generation in assembly generation smoke-tests In llvm/llvm-project@7b23f413d1f76532825e470b523e971818d453ca , `.text` started being suppressed from LLVM assembly in cases where it wasn't strictly necessary. Currently, the sample functions in these two tests are frequently decided to be IR-only functions, resulting in no code generation, so LLVM drops the `.text` directive. Adding `#[no_mangle]` forces these tests back to their original intent - assembly code is generated, and so a `.text` directive is generated as well. `@rustbot` label: +llvm-main r? `@workingjubilee` I'll attach a buildbot link once it finishes consuming this PR
2025-01-04Rollup merge of #135061 - matthiaskrgr:crashes_jan, r=lqdJubilee-0/+184
crashes: add latest batch of tests try-job: aarch64-apple try-job: x86_64-msvc try-job: x86_64-gnu try-job: dist-i586-gnu-i586-i686-musl
2025-01-04Rollup merge of #135046 - RalfJung:rustc_box_intrinsic, r=compiler-errorsJubilee-124/+143
turn rustc_box into an intrinsic I am not entirely sure why this was made a special magic attribute, but an intrinsic seems like a more natural way to add magic expressions to the language.
2025-01-04crashes: add latest batch of testsMatthias Krüger-0/+184
2025-01-04Auto merge of #135031 - RalfJung:intrinsics-without-body, r=oli-obkbors-32/+29
rustc_intrinsic: support functions without body We synthesize a HIR body `loop {}` but such bodyless intrinsics. Most of the diff is due to turning `ItemKind::Fn` into a brace (named-field) enum variant, because it carries a `bool`-typed field now. This is to remember whether the function has a body. MIR building panics to avoid ever translating the fake `loop {}` body, and the intrinsic logic uses the lack of a body to implicitly mark that intrinsic as must-be-overridden. I first tried actually having no body rather than generating the fake body, but there's a *lot* of code that assumes that all function items have HIR and MIR, so this didn't work very well. Then I noticed that even `rustc_intrinsic_must_be_overridden` intrinsics have MIR generated (they are filled with an `Unreachable` terminator) so I guess I am not the first to discover this. ;) r? `@oli-obk`
2025-01-04rustc_intrinsic: support functions without body; they are implicitly marked ↵Ralf Jung-32/+29
as must-be-overridden
2025-01-04Rollup merge of #135084 - maurer:nuw, r=nikicMatthias Krüger-2/+2
Update carrying_mul_add test to tolerate `nuw` LLVM 20 adds nuw to GEP operations in this code, tolerate them. `@rustbot` label: +llvm-main r? `@durin42`
2025-01-04Rollup merge of #135064 - RalfJung:const-in-pat-partial-eq-not-const, ↵Matthias Krüger-0/+54
r=compiler-errors const-in-pattern: test that the PartialEq impl does not need to be const Fixes https://github.com/rust-lang/rust/issues/119398 by adding a test. `@compiler-errors` is there some place in the code where we could add a comment saying "as a backcompat hack, here we only require `PartialEq` and not `const PartialEq`"? r? `@compiler-errors`
2025-01-04Rollup merge of #135055 - compiler-errors:rpitit-infer-in-stricter-impl, ↵Matthias Krüger-54/+70
r=estebank Report impl method has stricter requirements even when RPITIT inference gets in the way See the comment I added in the code. Fixes #122506.
2025-01-04Rollup merge of #133964 - joboet:select_unpredictable, r=tgross35Matthias Krüger-0/+35
core: implement `bool::select_unpredictable` Tracking issue: #133962 ACP: https://github.com/rust-lang/libs-team/issues/468
2025-01-04Auto merge of #135057 - compiler-errors:project-unconstrained, r=oli-obkbors-223/+93
Project to `TyKind::Error` when there are unconstrained non-lifetime (ty/const) impl params It splits the `enforce_impl_params_are_constrained` function into lifetime/non-lifetime, and queryfies the latter. We can then use the result of the latter query (`Result<(), ErrorGuaranteed>`) to intercept projection and constrain the projected type to `TyKind::Error`, which ensures that we leak no ty or const vars to places that don't expect them, like `normalize_erasing_regions`. The reason we split `enforce_impl_params_are_constrained` into two parts is because we only error for *lifetimes* if the lifetime ends up showing up in any of the associated types of the impl (e.g. we allow `impl<'a> Foo { type Assoc = (); }`). However, in order to compute the `type_of` query for the anonymous associated type of an RPITIT, we need to do trait solving (in `query collect_return_position_impl_trait_in_trait_tys`). That would induce cycles. Luckily, it turns out for lifetimes we don't even care about if they're unconstrained, since they're erased in all contexts that we are trying to fix ICEs. So it's sufficient to keep this check separated out of the query. I think this is a bit less invasive of an approach compared to #127973. The major difference between this PR and that PR is that we queryify the check instead of merging it into the `explicit_predicates_of` query, and we use the result to taint just projection goals, rather than trait goals too. This doesn't require a lot of new tracking in `ItemCtxt` and `GenericPredicates`, and it also seems to not require any other changes to typeck like that PR did. Fixes #123141 Fixes #125874 Fixes #126942 Fixes #127804 Fixes #130967 r? oli-obk
2025-01-03Force code generation in assembly generation smoke-testsMatthew Maurer-0/+4
In llvm/llvm-project@7b23f413d1f76532825e470b523e971818d453ca , `.text` started being suppressed from LLVM assembly in cases where it wasn't strictly necessary. Currently, the sample functions in these two tests are frequently decided to be IR-only functions, resulting in no code generation, so LLVM drops the `.text` directive. Adding `#[no_mangle]` forces these tests back to their original intent - assembly code is generated, and so a `.text` directive is generated as well.
2025-01-03Rollup merge of #135044 - compiler-errors:better-infer-suggestions-in-const, ↵Matthias Krüger-249/+271
r=oli-obk Improve infer (`_`) suggestions in `const`s and `static`s Fixes https://github.com/rust-lang/rust/issues/135010. This PR does a few things to (imo) greatly improve the error message when users write something like `static FOO: [i32; _] = [1, 2, 3]`. Firstly, it adapts the recovery code for when we encounter `_` in a const/static to work a bit more like `fn foo() -> _`, and removes the somewhat redundant query `diagnostic_only_typeck`. Secondly, it changes the lowering for `[T; _]` to always lower under the `feature(generic_arg_infer)` logic to `ConstArgKind::Infer`. We still issue the feature error, so it's not doing anything *observable* on the good path, but it does mean that we no longer erroneously interpret `[T; _]`'s array length as a `_` **wildcard expression** (à la destructuring assignment, like `(_, y) = expr`). Lastly it makes the suggestions verbose and fixes (well, suppresses) a bug with stashing and suggestions. r? oli-obk
2025-01-03Rollup merge of #135043 - ↵Matthias Krüger-2/+15
notriddle:notriddle/allowed-through-unstable-modules-is-a-deprecation-flag, r=GuillaumeGomez rustdoc: treat `allowed_through_unstable_modules` as deprecation This ensures `std::intrinsics::transmute` is deemphasized in the search engine and other UI, by cleaning it into a deprecation without propagating it through reexports when the parent module is stable. Fixes #131676 Related to #135003 r? ``@GuillaumeGomez`` ``@RalfJung`` ``@workingjubilee``
2025-01-03add m68k-unknown-none-elf targetkirk-0/+3
2025-01-03Update carrying_mul_add test to tolerate `nuw`Matthew Maurer-2/+2
LLVM 20 adds nuw to GEP operations in this code, tolerate them.
2025-01-03add codegen test for `bool::select_unpredictable`joboet-0/+35
2025-01-03Auto merge of #135034 - Noratrieb:strip-correctly, r=jieyouxubors-0/+50
Pass objcopy args for stripping on OSX When `-Cstrip` was changed in #131405 to use the bundled rust-objcopy instead of /usr/bin/strip on OSX, strip-like arguments were preserved. But strip and objcopy are, while being the same binary, different, they have different defaults depending on which binary they are. Notably, strip strips everything by default, and objcopy doesn't strip anything by default. Additionally, `-S` actually means `--strip-all`, so debuginfo stripped everything and symbols didn't strip anything. We now correctly pass `--strip-debug` and `--strip-all`. fixes #135028 try-job: aarch64-apple try-job: dist-aarch64-apple