Commit graph

31293 commits

Author SHA1 Message Date
Yunfei
f3a1b902fd Cargo fmt 2024-07-29 16:51:49 +08:00
Yunfei
752c49b679 Fix error message 2024-07-29 16:35:19 +08:00
Yunfei
94244a7a11 feat(ide-completion): explictly show async keyword on impl trait 2024-07-29 15:55:21 +08:00
bors
ee1e55b8d9 Auto merge of #125016 - nicholasbishop:bishop-cb-112, r=tgross35
Update compiler_builtins to 0.1.114

The `weak-intrinsics` feature was removed from compiler_builtins in https://github.com/rust-lang/compiler-builtins/pull/598, so dropped the `compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.

In https://github.com/rust-lang/compiler-builtins/pull/593, some builtins for f16/f128 were added. These don't work for all compiler backends, so add a `compiler-builtins-no-f16-f128` feature and disable it for cranelift and gcc.
2024-07-29 07:41:33 +00:00
Ali Bektas
5ece296adf Remove unnec copying of source_root_ids 2024-07-29 03:46:02 +02:00
Ali Bektas
f0d595dc77 add skip_slow_tests to ratoml tests 2024-07-29 03:43:27 +02:00
Ali Bektas
e0b6d2f681 Combine krate_ratoml and workspace_ratomls into one 2024-07-29 03:39:47 +02:00
Mark Rousskov
1b473ed74c step cfg(bootstrap) 2024-07-28 14:46:29 -04:00
bors
fd74511f34 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
900db35537 Merge from rust-lang/rust 2024-07-28 17:19:33 +03:00
Laurențiu Nicola
3e55b5b18f Preparing for merge from rust-lang/rust 2024-07-28 17:19:12 +03:00
bors
cdb97b8b30 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
3cf17dcfc6 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
duncan
20d3237dfa 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
huntc
ec7451cc8d Determine toolchain RA on age
Selects a rust-toolchain declared RA based on its date. The earliest (oldest) RA wins and becomes the one that the workspace uses as a whole.

In terms of precedence:

nightly > stable-with-version > stable

With stable-with-version, we invoke the RA with a `--version` arg and attempt to extract a date. Given the same date as a nightly, the nightly RA will win.
2024-07-28 16:09:05 +10:00
Josh McKinney
917ed63095
feat: add trace level to client logs 2024-07-27 21:59:12 -07:00
Josh McKinney
45a881313a
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
Luuk Wester
64ee4d3b1e flip the naming of the doc comment to comment assist 2024-07-28 00:48:08 +02:00
Ali Bektas
d7bedc85b3 Down to 1 failing test
And that is due to a case where we have two ratomls in a source root, one of which
is a `workspace_ratoml` and the other one is simple old ratoml. Since we are not checking to see if
the source root is already populated with workspace ratoml, this test fails. Due to principles of clear
code I believe it is reasonable to not have two HashMaps that are almost for the exact same thing.
So next commit should remove `workspace_ratoml` and merge it with `krate_ratoml`s.
2024-07-27 23:52:40 +02:00
bors
a46788318c Auto merge of #17511 - mckenfra:github_issue_17497_fix_v5, r=flodiebold
#17497 - Invalid RA diagnostic error: expected 2 arguments, found 1

Fix for #17497

The issue occurs because in some configurations of traits where one of them has `Deref` as a supertrait, RA's type inference algorithm fails to resolve the `Deref::Target` type, and instead uses a `TyKind::BoundVar` (i.e. an unknown type). This "autoderefed" type then incorrectly acts as if it implements all traits in scope.

The fix is to re-apply the same sanity-check that is done in [`iterate_method_candidates_with_autoref()`](9463d9eea4/crates/hir-ty/src/method_resolution.rs (L1008)), that is: don't try to resolve methods on unknown types. This same sanity-check is now done on each autoderefed type for which trait methods are about to be checked. If the autoderefed type is unknown, then the iterating of the trait methods for that type is skipped.

Includes a unit test that only passes after applying the fixes in this commit.

Includes a change to the assertion count in test `syntax_highlighting::tests::benchmark_syntax_highlighting_parser` as suggested by Lukas Wirth during review.

Includes a change to the sanity-check code as suggested by Florian Diebold during review.
2024-07-27 17:02:03 +00:00
Francis McKenzie
e77752eaf0 Fix for #17497 - Invalid RA diagnostic error: expected 2 arguments, found 1
The issue occurs because in some configurations of traits where one of them has Deref as a supertrait, RA's type inference algorithm fails to resolve the Deref::Target type, and instead uses a TyKind::BoundVar (i.e. an unknown type). This "autoderefed" type then incorrectly acts as if it implements all traits in scope.

