about summary refs log tree commit diff
path: root/src/tools/rust-analyzer/crates/ide-diagnostics
AgeCommit message (Collapse)AuthorLines
2025-03-06Pass the target crate in `HirFormatter`Chayim Refael Friedman-16/+31
This is required to format evaluated consts, because we need trait env, and it needs the crate (currently it uses the last crate in topological order, which is wrong, the next commit will fix that).
2025-02-27fix doc testsBenjaminBrienen-1/+1
2025-02-27enable doctestBenjaminBrienen-1/+0
2025-02-25Support target features implications in target_feature 1.1Chayim Refael Friedman-1/+1
We vendor the list of implications, which isn't nice, but t-compiler doesn't want to make rustc_target available to us.
2025-02-20Improve unset OUT_DIR error messageLukas Wirth-2/+2
2025-02-17Fix detection of ref patterns for path patternsChayim Refael Friedman-0/+21
I was wrong on #19127, I thought hir-def resolver is enough for them, but it turns out not because of paths like `<Enum>::Variant` and `Type::AssocThatIsEnum::Variant`.
2025-02-17Merge pull request #19127 from ChayimFriedman2/different-generic-argsLukas Wirth-1/+66
feat: Refactor path lowering and serve a new path diagnostic
2025-02-16Refactor path loweringChayim Refael Friedman-1/+66
And add a new diagnostic for non-`Fn` parenthesized generic args. Path lowering started to look like a mess, with each function carrying additional parameters for the diagnostic callback (since paths can occur both in type and in expression/pattern position, and their diagnostic handling is different) and the segment index, for the diagnostics report. So I refactored it from stateless functions on `TyLoweringContext` into stateful struct, `PathLoweringContext`, that tracks the process of lowering a path from resolution til assoc types selection.
2025-02-16Improve error recovery when method-calling an assoc functionLukas Wirth-26/+21
2025-02-12Merge pull request #18995 from alibektas/12210Lukas Wirth-7/+8
fix: Lower range pattern bounds to expressions
2025-02-12Propogate error types in mir type projectionsLukas Wirth-0/+13
2025-02-07fix: Resolve projection types before checking castsShoyu Vanilla-0/+35
2025-02-03Do not use make use of `InferenceResult::has_errors` flag for mir buildingLukas Wirth-1/+4
It generaly does not work as expected right now as we fallback type parameters to errors
2025-02-03Make higher levels adapt Bodys exprs having ExprOrPatId valuesAli Bektas-7/+8
2025-01-28Merge pull request #19063 from ↵David Barsky-46/+0
davidbarsky/davidbarsky/backout-struct-default-fields internal: backout `hir-*` changes from #19001
2025-01-28Merge pull request #19015 from Wilfred/mdbookLukas Wirth-1/+1
manual: Convert to mdbook
2025-01-27Back out "feat: Implement `default-field-values`"David Barsky-15/+0
This backs out commit 7de0b2e75a541b98f735ee6fcd12d326be38d23f.
2025-01-27Back out "Handle missing fields diagnostics"David Barsky-31/+0
This backs out commit e6a103ae50699db1dbb0676d075a4bcda2247939.
2025-01-27Merge pull request #19051 from ChayimFriedman2/fn-ptr-unsafeLukas Wirth-0/+12
fix: Report calling unsafe fn pointer as unsafe
2025-01-27Merge pull request #19049 from ChayimFriedman2/add-reference-tyLukas Wirth-2/+2
minor: Remove duplicate method from `hir::Type`
2025-01-27Report calling unsafe fn pointer as unsafeChayim Refael Friedman-0/+12
2025-01-27Remove duplicate method from `hir::Type`Chayim Refael Friedman-2/+2
I added it by mistake in #18927. I chose to keep the method as not static, because it's more comfortable, and keep the name `add_reference()` and not `reference()`, because it is clearer and better matches `strip_reference[s]()`.
2025-01-27Fix #[rustc_deprecated_safe_2024]Chayim Refael Friedman-11/+45
It should be considered by the edition of the caller, not the callee. Technically we still don't do it correctly - we need the span of the method name (if it comes from a macro), but we don't keep it and this is good enough for now.
2025-01-27Handle missing fields diagnosticsShoyu Vanilla-0/+31
2025-01-27feat: Implement `default-field-values`Shoyu Vanilla-0/+15
2025-01-26Support RFC 2396Chayim Refael Friedman-0/+20
AKA. target_feature 1.1, or non unsafe target_feature.
2025-01-25Fix flyimport not filtering via stability of import pathLukas Wirth-2/+10
2025-01-24manual: Convert to mdbookWilfred Hughes-1/+1
Split manual.adoc into markdown files, one for each chapter. For the parts of the manual that are generated from source code doc comments, update the comments to use markdown syntax and update the code generators to write to `generated.md` files. For the weekly release, stop copying the .adoc files to the `rust-analyzer/rust-analyzer.github.io` at release time. Instead, we'll sync the manual hourly from this repository. See https://github.com/rust-analyzer/rust-analyzer.github.io/pull/226 for the sync. This PR should be merged first, and that PR needs to be merged before the next weekly release. This change is based on #15795, but rebased and updated. I've also manually checked each page for markdown syntax issues and fixed any I encountered. Co-authored-by: Lukas Wirth <lukastw97@gmail.com> Co-authored-by: Josh Rotenberg <joshrotenberg@gmail.com>
2025-01-21Cleanup `Name` string renderingLukas Wirth-2/+2
2025-01-19Fix a bug where enum variants were not considered properly in type ns resolutionChayim Refael Friedman-0/+19
They should be considered just as well as in value ns, for example for struct literals.
2025-01-16Add missing `#[rust_analyzer::rust_fixture]` annotationsLukas Wirth-10/+29
2025-01-16update chalkWaffle Lapkin-1/+0
this brings in support from trait upcasting, yay! (and as such fixes a test)
2025-01-16add a test for trait upcasting type mismatchWaffle Lapkin-0/+32
this adds a test asserting *incorrect* behavior that can be seen in <https://github.com/rust-lang/rust-analyzer/issues/18083>, and a test asserting the *correct* behavior for the case of no super traits.
2025-01-13Fix another bug when reaching macro expansion limit caused a stack overflowChayim Refael Friedman-0/+26
This time without missing bindings. Solve it by returning to the old ways, i.e. just throw the extra nodes away. In other words, I acknowledge defeat.
2025-01-10Re-implement rust string highlighting via tool attributeLukas Wirth-7/+13
2025-01-09Merge pull request #18861 from ChayimFriedman2/await-editionLukas Wirth-0/+34
fix: Make edition per-token, not per-file
2025-01-09minor: Fixup macro error kindsLukas Wirth-3/+3
2025-01-09Make edition per-token, not per-fileChayim Refael Friedman-0/+34
More correctly, *also* per-token. Because as it turns out, while the top-level edition affects parsing (I think), the per-token edition affects escaping of identifiers/keywords.
2025-01-07Fix a bug with missing binding in MBEChayim Refael Friedman-0/+2728
We should immediately mark them as finished, on the first entry. The funny (or sad) part was that this bug was pre-existing, but previously to #18327, it was causing us to generate bindings non-stop, 65535 of them, until we get to the hardcoded repetition limit, and then throw it all away. And it was so Blazingly Fast that nobody noticed. With #18327 however, this is still what happens, except that now instead of *merging* the fragments into the result, we write them on-demand. Meaning that when we hit the limit, we've already written all previous entries. This is a minor change, I thought for myself when I was writing this, and it's actually for the better, so who cares. Minor change? Not so fast. This caused us to emit 65535 repetitions, all of which the MBE infra needs to handle when calling other macros with the expansion, and convert to rowan tree etc., which resulted a *massive* hang. The test (and also `analysis-stats`) used to crash with stack overflow on this macro, because we were dropping some crazily deep rowan tree. Now they work properly. Because I am lazy, and also because I could not find the exact conditions that causes a macro match but with a missing binding, I just copied all macros from tracing. Easy.
2025-01-06fix: Handle newstyle `rustc_intrinsic` safety correctlyLukas Wirth-0/+18
2024-12-28Consider `Enum::Variant` even when it comes from a different crateChayim Refael Friedman-0/+25
2024-12-24Unify handling of path diagnostics in hir-tyChayim Refael Friedman-0/+140
Because it was a mess. Previously, pretty much you had to handle all path diagnostics manually: remember to check for them and handle them. Now, we wrap the resolver in `TyLoweringContext` and ensure proper error reporting. This means that you don't have to worry about them: most of the things are handled automatically, and things that cannot will create a compile-time error (forcing you top `drop(ty_lowering_context);`) if forgotten, instead of silently dropping the diagnostics. The real place for error reporting is in the hir-def resolver, because there are other things resolving, both in hir-ty and in hir-def, and they all need to ensure proper diagnostics. But this is a good start, and future compatible. This commit also ensures proper path diagnostics for value/pattern paths, which is why it's marked "feat".
2024-12-18Taking a raw ref of a deref is always safeLukas Wirth-0/+16
2024-12-16Merge pull request #18700 from ChayimFriedman2/dyn-sendLukas Wirth-1/+18
fix: Fix a panic with a diagnostics fix when a keyword is used as a field
2024-12-16Fix a panic with a diagnostics fix when a keyword is used as a fieldChayim Refael Friedman-1/+18
I found it easiest to fix in the quickfix code, and not deeper (e.g. body lowering).
2024-12-16Report unresolved idents for implicit captures in `format_args!()`Chayim Refael Friedman-8/+8
And also a bit of cleanup by storing the capture's span with the open quote included.
2024-12-12Fix typo in error message for invalid castingPhilipp Hofer-1/+1
Corrected the spelling of "defererence" to "dereference" in the error message that informs users about invalid casting requirements.
2024-12-11Properly handle different defaults for severity of lintsChayim Refael Friedman-45/+103
Previously all lints were assumed to be `#[warn]`, and we had a hand-coded list of `#[allow]` exceptions. Now the severity is autogenerated from rustdoc output. Also support lints that change status between editions, and the `warnings` lint group.
2024-12-09minor: Migrate `remove_unnecessary_wrapper` to `SyntaxEditor`Giga Bowser-20/+43
2024-12-09Add diagnostic fix to remove unnecessary wrapper in type mismatchGiga Bowser-62/+375
I also reorganized the tests in a more logical order, and removed the redundant `test_` prefix from their names.