about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2025-01-03Auto merge of #135059 - matthiaskrgr:rollup-0ka9o3h, r=matthiaskrgrbors-73/+170
Rollup of 4 pull requests Successful merges: - #131729 (Make the `test` cfg a userspace check-cfg) - #134241 (more concrete source url of std docs [V2]) - #135042 (taint fcx on selection errors during unsizing) - #135049 (Remove unused fields from RepeatElementCopy obligation) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-03Rollup merge of #135042 - lukas-code:taint-dyn-incompat, r=compiler-errorsMatthias Krüger-13/+113
taint fcx on selection errors during unsizing With `feature(dyn_compatible_for_dispatch)` we only check for dyn-compatibility by checking the `T: Unsize<dyn Trait>` predicate during the unsizing coercions checks. If the predicate doesn't hold, we emit an error, but pretend the coercion succeeded to prevent further errors. To prevent const eval from attempting to actually perform this coercion, we need to taint the fcx after reporting the trait errors in the coercion check. fixes https://github.com/rust-lang/rust/issues/135021 fixes https://github.com/rust-lang/rust/issues/130521
2025-01-03Rollup merge of #131729 - Urgau:check-cfg-test-userspace, r=petrochenkovMatthias Krüger-60/+57
Make the `test` cfg a userspace check-cfg This PR implements MCP https://github.com/rust-lang/compiler-team/issues/785, which makes the `test` cfg a "userspace" check-cfg, i.e. no longer included in the well known cfg list. Things to do: - [x] Accept the MCP (https://github.com/rust-lang/compiler-team/issues/785#issuecomment-2424121886) - [x] Mark `test` in Cargo (https://github.com/rust-lang/cargo/pull/14963) `@rustbot` labels +S-waiting-on-MCP +F-check_cfg r? `@petrochenkov`
2025-01-03Auto merge of #134692 - GrigorenkoPV:sync_poision, r=tgross35bors-10/+10
Move some things to `std::sync::poison` and reexport them in `std::sync` Tracking issue: #134646 r? `@tgross35` I've used `sync_poison_mod` feature flag instead, because `sync_poison` had already been used back in 1.2. try-job: x86_64-msvc
2025-01-02Auto merge of #122565 - Zoxc:atomic-panic-msg, r=the8472bors-19/+78
Try to write the panic message with a single `write_all` call This writes the panic message to a buffer before writing to stderr. This allows it to be printed with a single `write_all` call, preventing it from being interleaved with other outputs. It also adds newlines before and after the message ensuring that only the panic message will have its own lines. Before: ``` thread 'thread 'thread 'thread 'thread '<unnamed>thread 'thread 'thread 'thread '<unnamed><unnamed>thread '<unnamed>' panicked at ' panicked at <unnamed><unnamed><unnamed><unnamed><unnamed>' panicked at <unnamed>' panicked at src\heap.rssrc\heap.rs' panicked at ' panicked at ' panicked at ' panicked at ' panicked at src\heap.rs' panicked at src\heap.rs::src\heap.rssrc\heap.rssrc\heap.rssrc\heap.rssrc\heap.rs:src\heap.rs:455455:::::455:455::455455455455455:455:99:::::9:9: : 999: 999: assertion failed: size <= (*queue).block_size: : assertion failed: size <= (*queue).block_size: assertion failed: size <= (*queue).block_size: : : assertion failed: size <= (*queue).block_sizeassertion failed: size <= (*queue).block_sizeassertion failed: size <= (*queue).block_size assertion failed: size <= (*queue).block_size assertion failed: size <= (*queue).block_sizeassertion failed: size <= (*queue).block_sizeerror: process didn't exit successfully: `target\debug\direct_test.exe` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN) ``` After: ``` thread '<unnamed>' panicked at src\heap.rs:455:9: assertion failed: size <= (*queue).block_size thread '<unnamed>' panicked at src\heap.rs:455:9: assertion failed: size <= (*queue).block_size thread '<unnamed>' panicked at src\heap.rs:455:9: assertion failed: size <= (*queue).block_size error: process didn't exit successfully: `target\debug\direct_test.exe` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN) ``` --- try-jobs: x86_64-gnu-llvm-18
2025-01-02taint fcx on selection errors during unsizingLukas Markeffsky-13/+113
2025-01-02Make the `test` cfg a "userspace" check-cfgUrgau-60/+57
2025-01-02Move some things to `std::sync::poison` and reexport them in `std::sync`Pavel Grigorenko-10/+10
2025-01-01Rollup merge of #135000 - compiler-errors:opaque-captures-dupe, r=lqdMatthias Krüger-15/+36
Fix ICE when opaque captures a duplicated/invalid lifetime See description on test. Fixes #132766 Fixes #133693 Fixes #134780
2025-01-01Fix ICE when opaque captures a duplicated/invalid lifetimeMichael Goulet-15/+36
2025-01-01Try to write the panic message with a single `write_all` callJohn Kåre Alsaker-19/+78
2025-01-01Rollup merge of #134979 - estebank:default-lint-sugg, r=compiler-errorsStuart Cook-1/+4
Provide structured suggestion for `impl Default` of type where all fields have defaults ``` error: `Default` impl doesn't use the declared default field values --> $DIR/manual-default-impl-could-be-derived.rs:28:1 | LL | / impl Default for B { LL | | fn default() -> Self { LL | | B { LL | | x: s(), | | --- this field has a default value LL | | y: 0, | | - this field has a default value ... | LL | | } | |_^ | help: to avoid divergence in behavior between `Struct { .. }` and `<Struct as Default>::default()`, derive the `Default` | LL ~ #[derive(Default)] struct B { | ``` Note that above the structured suggestion also includes completely removing the manual `impl`, but the rendering doesn't.
2025-01-01Rollup merge of #134945 - compiler-errors:map-mutate-nits, r=estebankStuart Cook-14/+20
Some small nits to the borrowck suggestions for mutating a map through index 1. Suggesting users to either use `.insert` or `.get_mut` (which do totally different things) can be a bit of a footgun, so let's make that a bit more nuanced. 2. I find the suggestion of `.get_mut(|val| { *val = whatever; })` to be a bit awkward. I changed this to be an if-let instead. 3. Fix a bug which was suppressing the structured suggestion for some mutations via the index operator on `HashMap`/`BTreeMap`. r? estebank or reassign
2025-01-01Rollup merge of #134877 - DavisRayM:129966-format-string-help-message, ↵Stuart Cook-0/+85
r=estebank add suggestion for wrongly ordered format parameters Add suggestion for wrongly ordered format parameters like `?#`. Supersedes #131004 Fix #129966
2025-01-01Rollup merge of #133292 - dianne:e0277-suggest-deref, r=estebankStuart Cook-0/+121
E0277: suggest dereferencing function arguments in more cases This unifies and generalizes some of the logic in `TypeErrCtxt::suggest_dereferences` so that it will suggest dereferencing arguments to function/method calls in order to satisfy trait bounds in more cases. Previously it would only fire on reference types, and it had two separate cases (one specifically to get through custom `Deref` impls when passing by-reference, and one specifically to catch #87437). I've based the new checks loosely on what's done for `E0308` in `FnCtxt::suggest_deref_or_ref`: it will suggest dereferences to satisfy trait bounds whenever the referent is `Copy`, is boxed (& so can be moved out of the boxes), or is being passed by reference. This doesn't make the suggestion fire in contexts other than function arguments or binary operators (which are in a separate case that this doesn't touch), and doesn't make it suggest a combination of `&`-removal and dereferences. Those would require a bit more restructuring, so I figured just doing this would be a decent first step. Closes #90997
2024-12-31Rollup merge of #134971 - dxsullivan:fix-typo, r=lqdTrevor Gross-5/+5
chore: fix typos I hope my typo corrections will help you. Thank you for your work.
2024-12-31Rollup merge of #134861 - GuillaumeGomez:item-info-colors, r=fmeaseTrevor Gross-0/+23
Add GUI test for item info elements color Fixes https://github.com/rust-lang/rust/issues/98341. r? ``@fmease``
2024-12-31Rollup merge of #133486 - dianne:fix-move-error-suggestion, r=estebankTrevor Gross-65/+131
borrowck diagnostics: make `add_move_error_suggestions` use the HIR rather than `SourceMap` This PR aims to fix #132806 by rewriting `add_move_error_suggestions`[^1]. Previously, it manually scanned the source text to find a leading `&`, which isn't always going to produce a correct result (see: that issue). Admittedly, the HIR visitor in this PR introduces a lot of boilerplate, but hopefully the logic at its core isn't too complicated (I go over it in the comments). I also tried a simpler version that didn't use a HIR visitor and suggested adding `ref` always, but the `&ref x` suggestions really didn't look good. As a bonus for the added complexity though, it's now able to produce nice `&`-removing suggestions in more cases. I tried to do this such that it avoids edition-dependent checks and its suggestions can be applied together with those from the match ergonomics 2024 migration lint. I haven't added tests for that since the details of match ergonomics 2024 are still being sorted out, but I can try if desired once that's finalized. [^1]: In brief, it fires on patterns where users try to bind by-value in such a way that moves out of a reference to a non-Copy type (including slice references with non-copy elements). The suggestions are to change the binding's mode to be by-reference, either by removing[^2] an enclosing `&`/`&mut` or adding `ref` to the binding. [^2]: Incidentally, I find the terminology of "consider removing the borrow" a bit confusing for a suggestion to remove a `&` pattern in order to make bindings borrow rather than move. I'm not sure what a good, concise way to explain that would be though, and that should go in a separate PR anyway.
2024-12-31Provide structured suggestion for `impl Default` of type where all fields ↵Esteban Küber-1/+4
have defaults ``` error: `Default` impl doesn't use the declared default field values --> $DIR/manual-default-impl-could-be-derived.rs:28:1 | LL | / impl Default for B { LL | | fn default() -> Self { LL | | B { LL | | x: s(), | | --- this field has a default value LL | | y: 0, | | - this field has a default value ... | LL | | } | |_^ | help: to avoid divergence in behavior between `Struct { .. }` and `<Struct as Default>::default()`, derive the `Default` | LL ~ #[derive(Default)] struct B { | ``` Note that above the structured suggestion also includes completely removing the manual `impl`, but the rendering doesn't.
2024-12-31chore: fix typosdxsullivan-5/+5
Signed-off-by: dxsullivan <193140725+dxsullivan@users.noreply.github.com>
2024-12-31Rollup merge of #134956 - compiler-errors:format-args-hidden-chars, r=jieyouxuMatthias Krüger-18/+76
Account for C string literals and `format_args` in `HiddenUnicodeCodepoints` lint This is stacked on #134955, and either that can land first or both of them can land together here. I split this out because this is a bit more involved of an impl. Fixes #94945
2024-12-31Rollup merge of #134918 - ChrisDenton:issue-70093, r=jieyouxuMatthias Krüger-20/+40
Windows: Enable issue 70093 link tests Tracking issue for `-Z link-native-libraries`: #134948 Tracking issue for `-Z link-directives`: #134947 `-Zlink-native-libraries=no` and `-Zlink-directives=no` *should* work on Windows, at least for msvc. The fly in ointment is that `default-linker-libraries` doesn't. On unixy platforms rustc calls another compiler which in turn calls the linker along with the default libraries. On MSVC rustc calls the linker directly therefore it would need to be the one to implement `default-linker-libraries`. Except it doesn't so we workaround that in the test by using `-C link-arg` to talk to the linker.
2024-12-31Rollup merge of #134957 - peicuiping:master, r=lqdJacob Pratt-4/+4
chore: fix some typos
2024-12-31Rollup merge of #134857 - compiler-errors:rustdoc-unsafe-binders, r=camelidJacob Pratt-0/+19
Unsafe binder support in rustdoc Adds rustdoc support for unsafe binder types: `unsafe<'a> Foo<'a>`. Doesn't add json support yet. Tracking: * https://github.com/rust-lang/rust/issues/130516
2024-12-31chore: fix some typospeicuiping-4/+4
Signed-off-by: peicuiping <ezc5@sina.cn>
2024-12-31Account for format_args in HiddenUnicodeCodepoints lintMichael Goulet-4/+23
2024-12-31Account for C string literals in HiddenUnicodeCodepoints lintMichael Goulet-18/+57
2024-12-31Rollup merge of #134933 - compiler-errors:async-fn-future-sized, r=lqdStuart Cook-0/+51
Make sure we check the future type is `Sized` in `AsyncFn*` Fixes #134817
2024-12-31Add comments to -Zlink-* testsChris Denton-0/+11
2024-12-31Fix span for IndexMut method call on HashMap/BTreeMapMichael Goulet-2/+8
2024-12-31Use if-let in structured suggestion instead of Option::mapMichael Goulet-8/+8
2024-12-31Explain how to mutate a HashMap/BTreeMap with more nuanceMichael Goulet-4/+4
2024-12-31Unsafe binder support in rustdocMichael Goulet-0/+19
2024-12-31Make sure we check the future type is Sized in AsyncFn*Michael Goulet-0/+51
2024-12-30Auto merge of #134757 - RalfJung:const_swap, r=scottmcmbors-23/+19
stabilize const_swap libs-api FCP passed in https://github.com/rust-lang/rust/issues/83163. However, I only just realized that this actually involves an intrinsic. The intrinsic could be implemented entirely with existing stable const functionality, but we choose to make it a primitive to be able to detect more UB. So nominating for `@rust-lang/lang` to make sure they are aware; I leave it up to them whether they want to FCP this. While at it I also renamed the intrinsic to make the "nonoverlapping" constraint more clear. Fixes #83163
2024-12-30Windows: Enable issue 70093 link testsChris Denton-11/+20
2024-12-30Rollup merge of #134911 - HigherOrderLogic:master, r=onur-ozkanMatthias Krüger-2/+2
chore: fix typos This PR fixes typos errors in docstring only, so functionality wise, it should stay the same.
2024-12-30Rollup merge of #134871 - clubby789:test-63646, r=compiler-errorsMatthias Krüger-0/+28
Add codegen test for issue 63646 Closes #63646
2024-12-30Auto merge of #134906 - jieyouxu:multi-crate-type, r=lqd,fmeasebors-0/+67
tests: add basic test coverage for stable `--crate-type` flag I experimented locally with making the compiler panic if multiple crate types are passed to a single `--crate-type` flag, and it turns out not only does the compiler successfully bootstrap, only two ui tests failed: ``` failures: [ui] tests/ui/sepcomp/sepcomp-lib.rs [ui] tests/ui/sepcomp/sepcomp-lib-lto.rs test result: FAILED. 4 passed; 2 failed; 18181 ignored; 0 measured; 0 filtered out; finished in 364.55ms ``` These are not specific tests for the `--crate-type` flag, only their auxiliary *happens* to use a `--crate-type` with two crate types: ```rs //@ compile-flags: -C codegen-units=3 --crate-type=rlib,dylib -g ``` I was not able to find a specific test in run-make test suite either. So this PR tries to add some basic test coverage for the stable `--crate-type` flag's interface (including to check that `--crate-type` accepts multiple crate types), since I imagine it might be slightly awkward if we accidentally regressed this. r? compiler
2024-12-30add suggestion for wrongly ordered format parametersDavis Muro-0/+85
2024-12-30tests: add basic test coverage for cli flag `--crate-type`许杰友 Jieyou Xu (Joe)-0/+67
2024-12-30chore: fix typosHoru-2/+2
2024-12-29Added codegen test for elidings bounds check when indexes are manually checkedAlex Gaynor-0/+37
Closes #55147
2024-12-29Auto merge of #134627 - estebank:issue-133252, r=jackh726bors-1/+39
Avoid ICE in borrowck Provide a fallback in `best_blame_constraint` when `find_constraint_paths_between_regions` doesn't have a result. This code is due a rework to avoid the letf-over `unwrap()`, but avoids the ICE caused by the repro. Fix #133252.
2024-12-29Add codegen test for issue 63646clubby789-0/+28
2024-12-28Add GUI test for item info elements colorGuillaume Gomez-0/+23
2024-12-28Added a codegen test for optimization with const arraysAlex Gaynor-0/+15
Closes #107208
2024-12-28Auto merge of #131244 - clubby789:match-branches-unreachable, r=DianQKbors-20/+69
Consider empty-unreachable otherwise branches in MatchBranchSimplification Fixes #131219
2024-12-28Auto merge of #134844 - Zalathar:rollup-1225wh9, r=Zalatharbors-75/+468
Rollup of 5 pull requests Successful merges: - #134737 (Implement `default_overrides_default_fields` lint) - #134760 (Migrate `branch-protection-check-IBT` to rmake.rs) - #134829 (Migrate `libs-through-symlink` to rmake.rs) - #134832 (Update `compiler-builtins` to 0.1.140) - #134840 (compiletest: Only pass the post-colon value to `parse_normalize_rule`) r? `@ghost` `@rustbot` modify labels: rollup
2024-12-28Rollup merge of #134840 - Zalathar:normalize, r=jieyouxuStuart Cook-0/+24
compiletest: Only pass the post-colon value to `parse_normalize_rule` Addresses one of the FIXMEs noted in #134759. I started working on the other FIXME, but it became complex enough that I wanted to split it off from this PR. r? jieyouxu