about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2025-01-08Try to explain borrow for tail expr temporary drop order change in 2024Michael Goulet-19/+47
2025-01-08Don't do AccessDepth::Drop for types with no drop implMichael Goulet-0/+56
2025-01-08Don't create cycles by normalizing opaques defined in the body we're checkingMichael Goulet-18/+27
2025-01-08run borrowck tests on BIDs and emit tail-expr-drop-order lints forDing Xiang Fei-0/+77
potential violations
2025-01-08Auto merge of #133858 - dianne:better-blame-constraints-for-static, r=lcnrbors-368/+501
`best_blame_constraint`: Blame better constraints when the region graph has cycles from invariance or `'static` This fixes #132749 by changing which constraint is blamed for region errors in several cases. `best_blame_constraint` had a heuristic that tried to pinpoint the constraint causing an error by filtering out any constraints where the outliving region is unified with the ultimate target region being outlived. However, it used the SCCs of the region graph to do this, which is unreliable; in particular, if the target region is `'static`, or if there are cycles from the presence of invariant types, it was skipping over the constraints it should be blaming. As is the case in that issue, this could lead to confusing diagnostics. The simplest fix seems to work decently, judging by test stderr: this makes `best_blame_constraint` no longer filter constraints by their outliving region's SCC. There are admittedly some quirks in the test output. In many cases, subdiagnostics that depend on the particular constraint being blamed have either started or stopped being emitted. After starting at this for quite a while, I think anything too fickle about whether it outputs based on the particular constraint being blamed should instead be looking at the constraint path as a whole, similar to what's done for [the placeholder-from-predicate note](https://github.com/rust-lang/rust/compare/master...dianne:rust:better-blame-constraints-for-static#diff-3c0de6462469af483c9ecdf2c4b00cb26192218ef2d5c62a0fde75107a74caaeR506). Very many tests involving invariant types gained a note pointing out the types' invariance, but in a few cases it was lost. A particularly illustrative example is [tests/ui/lifetimes/copy_modulo_regions.stderr](https://github.com/rust-lang/rust/compare/master...dianne:rust:better-blame-constraints-for-static?expand=1#diff-96e1f8b29789b3c4ce2f77a5e0fba248829b97ef9d1ce39e7d2b4aa57b2cf4f0); I'd argue the new constraint is a better one to blame, but it lacks the variance diagnostic information that's elsewhere in the constraint path. If desired, I can try making that note check the whole path rather than just the blamed constraint. The subdiagnostic [`BorrowExplanation::add_object_lifetime_default_note`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_borrowck/diagnostics/explain_borrow/enum.BorrowExplanation.html#method.add_object_lifetime_default_note) depends on a `Cast` being blamed, so [a special case](https://github.com/rust-lang/rust/pull/133858/commits/364ca7f99c12fb5220e6b568ac391979317ce878) was necessary to keep it from disappearing from tests specifically testing for it. However, see the FIXME comment in that commit; I think the special case should be removed once that subdiagnostic works properly, but it's nontrivial enough to warrant a separate PR. Incidentally, this removes the note from a test where it was being added erroneously: in [tests/ui/borrowck/two-phase-surprise-no-conflict.stderr](https://github.com/rust-lang/rust/compare/master...dianne:rust:better-blame-constraints-for-static?expand=1#diff-8cf085af8203677de6575a45458c9e6b03412a927df879412adec7e4f7ff5e14), the object lifetime is explicitly provided and it's not `'static`.
2025-01-08Rollup merge of #135219 - matthiaskrgr:simd'nt, r=compiler-errorsJacob Pratt-8/+66
warn about broken simd not only on structs but also enums and unions when we didn't opt in to it addresses https://github.com/rust-lang/rust/issues/135208#issuecomment-2576015186 r? ``@Noratrieb``
2025-01-08Rollup merge of #135203 - RalfJung:arm-soft-float, r=workingjubileeJacob Pratt-0/+1
arm: add unstable soft-float target feature This has an actual usecase as mentioned [here](https://github.com/rust-lang/rust/issues/116344#issuecomment-2575324988), and with my recent ARM float ABI changes there shouldn't be any soundness concerns any more. We will reject enabling this feature on `hf` targets, but disabling it on non-`hf` targets is entirely fine -- the target feature refers to whether softfloat emulation is used for float instructions, and is independent of the ABI which we set separately via `llvm_floatabi`. Cc ``@workingjubilee``
2025-01-07Rollup merge of #135171 - notriddle:notriddle/stable-path-is-better, ↵Matthias Krüger-0/+40
r=GuillaumeGomez rustdoc: use stable paths as preferred canonical paths This accomplishes something like 16a4ad7d7b0d163f7be6803c786c3b83d42913bb, but with the `rustc_allowed_through_unstable_modules` attribute instead of the path length. Fixes #131676
2025-01-07Rollup merge of #135149 - compiler-errors:mangle, r=oli-obkMatthias Krüger-0/+38
Use a post-monomorphization typing env when mangling components that come from impls When mangling associated methods of impls, we were previously using the wrong param-env. Instead of using a fully monomorphized param-env like we usually do in codegen, we were taking the post-analysis param-env, and treating it as an early binder to *re-substitute* the impl args. I've pointed out the problematic old code in an inline comment. This would give us param-envs with possibly trivial predicates that would prevent normalization via param-env shadowing. In the example test linked below, `tests/ui/symbol-names/normalize-in-param-env.rs`, this happens when we mangle the impl `impl<P: Point2> MyFrom<P::S> for P` with the substitution `P = Vec2`. Because the where clause of the impl is `P: Point2`, which elaborates to `[P: Point2, P: Point, <P as Point>::S projects-to <P as Point2>::S2]` and the fact that `impl Point2 for Vec2` normalizes `Vec2::S2` to `Vec2::S`, this causes a cycle. The proper fix here is to use a fully monomorphized param-env for the case where the impl is properly substituted. Fixes #135143 While #134081 uncovered this bug for legacy symbol mangling, it was preexisting for v0 symbol mangling. This PR fixes both. The test requires a "hack" because we strip the args of the instance we're printing for legacy symbol mangling except for drop glue, so we box a closure to ensure we generate drop glue. r? oli-obk
2025-01-07Rollup merge of #134989 - max-niederman:guard-patterns-hir, r=oli-obkMatthias Krüger-29/+10
Lower Guard Patterns to HIR. Implements lowering of [guard patterns](https://rust-lang.github.io/rfcs/3637-guard-patterns.html) (see the [tracking issue](#129967)) to HIR.
2025-01-07Rollup merge of #134745 - compiler-errors:better-arg-span-in-typeck, r=BoxyUwUMatthias Krüger-75/+52
Normalize each signature input/output in `typeck_with_fallback` with its own span Applies the same hack as #106582 but to the args in typeck. Greatly improves normalization error spans from a signature.
2025-01-07warn about broken simd not only on structs but also enums and unions when we ↵Matthias Krüger-8/+66
didn't opt in to it
2025-01-07arm: add unstable soft-float target featureRalf Jung-0/+1
2025-01-07Rollup merge of #135182 - scottmcm:box-deref-via-transmute, r=oli-obkGuillaume Gomez-15/+15
Transmute from NonNull to pointer when elaborating a box deref (MCP807) Since per https://github.com/rust-lang/compiler-team/issues/807 we have to stop projecting into `NonNull`. cc https://github.com/rust-lang/rust/issues/133652
2025-01-07Rollup merge of #135174 - xingxue-ibm:reproducible-build-aix, r=jieyouxuGuillaume Gomez-3/+44
[AIX] Port test case run-make/reproducible-build The test case `run-make/reproducible-build` verifies that two identical invocations of the compiler produce the same output by comparing the linker arguments, resulting binaries, and other artifacts. However, the AIX linker command includes an argument that specifies the file containing exported symbols, with a file path that contains a randomly generated substring to prevent collisions between different linking processes. Additionally, the AIX XCOFF file header includes a 4-byte timestamp. This PR replaces the random substring with a placeholder and nullifies the timestamp field in the XCOFF files for the comparisons.
2025-01-06Rollup merge of #135139 - c410-f3r:8-years-rfc, r=jhprattJacob Pratt-23/+3
[generic_assert] Constify methods used by the formatting system cc #44838 Starts the "constification" of all the elements required to allow the execution of the formatting system in constant environments. ```rust const _: () = { panic!("{:?}", 1i32); }; ``` Further stuff is blocked by #133999.
2025-01-06Rollup merge of #135126 - klensy:deprecated-and-do-nothing, r=jieyouxuJacob Pratt-4/+28
mark deprecated option as deprecated in rustc_session to remove copypasta and small refactor This marks deprecated options as deprecated via flag in options table in rustc_session, which removes copypasted deprecation text from rustc_driver_impl. This also adds warning for deprecated `-C ar` option, which didn't emitted any warnings before. Makes `inline_threshold` `[UNTRACKED]`, as it do nothing. Adds few tests. See individual commits.
2025-01-06Rollup merge of #135116 - camelid:sidebar-case, r=fmeaseJacob Pratt-2/+2
rustdoc: Fix mismatched capitalization in sidebar Previously, the main content used "Aliased Type", while the sidebar said "Aliased type". Now, they both say "Aliased Type", which is the more common capitalization in Rustdoc. See the following link for an example. https://doc.rust-lang.org/1.83.0/std/io/type.Result.html
2025-01-06Rollup merge of #135090 - compiler-errors:invalid-tuple-ctor-projection, ↵Jacob Pratt-0/+58
r=lqd,jieyouxu Suggest to replace tuple constructor through projection See the code example. when `Self::Assoc` normalizes to a struct that has a tuple constructor, you cannot construct the type via `Self::Assoc(field, field)`. Instead, suggest to replace it with the correct named struct. Fixes #120871
2025-01-06Rollup merge of #134744 - compiler-errors:transmute-non-wf, r=lcnrJacob Pratt-0/+92
Don't ice on bad transmute in typeck in new solver Old trait solver ends up getting its infcx tainted because we try to normalize the type, but the new trait solver doesn't. This means we try to compute the stalled transmute obligations, which tries to normalize a type an ICEs. Let's make this a delayed bug. r? lcnr
2025-01-06Rollup merge of #132345 - compiler-errors:fx-diag, r=lcnrJacob Pratt-8/+29
Improve diagnostics for `HostEffectPredicate` in the new solver Adds derived cause for host effect predicates. Some diagnostics regress, but that's connected to the fact that our predicate visitor doesn't play well with aliases just yet.
2025-01-06Rollup merge of #131830 - hoodmane:emscripten-wasm-eh, r=workingjubileeJacob Pratt-0/+91
Add support for wasm exception handling to Emscripten target This is a draft because we need some additional setting for the Emscripten target to select between the old exception handling and the new exception handling. I don't know how to add a setting like that, would appreciate advice from Rust folks. We could maybe choose to use the new exception handling if `Ctarget-feature=+exception-handling` is passed? I tried this but I get errors from llvm so I'm not doing it right.
2025-01-06Transmute from NonNull to pointer when elaborating a box deref (MCP807)Scott McMurray-15/+15
2025-01-06only avoid blaming assignments from argument patternsdianne-34/+27
2025-01-06point out unblamed constraints from `Copy`/`Sized` bounds in region errorsdianne-1/+7
2025-01-06make outlives constraints from pointer comparisons less boringdianne-15/+15
2025-01-06make outlives constraints from generic arguments less boringdianne-1/+1
2025-01-06`best_blame_constraint`: prioritize blaming interesting-seeming constraintsdianne-98/+121
2025-01-06`best_blame_constraint`: avoid blaming assignments without user-provided typesdianne-57/+63
2025-01-06`best_blame_constraint`: avoid blaming constraints from MIR generated by ↵dianne-32/+28
desugaring
2025-01-06`best_blame_constraint`: add a special case to recover object lifetime ↵dianne-37/+30
default notes
2025-01-06`best_blame_constraint`: don't filter constraints by sup SCCdianne-465/+581
The SCCs of the region graph are not a reliable heuristic to use for blaming an interesting constraint for diagnostics. For region errors, if the outlived region is `'static`, or the involved types are invariant in their lifetiems, there will be cycles in the constraint graph containing both the target region and the most interesting constraints to blame. To get better diagnostics in these cases, this commit removes that heuristic.
2025-01-06rustdoc: Fix mismatched capitalization in sidebarNoah Lev-2/+2
Previously, the main content used "Aliased Type", while the sidebar said "Aliased type". Now, they both say "Aliased Type", which is the more common capitalization in Rustdoc. See the following link for an example. https://doc.rust-lang.org/1.83.0/std/io/type.Result.html
2025-01-06Replace the random substring of a linker argument with a placeholder and ↵Xing Xue-3/+44
nullify the timestamp field of XCOFF files for file comparison.
2025-01-06Rollup merge of #135153 - crystalstall:master, r=workingjubileeMatthias Krüger-1/+1
chore: remove redundant words in comment
2025-01-06Rollup merge of #134951 - compiler-errors:double-trait-err-msg, r=davidtwcoMatthias Krüger-0/+63
Suppress host effect predicates if underlying trait doesn't hold Don't report two errors for when the (`HostEffectPredicate`) `T: const Trait` isn't implemented because (`TraitPredicate`) `T: Trait` doesn't even hold.
2025-01-06Rollup merge of #134771 - compiler-errors:const-arg-has-type-err, r=lcnrMatthias Krüger-2/+22
Report correct `SelectionError` for `ConstArgHasType` in new solver fulfill r? ``@BoxyUwU``
2025-01-06Rollup merge of #134742 - compiler-errors:post-borrowck-analysis, r=lcnrMatthias Krüger-0/+2
Use `PostBorrowckAnalysis` in `check_coroutine_obligations` This currently errors with: ``` error: concrete type differs from previous defining opaque type use --> tests/ui/coroutine/issue-52304.rs:10:21 | 10 | pub fn example() -> impl Coroutine { | ^^^^^^^^^^^^^^ expected `{example::{closure#0} upvar_tys=() resume_ty=() yield_ty=&'{erased} i32 return_ty=() witness={example::{closure#0}}}`, got `{example::{closure#0} upvar_tys=() resume_ty=() yield_ty=&'static i32 return_ty=() witness={example::{closure#0}}}` | = note: previous use here ``` This is because we end up redefining the opaque in `check_coroutine_obligations` but with the `yield_ty = &'erased i32` from hir typeck, which causes the *equality* check for opaques to fail. The coroutine obligtions in question (when `-Znext-solver` is enabled) are: ``` Binder { value: TraitPredicate(<Opaque(DefId(0:5 ~ issue_52304[4c6d]::example::{opaque#0}), []) as std::marker::Sized>, polarity:Positive), bound_vars: [] } Binder { value: AliasRelate(Term::Ty(Alias(Opaque, AliasTy { args: [], def_id: DefId(0:5 ~ issue_52304[4c6d]::example::{opaque#0}), .. })), Equate, Term::Ty(Coroutine(DefId(0:6 ~ issue_52304[4c6d]::example::{closure#0}), [(), (), &'{erased} i32, (), CoroutineWitness(DefId(0:6 ~ issue_52304[4c6d]::example::{closure#0}), []), ()]))), bound_vars: [] } Binder { value: AliasRelate(Term::Ty(Coroutine(DefId(0:6 ~ issue_52304[4c6d]::example::{closure#0}), [(), (), &'{erased} i32, (), CoroutineWitness(DefId(0:6 ~ issue_52304[4c6d]::example::{closure#0}), []), ()])), Subtype, Term::Ty(Alias(Opaque, AliasTy { args: [], def_id: DefId(0:5 ~ issue_52304[4c6d]::example::{opaque#0}), .. }))), bound_vars: [] } ``` Ignoring the fact that we end up stalling some really dumb obligations here (lol), I think it makes more sense for us to be using post borrowck analysis for this check anyways. r? lcnr
2025-01-06rustdoc: use stable paths as preferred canonical pathsMichael Howell-0/+40
This accomplishes something like 16a4ad7d7b0d163f7be6803c786c3b83d42913bb, but with the `rustc_allowed_through_unstable_modules` attribute instead of the path length.
2025-01-06Suggest to replace tuple constructor through projectionMichael Goulet-0/+58
2025-01-06Recurse on GAT where clauses in fulfillment error proof tree visitorMichael Goulet-18/+14
2025-01-06Normalize each signature input/output in typeck_with_fallback with its own spanMichael Goulet-75/+52
2025-01-06Don't ice on bad transmute in typeck in new solverMichael Goulet-0/+92
2025-01-06Add derived causes for host effect predicatesMichael Goulet-8/+33
2025-01-06add deprecated and do nothing flag to options tableklensy-4/+28
inline_threshold mark deprecated no-stack-check print deprecation message for -Car too inline_threshold deprecated and do nothing: make in untracked make OptionDesc struct from tuple
2025-01-06Auto merge of #135112 - tgross35:combine-select-unpredictable-test, r=the8472bors-36/+38
Merge the intrinsic and user tests for `select_unpredictable` [1] mentions that having a single test with `-Zmerge-functions=disabled` is preferable to having two separate tests. Apply that to the new `select_unpredictable` test here. [1]: https://github.com/rust-lang/rust/pull/133964#issuecomment-2569693325
2025-01-06Add support for wasm exception handling to Emscripten targetHood Chatham-0/+91
Gated behind an unstable `-Z emscripten-wasm-eh` flag
2025-01-06Auto merge of #135151 - matthiaskrgr:rollup-2vy1hwl, r=matthiaskrgrbors-9/+13
Rollup of 6 pull requests Successful merges: - #135111 (Add doc aliases for `libm` and IEEE names) - #135129 (triagebot: label `src/doc/rustc-dev-guide` changes with `A-rustc-dev-guide`) - #135132 (dev guide ping group and set adhoc reviewers to compiler) - #135145 (Mention `unnameable_types` in `unreachable_pub` documentation.) - #135147 (A few borrowck tweaks to improve 2024 edition migration lints) - #135150 (move footnote to ordinary comment) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-06chore: remove redundant words in commentcrystalstall-1/+1
Signed-off-by: crystalstall <crystalruby@qq.com>
2025-01-06Rollup merge of #135147 - compiler-errors:borrowck-tweaks, r=chenyukangMatthias Krüger-9/+13
A few borrowck tweaks to improve 2024 edition migration lints See first two commits' changes to test outputs. Test coverage in this area is kinda weak, but I think it affects more cases than this (like the craters that will begin to trigger the `tail_expr_drop_order` tests in #134523). Third commit is a drive-by change that removes a deref hack from `UseSpans` which doesn't really improve diagnostics much.