Commit Graph

214 Commits

Author SHA1 Message Date
Lukas Wirth
7072f59fc6 Use chalk_ir::Mutability 2021-03-01 19:57:36 +01:00
Lukas Wirth
5d121cdb45 Introduce Ty::Alias 2021-03-01 14:24:00 +01:00
Lukas Wirth
4b7fc69315 Assert index relationship between type_variable_table and var_unification_table 2021-03-01 13:54:17 +01:00
Lukas Wirth
11a1f13cd1 Being Ty::InferenceVar closes to chalk equivalent 2021-03-01 12:41:29 +01:00
bors[bot]
5df3ee8274
Merge #7816
7816: Lift Ty::Fn into a struct r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-02-28 22:54:07 +00:00
Lukas Wirth
407196b8c0 Lift FnPointer into a struct 2021-02-28 23:53:21 +01:00
cynecx
2cdd1ff1b5 hir_ty: use default type generic for box expressions 2021-02-28 21:18:30 +01:00
Lukas Wirth
a3fd2faba5 Remove Substs from Ty::ForeignType 2021-02-28 20:44:09 +01:00
Lukas Wirth
0e995adcf6 Turn Ty::Tuple variant into a tuple-variant 2021-02-28 20:39:43 +01:00
Lukas Wirth
faf2dd49e4 Fix code_model::Type::walk not walking all types 2021-02-28 20:15:56 +01:00
Lukas Wirth
a3f5491a1a Inline TypeCtor into Ty 2021-02-28 19:13:37 +01:00
Lukas Wirth
7c2dd85a32 Use chalk_ir::Scalar directly 2021-02-28 11:06:37 +01:00
Lukas Wirth
5183c9f083 Introduce TypeCtor::Scalar 2021-02-28 01:20:04 +01:00
Laurențiu Nicola
d03cfe141c Add test from #7273 2021-02-21 19:22:14 +02:00
Laurențiu Nicola
48ae948b22 Bump deps 2021-02-21 19:13:11 +02:00
Lukas Wirth
0799288f01 Don't write trailing whitespace when formatting empty GenericPredicates 2021-02-20 20:43:04 +01:00
Lukas Wirth
9e5192d917 Don't lower TypeBound::Lifetime as GenericPredicate::Error 2021-02-20 19:08:20 +01:00
Laurențiu Nicola
c1d37f030f Add test 2021-02-20 12:43:52 +02:00
Jonas Schievink
216dc856c5 Wrap BuiltinType in code model 2021-02-11 19:52:33 +01:00
Jonas Schievink
925c51aef3 Add test for #1165
Closes #1165
2021-02-10 18:42:35 +01:00
Jonas Schievink
2382dce2d3 Slightly expand test 2021-02-10 17:37:15 +01:00
Jonas Schievink
3c5734712a Add more tests 2021-02-10 15:59:20 +01:00
Jonas Schievink
a00fa0c06f Put the old resolver back 2021-02-10 15:12:45 +01:00
Jonas Schievink
244d8e37f1 Update fixed tests 2021-02-10 14:48:52 +01:00
Jonas Schievink
e837df8479 infer: update resolver when descending into block 2021-02-10 14:41:54 +01:00
Aleksey Kladov
4b1279d0b1 Infra for "unit" benchmarking 2021-02-09 20:25:39 +03:00
bors[bot]
876c4519e3
Merge #7602
7602: Check for dyn impls in method resolution r=flodiebold a=Veykril

Fixes #6777

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-02-08 18:22:35 +00:00
Lukas Wirth
965d31ce5b Check for dyn impls in method resolution 2021-02-08 19:13:54 +01:00
kjeremy
0c3b38695a Update crates
Pulls in https://github.com/rust-lang/chalk/pull/682
2021-02-08 11:38:51 -05:00
bors[bot]
737e7a7b75
Merge #7574
7574: Remove various redundant clones r=kjeremy a=yoshuawuyts

I noticed when running clippy through RA that there are a few instances where `clone` is called where it's not actually needed. I figured a small patch to remove these might be welcome here.

