about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2025-05-22Auto merge of #141397 - matthiaskrgr:rollup-l9uu6g6, r=matthiaskrgrbors-23/+44
Rollup of 8 pull requests Successful merges: - #141355 (ci: improve citool job db errors) - #141359 (Fix `FnOnce` impl for `AsyncFn`/`AsyncFnMut` self-borrowing closures in new solver) - #141362 (Normalize aliases to correct kind of error term) - #141377 (Remove unnecessary `is_empty` checks) - #141381 (try_cast_aligned: avoid bare int-to-ptr casts) - #141382 (ci: convert distcheck to free runner) - #141389 (ci: prepare aws access keys for migration) - #141390 (Don't allow `poly_select` in new solver) r? `@ghost` `@rustbot` modify labels: rollup
2025-05-22Rollup merge of #141390 - compiler-errors:poly-select-new-solver, r=lcnrMatthias Krüger-10/+12
Don't allow `poly_select` in new solver I added a `poly_select` call in #140519, but this causes an ICE since the new solver doesn't properly handle the "instantiate binder -> recanonicalize" step in the proof tree visitor. While we could fix the select visitor to look at the next step in proof tree, it's not really necessary. Instead, let's enforce that all callees call the non-higher-ranked `select` function in the new solver. Fixes https://github.com/rust-lang/rust/issues/141322 r? lcnr
2025-05-22Rollup merge of #141377 - nnethercote:rm-unnecessary-is_empty-checks, ↵Matthias Krüger-1/+1
r=GuillaumeGomez Remove unnecessary `is_empty` checks Part of #137978. r? `@GuillaumeGomez`
2025-05-22Rollup merge of #141362 - BoxyUwU:correct_error_term_kind, r=lcnrMatthias Krüger-4/+25
Normalize aliases to correct kind of error term Fixes #140642 When normalizing an alias to an error in the old solver, normalize to the same term kind as the alias being normalized instead of always to a type error. r? lcnr
2025-05-22Rollup merge of #141359 - compiler-errors:async-fn-once, r=lcnrMatthias Krüger-8/+6
Fix `FnOnce` impl for `AsyncFn`/`AsyncFnMut` self-borrowing closures in new solver This only affects closures that are "`AsyncFn`/`AsyncFnMut`" in their calling capability that are being called with the `FnOnce` trait. fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/217 r? lcnr
2025-05-22Rollup merge of #141286 - compiler-errors:querify-coroutine, r=oli-obkMatthias Krüger-41/+67
Querify `coroutine_hidden_types` This is necessary if we ever want to add implied bounds that would be used for higher-ranked coroutine auto trait goals (e.g. future implements `Send`). Modest perf regression in `hyper` full build which (afaict?) is the only async stress test, so definitely worth it IMO. r? oli-obk
2025-05-22Rollup merge of #141130 - mejrs:use_self, r=compiler-errorsMatthias Krüger-88/+49
rustc_on_unimplemented cleanups Addresses some of the fixmes from https://github.com/rust-lang/rust/pull/139091 and https://github.com/rust-lang/rust/pull/140307. - switch from `_Self` to `Self` in library - properly validate that arguments in the `on` filter and the format strings are actually valid See https://github.com/rust-lang/rustc-dev-guide/pull/2357 for the relevant documentation.
2025-05-22Rollup merge of #140435 - ↵Matthias Krüger-3/+16
bend-n:use_ux_from_instead_of_bool_as_ux_unnecessary_transmutes, r=compiler-errors use uX::from instead of _ as uX in non - const contexts changes `transmute(bool) -> integer` to `integer::from` as opposed to `bool as integer`. https://github.com/rust-lang/rust/pull/136083#discussion_r1985061667 `@rustbot` label L-unnecessary_transmutes
2025-05-22Rollup merge of #140218 - fmease:hirtylo-clean-up-path-low, r=compiler-errorsMatthias Krüger-500/+502
HIR ty lowering: Clean up & refactor the lowering of type-relative paths While rebasing #126651 I realized that HIR ty lowering could benefit from some *spring cleaning* now that it's been extended to handle RTN and mGCA paths. More seriously, similar to my merged PR #118668 which unified the handling of all *associated item constraints* (assoc ty, const (ACE) & fn (RTN)), this PR (commit https://github.com/rust-lang/rust/pull/140218/commits/695fcf517d8864b4812225643ef8cfc036ba9f61) partially[^1] deduplicates the resolution code for all *type-relative paths* (assoc ty, const (mGCA) & fn (RTN)). **Why**? DRY'ing that part of the code means PR #126651 will automatically support RTN paths like `Ty::AssocTy::assoc_fn(..)` and it also implies shared diagnostic code and thus better diagnostics for RTN. --- The other commits represent cleanups, renamings, moves. More notably, I've renamed path lowering methods to be a lot more descriptive, so ones lowering `QPath(Resolved)` paths now have `_resolved_` in their name and ones lowering `QPath(TypeRelative)` paths now have `_type_relative_` in their name. This should make it stupidly obvious what their purpose is. --- Best reviewed commit by commit. The changes are close to trivial but the diff might make it look hairier. r? compiler-errors [^1]: Sadly, I couldn't unify as much compared to the other PR without introducing unnecessary `unreachable!()`s or rendering the code otherwise illegible with flags and micro helper traits.
2025-05-22Rollup merge of #139668 - matthewjasper:upper-bound-fix, r=compiler-errorsMatthias Krüger-1/+57
Handle regions equivalent to 'static in non_local_bounds `non_local_bounds` would only find non local bounds that strictly bound a given region, but it's possible that a local region is equated to 'static when showing a type referencing a locally bound lifetime, such as `dyn Any + 'a` in the tests added, is well-formed. In this case we should return 'static. closes #122704 closes #139004
2025-05-22Rollup merge of #139635 - BoxyUwU:no_order_dependent_copy_checks, r=lcnrMatthias Krüger-75/+101
Finalize repeat expr inference behaviour with inferred repeat counts I believe this should be the last change of how repeat exprs are handled before it's finished for `generic_arg_infer`. Assuming we don't wind up deciding to replace this all with a new predicate kind :) This PR has three actual changes: - Always defer the checks to end of typeck even when generic arg infer is not enabled (needs an FCP) - Properly handle element exprs that are constants when the repeat count is inferred - "Isolate" each repeat expr check so that inference constraints from `Copy` goals dont affect other repeat expr checks resulting in weird order-dependent inference The commit history and tests should be relatively helpful for understanding this PR's impl. r? compiler-errors
2025-05-22Rollup merge of #135562 - chenyukang:yukang-fix-128561, r=compiler-errorsMatthias Krüger-7/+18
Add ignore value suggestion in closure body Fixes #128561 r? `@estebank`
2025-05-22Add test/comment about const patterns with unused paramsBoxy-0/+6
2025-05-22Review CommentsBoxy-79/+83
2025-05-22Auto merge of #141135 - compiler-errors:fast-path-2, r=lcnrbors-9/+85
Fast path for processing some obligations in the new solver Fast path applies to: - Dyn compatibility predicates - Region and type outlives predicates - Trivially sized predicates
2025-05-22Don't allow poly_select in new solverMichael Goulet-10/+12
2025-05-22Return correct error term kind on projection errorsBoxy-4/+25
2025-05-22ReviewsBoxy-23/+30
2025-05-22make enabling the neon target feature a FCWRalf Jung-13/+75
2025-05-22aarch64-softfloat: forbid enabling the neon target featureRalf Jung-5/+7
2025-05-22use uX::from instead of _ as uX in non - const contextsbendn-3/+16
2025-05-22Auto merge of #141379 - matthiaskrgr:rollup-g1cz0ic, r=matthiaskrgrbors-2/+1
Rollup of 6 pull requests Successful merges: - #140431 (dont handle bool transmute) - #140868 (rustdoc: Fix links with inline code in trait impl docs) - #141323 (Add bors environment to CI) - #141337 (bump stdarch) - #141364 (rustdoc-json: Remove false docs and add test for inline attribute) - #141370 (add doc alias `replace_first` for `str::replacen`) r? `@ghost` `@rustbot` modify labels: rollup
2025-05-22Rollup merge of #140431 - bend-n:dont_handle_bool_transmute, r=NadrierilMatthias Krüger-2/+1
dont handle bool transmute removes `transmute(u8) -> bool` suggestion due to ambiguity, leave it for clippy elaboration on ambiguity in question: `transmute::<u8, bool>(x)` will codegen to an `assume(u8 < 2)`; `_ == 1` or `_ != 0` or `_ % 2 == 0` would remove that assumption `match _ { x @ (0 | 1) => x == 1, _ => std::hint::unreachable_unchecked() }` is very verbose `@rustbot` label L-unnecessary_transmutes
2025-05-22Remove `is_empty` check in `Ident::is_numeric`.Nicholas Nethercote-1/+1
`Ident`s can no longer be empty, so the test always succeeds.
2025-05-22Auto merge of #137198 - tgross35:cfg-match-rename, r=Amanieubors-6/+6
Rename `cfg_match!` to `cfg_select!` [`@Nemo157` pointed out](https://github.com/rust-lang/rust/issues/115585#issuecomment-2346307605) that `cfg_match!` syntax does not actually align well with match syntax, which is a possible source of confusion. The comment points out that usage is instead more similar to ecosystem `select!` macros. Rename `cfg_match!` to `cfg_select!` to match this. Tracking issue: https://github.com/rust-lang/rust/issues/115585 [1]: https://github.com/rust-lang/rust/issues/115585#issuecomment-2346307605
2025-05-22Rename `kw::Empty` as `sym::empty`.Nicholas Nethercote-28/+27
Because the empty string is not a keyword.
2025-05-21Rollup merge of #141363 - BoxyUwU:doc_lta_norm_binders, r=lcnrMatthias Krüger-4/+13
Document why we allow escaping bound vars in LTA norm r? lcnr followup from the const normalization PR. I think I now understand why free alias norm is funny about binders
2025-05-21Rollup merge of #141357 - dianne:unhardcode-unpretty-thir-tree-body-expr, ↵Matthias Krüger-9/+4
r=compiler-errors `unpretty=thir-tree`: don't require the final expr to be the body's value Two motivations for this: - I couldn't find a comment motivating this hard-coding. I can imagine it might be easier to read `unpretty=thir-flat` output if the final expression in the THIR is always the body's value, but if that's the reason, that should be the justification in the source. I can also imagine it's meant to check that all expressions will be visited by the pretty-printer, but the existing check doesn't quite do that either. - Guard patterns (#129967) contain expressions, so lowering params containing guard patterns may add more expressions to the THIR. Currently a body's params are lowered after its expression, so guard expressions in params would end up last, breaking this. As an alternative, the params could be lowered first (#141356).
2025-05-21Rollup merge of #141356 - dianne:thir-lower-params-before-body-expr, ↵Matthias Krüger-1/+2
r=compiler-errors lower bodies' params to thir before the body's value Two motivations for this: - Lowering params first means errors from lowering the params are emitted before errors from lowering the body's expression. This comes up in [tests/ui/associated-consts/associated-const-type-parameter-pattern.stderr](https://github.com/rust-lang/rust/compare/master...dianne:rust:thir-lower-params-before-body-expr?expand=1#diff-acac6ea10e991af0da91633e08b2739f9f9ca0c8f826401b6ba829914d0806f2), where both the params and expression encounter errors in translating consts to patterns. This change puts the errors in the order they appear in the source file. - Guard patterns (#129967) contain expressions, so lowering params containing guard patterns may add more expressions to the THIR. However, there's a check for `-Zunpretty=thir-tree` that the final expression in the THIR corresponds to its value [(link)](https://github.com/rust-lang/rust/blob/c43786c9b7b8d8dcc3f9c604e0e3074c16ed69d3/compiler/rustc_mir_build/src/builder/mod.rs#L453-L455); lowering params last would break this. As an alternative way to get guard patterns to work, I think the pretty-printer could use the expression returned by `thir_body` and the check could be removed or changed (#141357).
2025-05-21Rollup merge of #141351 - bjorn3:attr_handling_changes, r=NadrierilMatthias Krüger-8/+8
Move -Zcrate-attr injection to just after crate root parsing This way `after_crate_root_parsing` and `-Zpretty` will see them.
2025-05-21Rollup merge of #141347 - lcnr:lets-make-it-unsound-3, r=compiler-errorsMatthias Krüger-2/+42
incorrectly prefer builtin `dyn` impls :3 This makes #57893 slightly more exploitable with the new solver. It's still strictly better than the old solver and the underlying unsoundness persists in the new one even without this preference. Properly fixing #57893 is something we've been looking at more deeply recently and discussed at the [Types Meetup during the All-Hands](https://hackmd.io/rz-4ghMzTb2wXOkdLKHaHw#Dyn-traits). Whatever approach we'll end up deciding on will likely require a fairly long transition period and some significant further design work. This should not block `-Znext-solver`. fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/183 r? `@compiler-errors` cc `@rust-lang/types`
2025-05-21Fix FnOnce impl for AsyncFn/AsyncFnMut closures in new solverMichael Goulet-1/+1
2025-05-21Make captures state error more preciseMichael Goulet-7/+5
2025-05-21Anon consts cant appear as repeat expr elementsBoxy-5/+1
2025-05-21Check for element being `const` before resolving repeat countBoxy-48/+47
2025-05-21GAI logic on stable tooBoxy-52/+47
2025-05-21Don't allow repeat expr count inference side effects to propagateBoxy-17/+46
2025-05-21Don't evaluate constants depending on infers or paramsBoxy-42/+64
2025-05-21Introduce `tcx.anon_const_kind` queryBoxy-46/+86
2025-05-21Document why we allow escaping bound vars in LTA normBoxy-4/+13
2025-05-21Auto merge of #141345 - matthiaskrgr:rollup-vux7gok, r=matthiaskrgrbors-28/+83
Rollup of 7 pull requests Successful merges: - #141267 (only resolve top-level guard patterns' guards once) - #141280 (Use Docker cache from the current repository) - #141296 (Async drop fix for 'broken mir, place has deref as later projection') - #141328 (When AsyncDrop impl is empty, sync drop generated in elaborator) - #141332 (Do not eagerly fold consts in `normalize_param_env_or_error` if new solver) - #141333 (Use `DeepRejectCtxt` in `assemble_inherent_candidates_from_param`) - #141334 (eagerly check nested obligations when coercing fndefs) r? `@ghost` `@rustbot` modify labels: rollup
2025-05-21`unpretty=thir-tree`: don't require the final expr to be the entrypointdianne-9/+4
2025-05-21lower bodies' params to thir before the body's valuedianne-1/+2
2025-05-21Move -Zcrate-attr injection to just after crate root parsingbjorn3-8/+8
This way after_crate_root_parsing and -Zpretty will see them.
2025-05-21fix better_any breakage by making the solver more unsoundlcnr-2/+42
2025-05-21Rollup merge of #141334 - lcnr:coerce-nested-obligations, r=compiler-errorsMatthias Krüger-3/+31
eagerly check nested obligations when coercing fndefs fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/212 r? `@compiler-errors`
2025-05-21Rollup merge of #141333 - compiler-errors:param-env-candidate-unnorm, r=lcnrMatthias Krüger-12/+12
Use `DeepRejectCtxt` in `assemble_inherent_candidates_from_param` Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/214 We were not properly considering unnormalized param-env candidates in `assemble_inherent_candidates_from_param`. r? lcnr
2025-05-21Rollup merge of #141332 - compiler-errors:no-fold-const, r=lcnrMatthias Krüger-3/+1
Do not eagerly fold consts in `normalize_param_env_or_error` if new solver Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/213 Given: ``` trait Trait: Deref<Target = [u8; { 1 + 1 }]> {} ``` when elaborating param env for `Trait`, we have `Self: Trait`, `Self: Deref<Target = [u8; {anon const}]>`. Before this PR, we would fold the anon consts away *before* elaborating. However, we end up getting another *un-folded* copy of the anon const from elaborating `Self: Trait`. This leads to normalization ambiguity. r? lcnr
2025-05-21Rollup merge of #141328 - azhogin:azhogin/async-drop-ice-for-empty-impl-fix, ↵Matthias Krüger-1/+23
r=oli-obk When AsyncDrop impl is empty, sync drop generated in elaborator Fixes #140974.
2025-05-21Rollup merge of #141296 - ↵Matthias Krüger-8/+13
azhogin:azhogin/async-drop-broken-mir-place-deref-fix, r=oli-obk Async drop fix for 'broken mir, place has deref as later projection' fixes #140975 Problem in codegen fixed with an additional temporary local.