Commit Graph

262105 Commits

Author SHA1 Message Date
Shoyu Vanilla
086065e56b Prevent redundant obigation push for assignee exprs 2024-08-01 02:51:33 +09:00
Shoyu Vanilla
8b14b743f9 fix: Apply IndexMut obligations for non-assigning mutable index usages, too 2024-08-01 02:20:52 +09:00
bors
bba84aa836 Auto merge of #17750 - davidbarsky:david/remove-abspath-requirement-in-linked-projects, r=Veykril
fix: remove AbsPath requirement from linkedProjects

Should (fingers crossed!) fix https://github.com/rust-lang/rust-analyzer/issues/17664. I opened the `rustc` workspace with the [suggested configuration](e552c168c7/src/etc/rust_analyzer_settings.json) and I was able to successfully open some rustc crates (`rustc_incremental`) and have IDE functionality.

`@Veykril:` can you try these changes and let me know if it fixed rustc?
2024-07-31 14:31:16 +00:00
David Barsky
e8a90513de fix: remove AbsPath requirement from linkedProjects 2024-07-31 10:07:48 -04:00
bors
9fb03f0f21 Auto merge of #17747 - ShoyuVanilla:issue-17734, r=Veykril
fix: Errors on method call inferences with elided lifetimes

Fixes #17734

Currently, we are matching non-lifetime(type or const) generic arg to liftime argument position while building substs for method calling when there are elided lifetimes.
This mismatch just make a subst for error lifetime and while this alone is not much a trouble, it also makes the mismatched type or const generic arg cannot be used in its proper place and this makes type inference failure
2024-07-31 07:09:57 +00:00
Shoyu Vanilla
1b058b796d
Add a test case 2024-07-31 10:47:13 +09:00
Shoyu Vanilla
a2555b976a fix: Errors on method call inferences with elided lifetimes 2024-07-31 02:36:44 +09:00
bors
51a0dd2677 Auto merge of #17744 - alibektas:debug_env_not_set, r=Veykril
minor: Set tracing level to debug when `cargo config get env` fails

fixes #17739
2024-07-30 11:02:21 +00:00
Ali Bektas
2169fc7f0f Set tracing level to debug when cargo config get env fails 2024-07-30 12:57:21 +02:00
bors
33fdfb4673 Auto merge of #17735 - alibektas:ratoml_workspaces, r=Veykril
feat: Introduce workspace `rust-analyzer.toml`s

In order to globally configure a project it was, prior to this PR, possible to have a `ratoml` at the root path of a project. This is not the case anymore. Instead we now let ratoml files that are placed at the root of any workspace have a new scope called `workspace`. Although there is not a difference between a `workspace` scope and and a `global` scope, future PRs will change that.
2024-07-30 06:49:14 +00:00
bors
cd266e0433 Auto merge of #17742 - Veykril:wrong-retries, r=Veykril
fix: Fix incorrect retrying of inlay hint requests
2024-07-30 06:35:28 +00:00
Lukas Wirth
13c095aaf1 fix: Fix incorrect retrying of inlay hint requests 2024-07-30 08:23:17 +02:00
bors
5fa145eab9 Auto merge of #17741 - Veykril:include-raw, r=Veykril
fix: Fix builtin includes rejecting raw string literals

Fixes https://github.com/rust-lang/rust-analyzer/issues/17701
2024-07-30 06:21:07 +00:00
Lukas Wirth
90e1a58cc6 fix: Fix builtin includes rejecting raw string literals 2024-07-30 08:19:32 +02:00
Ali Bektas
dc471c16b2 Remove clippy errors 2024-07-29 17:00:31 +02:00
bors
722f79d374 Auto merge of #17707 - Veykril:proc-macro-err-cleanup, r=Veykril
feat: Use spans for builtin and declarative macro expansion errors

This should generally improve some error reporting for macro expansion errors. Especially for `compile_error!` within proc-macros
2024-07-29 14:07:33 +00:00
Lukas Wirth
5ac8b79ca8 Add missing doc string 2024-07-29 16:05:21 +02:00
Lukas Wirth
a895797455 Fix error spans for include! and compile_error! 2024-07-29 15:57:01 +02:00
bors
51130d8222 Auto merge of #17736 - hyf0:hyf_09234908234, r=Veykril
feat(ide-completion): explictly show `async` keyword on `impl trait` methods

OLD:

