about summary refs log tree commit diff
path: root/tests/ui
AgeCommit message (Collapse)AuthorLines
2025-05-07Better error message for late/early lifetime param mismatchMichael Goulet-46/+164
2025-05-07[win][arm64] Disable various DebugInfo tests that don't work on Arm64 WindowsDaniel Paoliello-0/+4
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-07macro expansion issueKivooeo-39/+113
2025-05-07Only include associated type bounds for Self:Sized associated types if they ↵Michael Goulet-3/+46
are provided
2025-05-07Remove manual WF hackMichael Goulet-14/+76
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 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 #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`
2025-05-07Rollup merge of #139534 - madhav-madhusoodanan:apx-target-feature-addition, ↵Jacob Pratt-0/+20
r=workingjubilee Added support for `apxf` target feature
2025-05-07Rollup merge of #134273 - RalfJung:de-stabilize-bench, r=ibraheemdev,traviscrossJacob Pratt-70/+12
de-stabilize bench attribute This has been soft-unstable since forever (https://github.com/rust-lang/rust/pull/64066), and shown in future-compat reports since Rust 1.77 (https://github.com/rust-lang/rust/pull/116274). The feature covering `bench` itself is tracked in https://github.com/rust-lang/rust/issues/50297, which has been closed despite still having active feature gates referencing it. Cc `@rust-lang/libs-api`
2025-05-06Structurally resolve in check_ref_castMichael Goulet-0/+22
2025-05-06added error handle for error code > 9999Kivooeo-0/+74
2025-05-06Added apxf target feature testMadhav Madhusoodanan-0/+20
2025-05-06Preserve generic args in suggestions for ambiguous associated itemsLeón Orell Valerian Liehr-23/+111
Most notably, this preserves the `(..)` of ambiguous RTN paths.
2025-05-06Factor out `resolve_type_relative_path`León Orell Valerian Liehr-0/+18
IMPORTANT: This leads to a tiny diagnostic regression that will be fixed in the next commit!
2025-05-06support duplicates in the opaque_types_storagelcnr-0/+25
2025-05-06Auto merge of #140702 - GuillaumeGomez:rollup-rpyxs20, r=GuillaumeGomezbors-57/+402
Rollup of 4 pull requests Successful merges: - #140135 (Unify sidebar buttons to use the same image) - #140632 (add a test for issue rust-lang/rust#81317) - #140658 (`deref_patterns`: let string and byte string literal patterns peel references and smart pointers before matching) - #140681 (Don't ignore compiler stderr in `lib-defaults.rs`) r? `@ghost` `@rustbot` modify labels: rollup
2025-05-06Rollup merge of #140681 - jieyouxu:test_helpers, r=petrochenkovGuillaume Gomez-15/+17
Don't ignore compiler stderr in `lib-defaults.rs` Closes #54222. - Don't ignore compiler stderr. - Document test intent. - Move under `tests/ui/link-native-libs/` instead. This was previously discussed on https://web.archive.org/web/20181028094402/https://botbot.me/mozilla/rust-tools/2017-02-21/?page=1. try-job: armhf-gnu try-job: test-various try-job: x86_64-msvc-1 try-job: i686-msvc-1 try-job: x86_64-mingw-1 try-job: aarch64-apple try-job: x86_64-apple-1
2025-05-06Rollup merge of #140658 - dianne:lit-deref-pats-p2, r=oli-obkGuillaume Gomez-42/+297
`deref_patterns`: let string and byte string literal patterns peel references and smart pointers before matching This follows up on #140028. Together, they allow using string and byte string literal patterns to match on smart pointers when `deref_patterns` is enabled. In particular, string literals can now match on `String`, subsuming the functionality of the `string_deref_patterns` feature. More generally, this works by letting literals peel references (and smart pointers) before matching, similar to most other patterns, providing an answer to #44849. Though it's only partially implemented at this point: this doesn't yet let named const patterns peel before matching. The peeling logic is general enough to support named consts, but the typing rules for named const patterns would need adjustments to feel consistent (e.g. arrays would need rules to be usable as slices, and `const STR: &'static str` wouldn't be able to match on a `String` unless a rule was added to let it be used where a `str` is expected, similar to what #140028 did for literals). This also allows string and byte string patterns to match on mutable references, following up on https://github.com/rust-lang/rust/pull/140028#discussion_r2053927512. Rather than forward the mutability of the scrutinee to literal patterns, I've opted to peel `&mut`s from the scrutinee. From a design point of view, this makes the behavior consistent with what would be expected from deref coercions using the methodology in the next paragraph. From a diagnostics point of view, this avoids labeling string and byte string patterns as "mutable references", which I think could be confusing. See [`byte-string-type-errors.rs`](https://github.com/rust-lang/rust/compare/master...dianne:rust:lit-deref-pats-p2?expand=1#diff-4a0dd9b164b67c706751f3c0b5762ddab08bcef05a91972beb0190c6c1cd3706) for how the diagnostics look. At a high level, the peeling logic implemented here tries to mimic how deref coercions work for expressions: we peel references (and smart pointers) from the scrutinee until the pattern can match against it, and no more. This is primarily tested by [`const-pats-do-not-mislead-inference.rs`](https://github.com/rust-lang/rust/compare/master...dianne:rust:lit-deref-pats-p2?expand=1#diff-19afc05b8aae9a30fe4a3a8c0bc2ab2c56b58755a45cdf5c12be0d5e83c4739d). To illustrate the connection, I wasn't sure if this made sense to include in the test file, but I've translated those tests to make sure they give the same inference results as deref coercions: [(playground)](https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=1869744cb9cdfed71a686990aadf9fe1). In each case, a reference to the scrutinee is coerced to have the type of the pattern (under a reference). Tracking issue for deref patterns: #87121 r? `@oli-obk` cc `@Nadrieril`
2025-05-06Rollup merge of #140632 - Skgland:test-for-issue-81317, r=oli-obkGuillaume Gomez-0/+88
add a test for issue rust-lang/rust#81317 closes rust-lang/rust#81317
2025-05-06Auto merge of #140561 - compiler-errors:gather-fewer-locals, r=lcnrbors-253/+236
Do not gather local all together at the beginning of typeck r? lcnr
2025-05-06tests: don't ignore compiler stderr in `lib-defaults.rs`Jieyou Xu-15/+17
And also: - Document test intent. - Move under `link-native-libs/` instead.
2025-05-06Rollup merge of #140678 - compiler-errors:dont-ice-on-infer-in-upvar, r=lcnrStuart Cook-0/+35
Be a bit more relaxed about not yet constrained infer vars in closure upvar analysis See the writeup in `tests/ui/closures/opaque-upvar.rs`. TL;DR is that this has to do with the fact that the recursive revealing uses, which have not yet been constrained from the defining use by the time that closure upvar inference is performed, remain as infer vars during upvar analysis. We don't really care, though, since anywhere we structurally match on a type in upvar analysis, we already call `structurally_resolve_type` right before `.kind()`, which would emit a true ambiguity error. Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/197 r? lcnr
2025-05-06Rollup merge of #140035 - fee1-dead-contrib:push-oszwkkvmpkks, ↵Stuart Cook-0/+587
r=jieyouxu,wesleywiser Implement RFC 3503: frontmatters Tracking issue: #136889 Supercedes #137193. This implements [RFC 3503](https://github.com/rust-lang/rfcs/blob/master/text/3503-frontmatter.md). This might break rust-analyzer. Will look into how to fix that. Suggestions welcome for how to improve diagnostics.
2025-05-05Rollup merge of #140672 - compiler-errors:deeply-normalize, r=lcnrGuillaume Gomez-56/+98
Deeply normalize in the new solver in WF We need to deeply normalize types we check for well-formedness, since we only collect implied bounds from normalized signature types. Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/194 r? lcnr
2025-05-05Rollup merge of #140661 - Darksonn:fixedx18-tm, r=wesleywiserGuillaume Gomez-0/+37
Make `-Zfixed-x18` into a target modifier As part of #136966, the `-Zfixed-x18` flag should be turned into a target modifier. This is a blocker to stabilization of the flag. The flag was originally added in #124655 and the MCP for its addition is [MCP#748](https://github.com/rust-lang/compiler-team/issues/748). On some aarch64 targets, the x18 register is used as a temporary caller-saved register by default. When the `-Zfixed-x18` flag is passed, this is turned off so that the compiler doesn't use the x18 register. This allows end-users to use the x18 register for other purposes. For example, by accessing it with inline asm you can use the register as a very efficient thread-local variable. Another common use-case is to store the stack pointer needed by the shadow-call-stack sanitizer. There are also some aarch64 targets where not using x18 is the default – in those cases the flag is a no-op. Note that this flag does not *on its own* cause an ABI mismatch. What actually causes an ABI mismatch is when you have different compilation units that *disagree* on what it should be used for. But having a CU that uses it and another CU that doesn't normally isn't enough to trigger an ABI problem. However, we still consider the flag to be a target modifier in all cases, since it is assumed that you are passing the flag because you intend to assign some other meaning to the register. Rejecting all flag mismatches even if not all are unsound is consistent with [RFC#3716](https://rust-lang.github.io/rfcs/3716-target-modifiers.html). See the headings "not all mismatches are unsound" and "cases that are not caught" for additional discussion of this. On aarch64 targets where `-Zfixed-x18` is not a no-op, it is an error to pass `-Zsanitizer=shadow-call-stack` without also passing `-Zfixed-x18`.
2025-05-05Rollup merge of #140374 - compiler-errors:global_asm-bug, r=lcnrGuillaume Gomez-0/+62
Resolve instance for SymFn in global/naked asm `Instance::expect_resolve` ensures that we're actually going from trait item -> impl item. Fixes #140373
2025-05-05fix tidy and bless testSkgland-6/+8
2025-05-05Be a bit more relaxed about not yet constrained infer vars in closure upvar ↵Michael Goulet-0/+35
analysis
2025-05-05expand commentSkgland-0/+29
2025-05-05Deeply normalize in the new solver in WFMichael Goulet-56/+98
2025-05-05Implement RFC 3503: frontmattersDeadbeef-0/+587
Supercedes #137193
2025-05-05Add ui test fn-trait-use-named-paramsxizheyin-0/+26
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-05-05Do not gather local all together at the beginning of typeckMichael Goulet-253/+236
2025-05-05Rename Instance::new to Instance::new_raw and add a note that it is rawMichael Goulet-4/+4
2025-05-05Resolve instance for SymFn in global/naked asmMichael Goulet-0/+62
2025-05-05Make -Zfixed-x18 into a target modifierAlice Ryhl-0/+37
2025-05-05Auto merge of #140453 - Zoxc:next-disambiguator, r=oli-obkbors-18/+18
Remove global `next_disambiguator` state and handle it with a `DisambiguatorState` type This removes `Definitions.next_disambiguator` as it doesn't guarantee deterministic def paths when `create_def` is called in parallel. Instead a new `DisambiguatorState` type is passed as a mutable reference to `create_def` to help create unique def paths. `create_def` calls with distinct `DisambiguatorState` instances must ensure that that the def paths are unique without its help. Anon associated types did rely on this global state for uniqueness and are changed to use (method they're defined in + their position in the method return type) as the `DefPathData` to ensure uniqueness. This also means that the method they're defined in appears in error messages, which is nicer. `DefPathData::NestedStatic` is added to use for nested data inside statics instead of reusing `DefPathData::AnonConst` to avoid conflicts with those. cc `@oli-obk`