about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2024-11-26Rollup merge of #133458 - GuillaumeGomez:fix-prelude-tys-links, r=notriddleMichael Goulet-5/+8
Fix `Result` and `Option` not getting a jump to def link generated It was just because we didn't store the "span" in the `PreludeTy` variant. r? ``@notriddle``
2024-11-26Rollup merge of #115293 - cjgillot:no-fuel, r=wesleywiser,DianQKMichael Goulet-1/+0
Remove -Zfuel. I'm not sure this feature is used. I only found 2 references in a google search, both referring to its introduction. Meanwhile, it's a global mutable state, untracked by incremental compilation, so incompatible with it.
2024-11-26Auto merge of #133505 - compiler-errors:rollup-xjp8hdi, r=compiler-errorsbors-11/+11
Rollup of 12 pull requests Successful merges: - #133042 (btree: add `{Entry,VacantEntry}::insert_entry`) - #133070 (Lexer tweaks) - #133136 (Support ranges in `<[T]>::get_many_mut()`) - #133140 (Inline ExprPrecedence::order into Expr::precedence) - #133155 (Yet more `rustc_mir_dataflow` cleanups) - #133282 (Shorten the `MaybeUninit` `Debug` implementation) - #133326 (Remove the `DefinitelyInitializedPlaces` analysis.) - #133362 (No need to re-sort existential preds in relate impl) - #133367 (Simplify array length mismatch error reporting (to not try to turn consts into target usizes)) - #133394 (Bail on more errors in dyn ty lowering) - #133410 (target check_consistency: ensure target feature string makes some basic sense) - #133435 (miri: disable test_downgrade_observe test on macOS) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-26don't pass every test arg to test-float-parseonur-ozkan-6/+2
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-11-26Merge pull request #4031 from devnexen/solarish_statRalf Jung-34/+75
filesystem support for solarish: stat
2024-11-26Remove target.is_some() to handle it later inside ra::flycheckAli Bektas-3/+1
2024-11-26Revert #18197Ali Bektas-1/+1
Our first attempt to make flycheck only check the current crate if the crate is one of bin/bench/test targets had caused `check_workspace` to be ignored, which should have been a config with higher precedence all along. This commit revert #18197 and closes #18562
2024-11-26Rollup merge of #133140 - dtolnay:precedence, r=fmeaseMichael Goulet-11/+11
Inline ExprPrecedence::order into Expr::precedence The representation of expression precedence in rustc_ast has been an obstacle to further improvements in the pretty-printer (continuing from #119105 and #119427). Previously the operation of *"does this expression have lower precedence than that one"* (relevant for parenthesis insertion in macro-generated syntax trees) consisted of 3 steps: 1. Convert `Expr` to `ExprPrecedence` using `.precedence()` 2. Convert `ExprPrecedence` to `i8` using `.order()` 3. Compare using `<` As far as I can guess, the reason for the separation between `precedence()` and `order()` was so that both `rustc_ast::Expr` and `rustc_hir::Expr` could convert as straightforwardly as possible to the same `ExprPrecedence` enum, and then the more finicky logic performed by `order` could be present just once. The mapping between `Expr` and `ExprPrecedence` was intended to be as straightforward as possible: ```rust match self.kind { ExprKind::Closure(..) => ExprPrecedence::Closure, ... } ``` although there were exceptions of both many-to-one, and one-to-many: ```rust ExprKind::Underscore => ExprPrecedence::Path, ExprKind::Path(..) => ExprPrecedence::Path, ... ExprKind::Match(_, _, MatchKind::Prefix) => ExprPrecedence::Match, ExprKind::Match(_, _, MatchKind::Postfix) => ExprPrecedence::PostfixMatch, ``` Where the nature of `ExprPrecedence` becomes problematic is when a single expression kind might be associated with multiple different precedence levels depending on context (outside the expression) and contents (inside the expression). For example consider what is the precedence of an ExprKind::Closure `$closure`. Well, on the left-hand side of a binary operator it would need parentheses in order to avoid the trailing binary operator being absorbed into the closure body: `($closure) + Rhs`, so the precedence is something lower than that of `+`. But on the right-hand side of a binary operator, a closure is just a straightforward prefix expression like a unary op, which is a relatively high precedence level, higher than binops but lower than method calls: `Lhs + $closure` is fine without parens but `($closure).method()` needs them. But as a third case, if the closure contains an explicit return type, then the precedence is an even higher level than that, never needing parenthesization even in a binop left-hand side or method call: `|| -> bool { false } + Rhs` or `|| -> bool { false }.method()`. You can see that trying to capture all of this resolution about expressions into `ExprPrecedence` violates the intention of `ExprPrecedence` being a straightforward one-to-one correspondence from each AST and HIR `ExprKind` variant. It would be possible to attempt that by doing stuff like `ExprPrecedence::Closure(Side::Leading, ReturnType::No)`, but I don't foresee the original envisioned benefit of the `precedence()`/`order()` distinction being retained in this approach. Instead I want to move toward a model that Syn has been using successfully. In Syn, there is a Precedence enum but it differs from rustc in the following ways: - There are [relatively few variants](https://github.com/dtolnay/syn/blob/2.0.87/src/precedence.rs#L11-L47) compared to rustc's `ExprPrecedence`. For example there is no distinction at the precedence level between returns and closures, or between loops and method calls. - We distinguish between [leading](https://github.com/dtolnay/syn/blob/2.0.87/src/fixup.rs#L293) and [trailing](https://github.com/dtolnay/syn/blob/2.0.87/src/fixup.rs#L309) precedence, taking into account an expression's context such as what token follows it (for various syntactic bail-outs in Rust's grammar, like ambiguities around break-with-value) and how it relates to operators from the surrounding syntax tree. - There are no hardcoded mysterious integer quantities like rustc's `PREC_CLOSURE = -40`. All precedence comparisons are performed via PartialOrd on a C-like enum. This PR is just a first step in these changes. As you can tell from Syn, I definitely think there is value in having a dedicated type to represent precedence, instead of what `order()` is doing with `i8`. But that is a whole separate adventure because rustc_ast doesn't even agree consistently on `i8` being the type for precedence order; `AssocOp::precedence` instead uses `usize` and there are casts in both directions. It is likely that a type called `ExprPrecedence` will re-appear, but it will look substantially different from the one that existed before this PR.
2024-11-26filesystem support for solarish.David Carlier-34/+75
close #3890
2024-11-26Merge pull request #18511 from darichey/sysroot-query-metadataLaurențiu Nicola-51/+150
Re-add `rust-analyzer.cargo.sysrootQueryMetadata`
2024-11-26Rollup merge of #133470 - jieyouxu:ugly, r=compiler-errorsGuillaume Gomez-22/+0
Cleanup: delete `//@ pretty-expanded` directive This PR removes the `//@ pretty-expanded` directive support in compiletest and removes its usage inside ui tests because it does not actually do anything, and its existence is itself misleading. This PR is split into two commits: 1. The first commit just drops `pretty-expanded` directive support in compiletest. 2. The second commit is created by `sd '//@ pretty-expanded.*\n' '' tests/ui/**/*.rs`[^1], reblessing, and slightly adjusting some leading whitespace in a few tests. We can tell this is fully removed because compiletest doesn't complain about unknown directive when running the `ui` test suite. cc #23616 ### History Originally, there was some effort to introduce more test coverage for `-Z unpretty=expanded` (in 2015 this was called `--pretty=expanded`). In [Make it an error to not declare used features #23598][pr-23598], there was a flip from `//@ no-pretty-expanded` (opt-out of `-Z unpretty=expanded` test) to `//@ pretty-expanded` (opt-in to `-Z unpretty=expanded` test). This was needed because back then the dedicated `tests/pretty` ("pretty") test suite did not existed, and the pretty tests were grouped together under `run-pass` tests (I believe the `ui` test suite didn't exist back then either). Unfortunately, in this process the replacement `//@ pretty-expanded` directives contained a `FIXME #23616` linking to [There are very few tests for `-Z unpretty` expansion #23616][issue-23616]. But this was arguably backwards and somewhat misleading, as noted in [#23616](https://github.com/rust-lang/rust/issues/23616#issuecomment-484999901): The attribute is off by default and things just work if you don't test it, people have not been adding the `pretty-expanded` annotation to new tests even if it would work. Which basically renders this useless. ### Current status As of Nov 2024, we have a dedicated `pretty` test suite, and some time over the years the split between `run-pass` into `ui` and `pretty` test suites caused all the `//@ pretty-expanded` in `ui` tests to do absolutely nothing: the compiletest logic for `pretty-expanded` only triggers in the *pretty* test suite, but none of the pretty tests use it. Oops. Nobody remembers this, nobody uses this, it's misleading in ui tests. Let's get rid of this directive altogether. [pr-23598]: https://github.com/rust-lang/rust/pull/23598 [issue-23616]: https://github.com/rust-lang/rust/issues/23616 ### Follow-ups - [x] Yeet this directive from rustc-dev-guide docs. https://github.com/rust-lang/rustc-dev-guide/pull/2147 [^1]: https://github.com/chmln/sd r? compiler
2024-11-26Rollup merge of #133462 - mustartt:aix-improve-bootstrap-loading, r=jieyouxuGuillaume Gomez-8/+8
Use ReadCache for archive reading in bootstrap Address expensive archive reading in bootstrap. This fixes https://github.com/rust-lang/rust/issues/133268 Enable the `std` feature of `object` to use `ReadCache` instead of reading the entire archive file into memory to check for headers. This takes minimal extra time to compile compared to introducing other expensive dependencies to `bootstrap`. r? jieyouxu
2024-11-26Rollup merge of #133443 - fmease:rm-dead-eff-code-ii, r=compiler-errorsGuillaume Gomez-8/+0
Remove dead code stemming from the old effects desugaring (II) Follow-up to #132374. r? project-const-traits
2024-11-26Pacify tidy.Camille GILLOT-1/+0
2024-11-26Merge pull request #4059 from tiif/fixtestOli Scherer-49/+18
Simplify thread blocking tests
2024-11-26Simplify thread blocking teststiif-49/+18
2024-11-26Merge pull request #4061 from asquared31415/dep_info_fixRalf Jung-5/+8
Use `PathBuf` APIs to correctly do some path manipulation cross-platform
2024-11-26Add macro expansion test for raw variable namesMark Murphy-0/+28
2024-11-25attempt to fix miri failing to create file when under weird powershell ↵asquared31415-5/+8
configurations
2024-11-26Auto merge of #132894 - frank-king:feature/where-refactor, r=cjgillotbors-46/+42
Refactor `where` predicates, and reserve for attributes support Refactor `WherePredicate` to `WherePredicateKind`, and reserve for attributes support in `where` predicates. This is a part of #115590 and is split from #132388. r? petrochenkov
2024-11-25Fix the rest of the testsYoh Deadfall-6/+3
2024-11-25Added linux_like moduleYoh Deadfall-16/+17
2024-11-25Fixed test targetYoh Deadfall-2/+1
Co-authored-by: Ralf Jung <post@ralfj.de>
2024-11-25Added epoll and eventfd for AndroidYoh Deadfall-4/+32
2024-11-25Merge pull request #18559 from ChayimFriedman2/recur-unsizedLaurențiu Nicola-10/+47
fix: Fix a stack overflow when computing the sizedness of a struct that includes itself as the tail field
2024-11-26compiletest: remove `pretty-expanded` directive and infraJieyou Xu-22/+0
Foreword ======== Let us begin the journey to rediscover what the `//@ pretty-expanded` directive does, brave traveller -- "My good friend, [..] when I wrote that passage, God and I knew what it meant. It is possible that God knows it still; but as for me, I have totally forgotten." -- Johann Paul Friedrich Richter, 1826 We must retrace the steps of those before us, for history shall guide us in the present and inform us of the future. The Past ======== Originally there was some effort to introduce more test coverage for `-Z unpretty=expanded` (in 2015 this was called `--pretty=expanded`). In [Make it an error to not declare used features #23598][pr-23598], there was a flip from `//@ no-pretty-expanded` (opt-out of `-Z unpretty=expanded` test) to `//@ pretty-expanded` (opt-in to `-Z unpretty=expanded` test). This was needed because back then the dedicated `tests/pretty` ("pretty") test suite did not existed, and the pretty tests were grouped together under `run-pass` tests (I believe `ui` test suite didn't exist back then either). Unfortunately, in this process the replacement `//@ pretty-expanded` directives contained a `FIXME #23616` linking to [There are very few tests for `-Z unpretty` expansion #23616][issue-23616]. But this was arguably backwards and somewhat misleading, as noted in <https://github.com/rust-lang/rust/issues/23616#issuecomment-484999901>: The attribute is off by default and things just work if you don't test it, people have not been adding the `pretty-expanded` annotation to new tests even if it would work. Which basically renders this useless. The Present =========== As of Nov 2024, we have a dedicated `pretty` test suite, and some time over the years the split between `run-pass` into `ui` and `pretty` test suites caused all of the `//@ pretty-expanded` in `ui` tests to do absolutely nothing -- the compiletest logic for `pretty-expanded` only triggered in the *pretty* test suite, but none of the pretty tests use it. Oops. The Future ========== Nobody remembers this, nobody uses this, it's misleading in ui tests. Let's get rid of this directive altogether. [pr-23598]: https://github.com/rust-lang/rust/pull/23598 [issue-23616]: https://github.com/rust-lang/rust/issues/23616
2024-11-25Fix a stack overflow when computing the sizedness of a struct that includes ↵Chayim Refael Friedman-10/+47
itself as the tail field
2024-11-25Update booksEric Huss-0/+0
2024-11-25Update cargoEric Huss-0/+0
2024-11-26Migrate `add_turbo_fish` to `SyntaxEditor`Shoyu Vanilla-24/+77
2024-11-25Fix `Result` and `Option` not getting a jump to def link generatedGuillaume Gomez-5/+8
2024-11-25use ReadCache for archive loadingHenry Jiang-8/+8
2024-11-25miri: implement `TlsFree`joboet-0/+26
If the variable does not need a destructor, `std` uses racy initialization for creating TLS keys on Windows. With just the right timing, this can lead to `TlsFree` being called. Unfortunately, with #132654 this is hit quite often, so miri should definitely support `TlsFree` ([documentation](https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-tlsfree)). I'm filing this here instead of in the miri repo so that #132654 isn't blocked for so long.
2024-11-25generate-copyright: Use license-metadata.json from git.Jonathan Pallant-2/+1
2024-11-25Run the license-metadata check in CI.Jonathan Pallant-0/+1
This will tell you if license-metadata.json is out of date.
2024-11-25collect-license-metadata: move JSON to root, and add a 'check' modeJonathan Pallant-14/+65
2024-11-25Support predicate registers (clobber-only) in Hexagon inline assemblyTaiki Endo-0/+2
2024-11-25Fix a bug when synthetic AST node were searched in the AST ID map and caused ↵Chayim Refael Friedman-4/+80
panics
2024-11-25generate-copyright: Ensure output has UNIX line-endings for consistency.Jonathan Pallant-0/+8
2024-11-25Remove dead code stemming from the old effects desugaring (II)León Orell Valerian Liehr-8/+0
2024-11-25CI: split x86_64-msvc-ext jobMarcoIeni-6/+14
2024-11-25Refactor `where` predicates, and reserve for attributes supportFrank King-46/+42
2024-11-25Rollup merge of #132803 - wangjingcun:master, r=Mark-SimulacrumMatthias Krüger-1/+1
Fix broken url
2024-11-25Rollup merge of #131664 - taiki-e:s390x-asm-vreg-inout, r=AmanieuMatthias Krüger-0/+40
Support input/output in vector registers of s390x inline assembly (under asm_experimental_reg feature) This extends currently clobber-only vector registers (`vreg`) support to allow passing `#[repr(simd)]` types, floats (f32/f64/f128), and integers (i32/i64/i128) as input/output. This is unstable and gated under new `#![feature(asm_experimental_reg)]` (tracking issue: https://github.com/rust-lang/rust/issues/133416). If the feature is not enabled, only clober is supported as before. | Architecture | Register class | Target feature | Allowed types | | ------------ | -------------- | -------------- | -------------- | | s390x | `vreg` | `vector` | `i32`, `f32`, `i64`, `f64`, `i128`, `f128`, `i8x16`, `i16x8`, `i32x4`, `i64x2`, `f32x4`, `f64x2` | This matches the list of types that are supported by the vector registers in LLVM: https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/SystemZ/SystemZRegisterInfo.td#L301-L313 In addition to `core::simd` types and floats listed above, custom `#[repr(simd)]` types of the same size and type are also allowed. All allowed types other than i32/f32/i64/f64/i128, and relevant target features are currently unstable. Currently there is no SIMD type for s390x in `core::arch`, but this is tracked in https://github.com/rust-lang/rust/issues/130869. cc https://github.com/rust-lang/rust/issues/130869 about vector facility support in s390x cc https://github.com/rust-lang/rust/issues/125398 & https://github.com/rust-lang/rust/issues/116909 about f128 support in asm `@rustbot` label +O-SystemZ +A-inline-assembly
2024-11-24Auto merge of #133423 - jieyouxu:rollup-m3gyoz6, r=jieyouxubors-8/+5
Rollup of 6 pull requests Successful merges: - #132730 (std: allow after-main use of synchronization primitives) - #133105 (only store valid proc macro item for doc link) - #133260 (Constify the `Deref`/`DerefMut` traits, too) - #133297 (Remove legacy bitcode for iOS) - #133298 (Mention that std::fs::remove_dir_all fails on files) - #133384 (add a test for target-feature-ABI warnings in closures and when calling extern fn) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-24Fix rustfmt according to reviewNadrieril-2/+14
2024-11-24Merge pull request #4037 from tiif/blockpipeRalf Jung-44/+80
Refactor AnonSocket::read/write for blocking socketpair
2024-11-24cover guard patterns in clippy lintsMax Niederman-1/+1
2024-11-24cover guard patterns in rustfmtMax Niederman-1/+3
2024-11-24Merge pull request #18552 from lnicola/rust-src-messageLaurențiu Nicola-4/+5
internal: Fix missing `rust-src` message