about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2025-01-03Merge from rustcThe Miri Cronjob Bot-161/+693
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-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>
2025-01-16Implement `use` associated items of traitsFrank King-30/+340
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
2024-12-28Rollup merge of #134829 - jieyouxu:migrate-libs-through-symlinks, r=lqdStuart Cook-22/+48
Migrate `libs-through-symlink` to rmake.rs Part of https://github.com/rust-lang/rust/issues/121876. This PR migrates `tests/run-make/libs-through-symlink/` to use rmake.rs. - Regression test for #13890. - Original fix PR is #13903. - Document test intent, backlink to #13890 and fix PR #13903. - Fix the test logic: the `Makefile` version seems to not actually be exercising the "library search traverses symlink" logic, because the actual symlinked-to-library is present under the `$(TMPDIR)` directory tree when `bar.rs` is compiled, because the `$(RUSTC)` invocation has an implicit `-L $(TMPDIR)`. The symlink itself was actually broken, i.e. it should've been `ln -nsf $(TMPDIR)/outdir/$(NAME) $(TMPDIR)` but it used `ln -nsf outdir/$(NAME) $(TMPDIR)`. The rmake.rs version now explicitly separates the two directory trees and sets the CWD of the `bar.rs` rustc invocation so that the actual library is *not* present under its CWD tree. I.e. it is now ``` $test_output/ # rustc foo.rs -o actual_lib_dir/libfoo.rlib actual_lib_dir/ libfoo.rlib symlink_lib_dir/ # CWD set; rustc -L . bar.rs libfoo.rlib --> $test_output/actual_lib_dir/libfoo.rlib ``` Partially supersedes #129011. This PR is co-authored with `@Oneirical.` r? compiler
2024-12-28Rollup merge of #134760 - jieyouxu:enable-branch-protection-check-IBT, r=lqdStuart Cook-53/+58
Migrate `branch-protection-check-IBT` to rmake.rs - The Makefile version *never* ran because of Makefile syntax confusion because `ifeq ($(filter x86,$(LLVM_COMPONENTS)),x86_64)` [compares `x86` to `x86_64`, which always evaluates to false](https://github.com/rust-lang/rust/pull/126720#discussion_r1646808973). - The test would've always failed because precompiled std is not built with `-Z cf-protection=branch`, but linkers require all input object files to indicate IBT support in order to enable IBT for the executable, which is not the case for std. - Thus, the test input file is instead changed to a `no_std` program. - The test is currently limited to only `x86_64-unknown-linux-gnu` host, there are various other problems when the test is cross-compiled that I didn't want to fix atm, and is left as an exercise for the `-Z cf-protection` implementers. The GNU property note was added by #110304 in order to address #103001. Partially supersedes #129156. The rmake.rs port was initially authored by `@Rejyr` in #126720. This PR is co-authored with `@Oneirical` and `@Rejyr.` r? `@bjorn3` or reroll try-job: x86_64-mingw-1 try-job: x86_64-mingw-2 try-job: x86_64-msvc try-job: x86_64-apple-1 try-job: x86_64-apple-2
2024-12-28Rollup merge of #134737 - estebank:deive-lint-default-fields-base, ↵Stuart Cook-0/+338
r=compiler-errors Implement `default_overrides_default_fields` lint Detect when a manual `Default` implementation isn't using the existing default field values and suggest using `..` instead: ``` error: `Default` impl doesn't use the declared default field values --> $DIR/manual-default-impl-could-be-derived.rs:14:1 | LL | / impl Default for A { LL | | fn default() -> Self { LL | | A { LL | | y: 0, | | - this field has a default value ... | LL | | } | |_^ | = help: use the default values in the `impl` with `Struct { mandatory_field, .. }` to avoid them diverging over time note: the lint level is defined here --> $DIR/manual-default-impl-could-be-derived.rs:5:9 | LL | #![deny(default_overrides_default_fields)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` r? `@compiler-errors` This is a simpler version of #134441, detecting the simpler case when a field with a default should have not been specified in the manual `Default::default()`, instead using `..` for it. It doesn't provide any suggestions, nor the checks for "equivalences" nor whether the value used in the imp being used would be suitable as a default field value.
2024-12-28Auto merge of #134842 - jieyouxu:disable-flaky-test, r=ibraheemdevbors-0/+4
Disable `backtrace-debuginfo.rs` on windows-gnu This test appears still flaky cf. #117097 on `i686-mingw` as observed in https://github.com/rust-lang/rust/pull/131244#issuecomment-2564086577. r? compiler (or anyone, really)
2024-12-28tests: migrate `branch-protection-check-IBT` to rmake.rs许杰友 Jieyou Xu (Joe)-53/+58
- The Makefile version *never* ran because of Makefile syntax confusion. - The test would've always failed because precompiled std is not built with `-Z cf-protection=branch`, but linkers require all input object files to indicate IBT support in order to enable IBT for the executable, which is not the case for std. - Thus, the test input file is instead changed to a `no_std` + `no_core` program. Co-authored-by: Jerry Wang <jerrylwang123@gmail.com> Co-authored-by: Oneirical <manchot@videotron.ca>