about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2025-05-23Suggest correct `version("..")` predicate syntax in check-cfgUrgau-0/+64
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-22Auto merge of #140527 - GuillaumeGomez:doctest-main-fn, r=notriddlebors-73/+253
Emit a warning if the doctest `main` function will not be run Fixes #140310. I think we could try to go much further like adding a "link" (ie UI annotations) on the `main` function in the doctest. However that will require some more computation, not sure if it's worth it or not. Can still be done in a follow-up if we want it. For now, this PR does two things: 1. Pass the `DiagCtxt` to the doctest parser to emit the warning. 2. Correctly generate the `Span` to where the doctest is starting (I hope the way I did it isn't too bad either...). cc `@fmease` r? `@notriddle`
2025-05-22Auto merge of #141379 - matthiaskrgr:rollup-g1cz0ic, r=matthiaskrgrbors-22/+59
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 #141370 - WaffleLapkin:hiiii, r=jhprattMatthias Krüger-0/+1
add doc alias `replace_first` for `str::replacen` `replace_first` is a sensible name for a function, analogous to actually existing `<[_]>::split_first`, for example. (I just saw someone try to search for it) I think it's reasonable to add such an alias for `replacen`, which replaces the first occurrence of passed a 1.
2025-05-22Rollup merge of #141364 - aDotInTheVoid:atttrdocss, r=GuillaumeGomezMatthias Krüger-7/+12
rustdoc-json: Remove false docs and add test for inline attribute The docs about how `#[inline]` was represented isn't true. Updates the comment, and adds a test. CC #137645 r? `@GuillaumeGomez`
2025-05-22Rollup merge of #141337 - RalfJung:stdarch, r=AmanieuMatthias Krüger-0/+0
bump stdarch This should unblock https://github.com/rust-lang/rust/pull/135160. r? `@Amanieu`
2025-05-22Rollup merge of #141323 - Kobzol:bors-environment, r=marcoieniMatthias Krüger-0/+9
Add bors environment to CI This will be used to access secrets once we move off rust-lang-ci. The PR configures the environment: - Only for `rust-lang/rust`, so that it doesn't affect `rust-lang-ci/rust` before we switch (we can remove this condition later, but the environment likely won't work for forks anyway, so we might as well just keep it to make fork CI work) - Only for the `try`/`auto` branches, so that PR CI still works. Context: https://github.com/rust-lang/infra-team/issues/188 r? `@marcoieni`
2025-05-22Rollup merge of #140868 - SpecificProtagonist:rustdoc-trait-impl-code-link, ↵Matthias Krüger-1/+30
r=notriddle rustdoc: Fix links with inline code in trait impl docs Fixes #140857
2025-05-22Rollup merge of #140431 - bend-n:dont_handle_bool_transmute, r=NadrierilMatthias Krüger-14/+7
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-22Auto merge of #137198 - tgross35:cfg-match-rename, r=Amanieubors-60/+60
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-21Auto merge of #141366 - matthiaskrgr:rollup-utvtyy3, r=matthiaskrgrbors-81/+203
Rollup of 8 pull requests Successful merges: - #140526 (docs: Specify that common sort functions sort in an ascending direction) - #141230 (std: fix doctest and explain for `as_slices` and `as_mut_slices` in `VecDeque`) - #141341 (limit impls of `VaArgSafe` to just types that are actually safe) - #141347 (incorrectly prefer builtin `dyn` impls :3) - #141351 (Move -Zcrate-attr injection to just after crate root parsing) - #141356 (lower bodies' params to thir before the body's value) - #141357 (`unpretty=thir-tree`: don't require the final expr to be the body's value) - #141363 (Document why we allow escaping bound vars in LTA norm) r? `@ghost` `@rustbot` modify labels: rollup
2025-05-21add doc alias `replace_first` for `str::replacen`waffle-0/+1
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-10/+11
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/+75
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-21Rollup merge of #141341 - folkertdev:limit-VaArgSafe-impls, r=workingjubileeMatthias Krüger-34/+52
limit impls of `VaArgSafe` to just types that are actually safe tracking issue: https://github.com/rust-lang/rust/issues/44930 Retrieving 8- or 16-bit integer arguments from a `VaList` is not safe, because such types are subject to upcasting. See https://github.com/rust-lang/rust/issues/61275#issuecomment-2193942535 for more detail. This PR also makes the instances of `VaArgSafe` visible in the documentation, and uses a private sealed trait to make sure users cannot create additional impls of `VaArgSafe`, which would almost certainly cause UB. r? `@workingjubilee`
2025-05-21Rollup merge of #141230 - xizheyin:issue-141217, r=tgross35Matthias Krüger-5/+28
std: fix doctest and explain for `as_slices` and `as_mut_slices` in `VecDeque` Fixes #141217 r? libs
2025-05-21Rollup merge of #140526 - Natr1x:sort-direction-documentation, r=dtolnayMatthias Krüger-9/+12
docs: Specify that common sort functions sort in an ascending direction From [forum discussion](https://users.rust-lang.org/t/is-there-a-way-to-sort-a-slice-in-specifically-ascending-or-descending-order/128998?u=natr1x) it seems like the sorting direction can be expected to always be ascending (in terms of `cmp::Ordering`). If this is the case then it would be nice to have this stated in the documentation.
2025-05-21rustdoc-json: Remove false docs and add test for inline attributeAlona Enraght-Moony-7/+12
The docs about how `#[inline]` was represented isn't true. Updates the comment, and adds a test. CC https://www.github.com/rust-lang/rust/issues/137645
2025-05-21Auto merge of #141343 - flip1995:clippy-subtree-update, r=Manishearthbors-4620/+6166
Clippy subtree update Out of cycle sync to fix an ICE that was reported twice already: https://github.com/rust-lang/rust-clippy/issues/14828 r? `@Manishearth`
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-36/+240
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-10/+11
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-21std: fix doctest and explain for as_slices and as_mut_slices in VecDequexizheyin-5/+28
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-05-21fix better_any breakage by making the solver more unsoundlcnr-2/+75
2025-05-21Rollup merge of #141334 - lcnr:coerce-nested-obligations, r=compiler-errorsMatthias Krüger-3/+47
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/+58
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/+11
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-3/+39
r=oli-obk When AsyncDrop impl is empty, sync drop generated in elaborator Fixes #140974.
2025-05-21Rollup merge of #141296 - ↵Matthias Krüger-11/+20
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.
2025-05-21Rollup merge of #141280 - Kobzol:docker-rust-lang-cache, r=marcoieniMatthias Krüger-3/+2
Use Docker cache from the current repository This is needed to make the cache work after moving CI from the `rust-lang-ci` org to `rust-lang`. Shouldn't be merged until we actually move bors. Context: https://github.com/rust-lang/infra-team/issues/188 r? `@marcoieni`
2025-05-21Rollup merge of #141267 - dianne:fix-141265, r=oli-obkMatthias Krüger-1/+63
only resolve top-level guard patterns' guards once We resolve guard patterns' guards in `resolve_pattern_inner`, so to avoid resolving them multiple times, we must avoid doing so earlier. To accomplish this, `LateResolutionVisitor::visit_pat` contains a case for guard patterns that avoids visiting their guards while walking patterns. This PR fixes #141265, which was due to `visit::walk_pat` being used instead; this meant guards at the top level of a pattern would be visited twice. e.g. it would ICE on `for x if x in [] {}`, but not `for (x if x) in [] {}`. `visit_pat` was already used for the guard pattern in the second example, on account of the top-level pattern being parens.
2025-05-21limit impls of `VaArgSafe` to just types that are actually safeFolkert de Vries-34/+52
8 and 16-bit integers are subject to upcasting in C, and hence are not reliably safe. users should perform their own casting and deal with the consequences
2025-05-21Auto merge of #140386 - oli-obk:match-on-lang-item-kind, r=compiler-errorsbors-85/+91
Match on lang item kind instead of using an if/else chain Similar to how the new solver does this. Just noticed while I was adding a new entry to the chain 😆
2025-05-21Update Cargo.lockPhilipp Krones-8/+0
2025-05-21Merge commit 'cadf98bb7d783e2ea3572446c3f80d3592ec5f86' into ↵Philipp Krones-4612/+6166
clippy-subtree-update
2025-05-21Rustup (#14860)Philipp Krones-23/+35
r? @ghost Quick out-of cycle sync to fix an ICE that was already reported twice changelog: none
2025-05-21Bump nightly version -> 2025-05-21Philipp Krones-5/+12
2025-05-21Merge remote-tracking branch 'upstream/master' into rustupPhilipp Krones-4628/+6209
2025-05-21bump stdarchRalf Jung-0/+0
2025-05-21Async drop fix for 'broken mir in AsyncDropGlue, place has deref as a later ↵Andrew Zhogin-11/+20
projection' (#140975)
2025-05-21When AsyncDrop impl is empty, sync drop generated in elaborator (Fixes #140974)Andrew Zhogin-3/+39
2025-05-21Add bors environment to CIJakub Beránek-0/+9
This will be used to access secrets once we move off rust-lang-ci.
2025-05-21eagerly check nested obligations when coercing fndefslcnr-3/+47
2025-05-21Auto merge of #141331 - matthiaskrgr:rollup-k0loxj6, r=matthiaskrgrbors-201/+277
Rollup of 7 pull requests Successful merges: - #137759 (Add `std::os::unix::process::CommandExt::chroot` to safely chroot a child process) - #140994 (replace `cc_detect::cc2ar` with `cc::try_get_archiver`) - #141213 (Suggest use "{}", self.x instead of {self.x} when resolve x as field of `self`) - #141283 (Allow `x perf` to find rustc.exe on Windows) - #141284 (Allow trailing comma after argument in query definition) - #141317 (typeck: catch `continue`s pointing to blocks) - #141318 (Avoid creating an empty identifer in `Symbol::to_ident_string`.) r? `@ghost` `@rustbot` modify labels: rollup