about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2025-02-08Auto merge of #136728 - matthiaskrgr:rollup-x2qh9yt, r=matthiaskrgrbors-15/+45
Rollup of 6 pull requests Successful merges: - #136640 (Debuginfo for function ZSTs should have alignment of 8 bits, not 1 bit) - #136648 (Add a missing `//@ needs-symlink` to `tests/run-make/libs-through-symlinks`) - #136651 (Label mismatched parameters at the def site for foreign functions) - #136691 (Remove Linkage::Private and Linkage::Appending) - #136692 (add module level doc for bootstrap:utils:exec) - #136700 (i686-unknown-hurd-gnu: bump baseline CPU to Pentium 4) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-08Rollup merge of #136691 - bjorn3:linkage_cleanup, r=jieyouxuMatthias Krüger-3/+0
Remove Linkage::Private and Linkage::Appending Neither of them has any use case. Neither known nor theoretical.
2025-02-08Rollup merge of #136651 - Jarcho:fn_ctxt3, r=compiler-errorsMatthias Krüger-9/+39
Label mismatched parameters at the def site for foreign functions Nice and simple. Adds parameter marking for the only missing definition type. r? ``@compiler-errors``
2025-02-08Rollup merge of #136648 - jieyouxu:missing-needs-symlink, r=wesleywiserMatthias Krüger-0/+1
Add a missing `//@ needs-symlink` to `tests/run-make/libs-through-symlinks` r? ``@wesleywiser`` (since you [found it](https://rust-lang.zulipchat.com/#narrow/channel/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202025-02-06/near/498173394) :P or reroll)
2025-02-08Rollup merge of #136640 - Zalathar:debuginfo-align-bits, r=compiler-errorsMatthias Krüger-3/+5
Debuginfo for function ZSTs should have alignment of 8 bits, not 1 bit In #116096, function ZSTs were made to have debuginfo that gives them an alignment of “1”. But because alignment in LLVM debuginfo is denoted in *bits*, not bytes, this resulted in an alignment specification of 1 bit instead of 1 byte. I don't know whether this has any practical consequences, but I noticed that a test started failing when I accidentally fixed the mistake while working on #136632, so I extracted the fix (and the test adjustment) to this PR.
2025-02-08Auto merge of #136713 - matthiaskrgr:rollup-sy6py39, r=matthiaskrgrbors-1/+249
Rollup of 7 pull requests Successful merges: - #135179 (Make sure to use `Receiver` trait when extracting object method candidate) - #136554 (Add `opt_alias_variances` and use it in outlives code) - #136556 ([AIX] Update tests/ui/wait-forked-but-failed-child.rs to accomodate exiting and idle processes.) - #136589 (Enable "jump to def" feature on rustc docs) - #136615 (sys: net: Add UEFI stubs) - #136635 (Remove outdated `base_port` calculation in std net test) - #136682 (Move two windows process tests to tests/ui) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-07Rollup merge of #136682 - ChrisDenton:move-win-proc-tests, r=joboetMatthias Krüger-0/+169
Move two windows process tests to tests/ui Spawning processes from std unit tests is not something it's well suited for so moving them into tests/ui is more robust and means we don't need to hack around `cmd.exe`. Follow up to #136630
2025-02-07Rollup merge of #136556 - ↵Matthias Krüger-1/+10
amy-kwan:amy-kwan/update_wait-forked-but-failed-child.rs, r=joboet [AIX] Update tests/ui/wait-forked-but-failed-child.rs to accomodate exiting and idle processes. The `wait-forked-but-failed-child.rs` test expects to see an integer PPID in the output of the command: `ps -A -o pid,ppid,args`. However, on AIX, sometimes an integer PPID is not available when a process is either exiting or idle, as documented in https://www.ibm.com/docs/en/aix/7.3?topic=p-ps-command. In these situations, a `-` is instead shown in the PPID column of the `ps` output. This PR updates the test to accommodate this behaviour on AIX by first filtering out the lines of the `ps` output where a `-` is found in the `PPID` column.
2025-02-07Rollup merge of #136554 - compiler-errors:opt-alias-variances, r=lcnrMatthias Krüger-0/+37
Add `opt_alias_variances` and use it in outlives code ...so to fix some subtle outlives bugs with precise capturing in traits, and eventually make it easier to compute variances for "forced unconstrained" trait lifetimes. r? lcnr
2025-02-07Rollup merge of #135179 - compiler-errors:arbitrary-self-types-object, r=BoxyUwUMatthias Krüger-0/+33
Make sure to use `Receiver` trait when extracting object method candidate In method confirmation, the `extract_existential_trait_ref` function re-extracts the object type by derefing until it reaches an object. If we're assembling methods via the `Receiver` trait, make sure we re-do our work also using the receiver trait. Fixes #135155 cc ``@adetaylor``
2025-02-07Rollup merge of #136598 - compiler-errors:unit-fallback, r=WaffleLapkinMatthias Krüger-8/+46
Fix suggestion for `dependency_on_unit_never_type_fallback` involving closures + format args expansions fixes #136562 r? wafflelapkin or reassign
2025-02-07Rollup merge of #136577 - dianne:simple-pat-migration-simplification, ↵Matthias Krüger-171/+813
r=Nadrieril Pattern Migration 2024: try to suggest eliding redundant binding modifiers This is based on #136475. Only the last commit is new. This is a simpler, more restrictive alternative to #136496, meant to partially address #136047. If a pattern can be migrated to Rust 2024 solely by removing redundant binding modifiers, this will make that suggestion; otherwise, it uses the old suggestion of making the pattern fully explicit. Relevant tracking issue: #131414 ``@rustbot`` label A-diagnostics A-patterns A-edition-2024 r? ``@Nadrieril``
2025-02-07Rollup merge of #135945 - estebank:useless-parens, r=compiler-errorsMatthias Krüger-87/+84
Remove some unnecessary parens in `assert!` conditions While working on #122661, some of these started triggering our "unnecessary parens" lints due to a change in the `assert!` desugaring. A cursory search identified a few more. Some of these have been carried from before 1.0, were a bulk rename from the previous name of `assert!` left them in that state. I went and removed as many of these unnecessary parens as possible in order to have fewer annoyances in the future if we make the lint smarter.
2025-02-07Rollup merge of #134367 - WaffleLapkin:trait_upcasting_as_a_treat, ↵Matthias Krüger-337/+119
r=compiler-errors Stabilize `feature(trait_upcasting)` This feature was "done" for a while now, I think it's finally time to stabilize it! Stabilization report: https://github.com/rust-lang/rust/pull/134367#issuecomment-2545839841. cc reference PR: https://github.com/rust-lang/reference/pull/1622. Closes #65991 (tracking issue), closes #89460 (the lint is no longer future incompat). r? compiler-errors
2025-02-07Remove Linkage::Privatebjorn3-3/+0
This is the same as Linkage::Internal except that it doesn't emit any symbol. Some backends may not support it and it isn't all that useful anyway.
2025-02-07Rollup merge of #135973 - WaffleLapkin:tail-track-caller-fix, r=compiler-errorsMatthias Krüger-11/+64
fix tail call checks wrt `#[track_caller]` Only check the caller + disallow caller having the attribute. fixes #134336 r? `@compiler-errors` <sub>apparently there were no tests for `#[track_caller]` before... ooops</sub>
2025-02-07Move two windows process tests to tests/uiChris Denton-0/+169
2025-02-07Auto merge of #136450 - compiler-errors:simplify-cast, r=saethlinbors-0/+283
Don't reset cast kind without also updating the operand in `simplify_cast` in GVN Consider this heavily elided segment of the pre-GVN example code that was committed as a test: ```rust let _4: *const (); let _5: *const [()]; let mut _6: *const (); let _7: *mut (); let mut _8: *const [()]; let mut _9: std::boxed::Box<()>; let mut _10: *const (); /* ... */ // Deref a box _10 = copy ((_9.0: std::ptr::Unique<()>).0: std::ptr::NonNull<()>) as *const () (Transmute); _4 = copy _10; _6 = copy _4; // Inlined body of `slice::from_raw_parts`, to turn a unit pointer into a slice-of-unit pointer _5 = *const [()] from (copy _6, copy _11); _8 = copy _5; // Cast the raw slice-of-unit pointer back to a unit pointer _7 = copy _8 as *mut () (PtrToPtr); ``` A malformed optimization was changing `_7` (which casted the slice-of-unit ptr to a unit ptr) to: ``` _7 = copy _5 as *mut () (Transmute); ``` ...where `_8` was just replaced with `_5` bc of simple copy propagation, that part is not important... the CastKind changing to Transmute is the important part here. In #133324, two new functionalities were implemented: * Peeking through unsized -> sized PtrToPtr casts whose operand is `AggregateKind::RawPtr`, to turn it into PtrToPtr casts of the base of the aggregate. In this case, this allows us to see that the value of `_7` is just a ptr-to-ptr cast of `_6`. * Folding a PtrToPtr cast of an operand which is a Transmute cast into just a single Transmute, which (theoretically) allows us to treat `_7` as a transmute into `*mut ()` of the base of the cast of `_10`, which is the place projection of `((_9.0: std::ptr::Unique<()>).0: std::ptr::NonNull<()>)`. However, when applying those two subsequent optimizations, we must *not* update the CastKind of the final cast *unless* we also update the operand of the cast, since the operand may no longer make sense with the updated CastKind. In this case, this is problematic because the type of `_8` is `*const [()]`, but that operand in assignment statement of `_7` does *not* get turned into something like `((_9.0: std::ptr::Unique<()>).0: std::ptr::NonNull<()>)` -- **in other words, `try_to_operand` fails** -- because GVN only turns value nodes into locals or consts, not projections of locals. So we fail to update the operand, but we still update the CastKind to Transmute, which means we now are transmuting types of different sizes (a wide pointer and a thin pointer). r? `@scottmcm` or `@cjgillot` Fixes #136361 Fixes #135997
2025-02-06allow+update `deref_into_dyn_supertrait`Waffle Lapkin-62/+52
this commit makes `deref_into_dyn_supertrait` lint allow-by-default, removes future incompatibility (we finally live in a broken world), and changes the wording in the documentation. previously documentation erroneously said that it lints against *usage* of the deref impl, while it actually (since 104742) lints on the impl itself (oooops, my oversight, should have updated it 2+ years ago...)
2025-02-06remove `feature(trait_upcasting)` from tests and bless themWaffle Lapkin-275/+67
2025-02-06Remove some unnecessary parens in `assert!` conditionsEsteban Küber-87/+84
While working on #122661, some of these started triggering our "unnecessary parens" lints due to a change in the `assert!` desugaring. A cursory search identified a few more. Some of these have been carried from before 1.0, were a bulk rename from the previous name of `assert!` left them in that state. I went and removed as many of these unnecessary parens as possible in order to have fewer annoyances in the future if we make the lint smarter.
2025-02-06Label mismatched parameters at the def site for foreign functions.Jason Newcomb-9/+39
2025-02-06Rollup merge of #133925 - folkertdev:improve-repr-warnings, r=compiler-errorsMatthias Krüger-25/+67
disallow `repr()` on invalid items fixes https://github.com/rust-lang/rust/issues/129606 fixes https://github.com/rust-lang/rust/issues/132391 Disallows `repr()` (so a repr with no arguments) on items where that won't ever make sense. Also this generates an error when `repr` is used on a trait method and the `fn_align` feature is not enabled. Looks like that was missed here: https://github.com/rust-lang/rust/pull/110313/files Which first accepts the align attribute on trait methods. r? `@compiler-errors` cc `@jdonszelmann` who claimed https://github.com/rust-lang/rust/issues/132391 and generally has been working on attributes
2025-02-06fix tail call checks wrt `#[track_caller]`Waffle Lapkin-11/+64
only check the caller + disallow caller having the attr.
2025-02-06Use split_whitespace() when filtering lines in the ps outputAmy Kwan-1/+1
2025-02-06Don't reset cast kind without also updating the operand in simplify_castMichael Goulet-4/+4
2025-02-06Failing testMichael Goulet-0/+283
2025-02-07tests: add a missing `needs-symlink`许杰友 Jieyou Xu (Joe)-0/+1
2025-02-06Add opt_alias_variances and use it in outlives codeMichael Goulet-0/+37
2025-02-06Rollup merge of #136393 - oli-obk:pattern-type-lit-oflo-checks, ↵Matthias Krüger-0/+58
r=compiler-errors Fix accidentally not emitting overflowing literals lints anymore in patterns This was regressed in https://github.com/rust-lang/rust/pull/134228 (not in beta yet). The issue was that previously we nested `hir::Expr` inside `hir::PatKind::Lit`, so it was linted by the expression code. So now I've set it up for visitors to be able to directly visit literals and get all literals
2025-02-06Rollup merge of #136315 - estebank:long-ty-binop, r=SparrowLiiMatthias Krüger-0/+41
Use short ty string for binop and unop errors ``` error[E0369]: cannot add `(..., ..., ..., ...)` to `(..., ..., ..., ...)` --> $DIR/binop.rs:10:7 | LL | x + x; | - ^ - (..., ..., ..., ...) | | | (..., ..., ..., ...) | = note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' = note: consider using `--verbose` to print the full type name to the console ``` ``` error[E0600]: cannot apply unary operator `!` to type `(..., ..., ..., ...)` --> $DIR/binop.rs:14:5 | LL | !x; | ^^ cannot apply unary operator `!` | = note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' = note: consider using `--verbose` to print the full type name to the console ``` CC #135919.
2025-02-06Rollup merge of #136311 - compiler-errors:vtable-fixes-2, r=lcnrMatthias Krüger-0/+26
Ensure that we never try to monomorphize the upcasting or vtable calls of impossible dyn types Check for impossible obligations in the `dyn Trait` type we're trying to compute its the vtable upcasting and method call slots. r? lcnr
2025-02-06Rollup merge of #136235 - oli-obk:transmuty-pat-tys, r=RalfJungMatthias Krüger-2/+2
Pretty print pattern type values with transmute if they don't satisfy their pattern Instead of printing `0_u32 is 1..`, we now print the default fallback rendering that we also use for invalid bools, chars, ...: `{transmute(0x00000000): (u32) is 1..=}`. These cases can occur in mir dumps when const prop propagates a constant across a safety check that would prevent the actually UB value from existing. That's fine though, as it's dead code and we always need to allow UB in dead code. follow-up to https://github.com/rust-lang/rust/pull/136176 cc ``@compiler-errors`` ``@scottmcm`` r? ``@RalfJung`` because of the interpreter changes
2025-02-06Rollup merge of #136073 - compiler-errors:recursive-coro-always, r=oli-obkMatthias Krüger-14/+26
Always compute coroutine layout for eagerly emitting recursive layout errors Detect recursive coroutine layouts even if we don't detect opaque type recursion in the new solver. This is for two reasons: 1. It helps us detect (bad) recursive async function calls in the new solver, which due to its approach to normalization causes us to not detect this via a recursive RPIT (since the opaques are more eagerly revealed in the opaque body). * Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/137. 2. It helps us detect (bad) recursive async functions behind AFITs. See the AFIT test that changed for the old solver too. 3. It also greatly simplifies the recursive impl trait check, since I can remove some jankness around how it handles coroutines.
2025-02-06Debuginfo for function ZSTs should have alignment of 8 bits, not 1 bitZalathar-3/+5
2025-02-05Rollup merge of #136583 - Jarcho:fn_ctxt2, r=compiler-errorsJubilee-151/+91
Only highlight unmatchable parameters at the definition site Followup to #136497 This generally results more focused messages in the same vein as #99635 (see `test/ui/argument-suggestions/complex.rs`). There are still some cases (e.g. `test/ui/argument-suggestions/permuted_arguments.rs`) where it might be worth highlighting the arguments. This is mitigated by the fact that a suggestion with a suggested rearrangement is given. r? `@compiler-errors`
2025-02-05Rollup merge of #136550 - compiler-errors:rpitit-empty-body, r=oli-obkJubilee-0/+23
Fix `rustc_hidden_type_of_opaques` for RPITITs with no default body Needed this when debugging something
2025-02-05Rollup merge of #136269 - compiler-errors:spanned, r=lcnrJubilee-4/+12
Pass spans around new solver ...so that when we instantiate canonical responses, we can actually have region obligations with the right span. Within the solver itself, we still use dummy spans everywhere.
2025-02-05Rollup merge of #133932 - bjorn3:fix_ptx_kernel_abi, r=wesleywiserJubilee-17/+1
Avoid using make_direct_deprecated() in extern "ptx-kernel" This method will be removed in the future as it produces a broken ABI that depends on cg_llvm implementation details. After this PR wasm32-unknown-unknown is the only remaining user of make_direct_deprecated(). Fixes https://github.com/rust-lang/rust/issues/117271 Blocks https://github.com/rust-lang/rust/issues/38788
2025-02-05add more pattern migration testsdianne-1/+400
Most of these are meant to test possible future improvements, but since they cover cases the existing test suite didn't, I figure including them now may be helpful.
2025-02-05Walk into nested bodies when suggesting unit for unit fallbackMichael Goulet-0/+4
2025-02-05Only suggest unit for unit fallback when spans dont come from macro expansionMichael Goulet-8/+42
2025-02-05Eagerly detect coroutine recursion pre-mono when possibleMichael Goulet-14/+26
2025-02-05Pass spans around new solverMichael Goulet-4/+12
2025-02-05try to suggest eliding redundant binding modifiersdianne-10/+13
2025-02-05reword default binding mode notesdianne-82/+82
2025-02-05When displaying a parameter mismatch error, only highlight the mismatched ↵Jason Newcomb-151/+91
parameters when showing the definition.
2025-02-05Pretty print pattern type values with `transmute` if they don't satisfy ↵Oli Scherer-2/+2
their pattern
2025-02-05Uniformly handle HIR literals in visitors and lintsOli Scherer-1/+10
2025-02-05Add regression testOli Scherer-0/+49