about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2025-02-03Rollup merge of #136476 - jieyouxu:panic-panic-panic, r=lcnrMatthias Krüger-19/+7
Remove generic `//@ ignore-{wasm,wasm32,emscripten}` in tests Follow-up to #135926. In favor of capability-based guards `//@ needs-{unwind,subprocess}`. Resolves #135923. r? ``@ghost`` try-job: test-various
2025-02-03Rollup merge of #136430 - FedericoBruzzone:follow-up-136180, r=oli-obkMatthias Krüger-78/+79
Use the type-level constant value `ty::Value` where needed **Follow-up to #136180** ### Summary This PR refactors functions to accept a single type-level constant value `ty::Value` instead of separate `ty::ValTree` and `ty::Ty` parameters: - `valtree_to_const_value`: now takes `ty::Value` - `pretty_print_const_valtree`: now takes `ty::Value` - Uses `pretty_print_const_valtree` for formatting valtrees when `visit_const_operand` - Moves `try_to_raw_bytes` from `ty::Valtree` to `ty::Value` --- r? ``@lukas-code`` ``@oli-obk``
2025-02-03Rollup merge of #136411 - dtolnay:fnptr, r=notriddleMatthias Krüger-12/+34
Omit argument names from function pointers that do not have argument names This matches the style used for the vast majority of function pointer types in real-world code, in my experience. Prefixing `_: ` to every argument does not improve clarity. **Before:** <img src="https://github.com/user-attachments/assets/f07efa8b-d57e-4897-aa97-40db7d207862"> **After:** <img src="https://github.com/user-attachments/assets/8405e08b-d6d2-4904-bcc3-a3eb866cecf0">
2025-02-03Rollup merge of #136299 - lqd:polonius-next-episode-9, r=jackh726Matthias Krüger-152/+376
Ignore NLL boring locals in polonius diagnostics Another easy one ``@jackh726`` (the diff is inflated by blessed test expectations don't worry :) NLLs don't compute liveness for boring locals, and therefore cannot find them in causes explaining borrows. In polonius, we don't have this liveness optimization (we may be able to do something partially similar in the future, e.g. for function parameters and the like), so we do encounter these in diagnostics even though we don't want to. This PR: - restructures the polonius context into per-phase data, in spirit as you requested in an earlier review - stores the locals NLLs would consider boring into the errors/diagnostics data - ignores these if a boring local is found when trying to explain borrows This PR fixes around 80 cases of diagnostics differences between `-Zpolonius=next` and NLLs. I've also added explicit revisions to a few polonius tests (both for the in-tree implementation as well as the datalog implementation -- even if we'll eventually remove them). I didn't do this for all the "dead" expectations that were removed from #136112 for that same reason, it's fine. I'll soon/eventually add explicit revisions where they're needed: there's only a handful of tests left to fix. r? ``@jackh726``
2025-02-03Rollup merge of #136289 - Pyr0de:oncecell-docs, r=tgross35Matthias Krüger-54/+64
OnceCell & OnceLock docs: Using (un)initialized consistently Changed * `set` / `initialize` / `full` to `initialized state` * `uninitialize` / `empty` to `uninitialized state` * `f` to `f()` * Added explaination of `uninitialized state` & `initialized state` [OnceCell Docs](https://doc.rust-lang.org/nightly/std/cell/struct.OnceCell.html) [OnceLock Docs](https://doc.rust-lang.org/nightly/std/sync/struct.OnceLock.html) Fixes #85716 ``@rustbot`` label +A-docs
2025-02-03Move `try_to_raw_bytes` from `ty::Valtree` to `ty::Value`FedericoBruzzone-38/+36
Signed-off-by: FedericoBruzzone <federico.bruzzone.i@gmail.com>
2025-02-03Auto merge of #136481 - jieyouxu:rollup-w0lnnqb, r=jieyouxubors-143/+251
Rollup of 8 pull requests Successful merges: - #136356 (Docs for f16 and f128: correct a typo and add details) - #136404 (Remove a footgun-y feature / relic of the past from the compiletest DSL) - #136432 (LTA: Actually check where-clauses for well-formedness at the def site) - #136438 (miri: improve error when offset_from preconditions are violated) - #136441 ([`compiletest`-related cleanups 1/7] Cleanup `is_rustdoc` logic and remove a useless path join in rustdoc-json runtest logic) - #136455 (Remove some `Clone` bounds and derives.) - #136464 (Remove hook calling via `TyCtxtAt`.) - #136467 (override default config profile on tarballs) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-03tests: remove redundant `//@ ignore-{wasm,wasm32,emscripten}`许杰友 Jieyou Xu (Joe)-19/+7
2025-02-03Auto merge of #136352 - lqd:ensure-stacks, r=compiler-errorsbors-6/+12
Add a couple of missing `ensure_sufficient_stacks` r? `@saethlin` I hope you didn't spend time on this already. (I couldn't sleep, opened `check_tail_calls`, there was a single call where it could happen, might as well fix it) This PR adds a couple of missing `ensure_sufficient_stack`s: - one in `check_tail_calls` that prevented the #135709 backport on some targets. - after that was fixed, the test still didn't pass starting at 4MB, so I also added one in `check_unsafety` and that made it pass. I didn't add an `rmake` test purposefully limiting the min stack size on `issue-74564-if-expr-stack-overflow.rs`, but we could if we wanted to. On `apple-aarch64-darwin`, this is enough to make `RUST_MIN_STACK=$((1024*1024*3)) ./x test tests/ui --test-args tests/ui/issues/issue-74564-if-expr-stack-overflow.rs` pass for me locally, and it does stack overflow otherwise.
2025-02-03Refactor using the type-level constant value `ty::Value`FedericoBruzzone-59/+62
Signed-off-by: FedericoBruzzone <federico.bruzzone.i@gmail.com>
2025-02-03OnceCell & OnceLock docs: Using (un)initialized consistentlyPyrode-54/+64
2025-02-03Rollup merge of #136467 - onur-ozkan:override-default-profile-on-tarballs, ↵许杰友 Jieyou Xu (Joe)-1/+8
r=jieyouxu override default config profile on tarballs This is the same logic used in the Python script https://github.com/rust-lang/rust/blob/613bdd49978298648ed05ace086bd1ecad54b44a/src/bootstrap/bootstrap.py#L1273-L1274
2025-02-03Rollup merge of #136464 - nnethercote:rm-TyCtxtAt-for-hooks, r=oli-obk许杰友 Jieyou Xu (Joe)-38/+21
Remove hook calling via `TyCtxtAt`. All hooks receive a `TyCtxtAt` argument. Currently hooks can be called through `TyCtxtAt` or `TyCtxt`. In the latter case, a `TyCtxtAt` is constructed with a dummy span and passed to the hook. However, in practice hooks are never called through `TyCtxtAt`, and always receive a dummy span. (I confirmed this via code inspection, and double-checked it by temporarily making the `TyCtxtAt` code path panic and running all the tests.) This commit removes all the `TyCtxtAt` machinery for hooks. All hooks now receive `TyCtxt` instead of `TyCtxtAt`. There are two existing hooks that use `TyCtxtAt::span`: `const_caller_location_provider` and `try_destructure_mir_constant_for_user_output`. For both hooks the span is always a dummy span, probably unintentionally. This dummy span use is now explicit. If a non-dummy span is needed for these two hooks it would be easy to add it as an extra argument because hooks are less constrained than queries. r? `@oli-obk`
2025-02-03Rollup merge of #136455 - nnethercote:less-Clone, r=compiler-errors许杰友 Jieyou Xu (Joe)-24/+24
Remove some `Clone` bounds and derives. r? `@cjgillot`
2025-02-03Rollup merge of #136441 - jieyouxu:cleanup-is-rustdoc, r=compiler-errors许杰友 Jieyou Xu (Joe)-5/+2
[`compiletest`-related cleanups 1/7] Cleanup `is_rustdoc` logic and remove a useless path join in rustdoc-json runtest logic Reference for overall changes: https://github.com/rust-lang/rust/pull/136437 Part **1** of **7** of the *`compiletest`-related cleanups* PR series. ### Summary - Don't match on path when we already have test suite names. - Remove a useless path join. r? bootstrap (or compiler)
2025-02-03Rollup merge of #136438 - RalfJung:offset_from_ub_errors, r=oli-obk许杰友 Jieyou Xu (Joe)-19/+81
miri: improve error when offset_from preconditions are violated Fixes https://github.com/rust-lang/miri/issues/4143
2025-02-03Rollup merge of #136432 - fmease:lta-fix-def-site-checks, r=compiler-errors许杰友 Jieyou Xu (Joe)-11/+78
LTA: Actually check where-clauses for well-formedness at the def site All of the added tests used to wrongfully pass. r? oli-obk or types/compiler or reassign
2025-02-03Rollup merge of #136404 - fmease:rm-compiletest-relic-of-the-past, ↵许杰友 Jieyou Xu (Joe)-38/+30
r=Noratrieb,jieyouxu Remove a footgun-y feature / relic of the past from the compiletest DSL The compiletest DSL still features a historical remnant from the time when its directives were merely prefixed with `//` instead of `//`@`` when unknown directive names weren't rejected since they could just as well be part of prose: As an "optimization", it stops looking for directives once it stumbles upon a line which starts with either `fn` or `mod`. This is super footgun-y as it obviously leads to any seeming compiletest directives below `fn` and `mod` items getting completely ignored. See #136403 for a practical example. As well the assembly test updated in this PR. ~~Blocked on #136403.~~ (merged)
2025-02-03Rollup merge of #136356 - pthariensflame:patch-1, r=tgross35许杰友 Jieyou Xu (Joe)-7/+7
Docs for f16 and f128: correct a typo and add details CC: #116909; corrects and expands #124750.
2025-02-03Auto merge of #136413 - EnzymeAD:fix-autodiff-comptime-regression, r=oli-obkbors-10/+10
fix autodiff compile time regression Tries to fix the regression from https://github.com/rust-lang/rust/pull/133429 Tracking: - https://github.com/rust-lang/rust/issues/124509
2025-02-03Auto merge of #133138 - azhogin:azhogin/target-modifiers, r=davidtwco,saethlinbors-24/+666
Target modifiers (special marked options) are recorded in metainfo Target modifiers (special marked options) are recorded in metainfo and compared to be equal in different linked crates. PR for this RFC: https://github.com/rust-lang/rfcs/pull/3716 Option may be marked as `TARGET_MODIFIER`, example: `regparm: Option<u32> = (None, parse_opt_number, [TRACKED TARGET_MODIFIER]`. If an TARGET_MODIFIER-marked option has non-default value, it will be recorded in crate metainfo as a `Vec<TargetModifier>`: ``` pub struct TargetModifier { pub opt: OptionsTargetModifiers, pub value_name: String, } ``` OptionsTargetModifiers is a macro-generated enum. Option value code (for comparison) is generated using `Debug` trait. Error example: ``` error: mixing `-Zregparm` will cause an ABI mismatch in crate `incompatible_regparm` --> $DIR/incompatible_regparm.rs:10:1 | LL | #![crate_type = "lib"] | ^ | = help: the `-Zregparm` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely = note: `-Zregparm=1` in this crate is incompatible with `-Zregparm=2` in dependency `wrong_regparm` = help: set `-Zregparm=2` in this crate or `-Zregparm=1` in `wrong_regparm` = help: if you are sure this will not cause problems, use `-Cunsafe-allow-abi-mismatch=regparm` to silence this error error: aborting due to 1 previous error ``` `-Cunsafe-allow-abi-mismatch=regparm,reg-struct-return` to disable list of flags.
2025-02-03override default config profile on tarballsonur-ozkan-1/+8
This is the same logic used in the Python script https://github.com/rust-lang/rust/blob/613bdd49978298648ed05ace086bd1ecad54b44a/src/bootstrap/bootstrap.py#L1273-L1274 Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-02-03Remove hook calling via `TyCtxtAt`.Nicholas Nethercote-38/+21
All hooks receive a `TyCtxtAt` argument. Currently hooks can be called through `TyCtxtAt` or `TyCtxt`. In the latter case, a `TyCtxtAt` is constructed with a dummy span and passed to the hook. However, in practice hooks are never called through `TyCtxtAt`, and always receive a dummy span. (I confirmed this via code inspection, and double-checked it by temporarily making the `TyCtxtAt` code path panic and running all the tests.) This commit removes all the `TyCtxtAt` machinery for hooks. All hooks now receive `TyCtxt` instead of `TyCtxtAt`. There are two existing hooks that use `TyCtxtAt::span`: `const_caller_location_provider` and `try_destructure_mir_constant_for_user_output`. For both hooks the span is always a dummy span, probably unintentionally. This dummy span use is now explicit. If a non-dummy span is needed for these two hooks it would be easy to add it as an extra argument because hooks are less constrained than queries.
2025-02-03Remove a footgun-y feature / relic of the past from the compiletest DSLLeón Orell Valerian Liehr-38/+30
2025-02-02Docs for f16 and f128: correct a typo and add detailsLaine Taffin Altman-7/+7
2025-02-03LTA: Check where-clauses for well-formedness at the def siteLeón Orell Valerian Liehr-11/+78
2025-02-02Auto merge of #136454 - matthiaskrgr:rollup-ewejzmp, r=matthiaskrgrbors-734/+1935
Rollup of 8 pull requests Successful merges: - #136145 (Test validity of pattern types) - #136339 (CompileTest: Add Directives to Ignore `arm-unknown-*` Targets) - #136403 (Fix malformed error annotations in a UI test) - #136414 (Shorten error message for callable with wrong return type) - #136425 (Move `rustc_middle::infer::unify_key`) - #136426 (Explain why we retroactively change a static initializer to have a different type) - #136445 (Couple of cleanups to DiagCtxt and EarlyDiagCtxt) - #136452 (Miri subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-03Derive `Clone` on fewer THIR types.Nicholas Nethercote-22/+22
Some of these were never necessary, and some were facilitated by the previous commit.
2025-02-03`TypeVisitable` doesn't require `Clone`.Nicholas Nethercote-2/+2
`TypeFoldable` does, because it involves the production of new values. But `TypeVisitable` only involves the visiting of values.
2025-02-02Rollup merge of #136452 - RalfJung:miri-sync, r=RalfJungMatthias Krüger-568/+1477
Miri subtree update r? `@ghost` Unblocks https://github.com/rust-lang/rust/pull/122408 from the Miri side
2025-02-02Rollup merge of #136445 - bjorn3:diag_ctxt_cleanup, r=oli-obkMatthias Krüger-111/+63
Couple of cleanups to DiagCtxt and EarlyDiagCtxt
2025-02-02Rollup merge of #136426 - oli-obk:push-nkpuulwurykn, r=compiler-errorsMatthias Krüger-2/+8
Explain why we retroactively change a static initializer to have a different type I keep getting confused about it and in turn confused `@GuillaumeGomez` while trying to explain it badly
2025-02-02Rollup merge of #136425 - nnethercote:mv-rustc_middle-infer, r=lcnrMatthias Krüger-18/+14
Move `rustc_middle::infer::unify_key` `rustc_infer` is a much better place for it. r? `@lcnr`
2025-02-02Rollup merge of #136414 - estebank:expected-return-type, r=oli-obkMatthias Krüger-31/+29
Shorten error message for callable with wrong return type ``` error: expected `{closure@...}` to return `Ret`, but it returns `Other` ``` instead of ``` error: expected `{closure@...}` to be a closure that returns `Ret`, but it returns `Other` ```
2025-02-02Rollup merge of #136403 - fmease:fix-a-ui-test, r=oli-obkMatthias Krüger-2/+2
Fix malformed error annotations in a UI test The compiletest DSL still features a historical remnant from the time when its directives were merely prefixed with `//` instead of `//`@`` when unknown directive names weren't rejected since they could just as well be part of prose: As an "optimization", it stops looking for directives once it stumbles upon a line which starts with either `fn` or `mod`. This allowed a malformed error annotation of the form `//`@[…]~^^^`` to go undetected & unexercised (as it's placed below `fn main() {`). Obviously a character other than ``@`` would've mangled the error annotation, too (but it might've caught the reviewer's eye). I specifically found this file because I ran `rg '^(fn|mod)[\s\S]*?//`@'` tests/ui --multiline -trust` to check how footgun-y that "special feature" of compiletest is.
2025-02-02Rollup merge of #136339 - veera-sivarajan:ignore-arm-unknown-headers, r=jieyouxuMatthias Krüger-0/+4
CompileTest: Add Directives to Ignore `arm-unknown-*` Targets In #134626, I want to ignore `arm-unknown-*` targets because the LLVM IR for those looks very different compared to other targets: https://rust.godbolt.org/z/ssYMhdv4x. I can use `ignore-arm` but, I think, it would exclude large number of Apple devices. So this PR adds a few directives to ignore `arm-unknown-*` targets specifically.
2025-02-02Rollup merge of #136145 - oli-obk:push-wxvpklmkppqz, r=RalfJungMatthias Krüger-2/+338
Test validity of pattern types r? `@RalfJung` pulled out of #136006 so we don't have to rely on libcore types excercising this code path There's nothing to fix. `rustc_layout_scalar_valid_range_start` structs just failed their validation on their value instead of their fields' value, causing a diff where moving to pattern types adds an additional `.0` field access to the validation error
2025-02-02update lockfileRalf Jung-23/+130
2025-02-02Merge pull request #4142 from joboet/apple-futexRalf Jung-53/+626
shim Apple's futex primitives
2025-02-02Maintain a list of types permitted per patternOli Scherer-2/+211
2025-02-02Check the base type of pattern types for validity firstOli Scherer-6/+5
2025-02-02shim Apple's futex primitivesjoboet-53/+626
This is necessary to unblock rust-lang/rust#122408. The documentation for these is available [here](https://developer.apple.com/documentation/os/os_sync_wait_on_address?language=objc). Because the futex wait operations (`os_sync_wait_on_address` et al.) return the number of remaining waiters after returning, this required some changes to the common futex infrastructure, which I've changed to take a callback instead of precalculating the return values.
2025-02-02Test validity of pattern typesOli Scherer-0/+128
2025-02-02Merge pull request #4172 from RalfJung/miri_get_backtraceRalf Jung-51/+14
miri_get_backtrace: stop supporting the v0 protocol
2025-02-02Merge pull request #4174 from RalfJung/read-write-callbackRalf Jung-138/+158
files: make read/write take callback to store result
2025-02-02Auto merge of #136448 - matthiaskrgr:rollup-pdim5di, r=matthiaskrgrbors-1180/+775
Rollup of 7 pull requests Successful merges: - #134272 (Remove rustc_encodable_decodable feature) - #136283 (Update encode_utf16 to mention it is native endian) - #136394 (Clean up MonoItem::instantiation_mode) - #136402 (diagnostics: fix borrowck suggestions for if/while let conditionals) - #136415 (Highlight clarifying information in "expected/found" error) - #136422 (Convert two `rustc_middle::lint` functions to `Span` methods.) - #136434 (rustc_allowed_through_unstable_modules: require deprecation message) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-02Rollup merge of #136434 - ↵Matthias Krüger-125/+107
RalfJung:rustc_allowed_through_unstable_modules-deprecation-required, r=compiler-errors rustc_allowed_through_unstable_modules: require deprecation message This changes the `#[rustc_allowed_through_unstable_modules]` attribute so that a deprecation message (ideally directing people towards the stable path) is required.
2025-02-02Rollup merge of #136422 - nnethercote:convert-lint-functions, r=NoratriebMatthias Krüger-278/+179
Convert two `rustc_middle::lint` functions to `Span` methods. `rustc_middle` is a huge crate and it's always good to move stuff out of it. There are lots of similar methods already on `Span`, so these two functions, `in_external_macro` and `is_from_async_await`, fit right in. The diff is big because `in_external_macro` is used a lot by clippy lints. r? ``@Noratrieb``
2025-02-02Rollup merge of #136415 - estebank:highlight-clarification, r=compiler-errorsMatthias Krüger-27/+160
Highlight clarifying information in "expected/found" error When the expected and found types have the same textual representation, we add clarifying in parentheses. We now visually highlight it in the output. Detect a corner case where the clarifying information would be the same for both types and skip it, as it doesn't add anything useful. ![Screenshot of the rustc highlighted output on the terminal](https://github.com/user-attachments/assets/aa4b9433-5332-4941-b2c2-1a43e5cadff7)
2025-02-02Rollup merge of #136402 - notriddle:notriddle/let-expr-detector, ↵Matthias Krüger-18/+227
r=compiler-errors diagnostics: fix borrowck suggestions for if/while let conditionals This code detects the case where one of the borrows is inside the let init expr while the other end is not. If that happens, we don't want to suggest adding a semicolon, because it won't work. Fixes #133941