about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2025-01-23Remove query normalize from normalize type opMichael Goulet-20/+20
2025-01-23Auto merge of #135461 - jieyouxu:migrate-jobserver-errors, r=Noratriebbors-18/+48
tests: Port `jobserver-error` to rmake.rs Part of #121876. This PR ports `tests/run-make/jobserver-error` to rmake.rs, and is basically #128789 slightly adjusted. The complexity involved here is mostly how to get `/dev/null/` piping to fd 3 working with std `Command`, whereas with a shell this is much easier (as is evident with the `Makefile` version). Supersedes #128789. This PR is co-authored with `@Oneirical` and `@coolreader18.` try-job: aarch64-gnu try-job: i686-gnu-1 try-job: x86_64-gnu-debug try-job: x86_64-gnu-llvm-18-1
2025-01-23Auto merge of #135164 - Kobzol:run-make-test-glibc-symbols, r=jieyouxubors-0/+112
Add test for checking used glibc symbols This test checks that we do not use too new glibc symbols in the compiler on x64 GNU Linux, in order not to break our [glibc promises](https://blog.rust-lang.org/2022/08/01/Increasing-glibc-kernel-requirements.html). One thing that isn't solved in the PR yet is to make sure that this test will only run on `dist` CI, more specifically on the `dist-x86_64-linux` runner, in the opt-dist post-optimization tests (it can fail elsewhere, that doesn't matter). Any suggestions on how to do that are welcome. Fixes: https://github.com/rust-lang/rust/issues/134037 r? `@jieyouxu`
2025-01-22Auto merge of #135896 - matthiaskrgr:rollup-g6rv7za, r=matthiaskrgrbors-41/+372
Rollup of 9 pull requests Successful merges: - #132983 (Edit dangling pointers ) - #135409 (Fix ICE-133117: multiple never-pattern arm doesn't have false_edge_start_block) - #135557 (Point at invalid utf-8 span on user's source code) - #135596 (Properly note when query stack is being cut off) - #135794 (Detect missing fields with default values and suggest `..`) - #135814 (ci: use ghcr buildkit image) - #135826 (Misc. `rustc_resolve` cleanups) - #135837 (Remove test panic from File::open) - #135856 (Library: Finalize dyn compatibility renaming) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-22Rollup merge of #135794 - estebank:non-exhaustive-dfv-ctor, r=jieyouxuMatthias Krüger-0/+167
Detect missing fields with default values and suggest `..` When a struct ctor use has missing fields, if all those missing fields have defaults, suggest `..`: ``` error[E0063]: missing fields `field1` and `field2` in initializer of `S` --> $DIR/non-exhaustive-ctor.rs:16:13 | LL | let _ = S { field: () }; | ^ missing `field1` and `field2` | help: all remaining fields have default values, you can use those values with `..` | LL | let _ = S { field: (), .. }; | ++++ ```
2025-01-22Rollup merge of #135596 - compiler-errors:stack, r=oli-obkMatthias Krüger-4/+4
Properly note when query stack is being cut off cc #70953 also, i'm not certain whether we should even limit this at all. i don't see the problem with printing the full query stack, apparently it was limited b/c we used to ICE? but we're already printing the full stack to disk since #108714. r? oli-obk
2025-01-22Rollup merge of #135557 - estebank:wtf8, r=fee1-deadMatthias Krüger-10/+15
Point at invalid utf-8 span on user's source code ``` error: couldn't read `$DIR/not-utf8-bin-file.rs`: stream did not contain valid UTF-8 --> $DIR/not-utf8-2.rs:6:5 | LL | include!("not-utf8-bin-file.rs"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: byte `193` is not valid utf-8 --> $DIR/not-utf8-bin-file.rs:2:14 | LL | let _ = "�|�␂!5�cc␕␂��"; | ^ = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) ``` When we attempt to load a Rust source code file, if there is a OS file failure we try reading the file as bytes. If that succeeds we try to turn it into UTF-8. If *that* fails, we provide additional context about *where* the file has the first invalid UTF-8 character. Fix #76869.
2025-01-22Rollup merge of #135409 - ↵Matthias Krüger-27/+106
Shunpoco:issue-133117-ICE-never-false-edge-start-block, r=Nadrieril Fix ICE-133117: multiple never-pattern arm doesn't have false_edge_start_block Fixes #133117 , and close fixes #133063 , fixes #130779 In order to fix ICE-133117, at first I needed to tackle to ICE-133063 (this fixed 130779 as well). ### ICE-133063 and ICE-130779 This ICE is caused by those steps: 1. An arm has or-pattern, and all of the sub-candidates are never-pattern 2. In that case, all sub-candidates are removed in remove_never_subcandidates(). So the arm (candidate) has no sub-candidate. 3. In the current implementation, if there is no sub-candidate, the function assigns `pre_binding_block` into the candidate ([here](https://github.com/rust-lang/rust/blob/master/compiler/rustc_mir_build/src/builder/matches/mod.rs#L2002-L2004)). However, otherwise_block should be assigned to the candidate as well, because the otherwise_block is unwrapped in multiple place (like in lower_match_tree()). As a result, it causes the panic. I simply added the same block as pre_binding_block into otherwise_block, but I'm wondering if there is a better block to assign to otherwise_block (is it ok to assign the same block into pre_binding and otherwise?) ### ICE-133117 This is caused by those steps: 1. There are two arms, both are or-pattern and each has one match-pair (in the test code, both are `(!|!)`), and the second arm has a guard. 2. In match_candidate() for the first arm, it expands the second arm’s sub-candidates as well ([here](https://github.com/rust-lang/rust/blob/master/compiler/rustc_mir_build/src/builder/matches/mod.rs#L1800-L1805)). As a result, the root candidate of the second arm is not evaluated/modified in match_candidate(). So a false_edge_start_block is not assigned to the candidate. 3. merge_trivial_subcandidates() is called against the candidate for the second arm. It just returns immediately because the candidate has a guard. So a flase_edge_start_block is not assigned to the candidate also in this function. 4. remove_never_subcandidates() is called against the candidate. Since all sub-candidates are never-pattern. they are removed. 5. In lower_match_tree(), since there is no sub-candidate for the candidate, the candidate itself is evaluated in visit_leave_rev ([here](https://github.com/rust-lang/rust/blob/master/compiler/rustc_mir_build/src/builder/matches/mod.rs#L1532)). Because the candidate has no false_edge_start_block, it causes the panic. So I modified the order of if blocks in merge_trivial_subcandidates() to assign a false_edge_start_block if the candidate doesn't have.
2025-01-22Rollup merge of #132983 - Anthony-Eid:dangling-pointers-lint, r=UrgauMatthias Krüger-0/+80
Edit dangling pointers Closes: #132283
2025-01-22rustdoc-json: Rename `Path::name` to `path`, and give it path (again).Alona Enraght-Moony-15/+110
Closes https://github.com/rust-lang/rust/issues/135600 Effectivly reverts https://github.com/rust-lang/rust/pull/134880
2025-01-22Don't ICE in coerce when autoderef fails to structurally normalize non-WF ↵Michael Goulet-0/+56
type in new solver
2025-01-22Rollup merge of #135866 - BoxyUwU:dont_pick_fnptr_nested_goals, r=lcnrMatthias Krüger-66/+367
Don't pick `T: FnPtr` nested goals as the leaf goal in diagnostics for new solver r? `@lcnr` See `tests/ui/traits/next-solver/diagnostics/dont-pick-fnptr-bound-as-leaf.rs` for a minimized example of what code this affects the diagnostics off. The output of running nightly `-Znext-solver` on that test is the following: ``` error[E0277]: the trait bound `Foo: Trait` is not satisfied --> src/lib.rs:14:20 | 14 | requires_trait(Foo); | -------------- ^^^ the trait `FnPtr` is not implemented for `Foo` | | | required by a bound introduced by this call | note: required for `Foo` to implement `Trait` --> src/lib.rs:7:16 | 7 | impl<T: FnPtr> Trait for T {} | ----- ^^^^^ ^ | | | unsatisfied trait bound introduced here note: required by a bound in `requires_trait` --> src/lib.rs:11:22 | 11 | fn requires_trait<T: Trait>(_: T) {} | ^^^^^ required by this bound in `requires_trait` ``` Part of rust-lang/trait-system-refactor-initiative#148
2025-01-22Rollup merge of #135858 - fmease:rustdoc-mv-obj-save-dyn-compat-ii, ↵Matthias Krüger-1/+1
r=GuillaumeGomez rustdoc: Finalize dyn compatibility renaming Update the Reference link to use the new URL fragment from https://github.com/rust-lang/reference/pull/1666 (this change has finally hit stable). Fixes a FIXME. Follow-up to #131594. Part of #130852.
2025-01-22Rollup merge of #135823 - ferrocene:ja-gh135819, r=jieyouxuMatthias Krüger-2/+6
make UI tests that use `--test` work on panic=abort targets By passing `-Zpanic_abort_test`. fixes #135819
2025-01-22Rollup merge of #135816 - BoxyUwU:root_normalizes_to_goal_ice, r=lcnrMatthias Krüger-24/+191
Use `structurally_normalize` instead of manual `normalizes-to` goals in alias relate errors r? `@lcnr` I added `structurally_normalize_term` so that code that is generic over ty or const can use the structurally normalize helpers. See `tests/ui/traits/next-solver/diagnostics/alias_relate_error_uses_structurally_normalize.rs` for a description of the reason for the (now fixed) ICEs
2025-01-22Rollup merge of #133372 - cramertj:rework-dyn-suggestions, r=fmeaseMatthias Krüger-1005/+1213
Refactor dyn-compatibility error and suggestions This CL makes a number of small changes to dyn compatibility errors: - "object safety" has been renamed to "dyn-compatibility" throughout - "Convert to enum" suggestions are no longer generated when there exists a type-generic impl of the trait or an impl for `dyn OtherTrait` - Several error messages are reorganized for user readability Additionally, the dyn compatibility error creation code has been split out into functions. cc #132713 cc #133267 r? `@compiler-errors`
2025-01-22Refactor dyn-compatibility error and suggestionsTaylor Cramer-1005/+1213
This CL makes a number of small changes to dyn compatibility errors: - "object safety" has been renamed to "dyn-compatibility" throughout - "Convert to enum" suggestions are no longer generated when there exists a type-generic impl of the trait or an impl for `dyn OtherTrait` - Several error messages are reorganized for user readability Additionally, the dyn compatibility error creation code has been split out into functions. cc #132713 cc #133267
2025-01-22[AIX] Lint on structs that have a different alignment in AIX's C ABIAmy Kwan-11/+276
2025-01-22Reword comment slightlyJakub Beránek-1/+3
2025-01-22Auto merge of #134478 - compiler-errors:attr-span, r=oli-obkbors-11/+50
Properly record metavar spans for other expansions other than TT This properly records metavar spans for nonterminals other than tokentree. This means that we operations like `span.to(other_span)` work correctly for macros. As you can see, other diagnostics involving metavars have improved as a result. Fixes #132908 Alternative to #133270 cc `@ehuss` cc `@petrochenkov`
2025-01-22Use objdump instead of llvm-objdumpJakub Beránek-2/+4
2025-01-22Run the glibc run-make test in opt-distJakub Beránek-1/+1
2025-01-22Also check for associated fns on primitives in E0223 similar-path check.Zachary S-13/+57
2025-01-22Add test that multiple impls works with E0223 similar-name suggestion.Zachary S-7/+59
2025-01-22Use `structurally_normalize` instead of manual `normalizes-to` goalsBoxy-24/+191
2025-01-22Don't pick `T: FnPtr` nested goalsBoxy-66/+367
2025-01-22Update lint tests with new dangling pointers messageAnthony Eid-0/+80
2025-01-22tests: port `jobserver-error.rs` to rmake.rs许杰友 Jieyou Xu (Joe)-18/+48
Co-authored-by: Noa <coolreader18@gmail.com> Co-authored-by: Oneirical <manchot@videotron.ca>
2025-01-22Auto merge of #135674 - scottmcm:assume-better, r=estebankbors-55/+75
Update our range `assume`s to the format that LLVM prefers I found out in https://github.com/llvm/llvm-project/issues/123278#issuecomment-2597440158 that the way I started emitting the `assume`s in #109993 was suboptimal, and as seen in that LLVM issue the way we're doing it -- with two `assume`s sometimes -- can at times lead to CVP/SCCP not realize what's happening because one of them turns into a `ne` instead of conveying a range. So this updates how it's emitted from ``` assume( x >= LOW ); assume( x <= HIGH ); ``` or ``` // (for ranges that wrap the range) assume( (x <= LOW) | (x >= HIGH) ); ``` to ``` assume( (x - LOW) <= (HIGH - LOW) ); ``` so that we don't need multiple `icmp`s nor multiple `assume`s for a single value, and both wrappping and non-wrapping ranges emit the same shape. (And we don't bother emitting the subtraction if `LOW` is zero, since that's trivial for us to check too.)
2025-01-22rustdoc: Finalize dyn compatibility renamingLeón Orell Valerian Liehr-1/+1
2025-01-22address review: modify ICE-133063-never-arm-no-otherwise-block.rsShunpoco-43/+12
- Use enum Void to avoid mismatched types error - We don't need to use if let to check the ICE Signed-off-by: Shunpoco <tkngsnsk313320@gmail.com>
2025-01-22address review: modify ICE-133117-duplicated-never-arm.rsShunpoco-29/+15
Use enum Void to avoid mistmatched types error Signed-off-by: Shunpoco <tkngsnsk313320@gmail.com>
2025-01-22Point at invalid utf-8 span on user's source codeEsteban Küber-10/+15
``` error: couldn't read `$DIR/not-utf8-bin-file.rs`: stream did not contain valid UTF-8 --> $DIR/not-utf8-2.rs:6:5 | LL | include!("not-utf8-bin-file.rs"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: `[193]` is not valid utf-8 --> $DIR/not-utf8-bin-file.rs:2:14 | LL | let _ = "�|�␂!5�cc␕␂��"; | ^ = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) ``` When we attempt to load a Rust source code file, if there is a OS file failure we try reading the file as bytes. If that succeeds we try to turn it into UTF-8. If *that* fails, we provide additional context about *where* the file has the first invalid UTF-8 character. Fix #76869.
2025-01-21remove long-deprecated no-op attributes no_start and crate_idRalf Jung-184/+161
2025-01-21Rollup merge of #135833 - lqd:add-ice-test, r=compiler-errorsMatthias Krüger-0/+30
Add fixme and test for issue #135289 This PR: - adds a test minimizing issue #135289 for PR #135310 - adds a fixme about the suboptimal fix for the ICE I've verified the test indeed ICEs with 3f2f695d68334ca4ecc8aec0aa38b5391051c987 reverted. r? `@estebank`
2025-01-21Rollup merge of #135824 - jieyouxu:delete-bintools-check, r=NoratriebMatthias Krüger-50/+0
tests: delete `cat-and-grep-sanity-check` Part of #121876. All remaining `Makefile`s have open PRs that do not rely on platform `cat` or `grep` or the `cat-and-grep` script.
2025-01-21Detect missing fields with default values and suggest `..`Esteban Küber-0/+167
When a struct definition has default field values, and the use struct ctor has missing field, if all those missing fields have defaults suggest `..`: ``` error[E0063]: missing fields `field1` and `field2` in initializer of `S` --> $DIR/non-exhaustive-ctor.rs:16:13 | LL | let _ = S { field: () }; | ^ missing `field1` and `field2` | help: all remaining fields have defaults, use `..` | LL | let _ = S { field: (), .. }; | ++++ ```
2025-01-21Auto merge of #134299 - RalfJung:remove-start, r=compiler-errorsbors-488/+241
remove support for the (unstable) #[start] attribute As explained by `@Noratrieb:` `#[start]` should be deleted. It's nothing but an accidentally leaked implementation detail that's a not very useful mix between "portable" entrypoint logic and bad abstraction. I think the way the stable user-facing entrypoint should work (and works today on stable) is pretty simple: - `std`-using cross-platform programs should use `fn main()`. the compiler, together with `std`, will then ensure that code ends up at `main` (by having a platform-specific entrypoint that gets directed through `lang_start` in `std` to `main` - but that's just an implementation detail) - `no_std` platform-specific programs should use `#![no_main]` and define their own platform-specific entrypoint symbol with `#[no_mangle]`, like `main`, `_start`, `WinMain` or `my_embedded_platform_wants_to_start_here`. most of them only support a single platform anyways, and need cfg for the different platform's ways of passing arguments or other things *anyways* `#[start]` is in a super weird position of being neither of those two. It tries to pretend that it's cross-platform, but its signature is a total lie. Those arguments are just stubbed out to zero on ~~Windows~~ wasm, for example. It also only handles the platform-specific entrypoints for a few platforms that are supported by `std`, like Windows or Unix-likes. `my_embedded_platform_wants_to_start_here` can't use it, and neither could a libc-less Linux program. So we have an attribute that only works in some cases anyways, that has a signature that's a total lie (and a signature that, as I might want to add, has changed recently, and that I definitely would not be comfortable giving *any* stability guarantees on), and where there's a pretty easy way to get things working without it in the first place. Note that this feature has **not** been RFCed in the first place. *This comment was posted [in May](https://github.com/rust-lang/rust/issues/29633#issuecomment-2088596042) and so far nobody spoke up in that issue with a usecase that would require keeping the attribute.* Closes https://github.com/rust-lang/rust/issues/29633 try-job: x86_64-gnu-nopt try-job: x86_64-msvc-1 try-job: x86_64-msvc-2 try-job: test-various
2025-01-21make UI tests that use `--test` work on panic=abort targetsJorge Aparicio-2/+6
by adding `-Zpanic_abort_test`, which is a no-op on panic=unwind targets fixes #135819
2025-01-21add test for issue 135289Rémy Rakic-0/+30
2025-01-21add tests differing between stable and new rules (with errors on new rules)dianne-18/+155
Since there are so many ways to write these, I've opted to only include two sorts of test: simple tests that directly target the rules differing between rulesets and nuanced tests that produce different errors under different rulesets. I've also tried not to add any duplicate tests. `well-typed-edition-2024.rs` already has tests disagreeing with stable, so I've opted not to include any in this commit that are well-typed under the new rules.
2025-01-21organize old well-typed-edition-2024 testsdianne-85/+100
This doesn't (or at least shouldn't!) add, remove, or change any test cases. I've grouped them by which rule variants they test.
2025-01-21remove support for the #[start] attributeRalf Jung-488/+241
2025-01-21tests: delete `cat-and-grep-sanity-check`许杰友 Jieyou Xu (Joe)-50/+0
All remaining `Makefile`s have open PRs that do not rely on platform `cat` or `grep`.
2025-01-21add a stable edition 2021 revision to pattern typing testsdianne-198/+1103
This serves two purposes. First, they're additional tests that stable Rust behavior hasn't been messed with. There's plenty of other pattern tests, so this is less important, but these at least are targeted at what's being changed. Second, this helps document exactly where the new rulesets agree and disagree with stable pattern typing. This will be especially important after the new rules for old editions are updated, since they need to be strictly more permissive; any patterns well-typed on stable should also be well-typed with the same resultant bindings on the (upcoming) new new old-edition rules. The unusual test ordering on `borrowck-errors.rs` and `ref-binding-on-inh-ref-errors.rs` are to hopefully reduce how much adding new tests will mess with line numbers in their stderr.
2025-01-21add more information to old testsdianne-28/+36
2025-01-21minor test cleanupdianne-59/+26
- Removes some excess parens - Removes 3 duplicated tests
2025-01-21Auto merge of #133830 - compiler-errors:span-key, r=lcnrbors-351/+362
Rework dyn trait lowering to stop being so intertwined with trait alias expansion This PR reworks the trait object lowering code to stop handling trait aliases so funky, and removes the `TraitAliasExpander` in favor of a much simpler design. This refactoring is important for making the code that I'm writing in https://github.com/rust-lang/rust/pull/133397 understandable and easy to maintain, so the diagnostics regressions are IMO inevitable. In the old trait object lowering code, we used to be a bit sloppy with the lists of traits in their unexpanded and expanded forms. This PR largely rewrites this logic to expand the trait aliases *once* and handle them more responsibly throughout afterwards. Please review this with whitespace disabled. r? lcnr
2025-01-21Add test for checking used glibc symbolsJakub Beránek-0/+108
2025-01-21Add more testsOli Scherer-0/+49