about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2025-05-09Rollup merge of #140804 - bend-n:signed, r=lcnrStuart Cook-14/+58
add signed ints to unn- transmutes to ensure feature parity i forgot a few cases https://github.com/rust-lang/rust-clippy/pull/14703/#pullrequestreview-2824194994 adds - char -> i32 - i32 -> char - float -> size () - size -> float - i32 -> float ``@rustbot`` label L-unnecessary_transmutes
2025-05-09Rollup merge of #140801 - xizheyin:issue-140747, r=SparrowLiiStuart Cook-0/+34
Use span before macro expansion in lint for-loops-over-falibles Fixes #140747 I think there are going to be a lot of cases where macros are expanded in the compiler resulting in span offsets, and I'd like to know how that's typically handled. Does it have to be handled specially every time?
2025-05-09Auto merge of #140176 - dpaoliello:arm64ecdec, r=wesleywiserbors-1/+51
Fix linking statics on Arm64EC Arm64EC builds recently started to fail due to the linker not finding a symbol: ``` symbols.o : error LNK2001: unresolved external symbol #_ZN3std9panicking11EMPTY_PANIC17hc8d2b903527827f1E (EC Symbol) C:\Code\hello-world\target\arm64ec-pc-windows-msvc\debug\deps\hello_world.exe : fatal error LNK1120: 1 unresolved externals ``` It turns out that `EMPTY_PANIC` is a new static variable that was being exported then imported from the standard library, but when exporting LLVM didn't prepend the name with `#` (as only functions are prefixed with this character), whereas Rust was prefixing with `#` when attempting to import it. The fix is to have Rust not prefix statics with `#` when importing. Adding tests discovered another issue: we need to correctly mark static exported from dylibs with `DATA`, otherwise MSVC's linker assumes they are functions and complains that there is no exit thunk for them. CI found another bug: we only apply `DllImport` to non-local statics that aren't foreign items (i.e., in an `extern` block), that is we want to use `DllImport` for statics coming from other Rust crates. However, `__rust_no_alloc_shim_is_unstable` is a static generated by the Rust compiler if required, but downstream crates consider it a foreign item since it is declared in an `extern "Rust"` block, thus they do not apply `DllImport` to it and so fails to link if it is exported by the previous crate as `DATA`. The fix is to apply `DllImport` to foreign items that are marked with the `rustc_std_internal_symbol` attribute (i.e., we assume they aren't actually foreign and will be in some Rust crate). Fixes #138541 --- try-job: dist-aarch64-msvc try-job: dist-x86_64-msvc try-job: x86_64-msvc-1 try-job: x86_64-msvc-2
2025-05-08Rollup merge of #140800 - GuillaumeGomez:rustdoc-tempdir-removal, r=jieyouxuMatthias Krüger-3/+11
Make `rustdoc-tempdir-removal` run-make tests work on other platforms than linux Follow-up of #140706. r? `@jieyouxu`
2025-05-08Rollup merge of #140716 - Urgau:improve-remap_scope-tests, r=jieyouxuMatthias Krüger-9/+292
Improve `-Zremap-path-scope` tests with dependency This PR greatly improves our coverage of `-Zremap-path-scope` for diagnostic paths and macros with dependencies. r? `@jieyouxu` (since we talked about it) try-job: x86_64-msvc-1
2025-05-08Rollup merge of #140707 - compiler-errors:range-pat-struct-norm, r=lcnrMatthias Krüger-0/+24
Structurally normalize in range pattern checking in HIR typeck Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/200 r? lcnr
2025-05-08Rollup merge of #140684 - compiler-errors:unnecessary-assoc, r=lcnrMatthias Krüger-3/+46
Only include `dyn Trait<Assoc = ...>` associated type bounds for `Self: Sized` associated types if they are provided Since #136458, we began filtering out associated types with `Self: Sized` bounds when constructing the list of associated type bounds to put into our `dyn Trait` types. For example, given: ```rust trait Trait { type Assoc where Self: Sized; } ``` After #136458, even if a user writes `dyn Trait<Assoc = ()>`, the lowered ty would have an empty projection list, and thus be equivalent to `dyn Trait`. However, this has the side effect of no longer constraining any types in the RHS of `Assoc = ...`, not implying any WF implied bounds, and not requiring that they hold when unsizing. After this PR, we include these bounds, but (still) do not require that they are provided. If the are not provided, they are skipped from the projections list. This results in `dyn Trait` types that have differing numbers of projection bounds. This will lead to re-introducing type mismatches e.g. between `dyn Trait` and `dyn Trait<Assoc = ()>`. However, this is expected and doesn't suffer from any of the deduplication unsoundness from before #136458. We may want to begin to ignore thse bounds in the future by bumping `unused_associated_type_bounds` to an FCW. I don't want to tangle that up into the fix that was originally intended in #136458, so I'm doing a "fix-forward" in this PR and deferring thinking about this for the future. Fixes #140645 r? lcnr
2025-05-08add signed integers to unnecessary_lints to ensure feature parity with clippybendn-14/+58
2025-05-08Structurally resolve in check_ref_cast and calc_adjust_modeMichael Goulet-0/+24
2025-05-08Make `rustdoc-tempdir-removal` run-make tests work on other platforms than linuxGuillaume Gomez-3/+11
2025-05-08Use span before macro expansion in lint for-loops-over-faliblesxizheyin-16/+8
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-05-08Add ui test for for-loops-over-faliblesxizheyin-0/+42
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-05-08Rework `-Zremap-path-scope` macro test with dependency checkUrgau-9/+103
2025-05-08Add tests for `-Zremap-path-scope` and paths in diagnostics with depsUrgau-0/+189
2025-05-08Rollup merge of #140756 - dpaoliello:paclink, r=jieyouxuMatthias Krüger-1/+1
[arm64] Pointer auth test should link with C static library statically While trying to get the aarch64-msvc build working correctly (#140136), the `pointer-auth-link-with-c` test was failing. The pointer auth test builds its C library statically: https://github.com/rust-lang/rust/blob/3ef8e64ce9f72ee8d600d55bc43b36eed069b252/tests/run-make/pointer-auth-link-with-c/rmake.rs#L15 However, the Rust code did not indicate the link kind, so it defaulted to dynamic which then fails on Windows.
2025-05-08Rollup merge of #140755 - dpaoliello:arm64windebuginfo, r=jieyouxuMatthias Krüger-0/+10
[win][arm64] Disable various DebugInfo tests that don't work on Arm64 Windows While trying to get the aarch64-msvc build working correctly (#140136), various DebugInfo related tests were failing. I've added comments to each test to indicate why it is disabled and linked to appropriate bugs. * `tests/debuginfo/step-into-match.rs`: Stepping at the end of a function on goes to the callsite, not the instruction after it. * `tests/debuginfo/type-names.rs`: Arm64 Windows cdb doesn't support JavaScript extensions. Followed up with the Microsoft Debugger Tools team to fix this. * `tests/ui/runtime/backtrace-debuginfo.rs`: Backtraces are truncated due to #140489
2025-05-08Rollup merge of #140736 - xizheyin:issue-140166, r=petrochenkovMatthias Krüger-0/+40
trait selection: check `&` before suggest remove deref FIxes #140166 r? compiler
2025-05-08Rollup merge of #140769 - Zoxc:fix-140731, r=oli-obkMatthias Krüger-0/+42
Add `DefPathData::OpaqueLifetime` to avoid conflicts for remapped opaque lifetimes This adds `DefPathData::OpaqueLifetime` to ensure the def paths for remapped opaque lifetimes remain unique. Fixes https://github.com/rust-lang/rust/issues/140731. r? ``@oli-obk``
2025-05-08Rollup merge of #140762 - aDotInTheVoid:popnl, r=GuillaumeGomezMatthias Krüger-12/+12
rustdoc-json: Remove newlines from attributes Fixes #140689 Not sure if this needs to bump `FORMAT_VERSION` or not. r? ``@GuillaumeGomez`` cc ``@obi1kenobi``
2025-05-08Rollup merge of #140711 - compiler-errors:combine-maybes, r=lcnrMatthias Krüger-0/+56
Do not discard constraints on overflow if there was candidate ambiguity Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/201. There's a pretty chunky justification in the test. r? lcnr
2025-05-08Rollup merge of #140523 - compiler-errors:late-early-mismatch, r=jackh726Matthias Krüger-35/+164
Better error message for late/early lifetime param mismatch Rework the way we report early-/late-bound lifetime param mismatches to equate the trait and impl signatures using region variables, so that we can detect when a late-bound param is present in the signature in place of an early-bound param, or vice versa. The diagnostic is a bit more technical, but it's more obviously clear to see what the problem is, even if it's not great at explaining how to fix it. I think this could be improved further, but I still think it's much better than what exists today. Note to reviewer(s): I'd appreciate if we didn't bikeshed *too* much about this verbiage, b/c I hope it's clear that the old message sucked a lot. I'm happy to file bugs for interested new contributors to improve the messaging further. Edit(fmease): Fixes https://github.com/rust-lang/rust/issues/33624.
2025-05-08Rollup merge of #140260 - compiler-errors:only-global-post-norm, r=lcnrMatthias Krüger-19/+16
Only prefer param-env candidates if they remain non-global after norm Introduce `CandidateSource::GlobalParamEnv`, and dynamically compute the `CandidateSource` based on whether the predicate contains params *post-normalization*. This code needs some cleanup and documentation. I'm just putting this up for review. cc https://github.com/rust-lang/trait-system-refactor-initiative/issues/179 r? lcnr
2025-05-08Auto merge of #140106 - dianne:deref-pat-usefulness, r=Nadrierilbors-15/+369
allow deref patterns to participate in exhaustiveness analysis Per [this proposal](https://hackmd.io/4qDDMcvyQ-GDB089IPcHGg#Exhaustiveness), this PR allows deref patterns to participate in exhaustiveness analysis. Currently all deref patterns enforce `DerefPure` bounds on their scrutinees, so this assumes all patterns it's analyzing are well-behaved. This also doesn't support [mixed exhaustiveness](https://hackmd.io/4qDDMcvyQ-GDB089IPcHGg#Mixed-exhaustiveness), and instead emits an error if deref patterns are used together with normal constructors. I think mixed exhaustiveness would be nice to have (especially if we eventually want to support arbitrary `Deref` impls[^1]), but it'd require more work to get reasonable diagnostics[^2]. Tracking issue for deref patterns: #87121 r? `@Nadrieril` [^1]: Regardless of whether we support limited exhaustiveness checking for untrusted `Deref` or always require other arms to be exhaustive, I think it'd be useful to allow mixed matching for user-defined smart pointers. And it'd be strange if it worked there but not for `Cow`. [^2]: I think listing out witnesses of non-exhaustiveness can be confusing when they're not necessarily disjoint, and when you only need to cover some of them, so we'd probably want special formatting and/or explanatory subdiagnostics. And if it's implemented similarly to unions, we'd probably also want some way of merging witnesses; the way witnesses for unions can appear duplicated is pretty unfortunate. I'm not sure yet how the diagnostics should look, especially for deeply nested patterns.
2025-05-07Auto merge of #140751 - GuillaumeGomez:rollup-eahw4ta, r=GuillaumeGomezbors-53/+264
Rollup of 8 pull requests Successful merges: - #140234 (Separate dataflow analysis and results) - #140614 (Correct warning message in restricted visibility) - #140671 (Parser: Recover error from named params while parse_path) - #140700 (Don't crash on error codes passed to `--explain` which exceed our internal limit of 9999 ) - #140706 ([rustdoc] Ensure that temporary doctest folder is correctly removed even if doctests failed) - #140734 (Fix regression from #140393 for espidf / horizon / nuttx / vita) - #140741 (add armv5te-unknown-linux-gnueabi target maintainer) - #140745 (run-make-support: set rustc dylib path for cargo wrapper) r? `@ghost` `@rustbot` modify labels: rollup
2025-05-07Add `DefPathData::OpaqueLifetime` to avoid conflicts for remapped opaque ↵John Kåre Alsaker-0/+42
lifetimes
2025-05-07Auto merge of #140590 - lcnr:closure-in-dead-code, r=compiler-errorsbors-0/+78
borrowck nested items in dead code fixes https://github.com/rust-lang/rust/issues/140583 r? `@compiler-errors`
2025-05-07rustdoc-json: Remove newlines from attributesAlona Enraght-Moony-12/+12
2025-05-07Better error message for late/early lifetime param mismatchMichael Goulet-46/+164
2025-05-07[arm64] Pointer auth test should link with C static library staticallyDaniel Paoliello-1/+1
2025-05-07[win][arm64] Disable various DebugInfo tests that don't work on Arm64 WindowsDaniel Paoliello-0/+10
2025-05-07[Arm64EC] Only decorate functions with `#`Daniel Paoliello-1/+51
2025-05-07ReviewMichael Goulet-1/+1
2025-05-07Point out region bound mismatches in check_region_bounds_on_impl_itemMichael Goulet-3/+14
2025-05-07Use MaybeCause::or to allow constraints from overflows if they are combined ↵Michael Goulet-0/+56
with ambiguity
2025-05-07Only include associated type bounds for Self:Sized associated types if they ↵Michael Goulet-3/+46
are provided
2025-05-07Rollup merge of #140706 - GuillaumeGomez:fix-missing-temp-dir-cleanup, ↵Guillaume Gomez-0/+42
r=notriddle [rustdoc] Ensure that temporary doctest folder is correctly removed even if doctests failed Fixes #139899. The bug was due to the fact that if any doctest fails for any reason, we call `exit` (or it's called inside `libtest` if not edition 2024), meaning that `TempDir`'s destructor isn't called, and therefore the temporary folder isn't cleaned up. Took me a while to figure out how to reproduce but finally I was able to reproduce the bug with: `````rust #![doc(test(attr(deny(warnings))))] //! ``` //! let a = 12; //! ``` ````` And then I ensured that panicking doctests were cleaned up as well: `````rust //! ``` //! panic!(); //! ``` ````` And finally I checked if it was fixed for merged doctests too (`--edition 2024`). To make this work, I needed to add a new public function in `libtest` too which would call a function once all tests have been run. So only issue is: I have absolutely no idea how we can add a regression test for this fix. If anyone has an idea... r? `@notriddle`
2025-05-07Rollup merge of #140700 - Kivooeo:new-fix-six, r=davidtwco,fmeaseGuillaume Gomez-0/+74
Don't crash on error codes passed to `--explain` which exceed our internal limit of 9999 removed panic in case where we do `--explain > 9999` and added check for it now error looks like this instead of ICE ``` $ rustc.exe --explain E10000 error: E10000 is not a valid error code ``` fixes #140647 r? `@fmease`
2025-05-07Rollup merge of #140671 - xizheyin:issue-140169, r=petrochenkovGuillaume Gomez-52/+95
Parser: Recover error from named params while parse_path Fixes #140169 I added test to the first commit and the second added the code and changes to test. r? `@petrochenkov`
2025-05-07Rollup merge of #140614 - yuk1ty:fix-invalid-module-name-visibility, r=davidtwcoGuillaume Gomez-1/+53
Correct warning message in restricted visibility Fixes #131220
2025-05-07Only prefer param-env candidates if they remain non-global after normMichael Goulet-19/+16
2025-05-07Check `&` before suggest remove deref when trait_selectionxizheyin-5/+1
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-05-07Use `parse_param_general` when parsing `(T, U)->R` in `parse_path_segment`xizheyin-69/+86
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn> Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
2025-05-07Add regression test for #139899Guillaume Gomez-0/+42
2025-05-07Add ui test suggest-remove-deref-issue-140166xizheyin-0/+44
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-05-06error early when mixing deref patterns with normal constructorsdianne-0/+91
Without adding proper support for mixed exhaustiveness, mixing deref patterns with normal constructors would either violate `ConstructorSet::split`'s invariant 4 or 7. We'd either be ignoring rows with normal constructors or we'd have problems in unspecialization from non-disjoint constructors. Checking mixed exhaustivenss similarly to how unions are currently checked should work, but the diagnostics for unions are confusing. Since mixing deref patterns with normal constructors is pretty niche (currently it only makes sense for `Cow`), emitting an error lets us avoid committing to supporting mixed exhaustiveness without a good answer for the diagnostics.
2025-05-06add exhaustiveness/usefulness tests for deref patternsdianne-0/+269
2025-05-06let deref patterns participate in usefulness/exhaustivenessdianne-15/+9
This does not yet handle the case of mixed deref patterns with normal constructors; it'll ICE in `Constructor::is_covered_by`. That'll be fixed in a later commit.
2025-05-07Rollup merge of #140713 - compiler-errors:check_ref_cast, r=lcnrJacob Pratt-0/+22
Structurally resolve in `check_ref_cast` in new solver Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/203 r? lcnr
2025-05-07Rollup merge of #140709 - notriddle:rm-unportable-markdown, r=GuillaumeGomezJacob Pratt-85/+0
rustdoc: remove unportable markdown lint and old parser Follow up https://github.com/rust-lang/rust/pull/127127
2025-05-07Rollup merge of #140607 - lcnr:opaque-type-storage, r=compiler-errorsJacob Pratt-0/+25
support duplicate entries in the opaque_type_storage Necessary for the new solver as we may unify keys when eagerly resolving for canonical queries. See the relevant comment when instantiating query responses: ```rust // We eagerly resolve inference variables when computing the query response. // This can cause previously distinct opaque type keys to now be structurally equal. // // To handle this, we store any duplicate entries in a separate list to check them // at the end of typeck/borrowck. We could alternatively eagerly equate the hidden // types here. However, doing so is difficult as it may result in nested goals and // any errors may make it harder to track the control flow for diagnostics. if let Some(prev) = prev { self.delegate.add_duplicate_opaque_type(key, prev, self.origin_span); } ``` This will be far more relevant with #140497. r? `@compiler-errors`