Commit Graph

5607 Commits

Author SHA1 Message Date
Aleksey Kladov
ff609cc497 Don't reexport generics from HIR 2019-11-11 17:22:06 +03:00
bors[bot]
a599147b42
Merge #2200
2200: Add variables to HIR r=matklad a=matklad

Introduce a `hir::Variable`, which should cover locals, parameters and `self`. Unlike `PatId`, variable knows it's owner so it is self-contained, and should be more convenient to use from `ra_ide_api`. 

The goal here is to hide more details about `Body` from hir, which should make it easier to move `Body` into `hir_def`. I don't think that `ra_ide_api` intrracts with bodies directly at the moment anyway, but the glue layer is based basically on `ast::BindPat`, which seems pretty brittle. 

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-11 11:48:02 +00:00
Aleksey Kladov
8b7f853cc1 Add hir::Local 2019-11-11 14:42:08 +03:00
bors[bot]
ef2a9aedb6
Merge #2205
2205: Implement bulitin line! macro r=matklad a=edwin0cheng

This PR implements bulitin macro `line!` and add basic infra-structure for other bulitin macros:

1. Extend `MacroDefId` to support builtin macros
2. Add a `quote!` macro for simple quasi quoting.

Note that for support others builtin macros, eager macro expansion have to be supported first, this PR not try to handle it. :)

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-11-11 10:53:24 +00:00
Edwin Cheng
4f7df2aac1 Add MacroDefKind 2019-11-11 18:48:16 +08:00
bors[bot]
5ac4ffbc12
Merge #2211
2211: Refactor highlighting to use classify_name r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-11 09:52:56 +00:00
Aleksey Kladov
ef70925f5f Refactor highlighting to use classify_name 2019-11-11 12:52:14 +03:00
bors[bot]
3dff405443
Merge #2210
2210: Introduce ToNav trait r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-11 09:20:20 +00:00
Aleksey Kladov
4deba88c33 Introduce ToNav trait 2019-11-11 12:19:57 +03:00
bors[bot]
2ccc45979c
Merge #2209
2209: impl fmt::Display for BuiltinType r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-11 09:00:27 +00:00
Aleksey Kladov
5bb92c2d1a impl fmt::Display for BuiltinType 2019-11-11 11:59:19 +03:00
bors[bot]
113d7e44b7
Merge #2203
2203: Hover for builtins r=matklad a=kjeremy

Fixes #2192 

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-11-11 08:41:54 +00:00
bors[bot]
8f98f07303
Merge #2207
2207: Forbid visibility qualifiers in traits r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-11 08:27:38 +00:00
Aleksey Kladov
1860f9ab43 Forbid visibility qualifiers in traits 2019-11-11 11:26:57 +03:00
bors[bot]
a09b5b91ae
Merge #2206
2206: Disable debuginfo in dev builds r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-11 07:12:43 +00:00
Aleksey Kladov
9a04426617 Disable debuginfo in dev builds
Hopefully, this makes printf debugging faster!
2019-11-11 10:11:46 +03:00
bors[bot]
317df32eb5
Merge #2204
2204: Make primitive tys public r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-11 06:21:14 +00:00
Aleksey Kladov
ee876e7881 Make primitive tys public 2019-11-11 09:20:18 +03:00
Edwin Cheng
c4aa8b63bc Add line macro and tests 2019-11-11 14:15:09 +08:00
Edwin Cheng
1637a8a590 Add quote macro 2019-11-11 14:14:39 +08:00
Edwin Cheng
c46768d13d Add basic bultin macro infrastructure 2019-11-11 14:13:31 +08:00
bors[bot]
7973fd66e9
Merge #2201
2201: Resolve core types r=matklad a=Matthias247

This adds support for completion and goto definition of
types defined within the "core" crate. The core crate is
added as a dependency to each crate in the project.

The core crate exported it's own prelude. This caused
now all crates to inherit the core crates prelude instead
of the std crates. In order to avoid the problem the
prelude resolution has been changed to overwrite
an already resolved prelude if this was set to a crate
named core - in order to pick a better prelude like std.

Fixes #2199

Co-authored-by: Matthias Einwag <matthias.einwag@live.com>
2019-11-10 21:35:19 +00:00
Matthias Einwag
d634364462 Overwrite the prelude with one defined in a later dependency
This removes the special casing for the "core" prelude.
Whenever a later dependency also exports a prelude, it will replace
the formerly imported prelude.  The utilized prelude then depends
purely on import order.
2019-11-10 13:15:47 -08:00
Jeremy Kolb
3188c1451a Hover for builtins 2019-11-10 13:59:39 -05:00
Matthias Einwag
8baa05666c Add tests for resolving types in core and std preludes 2019-11-09 17:38:08 -08:00
Matthias Einwag
799903ba16 Resolve core types
This adds support for completion and goto definition of
types defined within the "core" crate. The core crate is
added as a dependency to each crate in the project.

