Commit Graph

25395 Commits

Author SHA1 Message Date
Joe Neeman
cdab3507eb Add span to group. 2023-06-07 08:48:19 -05:00
bors
085a3112ae Auto merge of #15000 - lowr:fix/builtin-derive-bound-for-assoc, r=HKalbasi
fix: only generate trait bound for associated types in field types

Given the following definitions:

```rust
trait Trait {
    type A;
    type B;
    type C;
}

#[derive(Clone)]
struct S<T: Trait>
where
    T::A: Send,
{
    qualified: <T as Trait>::B,
    shorthand: T::C,
}
```

we currently expand the derive macro to:

```rust
impl<T> Clone for S<T>
where
    T: Trait + Clone,
    T::A: Clone,
    T::B: Clone,
    T::C: Clone,
{ /* ... */ }
```

This does not match how rustc expands it. Specifically, `Clone` bounds for `T::A` and `T::B` should not be generated.

The criteria for associated types to get bound seem to be 1) the associated type appears as part of field types AND 2) it's written in the shorthand form. I have no idea why rustc doesn't consider qualified associated types (there's even a comment that suggests they should be considered; see rust-lang/rust#50730), but it's important to follow rustc.
2023-06-07 13:00:24 +00:00
Ryo Yoshida
4f0c6fac17
fix: only generate trait bound for associated types in field types 2023-06-07 20:52:49 +09:00
Laurențiu Nicola
08ef169435 Fix dependency warning 2023-06-07 12:34:38 +03:00
bors
1c25885bd2 Auto merge of #14995 - Veykril:proc-macro-slow-test, r=lnicola
fix: Fix proc-macro slow test
2023-06-07 05:04:33 +00:00
Lukas Wirth
a6bef7808f fix: Fix proc-macro slow test 2023-06-07 07:03:27 +02:00
bors
058e2d2bdd Auto merge of #14925 - viktorlott:inline-const-expr-as-static-str, r=HKalbasi
feat: inline const as literal

Assist: inline_const_as_literal

Evaluate and inline const variable as literal.

```rust
const STRING: &str = "Hello, World!";

fn something() -> &'static str {
    STR$0ING
}
```
->
```rust
const STRING: &str = "Hello, World!";

fn something() -> &'static str {
    "Hello, World!"
}
```
2023-06-06 21:30:30 +00:00
bors
f3145dc1f1 Auto merge of #14994 - Veykril:ci-fix, r=Veykril
fix: Fix ci never running on nightly when proc-macro things change

Was wondering why this wasn't running on the subtree sync ...
2023-06-06 21:03:56 +00:00
Lukas Wirth
ef09558575 fix: Fix ci never running on nightly when proc-macro things change 2023-06-06 23:02:58 +02:00
Viktor Lott
eef716d5f2 fix: use render_eval instead of inlined expr 2023-06-06 12:08:11 +02:00
Viktor Lott
2d4cb780b6 fix: Use render_eval for all builtins 2023-06-06 00:34:00 +02:00
Viktor Lott
8103a10a78 update assist to include more literals 2023-06-06 00:34:00 +02:00
Viktor Lott
094c1e7b86 feat: inline const expr as static str 2023-06-06 00:34:00 +02:00
bors
d42d55feaa Auto merge of #14988 - lnicola:sync-from-rust, r=lnicola
internal: Sync from rust
2023-06-05 16:55:06 +00:00
Laurențiu Nicola
338f969181 Merge remote-tracking branch 'upstream/master' into sync-from-rust 2023-06-05 19:54:30 +03:00
Laurențiu Nicola
bbd695589e Merge commit 'ed87e0a20a9d196a5ea659ea46ae9574be666d4f' into sync-from-ra 2023-06-05 15:10:05 +03:00
bors
ed87e0a20a Auto merge of #14984 - lnicola:rm-test-gate, r=Veykril
Bring back sysroot-abi feature

https://github.com/rust-lang/rust/pull/112305
2023-06-05 11:54:45 +00:00
Laurențiu Nicola
768a6c5931 Add back sysroot-abi feature gate to rust-analyzer 2023-06-05 14:43:31 +03:00
Laurențiu Nicola
c48062fe2a Merge commit 'aa9bc8612514d216f84eec218dfd19ab83f3598a' into sync-from-ra 2023-06-05 12:04:23 +03:00
bors
aa9bc86125 Auto merge of #14980 - lnicola:sync-from-rust, r=lnicola
Sync from downstream
2023-06-05 08:33:53 +00:00
Laurențiu Nicola
c3dbe7c717 Merge remote-tracking branch 'upstream/master' into sync-from-rust 2023-06-05 11:07:47 +03:00
bors
c6a3fe051a Auto merge of #14978 - HKalbasi:lifetime-display, r=HKalbasi
Emit `'_` for lifetime generics in `HirDisplay`

This makes the generated code not linted by `rust_2018_idioms` lint. But that is an allow by default lint, so should we do this? Maybe we should only do this for `DisplayTarget::SourceCode`?
2023-06-05 07:26:30 +00:00
hkalbasi
5531d46c95 Emit '_ for lifetime generics in HirDisplay 2023-06-05 10:55:47 +03:30
DropDemBits
dd5f05590e
Migrate extract_type_alias to mutable ast 2023-06-05 00:24:12 -04:00
DropDemBits
e6e72bf9d5
Migrate add_missing_impl_members to mutable ast
`replace_derive_with_manual_impl` was slightly since it used
`add_trait_assoc_items_to_impl`
(which was also used by `add_missing_impl_members`)
2023-06-05 00:23:10 -04:00
bors
2f1b7cedcf Auto merge of #14971 - lowr:fix/captured-item-ty-outer-binder, r=HKalbasi
fix: consider outer binders when folding captured items' type

Fixes #14966

Basically, the crash is caused by us producing a broken type and passing it to chalk: `&dyn for<type> [for<> Implemented(^1.0: A<^0.0>)]` (notice the innermost bound var `^0.0` has no corresponding binder). It's created in `CapturedItemWithoutTy::with_ty()`, which didn't consider outer binders when folding types to replace placeholders with bound variables.

The fix is one-liner, but I've also refactored the surrounding code a little.
2023-06-04 18:25:23 +00:00
bors
5545961df2 Auto merge of #14976 - HKalbasi:mir-fix, r=HKalbasi
Fix missing terminator for slice pattern
2023-06-04 17:30:16 +00:00
hkalbasi
b4907a531f Fix missing terminator for slice pattern 2023-06-04 20:59:27 +03:30
bors
17426835d8 Auto merge of #14972 - HKalbasi:mir-fix, r=HKalbasi
Fix `unused-mut` false positive for `Box`
2023-06-04 12:26:39 +00:00
hkalbasi
0408af6453 Fix unused-mut false positive for Box 2023-06-04 15:56:01 +03:30
Ryo Yoshida
f549cacc1d
Destructure InferenceResult in resolve_all()
so that whenever new fields are added we don't forget to handle them.
2023-06-04 20:38:40 +09:00
Ryo Yoshida
a3789eabc9
Minor refactorings
- use `DefWithBodyId::as_generic_def_id()`
- add comments on `InferenceResult` invariant
- move local helper function to bottom to comply with style guide
2023-06-04 19:39:49 +09:00
Ryo Yoshida
275afd6e79
fix: consider outer binders when folding captured items' type 2023-06-04 19:38:47 +09:00
bors
9d5c34a80e Auto merge of #14970 - HKalbasi:mir-fix, r=HKalbasi
Detect "bound more than once" error and suppress `need-mut` for it.

Fix the `need-mut` false positive for `izip!`
2023-06-04 09:33:53 +00:00
hkalbasi
71f3e4b08c Detect "bound more than once" error and suppress need-mut for it. 2023-06-04 12:39:36 +03:30
bors
c4eb3946fa Auto merge of #14969 - Veykril:inert-attrs, r=Veykril
Update builtin attribute list
2023-06-04 08:02:36 +00:00
Lukas Wirth
f9a9e40c0a Update builtin attribute list 2023-06-04 10:02:11 +02:00
bors
48f8799bf1 Auto merge of #14967 - rust-lang:revert-14965-panic-ctx, r=Veykril
Revert "Add mandatory panic contexts to all threadpool tasks"

Reverts rust-lang/rust-analyzer#14965

This won't quite work actually given the use of `catch_unwind` in some of these
2023-06-04 07:30:54 +00:00
Lukas Wirth
a1af9eb1f8
Revert "Add mandatory panic contexts to all threadpool tasks" 2023-06-04 09:30:21 +02:00
bors
de2320e461 Auto merge of #14965 - Veykril:panic-ctx, r=Veykril
Add mandatory panic contexts to all threadpool tasks

the diagnostics task is panicking I think, but without this you can't really tell because the stack trace ends in a generic iterator fold call instead of something specific.
2023-06-04 07:10:45 +00:00
Lukas Wirth
2d0510e226 Add mandatory panic contexts to all threadpool tasks 2023-06-04 09:09:25 +02:00
bors
4fb1df6b7a Auto merge of #14961 - HKalbasi:mir-fix, r=HKalbasi
Fix drop scopes problems in mir

Fix false positives of `need-mut` emerged from #14955

There are still 5 `need-mut` false positives on self, all related to `izip!` macro hygenic issue. I will try to do something about that before monday release.
2023-06-03 21:40:09 +00:00
hkalbasi
08f89193b5 Fix drop scopes in mir 2023-06-04 01:03:32 +03:30
ponyii
7f45cccda4 lifetime transformation: refactoring & a new test 2023-06-03 21:34:31 +04:00
ponyii
fe8f862757 made the add_missing_impl_members and add_missing_default_members assists transform lifetimes 2023-06-03 21:12:11 +04:00
bors
e5c56cd9a0 Auto merge of #14955 - HKalbasi:mir-fix, r=HKalbasi
Remove unnecessary `StorageDead`

I hope this reduces MIR memory usage.
2023-06-03 13:55:40 +00:00
hkalbasi
f44fc271d4 Remove unnecessary StorageDead 2023-06-03 17:24:10 +03:30
bors
dd0c29c934 Auto merge of #14952 - lowr:fix/assignments-are-right-associative, r=HKalbasi
fix: assignment operators are right associative

Fixes #14944

Assignment operators, be they simple or complex, are right associative in Rust ([reference]). We need to consider that fact when computing [binding power][bp] of infix operators.

The changes in `0072_destructuring_assignment.{rs,rast}` are unexpected, but I'm pretty sure it's a typo and fixed the `.rs` file accordingly.

[reference]: https://doc.rust-lang.org/reference/expressions.html#expression-precedence
[bp]: https://matklad.github.io/2020/04/13/simple-but-powerful-pratt-parsing.html
2023-06-03 12:01:09 +00:00
Ryo Yoshida
f9c1a7dcd9
fix: assignment operators are right associative 2023-06-03 19:58:35 +09:00
bors
7f3bfc6ae7 Auto merge of #14951 - HKalbasi:mir-fix, r=HKalbasi
Fix string pattern matching in mir interpreter
2023-06-02 20:16:28 +00:00