Jonas Schievink
a54564378b
Fix use crate as <name>;
imports
2021-03-17 22:24:51 +01:00
bors[bot]
daee133ba1
Merge #8073
...
8073: Improve diagnostic when including nonexistent file r=jonas-schievink a=jonas-schievink
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-03-17 20:56:37 +00:00
Jonas Schievink
5f80364ede
Improve diagnostic when including nonexistent file
2021-03-17 21:56:09 +01:00
bors[bot]
9d691530d5
Merge #8072
...
8072: Fix "unset `OUT_DIR`" diagnostic when using it in item position r=jonas-schievink a=jonas-schievink
"load out dirs from check" is enabled by default now, but better late than never I guess.
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-03-17 20:42:52 +00:00
Jonas Schievink
c64adfe706
Use first early expansion error during nameres
2021-03-17 21:41:32 +01:00
bors[bot]
bba474bb52
Merge #8071
...
8071: Semantic highlight intradoclinks in documentation r=Veykril a=Veykril
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-17 20:08:42 +00:00
Lukas Wirth
9763f0a6bd
Semantic highlight intradoclinks in documentation
2021-03-17 21:00:01 +01:00
bors[bot]
ec10835d60
Merge #8069
...
8069: Inject highlight into block doc comments r=Veykril a=Veykril
bors r+
Closes https://github.com/rust-analyzer/rust-analyzer/issues/6873
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-17 18:20:25 +00:00
Lukas Wirth
37964f9fef
Inject highlight into block doc comments
2021-03-17 19:12:28 +01:00
bors[bot]
4fa56e3ab1
Merge #8068
...
8068: Correctly handle `#[cfg]` on function parameters r=jonas-schievink a=jonas-schievink
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/5649
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-03-17 17:36:13 +00:00
Jonas Schievink
9436436d20
Improve test
2021-03-17 18:35:17 +01:00
Jonas Schievink
ba0e4c745d
Apply #[cfg]
s when computing function signatures
2021-03-17 18:28:27 +01:00
Jonas Schievink
6356ea24dd
Add test for #[cfg]
on function params
2021-03-17 18:28:27 +01:00
Jonas Schievink
622c780a8c
ItemTree: lower attributes on fn parameters
2021-03-17 18:28:27 +01:00
Jonas Schievink
022a0f061e
Correctly parse attributes on fn parameters
2021-03-17 18:28:27 +01:00
bors[bot]
0a64713845
Merge #8067
...
8067: Check whether cursor is on and not between intra doc links in goto_definition r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-17 16:26:05 +00:00
Lukas Wirth
5481c78f32
Check whether cursor is on and not between intra doc links in goto_definition
2021-03-17 17:24:16 +01:00
bors[bot]
edf11480ce
Merge #8065
...
8065: Better handling of block doc comments r=Veykril a=Veykril
Moves doc string processing to `Attrs::docs`, as we need the indent info from all comments before being able to know how much to strip
Closes #7774
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-17 16:00:43 +00:00
Lukas Wirth
5734b347dd
Fix incorrect newline emission in Attrs::docs
2021-03-17 17:00:08 +01:00
bors[bot]
baa1999168
Merge #8066
...
8066: Handle `#[cfg]` on call arguments r=jonas-schievink a=jonas-schievink
This resolved the issue reported in this comment: https://github.com/rust-analyzer/rust-analyzer/issues/5649#issuecomment-789424608
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-03-17 14:12:39 +00:00
Jonas Schievink
cb530e7c97
Handle #[cfg]
on call arguments
2021-03-17 15:10:46 +01:00
Lukas Wirth
ec824a92d0
Better handling of block doc comments
2021-03-17 14:48:57 +01:00
bors[bot]
0fbfab3b45
Merge #8059
...
8059: Move doc-comment highlight injection from AST to HIR r=matklad,jonas-schievink a=Veykril
Fixes #5016
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-17 11:13:54 +00:00
Lukas Wirth
cdfb5c353f
Remove quadratic attr source lookup
2021-03-17 11:22:40 +01:00
bors[bot]
f7fbea509f
Merge #8063
...
8063: couple clippy::complexity fixes r=matklad a=matthiaskrgr
avoid redundant `.into()` calls to convert T into identical T (`let x: String = String::from("hello").into();`)
use `if let Some(x)` instead of `.is_some()` + `.unwrap()`
don't clone Copy types
remove redundant wrapped ?s: `Some(Some(3)?)` can just be `Some(3)`
use `.map(|x| y)` instead of `and_then(|x| Some(y)` on `Option`s
Co-authored-by: Matthias Krüger <matthias.krueger@famsik.de>
2021-03-17 08:12:34 +00:00
bors[bot]
6fcb5d772f
Merge #8048
...
8048: Fix missing unresolved macro diagnostic in function body r=edwin0cheng a=brandondong
This was an issue I found while working on https://github.com/rust-analyzer/rust-analyzer/pull/7970 .
**Reproduction:**
1. Call a non-existent macro in a function body.
```
fn main() {
foo!();
}
```
2. No diagnostics are raised. An unresolved-macro-call diagnostic is expected.
3. If the macro call is instead outside of the function body, this works as expected.
I believe this worked previously and regressed in https://github.com/rust-analyzer/rust-analyzer/pull/7805 .
**Behavior prior to https://github.com/rust-analyzer/rust-analyzer/pull/7805 :**
- The unresolved-macro-call diagnostic did not exist. Instead, a macro-error diagnostic would be raised with the text "could not resolve macro [path]".
- This was implemented by adding an error to the error sink (https://github.com/rust-analyzer/rust-analyzer/pull/7805/files#diff-50a326c5ae465bd9b31ee4310186380aa06e4fa1f6b41dbc0aed5bcc656a3cb8L657 ).
- The error was propagated through 1a82af3527/crates/hir_def/src/body.rs (L123)
eventually reaching 1a82af3527/crates/hir_def/src/body/lower.rs (L569)
.
**Behavior after:**
- Instead of writing to the error sink, an UnresolvedMacro error is now returned (https://github.com/rust-analyzer/rust-analyzer/pull/7805/files#diff-50a326c5ae465bd9b31ee4310186380aa06e4fa1f6b41dbc0aed5bcc656a3cb8R631 ).
- The parent caller throws away the error as its function signature is `Option<MacroCallId>` (https://github.com/rust-analyzer/rust-analyzer/pull/7805/files#diff-50a326c5ae465bd9b31ee4310186380aa06e4fa1f6b41dbc0aed5bcc656a3cb8R604 ).
- We instead now reach the warn condition (1a82af3527/crates/hir_def/src/body.rs (L124)
) and no diagnostics are created in 1a82af3527/crates/hir_def/src/body/lower.rs (L575)
.
**Fix:**
- Make sure to propagate the UnresolvedMacro error. Report the error using the new unresolved-macro-call diagnostic.
Co-authored-by: Brandon <brandondong604@hotmail.com>
2021-03-17 07:20:28 +00:00
Brandon
a79b5673e8
Follow established ErrorEmitted pattern
2021-03-16 23:31:14 -07:00
Matthias Krüger
ff5f90d8ae
use simpler .map(|x| y) instead of .and_then(|x| Some(y)) for Options. (clippy::bind_instead_of_map)
2021-03-17 02:36:29 +01:00
Matthias Krüger
64b91393b8
remove uselessly wrapped ?s. (clippy::meedless_question_mark
...
let x = Some(3);
let y = Some(x?);
can just be:
let y = x
2021-03-17 02:19:40 +01:00
Matthias Krüger
048dad8c2e
don't clone types that are copy (clippy::clone_on_copy)
2021-03-17 01:56:31 +01:00
Matthias Krüger
c5d654d513
use if let Some(x) instead of if x.is_some() and x.unwrap() (clippy::unnecessary-unwrap)
2021-03-17 01:39:58 +01: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
Lukas Wirth
c766492d26
Properly handle doc attributes in doc-comment highlight injection
2021-03-16 21:15:26 +01:00
bors[bot]
83e6940efb
Merge #8062
...
8062: pit-of-successify tree editor r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-03-16 20:01:20 +00:00
Aleksey Kladov
186a430853
pit-of-successify tree editor
2021-03-16 22:59:57 +03:00
bors[bot]
2f9ce4f663
Merge #8061
...
8061: Auto-magical whitespace r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-03-16 19:53:01 +00:00
Aleksey Kladov
34555593ca
Auto-magical whitespace
2021-03-16 22:51:37 +03:00
bors[bot]
9caeef98e3
Merge #8042
...
8042: Add perf_revision to benchmark results r=lnicola a=d2weber
I gave it a try to add the hash as described in #8031
Feel free to tell me if there is something I could improve.
Co-authored-by: Douglas Weber <douglas.web@web.de>
2021-03-16 19:36:55 +00:00
bors[bot]
9375207461
Merge #8060
...
8060: Move more bounds r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-03-16 19:28:47 +00:00
Aleksey Kladov
d733c9bdad
Move more bounds
...
changelog: skip
2021-03-16 22:28:04 +03:00
Lukas Wirth
3daa302cd3
Fix attribute index assignment in cfg_attr resolution
2021-03-16 19:55:40 +01:00
Lukas Wirth
acc6458390
Replace trait object boxing with extra AttrsOwnerNode
2021-03-16 19:06:58 +01:00
Lukas Wirth
11e9bc60a2
Move doc-comment highlight injection from AST to HIR
2021-03-16 18:57:47 +01:00
bors[bot]
4771a5f1ca
Merge #8041
...
8041: Rename Substs -> Substitution r=flodiebold a=flodiebold
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-03-16 16:58:48 +00:00
Florian Diebold
ce2cae45b5
Rename Substs -> Substitution
2021-03-16 17:58:17 +01:00
bors[bot]
00c80b208b
Merge #8055
...
8055: Implement HirDisplay for some more types r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-16 15:48:35 +00:00
bors[bot]
a69f7ce312
Merge #8053
...
8053: Remove ShortLabel r=Veykril a=Veykril
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-16 15:40:06 +00:00
Lukas Wirth
4d1e1daa31
Implement HirDisplay for some more types
2021-03-16 16:36:34 +01:00
bors[bot]
979e788957
Merge #8034
...
8034: Implement Crate::transitive_reverse_dependencies r=matklad a=Veykril
changelog internal Implement Crate::transitive_reverse_dependencies
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-16 14:54:12 +00:00
Lukas Wirth
bebee2106d
Don't repeat work in transitive_reverse_dependencies
2021-03-16 15:53:34 +01:00