about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2025-01-24Rollup merge of #135998 - GuillaumeGomez:fix-trait-items-mobile-indent, ↵Matthias Krüger-3/+7
r=notriddle [rustdoc] Fix indent of trait items on mobile Before: ![Screenshot From 2025-01-24 15-38-53](https://github.com/user-attachments/assets/f7738ff8-92b6-4aca-8a66-2d3618c54572) After: ![Screenshot From 2025-01-24 15-38-37](https://github.com/user-attachments/assets/0a19dc7e-dddd-4cd5-b087-1915e152d7c1) Seems like we forgot them when we did #131718. Can be tested [here](https://rustdoc.crud.net/imperio/fix-trait-items-mobile-indent/foo/trait.T.html). r? `@notriddle`
2025-01-24Rollup merge of #135976 - WaffleLapkin:tailcall-nodrop, r=oli-obkMatthias Krüger-2/+2
Don't drop types with no drop glue when building drops for tailcalls this is required as otherwise drops of `&mut` refs count as a usage of a 'two-phase temporary' causing an ICE. fixes #128097 The underlying issue is that the current code generates drops for `&mut` which are later counted as a second use of a two-phase temporary: `bat t.rs -p` ```rust #![expect(incomplete_features)] #![feature(explicit_tail_calls)] fn f(x: &mut ()) { let _y = String::new(); become f(x); } fn main() {} ``` `rustc t.rs -Zdump_mir=f` ```text error: internal compiler error: compiler/rustc_borrowck/src/borrow_set.rs:298:17: found two uses for 2-phase borrow temporary _4: bb2[1] and bb3[0] --> t.rs:6:5 | 6 | become f(x); | ^^^^^^^^^^^ thread 'rustc' panicked at compiler/rustc_borrowck/src/borrow_set.rs:298:17: Box<dyn Any> stack backtrace: [REDACTED] error: aborting due to 1 previous error ``` `bat ./mir_dump/t.f.-------.renumber.0.mir -p -lrust` ```rust // MIR for `f` 0 renumber fn f(_1: &mut ()) -> () { debug x => _1; let mut _0: (); let mut _2: !; let _3: std::string::String; let mut _4: &mut (); scope 1 { debug _y => _3; } bb0: { StorageLive(_3); _3 = String::new() -> [return: bb1, unwind: bb4]; } bb1: { FakeRead(ForLet(None), _3); StorageLive(_4); _4 = &mut (*_1); drop(_3) -> [return: bb2, unwind: bb3]; } bb2: { StorageDead(_3); tailcall f(Spanned { node: move _4, span: t.rs:6:14: 6:15 (#0) }); } bb3 (cleanup): { drop(_4) -> [return: bb4, unwind terminate(cleanup)]; } bb4 (cleanup): { resume; } } ``` Note how `_4 is moved into the tail call in `bb2` and dropped in `bb3`. This PR adds a check that the locals we drop need dropping. r? `@oli-obk` (feel free to reassign, I'm not sure who would be a good reviewer, but thought you might have an idea) cc `@beepster4096,` since you wrote the original drop implementation.
2025-01-24Rollup merge of #135829 - Kobzol:rustc-push, r=jieyouxuMatthias Krüger-106/+184
Rustc dev guide subtree update r? ``@ghost``
2025-01-24Don't move ownership of job objectChris Denton-50/+4
2025-01-24ci.py: check the return code in `run-local`Josh Stone-1/+1
If the run fails, it should report that and return a non-zero exit status. The simplest way to do that is with `run(..., check=True)`, which raises a `CalledProcessError`.
2025-01-24fix(libtest): Deprecate '--logfile'Ed Page-0/+2
rust-lang/testing-devex-team#9 proposed changing the behavior of `--logfile`. The given reasons were: (1) Bazel can't programmatically process stdout. This seems like a limitation in Bazel and we recommend focusing on that. If we look at the wider Rust ecosystem, Rustc and Cargo don't support any such mechanism and the Cargo team rejected having one. Expecting this in libtest when its not supported elsewhere seems too specialized. (2) Tests that leak out non-programmatic output that intermixes with programmatic output. We acknowledge this is a problem to be evaluated but we need to make sure we are stepping back and gathering requirements, rather than assuming `--logfile` will fit the needs. Independent of the motive, regarding using or changing `--logfile` (1) Most ways to do it would be a breaking change, like if we respect any stable `--format`. As suggested above, we could specialize this to new `--format` values but that would be confusing for some values to apply but not others. (2) Other ways of solving this add new features to lib`test` when we are instead wanting to limit the feature set it has to minimize the compatibility surface that has to be maintained and the burden it would put on third party harnesses which are a focus area. Examples include `--format compact` or a `--log-format` flag (3) The existence of `--logfile` dates back quite a ways (https://github.com/rust-lang/rust/commit/5cc050b265509c19717e11e12dd785d8c73f5b11, rust-lang/rust#2127) and the history gives the impression this more of slipped through rather than being an intended feature (see also https://github.com/rust-lang/rust/pull/82350#discussion_r579732071). Deprecation would better match to how it has been treated. By deprecating this, we do not expect custom test harnesses (rust-lang/testing-devex-team#2) to implement this. T-testing-devex held an FCP for deprecating in rust-lang/testing-devex-team#9 though according to [RFC #3455](https://rust-lang.github.io/rfcs/3455-t-test.html), this is still subject to final approval from T-libs-api.
2025-01-24manual: Convert to mdbookWilfred Hughes-2686/+2836
Split manual.adoc into markdown files, one for each chapter. For the parts of the manual that are generated from source code doc comments, update the comments to use markdown syntax and update the code generators to write to `generated.md` files. For the weekly release, stop copying the .adoc files to the `rust-analyzer/rust-analyzer.github.io` at release time. Instead, we'll sync the manual hourly from this repository. See https://github.com/rust-analyzer/rust-analyzer.github.io/pull/226 for the sync. This PR should be merged first, and that PR needs to be merged before the next weekly release. This change is based on #15795, but rebased and updated. I've also manually checked each page for markdown syntax issues and fixed any I encountered. Co-authored-by: Lukas Wirth <lukastw97@gmail.com> Co-authored-by: Josh Rotenberg <joshrotenberg@gmail.com>
2025-01-24Update cargoWeihang Lo-0/+0
2025-01-24minor: Suggest better names when a type is a sequenceWilfred Hughes-10/+93
Previously, we'd suggest a type of `vec` for a value of type `Vec<T>`, which is rarely what the user wants. We also had no suggestions for values of type `&[T]`. Instead, try to pluralise the inner type name, and fall back to `items`.
2025-01-24bless miri testWaffle Lapkin-2/+2
I'm not sure why the span improved but that's nice!
2025-01-24bootstrap: Handle bootstrap lockfile race condition betterclubby789-1/+3
2025-01-24Explicitly add buildfiles when constructing ProjectFoldersDavid Richey-21/+38
2025-01-24Ignore linker warnings on macOS for ui-fulldepsjyn-3/+10
ld is showing things like this: ``` ld: ignoring duplicate libraries: '-lm' ``` I don't have time or a macbook that lets me investigate these. Just silence them for now.
2025-01-24Rollup merge of #135950 - Kobzol:tidy-python-improvements, r=onur-ozkanMatthias Krüger-59/+110
Tidy Python improvements Fixes display of Python formatting diffs in tidy, and refactors the code to make it simpler and more robust. Also documents Python formatting and linting in the Rustc dev guide. Fixes: https://github.com/rust-lang/rust/issues/135942 r? `@onur-ozkan`
2025-01-24Rollup merge of #135926 - jieyouxu:needs-subprocess-thread, r=oli-obkMatthias Krüger-3/+23
Implement `needs-subprocess` directive, and cleanup a bunch of tests to use `needs-{subprocess,threads}` ### Summary Closes #128295. - Implements `//@ needs-subprocess` directive in compiletest as requested in #128295. However, compiletest is a host tool, so we can't just try to spawn process because that spawns the process on *host*, not the *target*, under cross-compilation scenarios. - The short-term solution is to add *Yet Another* list of allow-list targets. - The long-term solution is to first check if a `$target` supports std, then try to run a binary to do run-time capability detection *on the target*. But that is tricky because you have to build-and-run a binary *for the target*. - This PR picks the short-term solution, because the long-term solution is highly non-trivial, and it's already an improvement over individual `ignore-*`s all over the place. - Opened an issue about the long-term solution in #135928. - Documents `//@ needs-subprocess` in rustc-dev-guide. - Replace `ignore-{wasm,wasm32,emscripten,sgx}` with `needs-{subprocess,threads}` where suitable in tests. - Some drive-by test changes as I was trying to figure out if I could use `needs-{subprocess,threads}` and found some bits needlessly distracting. Count of tests that use `ignore-{wasm,wasm32,emscripten,sgx}` before and after this PR: | State | `ignore-sgx` | `ignore-wasm` | `ignore-emscripten` | | - | - | - | - | | Before this PR | 96 | 88 | 207 | | After this PR | 36 | 38 | 61 | <details> <summary>Commands used to find out locally</summary> ``` --- before [17:40] Joe:rust (fresh) | rg --no-ignore -l "ignore-sgx" tests | wc -l 96 [17:40] Joe:rust (fresh) | rg --no-ignore -l "ignore-wasm" tests | wc -l 88 [17:40] Joe:rust (fresh) | rg --no-ignore -l "ignore-emscripten" tests | wc -l 207 --- after [17:39] Joe:rust (needs-subprocess-thread) | rg --no-ignore -l "ignore-sgx" tests | wc -l 36 [17:39] Joe:rust (needs-subprocess-thread) | rg --no-ignore -l "ignore-wasm" tests | wc -l 38 [17:39] Joe:rust (needs-subprocess-thread) | rg --no-ignore -l "ignore-emscripten" tests | wc -l 61 ``` </details> ### Review advice - Best reviewed commit-by-commit. - Non-trivial test changes (not mechanically simple replacements) are split into individual commits to help with review. Their individual commit messages give some basic description of the changes. - I *could* split some test changes out into another PR, but I found that I needed to change some tests to `needs-threads`, some to `needs-subprocess`, and some needed to use *both*, so they might conflict and become very annoying. --- r? ``@ghost`` (need to run try jobs) try-job: x86_64-msvc-1 try-job: i686-msvc-1 try-job: i686-mingw try-job: x86_64-mingw-1 try-job: x86_64-apple-1 try-job: aarch64-apple try-job: aarch64-gnu try-job: test-various try-job: armhf-gnu
2025-01-24Fix indent of trait items on mobileGuillaume Gomez-3/+7
2025-01-24Merge pull request #19018 from Veykril/push-wxqqunxwrplyLukas Wirth-95/+112
internal: Record the use tree index in glob imports
2025-01-24Merge pull request #18991 from Veykril/push-rmqmnrymwmozLukas Wirth-322/+433
Keep already computed inlay hint properties instead of late resolving them
2025-01-24Lazily compute location links in type hints againLukas Wirth-9/+18
2025-01-24Record the use tree index in glob importsLukas Wirth-95/+112
2025-01-24Add a new failing test that overflows stackShoyu Vanilla-0/+37
2025-01-24Merge pull request #19012 from ShoyuVanilla/arbitrary-selfLukas Wirth-26/+129
feat: Implement `arbitrary-self-types`
2025-01-24feat: Implement `arbitrary-self-types`Shoyu Vanilla-26/+129
2025-01-24Cross-link documentation for adding a new targetMads Marquart-0/+9
Both the target tier policy and the rustc-dev-guide has documentation on this, let's make sure people see both.
2025-01-24Merge pull request #19017 from Veykril/push-uktrsknwmsvyLukas Wirth-10/+26
fix: Fix flycheck panicking with "once" invocation strategy
2025-01-24Merge pull request #18993 from ChayimFriedman2/iter-configLukas Wirth-56/+111
feat: Provide a config to control auto-insertion of `await` and `iter()`
2025-01-24Merge pull request #18994 from Wilfred/failed_rustc_cfg_as_warningLukas Wirth-1/+1
internal: Treat cfg fetching failures as a warning
2025-01-24Merge pull request #19016 from Veykril/push-moqnsytyrupuLukas Wirth-208/+234
fix: Fix `ItemScope` not recording glob imports
2025-01-24fix: Fix flycheck panicking with "once" invocation strategyLukas Wirth-10/+26
We only ever have one flycheck runner no matter the number of workspaces, so just kick off flycheck for it immediately
2025-01-24fix(solve/significant-changes): typoAda Alakbarova-1/+1
2025-01-24Fix `ItemScope` not recording glob importsLukas Wirth-208/+234
This caused us other code to incorrectly assume in dealing with a declaration when in fact it was dealing with a glob imported definition
2025-01-24Revert "Add `@bors rollup=never` to rustc-push PR body"Jakub Beránek-1/+1
2025-01-24Review nto-qnx.md.Jonathan Pallant-29/+30
QNX SDP 8.0 comes with newly renamed QNX OS 8.0, so update the page to talk about QNX, QNX Neutrino 7.0, QNX Neutrino 7.1 or QNX OS 8.0. Also actually add a list of target triples.
2025-01-24Update documentation to include QNX 8.0Florian Bartels-44/+51
Signed-off-by: Florian Bartels <Florian.Bartels@elektrobit.com>
2025-01-24Rename test to `unresolvable-upvar-issue-87987.rs`Zalathar-1/+0
This also suppresses an irrelevant warning, to avoid having to re-bless the output snapshot.
2025-01-24add nto80 x86-64 and aarch64 targetAkhilTThomas-0/+3
Signed-off-by: Florian Bartels <Florian.Bartels@elektrobit.com>
2025-01-24Move common code to mod nto_qnxFlorian Bartels-19/+24
Signed-off-by: Florian Bartels <Florian.Bartels@elektrobit.com>
2025-01-24Add support for QNX 7.1 with io-sock on x64Florian Bartels-6/+9
Signed-off-by: Florian Bartels <Florian.Bartels@elektrobit.com>
2025-01-24Add new target for supporting Neutrino QNX 6.1 with `io-socket` network ↵Florian Bartels-4/+16
stack on aarch64 Signed-off-by: Florian Bartels <Florian.Bartels@elektrobit.com>
2025-01-24Auto merge of #135272 - BoxyUwU:generic_arg_infer_reliability_2, ↵bors-182/+189
r=compiler-errors Forbid usage of `hir` `Infer` const/ty variants in ambiguous contexts The feature `generic_arg_infer` allows providing `_` as an argument to const generics in order to infer them. This introduces a syntactic ambiguity as to whether generic arguments are type or const arguments. In order to get around this we introduced a fourth `GenericArg` variant, `Infer` used to represent `_` as an argument to generic parameters when we don't know if its a type or a const argument. This made hir visitors that care about `TyKind::Infer` or `ConstArgKind::Infer` very error prone as checking for `TyKind::Infer`s in `visit_ty` would find *some* type infer arguments but not *all* of them as they would sometimes be lowered to `GenericArg::Infer` instead. Additionally the `visit_infer` method would previously only visit `GenericArg::Infer` not *all* infers (e.g. `TyKind::Infer`), this made it very easy to override `visit_infer` and expect it to visit all infers when in reality it would only visit *some* infers. --- This PR aims to fix those issues by making the `TyKind` and `ConstArgKind` types generic over whether the infer types/consts are represented by `Ty/ConstArgKind::Infer` or out of line (e.g. by a `GenericArg::Infer` or accessible by overiding `visit_infer`). We then make HIR Visitors convert all const args and types to the versions where infer vars are stored out of line and call `visit_infer` in cases where a `Ty`/`Const` would previously have had a `Ty/ConstArgKind::Infer` variant: API Summary ```rust enum AmbigArg {} enum Ty/ConstArgKind<Unambig = ()> { ... Infer(Unambig), } impl Ty/ConstArg { fn try_as_ambig_ty/ct(self) -> Option<Ty/ConstArg<AmbigArg>>; } impl Ty/ConstArg<AmbigArg> { fn as_unambig_ty/ct(self) -> Ty/ConstArg; } enum InferKind { Ty(Ty), Const(ConstArg), Ambig(InferArg), } trait Visitor { ... fn visit_ty/const_arg(&mut self, Ty/ConstArg<AmbigArg>) -> Self::Result; fn visit_infer(&mut self, id: HirId, sp: Span, kind: InferKind) -> Self::Result; } // blanket impl'd, not meant to be overriden trait VisitorExt { fn visit_ty/const_arg_unambig(&mut self, Ty/ConstArg) -> Self::Result; } fn walk_unambig_ty/const_arg(&mut V, Ty/ConstArg) -> Self::Result; fn walk_ty/const_arg(&mut V, Ty/ConstArg<AmbigArg>) -> Self::Result; ``` The end result is that `visit_infer` visits *all* infer args and is also the *only* way to visit an infer arg, `visit_ty` and `visit_const_arg` can now no longer encounter a `Ty/ConstArgKind::Infer`. Representing this in the type system means that it is now very difficult to mess things up, either accessing `TyKind::Infer` "just works" and you won't miss *some* type infers- or it doesn't work and you have to look at `visit_infer` or some `GenericArg::Infer` which forces you to think about the full complexity involved. Unfortunately there is no lint right now about explicitly matching on uninhabited variants, I can't find the context for why this is the case :woman_shrugging: I'm not convinced the framing of un/ambig ty/consts is necessarily the right one but I'm not sure what would be better. I somewhat like calling them full/partial types based on the fact that `Ty<Partial>`/`Ty<Full>` directly specifies how many of the type kinds are actually represented compared to `Ty<Ambig>` which which leaves that to the reader to figure out based on the logical consequences of it the type being in an ambiguous position. --- tool changes have been modified in their own commits for easier reviewing by anyone getting cc'd from subtree changes. I also attempted to split out "bug fixes arising from the refactoring" into their own commit so they arent lumped in with a big general refactor commit Fixes #112110
2025-01-24Update target docs to mention MAXIMUM_MEMORY=2GBbjorn3-1/+1
2025-01-24Update Python 3 versions in tidyJakub Beránek-2/+10
Python 3.13 has been released a few months ago.
2025-01-24Make virtualenv creation in tidy more robustJakub Beránek-6/+24
2025-01-24Document Python formatting and linting in the rustc-dev-guideJakub Beránek-3/+25
2025-01-24Refactor Python linting and formatting in tidyJakub Beránek-48/+51
Unify the logic under a simple function to make it harder to cause mistakes.
2025-01-24Auto merge of #135978 - matthiaskrgr:rollup-ni16gqr, r=matthiaskrgrbors-15/+29
Rollup of 8 pull requests Successful merges: - #133605 (Add extensive set of drop order tests) - #135489 (remove pointless allowed_through_unstable_modules on TryFromSliceError) - #135757 (Add NuttX support for AArch64 and ARMv7-A targets) - #135799 (rustdoc-json: Rename `Path::name` to `path`, and give it the path again.) - #135865 (For E0223, suggest associated functions that are similar to the path, even if the base type has multiple inherent impl blocks.) - #135890 (Implement `VecDeque::pop_front_if` & `VecDeque::pop_back_if`) - #135914 (Remove usages of `QueryNormalizer` in the compiler) - #135936 (fix reify-intrinsic test) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-24Rollup merge of #135865 - zachs18:maybe_report_similar_assoc_fn_more, ↵Matthias Krüger-1/+0
r=compiler-errors For E0223, suggest associated functions that are similar to the path, even if the base type has multiple inherent impl blocks. Currently, the "help: there is an associated function with a similar name `from_utf8`" suggestion for `String::from::utf8` is only given if `String` has exactly one inherent `impl` item. This PR makes the suggestion be emitted even if the base type has multiple inherent `impl` items. Example: ```rust struct Foo; impl Foo { fn bar_baz() {} } impl Foo {} // load-bearing fn main() { Foo::bar::baz; } ``` Nightly/stable output: ```rust error[E0223]: ambiguous associated type --> f.rs:7:5 | 7 | Foo::bar::baz; | ^^^^^^^^ | help: if there were a trait named `Example` with associated type `bar` implemented for `Foo`, you could use the fully-qualified path | 7 | <Foo as Example>::bar::baz; | ~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0223`. ``` Output with this PR, or without the load-bearing empty impl on nightly/stable: ```rust error[E0223]: ambiguous associated type --> f.rs:7:5 | 7 | Foo::bar::baz; | ^^^^^^^^ | help: there is an associated function with a similar name: `bar_baz` | 7 | Foo::bar_baz; | ~~~~~~~ error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0223`. ``` Ideally, this suggestion would also work for non-ADT types like ~~`str::char::indices`~~ (edit: latest commit makes this work with primitives) or `<dyn Any>::downcast::mut_unchecked`, but that seemed to be a harder change. `@rustbot` label +A-diagnostics
2025-01-24Rollup merge of #135799 - aDotInTheVoid:skrrt-skrrt-revrrt, r=GuillaumeGomezMatthias Krüger-11/+15
rustdoc-json: Rename `Path::name` to `path`, and give it the path again. Closes: #135600. Reverts #134880 (Effectively, but not actually, as the `FORMAT_VERSION` needs to be bumped, changed docs/tests). CC `@AS1100K.` Also CC `@obi1kenobi` `@LukeMathWalker` Still needs before being merge-ready: - [x] Tests for cross-crate paths - [x] (Maybe) Document what the field does. - [x] Decide if the field rename is good (https://github.com/rust-lang/rust/pull/135799#issuecomment-2605937831) - [ ] Squash commits. r? `@GuillaumeGomez`
2025-01-24Rollup merge of #135757 - no1wudi:master, r=compiler-errorsMatthias Krüger-2/+12
Add NuttX support for AArch64 and ARMv7-A targets This patch adds tier 3 support for AArch64 and ARMv7-A targets in NuttX, including: - AArch64 target: aarch64-unknown-nuttx - ARMv7-A target: armv7a-nuttx-eabi, armv7a-nuttx-eabihf - Thumbv7-A target: thumbv7a-nuttx-eabi, thumbv7a-nuttx-eabihf
2025-01-24Rollup merge of #135489 - RalfJung:TryFromSliceError, r=tgross35Matthias Krüger-1/+2
remove pointless allowed_through_unstable_modules on TryFromSliceError This got added in https://github.com/rust-lang/rust/pull/132482 but the PR does not explain why. `@lukas-code` do you still remember? Also Cc `@Noratrieb` as reviewer of that PR. If I understand the issue description correctly, all paths under which this type is exported are stable now: `core::array::TryFromSliceError` and `std::array::TryFromSliceError`. If that is the case, we shouldn't have the attribute; it's a terrible hack that should only be used when needed to maintain backward compatibility. Getting some historic information right is IMO *not* sufficient justification to risk accidentally exposing this type via more unstable paths today or in the future.