<img width="676" alt="image" src="https://github.com/user-attachments/assets/f6fa626f-6b6d-4c22-af27-b0755e7a6bf8">

Now:

<img width="684" alt="image" src="https://github.com/user-attachments/assets/efbaac0e-c805-4dd2-859d-3e44b2886dbb">

---

This is an preparation for https://github.com/rust-lang/rust-analyzer/issues/17719.

```rust
use std::future::Future;

trait DesugaredAsyncTrait {
    fn foo(&self) -> impl Future<Output = usize> + Send;
    fn bar(&self) -> impl Future<Output = usize> + Send;
}

struct Foo;

impl DesugaredAsyncTrait for Foo {
    fn foo(&self) -> impl Future<Output = usize> + Send {
        async { 1 }
    }

    //
    async fn bar(&self) -> usize {
        1
    }
}

fn main() {
    let fut = Foo.bar();
    fn _assert_send<T: Send>(_: T) {}
    _assert_send(fut);
}
```

If we don't distinguish `async` or not. It would be confusing to generate sugared version `async fn foo ....` and original form `fn foo`  for `async fn in trait` that is defined in desugar form.
2024-07-29 12:55:53 +00:00
Lukas Wirth
79defab2b1 Make basic use of spans for macro expansion errors 2024-07-29 14:52:40 +02:00
Yunfei
825034566a Add test in ide-completion/src/tests/item_list.rs 2024-07-29 20:40:51 +08:00
Yunfei
dc548f0168 Revert "Fix error message"
This reverts commit 752c49b679afcec7edf5d26d52bf3d164ee7349f.
2024-07-29 20:36:03 +08:00
bors
ca16c0633d Auto merge of #17715 - Throne3d:fix/glob-may-override-vis-2, r=Veykril
fix: let glob imports override other globs' visibility

Follow up to #14930

Fixes #11858
Fixes #14902
Fixes #17704

I haven't reworked the code here at all - I don't feel confident in the codebase to do so - just rebased it onto the current main branch and fixed conflicts.

I'm not _entirely_ sure I understand the structure of the `check` function in `crates/hir-def/src/nameres` tests. I think the change to the test expectation from #14930 is correct, marking the `crate::reexport::inner` imports with `i`, and I understand it to mean there's a specific token in the import that we can match it to (in this case, `Trait`, `function` and `makro` of `pub use crate::defs::{Trait, function, makro};` respectively), but I had some trouble understanding the meaning of the different parts of `PerNs` to be sure.
Does this make sense?

I tested building and using RA locally with `cargo xtask install` and after this change the documentation for `arrow_array::ArrowPrimitiveType` seems to be picked up correctly!
2024-07-29 12:06:31 +00:00
bors
ee72122342 Auto merge of #17722 - joshka:jm/logs, r=Veykril
feat: use vscode log format for client logs

This change updates the log format to use the vscode log format instead
of the custom log format, by replacing the `OutputChannel` with a
`LogOutputChannel` and using the `debug`, `info`, `warn`, and `error`
methods on it. This has the following benefits:

- Each log level now has its own color and the timestamp is in a more
  standard format
- Inspect output (e.g. the log of the config object) is now colored
- Error stack traces are now shown in the output
- The log level is now controlled on the output tab by clicking the gear
  icon and selecting "Debug" or by passing the `--log` parameter to
  vscode. The `trace.extension` setting has been marked as deprecated.

Motivation:
The large uncolored unformatted log output with a large config object logged whenever it changes has always dominated the logs. This subjectively has made it that looking to see what the client is doing has always been a bit disappointing. That said, there's only 17 log messages total in the client. Hopefully by making the logs more visually useful this will encourage adding more appropriate debug level messages in future.

Incidentally, it might be worth only logging the config change message at a debug level instead of an info level to reduce the noise.
2024-07-29 11:52:32 +00:00
Yunfei
568228fbc9 Cargo fmt 2024-07-29 16:51:49 +08:00
Yunfei
5b184ffa22 Fix error message 2024-07-29 16:35:19 +08:00
Yunfei
55c703bca7 feat(ide-completion): explictly show async keyword on impl trait 2024-07-29 15:55:21 +08:00
Ali Bektas
45ef4f2c32 Remove unnec copying of source_root_ids 2024-07-29 03:46:02 +02:00
Ali Bektas
59c465b6e2 add skip_slow_tests to ratoml tests 2024-07-29 03:43:27 +02:00
Ali Bektas
adefc44f31 Combine krate_ratoml and workspace_ratomls into one 2024-07-29 03:39:47 +02:00
bors
48fb66be7a Auto merge of #17732 - lnicola:sync-from-rust, r=lnicola
minor: sync from downstream
2024-07-28 14:22:27 +00:00
Laurențiu Nicola
a973d3f087 Merge from rust-lang/rust 2024-07-28 17:19:33 +03:00
Laurențiu Nicola
c16061a237 Preparing for merge from rust-lang/rust 2024-07-28 17:19:12 +03:00
bors
1b51d80027 Auto merge of #127799 - Kobzol:bootstrap-cmd-refactor-7, r=onur-ozkan
Bootstrap command refactoring: make command output API more bulletproof (step 7)

