Commit Graph

5829 Commits

Author SHA1 Message Date
Geoffry Song
989cebc99c Fix parsing of "postfix" range expressions.
Right now they are handled in `postfix_dot_expr`, but that doesn't allow it to
correctly handle precedence. Integrate it more tightly with the Pratt parser
instead.

Also includes a drive-by fix for parsing `match .. {}`.

Fixes #2242.
2019-11-15 00:18:28 -08:00
bors[bot]
31d01efb06
Merge #2251
2251: Privatize modules r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-15 07:45:57 +00:00
Aleksey Kladov
a28907af8c Privatize modules 2019-11-15 10:42:54 +03:00
Aleksey Kladov
9c7a2aef30 Refactor Module::from_source to properly descend from root file 2019-11-15 10:26:31 +03:00
bors[bot]
3ad11973ac
Merge #2165
2165: ra_assists: Add add_new assist r=matklad a=rep-nop

Adds a new assist to autogenerate a new fn based on the selected struct, excluding tuple structs and unions. The fn will inherit the same visibility as the struct and the assist will attempt to reuse any existing impl blocks that exist at the same level of struct.

Not marking this as closing #1644 since there's a part 2 of adding autocompletion for when someone starts typing `[pub ]fn new(...`

Co-authored-by: Wesley Norris <repnop@outlook.com>
2019-11-15 07:01:19 +00:00
bors[bot]
a6d080608d
Merge #2249
2249: Cleanup hover r=matklad a=kjeremy

Take advantage of classify_name to consolidate multiple hover paths. This isn't quite as clean as I want it to be (`no_fallback` bool is wonky). There's a relationship between `HoverResult` being empty and the range that is a little warty.

Also I noticed that HoverResults are always marked as exact and have been for quite a while... maybe that should be removed in another PR.

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-11-15 06:27:59 +00:00
bors[bot]
ae6a803c0a
Merge #2246
2246: Normalize Line Endings r=matklad a=kjeremy

Line endings with git always confuse me so let's be explicit.

In doing this I ran `git add --renormalize .` on my repo per https://help.github.com/en/github/using-git/configuring-git-to-handle-line-endings and it converted a bunch of files. I then backed it all out and ran it again and only this one `Cargo.toml` file changed so I suspect line endings are just weird.

Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-11-15 06:01:26 +00:00
Jeremy Kolb
89647f93c4 Cleanup hover
Take advantage of classify_name
2019-11-14 22:53:42 -05:00
kjeremy
50825a41d8 Renormalize line endings 2019-11-14 19:44:37 -05:00
kjeremy
1e3b1cc7eb Set text to autodetect and use LF 2019-11-14 19:44:37 -05:00
kjeremy
f299e50e6c Remove snapshots since we no long commit them 2019-11-14 19:44:37 -05:00
bors[bot]
bbb022d399
Merge #2245
2245: Even if jemalloc feature is used do not use it on msvc r=matklad a=kjeremy

