about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2025-02-05Rollup merge of #136263 - notriddle:notriddle/typescript2, r=fmeaseLeón Orell Valerian Liehr-148/+156
rustdoc: clean up a bunch of ts-expected-error declarations in main This mostly consists of handling potentially-null input and adding more global functions to the list of globals. Follow-up for #136161
2025-02-05Rollup merge of #128045 - pnkfelix:rustc-contracts, r=oli-obkLeón Orell Valerian Liehr-1/+26
#[contracts::requires(...)] + #[contracts::ensures(...)] cc https://github.com/rust-lang/rust/issues/128044 Updated contract support: attribute syntax for preconditions and postconditions, implemented via a series of desugarings that culminates in: 1. a compile-time flag (`-Z contract-checks`) that, similar to `-Z ub-checks`, attempts to ensure that the decision of enabling/disabling contract checks is delayed until the end user program is compiled, 2. invocations of lang-items that handle invoking the precondition, building a checker for the post-condition, and invoking that post-condition checker at the return sites for the function, and 3. intrinsics for the actual evaluation of pre- and post-condition predicates that third-party verification tools can intercept and reinterpret for their own purposes (e.g. creating shims of behavior that abstract away the function body and replace it solely with the pre- and post-conditions). Known issues: * My original intent, as described in the MCP (https://github.com/rust-lang/compiler-team/issues/759) was to have a rustc-prefixed attribute namespace (like rustc_contracts::requires). But I could not get things working when I tried to do rewriting via a rustc-prefixed builtin attribute-macro. So for now it is called `contracts::requires`. * Our attribute macro machinery does not provide direct support for attribute arguments that are parsed like rust expressions. I spent some time trying to add that (e.g. something that would parse the attribute arguments as an AST while treating the remainder of the items as a token-tree), but its too big a lift for me to undertake. So instead I hacked in something approximating that goal, by semi-trivially desugaring the token-tree attribute contents into internal AST constucts. This may be too fragile for the long-term. * (In particular, it *definitely* breaks when you try to add a contract to a function like this: `fn foo1(x: i32) -> S<{ 23 }> { ... }`, because its token-tree based search for where to inject the internal AST constructs cannot immediately see that the `{ 23 }` is within a generics list. I think we can live for this for the short-term, i.e. land the work, and continue working on it while in parallel adding a new attribute variant that takes a token-tree attribute alongside an AST annotation, which would completely resolve the issue here.) * the *intent* of `-Z contract-checks` is that it behaves like `-Z ub-checks`, in that we do not prematurely commit to including or excluding the contract evaluation in upstream crates (most notably, `core` and `std`). But the current test suite does not actually *check* that this is the case. Ideally the test suite would be extended with a multi-crate test that explores the matrix of enabling/disabling contracts on both the upstream lib and final ("leaf") bin crates.
2025-02-05Auto merge of #136244 - yotamofek:pr/rustdoc-join-iter, r=GuillaumeGomezbors-205/+202
librustdoc: create a helper for separating elements of an iterator instead of implementing it multiple times This implements something similar to [`Itertools::format`](https://docs.rs/itertools/latest/itertools/trait.Itertools.html#method.format), but on `Fn`s returning iterators instead of directly on iterators, to allow implementing `Display` without the use of a `Cell` (to handle the possibility of `fmt` being called multiple times while receiving `&self`). ~This is WIP, I just want to get a perf run first to see if the regression I saw in #135494 is fixed~ This was originally part of #135494 , but originally caused a perf regression that was since fixed: https://github.com/rust-lang/rust/blob/7d5ae1863aa66847a4edf8d2ef9420717df65c5d/src/librustdoc/html/format.rs#L507
2025-02-04Remove a no-longer-correct FIXMEChayim Refael Friedman-1/+0
2025-02-04Fix incorrect terminologyChayim Refael Friedman-2/+2
Lifetimes are elided in function signatures, and inferred in bodies.
2025-02-04Refactor `TyLoweringContext::substs_from_args_and_bindings()` to always take ↵Chayim Refael Friedman-27/+18
a `GenericDefId`
2025-02-04Auto merge of #136549 - matthiaskrgr:rollup-sqbpgtd, r=matthiaskrgrbors-2/+18
Rollup of 7 pull requests Successful merges: - #136242 (Remove `LateContext::match_def_path()`) - #136274 (Check Sizedness of return type in WF) - #136284 (Allow using named consts in pattern types) - #136477 (Fix a couple NLL TLS spans ) - #136497 (Report generic mismatches when calling bodyless trait functions) - #136520 (Remove unnecessary layout assertions for object-safe receivers) - #136526 (mir_build: Rename `thir::cx::Cx` to `ThirBuildCx` and remove `UserAnnotatedTyHelpers`) Failed merges: - #136304 (Reject negative literals for unsigned or char types in pattern ranges and literals) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-04Document minimum supported host tooling on macOSMads Marquart-0/+12
2025-02-04Merge pull request #19095 from ChayimFriedman2/fixme-adt_const_paramsChayim Refael Friedman-0/+1
minor: Add a FIXME for feature(adt_const_params)
2025-02-04Add a FIXME for feature(adt_const_params)Chayim Refael Friedman-0/+1
2025-02-04Rollup merge of #136284 - oli-obk:push-zsxuwnzmonnl, r=lcnrMatthias Krüger-2/+18
Allow using named consts in pattern types This required a refactoring first: I had to stop using `hir::Pat`in `hir::TyKind::Pat` and instead create a separate `TyPat` that has `ConstArg` for range ends instead of `PatExpr`. Within the type system we should be using `ConstArg` for all constants, as otherwise we'd be maintaining two separate const systems that could diverge. The big advantage of this PR is that we now inherit all the rules from const generics and don't have a separate system. While this makes things harder for users (const generic rules wrt what is allowed in those consts), it also means we don't accidentally allow some things like referring to assoc consts or doing math on generic consts.
2025-02-04Auto merge of #135760 - scottmcm:disjoint-bitor, r=WaffleLapkinbors-0/+20
Add `unchecked_disjoint_bitor` per ACP373 Following the names from libs-api in https://github.com/rust-lang/libs-team/issues/373#issuecomment-2085686057 Includes a fallback implementation so this doesn't have to update cg_clif or cg_gcc, and overrides it in cg_llvm to use `or disjoint`, which [is available in LLVM 18](https://releases.llvm.org/18.1.0/docs/LangRef.html#or-instruction) so hopefully we don't need any version checks.
2025-02-04Fix a failing testChayim Refael Friedman-2/+20
The reason this test passed previously is not because it was working as intended, but because prior to the previous commit we did not resolve the `use` at all! Now, `use self as _` is invalid code anyway (it prints E0429), and because we fallback to the value namespace if we can't resolve in the type namespace (which is a reasonable behavior), this test now actually fails. I don't think we want to change the fallback, so I removed `use self as _` and instead added a new test, where the value can be resolved in the type namespace.
2025-02-04Fix IDE resolution of `use` inside a bodyChayim Refael Friedman-1/+23
We stopped the expression search too early because `use` is an item.
2025-02-04Make `rust-analyzer.files.excludeDirs` work, actuallyChayim Refael Friedman-11/+46
I have no idea what the original writer of the code thought but the logic just seems backwards. We should not exclude a file/directory if it is equal to an include! This also meant that we had to add a `root == path` check so this stuff will actually work, which in turn meant excludes (of root files) no longer worked... Also rename if to `rust-analyzer.files.exclude`, because it can exclude files as well.
2025-02-04Merge pull request #19083 from he32/fix-arm64-beLaurențiu Nicola-4/+8
line-index: don't try to use (unavailable) neon on big-endian aarch64
2025-02-04intrinsics: unify rint, roundeven, nearbyint in a single round_ties_even ↵Ralf Jung-8/+8
intrinsic
2025-02-04line-index: don't try to use neon on big-endian aarch64.Havard Eidnes-4/+8
2025-02-04Merge pull request #19093 from Veykril/push-lrvoookylnxpLukas Wirth-10/+17
Prevent panics from tearing down worker threads
2025-02-04Prevent panics from tearing down worker threadsLukas Wirth-10/+17
2025-02-04Merge pull request #19084 from Veykril/push-muworpzpzqupLukas Wirth-66/+126
Split cache priming into distinct phases
2025-02-04Expose symbol of `CrateName`Lukas Wirth-34/+33
2025-02-04Rename and Move some UI tests to more suitable subdirsDuskyElf-16/+1
2025-02-04update JSON target spec to declare softfloat ABIRalf Jung-0/+1
2025-02-04Rollup merge of #136334 - ricci009:primitivers, r=tgross35Jacob Pratt-1/+2
Extract `core::ffi` primitives to a separate (internal) module ### Introduce library/core/src/ffi/primitives.rs The regex preprocessing for PR #133944 would be more robust if the relevant types from core/src/ffi/mod.rs were first moved to library/core/src/ffi/primitives.rs, then there isn't a need to deal with traits / c_str / va_list / whatever might wind up in that module in the future r? `@tgross35`
2025-02-04Rollup merge of #136167 - pitaj:new_range, r=NadrierilJacob Pratt-0/+9
Implement unstable `new_range` feature Switches `a..b`, `a..`, and `a..=b` to resolve to the new range types. For rust-lang/rfcs#3550 Tracking issue #123741 also adds the re-export that was missed in the original implementation of `new_range_api`
2025-02-04Rollup merge of #135844 - yaahc:tidy-feature-status-dump, r=jieyouxuJacob Pratt-0/+107
Add new tool for dumping feature status based on tidy sequel to https://github.com/rust-lang/rust/pull/133514 meaning ... supercedes https://github.com/rust-lang/rust/pull/133351 part of https://github.com/rust-lang/rust/issues/129485 r? `@jieyouxu` cc `@estebank`
2025-02-04librustdoc: create a helper for separating elements of an iterator instead ↵Yotam Ofek-205/+202
of implementing it multiple times
2025-02-04Merge pull request #2243 from Kobzol/pull-cron许杰友 Jieyou Xu (Joe)-2/+2
2025-02-04bootstrap: add wrapper macros for `tracing`-gated tracing macros许杰友 Jieyou Xu (Joe)-51/+99
- Add wrapper macros for `error!`, `warn!`, `info!`, `debug!` and `trace!`, which `cfg(feature = "tracing")`-gates the underlying `tracing` macros. - This is not done for `span!` or `event!` because they can return span guards, and you can't really wrap that. - This is also not possible for `tracing::instrument` attribute proc-macro unless you use another attribute proc-macro to wrap that.
2025-02-04Auto merge of #136525 - matthiaskrgr:rollup-m8kqlek, r=matthiaskrgrbors-31/+42
Rollup of 6 pull requests Successful merges: - #134807 (fix(rustdoc): always use a channel when linking to doc.rust-lang.org) - #134814 (Add `kl` and `widekl` target features, and the feature gate) - #135836 (bootstrap: only build `crt{begin,end}.o` when compiling to MUSL) - #136022 (Port ui/simd tests to use the intrinsic macro) - #136309 (set rustc dylib on manually constructed rustc command) - #136462 (mir_build: Simplify `lower_pattern_range_endpoint`) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-04Rollup merge of #136309 - onur-ozkan:133629, r=jieyouxuMatthias Krüger-1/+5
set rustc dylib on manually constructed rustc command Fixes #133629
2025-02-04Rollup merge of #135836 - ferrocene:ja-gh135782-build-crt-only-for-musl, ↵Matthias Krüger-2/+8
r=onur-ozkan bootstrap: only build `crt{begin,end}.o` when compiling to MUSL only MUSL needs those objects and trying to compile them to other targets, e.g. Windows or macOS, will produce C compilation errors check the target before shelling out to the C compiler and tweak `make_run` to skip the actual C compilation when the target is not MUSL fixes #135782 see the linked issue for additional context
2025-02-04Rollup merge of #134807 - poliorcetics:ab/push-skpynvsmwkll, r=camelidMatthias Krüger-28/+29
fix(rustdoc): always use a channel when linking to doc.rust-lang.org Closes #131971 I manually checked the resulting links One issue is that this will create `nightly/...` links in places that formerly linked to stable, is that ok ? (the `slice` and `array` links in the search help notably)
2025-02-04Merge from rustcThe Miri Cronjob Bot-51/+103
2025-02-04Preparing for merge from rustcThe Miri Cronjob Bot-1/+1
2025-02-04Auto merge of #136507 - matthiaskrgr:rollup-uzwv9mo, r=matthiaskrgrbors-27/+40
Rollup of 8 pull requests Successful merges: - #136289 (OnceCell & OnceLock docs: Using (un)initialized consistently) - #136299 (Ignore NLL boring locals in polonius diagnostics) - #136411 (Omit argument names from function pointers that do not have argument names) - #136430 (Use the type-level constant value `ty::Value` where needed) - #136476 (Remove generic `//@ ignore-{wasm,wasm32,emscripten}` in tests) - #136484 (Notes on types/traits used for in-memory query caching) - #136493 (platform-support: document CPU baseline for x86-32 targets) - #136498 (Update books) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-03Auto merge of #136483 - marcoieni:dist-x86_64-msvc-windows-25, r=Kobzolbors-1/+1
ci: move dist-x86_64-msvc to windows 2025 try-job: dist-x86_64-msvc
2025-02-03Make the rustc-pull workflow run less oftenJakub Beránek-2/+2
2025-02-03primitive type migration from mod.rs to primitives.rsricci009-1/+2
2025-02-03Express contracts as part of function header and lower it to the contract ↵Celina G. Val-0/+20
lang items includes post-developed commit: do not suggest internal-only keywords as corrections to parse failures. includes post-developed commit: removed tabs that creeped in into rustfmt tool source code. includes post-developed commit, placating rustfmt self dogfooding. includes post-developed commit: add backquotes to prevent markdown checking from trying to treat an attr as a markdown hyperlink/ includes post-developed commit: fix lowering to keep contracts from being erroneously inherited by nested bodies (like closures). Rebase Conflicts: - compiler/rustc_parse/src/parser/diagnostics.rs - compiler/rustc_parse/src/parser/item.rs - compiler/rustc_span/src/hygiene.rs Remove contracts keywords from diagnostic messages
2025-02-03Contracts core intrinsics.Felix S. Klock II-1/+6
These are hooks to: 1. control whether contract checks are run 2. allow 3rd party tools to intercept and reintepret the results of running contracts.
2025-02-04Merge pull request #2242 from DuskyElf/master许杰友 Jieyou Xu (Joe)-1/+0
2025-02-03Rollup merge of #136498 - rustbot:docs-update, r=ehussMatthias Krüger-0/+0
Update books ## rust-lang/book 2 commits in fa312a343fbff01bc6cef393e326817f70719813..e2fa4316c5a7c0d2499c5d6b799adcfad6ef7a45 2025-02-03 15:02:07 UTC to 2025-02-01 17:33:39 UTC - Add missing word in ch17-04-streams.md (rust-lang/book#4218) - Fix typo in ch5.3 and in CONTRIBUTING.md (rust-lang/book#4216) ## rust-lang/edition-guide 2 commits in 4ed5a1a4a2a7ecc2e529a5baaef04f7bc7917eda..f56aecc3b036dff16404b525a83b00f911b9bbea 2025-02-03 17:14:16 UTC to 2025-01-31 17:44:00 UTC - Rustc{En,De}codable has been removed (rust-lang/edition-guide#353) - Remove rustfmt-overflow-delimited-expr (rust-lang/edition-guide#357) ## rust-lang/nomicon 3 commits in bc2298865544695c63454fc1f9f98a3dc22e9948..336f75835a6c0514852cc65aba9a698b699b13c8 2025-02-02 10:06:30 UTC to 2025-02-02 08:35:20 UTC - Improve grammar in exotic-sizes (rust-lang/nomicon#452) - other-reprs: Add details for n!=1 repr(packed) (rust-lang/nomicon#460) - Use `()` instead of `[u8; 0]` in opaque type (rust-lang/nomicon#456) ## rust-lang/reference 3 commits in 93b921c7d3213d38d920f7f905a3bec093d2217d..4249fb411dd27f945e2881eb0378044b94cee06f 2025-01-31 03:43:07 UTC to 2025-01-29 04:17:34 UTC - Add Spec Identifier Syntax to expressions.md and subchapters (rust-lang/reference#1591) - Exclude the test summary from the search index (rust-lang/reference#1723) - Spec inline assembly tests (rust-lang/reference#1648) ## rust-lang/rust-by-example 1 commits in 054259ed1bf01cdee4309ee764c7e103f6df3de5..743766929f1e53e72fab74394ae259bbfb4a7619 2025-02-02 19:53:31 UTC to 2025-02-02 19:53:31 UTC - Spanish translation to 1:2100 (rust-lang/rust-by-example#1910)
2025-02-03Rollup merge of #136493 - RalfJung:x86-platform-support, r=NoratriebMatthias Krüger-20/+20
platform-support: document CPU baseline for x86-32 targets Also fixes the footnote for i686-unknown-hurd-gnu (which has the bad case of the x87 issue since it uses a non-SSE baseline) and adds the missing footnote for i686-unknown-redox. Both of those targets break our usual pattern by not using the Pentium 4 baseline, but fixing that is a much larger change that I will not pursue (see [Zulip](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/x86-32.20target.20names)). Cc ``@bjorn3``
2025-02-03Rollup merge of #136411 - dtolnay:fnptr, r=notriddleMatthias Krüger-6/+20
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-1/+0
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-03overlong lineTshepang Mbambo-2/+4
2025-02-03Auto merge of #136146 - RalfJung:x86-abi, r=workingjubileebors-2/+2
Explicitly choose x86 softfloat/hardfloat ABI Part of https://github.com/rust-lang/rust/pull/135408: Instead of choosing this based on the target features listed in the target spec, make that choice explicit. All built-in targets are being updated here; custom (JSON-defined) x86 (32bit and 64bit) softfloat targets need to explicitly set `rustc-abi` to `x86-softfloat`.
2025-02-04Remove "Port run-make tests from Make to Rust" tracking issue from Recurring ↵Rehmatpal Singh-1/+0
work