about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2025-07-13Auto merge of #140717 - mejrs:diagnostic_lints, r=oli-obkbors-29/+35
Split up the `unknown_or_malformed_diagnostic_attributes` lint This splits up the lint into the following lint group: - `unknown_diagnostic_attributes` - triggers if the attribute is unknown to the current compiler - `misplaced_diagnostic_attributes` - triggers if the attribute exists but it is not placed on the item kind it's meant for - `malformed_diagnostic_attributes` - triggers if the attribute's syntax or options are invalid - `malformed_diagnostic_format_literals` - triggers if the format string literal is invalid, for example if it has unpaired curly braces or invalid parameters - this pr doesn't create it, but future lints for things like deprecations can also go here. This PR does not start emitting lints in places that previously did not. ## Motivation I want to have finer control over what `unknown_or_malformed_diagnostic_attributes` does I have a project with fairly low msrv that is/will have a lower msrv than future diagnostic attributes. So lints will be emitted when I or others compile it on a lower msrv. At this time, there are two options to silence these lints: - `#[allow(unknown_or_malformed_diagnostic_attributes)]` - this risks diagnostic regressions if I (or others) mess up using the attribute, or if the attribute's syntax ever changes. - write a build script to detect the compiler version and emit cfgs, and then conditionally enable the attribute: ```rust #[cfg_attr(rust_version_99, diagnostic::new_attr_in_rust_99(thing = ..))]` struct Foo; ``` or conditionally `allow` the lint: ```rust // lib.rs #![cfg_attr(not(current_rust), allow(unknown_or_malformed_diagnostic_attributes))] ``` I like to avoid using build scripts if I can, so the following works much better for me. That is what this PR will let me do in the future: ```rust #[allow(unknown_diagnostic_attribute, reason = "attribute came out in rust 1.99 but msrv is 1.70")] #[diagnostic::new_attr_in_rust_99(thing = ..)]` struct Foo;
2025-07-13compute all rpitit of a traitbohan-1/+35
2025-07-12Auto merge of #143624 - tmiasko:copy-prop-borrowed, r=cjgillotbors-122/+91
Propagate from borrowed locals in CopyProp r? cjgillot
2025-07-12Auto merge of #143810 - matthiaskrgr:rollup-iw7a23z, r=matthiaskrgrbors-34/+57
Rollup of 9 pull requests Successful merges: - rust-lang/rust#143403 (Port several trait/coherence-related attributes the new attribute system) - rust-lang/rust#143633 (fix: correct assertion to check for 'noinline' attribute presence before removal) - rust-lang/rust#143647 (Clarify and expand documentation for std::sys_common dependency structure) - rust-lang/rust#143716 (compiler: doc/comment some codegen-for-functions interfaces) - rust-lang/rust#143747 (Add target maintainer information for aarch64-unknown-linux-musl) - rust-lang/rust#143759 (Fix typos in function names in the `target_feature` test) - rust-lang/rust#143767 (Bump `src/tools/x` to Edition 2024 and some cleanups) - rust-lang/rust#143769 (Remove support for SwitchInt edge effects in backward dataflow) - rust-lang/rust#143770 (build-helper: clippy fixes) r? `@ghost` `@rustbot` modify labels: rollup
2025-07-12Auto merge of #143766 - matthiaskrgr:rollup-0x7t69s, r=matthiaskrgrbors-399/+814
Rollup of 8 pull requests Successful merges: - rust-lang/rust#142391 (rust: library: Add `setsid` method to `CommandExt` trait) - rust-lang/rust#143302 (`tests/ui`: A New Order [27/N]) - rust-lang/rust#143303 (`tests/ui`: A New Order [28/28] FINAL PART) - rust-lang/rust#143568 (std: sys: net: uefi: tcp4: Add timeout support) - rust-lang/rust#143611 (Mention more APIs in `ParseIntError` docs) - rust-lang/rust#143661 (chore: Improve how the other suggestions message gets rendered) - rust-lang/rust#143708 (fix: Include frontmatter in -Zunpretty output ) - rust-lang/rust#143718 (Make UB transmutes really UB in LLVM) r? `@ghost` `@rustbot` modify labels: rollup try-job: i686-gnu-nopt-1 try-job: test-various
2025-07-11Rollup merge of #143759 - fluiderson:rdttff, r=aDotInTheVoidMatthias Krüger-3/+3
Fix typos in function names in the `target_feature` test Seems like `test1` was copy-pasted but forgotten to be renamed after.
2025-07-11Rollup merge of #143403 - GrigorenkoPV:attributes/traits, r=jdonszelmannMatthias Krüger-31/+54
Port several trait/coherence-related attributes the new attribute system Part of rust-lang/rust#131229 This ports: - `#[const_trait]` - `#[rustc_deny_explicit_impl]` - `#[rustc_do_not_implement_via_object]` - `#[rustc_coinductive]` - `#[type_const]` - `#[rustc_specialization_trait]` - `#[rustc_unsafe_specialization_marker]` - `#[marker]` - `#[fundamental]` - `#[rustc_paren_sugar]` - `#[rustc_allow_incoherent_impl]` - `#[rustc_coherence_is_core]` This also changes `#[marker]` to error on duplicates instead of warning. cc rust-lang/rust#142838, but I don't think it matters too much, since it's unstable. r? ``@oli-obk``
2025-07-11Rollup merge of #143718 - scottmcm:ub-transmute-is-ub, r=WaffleLapkinMatthias Krüger-17/+20
Make UB transmutes really UB in LLVM Ralf suggested in <https://github.com/rust-lang/rust/pull/143410#discussion_r2184928123> that UB transmutes shouldn't be trapping, which happened for the one path *that* PR was changing, but there's another path as well, so *this* PR changes that other path to match. r? codegen
2025-07-11Rollup merge of #143708 - epage:pretty, r=compiler-errorsMatthias Krüger-0/+19
fix: Include frontmatter in -Zunpretty output In the implementation (rust-lang/rust#140035), this was left as an open question for the tracking issue (rust-lang/rust#136889). My assumption is that this should be carried over. The test was carried over from rust-lang/rust#137193 which was superseded by rust-lang/rust#140035. Thankfully, either way, `-Zunpretty` is unstable and we can always change it even if we stabilize frontmatter.
2025-07-11Rollup merge of #143661 - Muscraft:other-suggestion-message, r=estebankMatthias Krüger-12/+294
chore: Improve how the other suggestions message gets rendered Note: This change is part of my ongoing work to use `annotate-snippets` as `rustc`'s emitter This change started as a way to remove some specialty code paths from `annotate-snippets`, by making the "and {} other candidates" message get rendered like a secondary message with no level, but turned into a fix for the message's Unicode output. Before this change, when using the Unicode output, the other suggestions message would get rendered outside of the main suggestion block, making it feel disconnected from what it was referring to. This change makes it so that the message is on the last line of the block, aligning its rendering with other secondary messages, and making it clear what the message is referring to. Before: ``` error[E0433]: failed to resolve: use of undeclared type `IntoIter` ╭▸ $DIR/issue-82956.rs:28:24 │ LL │ let mut iter = IntoIter::new(self); │ ━━━━━━━━ use of undeclared type `IntoIter` ╰╴ help: consider importing one of these structs ╭╴ LL + use std::array::IntoIter; ├╴ LL + use std::collections::binary_heap::IntoIter; ├╴ LL + use std::collections::btree_map::IntoIter; ├╴ LL + use std::collections::btree_set::IntoIter; ╰╴ and 9 other candidates ``` After: ``` error[E0433]: failed to resolve: use of undeclared type `IntoIter` ╭▸ $DIR/issue-82956.rs:28:24 │ LL │ let mut iter = IntoIter::new(self); │ ━━━━━━━━ use of undeclared type `IntoIter` ╰╴ help: consider importing one of these structs ╭╴ LL + use std::array::IntoIter; ├╴ LL + use std::collections::binary_heap::IntoIter; ├╴ LL + use std::collections::btree_map::IntoIter; ├╴ LL + use std::collections::btree_set::IntoIter; │ ╰ and 9 other candidates ```
2025-07-11Rollup merge of #143303 - Kivooeo:tf28, r=tgross35Matthias Krüger-197/+262
`tests/ui`: A New Order [28/28] FINAL PART > [!NOTE] > > Intermediate commits are intended to help review, but will be squashed prior to merge. Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895. r? ``@tgross35``
2025-07-11Rollup merge of #143302 - Kivooeo:tf27, r=tgross35Matthias Krüger-173/+219
`tests/ui`: A New Order [27/N] > [!NOTE] > > Intermediate commits are intended to help review, but will be squashed prior to merge. Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895. r? ``@tgross35``
2025-07-11Auto merge of #142911 - mejrs:unsized, r=compiler-errorsbors-7/+118
Remove support for dynamic allocas Followup to rust-lang/rust#141811
2025-07-10Rollup merge of #143744 - fmease:lta-expand-proper-depth, r=compiler-errorsTrevor Gross-0/+20
Properly track the depth when expanding free alias types Decrease the depth after the fold so as not to affect the depth for unrelated same-level constituent types. My bad. Fixes rust-lang/rust#142419.
2025-07-10Rollup merge of #143742 - estebank:borrow-suggestion, r=compiler-errorsTrevor Gross-75/+190
Rework borrowing suggestions to use `Expr` instead of just `Span` In the suggestion machinery for borrowing expressions and types, always use the available obligation `Span` to find the appropriate `Expr` to perform appropriateness checks no the `ExprKind` instead of on the textual snippet corresponding to the `Span`. (We were already doing this, but only for a subset of cases.) This now better handles situations where parentheses and `<>` are needed for correct syntax (`&(foo + bar)`, `(&foo).bar()`, `<&Foo>::bar()`, etc.). Unify the logic for the case where `&` *and* `&mut` are appropriate with the logic for only one of those cases. (Instead of having two branches for emitting the suggestion, we now have a single one, using `Diag::multipart_suggestions` always.) Handle the case when `S::foo()` should have been `<&S>::foo()` (instead of suggesting the prior `&S::foo()`. Fix rust-lang/rust#143393. Make `Diag::multipart_suggestions` always verbose. CC rust-lang/rust#141973.
2025-07-11fix typos in function names in the `target_feature` testFluid-3/+3
2025-07-11Split up the `unknown_or_malformed_diagnostic_attributes` lintmejrs-29/+35
2025-07-10Rollup merge of #143665 - obi1kenobi:pg/doc-hidden-tests, r=aDotInTheVoidMatthias Krüger-0/+36
[rustdoc-json] Add tests for `#[doc(hidden)]` handling of items. Add tests which check: - `#[doc(hidden)]` items are not present in rustdoc JSON output by default. - Invoking rustdoc with `--document-hidden-items` makes `#[doc(hidden)]` items appear, and they show their `#[doc(hidden)]` status appropriately. r? `@aDotInTheVoid`
2025-07-10Rollup merge of #143640 - oli-obk:const-fn-traits, r=compiler-errorsMatthias Krüger-562/+69
Constify `Fn*` traits r? `@compiler-errors` `@fee1-dead` this should unlock a few things. A few `const_closures` tests have broken even more than before, but that feature is marked as incomplete anyway cc rust-lang/rust#67792
2025-07-10Rollup merge of #143599 - folkertdev:x86-asm-syntax-global-naked-asm, r=AmanieuMatthias Krüger-0/+75
emit `.att_syntax` when global/naked asm use that option fixes https://github.com/rust-lang/rust/issues/143542 LLVM would error when using `-Cllvm-args=-x86-asm-syntax=intel` in combination with global/naked assembly with `att_syntax`. It turns out that for LLVM you do in this case need to emit `.att_syntax`. r? `@Amanieu`
2025-07-10Rollup merge of #143590 - GuillaumeGomez:reexport-shadowing, r=lolbinaryMatthias Krüger-0/+41
Fix weird rustdoc output when single and glob reexport conflict on a name Fixes rust-lang/rust#143107. The problem was that the second reexport would overwrite the first, leading to having unexpected results. To fix it, I now group items by their original `DefId` and their name and keep tracks of all imports for this item (should very rarely be more than one though, and even less often more than 2). cc `@lolbinarycat`
2025-07-10Rollup merge of #143446 - usamoi:export-executable-symbols, r=bjorn3,oli-obkMatthias Krüger-0/+30
use `--dynamic-list` for exporting executable symbols closes rust-lang/rust#101610 cc rust-lang/rust#84161 https://sourceware.org/binutils/docs-2.39/ld/VERSION.html: > --dynamic-list=dynamic-list-file Specify the name of a dynamic list file to the linker. This is typically used when creating shared libraries to specify a list of global symbols whose references shouldn’t be bound to the definition within the shared library, or creating dynamically linked executables to specify a list of symbols which should be added to the symbol table in the executable. This option is only meaningful on ELF platforms which support shared libraries. `ld.lld --help`: > --dynamic-list=<file>: Similar to --export-dynamic-symbol-list. When creating a shared object, this additionally implies -Bsymbolic but does not set DF_SYMBOLIC > --export-dynamic-symbol-list=file: Read a list of dynamic symbol patterns. Apply --export-dynamic-symbol on each pattern > --export-dynamic-symbol=glob: (executable) Put matched symbols in the dynamic symbol table. (shared object) References to matched non-local STV_DEFAULT symbols shouldn't be bound to definitions within the shared object. Does not imply -Bsymbolic. > --export-dynamic: Put symbols in the dynamic symbol table Use `--dynamic-list` because it's older than `--export-dynamic-symbol-list` (binutils 2.35) try-job: dist-i586-gnu-i586-i686-musl
2025-07-10Properly track the depth when expanding free alias typesLeón Orell Valerian Liehr-0/+20
2025-07-10Update testEsteban Küber-14/+70
2025-07-10Make `Diag::multipart_suggestions` always verboseEsteban Küber-109/+186
2025-07-10Rework borrowing suggestions to use `Expr` instead of just `Span`Esteban Küber-110/+92
In the suggestion machinery for borrowing expressions and types, always use the available obligation `Span` to find the appropriate `Expr` to perform appropriateness checks no the `ExprKind` instead of on the textual snippet corresponding to the `Span`. Unify the logic for the case where `&` *and* `&mut` are appropriate with the logic for only one of those cases. Handle the case when `S::foo()` should have been `<&S>::foo()` (instead of suggesting the prior `&S::foo()`.
2025-07-10Add `BuilderMethods::unreachable_nonterminator`Scott McMurray-21/+20
So places that need `unreachable` but in the middle of a basic block can call that instead of figuring out the best way to do it.
2025-07-10fix: Include frontmatter in -Zunpretty outputEd Page-0/+2
In the implementation (#140035), this was left as an open question for the tracking issue (#136889). My assumption is that this should be carried over. Thankfully, either way, `-Zunpretty` is unstable and we can always change it even if we stabilize frontmatter.
2025-07-10chore: Improve how the other suggestions message gets renderedScott Schafer-18/+18
2025-07-10test: Make one multi suggestion test unicodeScott Schafer-0/+282
2025-07-10cleaned up some testsKivooeo-112/+177
2025-07-10cleaned up some testsKivooeo-85/+131
2025-07-10Rollup merge of #143683 - jieyouxu:rms-cleanup, r=KobzolMatthias Krüger-53/+57
Assorted `run-make-support` maintenance This PR should contain no functional changes. - Commit 1: Removes the support library's CHANGELOG. In the very beginning, I thought maybe we would try to version this library. But this is a purely internal test support library, and it's just extra busywork trying to maintain changelog/versions. It's also hopelessly outdated. - Commit 2: Resets version number to `0.0.0`. Ditto on busywork. - Commit 3: Bump `run-make-support` to Edition 2024. The support library was already "compliant" with Edition 2024. - Commit 4: Slightly organizes the support library dependencies. - Commit 5: Previously, I tried hopelessly to maintain some manual formatting, but that was annoying because it required skipping rustfmt (so export ordering etc. could not be extra formatted). Give up, and do some rearrangements / module prefix tricks to get the `lib.rs` looking at least *reasonable*. IMO this is not a strict improvement, but I rather regain the ability to auto-format it with rustfmt. - Commit {6,7}: Noticed in rust-lang/rust#143669 that we apparently had *both* {`is_msvc`, `is_windows_msvc`}. This PR removes `is_msvc` in favor of `is_windows_msvc` to make it unambiguous (and only retain one way of gating) as there are some UEFI targets which are MSVC but not Windows. Best reviewed commit-by-commit. r? `@Kobzol`
2025-07-10Rollup merge of #143666 - nilehmann:nested_bodies_in_consumers, r=lcnrMatthias Krüger-8/+18
Re-expose nested bodies in rustc_borrowck::consumers After https://github.com/rust-lang/rust/pull/138499, it's not possible anymore to get borrowck information for nested bodies via `get_body_with_borrowck_facts`. This PR re-exposes nested bodies by returning a map containing the typeck root and all its nested bodies. To collect the bodies, a map is added to `BorrowCheckRootCtxt`, and a body is inserted every time `do_mir_borrowck` is called. r? ``@lcnr``
2025-07-10Rollup merge of #136906 - chenyukang:yukang-fix-136741-closure-body, r=oli-obkMatthias Krüger-16/+136
Add checking for unnecessary delims in closure body Fixes #136741
2025-07-10Auto merge of #143721 - tgross35:rollup-sjdfp6r, r=tgross35bors-394/+1642
Rollup of 9 pull requests Successful merges: - rust-lang/rust#141996 (Fix `proc_macro::Ident`'s handling of `$crate`) - rust-lang/rust#142950 (mbe: Rework diagnostics for metavariable expressions) - rust-lang/rust#143011 (Make lint `ambiguous_glob_imports` deny-by-default and report-in-deps) - rust-lang/rust#143265 (Mention as_chunks in the docs for chunks) - rust-lang/rust#143270 (tests/codegen/enum/enum-match.rs: accept negative range attribute) - rust-lang/rust#143298 (`tests/ui`: A New Order [23/N]) - rust-lang/rust#143396 (Move NaN tests to floats/mod.rs) - rust-lang/rust#143398 (tidy: add support for `--extra-checks=auto:` feature) - rust-lang/rust#143644 (Add triagebot stdarch mention ping) r? `@ghost` `@rustbot` modify labels: rollup
2025-07-10Add regression test for #143107Guillaume Gomez-0/+41
2025-07-10Propagate from borrowed locals in CopyPropTomasz Miąsko-122/+91
2025-07-10Rollup merge of #143298 - Kivooeo:tf23, r=tgross35Trevor Gross-121/+161
`tests/ui`: A New Order [23/N] > [!NOTE] > > Intermediate commits are intended to help review, but will be squashed prior to merge. Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895. r? ``@tgross35``
2025-07-10Rollup merge of #143270 - TimNN:fix-enum-match, r=nikicTrevor Gross-1/+1
tests/codegen/enum/enum-match.rs: accept negative range attribute The test current fails when `rustc` is built with HEAD LLVM: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/38097/steps/canvas?sid=0197c492-5661-4c42-8ae7-3d789e85c6ca I suspect the change was caused by https://github.com/llvm/llvm-project/commit/545cdca4883552b147a0f1adfac713f76fc22305 ``@rustbot`` label llvm-main
2025-07-10Rollup merge of #143011 - LorrensP-2158466:warn-ambiguity-into-error, ↵Trevor Gross-115/+508
r=petrochenkov Make lint `ambiguous_glob_imports` deny-by-default and report-in-deps This pr aims to finish the second part of rust-lang/rust#114095. It converts the `ambiguous_glob_imports` lint from a warning to an error. Currently, only the lint definition and the related tests are changed, a crater run should provide us with information on whether we should go for this.
2025-07-10Rollup merge of #142950 - tgross35:metavariable-expr-rework, r=petrochenkovTrevor Gross-110/+115
mbe: Rework diagnostics for metavariable expressions Make the diagnostics for metavariable expressions more user-friendly. This mostly addresses syntactic errors; I will be following up with improvements to `concat(..)`.
2025-07-10Rollup merge of #141996 - Daniel-Aaron-Bloom:dollar_crate, r=petrochenkovTrevor Gross-47/+857
Fix `proc_macro::Ident`'s handling of `$crate` This PR is addresses a few minor bugs, all relating to `proc_macro::Ident`'s support for `$crate`. `Ident` currently supports `$crate` (as can be seen in the `mixed-site-span` test), but: * `proc_macro::Symbol::can_be_raw` is out of sync with `rustc_span::Symbol::can_be_raw` * former doesn't cover `$crate` while the latter does cover `kw::DollarCrate` * `Ident::new` rejects `$crate` * This conflicts with the [reference definition](https://doc.rust-lang.org/nightly/reference/macros-by-example.html#r-macro.decl.meta.specifier) of `ident` which includes `$crate`. * This also conflicts with the documentation on [`Display for Ident`](https://doc.rust-lang.org/proc_macro/struct.Ident.html#impl-Display-for-Ident) which says the output "should be losslessly convertible back into the same identifier". This PR fixes the above issues and extends the `mixed-site-span` test to exercise these fixed code paths, as well as validating the different possible spans resolve `$crate` as expected (for both the new and old `$crate` construction code paths).
2025-07-10Auto merge of #143696 - oli-obk:constable-type-id2, r=RalfJungbors-51/+131
Add opaque TypeId handles for CTFE Reopen of https://github.com/rust-lang/rust/pull/142789#issuecomment-3053155043 after some bors insta-merge chaos r? `@RalfJung`
2025-07-10Use `is_windows_msvc` instead of `is_msvc` in run-make testsJieyou Xu-53/+57
2025-07-09Make UB transmutes really UB in LLVMScott McMurray-9/+13
Ralf suggested in <https://github.com/rust-lang/rust/pull/143410#discussion_r2184928123> that UB transmutes shouldn't be trapping, which happened for the one path that PR was changing, but there's another path as well, so this PR changes that other path to match.
2025-07-10Remove uncessary parens in closure body with unused lintyukang-16/+136
2025-07-09mbe: Refactor the diagnostic for unrecognized metavariable expressionsTrevor Gross-3/+5
Change to a structural diagnostic, update the valid list, and move the valid list to a note.
2025-07-09mbe: Refactor diagnostics for invalid metavar expression syntaxTrevor Gross-107/+110
Give a more user-friendly diagnostic about the following: * Trailing tokens within braces, e.g. `${foo() extra}` * Missing parentheses, e.g. `${foo}` * Incorrect number of arguments, with a hint about correct usage.
2025-07-10Add rustdoc JSON tests for `#[doc(hidden)]` handling of items.Predrag Gruevski-0/+36