bors[bot]
95e8766db6
Merge #4178
...
4178: Validate the location of `crate` in paths r=matklad a=djrenren
**This solution does not fully handle `use` statements. See below**
This pull requests implements simple validation of usages of the `crate` keyword in `Path`s. Specifically it validates that:
- If a `PathSegment` is starts with the `crate` keyword, it is also the first segment of the `Path`
- All other usages of `crate` in `Path`s are considered errors.
This aligns with `rustc`'s rules. Unlike rustc this implementation does not issue a special error message in the case of `::crate` but it does catch the error.
Furthermore, this change does not cover all error cases. Specifically the following is not caught:
```rust
use foo::{crate}
```
This is because this check is context sensitive. From an AST perspective, `crate` is the root of the `Path`. Only by inspecting the full `UseItem` do we see that it is not in fact the root. This problem becomes worse because `UseTree`s are allowed to be arbitrarily nested:
```rust
use {crate, {{crate, foo::{crate}}}
```
So this is a hard problem to solve without essentially a breadth-first search. In a traditional compiler, I'd say this error is most easily found during the AST -> HIR conversion pass but within rust-analyzer I'm not sure where it belongs.
Under the implementation in this PR, such errors are ignored so we're *more correct* just not *entirely correct*.
Co-authored-by: John Renner <john@jrenner.net>
2020-04-30 10:17:40 +00:00
oxalica
a1e84516e8
Avoid rustup
invocation for non-rustup rust installation
2020-04-30 17:53:38 +08:00
John Renner
0af727da91
Validate the location of crate
in paths
2020-04-29 11:06:51 -07:00
Laurențiu Nicola
77de40192e
Use x86_64-unknown-linux-gnu for releases
2020-04-28 20:47:13 +03:00
kjeremy
4378c63272
Bump required rust to 1.43
2020-04-23 11:56:32 -04:00
veetaha
972d3b2ba3
Group generated ast boilerplate apart from the interesting part
2020-04-18 23:51:13 +03:00
veetaha
21b98d585e
Refucktor codegen
2020-04-18 21:46:24 +03:00
Benjamin Coenen
828f69ce54
tests: add more info about what failed in tidy tests
...
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-17 10:32:12 +02:00
Timo Freiberg
1231418f31
Change add_function assist to use todo!()
2020-04-13 22:17:06 +02:00
Aleksey Kladov
5e5eb6a108
Align grammar for record patterns and literals
...
The grammar now looks like this
[name_ref :] pat
2020-04-12 00:00:15 +02:00
Chris Hopman
af04d45d32
Change missing impl assist to use todo!() instead of unimplemented()
...
todo!() "Indicates unfinished code" (https://doc.rust-lang.org/std/macro.todo.html )
Rust documentation provides further clarification:
> The difference between unimplemented! and todo! is that while todo!
> conveys an intent of implementing the functionality later and the
> message is "not yet implemented", unimplemented! makes no such claims.
todo!() seems more appropriate for assists that insert missing impls.
2020-04-10 13:56:12 -07:00
Aleksey Kladov
c476742f47
Simplify
2020-04-10 17:47:49 +02:00
Aleksey Kladov
5c5bde47fb
Rename some tokens
2020-04-10 17:07:09 +02:00
Aleksey Kladov
d4332760d8
Better readability
2020-04-10 16:10:28 +02:00
Aleksey Kladov
e0f02d233f
Remove dead code
2020-04-10 16:10:28 +02:00
Aleksey Kladov
4560fe2abf
Generate only minimal set of ineresting tokens
2020-04-10 16:10:28 +02:00
Aleksey Kladov
8d71a6bf0c
Scale token generation back
2020-04-10 16:10:28 +02:00
Aleksey Kladov
779f06ed77
Convert more tokens
2020-04-10 16:10:28 +02:00
Aleksey Kladov
548f562dda
Other delimiters
2020-04-10 16:10:28 +02:00
Aleksey Kladov
460c8bbdec
Curley tokens
2020-04-10 16:10:28 +02:00
Aleksey Kladov
1c5d859195
Start replacing tokens
2020-04-10 16:10:28 +02:00
Aleksey Kladov
c8b4c36f81
Semicolon token
2020-04-10 16:10:28 +02:00
Aleksey Kladov
f89f2e3885
More readable ast_src for keywords
2020-04-10 16:10:28 +02:00
Aleksey Kladov
ff5643c524
Simplify
2020-04-10 16:10:27 +02:00
Aleksey Kladov
30084a56a5
Simpler acessors for keywords
2020-04-09 23:42:01 +02:00
Aleksey Kladov
0ed27c388a
Drop needless trait
2020-04-09 23:02:10 +02:00
Aleksey Kladov
2bfb65db93
Be consistent about token accesors
2020-04-09 18:48:13 +02:00
Aleksey Kladov
e6d22187a6
Add _token suffix to token accessors
...
I think this makes is more clear which things are : AstNode and which
are : AstToken
2020-04-09 18:25:36 +02:00
Aleksey Kladov
56c8581b90
Put displays at the end
2020-04-09 18:11:16 +02:00
Aleksey Kladov
9285cbffb6
More compact
2020-04-09 18:08:54 +02:00
Aleksey Kladov
6fd2a12495
More compact generated code
2020-04-09 18:07:16 +02:00
Aleksey Kladov
4a063e651f
Move the rest of the tokens to generated/tokens
2020-04-09 17:58:15 +02:00
Aleksey Kladov
c80795e274
Move generated tokens to a separate file
2020-04-09 17:47:46 +02:00
Aleksey Kladov
59b6b2278b
Start ast/generated/tokens
2020-04-09 16:25:06 +02:00
Aleksey Kladov
d61932ef7e
Prepare for spliting generated into tokens and nodes
2020-04-09 16:17:18 +02:00
Aleksey Kladov
0fc8c5cca0
Reduce visibility
2020-04-09 15:49:17 +02:00
Aleksey Kladov
6379061e21
Cleanup import
2020-04-09 15:47:48 +02:00
Aleksey Kladov
689661c959
Scale back to only two traits
2020-04-09 13:00:09 +02:00
Luca Barbieri
60f4d7bd8c
Provide more complete AST accessors to support usage in rustc
2020-04-09 11:50:37 +02:00
Aleksey Kladov
8f01e62bb9
Scale back the traits
2020-04-09 11:04:18 +02:00
Luca Barbieri
68196ccc10
Add AstElement trait, generate tokens, support tokens in enums
...
- Adds a new AstElement trait that is implemented by all generated
node, token and enum structs
- Overhauls the code generators to code-generate all tokens, and
also enhances enums to support including tokens, node, and nested
enums
2020-04-08 17:15:12 +02:00
Aleksey Kladov
9e3c843847
fmt
2020-04-08 12:19:41 +02:00
Aleksey Kladov
ffb7ea678b
Don't strip nightly releases
2020-04-08 11:47:40 +02:00
Aleksey Kladov
372e684f6e
When making a release, just promote the latest nightly
2020-04-07 11:42:36 +02:00
Aleksey Kladov
da8eb29a2f
Macro patterns are not confused with expressions.
...
We treat macro calls as expressions (there's appropriate Into impl),
which causes problem if there's expresison and non-expression macro in
the same node (like in the match arm).
We fix this problem by nesting macor patterns into another node (the
same way we nest path into PathExpr or PathPat). Ideally, we probably
should add a similar nesting for macro expressions, but that needs
some careful thinking about macros in blocks: `{ am_i_expression!() }`.
2020-04-03 16:12:38 +02:00
Aleksey Kladov
db34abeb85
Get rid of ItemOrMacro
2020-03-26 16:10:01 +01:00
Aleksey Kladov
b605271d7f
Fix formatting
2020-03-23 15:20:49 +01:00
Aleksey Kladov
59f6bf87d6
Fix release
2020-03-23 14:33:44 +01:00
Josh Mcguigan
90c66470f9
gen_assists_docs skip hidden files
2020-03-21 09:39:45 -07:00
Aleksey Kladov
4b5435b52b
Make from-source install use cargo installed binary by default
2020-03-20 13:07:12 +01:00
Aleksey Kladov
3d1cb5e20f
Simplify extension tag sniffing
2020-03-19 09:37:03 +01:00
Aleksey Kladov
e511b3280f
Make xtask dist more reliable
2020-03-18 13:23:44 +01:00
Aleksey Kladov
de7662c852
Check that no file contains trailing ws
...
rustfmt allows trailing spaces in string literals unfortunately.
2020-03-17 11:42:54 +01:00
Aleksey Kladov
8f6efa01b2
Tidier tidy checks
2020-03-17 10:27:09 +01:00
Aleksey Kladov
ebab250b6b
Fix version
2020-03-16 13:39:13 +01:00
Aleksey Kladov
680182d0a0
Restore cargo-fmt gating
2020-03-13 12:54:32 +01:00
Aleksey Kladov
afd64ef4f7
Merge pull request #3562 from FireofGods/display_for_node
...
Add `std::fmt::Display` as a supertrait for `AstNode`
2020-03-12 15:40:53 +01:00
Fireassember
31eec5e80c
implementing Display for enums too.
2020-03-11 22:54:24 +02:00
Aleksey Kladov
bf3eef8897
Set extension version during release
2020-03-09 14:24:00 +01:00
Aleksey Kladov
5770fa71fa
Disable jemalloc, it doesn't work out of the box with musl
2020-03-09 13:55:14 +01:00
Aleksey Kladov
264ce7b722
Use jemalloc for linux builds
2020-03-09 12:35:31 +01:00
Fireassember
787043496a
added fmt::Display as a supertrait for AstNode and changed generation.
2020-03-06 19:29:30 +02:00
bors[bot]
aec78f090c
Merge #3472
...
3472: Fix dist again r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-05 10:56:12 +00:00
Aleksey Kladov
700a1a3175
Fix dist again
2020-03-05 11:55:34 +01:00
Aleksey Kladov
ca62f568be
Remove pwd
2020-03-05 11:25:23 +01:00
Aleksey Kladov
166c07b28d
Install node deps during dist
2020-03-05 11:11:47 +01:00
Aleksey Kladov
4a48256f0e
Don't disable proposed features for nightly
2020-03-04 21:35:31 +01:00
Aleksey Kladov
694ca4e185
Build server via dist as well
2020-03-04 18:56:20 +01:00
Aleksey Kladov
558608548f
Hopefully fix YAML syntax
2020-03-04 18:45:56 +01:00
Aleksey Kladov
fd586e58d9
cargo xtask dist
...
This builds the typescript extension
2020-03-04 18:18:20 +01:00
Christopher Durham
e070553cef
Clean xtask partial artifacts in xtask pre-cache
2020-03-02 23:50:10 -05:00
Aleksey Kladov
4eea4e1993
Print log on release
2020-03-02 14:54:55 +01:00
nmio
930b70c5d2
Readability
2020-03-01 13:07:16 +00:00
nmio
4b2880b886
Add note
2020-03-01 13:02:42 +00:00
Aleksey Kladov
a1e1869554
Rename ast::ImplBlock -> ast::ImplDef
2020-02-29 21:33:15 +01:00
Aleksey Kladov
364162f875
Some docs
2020-02-27 11:07:26 +01:00
Aleksey Kladov
520b0c8faf
Make xtask install path-agnostic
2020-02-27 10:55:27 +01:00
Kirill Bulatov
f6816c253b
Update versions
2020-02-18 16:12:40 +02:00
Kirill Bulatov
eceaf94f19
More manual clippy fixes
2020-02-18 16:12:37 +02:00
Aleksey Kladov
c855e36696
Rename config value for server Path
2020-02-18 12:35:44 +01:00
Aleksey Kladov
c0fa5e2246
Rename the binary to rust-analyzer
2020-02-18 12:33:16 +01:00
Aleksey Kladov
59e1207dac
Better folder structure
2020-02-18 11:56:18 +01:00
Aleksey Kladov
2c9b91ad32
Merge ra_vfs_glob and ra_lsp_server
2020-02-17 19:07:30 +01:00
Aleksey Kladov
d7be1da8df
Inline ra_batch
2020-02-17 17:32:17 +01:00
Aleksey Kladov
57140f1730
Drop proptest tests
...
It takes waaay to long to compile.
We should add quickcheck tests when we touch the relevant code next
time.
2020-02-17 16:57:06 +01:00
Aleksey Kladov
94fb9ad6b3
Fix extension name
2020-02-17 15:35:06 +01:00
Veetaha
c9d83bcacc
xtask: bump nodejs requirement while we can!
2020-02-14 23:20:49 +02:00
Aleksey Kladov
2ae71a9ed0
Simplify
2020-02-14 19:13:26 +01:00
Aleksey Kladov
5acb467894
Move rm_rf to not-bash
2020-02-14 19:03:45 +01:00
Aleksey Kladov
cd956a191f
Trim output
2020-02-14 18:59:26 +01:00
Aleksey Kladov
3f675179e5
Add fs2 module for better error messages
2020-02-14 18:56:07 +01:00
Aleksey Kladov
705f8820c9
Update the manual on release
2020-02-14 18:42:48 +01:00
Aleksey Kladov
9fc2748d47
Add dry run mode to xtask release
2020-02-14 18:42:48 +01:00
Aleksey Kladov
f2e8dfc820
Cleanup
2020-02-14 17:11:19 +01:00
Aleksey Kladov
269e2f22a9
More declarative fs massaging
2020-02-14 17:05:56 +01:00
Aleksey Kladov
ce29497e43
Replace Cmd with not-bash
2020-02-14 16:47:09 +01:00
Aleksey Kladov
bd3a41cc33
Prevent auto-update of dev extension
2020-02-14 15:29:19 +01:00
Aleksey Kladov
52dcf3243e
Minor
2020-02-14 15:10:49 +01:00
bors[bot]
759100fb0d
Merge #3062
...
3062: Implement slice pattern AST > HIR lowering r=jplatte a=jplatte
WIP. The necessary changes for parsing are implemented, but actual inference is not yet. Just wanted to upload what I've got so far so it doesn't get duplicated :)
Will fix #3043
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
2020-02-11 21:46:36 +00:00
Jonas Platte
a3b104aa6d
Implement slice pattern AST > HIR lowering
2020-02-11 22:33:11 +01:00
bors[bot]
f8d6d6f23b
Merge #3074
...
3074: Or patterns r=matthewjasper a=matthewjasper
Works towards #2458
Co-authored-by: Matthew Jasper <mjjasper1@gmail.com>
2020-02-10 20:14:08 +00:00
Aleksey Kladov
57147d7471
xtask release
2020-02-10 15:34:04 +01:00
Aleksey Kladov
1b6acc391a
More convenient run_with_output
2020-02-10 15:16:07 +01:00
Aleksey Kladov
bbd9013bca
Add note
2020-02-10 10:53:31 +01:00
Matthew Jasper
8c8d0bb34f
Add or- and parenthesized-patterns
2020-02-09 22:06:15 +00:00
Kirill Bulatov
740a26b7d2
Rename add import assist
2020-02-07 23:53:08 +02:00
Aleksey Kladov
561b4b11ff
Name assist handlers
2020-02-07 17:28:02 +01:00
Aleksey Kladov
755077e372
Doctest autoimport
2020-02-06 18:14:44 +01:00
Aleksey Kladov
5d7614197d
⬆️ rust
2020-01-30 18:03:24 +01:00
Veetaha
ecf3b3c9a1
todo(codegen): added todo to change the reference to removed ra_tools crate
2020-01-17 01:31:03 +02:00
Veetaha
51fec39b82
fix(xtask.gen_syntax.typo): add s to the verb that refers to the 3d person
2020-01-16 00:47:03 +02:00
Aleksey Kladov
bd7aa5db14
Rename VS Code extension to rust-analyzer
2020-01-13 11:13:18 +01:00
Aleksey Kladov
fd394ff424
Use correct rustfmt for codegen
...
closes #1569
2020-01-10 11:23:43 +01:00
Aleksey Kladov
ceb8f74901
⬆️ pico-args
2020-01-08 11:27:31 +01:00
bors[bot]
2a8dd492a8
Merge #2758
...
2758: Add "code-oss" Visual Studio Code binary name r=matklad a=leo-lb
When Visual Studio Code is manually compiled from the upstream
source tree the binary is named "code-oss".
Co-authored-by: leo-lb <lle-bout@zaclys.net>
2020-01-07 16:18:07 +00:00
Aleksey Kladov
6a7db8c701
Share cache cleaning logic between OSes
2020-01-07 16:45:57 +01:00
leo-lb
e34c5d0f06
Add "code-oss" Visual Studio Code binary name
...
When Visual Studio Code is manually compiled from the upstream
source tree the binary is named "code-oss".
2020-01-07 16:42:45 +01:00
Aleksey Kladov
5e7995eeb7
Cleanup
2020-01-07 15:36:43 +01:00
Aleksey Kladov
64f0510d18
Move cmd to a separate dir
2020-01-07 15:33:09 +01:00
Aleksey Kladov
91f9bc2b86
Refactor xtasks
2020-01-07 14:42:56 +01:00
Aleksey Kladov
b02576d562
Simplify
...
help for internal tools does not worth the duplication
2020-01-07 14:11:18 +01:00
Michael Chesser
ce1b34fd59
Improve const generics parsing
...
- Handle const generics type args
- Fix issue with const generic as first parameter in trait impl
2020-01-07 09:29:03 +10:30
Aleksey Kladov
084bd304f3
Switch ast declaration from ron to a macro
2020-01-03 21:54:10 +01:00
Aleksey Kladov
67922a029a
kill unused file
2020-01-02 15:32:36 +01:00
Florian Diebold
1a4a3eb69b
Check for todo!
macros in no_todo
2019-12-26 16:23:40 +01:00
bold
2a09752137
Notify that latest version of VS Code is required
2019-12-24 20:04:42 +08:00
Aleksey Kladov
c7291386d3
⬆️ Rust
2019-12-19 18:27:44 +01:00
Aleksey Kladov
6e48a5bf91
Make reformat hook actually reformat files
2019-12-18 15:45:24 +01:00
Edwin Cheng
74c7c7a8b1
Use rustup toolchain instead of rustup install
2019-12-08 23:13:56 +08:00
Aleksey Kladov
1836671d53
Switch back to npm install
...
Locks like it honors package.lock nowdays
2019-12-02 15:17:55 +01:00
Aleksey Kladov
757e593b25
rename ra_ide_api -> ra_ide
2019-11-27 21:35:06 +03:00
Aleksey Kladov
a87579500a
Move Ty
2019-11-27 21:16:00 +03:00
Aleksey Kladov
d87c16bea6
hir_def is fully doc'ed!
2019-11-24 21:00:50 +03:00
Aleksey Kladov
ad2b6cad48
Remove npm.cmd
...
I *think* this is more correct
2019-11-20 23:27:03 +03:00
Aleksey Kladov
7020167aa2
Cleanup imports
2019-11-20 09:47:14 +03:00
Aleksey Kladov
76da22e66a
Don't create a separate bin for format hook
2019-11-18 15:27:04 +03:00
Aleksey Kladov
c65f42325f
Revert #2230
...
Looks like autocfg tries to do slightly more than we need (see #2231 ),
so let's stick with minimal home-grown solution.
2019-11-14 11:12:52 +03:00
Pascal Hertleif
5075c77957
Use anyhow::Result in xtask, add contexts
...
This builds on #2231 but was actually done before that. You see, the
cause for #2231 was that I got this error message:
Error: Error { kind: Io(Os { code: 2, kind: NotFound, message: "No such file or directory" }) }
Just switching to `anyhow::Result` got me stack traces (when setting
`RUST_LIB_BACKTRACE=1`) that at least showed
stack backtrace:
0: std::backtrace::Backtrace::create
1: std::backtrace::Backtrace::capture
2: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from
3: xtask::install_server
4: xtask::install
5: xtask::main
6: std::rt::lang_start::{{closure}}
7: std::panicking::try::do_call
8: __rust_maybe_catch_panic
9: std::rt::lang_start_internal
10: std::rt::lang_start
11: main
With the added contexts (not at all exhaustive), the error became
Error: install server
Caused by:
0: build AutoCfg with target directory
1: No such file or directory (os error 2)
Since anyhow is such a small thing (no new transitive dependencies!),
and in general gives you `Result<T, Box<dyn Error>>` on steroids, I
think this a nice small change. The only slightly annoying thing was to
replace all the `Err(format!(…))?` calls (haven't even looked at whether
we can make it support wrapping strings though), but the `bail!` macro
is shorter anyway :)
2019-11-13 20:51:57 +01:00
Pascal Hertleif
5e3c1c2b5f
Allow usage of CARGO_TARGET_DIR env var
2019-11-13 20:44:39 +01:00
kjeremy
06754b78ac
Use autocfg to determine rust version
2019-11-13 11:19:07 -05:00
Aleksey Kladov
018255efe3
Minor cleanup
2019-11-13 10:32:53 +03:00
Aleksey Kladov
30bf7e43db
Disallow regressing crate docs
2019-11-12 15:41:02 +03:00
mkucijan
d67157c0f1
Add '--scripts-prepend-node-pat' to npm run package
2019-11-11 20:51:07 +01:00
Aleksey Kladov
5efd99a6e0
Ignore line-endings when checking generated files for freshness
...
closes #2184
2019-11-06 12:40:28 +03:00
Aleksey Kladov
8922a44395
Add small module-level docs
2019-11-04 00:23:14 +03:00
Laurențiu Nicola
e3354c1496
Use run-time project path in xtask
2019-11-01 22:20:44 +02:00
krk
462c1b49c6
Fix typo in xtask/src/main.rs.
2019-10-30 21:17:27 +01:00
bors[bot]
ce3173469c
Merge #2132
...
2132: echo cargo version during install r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-30 17:52:02 +00:00
Aleksey Kladov
e529c8e3e2
echo cargo version during install
2019-10-30 20:49:04 +03:00
kjeremy
b441b4e8ef
Some clippy fixes
2019-10-30 13:36:37 -04:00
Aleksey Kladov
cf4720ffd5
use unicode bar for drawing the cursor
2019-10-26 21:22:40 +03:00
Aleksey Kladov
a5cbd8d5e8
check style for assist docs
2019-10-26 19:08:13 +03:00
bors[bot]
65e3fc8e77
Merge #2075
...
2075: document a couple of assists r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-26 14:38:20 +00:00
Aleksey Kladov
394e474479
add blank lines for readability
2019-10-26 17:27:47 +03:00
bors[bot]
fa4ccc5fef
Merge #2074
...
2074: document tasks module r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-26 14:25:35 +00:00
Aleksey Kladov
e3a253d80f
document tasks module
2019-10-26 17:20:44 +03:00
bors[bot]
75cd15c84f
Merge #2073
...
2073: warn if npm is not found r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-26 14:13:21 +00:00
Aleksey Kladov
8e8b6e7f62
warn if npm is not found
2019-10-26 17:12:56 +03:00
Aleksey Kladov
d385438bcc
generate more assists docs
2019-10-25 23:38:15 +03:00
Aleksey Kladov
0dd35ff2b2
auto-generate assists docs and tests
2019-10-25 14:47:48 +03:00
Aleksey Kladov
a40d02c9eb
refactor comment extraction from tasks
2019-10-24 19:29:38 +03:00
Aleksey Kladov
a409a12f1b
simplify
2019-10-24 19:19:22 +03:00
Aleksey Kladov
6048d29400
xtask: don't depend on itertools
...
xtask should be fast to compiler, as it's a gateway to rust-analyzer
2019-10-23 18:57:18 +03:00
Aleksey Kladov
a669049ef3
xtask: fold gen-tests and gen-ast into codegen
2019-10-23 18:57:18 +03:00
Aleksey Kladov
b5f13d8d51
xtask: move codegen to a module
2019-10-23 18:57:18 +03:00
Aleksey Kladov
4aa7873588
try to warn about old rust
2019-10-21 13:40:40 +03:00
Aleksey Kladov
5376c769f0
rename tools -> xtask
2019-10-17 23:14:05 +03:00
Aleksey Kladov
7b15c4f7ae
WIP: move to xtasks
2019-10-17 22:54:38 +03:00