about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2025-03-25Add a test with an empty crate name.Nicholas Nethercote-0/+13
This error was untested.
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-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-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
2025-03-20Auto merge of #133889 - compiler-errors:inh-unstable, r=Nadrierilbors-0/+110
Consider fields to be inhabited if they are unstable Fixes #133885 with a simple heuristic r? Nadrieril Not totally certain if this needs T-lang approval or a crater run.
2025-03-20Use def_path_str for def id arg in UnsupportedOpInfoMichael Goulet-6/+6
2025-03-20Do not rely on type_var_origin in OrphanCheckErr::NonLocalInputTypeMichael Goulet-10/+33
2025-03-19Check attrs: Don't try to retrieve the name of list stemsLeón Orell Valerian Liehr-0/+11
2025-03-19Use explicit cpu in some asm and codegen tests.Jesus Checa Hidalgo-28/+29
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.
2025-03-19merge opaque types of nested bodieslcnr-98/+59
2025-03-19Rollup merge of #138613 - m-ou-se:no-more-e0773, r=jdonszelmann,petrochenkovMatthias Krüger-53/+4
Remove E0773 "A builtin-macro was defined more than once." Error E0773 "A builtin-macro was defined more than once" is triggered when using the same `#[rustc_builtin_macro(..)]` twice. However, it can only be triggered in unstable code (using a `rustc_` attribute), and there doesn't seem to be any harm in using the same implementation from `compiler/rustc_builtin_macros/…` for multiple macro definitions. By changing the Box to an Arc in `SyntaxExtensionKind`, we can throw away the `BuiltinMacroState::{NotYetSeen, AlreadySeen}` logic, simplifying things.
2025-03-19Rollup merge of #138594 - oli-obk:no-select, r=lcnrMatthias Krüger-10/+68
Fix next solver handling of shallow trait impl check I'm trying to remove unnecessary direct calls to `select`, and this one seemed like a good place to start 😆 r? `@compiler-errors` or `@lcnr`
2025-03-19Rollup merge of #138589 - ↵Matthias Krüger-0/+230
zachs18:block-label-not-supported-here-loop-body-help, r=petrochenkov If a label is placed on the block of a loop instead of the header, suggest moving it to the header. Fixes #138585 If a label is placed on the block of a loop instead of the header, suggest to the user moving it to the loop header instead of ~~suggesting to remove it~~ emitting a tool-only suggestion to remove it. ```rs fn main() { loop 'a: { return; } } ``` ```diff error: block label not supported here --> src/main.rs:2:10 | 2 | loop 'a: { return; } | ^^^ not supported here + | +help: if you meant to label the loop, move this label before the loop + | +2 - loop 'a: { return; } +2 + 'a: loop { return; } + | ``` Questions for reviewer: * The "desired output" in the linked issue had the main diagnostic be "misplaced loop label". Should the main diagnostic message the changed instead of leaving it as "block label not supported here"? * Should this be `Applicability::MachineApplicable`?
2025-03-19Rollup merge of #138001 - meithecatte:privately-uninhabited, r=NadrierilMatthias Krüger-0/+70
mir_build: consider privacy when checking for irrefutable patterns This PR fixes #137999. Note that, since this makes the compiler reject code that was previously accepted, it will probably need a crater run. I include a commit that factors out a common code pattern into a helper function, purely because the fact that this was repeated all over the place was bothering me. Let me know if I should split that into a separate PR instead.
2025-03-19Rollup merge of #137051 - thaliaarchi:io-optional-impls/empty, r=m-ou-seMatthias Krüger-2/+2
Implement default methods for `io::Empty` and `io::Sink` Implements default methods of `io::Read`, `io::BufRead`, and `io::Write` for `io::Empty` and `io::Sink`. These implementations are equivalent to the defaults, except in doing less unnecessary work. `Read::read_to_string` and `BufRead::read_line` both have a redundant call to `str::from_utf8` which can't be inlined from `core` and `Write::write_all_vectored` has slicing logic which can't be simplified (See on [Compiler Explorer](https://rust.godbolt.org/z/KK6xcrWr4)). The rest are optimized to the minimal with `-C opt-level=3`, but this PR gives that benefit to unoptimized builds. This includes an implementation of `Write::write_fmt` which just ignores the `fmt::Arguments<'_>`. This could be problematic whenever a user formatting impl is impure, but the docs do not guarantee that the args will be expanded. Tracked in https://github.com/rust-lang/rust/issues/136756. r? `@m-ou-se`
2025-03-19Fix next solver handling of shallow trait impl checkOli Scherer-2/+39
2025-03-19Demonstrate next-solver missing diagnosticOli Scherer-12/+33
2025-03-19Allow builtin macros to be used more than once.Mara Bos-53/+4
This removes E0773 "A builtin-macro was defined more than once."
2025-03-19Auto merge of #138693 - matthiaskrgr:rollup-ejq8mwp, r=matthiaskrgrbors-120/+177
Rollup of 10 pull requests Successful merges: - #136177 (clarify BufRead::{fill_buf, consume} docs) - #138654 (Remove the regex dependency from coretests) - #138655 (rustc-dev-guide sync) - #138656 (Remove double nesting in post-merge workflow) - #138658 (CI: mirror alpine and centos images to ghcr) - #138659 (coverage: Don't store a body span in `FunctionCoverageInfo`) - #138661 (Revert: Add *_value methods to proc_macro lib) - #138670 (Remove existing AFIDT implementation) - #138674 (Various codegen_llvm cleanups) - #138684 (use then in docs for `fuse` to enhance readability) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-19Suggest `-Whelp` when pass `--print lints` to rustcxizheyin-0/+9
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>