Commit Graph

16545 Commits

Author SHA1 Message Date
Lukas Wirth
617cd7231c Remove SyntaxRewriter usage in eager::eager_macro_recur 2021-04-19 19:28:41 +02:00
bors[bot]
3f1a220f32
Merge #8574
8574: Check for rust doc code attributes like rustdoc does r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-19 11:39:45 +00:00
Lukas Wirth
2f62c0117a Check for rust doc code attributes like rustdoc does 2021-04-19 13:32:52 +02:00
bors[bot]
65dd942fa1
Merge #8565
8565: Fill match arms assist: add remaining arms for tuple of enums r=iDawer a=iDawer

Fix for #8493

However, the assist is still flaky and does not use `hir_ty::diagnostics::match_check`

Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
2021-04-19 11:32:22 +00:00
Dawer
9222d3b0fb Unindent test according to the style guide. 2021-04-19 16:24:09 +05:00
Lukas Wirth
8a959497b1 Don't require all doc fences to be valid for identifying rust code 2021-04-19 11:41:45 +02:00
bors[bot]
75bf832899
Merge #8540
8540: Prevent being able to rename items that are not part of the workspace r=Veykril a=Veykril

This change causes renames that happen on items coming from crates outside the workspace to fail. I believe this should be the right approach, but usage of cargo's workspace might not be entirely correct for preventing these kinds of refactoring from touching things they shouldn't. I'm not entirely sure?

cc #6623, this is one of the bigger footguns when it comes to refactoring, especially in combination with import aliases people tend to rename items coming from a crates dependency which this prevents.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-19 07:57:40 +00:00
bors[bot]
0308fd6dab
Merge #8572
8572: minor: update bug report template r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-04-19 06:09:48 +00:00
Laurențiu Nicola
ef306b2ec2 Update bug report template 2021-04-19 09:07:54 +03:00
bors[bot]
3f432730df
Merge #8467
8467: Adds impl Deref assist r=jhgg a=jhgg

This PR adds a new `generate_deref` assist that automatically generates a deref impl for a given struct field.

Check out this gif:

![2021-04-11_00-33-33](https://user-images.githubusercontent.com/5489149/114296006-b38e1000-9a5d-11eb-9112-807c01b8fd0a.gif)

--

I have a few Q's:
 - [x] Should I write more tests, if so, what precisely should I test for?
 - [x] I have an inline question on line 65, can someone provide guidance? :) 
 - [x] I can implement this for `ast::TupleField` too. But should it be a separate assist fn, or should I try and jam both into the `generate_deref`?
 - [x] I want to follow this up with an assist on `impl $0Deref for T {` which would automatically generate a `DerefMut` impl that mirrors the Deref as well, however, I could probably use some pointers on how to do that, since I'll have to reach into the ast of `fn deref` to grab the field that it's referencing for the `DerefMut` impl. 

Co-authored-by: jake <jh@discordapp.com>
2021-04-19 04:54:04 +00:00
jake
3d1ca786f6 implement field stuff too 2021-04-18 21:51:17 -07:00
bors[bot]
7570212a54
Merge #8569
8569: Support inherent impls in unnamed consts r=jonas-schievink a=jonas-schievink

It turns out that some proc. macros not only generate *trait* impls wrapped in `const _: () = { ... };`, but inherent impls too. Even though it is questionable whether *custom derives* should produce non-trait impls, this is useful for procedural attribute macros once we support them.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-18 23:08:44 +00:00
Jonas Schievink
20c27dbdbe Collect inherent impls in unnamed consts 2021-04-19 01:06:26 +02:00
Jonas Schievink
b777d46ae6 Fix visibility of items in block modules 2021-04-19 01:06:04 +02:00
Lukas Wirth
493aaa1403 Better visualise control flow for change_annotation_support" 2021-04-19 00:14:55 +02:00
bors[bot]
d39873e88b
Merge #8564
8564: Expand `global_asm!` to nothing r=jonas-schievink a=jonas-schievink