Fixes #2233

Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-11-14 16:48:58 +00:00
kjeremy
fc9c2915c7 Even if jemalloc feature is used do not use it on msvc
Fixes #2233
2019-11-14 11:47:18 -05:00
bors[bot]
f2c64ba15d
Merge #2243
2243: Move body queries to hir_def r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-14 14:38:01 +00:00
Aleksey Kladov
1583ab1558 Move body queries to hir_def 2019-11-14 17:37:22 +03:00
Aleksey Kladov
ef02296b9f Simplify parsing 2019-11-14 17:36:27 +03:00
bors[bot]
5c3ccc5508
Merge #2240
2240: Move scopes to hir_def r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-14 08:56:48 +00:00
Aleksey Kladov
f924ae3b86 Move scopes to hir_def 2019-11-14 11:56:13 +03:00
bors[bot]
267f194c28
Merge #2238
2238: Slightly better naming r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-14 08:34:26 +00:00
Aleksey Kladov
4efd345b09 Slightly better naming 2019-11-14 11:33:48 +03:00
bors[bot]
2cfa30ac6a
Merge #2237
2237: Revert #2230 r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-14 08:13:20 +00: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
bors[bot]
8af85263f7
Merge #2235
2235: Handle macro-generated expressions slightly less wrong r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-14 07:36:47 +00:00
Aleksey Kladov
da2ca01eba Handle macro-generated expressions slightly less wrong 2019-11-14 10:30:30 +03:00
Aleksey Kladov
a73b7bb3f6 Move expansion to Expander 2019-11-14 10:04:39 +03:00
Aleksey Kladov
5c720b256f Move parse_path to Expander 2019-11-14 09:58:39 +03:00
Aleksey Kladov
e7880db1d0 Expansion stack scaffold 2019-11-14 09:57:57 +03:00
Aleksey Kladov
c89010df2d Add Expader::to_source 2019-11-14 09:57:57 +03:00
Aleksey Kladov
e7e85c60d2 Move original_file to Expander 2019-11-14 09:55:24 +03:00
Aleksey Kladov
8c8ef1432e Rename MacroResolver -> Expander 2019-11-14 09:38:25 +03:00
Aleksey Kladov
b3175b7077 Move current file to MacroResolver 2019-11-14 09:37:33 +03:00
Aleksey Kladov
debf95eb1b Reduce visibility 2019-11-14 09:24:39 +03:00
bors[bot]
38a3c76d15
Merge #2234
2234: Normalize data r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-14 06:11:47 +00:00
Aleksey Kladov
b8f62095d6 Normalize data
No need to store derivable info
2019-11-14 09:09:42 +03:00
bors[bot]
e918b1f2b3
Merge #2232
2232: Use anyhow::Result in xtask, add contexts r=matklad a=killercup

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 :)

Co-authored-by: Pascal Hertleif <pascal@technocreatives.com>
2019-11-13 20:00:58 +00: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
bors[bot]
6195783049
Merge #2231
2231: Allow usage of CARGO_TARGET_DIR env var r=matklad a=killercup



Co-authored-by: Pascal Hertleif <pascal@technocreatives.com>
2019-11-13 19:50:29 +00:00
Pascal Hertleif
5e3c1c2b5f Allow usage of CARGO_TARGET_DIR env var 2019-11-13 20:44:39 +01:00
bors[bot]
4786556657
Merge #2230
2230: Use autocfg to determine rust version r=matklad a=kjeremy

Fixes #2229 

Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-11-13 16:42:50 +00:00
kjeremy
06754b78ac Use autocfg to determine rust version 2019-11-13 11:19:07 -05:00
bors[bot]
c486f8477a
Merge #2228
2228: Update Crates r=matklad a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-11-13 13:30:50 +00:00
Jeremy Kolb
1e40b395ed Update Crates 2019-11-13 08:25:37 -05:00
bors[bot]
d523366299
Merge #2226
2226: Use strongly-typed ast building for early-return assist r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-13 08:59:48 +00:00
Aleksey Kladov
4cea6bb6f1 Make make:: builders slightly more convenient 2019-11-13 11:59:18 +03:00
Aleksey Kladov
e177c65e36 Use strongly-typed ast building for early-return assist 2019-11-13 11:54:21 +03:00
Aleksey Kladov
2a69d584d6 Add a bit of types 2019-11-13 10:54:50 +03:00
Aleksey Kladov
018255efe3 Minor cleanup 2019-11-13 10:32:53 +03:00
bors[bot]
6ca0d79cff
Merge #2225
2225: Reduce duplication between uncertain floats & ints r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-13 06:57:13 +00:00
Aleksey Kladov
70dd70b1fc Reduce duplication between uncertain floats & ints 2019-11-13 09:56:33 +03:00
bors[bot]
3322d65add
Merge #2223
2223: Move expression lowering to hir_def r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-12 15:53:55 +00:00