Continuation of https://github.com/rust-lang/rust/pull/127680.

This PR modifies the API of running commands to make it more explicit when a command is expected to produce programmatically handled output. Now if you call just `run`, you cannot access the stdout/stderr by accident, because it will not be returned to the caller.

This API change might be seen as overkill, let me know what do you think. In any case, I'd like to land the second commit, to make it harder to accidentally read stdout/stderr of commands that did not capture output (now you'd get an empty string as a result, but you should probably get a panic instead, if you try to read uncaptured stdout/stderr).

Tracking issue: https://github.com/rust-lang/rust/issues/126819

r? `@onur-ozkan`

try-job: x86_64-msvc
2024-07-28 11:40:27 +00:00
bors
3954398882 Auto merge of #128298 - matthiaskrgr:rollup-0wdu2wo, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #127853 (`#[naked]`: report incompatible attributes)
 - #128276 (Add a README to rustbook to explain its purpose)
 - #128279 (Stabilize `is_sorted`)
 - #128282 (bitwise and bytewise methods on `NonZero`)
 - #128285 (rustc book: document how the RUST_TARGET_PATH variable is used)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-28 09:18:53 +00:00
bors
159524019f Auto merge of #17720 - ThouCheese:fix/doc-to-comment-naming, r=Veykril
flip the naming of the doc comment to comment assist

I did this the wrong way around when I implemented these assists, so here is a quick fix for it
2024-07-28 08:46:34 +00:00
bors
ca66ea2916 Auto merge of #17472 - duncanawoods:master, r=HKalbasi
#17470 - run unit tests at the crate level not workspace

For https://github.com/rust-lang/rust-analyzer/issues/17470

Use the test path to identify a package in the workspace and run the unit test there instead of at the workspace.
2024-07-28 08:20:06 +00:00
Matthias Krüger
b801fab003
Rollup merge of #128285 - lolbinarycat:rustc-custom-targets, r=jieyouxu
rustc book: document how the RUST_TARGET_PATH variable is used

based on the module comment in
rust/compiler/rustc_target/src/spec/mod.rs

Fixes #128280
2024-07-28 08:57:18 +02:00
Matthias Krüger
32f6534c91
Rollup merge of #128282 - pitaj:nonzero_bitwise, r=workingjubilee
bitwise and bytewise methods on `NonZero`

Implementation for `nonzero_bitwise`
Tracking issue #128281
ACP https://github.com/rust-lang/libs-team/issues/413
2024-07-28 08:57:18 +02:00
Matthias Krüger
99204047c9
Rollup merge of #128279 - slanterns:is_sorted, r=dtolnay
Stabilize `is_sorted`

Closes: https://github.com/rust-lang/rust/issues/53485.

~~Question: does~~ 8fe0c753f2/compiler/rustc_lint_defs/src/builtin.rs (L1986-L1994) ~~need a new example?~~
edit: It causes a test failure and needs to be changed anyway.

``@rustbot`` label: +T-libs-api

r? libs-api
2024-07-28 08:57:17 +02:00
Matthias Krüger
13b7c230d8
Rollup merge of #128276 - ehuss:rustbook-readme, r=Kobzol
Add a README to rustbook to explain its purpose

This adds a README to the rustbook tool to help explain what it is for and how to use it.
2024-07-28 08:57:17 +02:00
Matthias Krüger
a13f40dae6
Rollup merge of #127853 - folkertdev:naked-function-error-messages, r=bjorn3
`#[naked]`: report incompatible attributes

tracking issue: https://github.com/rust-lang/rust/issues/90957

this is a re-implementation of https://github.com/rust-lang/rust/pull/93809 by ``@bstrie`` which was closed 2 years ago due to inactivity.

