about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2025-03-24Auto merge of #133984 - DaniPopes:scmp-ucmp, r=scottmcmbors-42/+67
Lower BinOp::Cmp to llvm.{s,u}cmp.* intrinsics Lowers `mir::BinOp::Cmp` (`three_way_compare` intrinsic) to the corresponding LLVM `llvm.{s,u}cmp.i8.*` intrinsics. These are the intrinsics mentioned in https://github.com/rust-lang/rust/pull/118310, which are now available in LLVM 19. I couldn't find any follow-up PRs/discussions about this, please let me know if I missed something. r? `@scottmcm`
2025-03-24Rollup merge of #138868 - mejrs:d_not_recommend_typo, r=davidtwcoMatthias Krüger-1/+18
Add do_not_recommend typo help
2025-03-23Rollup merge of #138574 - lolbinarycat:rustdoc-deref-24686-v2, r=GuillaumeGomezJacob Pratt-0/+27
rustdoc: be more strict about "Methods from Deref" fixes #137083 fixes #24686 Currently done: * [x] fix `render_assoc_items_inner * [x] fix sidebar logic * [x] port test from https://github.com/rust-lang/rust/pull/137564 * [x] add test for sidebar items Note that this does not yet fix the sidebar logic.
2025-03-23Rollup merge of #138135 - scottmcm:chaining-ord, r=Mark-SimulacrumJacob Pratt-0/+156
Simplify `PartialOrd` on tuples containing primitives We noticed in https://github.com/rust-lang/rust/pull/133984#issuecomment-2704011800 that currently the tuple comparison code, while it [does optimize down](https://github.com/rust-lang/rust/blob/master/tests/codegen/comparison-operators-2-tuple.rs) today, is kinda huge: <https://rust.godbolt.org/z/xqMoeYbhE> This PR changes the tuple code to go through an overridable "chaining" version of the comparison functions, so that for simple things like `(i16, u16)` and `(f32, f32)` (as seen in the new MIR pre-codegen test) we just directly get the ```rust if lhs.0 == rhs.0 { lhs.0 OP rhs.0 } else { lhs.1 OP rhs.1 } ``` version in MIR, rather than emitting a mess for LLVM to have to clean up. Test added in the first commit, so you can see the MIR diff in the second one.
2025-03-24Add do_not_recommend typo helpmejrs-1/+18
2025-03-23Stop using specialization for thisScott McMurray-2/+2
Uses `__`-named `doc(hidden)` methods instead.
2025-03-23Rollup merge of #138854 - TaKO8Ki:invalid-extern-fn-body, r=compiler-errorsMichael Goulet-0/+31
Fix ICE #138415 for invalid extern function body Fixes #138415
2025-03-23Rollup merge of #138641 - jieyouxu:print-supported-crate-types, r=UrgauMichael Goulet-7/+53
Add unstable `--print=supported-crate-types` option MCP: https://github.com/rust-lang/compiler-team/issues/836 Tracking issue: https://github.com/rust-lang/rust/issues/138640 ### Test coverage Two tests: 1. `tests/ui/print-request/stability.rs` to check that `--print=supported-crate-types` is `-Zunstable-options`-gated 2. `tests/ui/print-request/supported-crate-types.rs` is added as a basic smoke test. Observe that the compiler stdout corresponds to the below *Example output* section (e.g. `proc-macro` is unsupported on `wasm32-unknown-unknown` currently). ### Example output <details> <summary>For `x86_64-unknown-linux-gnu`</summary> Notice the presence of `{c,}dylib` and `proc-macro`: ``` bin cdylib dylib lib proc-macro rlib staticlib ``` </details> <details> <summary>For `wasm32-unknown-unknown`</summary> Notice the absence of `dylib` and `proc-macro`: ``` bin cdylib lib rlib staticlib ``` </details> <details> <summary>For `x86_64-unknown-linux-musl`</summary> Notice the absence of `{c,}dylib` but presence of `proc-macro`: ``` bin lib proc-macro rlib staticlib ``` </details> ### Documentation I added an entry in the unstable book's print request section to document this `supported-crate-types` print request. ### Unresolved questions - [ ] (Name bikeshedding) is `supported-crate-types` a good name for the print request? I'm inclined to say it's good enough for an unstable print request, but may be worth revisiting at stabilization time. ### Stability This print request being added is *unstable* in this PR. A separate stabilization PR following the usual compiler flag stabilization procedure should be filed for stabilization after some baking time. ### Review remarks Best reviewed commit-by-commit. r? compiler
2025-03-23Rollup merge of #138545 - scottmcm:more-option-tests, r=Mark-SimulacrumMichael Goulet-4/+315
Add MIR pre-codegen tests to track #138544 I don't know how best to fix the problem yet, but wanted to check in some tests to demonstrate it and make sure that they get updated to keep it fixed if anyone does fix it 🙂 No code changes; just the tests for #138544.
2025-03-23Rollup merge of #138509 - reddevilmidzy:add-test, r=compiler-errorsMichael Goulet-0/+44
Add test to ensure no index out of bounds panic (#135474) Adds test for #135474
2025-03-23Rollup merge of #138293 - clubby789:doc-cfg-gate, r=GuillaumeGomezMichael Goulet-0/+49
rustdoc: Gate unstable `doc(cfg())` predicates Fixes #138113 Since the extraction process treats `cfg(true)` as having no cfg attribute, we have to do the gating during parsing; so we remove the unused `features` arg from `Cfg::matches`
2025-03-23Adjust `rustc-print-info-issue-138612.rs`Jieyou Xu-3/+8
- Document test intent to check for `-Whelp` suggestion if `--print=lints` was specified. - Move this test under `tests/ui/print-request/` and rename it to `print-lints-help.rs` to better reflect what it is checking.
2025-03-23Rebless tests with changed help due to new print request optionJieyou Xu-4/+4
2025-03-23Implement `supported-crate-types` print requestJieyou Xu-0/+41
As an unstable print request.
2025-03-23fix ICE #138415Takayuki Maeda-0/+31
2025-03-22Auto merge of #138841 - matthiaskrgr:rollup-bfkls57, r=matthiaskrgrbors-32/+48
Rollup of 8 pull requests Successful merges: - #138018 (rustdoc: Use own logic to print `#[repr(..)]` attributes in JSON output.) - #138294 (Mark some std tests as requiring `panic = "unwind"`) - #138468 (rustdoc js: add nonnull helper and typecheck src-script.js) - #138675 (Add release notes for 1.85.1) - #138765 (Fix Thread::set_name on cygwin) - #138786 (Move some driver code around) - #138793 (target spec check: better error when llvm-floatabi is missing) - #138822 (De-Stabilize `file_lock`) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-22Auto merge of #138831 - matthiaskrgr:rollup-3t0dqiz, r=matthiaskrgrbors-81/+116
Rollup of 7 pull requests Successful merges: - #138609 (Add stack overflow handler for cygwin) - #138639 (Clean UI tests 2 of n) - #138773 (catch_unwind intrinsic: document return value) - #138782 (test(ui): add tuple-struct-where-clause-suggestion ui test for #91520) - #138794 (expand: Do not report `cfg_attr` traces on macros as unused attributes) - #138801 (triagebot: add autolabel rules for D-* and L-*) - #138804 (Allow inlining for `Atomic*::from_ptr`) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-22Rollup merge of #138786 - bjorn3:driver_code_move, r=compiler-errorsMatthias Krüger-1/+1
Move some driver code around `--emit mir`, `#[rustc_symbol_name]` and `#[rustc_def_path]` now run before codegen and thus work even if codegen fails. This can help with debugging.
2025-03-22rustdoc: Use own logic to print `#[repr(..)]` attributes in JSON output.Predrag Gruevski-31/+47
2025-03-22rustdoc: be more strict about "Methods from Deref"binarycat-0/+27
hack: is_doc_subtype_of always returns true for TyAlias it's worth noting that this function is only used in the handling of "Methods from Deref", and we were previously assuming all generic parameters were meaningless, so this is still an improvment from the status quo. this change means that we will have strictly less false positives without adding any new false negitives. Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2025-03-22Auto merge of #138830 - matthiaskrgr:rollup-gaxgfwl, r=matthiaskrgrbors-1184/+1263
Rollup of 7 pull requests Successful merges: - #138410 (Couple mir building cleanups) - #138490 (Forward `stream_position` in `Arc<File>` as well) - #138535 (Cleanup `LangString::parse`) - #138536 (stable_mir: Add `MutMirVisitor`) - #138673 (Fix build failure on Trusty) - #138750 (Make `crate_hash` not iterate over `hir_crate` owners anymore) - #138763 (jsondocck: Replace `jsonpath_lib` with `jsonpath-rust`) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-22Rollup merge of #138794 - petrochenkov:cfgtracefix, r=jieyouxuMatthias Krüger-7/+14
expand: Do not report `cfg_attr` traces on macros as unused attributes Fixes https://github.com/rust-lang/rust/issues/138779
2025-03-22Rollup merge of #138782 - karolzwolak:where-test-91520, r=compiler-errorsMatthias Krüger-0/+38
test(ui): add tuple-struct-where-clause-suggestion ui test for #91520 Fixes #91520 I tried to also make it a .fixed test, but I failed to accomplish that. That's because of the 'consider annotating `Inner<T>` with `#[derive(Clone)]`' suggestion does not compile (conflicting Clone implementations), and I can't isolate them with `rustfix-only-machine-applicable` as both suggestions are not marked as `MachineApplicable`. Instead I just test that the where clause suggestion is applied to the correct line.
2025-03-22Rollup merge of #138639 - spencer3035:clean-ui-tests-2-of-n, r=jieyouxuMatthias Krüger-74/+64
Clean UI tests 2 of n Modified 4 tests in tests/ui. Cleaned 3 and deleted one. I have a final commit changing the values in `src/tools/tidy/src/ui_tests.rs`. I wasn't sure if it was best practice to change this value as you go along or once at the end. I can rebase to something that incrementally changes the value in the "cleaned" commits if that is preferred. Related Issues: #73494 #133895 r? jieyouxu
2025-03-22Rollup merge of #138763 - aDotInTheVoid:two-years-later, r=GuillaumeGomezMatthias Krüger-1183/+1183
jsondocck: Replace `jsonpath_lib` with `jsonpath-rust` The current jsonpath implementation we use isn't spec-compliant, and is buggy. See https://github.com/freestrings/jsonpath/issues/91 To solve it, it's replaced with https://github.com/besok/jsonpath-rust. This is spec-compiant, and doesn't have a really awkward bug we need to always dance around. Unfortunately, this requires rewriting almost every test, as the behaviour of `[?(```@`,``` which is *extremely* common was changed. (But the new behaviour makes way more sense, and isn't buggy with tripply nested selectors) Unblocks #110406. Makes #100515 much easier as we don't need to explain the broken JSONPath implementation Best reviewed commit-by-commit. The first does the replacement. The next two rewrite the test-suite mechanically. The last rewrites the test-suite by hand. r? ```@GuillaumeGomez```
2025-03-22Rollup merge of #138536 - makai410:mut-mir-visitor, r=celinvalMatthias Krüger-1/+80
stable_mir: Add `MutMirVisitor` Resolves: [rust-lang/project-stable-mir#81](https://github.com/rust-lang/project-stable-mir/issues/81). I am unsure if we should add a `MutableBody` like Kani did. Currently, I use `&mut Body` in `MutMirVisitor::visit_body()`. r? ``````@celinval``````
2025-03-22Auto merge of #136974 - m-ou-se:fmt-options-64-bit, r=scottmcmbors-108/+88
Reduce FormattingOptions to 64 bits This is part of https://github.com/rust-lang/rust/issues/99012 This reduces FormattingOptions from 6-7 machine words (384 bits on 64-bit platforms, 224 bits on 32-bit platforms) to just 64 bits (a single register on 64-bit platforms). Before: ```rust pub struct FormattingOptions { flags: u32, // only 6 bits used fill: char, align: Option<Alignment>, width: Option<usize>, precision: Option<usize>, } ``` After: ```rust pub struct FormattingOptions { /// Bits: /// - 0-20: fill character (21 bits, a full `char`) /// - 21: `+` flag /// - 22: `-` flag /// - 23: `#` flag /// - 24: `0` flag /// - 25: `x?` flag /// - 26: `X?` flag /// - 27: Width flag (if set, the width field below is used) /// - 28: Precision flag (if set, the precision field below is used) /// - 29-30: Alignment (0: Left, 1: Right, 2: Center, 3: Unknown) /// - 31: Always set to 1 flags: u32, /// Width if width flag above is set. Otherwise, always 0. width: u16, /// Precision if precision flag above is set. Otherwise, always 0. precision: u16, } ```
2025-03-22Auto merge of #138719 - lcnr:concrete_opaque_types-closures, r=oli-obkbors-98/+59
merge opaque types defined in nested bodies A small step towards https://github.com/rust-lang/types-team/issues/129 r? `@oli-obk`
2025-03-21cleaned and organized 3 tests in `./tests/ui/issues`Spencer-74/+64
2025-03-22Add test to ensure no index out of bounds panic (#135474)Redddy-0/+44
2025-03-21expand: Do not report `cfg_attr` traces on macros as unused attributesVadim Petrochenkov-7/+14
2025-03-21Rollup merge of #138721 - jchecahi:tests-explicit-cpus, r=tgross35Matthias Krüger-28/+29
Use explicit cpu in some asm and codegen tests. Some tests expect to be compiled for a specific CPU or require certain target features to be present (or absent). These tests work fine with default CPUs but fail in downstream builds for RHEL and Fedora, where we use non-default CPUs such as z13 on s390x, pwr9 on ppc64le, or x86-64-v2/x86-64-v3 on x86_64. This is similar to #124597.
2025-03-21Rollup merge of #138669 - durin42:llvm-21-anon-func-unmangled, r=bjorn3Matthias Krüger-2/+14
tests: accept some noise from LLVM 21 in symbols-all-mangled I'm not entirely sure this is correct, but it doesn't feel obviously-wrong so I figured I'd just start by sending a PR rather than filing a bug and letting it linger. ``@rustbot`` label llvm-main
2025-03-21Rollup merge of #138627 - EnzymeAD:autodiff-cleanups, r=oli-obkMatthias Krüger-8/+4
Autodiff cleanups Splitting out some cleanups to reduce the size of my batching PR and simplify ``@haenoe`` 's [PR](https://github.com/rust-lang/rust/pull/138314). r? ``@oli-obk`` Tracking: - https://github.com/rust-lang/rust/issues/124509
2025-03-21Rollup merge of #138570 - folkertdev:naked-function-target-feature-gate, ↵Matthias Krüger-7/+49
r=Amanieu add `naked_functions_target_feature` unstable feature tracking issue: https://github.com/rust-lang/rust/issues/138568 tagging https://github.com/rust-lang/rust/pull/134213 https://github.com/rust-lang/rust/issues/90957 This PR puts `#[target_feature(/* ... */)]` on `#[naked]` functions behind its own feature gate, so that naked functions can be stabilized. It turns out that supporting `target_feature` on naked functions is tricky on some targets, so we're splitting it out to not block stabilization of naked functions themselves. See the tracking issue for more information and workarounds. Note that at the time of writing, the `target_features` attribute is ignored when generating code for naked functions. r? ``@Amanieu``
2025-03-21Fix lint name in unused linker_messages warningbjorn3-1/+1
2025-03-21test(ui): add tuple-struct-where-clause-suggestion ui test for #91520Karol Zwolak-0/+38
2025-03-21Rollup merge of #138751 - Jeff-A-Martin:used-with-archive-test-fuchsia, ↵Matthias Krüger-0/+1
r=jieyouxu Fix the "used_with_archive" test on Fuchsia This change adds Fuchsia OS as a target to the cfg_attr in the pre_main_constructor external declaration. This allows the "tests/ui/attributes/used_with_archive.rs" to pass against Fuchsia.
2025-03-21Rollup merge of #138724 - fmease:list-stems-bear-no-name, r=nnethercoteMatthias Krüger-0/+11
Check attrs: Don't try to retrieve the name of list stems Fixes #138723. r? nnethercote or compiler
2025-03-21tests/rustdoc-json: change assertions to use RFC 9535 jsonpathAlona Enraght-Moony-25/+25
2025-03-21tests/rustdoc-json: replace `$.paths[*][?` with `$.paths[?`Alona Enraght-Moony-6/+6
This fixes all 3 of these tests. Done automatically in VSCode.
2025-03-21tests/rustdoc-json: replace `$.index[*][?` with `$.index[?`Alona Enraght-Moony-1155/+1155
Done automatically with VSCode.
2025-03-20Auto merge of #138747 - matthiaskrgr:rollup-68x44rw, r=matthiaskrgrbors-16/+97
Rollup of 8 pull requests Successful merges: - #138435 (Add support for postfix yield expressions) - #138685 (Use `Option<Ident>` for lowered param names.) - #138700 (Suggest `-Whelp` when pass `--print lints` to rustc) - #138727 (Do not rely on `type_var_origin` in `OrphanCheckErr::NonLocalInputType`) - #138729 (Clean up `FnCtxt::resolve_coroutine_interiors`) - #138731 (coverage: Add LLVM plumbing for expansion regions) - #138732 (Use `def_path_str` for def id arg in `UnsupportedOpInfo`) - #138735 (Remove `llvm` and `llvms` triagebot ping aliases for `icebreakers-llvm` ping group) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-20Auto merge of #138515 - petrochenkov:cfgtrace, r=nnethercotebors-0/+79
expand: Leave traces when expanding `cfg_attr` attributes Currently `cfg_trace` just disappears during expansion, but after this PR `#[cfg_attr(some tokens)]` will leave a `#[cfg_attr_trace(some tokens)]` attribute instead of itself in AST after expansion (the new attribute is built-in and inert, its inner tokens are the same as in the original attribute). This trace attribute can then be used by lints or other diagnostics, #133823 has some examples. Tokens in these trace attributes are set to an empty token stream, so the traces are non-existent for proc macros and cannot affect any user-observable behavior. This is also a weakness, because if a proc macro processes some code with the trace attributes, they will be lost, so the traces are best effort rather than precise. The next step is to do the same thing with `cfg` attributes (`#[cfg(TRUE)]` currently remains in both AST and tokens after expanding, it should be replaced with a trace instead). The idea belongs to `@estebank.`
2025-03-20Fix the "used_with_archive" test on FuchsiaJeff Martin-0/+1
This change adds Fuchsia OS as a target to the cfg_attr in the pre_main_constructor external declaration. This allows the "tests/ui/attributes/used_with_archive.rs" to pass against Fuchsia.
2025-03-20tests: accept some noise from LLVM 21 in symbols-all-mangledAugie Fackler-2/+14
I'm not entirely sure this is correct, but it doesn't feel obviously-wrong so I figured I'd just start by sending a PR rather than filing a bug and letting it linger. @rustbot label llvm-main
2025-03-20Rollup merge of #138732 - compiler-errors:did, r=jieyouxuMatthias Krüger-6/+6
Use `def_path_str` for def id arg in `UnsupportedOpInfo` We could alternatively just omit the def path from the label, but I think it's fine to keep around Fixes #138730
2025-03-20Rollup merge of #138727 - compiler-errors:ty-var-origin, r=fmeaseMatthias Krüger-10/+33
Do not rely on `type_var_origin` in `OrphanCheckErr::NonLocalInputType` The ordering of ty var unification means that we may end up with a root variable whose ty var origin is from another item's params. Let's not rely on this by just unifying the infer vars with the params of the impl + resolving. It's kinda goofy but it's clearer IMO. Fixes #132826. r? `@fmease` or `@lcnr`
2025-03-20Rollup merge of #138700 - xizheyin:issue-138612, r=NadrierilMatthias Krüger-0/+9
Suggest `-Whelp` when pass `--print lints` to rustc Closes #138612
2025-03-20Rollup merge of #138435 - eholk:prefix-yield, r=oli-obkMatthias Krüger-0/+49
Add support for postfix yield expressions We've been having a discussion about whether we want postfix yield, or want to stick with prefix yield, or have both. I figured it's easy enough to support both for now and let us play around with them while the feature is still experimental. This PR treats `yield x` and `x.yield` as semantically equivalent. There was a suggestion to make `yield x` have a `()` type (so it only works in coroutines with `Resume = ()`. I think that'd be worth trying, either in a later PR, or before this one merges, depending on people's opinions. #43122