The fix is to re-apply the same sanity-check that is done in iterate_method_candidates_with_autoref(), that is: don't try to resolve methods on unknown types. This same sanity-check is now done on each autoderefed type for which trait methods are about to be checked. If the autoderefed type is unknown, then the iterating of the trait methods for that type is skipped.

Includes a unit test that only passes after applying the fixes in this commit.

Includes a change to the assertion count in test syntax_highlighting::tests::benchmark_syntax_highlighting_parser as suggested by Lukas Wirth during review.

Includes a change to the sanity-check code as suggested by Florian Diebold during review.
2024-07-28 00:32:37 +08:00
bors
9fcaab3704 Auto merge of #17714 - Throne3d:patch-1, r=Veykril
docs: Reference cov_mark crate instead of test_utils/mark

Seems this was switched over in https://github.com/rust-lang/rust-analyzer/issues/7922

I'm guessing this should skip the changelog because it's so minor, right? Reading through https://github.com/rust-lang/rust-analyzer/blob/master/docs/dev/style.md and trying to get up to speed here =)
2024-07-27 04:33:24 +00:00
bors
072d7107bc Auto merge of #17713 - alibektas:17710, r=Veykril
fix: early exit if unresolved field is an index

Fixes #17710
2024-07-27 04:19:09 +00:00
Ryo Yoshida
fdb367ab89 fix: let glob imports override other globs' visibility 2024-07-27 00:10:53 -03:00
Edward Jones
d10cdd25e7
docs: Reference cov_mark crate instead of test_utils/mark
Seems this was switched over in https://github.com/rust-lang/rust-analyzer/issues/7922
2024-07-26 22:49:11 -03:00
Ali Bektas
480db310b6 early exit if unresolved field is an index 2024-07-26 22:44:47 +02:00
bors
aae54dde8c Auto merge of #17709 - Young-Flash:hover_tooltip, r=Veykril
fix: tweak hover/tooltip links

close https://github.com/rust-lang/rust-analyzer/issues/17628
2024-07-26 16:12:50 +00:00
Young-Flash
38817263e4 fix: tweak hover/tooltip links 2024-07-26 23:13:55 +08:00
Lukas Wirth
7beac14cba Internal: Cleanup proc-macro error handling 2024-07-26 14:38:19 +02:00
bors
f46af90ba8 Auto merge of #17706 - Veykril:fragment-include-fix, r=Veykril
fix: Fix includes not working with expr fragment inputs

Temporary workaround for https://github.com/rust-lang/rust-analyzer/issues/17701
2024-07-26 08:13:29 +00:00
Lukas Wirth
df15b6f668 fix: Fix includes not working with expr fragment inputs 2024-07-26 10:12:06 +02:00
Ali Bektas
1aece03d16 Globals too are asking for sourcerootid 2024-07-26 03:04:29 +02:00
Ali Bektas
c4c6b64976 Turn root_ratoml into workspace_ratomls 2024-07-26 02:38:02 +02:00
bors
d401839753 Auto merge of #127042 - GrigorenkoPV:derivative, r=compiler-errors
Switch from `derivative` to `derive-where`

This is a part of the effort to get rid of `syn 1.*` in compiler's dependencies: #109302

Derivative has not been maintained in nearly 3 years[^1]. It also depends on `syn 1.*`.

This PR replaces `derivative` with `derive-where`[^2], a not dead alternative, which uses `syn 2.*`.

A couple of `Debug` formats have changed around the skipped fields[^3], but I doubt this is an issue.

[^1]: https://github.com/mcarton/rust-derivative/issues/117
[^2]: https://lib.rs/crates/derive-where
[^3]: See the changes in `tests/ui`
2024-07-25 22:50:58 +00:00
bors
8eba6960d5 Auto merge of #126963 - runtimeverification:smir_serde_derive, r=celinval
Add basic Serde serialization capabilities to Stable MIR

This PR adds basic Serde serialization capabilities to Stable MIR. It is intentionally minimal (just wrapping all stable MIR types with a Serde `derive`), so that any important design decisions can be discussed before going further. A simple test is included with this PR to validate that JSON can actually be emitted.

## Notes

