| Age | Commit message (Collapse) | Author | Lines |
|
r=notriddle
rustdoc: make settings checkboxes always square
Previously, checkboxes would flex horizontally on small screens:

this simple css tweak fixes this.
|
|
Apply requested API changes to `cell_update`
Do the following:
* Switch to `impl FnOnce` rather than a generic `F`.
* Change `update` to return nothing.
This was discussed at a libs-api meeting [1].
Tracking issue: https://github.com/rust-lang/rust/issues/50186
[1]: https://github.com/rust-lang/rust/pull/134446#issuecomment-2770842949
|
|
unstable book: document import_trait_associated_functions
Documents https://github.com/rust-lang/rust/issues/134691 which was implemented in https://github.com/rust-lang/rust/pull/134754
|
|
slice: Remove some uses of unsafe in first/last chunk methods
Remove unsafe `split_at_unchecked` and `split_at_mut_unchecked` in some slice `split_first_chunk`/`split_last_chunk` methods.
Replace those calls with the safe `split_at` and `split_at_checked` where applicable.
Add codegen tests to check for no panics when calculating the last chunk index using `checked_sub` and `split_at`.
Better viewed with whitespace disabled in diff view
---
The unchecked calls are mostly manual implementations of the safe methods, but with the safety condition negated from `mid <= len` to `len < mid`.
```rust
if self.len() < N {
None
} else {
// SAFETY: We manually verified the bounds of the split.
let (first, tail) = unsafe { self.split_at_unchecked(N) };
// Or for the last_chunk methods
let (init, last) = unsafe { self.split_at_unchecked(self.len() - N) };
```
Unsafe is still needed for the pointer array casts. Their safety comments are unmodified.
|
|
Experimental feature gate for `super let`
This adds an experimental feature gate, `#![feature(super_let)]`, for the `super let` experiment.
Tracking issue: https://github.com/rust-lang/rust/issues/139076
Liaison: ``@nikomatsakis``
## Description
There's a rough (inaccurate) description here: https://blog.m-ou.se/super-let/
In short, `super let` allows you to define something that lives long enough to be borrowed by the tail expression of the block. For example:
```rust
let a = {
super let b = temp();
&b
};
```
Here, `b` is extended to live as long as `a`, similar to how in `let a = &temp();`, the temporary will be extended to live as long as `a`.
## Properties
During the temporary lifetimes work we did last year, we explored the properties of "super let" and concluded that the fundamental property should be that these two are always equivalent in any context:
1. `& $expr`
2. `{ super let a = & $expr; a }`
And, additionally, that these are equivalent in any context when `$expr` is a temporary (aka rvalue):
1. `& $expr`
2. `{ super let a = $expr; & a }`
This makes it possible to give a name to a temporary without affecting how temporary lifetimes work, such that a macro can transparently use a block in its expansion, without that having any effect on the outside.
## Implementing pin!() correctly
With `super let`, we can properly implement the `pin!()` macro without hacks: :sparkles:
```rust
pub macro pin($value:expr $(,)?) {
{
super let mut pinned = $value;
unsafe { $crate::pin::Pin::new_unchecked(&mut pinned) }
}
}
```
This is important, as there is currently no way to express it without hacks in Rust 2021 and before (see [hacky definition](https://github.com/rust-lang/rust/blob/2a06022951893fe5b5384f8dbd75b4e6e3b5cee0/library/core/src/pin.rs#L1947)), and no way to express it at all in Rust 2024 (see [issue](https://github.com/rust-lang/rust/issues/138718)).
## Fixing format_args!()
This will also allow us to express `format_args!()` in a way where one can assign the result to a variable, fixing a [long standing issue](https://github.com/rust-lang/rust/issues/92698):
```rust
let f = format_args!("Hello {name}!"); // error today, but accepted in the future! (after separate FCP)
```
## Experiment
The precise definition of `super let`, what happens for `super let x;` (without initializer), and whether to accept `super let _ = _ else { .. }` are still open questions, to be answered by the experiment.
Furthermore, once we have a more complete understanding of the feature, we might be able to come up with a better syntax. (Which could be just a different keywords, or an entirely different way of naming temporaries that doesn't involve a block and a (super) let statement.)
|
|
Misc query tweaks
Remove some redundant work around `cache_on_disk` and `ensure_ok`, since `Result<(), ErrorGuaranteed>` queries don't need to cache or recompute their "value" if they are only used for their result.
|
|
Co-authored-by: Travis Cross <tc@traviscross.com>
|
|
|
|
Rollup of 6 pull requests
Successful merges:
- #138992 (literal pattern lowering: use the pattern's type instead of the literal's in `const_to_pat`)
- #139211 (interpret: add a version of run_for_validation for &self)
- #139235 (`AstValidator` tweaks)
- #139237 (Add a dep kind for use of the anon node with zero dependencies)
- #139260 (Add dianqk to codegen reviewers)
- #139264 (Fix two incorrect turbofish suggestions)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
Do the following:
* Switch to `impl FnOnce` rather than a generic `F`.
* Change `update` to return nothing.
This was discussed at a libs-api meeting [1].
Tracking issue: https://github.com/rust-lang/rust/issues/50186
[1]: https://github.com/rust-lang/rust/pull/134446#issuecomment-2770842949
|
|
Fix two incorrect turbofish suggestions
This fixes #121901
This is my contribution to Rust, and my first contribution to a language parser that I didn't write myself.
I am a bit outside my depth here, so any constructive criticism is appreciated.
|
|
Add dianqk to codegen reviewers
Not an expert yet, but I may be able to review some LLVM-related PRs.
r? codegen
|
|
Add a dep kind for use of the anon node with zero dependencies
This adds a dep kind for use of the anon node with zero dependencies instead of making use of the null node. I don't think this matters, but it is nicer than random null nodes in the dep graph.
|
|
`AstValidator` tweaks
When I read through `AstValidator` there were several things that tripped me up, and made the code harder to understand than I would have liked. This PR addresses them. Best reviewed one commit at a time.
r? ``@davidtwco``
|
|
interpret: add a version of run_for_validation for &self
Turns out we'll need this for some ongoing work in Miri.
r? ``@oli-obk``
|
|
literal pattern lowering: use the pattern's type instead of the literal's in `const_to_pat`
This has two purposes:
- First, it enables removing the `treat_byte_string_as_slice` fields from `TypeckResults` and `ConstToPat`. A byte string pattern's type will be `&[u8]` when matching on a slice reference, so `const_to_pat` will lower it to a slice ref pattern. I believe this is tested by `tests/ui/match/pattern-deref-miscompile.rs`.
- Second, it will simplify the implementation of byte string literals in deref patterns. If byte string patterns can be given the type `[u8; N]` or `[u8]` during HIR typeck, then nothing needs to be changed in `const_to_pat` in order to lower the patterns `deref!(b"..."): Vec<u8>` and `deref!(b"..."): Box<[u8; 3]>`.
Implementation-wise, this uses `lit_to_const` to make a const with the pattern's type and the literal's valtree; that feels to me like the best way to make sure that the valtree representations of the pattern type and literal are the same. Though it may necessitate later changes to `lit_to_const` to accommodate giving byte string literal patterns non-reference types—would that be reasonable?
This unfortunately doesn't work for the `string_deref_patterns` feature (since that gives string literal patterns the `String` type), so I added a workaround for that. However, once `deref_patterns` supports string literals, it may be able to replace `string_deref_patterns`; the special case for `String` can removed at that point.
r? ``@oli-obk``
|
|
Fixes #121901
|
|
|
|
Rollup of 5 pull requests
Successful merges:
- #139178 (Remove cjgillot from automated review assignment)
- #139184 (Add unstable `--print=crate-root-lint-levels`)
- #139215 (Add `opt-level = "s"` for more std symbolication crates)
- #139232 (Move methods from `Map` to `TyCtxt`, part 5.)
- #139239 (Remove `aux_build` run-make rustc helpers)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
Remove `aux_build` run-make rustc helpers
They provide very little value and makes it more confusing than is
helpful.
Helps with #138066.
r? `@Kobzol`
|
|
Move methods from `Map` to `TyCtxt`, part 5.
This eliminates all methods on `Map`. Actually removing `Map` will occur in a follow-up PR.
A follow-up to #137504.
r? `@Zalathar`
|
|
Add `opt-level = "s"` for more std symbolication crates
This reduces the size of a hello world binary built by stage 1 in release by a few kilobytes
|
|
Add unstable `--print=crate-root-lint-levels`
This PR implements `--print=crate-root-lint-levels` from MCP 833 https://github.com/rust-lang/compiler-team/issues/833.
Tracking issue: https://github.com/rust-lang/rust/issues/139180
Best reviewed commit by commit.
|
|
r=cjgillot
Remove cjgillot from automated review assignment
As discussed [on Zulip](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Review.20for.20.23137465/with/508540539).
To be clear, this is not a value judgement, it's just a way to improve our fairness when assigning reviews, trying to find a balance between leaving time to Rust contributors review on their terms and availability and avoid having PRs waiting for too long.
> [!IMPORTANT]
> This is not a final decision! Rust contributors are free to re-add themselves back to the active review rotation (if they feel like it) once they have more availability.
cc: `@cjgillot`
|
|
Various local trait item iteration cleanups
Adding a trait impl for `Foo` unconditionally affected all queries that are interested in a completely independent trait `Bar`. Perf has no effect on this. We probably don't have a good perf test for this tho.
r? `@compiler-errors`
I am unsure about https://github.com/rust-lang/rust/pull/139018/commits/9d05efb66f7b599eeacb5d2456f844fe4768e865 as it doesn't improve anything wrt incremental, because we still do all the checks for valid `Drop` impls, which subsequently will still invoke many queries and basically keep the depgraph the same.
I want to do
https://github.com/rust-lang/rust/blob/9549077a47099dc826039c051b528d1013740e6f/compiler/rustc_middle/src/ty/trait_def.rs#L141
but would leave that to a follow-up PR, this one changes enough things as it is
|
|
|
|
They provide very little value and makes it more confusing than is
helpful.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Update dependencies
#136077 needs manual tweaking
```
compiler and tools dependencies
Updating anyhow v1.0.95 -> v1.0.97
Updating basic-toml v0.1.9 -> v0.1.10
Updating bitflags v2.8.0 -> v2.9.0
Updating blake3 v1.5.5 -> v1.8.0
Updating bumpalo v3.16.0 -> v3.17.0
Removing byteorder v1.5.0
Updating bytes v1.9.0 -> v1.10.1
Updating cargo_metadata v0.19.1 -> v0.19.2
Updating chrono v0.4.39 -> v0.4.40
Updating chrono-tz v0.10.1 -> v0.10.3
Updating chrono-tz-build v0.4.0 -> v0.4.1
Updating clap v4.5.26 -> v4.5.35
Updating clap_builder v4.5.26 -> v4.5.35
Updating clap_derive v4.5.24 -> v4.5.35
Updating console v0.15.10 -> v0.15.11
Updating cpufeatures v0.2.16 -> v0.2.17
Updating curl-sys v0.4.78+curl-8.11.0 -> v0.4.80+curl-8.12.1
Updating darling v0.20.10 -> v0.20.11
Updating darling_core v0.20.10 -> v0.20.11
Updating darling_macro v0.20.10 -> v0.20.11
Updating deranged v0.3.11 -> v0.4.1
Updating dissimilar v1.0.9 -> v1.0.10
Updating either v1.13.0 -> v1.15.0
Updating elsa v1.11.0 -> v1.11.2
Updating env_logger v0.11.6 -> v0.11.7
Updating equivalent v1.0.1 -> v1.0.2
Updating flate2 v1.0.35 -> v1.1.0
Updating foldhash v0.1.4 -> v0.1.5
Updating getrandom v0.3.1 -> v0.3.2
Updating globset v0.4.15 -> v0.4.16
Downgrading html5ever v0.29.2 -> v0.29.1 (available: v0.30.0)
Updating humantime v2.1.0 -> v2.2.0
Updating icu_list_data v1.5.0 -> v1.5.1
Updating icu_locid_transform_data v1.5.0 -> v1.5.1
Updating icu_normalizer_data v1.5.0 -> v1.5.1
Updating icu_properties_data v1.5.0 -> v1.5.1
Updating indexmap v2.7.0 -> v2.8.0
Updating indicatif v0.17.9 -> v0.17.11
Updating inout v0.1.3 -> v0.1.4
Updating itoa v1.0.14 -> v1.0.15
Adding jiff v0.2.5
Adding jiff-static v0.2.5
Updating jobserver v0.1.32 -> v0.1.33
Updating lexopt v0.3.0 -> v0.3.1
Adding leb128fmt v0.1.0
Updating libc v0.2.169 -> v0.2.171
Updating libz-sys v1.1.21 -> v1.1.22
Updating linux-raw-sys v0.4.15 -> v0.9.3
Updating litemap v0.7.4 -> v0.7.5
Updating log v0.4.25 -> v0.4.27
Downgrading markup5ever v0.15.0 -> v0.14.1
Updating miniz_oxide v0.8.3 -> v0.8.5
Updating once_cell v1.20.2 -> v1.21.3
Updating openssl-probe v0.1.5 -> v0.1.6
Updating openssl-sys v0.9.104 -> v0.9.106
Updating pest v2.7.15 -> v2.8.0
Updating pest_derive v2.7.15 -> v2.8.0
Updating pest_generator v2.7.15 -> v2.8.0
Updating pest_meta v2.7.15 -> v2.8.0
Updating pkg-config v0.3.31 -> v0.3.32
Updating portable-atomic v1.10.0 -> v1.11.0
Adding portable-atomic-util v0.2.4
Updating ppv-lite86 v0.2.20 -> v0.2.21
Updating proc-macro2 v1.0.93 -> v1.0.94
Updating quote v1.0.38 -> v1.0.40
Adding r-efi v5.2.0
Updating rand_core v0.9.0 -> v0.9.3
Updating redox_syscall v0.5.8 -> v0.5.10
Updating rustc-stable-hash v0.1.1 -> v0.1.2
Updating rustc_tools_util v0.4.0 -> v0.4.2
Updating rustix v0.38.43 -> v1.0.5
Updating rustversion v1.0.19 -> v1.0.20
Updating ryu v1.0.18 -> v1.0.20
Updating semver v1.0.24 -> v1.0.26
Updating serde v1.0.217 -> v1.0.219
Updating serde_derive v1.0.217 -> v1.0.219
Updating serde_json v1.0.135 -> v1.0.140
Updating similar v2.6.0 -> v2.7.0
Updating smallvec v1.13.2 -> v1.14.0
Updating socket2 v0.5.8 -> v0.5.9
Updating stacker v0.1.18 -> v0.1.20
Updating string_cache v0.8.8 -> v0.8.9
Updating syn v2.0.96 -> v2.0.100
Updating tar v0.4.43 -> v0.4.44
Updating tempfile v3.15.0 -> v3.19.1
Updating thin-vec v0.2.13 -> v0.2.14
Updating thiserror v2.0.11 -> v2.0.12
Updating thiserror-impl v2.0.11 -> v2.0.12
Updating time v0.3.37 -> v0.3.41
Updating time-core v0.1.2 -> v0.1.4
Updating time-macros v0.2.19 -> v0.2.22
Updating tinyvec v1.8.1 -> v1.9.0
Updating tokio v1.43.0 -> v1.44.1
Updating typenum v1.17.0 -> v1.18.0
Updating unicode-ident v1.0.14 -> v1.0.18
Updating uuid v1.12.0 -> v1.16.0
Updating wasi v0.13.3+wasi-0.2.2 -> v0.14.2+wasi-0.2.4
Removing wasm-encoder v0.219.1
Removing wasm-encoder v0.223.0
Adding wasm-encoder v0.219.2 (available: v0.227.1)
Adding wasm-encoder v0.223.1
Adding wasm-encoder v0.228.0
Updating wasm-metadata v0.223.0 -> v0.223.1
Removing wasmparser v0.219.1
Removing wasmparser v0.222.0
Removing wasmparser v0.223.0
Adding wasmparser v0.219.2 (available: v0.227.1)
Adding wasmparser v0.222.1
Adding wasmparser v0.223.1
Adding wasmparser v0.228.0
Updating wast v223.0.0 -> v228.0.0
Updating wat v1.223.0 -> v1.228.0
Updating windows-core v0.52.0 -> v0.61.0
Adding windows-implement v0.60.0
Updating windows-interface v0.59.0 -> v0.59.1
Adding windows-link v0.1.1
Updating windows-result v0.3.0 -> v0.3.2
Updating windows-strings v0.3.0 -> v0.3.1
Adding windows-strings v0.4.0
Updating wit-bindgen-rt v0.33.0 -> v0.39.0
Updating wit-component v0.223.0 -> v0.223.1
Updating wit-parser v0.223.0 -> v0.223.1
Updating xattr v1.4.0 -> v1.5.0
Updating zerocopy v0.8.14 -> v0.8.24
Updating zerocopy-derive v0.8.14 -> v0.8.24
Updating zerofrom v0.1.5 -> v0.1.6
Updating zerofrom-derive v0.1.5 -> v0.1.6
```
|
|
|
|
`AstValidator` has several `with_*` methods, each one setting a field
that adjust how checking takes place for items within certain other
items. E.g. `with_in_trait_impl` is used to adjust the checking done on
items inside an `impl` item. Weirdly, the scopes used for most of the
`with_*` calls are very broad, and include things that aren't "inside"
the item, such as visibility, unsafety, and constness.
This commit minimizes the scope of these `with_*` calls so they only
apply to the things inside the item.
|
|
|
|
|
|
|
|
|
|
Rollup of 14 pull requests
Successful merges:
- #135295 (Check empty SIMD vector in inline asm)
- #138003 (Add the new `amx` target features and the `movrs` target feature)
- #138823 (rustc_target: RISC-V: add base `I`-related important extensions)
- #138913 (Remove even more instances of `@ts-expect-error` from search.js)
- #138941 (Do not mix normalized and unnormalized caller bounds when constructing param-env for `receiver_is_dispatchable`)
- #139060 (replace commit placeholder in vendor status with actual commit)
- #139102 (coverage: Avoid splitting spans during span extraction/refinement)
- #139191 (small opaque type/borrowck cleanup)
- #139200 (Skip suggest impl or dyn when poly trait is not a real trait)
- #139208 (fix dead link netbsd.md)
- #139210 (chore: remove redundant backtick)
- #139212 (Update mdbook to 0.4.48)
- #139214 (Tell rustfmt to use the 2024 edition in ./x.py fmt)
- #139225 (move autodiff from EnzymeAD/Enzyme to our rust-lang/Enzyme soft-fork)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
A bunch of span-related names in `AstValidator` don't end in `span`,
which goes against the usual naming conventions and makes the code
surprisingly hard to read. E.g. a name like `body` doesn't sound like
it's a span.
This commit adds `_span` suffixes.
|
|
move autodiff from EnzymeAD/Enzyme to our rust-lang/Enzyme soft-fork
In https://github.com/rust-lang/team/pull/1665 we decided to have a soft-fork of Enzyme, to be able to merge e.g. CI, docs, or cmake improvements if upstream is not interested in them. We don't intend to merge logic/code changes. It also seems generally preferable if we clone submodules from a rust-lang repo, instead of an external org. We don't build or checkout Enzyme yet by default, so this should be a safe rollup.
|
|
Tell rustfmt to use the 2024 edition in ./x.py fmt
Most crates in this repo have been moved to the 2024 edition already. This also allows removing a rustfmt exclusion for a cg_clif test.
|
|
Update mdbook to 0.4.48
This brings in several updates. Two significant ones are to halve the search index size, and the other introduces major changes to footnote rendering.
Changelog: https://github.com/rust-lang/mdBook/blob/master/CHANGELOG.md#mdbook-0448
|
|
chore: remove redundant backtick
remove redundant backtick
|
|
fix dead link netbsd.md
src/doc/rustc/src/platform-support/netbsd.md
https://github.com/NetBSD/pkgsrc-wip/blob/master/rust/Makefile - https://github.com/NetBSD/pkgsrc-wip/blob/master/Makefile
|
|
Skip suggest impl or dyn when poly trait is not a real trait
Fixes #139174
When `poly_trait_ref` is not a real trait, we should stop suggesting `impl` and `dyn` to avoid false positives. 3 cases were added to the ui test.
https://github.com/rust-lang/rust/blob/0b45675cfcec57f30a3794e1a1e18423aa9cf200/compiler/rustc_hir_analysis/src/hir_ty_lowering/lint.rs#L88-L93
In the first commit, I submitted the test and passed it. In the second commit, I modified the code and we can see the changes in the test.
r? compiler
|
|
small opaque type/borrowck cleanup
pulled out of #138785
|
|
coverage: Avoid splitting spans during span extraction/refinement
This PR removes or simplifies some of the steps involved in extracting coverage-relevant spans from MIR, and preparing them for use in coverage instrumentation metadata.
A common theme is that we now try harder to avoid modifying or combining spans in non-trivial ways, because those modifications present the most risk for weird behaviour or ICEs.
The main changes are:
- When extracting spans from MIR call terminators, try to restrict them to just the function name.
- Instead of splitting spans around “holes”, just discard any span that overlaps with a hole.
- Instead of splitting macro-invocation spans into two parts, truncate them to just the macro name and subsequent `!`.
---
This results in a lot of tiny changes to the spans that end up in coverage metadata, and a few changes to coverage reports. Judging by test snapshots, these changes appear to be quite minor in practice.
|