This PR takes some of the final comments into account, specifically providing a little more context in error messages, and using an allow list to determine which attributes are compatible with `#[naked]`.

Notable attributes that are incompatible with `#[naked]` are:

  * `#[inline]`
  * `#[track_caller]`
  * ~~`#[target_feature]`~~ (this is now allowed, see PR discussion)
  * `#[test]`, `#[ignore]`, `#[should_panic]`

These attributes just directly conflict with what `#[naked]` should do.

Naked functions are still important for systems programming, embedded, and operating systems, so I'd like to move them forward.
2024-07-28 08:57:16 +02:00
bors
0bb6fec1c9 Auto merge of #128293 - aDotInTheVoid:github-pls-fix-🏳️‍⚧️, r=Noratrieb
trans her gender

CC https://github.com/rust-lang/team/pull/1511

r? `@Noratrieb`
2024-07-28 06:55:47 +00:00
duncan
53fea63c0c 17470 - run test explorer tests at the package level and add missing extra_test_bin_args settings 2024-07-28 07:43:07 +01:00
Josh McKinney
2f0451d113
feat: add trace level to client logs 2024-07-27 21:59:12 -07:00
Josh McKinney
c0df26be42
feat: use vscode log format for client logs
This change updates the log format to use the vscode log format instead
of the custom log format, by replacing the `OutputChannel` with a
`LogOutputChannel` and using the `debug`, `info`, `warn`, and `error`
methods on it. This has the following benefits:

- Each log level now has its own color and the timestamp is in a more
  standard format
- Inspect output (e.g. the log of the config object) is now colored
- Error stack traces are now shown in the output
- The log level is now controlled on the output tab by clicking the gear
  icon and selecting "Debug" or by passing the `--log` parameter to
  vscode. The `trace.extension` setting has been marked as deprecated.
2024-07-27 21:43:35 -07:00
bors
3148b35f6a Auto merge of #128079 - Oneirical:testiges-of-civilization, r=jieyouxu
Migrate `static-dylib-by-default`, `sanitizer-dylib-link`, `sanitizer-cdylib-link` and `sanitizer-staticlib-link` `run-make` tests to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

Please try:

try-job: x86_64-msvc
try-job: armhf-gnu
try-job: test-various
try-job: i686-msvc
try-job: x86_64-mingw
try-job: x86_64-gnu-llvm-18
2024-07-28 04:16:12 +00:00
binarycat
5eea6d7542 rustc book: document how the RUST_TARGET_PATH variable is used
based on the module comment in
rust/compiler/rustc_target/src/spec/mod.rs

Fixes #128280
2024-07-27 23:25:13 -04:00
Alona Enraght-Moony
16fc1bbfaf trans her gender
CC https://github.com/rust-lang/team/pull/1511
2024-07-27 23:36:23 +00:00
bors
385a74f50f Auto merge of #128270 - weihanglo:update-cargo, r=weihanglo
Update cargo

14 commits in 5f6b9a92201d78af75dc24f14662c3e2dacbbbe1..b5d44db1daf0469b227a6211b987162a39a54730
2024-07-19 18:09:17 +0000 to 2024-07-26 21:27:12 +0000
- Package workspaces (rust-lang/cargo#13947)
- test: migrate messages to snapbox (rust-lang/cargo#14242)
- chore: Update dependencies (rust-lang/cargo#14299)
- fix: remove rustc probe for `--check-cfg` support (rust-lang/cargo#14302)
- Misc test clean up (rust-lang/cargo#14297)
- Don't downgrade on prerelease `VersionReq` when update with --breaking. (rust-lang/cargo#14250)
- test: Migrate some json tests to snapbox (rust-lang/cargo#14293)
- Revert "fix: Ensure dep/feature activates the dependency on 2024" (rust-lang/cargo#14295)
- chore: bump cargo-test-support to 0.4.0 (rust-lang/cargo#14286)
- Bump to 0.83.0; update changelog (rust-lang/cargo#14285)
- Improved error message when `update --breaking` invalid spec. (rust-lang/cargo#14279)
- docs(test): Expand documentation of cargo-test-support (rust-lang/cargo#14272)
- test: Fix some test based on rustc version (rust-lang/cargo#14282)
- Use `Rc` instead of `Arc` for storing rustflags (rust-lang/cargo#14273)

r? ghost
2024-07-27 23:36:10 +00:00