When I wrapped the Stable MIR error types in `compiler/stable_mir/src/error.rs`, it caused test failures (though I'm not sure why) so I backed those out.

## Future Work

So, this PR will support serializing basic stable MIR, but it _does not_ support serializing interned values beneath `Ty`s and `AllocId`s, etc... My current thinking about how to handle this is as follows:

1.  Add new `visited_X` fields to the `Tables` struct for each interned category of interest.

2.  As serialization is occuring, serialize interned values as usual _and_ also record the interned value we referenced in `visited_X`.

    (Possibly) In addition, if an interned value recursively references other interned values, record those interned values as well.

3.  Teach the stable MIR `Context` how to access the `visited_X` values and expose them with wrappers in `stable_mir/src/lib.rs` to users (e.g. to serialize and/or further analyze them).

### Pros

This approach does not commit to any specific serialization format regarding interned values or other more complex cases, which avoids us locking into any behaviors that may not be desired long-term.

### Cons

The user will need to manually handle serializing interned values.

### Alternatives

1.  We can directly provide access to the underlying `Tables` maps for interned values; the disadvantage of this approach is that it either requires extra processing for users to filter out to only use the values that they need _or_ users may serialize extra values that they don't need. The advantage is that the implementation is even simpler. The other pros/cons are similar to the above.

2.  We can directly serialize interned values by expanding them in-place. The pro is that this may make some basic inputs easier to consume. However, the cons are that there will need to be special provisions for dealing with cyclical values on both the producer and consumer _and_ global values will possibly need to be de-duplicated on the consumer side.
2024-07-25 20:27:51 +00:00
bors
c02a4a31ea Auto merge of #17698 - Veykril:remove-trace, r=Veykril
internal: Remove unused trace module
2024-07-25 12:10:30 +00:00
Lukas Wirth
d32e60467f Remove unused trace module 2024-07-25 14:08:48 +02:00
bors
0ba6f4eda0 Auto merge of #17676 - winstxnhdw:precise-capturing, r=Veykril
feat: add preliminary support for `+ use<..>` `precise_capturing` syntax

## Summary

This PR adds basic support for the following syntax.

```rs
fn captures<'a: 'a, 'b: 'b, T>() -> impl Sized + use<'b, T> {}
//                                  ~~~~~~~~~~~~~~~~~~~~~~~
//                          This opaque type does not capture `'a`.

fn outlives<'o, T: 'o>(_: T) {}

fn caller<'o, 'a, 'b: 'o, T: 'o>() {
    //        ~~
    //        ^ Note that we don't need `'a: 'o`.
    outlives::<'o>(captures::<'a, 'b, T>());
}
```

Related to #17598
2024-07-25 11:10:56 +00:00
Winston H.
9f74787d5d fix: handle new TypeBoundKind variant 2024-07-25 10:58:25 +00:00
bors
fa5ff86e04 Auto merge of #17697 - Veykril:cargo-env, r=Veykril
fix: Support new cargo config get env format

Fixes https://github.com/rust-lang/rust-analyzer/issues/17686
2024-07-25 10:30:03 +00:00
Lukas Wirth
c7d6fe5257 fix: Support new cargo config get env format 2024-07-25 12:28:31 +02:00
bors
cddce62237 Auto merge of #17695 - Veykril:typeref-size, r=Veykril
internal: Reduce size of TypeRef by 8 bytes
2024-07-25 09:52:30 +00:00
Lukas Wirth
0e93e6fee7 Make legacy_const_generics_indices thin by double boxing as its seldom used 2024-07-25 11:51:15 +02:00
Lukas Wirth
7f884487d7 Reduce size of TypeRef by 8 bytes 2024-07-25 11:14:55 +02:00
bors
42facc20c6 Auto merge of #17693 - Veykril:astidmap, r=Veykril
Remove Params and Fields from AstIdMap

These are too volatile, and the only reason for them seems to be for cfg diagnostics which does not carry the weight
2024-07-25 09:06:34 +00:00
Lukas Wirth
f2fa456a8c Fix incorrect handling of cfg'd varargs 2024-07-25 11:02:19 +02:00
Lukas Wirth
9cbafa2d49 Remove Params and Fields from AstIdMap 2024-07-25 10:22:05 +02:00
Lukas Wirth
200a01adc4 Generate From impls for Any* nodes 2024-07-25 10:21:58 +02:00
bors
55c9bf894f Auto merge of #127995 - workingjubilee:say-turings-prayer, r=BoxyUwU
compiler: Never debug_assert in codegen

In the name of Turing and his Hoarey heralds, assert our truths before creating a monster!

The `rustc_codegen_llvm` and `rustc_codegen_ssa` crates are fairly critical for rustc's correctness. Small mistakes here can easily result in undefined behavior, since a "small mistake" can mean something like "link and execute the wrong code". We should probably run any and all asserts in these modules unconditionally on whether this is a "debug build", and damn the costs in performance.

...Especially because the costs in performance seem to be *nothing*. It is not clear how much correctness we gain here, but I'll take free correctness improvements.
2024-07-25 07:52:31 +00:00
winstxnhdw
d42e85758c fix: temporarily use ast::GenericParamList 2024-07-25 07:40:08 +01:00