about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2024-09-25Auto merge of #130807 - tgross35:rollup-p304vzf, r=tgross35bors-294/+418
Rollup of 7 pull requests Successful merges: - #130234 (improve compile errors for invalid ptr-to-ptr casts with trait objects) - #130752 (Improve assembly test for CMSE ABIs) - #130764 (Separate collection of crate-local inherent impls from error tracking) - #130788 (Pin memchr to 2.5.0 in the library rather than rustc_ast) - #130789 (add InProgress ErrorKind gated behind io_error_inprogress feature) - #130793 (Mention `COMPILETEST_VERBOSE_CRASHES` on crash test failure) - #130798 (rustdoc: inherit parent's stability where applicable) Failed merges: - #130735 (Simple validation for unsize coercion in MIR validation) r? `@ghost` `@rustbot` modify labels: rollup
2024-09-24Rollup merge of #130798 - lukas-code:doc-stab, r=notriddleTrevor Gross-7/+42
rustdoc: inherit parent's stability where applicable It is currently not possible for a re-export to have a different stability (https://github.com/rust-lang/rust/issues/30827). Therefore the standard library uses a hack when moving items like `std::error::Error` or `std::net::IpAddr` into `core` by marking the containing module (`core::error` / `core::net`) as unstable or stable in a later version than the items the module contains. Previously, rustdoc would always show the *stability as declared* for an item rather than the *stability as publicly reachable* (i.e. the features required to actually access the item), which could be confusing when viewing the docs. This PR changes it so that we show the stability of the first unstable parent or the most recently stabilized parent instead, to hopefully make things less confusing. fixes https://github.com/rust-lang/rust/issues/130765 screenshots: ![error in std](https://github.com/user-attachments/assets/2ab9bdb9-ed81-4e45-a832-ac7d3ba1be3f) ![error in core](https://github.com/user-attachments/assets/46f46182-5642-4ac5-b92e-0b99a8e2496d)
2024-09-24Rollup merge of #130764 - compiler-errors:inherent, r=estebankTrevor Gross-65/+66
Separate collection of crate-local inherent impls from error tracking #119895 changed the return type of the `crate_inherent_impls` query from `CrateInherentImpls` to `Result<CrateInherentImpls, ErrorGuaranteed>` to avoid needing to use the non-parallel-friendly `track_errors()` to track if an error was reporting from within the query... This was mostly fine until #121113, which stopped halting compilation when we hit an `Err(ErrorGuaranteed)` in the `crate_inherent_impls` query. Thus we proceed onwards to typeck, and since a return type of `Result<CrateInherentImpls, ErrorGuaranteed>` means that the query can *either* return one of "the list inherent impls" or "error has been reported", later on when we want to assemble method or associated item candidates for inherent impls, we were just treating any `Err(ErrorGuaranteed)` return value as if Rust had no inherent impls defined anywhere at all! This leads to basically every inherent method call failing with an error, lol, which was reported in #127798. This PR changes the `crate_inherent_impls` query to return `(CrateInherentImpls, Result<(), ErrorGuaranteed>)`, i.e. returning the inherent impls collected *and* whether an error was reported in the query itself. It firewalls the latter part of that query into a new `crate_inherent_impls_validity_check` just for the `ensure()` call. This fixes #127798.
2024-09-24Rollup merge of #130752 - tdittr:cmse-assembly-tests, r=jieyouxuTrevor Gross-5/+81
Improve assembly test for CMSE ABIs Tracking issues: #75835 #81391 This ensures the code-gen for these ABIs does not change silently. There is a small chance that this code-gen might change, however even GCC (https://godbolt.org/z/16arxab5x and https://godbolt.org/z/16arxab5x) generates almost the same assembly for these ABIs. I hope the notes in the comments should help fix the tests if it ever breaks.
2024-09-24Auto merge of #130739 - jieyouxu:stage0_run_make, r=Kobzolbors-97/+58
Fix cargo staging for run-make tests Follow-up to https://github.com/rust-lang/rust/pull/130642#issuecomment-2366891866 to make sure that when ``` $ COMPILETEST_FORCE_STAGE0=1 ./x test run-make --stage 0 ``` is used, bootstrap cargo is used in order to avoid building stage 1 rustc. Note that run-make tests are usually not written with `--stage 0` in mind and some tests may rely on stage1 rustc (nightly) behavior, and it is expected that some tests will fail under this invocation. This PR also fixes `tool::Cargo` staging in compiletest when preparing for `run-make` test mode, by chopping off a stage from the `compiler` passed to `tool::Cargo` such that when the user invokes with stage `N` ``` ./x test run-make --stage N ``` the `run-make` test suite will be tested against the cargo built by stage `N` compiler. Let's take `N=1`, i.e. `--stage 1`, without chopping off a stage, previously `./x test run-make --stage 1` will cause stage 1 rustc + std to be built, then stage 2 rustc, and cargo will be produced by the stage 2 rustc, which is clearly not what we want. By chopping off a stage, it means that cargo will be produced by the stage 1 rustc. cc #119946, #59864. See discussions regarding the tool staging at https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/.E2.9C.94.20stage1.20run-make.20tests.20now.20need.20stage2.20rustc.20built.20for.20c.2E.2E.2E.
2024-09-24improve errors for invalid pointer castsLukas Markeffsky-44/+29
2024-09-24be even more precise about "cast" vs "coercion"Lukas Markeffsky-131/+129
2024-09-24replace "cast" with "coercion" where applicableLukas Markeffsky-15/+15
This changes the remaining span for the cast, because the new `Cast` category has a higher priority (lower `Ord`) than the old `Coercion` category, so we no longer report the region error for the "unsizing" coercion from `*const Trait` to itself.
2024-09-24use more accurate spans for user type ascriptionsLukas Markeffsky-26/+24
2024-09-24add another testLukas Markeffsky-1/+14
2024-09-24unify dyn* coercions with other pointer coercionsLukas Markeffsky-4/+22
2024-09-24rustdoc: inherit parent's stability where applicableLukas Markeffsky-7/+42
2024-09-24Auto merge of #130775 - jieyouxu:revert-129047, r=nagisabors-247/+18
Revert "Apply EarlyOtherwiseBranch to scalar value #129047" This reverts PR #129047, commit a772336fb3fbd1fe4493077fcfe04e0221296a99, reversing changes made to 702987f75b74f789ba227ee04a3d7bb1680c2309. cc `@DianQK` and `@cjgillot` as the PR author and reviewer of #129047 respectively. It seems [Apply EarlyOtherwiseBranch to scalar value #129047](https://github.com/rust-lang/rust/pull/129047) may have lead to several nightly regressions: - https://github.com/rust-lang/rust/issues/130769 - https://github.com/rust-lang/rust/issues/130774 - https://github.com/rust-lang/rust/issues/130771 Example test that would ICE with changes in #129047 (this test is included in this PR): ```rs //@ compile-flags: -C opt-level=3 //@ check-pass use std::task::Poll; pub fn poll(val: Poll<Result<Option<Vec<u8>>, u8>>) { match val { Poll::Ready(Ok(Some(_trailers))) => {} Poll::Ready(Err(_err)) => {} Poll::Ready(Ok(None)) => {} Poll::Pending => {} } } ``` Since this is a mir-opt ICE that seems to quite easy to trigger with real-world crates being affected, let's revert for now and reland the mir-opt after these are fixed.
2024-09-24Separate collection of crate-local inherent impls from error reportingMichael Goulet-65/+66
2024-09-24Update `run-make` tests to use `cargo` wrapper cmd许杰友 Jieyou Xu (Joe)-97/+58
2024-09-24Add regression test for #130769许杰友 Jieyou Xu (Joe)-0/+18
2024-09-24Revert "Auto merge of #129047 - DianQK:early_otherwise_branch_scalar, ↵许杰友 Jieyou Xu (Joe)-247/+0
r=cjgillot" This reverts commit a772336fb3fbd1fe4493077fcfe04e0221296a99, reversing changes made to 702987f75b74f789ba227ee04a3d7bb1680c2309. It seems Apply EarlyOtherwiseBranch to scalar value #129047 may have lead to several nightly regressions: - https://github.com/rust-lang/rust/issues/130769 - https://github.com/rust-lang/rust/issues/130774 - https://github.com/rust-lang/rust/issues/130771 And since this is a mir-opt ICE that seems to quite easy to trigger with real-world crates being affected, let's revert for now and reland the mir-opt later.
2024-09-24Auto merge of #130768 - compiler-errors:rollup-8ncjy55, r=compiler-errorsbors-195/+211
Rollup of 7 pull requests Successful merges: - #129545 (rustdoc: redesign toolbar and disclosure widgets) - #130618 (Skip query in get_parent_item when possible.) - #130727 (Check vtable projections for validity in miri) - #130750 (Add new Tier-3 target: `loongarch64-unknown-linux-ohos`) - #130758 (Revert "Add recursion limit to FFI safety lint") - #130759 (Update books) - #130762 (stabilize const_intrinsic_copy) r? `@ghost` `@rustbot` modify labels: rollup
2024-09-23Rollup merge of #130762 - RalfJung:const_intrinsic_copy, r=dtolnayMichael Goulet-8/+5
stabilize const_intrinsic_copy Fixes https://github.com/rust-lang/rust/issues/80697 This stabilizes ```rust mod ptr { pub const unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize); pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize); } impl *const T { pub const unsafe fn copy_to(self, dest: *mut T, count: usize); pub const unsafe fn copy_to_nonoverlapping(self, dest: *mut T, count: usize); } impl *mut T { pub const unsafe fn copy_to(self, dest: *mut T, count: usize); pub const unsafe fn copy_to_nonoverlapping(self, dest: *mut T, count: usize); pub const unsafe fn copy_from(self, src: *const T, count: usize); pub const unsafe fn copy_from_nonoverlapping(self, src: *const T, count: usize); } impl <T> NonNull<T> { pub const unsafe fn copy_to(self, dest: NonNull<T>, count: usize); pub const unsafe fn copy_to_nonoverlapping(self, dest: NonNull<T>, count: usize); pub const unsafe fn copy_from(self, src: NonNull<T>, count: usize); pub const unsafe fn copy_from_nonoverlapping(self, src: NonNull<T>, count: usize); } ``` In particular, this reverts https://github.com/rust-lang/rust/pull/117905, which reverted https://github.com/rust-lang/rust/pull/97276. The `NonNull` methods are not listed in the tracking issue, they were added to this feature gate in https://github.com/rust-lang/rust/pull/124498. The existing [FCP](https://github.com/rust-lang/rust/issues/80697#issuecomment-1022585839) does not cover them. They are however entirely identical to the `*mut` methods and already stable outside `const`. ``@rust-lang/libs-api`` please let me know if FCP will be required for the `NonNull` methods.
2024-09-23Rollup merge of #130758 - compiler-errors:ctype-recursion-limit, r=jieyouxuMichael Goulet-31/+47
Revert "Add recursion limit to FFI safety lint" It's not necessarily clear if warning when we hit the recursion limit is the right thing to do, first of all. **More importantly**, this PR was implemented incorrectly in the first place; it was not decrementing the recursion limit when stepping out of a type, so it would trigger when a ctype has more than RECURSION_LIMIT fields *anywhere* in the type's set of recursively reachable fields. Reverts #130598 Reopens #130310 Fixes #130757
2024-09-23Rollup merge of #130750 - heiher:loong-linux-ohos-tier3, r=jieyouxuMichael Goulet-0/+3
Add new Tier-3 target: `loongarch64-unknown-linux-ohos` MCP: https://github.com/rust-lang/compiler-team/issues/784
2024-09-23Rollup merge of #129545 - notriddle:notriddle/toolbar-v2, r=GuillaumeGomezMichael Goulet-156/+156
rustdoc: redesign toolbar and disclosure widgets Fixes #77899 Fixes #90310 ## Preview | before | after | ------ | ----- | ![image](https://github.com/user-attachments/assets/ebeec185-3a72-481d-921e-a9a885f348d9) | ![image](https://github.com/user-attachments/assets/08735a65-99d1-4523-ab77-ddb164c0a5db) | ![image](https://github.com/user-attachments/assets/ae8e0f24-49cb-445d-b9bd-cec9c57b94e7) | ![image](https://github.com/user-attachments/assets/ba484f94-b031-41fc-b8a8-6cd81be8fb6b) | ![image](https://github.com/user-attachments/assets/8c2cc041-a138-4950-a12e-3d529c8a5339) | ![image](https://github.com/user-attachments/assets/e7f010bd-19e2-4711-85bf-3fd00c3e5647) | ![image](https://github.com/user-attachments/assets/e2b63785-971c-489e-b069-eb85f6a30620) | ![image](https://github.com/user-attachments/assets/b65eea16-d6a3-4aa3-8a27-6ded74009010) | ![image](https://github.com/user-attachments/assets/1c7b0901-a61a-4325-9d01-9d8b14b476aa) | ![image](https://github.com/user-attachments/assets/d4a485db-d9f1-4a62-94bc-a3d125ea6dc1) | N/A | ![image](https://github.com/user-attachments/assets/7add0a2a-7fd7-483d-87ee-51ee45a2fe5d) | ![image](https://github.com/user-attachments/assets/334f50bc-9f8d-42d9-a7df-95058f7cdfd5) | ![image](https://github.com/user-attachments/assets/451fcc22-b034-453c-ae4b-b948fd6bd779) | ![image](https://github.com/user-attachments/assets/132f720c-802a-466d-bd55-c7a4750acdc3) | ![image](https://github.com/user-attachments/assets/177b7921-06c5-467d-87d3-9cdf88c4e50b) https://notriddle.com/rustdoc-html-demo-12/toolbar-v2/std/index.html ## Description This adds labels to the icons and moves them away from the search box. These changes are made together, because they work together, but are based on several complaints: * The [+/-] thing are a Reddit-ism. They don't look like buttons, but look like syntax <https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/More.20visual.20difference.20for.20the.20.2B.2F-.20.20Icons>, <https://github.com/rust-lang/rust/issues/59851> (some of these are laundry lists with more suggestions, but they all mention [+/-] looking wrong) * The settings, help, and summary buttons are also too hard to recognize <https://lwn.net/Articles/987070/>, <https://github.com/rust-lang/rust/issues/90310>, <https://github.com/rust-lang/rust/issues/14475#issuecomment-274241997>, <https://internals.rust-lang.org/t/improve-rustdoc-design/12758> ("Not all functionality is self-explanatory, for example the [+] button in the top right corner, the theme picker or the settings button.") The toggle-all and toggle-individual buttons both need done at once, since we want them to look like they go together. This changes them from both being [+/-] to both being arrows. CC <https://github.com/rust-lang/rust/pull/113074#issuecomment-1677469680> and ``@jsha`` regarding the use of triangles for disclosure, which is what everyone wanted, but was pending a good toggle-all button. This PR adds a toggle-all button that should work. Settings and Help are also migrated, so that the whole group can benefit from being described using actual words. The breadcrumbs also get redesigned, so that they use less space, by shrinking the parent module path parts. This is done at the same time as the toolbar redesign because it's, effectively, moving space from the toolbar to the breadcrumbs. This is aimed at avoiding any line wrapping at desktop sizes. ## Prior art This style of toolbar, with explicit labels on the buttons, used to be more popular. It's not very common in web browsers nowadays, and for truly universal icons like :arrow_left: I can understand why, but words are great when icons fail. ![image](https://github.com/user-attachments/assets/9a4a0498-232d-4d60-87b9-f601f4515254)
2024-09-24Auto merge of #127117 - Urgau:non_local_def-syntactic, r=BoxyUwUbors-640/+145
Rework `non_local_definitions` lint to only use a syntactic heuristic This PR reworks the `non_local_definitions` lint to only use a syntactic heuristic, i.e. not use a type-system logic for whenever an `impl` is local or not. Instead the new logic wanted by T-lang in https://github.com/rust-lang/rust/issues/126768#issuecomment-2192634762, which is to consider every paths in `Self` and `Trait` and to no longer use the type-system inference trick. `@rustbot` labels +L-non_local_definitions Fixes #126768
2024-09-23stabilize const_intrinsic_copyRalf Jung-8/+5
2024-09-23Auto merge of #125645 - RalfJung:unclear_local_imports, r=nnethercotebors-0/+71
add unqualified_local_imports lint This lint helps deal with https://github.com/rust-lang/rustfmt/issues/4709 by having the compiler detect imports of local items that are not syntactically distinguishable from imports from other cates. Making them syntactically distinguishable ensures rustfmt can consistently apply the desired import grouping.
2024-09-23Improve assembly test for CMSE ABIsTamme Dittrich-5/+81
This ensures the code-gen for these ABIs does not change silently. Co-authored-by: Folkert <folkert@folkertdev.nl>
2024-09-23Add a testMichael Goulet-0/+32
2024-09-23Revert "Add recursion limit to FFI safety lint"Michael Goulet-31/+15
This reverts commit 716044751b7a36c634be709e37923e3dbdf53888.
2024-09-23Tweak breadcrumbs listMichael Howell-23/+23
2024-09-23Add new Tier-3 target: `loongarch64-unknown-linux-ohos`Xiaotian Wu-0/+3
MCP: https://github.com/rust-lang/compiler-team/issues/784 Co-authored-by: WANG Rui <wangrui@loongson.cn>
2024-09-23Rollup merge of #130721 - GrigorenkoPV:block-no-opening-brace, r=jieyouxuJubilee-12/+48
Add more test cases for block-no-opening-brace Also add FIXME's for #80931 & #78168
2024-09-23Rollup merge of #130657 - arttet:fix/fuchsia, r=jieyouxuJubilee-6/+0
Remove x86_64-fuchsia and aarch64-fuchsia target aliases Closes #106649.
2024-09-23Rollup merge of #130551 - nnethercote:fix-break-last-token, r=petrochenkovJubilee-0/+16
Fix `break_last_token`. It currently doesn't handle the three-char tokens `>>=` and `<<=` correctly. These can be broken twice, resulting in three individual tokens. This is a latent bug that currently doesn't cause any problems, but does cause problems for #124141, because that PR increases the usage of lazy token streams. r? `@petrochenkov`
2024-09-23add unqualified_local_imports lintRalf Jung-0/+71
2024-09-23Update rustdoc doctest non_local_defs impl testUrgau-11/+13
2024-09-23Remove with/without trait and bounds considerationUrgau-40/+7
2024-09-23Point to every relevant types in the main diagUrgau-57/+59
2024-09-23Rework `non_local_definitions` lint to only be a syntactic heuristicUrgau-404/+12
2024-09-23Revert "Switch back `non_local_definitions` lint to allow-by-default"Urgau-168/+94
This reverts commit 0c0dfb88eeefbbaa4c10cfa4a7f0e16541e086eb.
2024-09-23Auto merge of #129047 - DianQK:early_otherwise_branch_scalar, r=cjgillotbors-0/+247
Apply `EarlyOtherwiseBranch` to scalar value In the future, I'm thinking of hoisting discriminant via GVN so that we only need to write very little code here. r? `@cjgillot`
2024-09-23Rollup merge of #130726 - workingjubilee:put-the-spurs-to-this-test, r=BoxyUwUMatthias Krüger-22/+0
tests: Remove spuriously failing vec-tryinto-array codegen test This has failed more than a couple of times now. It costs real time, money, and energy to deal with this, far more than this test is saving us.
2024-09-23Rollup merge of #130714 - compiler-errors:try-structurally-resolve-const, ↵Matthias Krüger-2/+2
r=BoxyUwU Introduce `structurally_normalize_const`, use it in `rustc_hir_typeck` Introduces `structurally_normalize_const` to typecking to separate the "eval a const" step from the "try to turn a valtree into a target usize" in HIR typeck, where we may still have infer vars and stuff around. I also changed `check_expr_repeat` to move a double evaluation of a const into a single one. I'll leave inline comments. r? ```@BoxyUwU``` I hesitated to really test this on the new solver where it probably matters for unevaluated consts. If you're worried about the side-effects, I'd be happy to craft some more tests 😄
2024-09-23Rollup merge of #130712 - compiler-errors:const-eval-error-reporting, r=BoxyUwUMatthias Krüger-158/+158
Don't call `ty::Const::normalize` in error reporting We do this to ensure that trait refs with unevaluated consts have those consts simplified to their evaluated forms. Instead, use `try_normalize_erasing_regions`. **NOTE:** This has the side-effect of erasing regions from all of our trait refs. If this is too much to review or you think it's too opinionated of a diagnostics change, then I could split out the effective change (i.e. erasing regions from this impl suggestion) into another PR and have someone else review it.
2024-09-23Rollup merge of #130705 - compiler-errors:rtn-complete, r=jackh726Matthias Krüger-429/+76
No longer mark RTN as incomplete The RFC is accepted and the feature is basically fully implemented. This doesn't mean it's necesarily *ready* for stabiliation; there's probably some diagnostic improvements to be made, and as always, users uncover the most creative bugs. But marking this feature as incomplete no longer serves any purpose, so let's fix that.
2024-09-23Rollup merge of #130344 - Jaic1:fix-116306, r=BoxyUwUMatthias Krüger-0/+24
Handle unsized consts with type `str` in v0 symbol mangling This PR fixes #116303 by handling consts with type `str` in v0 symbol mangling as partial support for unsized consts. This PR is related to `#![feature(adt_const_params)]` (#95174) and `#![feature(unsized_const_params)]` (#128028). r? ``@BoxyUwU``
2024-09-23Rollup merge of #129550 - kornelski:boxasstr, r=joshtriplett,dtolnayMatthias Krüger-48/+0
Add str.as_str() for easy Deref to string slices Working with `Box<str>` is cumbersome, because in places like `iter.filter()` it can end up being `&Box<str>` or even `&&Box<str>`, and such type doesn't always get auto-dereferenced as expected. Dereferencing such box to `&str` requires ugly syntax like `&**boxed_str` or `&***boxed_str`, with the exact amount of `*`s. `Box<str>` is [not easily comparable with other string types](https://github.com/rust-lang/rust/pull/129852) via `PartialEq`. `Box<str>` won't work for lookups in types like `HashSet<String>`, because `Borrow<String>` won't take types like `&Box<str>`. OTOH `set.contains(s.as_str())` works nicely regardless of levels of indirection. `String` has a simple solution for this: the `as_str()` method, and `Box<str>` should too.
2024-09-22Fix hard-coded stderr in run-make testMichael Goulet-6/+6
2024-09-22Bless rustdoc-js-std testMichael Goulet-5/+5
2024-09-22tests: Remove spuriously failing vec-tryinto-array codegen testJubilee Young-22/+0
2024-09-23Fix `break_last_token`.Nicholas Nethercote-0/+16
It currently doesn't handle the three-char tokens `>>=` and `<<=` correctly. These can be broken twice, resulting in three individual tokens. This is a latent bug that currently doesn't cause any problems, but does cause problems for #124141, because that PR increases the usage of lazy token streams.