about summary refs log tree commit diff
path: root/src/tools/rust-analyzer
AgeCommit message (Collapse)AuthorLines
2024-04-18Fix #[rustc_const_panic_str] functions not actually being hookedLukas Wirth-18/+26
2024-04-18Fixup some issues with minicoreLukas Wirth-48/+73
2024-04-18Fix missing function body in minicoreLukas Wirth-2/+3
2024-04-18Handle panicking like rustc CTFE doesNilstrieb-0/+493637
Instead of using `core::fmt::format` to format panic messages, which may in turn panic too and cause recursive panics and other messy things, redirect `panic_fmt` to `const_panic_fmt` like CTFE, which in turn goes to `panic_display` and does the things normally. See the tests for the full call stack.
2024-04-16fix: adjust the limitation for ADTs' fields to 5roife-7/+7
2024-04-16fix: the fields or variants of ADT was not restricted by limitations when ↵roife-3/+40
hovering on Self type
2024-04-16Update tests and docs for hover_show_adtFieldsOrVariantsroife-59/+235
2024-04-16Add config hover_show_adtFieldsOrVariants to handle hovering limitation for ADTsroife-0/+493444
2024-04-10Properly handle emojis as literal prefix in macrosEsteban Küber-1/+1
Do not accept the following ```rust macro_rules! lexes {($($_:tt)*) => {}} lexes!(🐛"foo"); ``` Before, invalid emoji identifiers were gated during parsing instead of lexing in all cases, but this didn't account for macro expansion of literal prefixes. Fix #123696.
2024-03-31Merge commit 'f5a9250147f6569d8d89334dc9cca79c0322729f' into sync-from-raLaurențiu Nicola-3632/+5731
2024-03-28Make `cargo run` always available for binariesJosh McKinney-0/+491402
Previously, items for `cargo test` and `cargo check` would appear as in the `Select Runnable` quick pick that appears when running `rust-analyzer: Run`, but `run` would only appear as a runnable if a `main`` function was selected in the editor. This change adds `cargo run` as an always available runnable command for binary packages. This makes it easier to develop cli / tui applications, as now users can run application from anywhere in their codebase.
2024-03-17Merge commit '5ecace48f693afaa6adf8cb23086b651db3aec96' into sync-from-raLaurențiu Nicola-1917/+3374
2024-03-10Bring back in-rust-tree feature to ideLaurențiu Nicola-0/+3
2024-03-10Merge commit '574e23ec508064613783cba3d1833a95fd9a5080' into sync-from-raLaurențiu Nicola-2350/+4709
2024-03-05Change message type in bug functions.Nicholas Nethercote-2/+3
From `impl Into<DiagnosticMessage>` to `impl Into<Cow<'static, str>>`. Because these functions don't produce user-facing output and we don't want their strings to be translated.
2024-03-03Merge commit '4ef6a49b44e8aa380da7522442234bfd7a52c55e' into sync-from-raLaurențiu Nicola-1267/+3264
2024-02-25Avoid using cfg(FALSE)Laurențiu Nicola-2/+1
2024-02-25Add missing importsLaurențiu Nicola-1/+1
2024-02-25Merge commit '4a8d0f7f565b6df45da5522dd7366a4df3460cd7' into sync-from-raLaurențiu Nicola-703/+1828
2024-02-19Remove suspicious auto trait lintSantiago Pastorino-5/+0
2024-02-18Auto merge of #117772 - surechen:for_117448, r=petrochenkovbors-34/+20
Tracking import use types for more accurate redundant import checking fixes #117448 By tracking import use types to check whether it is scope uses or the other situations like module-relative uses, we can do more accurate redundant import checking. For example unnecessary imports in std::prelude that can be eliminated: ```rust use std::option::Option::Some;//~ WARNING the item `Some` is imported redundantly use std::option::Option::None; //~ WARNING the item `None` is imported redundantly ```
2024-02-18By tracking import use types to check whether it is scope uses or the other ↵surechen-34/+20
situations like module-relative uses, we can do more accurate redundant import checking. fixes #117448 For example unnecessary imports in std::prelude that can be eliminated: ```rust use std::option::Option::Some;//~ WARNING the item `Some` is imported redundantly use std::option::Option::None; //~ WARNING the item `None` is imported redundantly ```
2024-02-18Merge commit 'ac998a74b3c8ff4b81c3eeb9a18811d4cc76226d' into sync-from-raLaurențiu Nicola-1959/+7095
2024-02-15Add `ErrorGuaranteed` to `ast::LitKind::Err`, `token::LitKind::Err`.Nicholas Nethercote-4/+4
This mostly works well, and eliminates a couple of delayed bugs. One annoying thing is that we should really also add an `ErrorGuaranteed` to `proc_macro::bridge::LitKind::Err`. But that's difficult because `proc_macro` doesn't have access to `ErrorGuaranteed`, so we have to fake it.
2024-02-12Tweak delayed bug mentions.Nicholas Nethercote-1/+1
Now that we have both `delayed_bug` and `span_delayed_bug`, it makes sense to use the generic term "delayed bug" more.
2024-02-11Merge commit 'ddf105b646c6749a2de2451c9a499a354eec79c2' into sync-from-raLaurențiu Nicola-3027/+14636
2024-02-04Try to fix in-tree buildLaurențiu Nicola-3/+3
2024-02-04Merge commit '0113bc9388b480fa42c632f57f4f0f7af5813ec1' into sync-from-raLaurențiu Nicola-2004/+3103
2024-01-28Merge commit '7219414e81810fd4d967136c4a0650523892c157' into sync-from-raLaurențiu Nicola-2796/+1390
2024-01-25Rename the unescaping functions.Nicholas Nethercote-14/+14
`unescape_literal` becomes `unescape_unicode`, and `unescape_c_string` becomes `unescape_mixed`. Because rfc3349 will mean that C string literals will no longer be the only mixed utf8 literals.
2024-01-25Rework `CStrUnit`.Nicholas Nethercote-5/+4
- Rename it as `MixedUnit`, because it will soon be used in more than just C string literals. - Change the `Byte` variant to `HighByte` and use it only for `\x80`..`\xff` cases. This fixes the old inexactness where ASCII chars could be encoded with either `Byte` or `Char`. - Add useful comments. - Remove `is_ascii`, in favour of `u8::is_ascii`.
2024-01-25Fix copy/paste error.Nicholas Nethercote-2/+2
The `CString` handling code is erroneously identical to the `ByteString` handling code.
2024-01-21Merge commit 'a9116523604c998e7781f60d3b5a6f586e0414a9' into sync-from-raLaurențiu Nicola-4396/+7069
2024-01-21Rollup merge of #120084 - weihanglo:pkgid-spec, r=Mark-SimulacrumNadrieril-2/+14
fix(rust-analyzer): use new pkgid spec to compare Starting from rust-lang/cargo#13311, Cargo's compiler artifact message uses Package ID specification as package's identifier format. Zulip topic: https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/proc-macro-test.20bootstrap.20and.20pkgid.20JSON cc `@ehuss`
2024-01-18Rollup merge of #119172 - nnethercote:earlier-NulInCStr, r=petrochenkovMatthias Krüger-0/+4
Detect `NulInCStr` error earlier. By making it an `EscapeError` instead of a `LitError`. This makes it like the other errors produced when checking string literals contents, e.g. for invalid escape sequences or bare CR chars. NOTE: this means these errors are issued earlier, before expansion, which changes behaviour. It will be possible to move the check back to the later point if desired. If that happens, it's likely that all the string literal contents checks will be delayed together. One nice thing about this: the old approach had some code in `report_lit_error` to calculate the span of the nul char from a range. This code used a hardwired `+2` to account for the `c"` at the start of a C string literal, but this should have changed to a `+3` for raw C string literals to account for the `cr"`, which meant that the caret in `cr"` nul error messages was one short of where it should have been. The new approach doesn't need any of this and avoids the off-by-one error. r? ```@fee1-dead```
2024-01-18fix(rust-analyzer): use new pkgid spec to compareWeihang Lo-2/+14
Starting from cargo#13311, Cargo's compiler artifact message uses Package ID specification as package's identifier format.
2024-01-15Merge commit '9d8889cdfcc3aa0302353fc988ed21ff9bc9925c' into sync-from-raLaurențiu Nicola-1024/+1650
2024-01-12Detect `NulInCStr` error earlier.Nicholas Nethercote-0/+4
By making it an `EscapeError` instead of a `LitError`. This makes it like the other errors produced when checking string literals contents, e.g. for invalid escape sequences or bare CR chars. NOTE: this means these errors are issued earlier, before expansion, which changes behaviour. It will be possible to move the check back to the later point if desired. If that happens, it's likely that all the string literal contents checks will be delayed together. One nice thing about this: the old approach had some code in `report_lit_error` to calculate the span of the nul char from a range. This code used a hardwired `+2` to account for the `c"` at the start of a C string literal, but this should have changed to a `+3` for raw C string literals to account for the `cr"`, which meant that the caret in `cr"` nul error messages was one short of where it should have been. The new approach doesn't need any of this and avoids the off-by-one error.
2024-01-08Merge commit 'af40101841c45aa75b56f4e9ca745369da8fb4ba' into sync-from-raLaurențiu Nicola-3605/+3088
2024-01-04Set proc-macro-test/sysroot-abi with proc-macro-srv/sysroot-abiLukas Wirth-1/+1
2024-01-04Set sysroot-abi flag for proc-macro-cli when in-rust-tree is setLukas Wirth-1/+1
2024-01-04Add extern crate rustc_driver to proc-macro-srv-cliLukas Wirth-3/+6
2024-01-04Imply sysroot-abi feature when in-rust-tree is setLukas Wirth-1/+1
2024-01-04Set the `in-rust-tree`` feature for all rust-analyzer{-proc-macro-srv} stepsLukas Wirth-4/+11
2024-01-03Allow unexpected_cfgs in proc-macro-test impLaurențiu Nicola-0/+2
2024-01-03Merge commit '426d2842c1f0e5cc5e34bb37c7ac3ee0945f9746' into sync-from-ra2Laurențiu Nicola-3073/+6912
2023-12-18Merge commit '21b06c1beb9bb59369ffd652f5d617bcf6952e05' into sync-from-raLaurențiu Nicola-476/+1079
2023-12-17Auto merge of #118830 - GuillaumeGomez:env-tracked_env, r=Nilstriebbors-0/+4
Add support for `--env` on `tracked_env::var` Follow-up of https://github.com/rust-lang/rust/pull/118368. Part of Part of https://github.com/rust-lang/rust/issues/80792. It adds support of the `--env` option for proc-macros through `tracked_env::var`. r? `@Nilstrieb`
2023-12-12Auto merge of #118817 - lnicola:sync-from-ra, r=lnicolabors-6213/+9743
Subtree update of `rust-analyzer` r? `@ghost`
2023-12-12Rollup merge of #118445 - ferrocene:jp-support-reuse-in-submodules, ↵Matthias Krüger-1/+2
r=Mark-Simulacrum Let `reuse` look inside git submodules Changes `collect-license-metadata` and `generate-copyright` so they can now look at the git submodules. Unfortunately `reuse` chokes on the LLVM submodule - it finds the word "Copyright" or the unicode copyright symbol in all kinds of places, including UTF-8 test cases. The `reuse` tool expressly won't let you ignore folders, so we let it scan everything and then strip out the LLVM sub-folder in post. Instead, we add in a hand-curated list of copyright information gleaned by reading the LLVM codebase carefully, which is stored in `.reuse/dep5` in Debian format where `reuse` can find and use it. The `.reuse/dep5` continues to track copyright info for files in the tree that do not have SPDX metadata in them (i.e. all of them)