Lukas Wirth
531e152390
fix: Simplify macro statement expansion handling
2022-07-01 14:49:30 +02:00
Lukas Wirth
bdbffdd463
fix: Fix completions for locals not working properly inside macro calls
2022-06-27 14:39:44 +02:00
bitgaoshu
0dbc091fee
add test for suggest_name
2022-06-25 17:33:27 +08:00
bitgaoshu
6ecabe352a
functions resolve to impl
2022-06-24 19:11:35 +08:00
Florian Diebold
29f01cd9d2
Various cleanups
...
- remove Valid, it serves no purpose and just obscures the diff
- rename some things
- don't use is_valid_candidate when searching for impl, it's not necessary
2022-06-23 14:38:28 +02:00
bitgaoshu
1ef5e14c2c
goto where trait method impl
2022-06-23 14:01:22 +02:00
XFFXFF
6df969f5f4
the offset used for the completion cursor should always be relative to the original file and not to the marco file
2022-06-16 20:34:37 +08:00
XFFXFF
fbf8e12234
the scope of the return type is not the body of the function
2022-06-16 16:24:18 +08:00
Lukas Wirth
6b696fced8
feat: Add binding mode inlay hints
2022-05-14 14:58:35 +02:00
bitgaoshu
5d1aff3357
#11973 associated type is unresolved
2022-04-24 20:51:48 +08:00
Lukas Wirth
4b4a34327e
Remove duplicated crate id field from hir::Type
2022-04-15 20:14:35 +02:00
Lukas Wirth
3632d5946f
minor: Remove pointless rebindings
2022-04-07 01:29:31 +02:00
Lukas Wirth
4a1423337f
fix: Attempt to resolve paths in const arguments heuristically
...
While we don't support const args in type inference yet, we can at least
make use of the fallback path resolution to resolve paths in const args
in the IDE layer to enable some features for them.
2022-04-06 20:24:24 +02:00
Lukas Wirth
7959c24876
fix: Fix path qualifiers not resolving generic type params when shadowed by trait
2022-04-06 19:38:45 +02:00
Jonas Schievink
872b7b9660
Wrap macros in expr position in MacroExpr
node
2022-04-05 17:43:34 +02:00
Lukas Wirth
c290e68ff9
internal: Remove PathResolution::AssocItem
2022-04-01 18:32:05 +02:00
Lukas Wirth
75689f2ad8
internal: Enforce Resolver to always have a module scope
2022-03-31 11:12:08 +02:00
Lukas Wirth
ddf144051a
internal: Treat {global_}asm macros as unsafe
2022-03-20 19:31:00 +01:00
Lukas Wirth
68de7b30e0
feat: Tag macro calls as unsafe if they expand to unsafe expressions
2022-03-20 19:07:44 +01:00
Lukas Wirth
37b48ceb8f
feat: Visualize compiler inserted reborrows via inlay hints
2022-03-20 14:38:16 +01:00
Matthias Krüger
7912e33ed6
fix clippy::needless_borrow
2022-03-12 16:50:49 +01:00
Lukas Wirth
c04b0f435b
Move hir to new MacroId
2022-03-08 23:51:48 +01:00
hkalbasi
660fd4ab41
Resolve only type params in type ns
2022-03-04 12:30:53 +03:30
hkalbasi
4fa8749c44
Preserve order of generic args
2022-03-04 11:46:14 +03:30
Lukas Wirth
7b89d5ede2
internal: Expand the derive attribute into a pseudo expansion
2022-02-22 10:20:40 +01:00
Florian Diebold
4ed5fe1554
Fix assoc type shorthand from method bounds
...
In code like this:
```rust
impl<T> Option<T> {
fn as_deref(&self) -> T::Target where T: Deref {}
}
```
when trying to resolve the associated type `T::Target`, we were only
looking at the bounds on the impl (where the type parameter is defined),
but the method can add additional bounds that can also be used to refer
to associated types. Hence, when resolving such an associated type, it's
not enough to just know the type parameter T, we also need to know
exactly where we are currently.
This fixes #11364 (beta apparently switched some bounds around).
2022-02-03 13:15:02 +01:00
Lukas Wirth
82fccb971e
feat: Add very simplistic ident completion for format_args! macro input
2022-01-15 12:23:26 +01:00
Lukas Wirth
dc135cc076
internal: Support registered tools and attributes in ide layer
2022-01-06 14:56:50 +01:00
Lukas Wirth
762a3b3030
Fix tool module classification not working correctly
2022-01-02 23:14:18 +01:00
Lukas Wirth
37a87708ae
internal: Don't kick off inference in Semantics::descend_into_macros_impl
2021-12-20 13:19:48 +01:00
Laurențiu Nicola
32b6f103a6
Bump chalk
2021-12-19 18:58:39 +02:00
Lukas Wirth
9915103c9e
Simplify
2021-12-14 12:38:20 +01:00
Lukas Wirth
89e1d19ec5
internal: Prefer resolution of inert attributes
2021-12-05 16:28:08 +01:00
Lukas Wirth
d174158abc
Rename things: Tool -> ToolModule
2021-12-03 17:15:19 +01:00
Lukas Wirth
db559e5049
Simplify
2021-12-03 17:07:06 +01:00
Lukas Wirth
e58af219a4
feat: Resolve builtin-attr and tools in ide layer
2021-12-03 16:32:17 +01:00
Jake Heinz
fec2d39f3c
simplify??
2021-12-01 09:23:42 +00:00
Jake Heinz
a1b2d25810
hir: resolve assoc trait type
2021-12-01 08:44:30 +00:00
Lukas Wirth
26419c0379
Fix proc-macro attributes being shadowed by their functions in IDE layer
2021-11-08 14:49:50 +01:00
Lukas Wirth
aa9d093488
Resolve derive attributes even when shadowed
2021-10-19 13:42:36 +02:00
Aleksey Kladov
73b0f9dc04
internal: remove dead code
2021-09-15 21:22:06 +03:00
Laurențiu Nicola
c9f448a834
Fix some clippy lints
2021-08-16 22:04:26 +03:00
Lukas Wirth
25ff7171c4
Introduce TypeInfo
2021-08-03 16:41:53 +02:00
Lukas Wirth
486603d559
Show coerced types on type hover
2021-08-02 17:10:36 +02:00
Lukas Wirth
c6b6f18520
Simplify Semantics::type_of_expr_with_coercion
2021-07-11 14:44:10 +02:00
Lukas Wirth
9e1eb77f6b
Respect coercions in inline_call
2021-07-10 19:24:49 +02:00
Lukas Wirth
7e6f40b6f1
Expose coercions for patterns and expressions in semantics
2021-07-10 19:03:46 +02:00
Lukas Wirth
576e3a4e12
add_explicit_type
respects coercions
2021-07-10 18:19:46 +02:00
Maan2003
c9b4ac5be4
clippy::redudant_borrow
2021-06-13 09:24:16 +05:30
Lukas Wirth
26e784a575
simplify
2021-05-26 21:09:27 +02:00
bors[bot]
495c9586ec
Merge #8945
...
8945: fix: Make expected type work in more situations r=flodiebold a=flodiebold
Also makes call info show the correct types for generic methods.
![2021-05-23-182952_1134x616_scrot](https://user-images.githubusercontent.com/906069/119269023-dd5a5b00-bbf5-11eb-993a-b6e122c3b9a6.png )
![2021-05-23-183117_922x696_scrot](https://user-images.githubusercontent.com/906069/119269025-dfbcb500-bbf5-11eb-983c-fc415b8428e0.png )
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-05-23 21:55:51 +00:00
Florian Diebold
b8262099cc
Get rid of field_type again
2021-05-23 23:54:35 +02:00
Lukas Tobias Wirth
da74c66947
Correctly resolve crate name in use paths when import shadows itself
2021-05-23 19:37:01 +02:00
Florian Diebold
4a6cdd776d
Record method call substs and use them in call info
2021-05-23 18:24:21 +02:00
Jonas Schievink
20ae41c1a1
Reuse database in LowerCtx
2021-05-06 23:23:50 +02:00
Jonas Schievink
976a3226fe
Don't store call-site text offsets in hygiene info
2021-05-06 19:59:54 +02:00
cynecx
cf3b4f1e20
hir_ty: Expand macros at type position
2021-04-17 16:24:56 +02:00
Florian Diebold
92dcc53f94
Remove Ty::substs{_mut}
...
Almost all uses actually only care about ADT substs, so it's better to
be explicit. The methods were a bad abstraction anyway since they
already didn't include the inner types of e.g. `TyKind::Ref` anymore.
2021-04-07 17:56:53 +02:00
Jonas Schievink
230c763648
infer: remove record_pat_field_resolutions
field
...
Same as https://github.com/rust-analyzer/rust-analyzer/pull/8376 , this
can be computed from other data
2021-04-06 19:44:28 +02:00
Jonas Schievink
e9752308bb
infer: remove record_field_resolutions
field
...
It stores no useful data, since we can derive all fields from
`variant_resolutions`
2021-04-06 17:59:18 +02:00
Florian Diebold
30a339e038
Add Interner parameter to Binders::substitute
2021-04-05 19:21:01 +02:00
Florian Diebold
05eba0db3d
Binders::subst -> substitute
2021-04-05 19:20:28 +02:00
Lukas Wirth
9fe10a9606
Resolve associated types with type anchors
2021-04-01 21:52:07 +02:00
Lukas Wirth
444f6caaba
Resolve associated types
2021-04-01 21:31:25 +02:00
Matthias Krüger
966c23f529
avoid converting types into themselves via .into() (clippy::useless-conversion)
...
example: let x: String = String::from("hello world").into();
2021-03-17 01:27:56 +01:00
Florian Diebold
ce2cae45b5
Rename Substs -> Substitution
2021-03-16 17:58:17 +01:00
Aleksey Kladov
f7156cb0ae
Simplify source maps for fields
2021-03-15 15:38:50 +03:00
Aleksey Kladov
af2366acdf
Goto definition works for S { a: }
case
...
What happens here is that we lower `: ` to a missing expression, and
then correctly record that the corresponding field expression resolves
to a specific field. Where we fail is in the mapping of syntax to this
missing expression. Doing it via `ast_field.expr()` fails, as that
expression is `None`. Instead, we go in the opposite direcition and ask
each lowered field about its source.
This works, but has wrong complexity `O(N)` and, really, the
implementation is just too complex. We need some better management of
data here.
2021-03-15 15:12:39 +03:00
Aleksey Kladov
e346a9c5e1
Remove useless code_model indirection
2021-03-08 22:08:30 +03:00
Lukas Wirth
a3f5491a1a
Inline TypeCtor into Ty
2021-02-28 19:13:37 +01:00
Jonas Schievink
216dc856c5
Wrap BuiltinType
in code model
2021-02-11 19:52:33 +01:00
Lukas Wirth
a195711df0
Resolve TupleStructPat in SourceAnalyzer::resolve_path
2021-02-10 09:37:22 +01:00
Lukas Wirth
e3eeccf8ef
Prefer ValueNS when resolving hir path for PathExpressions
2021-01-29 15:59:52 +01:00
Lukas Wirth
426ad8e165
Classify function calls as functions when shadowed by types
2021-01-28 19:08:55 +01:00
Lukas Wirth
0acdb73076
Add ConstParams to the HIR
2021-01-01 10:06:42 +01:00
Aleksey Kladov
f6ed16674c
Align code_model name with ungrammar
2020-12-20 10:05:24 +03:00
Aleksey Kladov
4015ff0e0b
Improve code structure
...
Make sure that there's only one entry point, analyze, remove awkard
analyzer2 name
2020-12-11 17:06:21 +03:00
Pavan Kumar Sunkara
4d97f5f037
Rename record_field_pat to record_pat_field
2020-09-10 18:56:04 +02:00
Aleksey Kladov
0ca1ba29e8
Don't expose hir::Path out of hir
...
Conjecture: it's impossible to use hir::Path *correctly* from an IDE.
I am not entirely sure about this, and we might need to add it back at
some point, but I have to arguments that convince me that we probably
won't:
* `hir::Path` has to know about hygiene, which an IDE can't set up
properly.
* `hir::Path` lacks identity, but you actually have to know identity
to resolve it correctly
2020-08-15 18:50:41 +02:00
Aleksey Kladov
ae71a631fd
Rename ra_hir -> hir
2020-08-13 16:36:55 +02:00