The core crate exported it's own prelude. This caused
now all crates to inherit the core crates prelude instead
of the std crates. In order to avoid the problem the
prelude resolution has been changed to overwrite
an already resolved prelude if this was set to a crate
named core - in order to pick a better prelude like std.

Fixes #2199
2019-11-09 15:22:19 -08:00
bors[bot]
9d786ea221
Merge #2198
2198: Unfork struct and union ids r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-09 12:37:49 +00:00
Aleksey Kladov
6294fd5ec9 Unfork struct and union ids 2019-11-09 15:34:00 +03:00
bors[bot]
defc7ad772
Merge #2197
2197: Remove typed macro parsing API r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-09 10:16:48 +00:00
Aleksey Kladov
70f2a21b55 Remove typed macro parsing API
We do type-erasure on every path anyway, so it doesn't make much sense
to duplicate this function for every type
2019-11-09 13:14:10 +03:00
Aleksey Kladov
f6c40c09e0 Minor cleanup 2019-11-09 12:49:35 +03:00
bors[bot]
561bb979ce
Merge #2169
2169: MBE: Mapping spans for goto definition r=matklad a=edwin0cheng

Currently, go to definition gives the wrong span in MBE.  This PR implement a mapping mechanism to fix it and it could be used for future MBE hygiene implementation.

The basic idea of the mapping is:
1. When expanding the macro, generated 2 `TokenMap` which maps the macro args and macro defs between tokens and input text-ranges.
2. Before converting generated `TokenTree` to `SyntaxNode`, generated a `ExpandedRangeMap` which is a mapping between token and output text-ranges.
3. Using these 3 mappings to construct an `ExpansionInfo`  which can map between input text ranges and output text ranges.


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-11-09 09:13:14 +00:00
Edwin Cheng
0a5ec69404 Remove map_ranges in RevTokenMap 2019-11-09 12:00:46 +08:00
bors[bot]
23939cabcc
Merge #2196
2196: Touch up nameres doc comment r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-08 21:24:02 +00:00
Aleksey Kladov
c626a677e8 Touch up nameres doc comment 2019-11-09 00:23:19 +03:00
Aleksey Kladov
657340e078 Reduce visibility 2019-11-09 00:23:11 +03:00
Aleksey Kladov
53945841be Extract path resolution submodule 2019-11-09 00:17:17 +03:00
Aleksey Kladov
785887b382 Simplify
There's only one call-site for the function, so it seems fine to
inline
2019-11-08 23:53:39 +03:00
Aleksey Kladov
dc5e5f610c Reduce visibility 2019-11-08 23:47:52 +03:00
Edwin Cheng
d01e0abdb5 Refactor and simpfily 2019-11-09 04:26:28 +08:00
Edwin Cheng
62ed93db13 Refactor and add more comments 2019-11-08 10:19:41 +08:00
bors[bot]
ee798a02b3
Merge #2194
2194: Update crates r=matklad a=kjeremy

Removes nodrop and extra arrayvec

We have an extra crossbeam-queue and crossbeam-utils left but those should
drop once rayon accepts https://github.com/rayon-rs/rayon/pull/704

Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-11-07 18:28:10 +00:00
kjeremy
91b154fa05 Update crates
Removes nodrop and extra arrayvec

We have an extra crossbeam-queue and crossbeam-utils left but those should
drop once rayon accepts https://github.com/rayon-rs/rayon/pull/704
2019-11-07 13:05:12 -05:00
bors[bot]
2a8d48d8a9
Merge #2193
2193: cargo xtask format with rust 1.39 r=matklad a=kjeremy

Needed to pass tests on latest stable

Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-11-07 14:57:30 +00:00
kjeremy
e670a99413 cargo xtask format with 1.39 2019-11-07 09:44:45 -05:00
bors[bot]
14e19c0df1
Merge #2179
2179: Use HirDatabase to compute `is_deprecated` r=matklad a=martskins

This PR fixes #2167 by introducing `attributes_query` and adding `fn attrs(&self, def: crate::AttrDef) -> Option<Arc<[Attr]>>;`  to the `DefDatabase` trait.

I'm a little concerned about the two spots in `attributes_query` where code is repeated, but I couldn't figure out a way to avoid that, so.. I welcome suggestions 😄 



Co-authored-by: Martin Asquino <martin.asquino@gmail.com>
2019-11-06 21:11:42 +00:00
bors[bot]
ef988492ee
Merge #2191
2191: Cleanup complete_postfix r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-06 11:50:34 +00:00
Aleksey Kladov
b5349af05f Cleanup complete_postfix 2019-11-06 14:50:03 +03:00
bors[bot]
d222608a45
Merge #2188
2188: Ignore line-endings when checking generated files for freshness r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-06 09:41:33 +00:00
Aleksey Kladov
5efd99a6e0 Ignore line-endings when checking generated files for freshness
closes #2184
2019-11-06 12:40:28 +03:00