fixes https://github.com/rust-analyzer/rust-analyzer/issues/8563

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-18 16:44:14 +00:00
Jonas Schievink
ae84a71e4a Expand global_asm! to nothing 2021-04-18 18:43:45 +02:00
Dawer
8d588efc2b Return to the status quo in #8129 2021-04-18 20:17:30 +05:00
Dawer
51d65caed4 Prevent adding useless match arms 2021-04-18 16:54:09 +05:00
Lukas Wirth
b501b59eda Update lsp-extensions docs 2021-04-18 12:50:44 +02:00
Lukas Wirth
c447a795ab Prevent being able to rename items that are not part of the workspace 2021-04-18 12:44:00 +02:00
bors[bot]
e8e145f13c
Merge #8561
8561: Accept `E<error_number>` notation in doctests r=Veykril a=ChayimFriedman2

````
```compile_fail,E0000
```
````

The code was stolen from rustdoc at 392ba2ba1a/src/librustdoc/html/markdown.rs (L866-L867)

Co-authored-by: Chayim Refael Friedman <chayimfr@gmail.com>
2021-04-18 09:57:43 +00:00
Chayim Refael Friedman
6c287e1504 Accept E<error_number> notation in doctests
```compile_fail,E0000
```

The code was stolen from rustdoc at 392ba2ba1a/src/librustdoc/html/markdown.rs (L866-L867)
2021-04-18 06:15:40 +03:00
bors[bot]
2ace128dd4
Merge #8560
8560: Escape characters in doc comments in macros correctly r=jonas-schievink a=ChayimFriedman2

Previously they were escaped twice, both by `.escape_default()` and the debug view of strings (`{:?}`). This leads to things like newlines or tabs in documentation comments being `\\n`, but we unescape literals only once, ending up with `\n`.

This was hard to spot because CMark unescaped them (at least for `'` and `"`), but it did not do so in code blocks.

This also was the root cause of #7781. This issue was solved by using `.escape_debug()` instead of `.escape_default()`, but the real issue remained.
We can bring the `.escape_default()` back by now, however I didn't do it because it is probably slower than `.escape_debug()` (more work to do), and also in order to change the code the least.