Thanks!

Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2021-02-05 16:04:50 +00:00
Yoshua Wuyts
79d103d5b4 Remove redundant clones 2021-02-05 16:57:26 +01:00
bors[bot]
855b00cbe6
Merge #7570 #7571
7570: Add doc gen to the `generate_enum_match_method` assist r=yoshuawuyts a=yoshuawuyts

Implements a small extension to https://github.com/rust-analyzer/rust-analyzer/pull/7562, generating default comments. I wasn't sure if this would fit the goals of Rust-Analyzer, so I chose to split it into a separate PR. This is especially useful when writing code in a codebase which uses `#![warn(missing_docs)]` lint, as many production-grade libraries do.

The comments we're generating here are similar to the ones found on [`Option::is_some`](https://doc.rust-lang.org/std/option/enum.Option.html#method.is_some) and [`Result::is_err`](https://doc.rust-lang.org/std/result/enum.Result.html#method.is_err). I briefly considered only generating these for `pub` types, but they seem small and unobtrusive enough that they're probably useful in the general case. Thanks!

## Example

__input__
```rust
pub(crate) enum Variant {
    Undefined,
    Minor, // cursor here
    Major,
}
```

__output__
```rust
pub(crate) enum Variant {
    Undefined,
    Minor,
    Major,
}

impl Variant {
    /// Returns `true` if the variant is [`Minor`].
    pub(crate) fn is_minor(&self) -> bool {
        matches!(self, Self::Minor)
    }
}
```

## Future Directions

This opens up the path to adding an assist for generating these comments on existing `is_` methods. This would make it both easy to document new code, and update existing code with documentation.

7571: Cleanup decl_check r=Veykril a=Veykril

bors r+

Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-02-05 15:17:41 +00:00
Lukas Wirth
eeb5bfcfab Cleanup decl_check 2021-02-05 16:09:45 +01:00
Lukas Wirth
486c7175fe Remove unnecessary allocs in case_conv 2021-02-05 15:02:39 +01:00
Jonas Schievink
5d99ba1d9a Make ModPath's representation private 2021-02-04 20:49:24 +01:00
Jonas Schievink
b7be2b1d3c Use block_def_map in body lowering 2021-02-03 14:21:15 +01:00
Laurențiu Nicola
9c4b799dce Bump chalk 2021-02-02 17:40:01 +02:00
Jonas Schievink
7202ce6c96
Revert "Use block_def_map in body lowering" 2021-02-02 11:46:58 +01:00
Jonas Schievink
9cc7d57429 Use block_def_map in body lowering 2021-02-01 13:33:18 +01:00
Lukas Wirth
426ad8e165 Classify function calls as functions when shadowed by types 2021-01-28 19:08:55 +01:00
Laurențiu Nicola
efafcf2428 Bump deps 2021-01-27 14:22:19 +02:00
Jonas Schievink
5c241b0766 Create all ModuleIds through a DefMap method
`ModuleId` needs to be able to represent blocks, and only the
associated `DefMap` will know how to construct that `ModuleId`
2021-01-25 15:21:33 +01:00
Phil Ellison
65a5ea581d Update tests to register the required standard library types 2021-01-23 07:40:25 +00:00
Phil Ellison
7c691f51f9 Fix test names 2021-01-23 07:40:25 +00:00
Phil Ellison
8c7ccdc29d Identify methods using functions ids rather than string names 2021-01-23 07:40:25 +00:00
Phil Ellison
1ff860b93c Implement fix, add tests 2021-01-23 07:40:25 +00:00
Phil Ellison
1316422a7c Add diagnostic for filter_map followed by next 2021-01-23 07:40:24 +00:00
Jonas Schievink
3de8f57c51 Make ModuleId's krate field private 2021-01-22 18:09:55 +01:00
Jonas Schievink
ce29730bc7 Obtain ModuleId's DefMap through a method 2021-01-22 16:33:58 +01:00
bors[bot]
c050e972a3
Merge #7386
7386: Handle box with allocator r=flodiebold a=tweksteen

In 1.49.0, the definition of Box was modified to support an optional
Allocator[1]. Adapt the parsing of the `box` keyword to supply the
expected number of parameters to the constructor.

[1] f288cd2e17

Fixes: #6956 


Co-authored-by: Thiébaud Weksteen <tweek@google.com>
2021-01-22 13:14:40 +00:00