Example (the keyword and primitive docs are `include!()`d at https://doc.rust-lang.org/src/std/lib.rs.html#570-578, and thus originate from macro):

Before:
![image](https://user-images.githubusercontent.com/24700207/115130096-40544300-9ff5-11eb-847b-969e7034e8a4.png)

After:
![image](https://user-images.githubusercontent.com/24700207/115130143-9cb76280-9ff5-11eb-9281-323746089440.png)


Co-authored-by: Chayim Refael Friedman <chayimfr@gmail.com>
2021-04-18 02:14:27 +00:00
Chayim Refael Friedman
f92be7eaab Escape characters in doc comments in macros correctly
Previously they were escaped twice, both by `.escape_default()` and the debug view of strings (`{:?}`). This leads to things like newlines or tabs in documentation comments being `\\n`, but we unescape literals only once, ending up with `\n`.

This was hard to spot because CMark unescaped them (at least for `'` and `"`), but it did not do so in code blocks.

This also was the root cause of #7781. This issue was solved by using `.escape_debug()` instead of `.escape_default()`, but the real issue remained.
We can bring the `.escape_default()` back by now, however I didn't do it because it is probably slower than `.escape_debug()` (more work to do), and also in order to change the code the least.
2021-04-18 03:16:38 +03:00
bors[bot]
19fc1f333f
Merge #8559
8559: Add some more error messages to fixture failure cases r=Veykril a=Veykril

Follow up for #8557
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-17 19:37:59 +00:00
Lukas Wirth
58a6ec549d Add some more error messages to fixture failure cases 2021-04-17 21:34:14 +02:00
bors[bot]
eb38dc704f
Merge #8557
8557: Add an error message to fixture errors r=Veykril a=yoshuawuyts

Improve the error message when folks forget to add an `$0` in one of the fixtures. Figuring this one out was 20 minutes down the drain for me, so figured I might as well make sure nobody else has to go through the same thing in the future. Thanks!

Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2021-04-17 14:51:42 +00:00
Yoshua Wuyts
5518a65037 Add an error message to fixture errors 2021-04-17 16:39:03 +02:00
Dawer
76285f16de Test fill-match-arms assist: partial with wildcards 2021-04-17 15:20:29 +05:00
bors[bot]
fb2d284f28
Merge #8551
8551: nail rowan version down r=lnicola a=drahnr

The different pre versions include breaking changes, which cause build failures for the users.

Co-authored-by: Bernhard Schuster <bernhard@ahoi.io>
2021-04-17 08:00:52 +00:00
Bernhard Schuster
3b7753d257
nail rowan version down
The different pre versions include breaking changes, which cause build failures for the users.
2021-04-17 09:31:54 +02:00
bors[bot]
c9ca6a1434
Merge #8550
8550: Handle extended key value attributes in mbe r=edwin0cheng a=edwin0cheng

fixes #8544

bors r+

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-04-17 06:34:07 +00:00
Edwin Cheng
c4173bb468 Handle extended key value attr in mbe 2021-04-17 14:31:52 +08:00
bors[bot]
df5b6f7d45
Merge #8549
8549: Fix `TestDB::module_at_position` with submodules r=jonas-schievink a=jonas-schievink

Found while looking into https://github.com/rust-analyzer/rust-analyzer/issues/8519

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-17 01:35:22 +00:00
Jonas Schievink
9e8feeb94a Fix TestDB::module_at_position with submodules 2021-04-17 03:34:05 +02:00
bors[bot]
52585df24a
Merge #8546
8546: Return CallInfo for unclosed call expressions r=Veykril a=Veykril

Closes #8522
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-16 21:00:55 +00:00
Lukas Wirth
992965cd82 Return CallInfo for unclosed call expressions 2021-04-16 22:57:33 +02:00
bors[bot]
2009556472
Merge #8542
8542: Include path in `unresolved-macro-call` diagnostic r=matklad a=jonas-schievink



Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-16 20:52:56 +00:00
Dawer
edbb1797fb Fill partial match arms for a tuple of enums 2021-04-17 01:09:09 +05:00
bors[bot]
5274eb12dd
Merge #8539
8539:  fix: Do not propose inherent traits in flyimports and import assists r=flodiebold a=SomeoneToIgnore

Closes https://github.com/rust-analyzer/rust-analyzer/issues/8520

I've went with a separate method approach, since the [highlighted code](https://github.com/rust-analyzer/rust-analyzer/issues/8520#issuecomment-819856337) has not`Type` and uses `Ty` to get his data, but the code I had to change has no access to `Ty` and has `Type` only.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2021-04-16 17:54:47 +00:00
bors[bot]
47b40b6603
Merge #8545
8545: Fix primitive shadowing with inner items r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-16 17:32:02 +00:00
Jonas Schievink
543d4ef7c5 Fix primitive shadowing with inner items 2021-04-16 19:28:22 +02:00
bors[bot]
e53919a425
Merge #8543
8543: Assist fix: Fill match arms for a tuple of a single enum. r=Veykril a=iDawer

This is rather a small fix addressing an issue mentioned in https://github.com/rust-analyzer/rust-analyzer/issues/8493#issuecomment-818770670


Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
2021-04-16 15:47:43 +00:00
Jonas Schievink
ff858376aa Include path in unresolved-macro-call diagnostic 2021-04-16 15:48:03 +02:00
Dawer
8965be3d0e Fill match arms for a tuple of a single enum. 2021-04-16 17:22:11 +05:00
Kirill Bulatov
739edfd5cf Exclude inherent traits from flyimports 2021-04-16 11:13:17 +03:00
bors[bot]
75371eb0fa
Merge #8536
8536: change grammar r=kjeremy a=Milo123459

indexing -> Indexing
fetching -> Fetching
loading -> Loading
roots scanned -> Roots Scanned

Co-authored-by: Milo <50248166+Milo123459@users.noreply.github.com>
2021-04-15 18:48:25 +00:00
Milo
2fa5086424 change grammar 2021-04-15 19:40:07 +01:00
bors[bot]
a78c50f1fe
Merge #8535
8535: Fix markdown links r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-15 17:46:10 +00:00