about summary refs log tree commit diff
path: root/src/tools/rust-analyzer
AgeCommit message (Collapse)AuthorLines
2023-11-04Remove support for compiler plugins.Nicholas Nethercote-18/+0
They've been deprecated for four years. This commit includes the following changes. - It eliminates the `rustc_plugin_impl` crate. - It changes the language used for lints in `compiler/rustc_driver_impl/src/lib.rs` and `compiler/rustc_lint/src/context.rs`. External lints are now called "loaded" lints, rather than "plugins" to avoid confusion with the old plugins. This only has a tiny effect on the output of `-W help`. - E0457 and E0498 are no longer used. - E0463 is narrowed, now only relating to unfound crates, not plugins. - The `plugin` feature was moved from "active" to "removed". - It removes the entire plugins chapter from the unstable book. - It removes quite a few tests, mostly all of those in `tests/ui-fulldeps/plugin/`. Closes #29597.
2023-10-22use visibility to check unused imports and delete some stmtsbohan-3/+1
2023-09-18Merge commit '258b15c506a2d3ad862fd17ae24eaf272443f477' into sync-from-raLaurențiu Nicola-2740/+5763
2023-09-08Rework no_coverage to coverage(off)Andy Caldwell-6/+6
2023-08-22Rollup merge of #115011 - compiler-errors:warn-on-elided-assoc-ct-lt, r=cjgillotMichael Goulet-1/+1
Warn on elided lifetimes in associated constants (`ELIDED_LIFETIMES_IN_ASSOCIATED_CONSTANT`) Elided lifetimes in associated constants (in impls) erroneously resolve to fresh lifetime parameters on the impl since #97313. This is not correct behavior (see #38831). I originally opened #114716 to fix this, but given the time that has passed, the crater results seem pretty bad: https://github.com/rust-lang/rust/pull/114716#issuecomment-1682091952 This PR alternatively implements a lint against this behavior, and I'm hoping to bump this to deny in a few versions.
2023-08-21Fix elided lifetimes in rust-lang/rustMichael Goulet-1/+1
2023-08-21Merge commit '9b3d03408c66749d56466bb09baf2a7177deb6ce' into sync-from-raLaurențiu Nicola-1448/+3862
2023-08-20fix RA buildRalf Jung-1/+1
2023-08-20give some unwind-related terminators a more clear nameRalf Jung-5/+5
2023-08-15update Cargo.lockdirreke-4/+4
2023-08-14Upgrade Object and related depsdirreke-2/+2
2023-08-14fix the wrong number in const KNOWN_ARCHdirreke-1/+1
2023-08-14add a csky-unknown-linux-gnuabiv2 targetDirreke-0/+1
2023-08-08feat: `riscv-interrupt-{m,s}` calling conventionsSeth Pellegrino-0/+2
Similar to prior support added for the mips430, avr, and x86 targets this change implements the rough equivalent of clang's [`__attribute__((interrupt))`][clang-attr] for riscv targets, enabling e.g. ```rust static mut CNT: usize = 0; pub extern "riscv-interrupt-m" fn isr_m() { unsafe { CNT += 1; } } ``` to produce highly effective assembly like: ```asm pub extern "riscv-interrupt-m" fn isr_m() { 420003a0: 1141 addi sp,sp,-16 unsafe { CNT += 1; 420003a2: c62a sw a0,12(sp) 420003a4: c42e sw a1,8(sp) 420003a6: 3fc80537 lui a0,0x3fc80 420003aa: 63c52583 lw a1,1596(a0) # 3fc8063c <_ZN12esp_riscv_rt3CNT17hcec3e3a214887d53E.0> 420003ae: 0585 addi a1,a1,1 420003b0: 62b52e23 sw a1,1596(a0) } } 420003b4: 4532 lw a0,12(sp) 420003b6: 45a2 lw a1,8(sp) 420003b8: 0141 addi sp,sp,16 420003ba: 30200073 mret ``` (disassembly via `riscv64-unknown-elf-objdump -C -S --disassemble ./esp32c3-hal/target/riscv32imc-unknown-none-elf/release/examples/gpio_interrupt`) This outcome is superior to hand-coded interrupt routines which, lacking visibility into any non-assembly body of the interrupt handler, have to be very conservative and save the [entire CPU state to the stack frame][full-frame-save]. By instead asking LLVM to only save the registers that it uses, we defer the decision to the tool with the best context: it can more accurately account for the cost of spills if it knows that every additional register used is already at the cost of an implicit spill. At the LLVM level, this is apparently [implemented by] marking every register as "[callee-save]," matching the semantics of an interrupt handler nicely (it has to leave the CPU state just as it found it after its `{m|s}ret`). This approach is not suitable for every interrupt handler, as it makes no attempt to e.g. save the state in a user-accessible stack frame. For a full discussion of those challenges and tradeoffs, please refer to [the interrupt calling conventions RFC][rfc]. Inside rustc, this implementation differs from prior art because LLVM does not expose the "all-saved" function flavor as a calling convention directly, instead preferring to use an attribute that allows for differentiating between "machine-mode" and "superivsor-mode" interrupts. Finally, some effort has been made to guide those who may not yet be aware of the differences between machine-mode and supervisor-mode interrupts as to why no `riscv-interrupt` calling convention is exposed through rustc, and similarly for why `riscv-interrupt-u` makes no appearance (as it would complicate future LLVM upgrades). [clang-attr]: https://clang.llvm.org/docs/AttributeReference.html#interrupt-risc-v [full-frame-save]: https://github.com/esp-rs/esp-riscv-rt/blob/9281af2ecffe13e40992917316f36920c26acaf3/src/lib.rs#L440-L469 [implemented by]: https://github.com/llvm/llvm-project/blob/b7fb2a3fec7c187d58a6d338ab512d9173bca987/llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp#L61-L67 [callee-save]: https://github.com/llvm/llvm-project/blob/973f1fe7a8591c7af148e573491ab68cc15b6ecf/llvm/lib/Target/RISCV/RISCVCallingConv.td#L30-L37 [rfc]: https://github.com/rust-lang/rfcs/pull/3246
2023-08-07Rollup merge of #114562 - Trolldemorted:thiscall, r=oli-obkMatthias Krüger-16/+0
stabilize abi_thiscall Closes https://github.com/rust-lang/rust/issues/42202, stabilizing the use of the "thiscall" ABI. FCP was substituted by a poll, and the poll has been accepted.
2023-08-07stabilize abi_thiscallBenedikt Radtke-16/+0
2023-08-07Merge commit 'baee6b338b0ea076cd7a9f18d47f175dd2ba0e5d' into sync-from-raLaurențiu Nicola-1042/+4248
2023-07-24Merge commit '99718d0c8bc5aadd993acdcabc1778fc7b5cc572' into sync-from-raLaurențiu Nicola-405/+717
2023-07-17Merge commit '37f84c101bca43b11027f30ab0c2852f9325bc3d' into sync-from-raLaurențiu Nicola-9096/+13686
2023-06-21Remove outdated import in r-a proc macro server.Mara Bos-4/+1
2023-06-20Delete use of proc_macro_span_shrink from proc-macro2David Tolnay-2/+2
2023-06-20Add `Span::{line, column}`Jacob Pratt-0/+10
2023-06-20`Span::{before, after}` → `Span::{start, end}`Jacob Pratt-2/+2
2023-06-20Remove `LineColumn`, `Span::start`, `Span::end`Jacob Pratt-8/+0
2023-06-19Merge commit 'cd3bf9fe51676b520c546460e6d8919b8c8ff99f' into sync-from-raLaurențiu Nicola-1250/+3891
2023-06-05Merge commit 'ed87e0a20a9d196a5ea659ea46ae9574be666d4f' into sync-from-raLaurențiu Nicola-1/+4
2023-06-05Merge commit 'aa9bc8612514d216f84eec218dfd19ab83f3598a' into sync-from-raLaurențiu Nicola-17585/+57666
2023-05-31Remove const eval limit and implement an exponential backoff lint insteadOli Scherer-4/+0
2023-05-26Update proc-macro-api for the new rustc metadata formatjyn-1/+1
2023-05-07Remove `identity_future` from stdlibArpad Borsos-1/+0
This function/lang_item was introduced in #104321 as a temporary workaround of future lowering. The usage and need for it went away in #104833. After a bootstrap update, the function itself can be removed from `std`.
2023-04-28Rollup merge of #110766 - m-ou-se:fmt-rt, r=jyn514Matthias Krüger-6/+6
More core::fmt::rt cleanup. - Removes the `V1` suffix from the `Argument` and `Flag` types. - Moves more of the format_args lang items into the `core::fmt::rt` module. (The only remaining lang item in `core::fmt` is `Arguments` itself, which is a public type.) Part of https://github.com/rust-lang/rust/issues/99012 Follow-up to https://github.com/rust-lang/rust/pull/110616
2023-04-25Revert "Remove #[alloc_error_handler] from the compiler and library"Matthias Krüger-0/+4
This reverts commit abc0660118cc95f47445fd33502a11dd448f5968.
2023-04-24Remove "V1" from ArgumentsV1 and FlagsV1.Mara Bos-6/+6
2023-04-22Auto merge of #109507 - Amanieu:panic-oom-payload, r=davidtwcobors-4/+0
Report allocation errors as panics OOM is now reported as a panic but with a custom payload type (`AllocErrorPanicPayload`) which holds the layout that was passed to `handle_alloc_error`. This should be review one commit at a time: - The first commit adds `AllocErrorPanicPayload` and changes allocation errors to always be reported as panics. - The second commit removes `#[alloc_error_handler]` and the `alloc_error_hook` API. ACP: https://github.com/rust-lang/libs-team/issues/192 Closes #51540 Closes #51245
2023-04-21Auto merge of #109002 - michaelvanstraten:master, r=petrochenkovbors-1/+5
Added byte position range for `proc_macro::Span` Currently, the [`Debug`](https://doc.rust-lang.org/beta/proc_macro/struct.Span.html#impl-Debug-for-Span) implementation for [`proc_macro::Span`](https://doc.rust-lang.org/beta/proc_macro/struct.Span.html#) calls the debug function implemented in the trait implementation of `server::Span` for the type `Rustc` in the `rustc-expand` crate. The current implementation, of the referenced function, looks something like this: ```rust fn debug(&mut self, span: Self::Span) -> String { if self.ecx.ecfg.span_debug { format!("{:?}", span) } else { format!("{:?} bytes({}..{})", span.ctxt(), span.lo().0, span.hi().0) } } ``` It returns the byte position of the [`Span`](https://doc.rust-lang.org/beta/proc_macro/struct.Span.html#) as an interpolated string. Because this is currently the only way to get a spans position in the file, I might lead someone, who is interested in this information, to parsing this interpolated string back into a range of bytes, which I think is a very non-rusty way. The proposed `position()`, method implemented in this PR, gives the ability to directly get this info. It returns a [`std::ops::Range`](https://doc.rust-lang.org/std/ops/struct.Range.html#) wrapping the lowest and highest byte of the [`Span`](https://doc.rust-lang.org/beta/proc_macro/struct.Span.html#). I put it behind the `proc_macro_span` feature flag because many of the other functions that have a similar footprint also are annotated with it, I don't actually know if this is right. It would be great if somebody could take a look at this, thank you very much in advanced.
2023-04-16Remove #[alloc_error_handler] from the compiler and libraryAmanieu d'Antras-4/+0
2023-03-20:arrow_up: rust-analyzerLaurențiu Nicola-610/+2220
2023-03-13Auto merge of #109069 - lnicola:rust-analyzer-2023-03-13, r=lnicolabors-3055/+12635
:arrow_up: `rust-analyzer` r? `@ghost`
2023-03-13:arrow_up: rust-analyzerLaurențiu Nicola-3055/+12635
2023-03-12Remove uses of `box_syntax` in rustc and toolsclubby789-2/+2
2023-03-11Renamed to byte_range and changed Range generics [skip ci]Michael van Straten-1/+1
2023-03-10Fixed rust-analyser: no implementation for position()Michael van Straten-1/+5
2023-02-24Rename many interner functions.Nicholas Nethercote-1/+1
(This is a large commit. The changes to `compiler/rustc_middle/src/ty/context.rs` are the most important ones.) The current naming scheme is a mess, with a mix of `_intern_`, `intern_` and `mk_` prefixes, with little consistency. In particular, in many cases it's easy to use an iterator interner when a (preferable) slice interner is available. The guiding principles of the new naming system: - No `_intern_` prefixes. - The `intern_` prefix is for internal operations. - The `mk_` prefix is for external operations. - For cases where there is a slice interner and an iterator interner, the former is `mk_foo` and the latter is `mk_foo_from_iter`. Also, `slice_interners!` and `direct_interners!` can now be `pub` or non-`pub`, which helps enforce the internal/external operations division. It's not perfect, but I think it's a clear improvement. The following lists show everything that was renamed. slice_interners - const_list - mk_const_list -> mk_const_list_from_iter - intern_const_list -> mk_const_list - substs - mk_substs -> mk_substs_from_iter - intern_substs -> mk_substs - check_substs -> check_and_mk_substs (this is a weird one) - canonical_var_infos - intern_canonical_var_infos -> mk_canonical_var_infos - poly_existential_predicates - mk_poly_existential_predicates -> mk_poly_existential_predicates_from_iter - intern_poly_existential_predicates -> mk_poly_existential_predicates - _intern_poly_existential_predicates -> intern_poly_existential_predicates - predicates - mk_predicates -> mk_predicates_from_iter - intern_predicates -> mk_predicates - _intern_predicates -> intern_predicates - projs - intern_projs -> mk_projs - place_elems - mk_place_elems -> mk_place_elems_from_iter - intern_place_elems -> mk_place_elems - bound_variable_kinds - mk_bound_variable_kinds -> mk_bound_variable_kinds_from_iter - intern_bound_variable_kinds -> mk_bound_variable_kinds direct_interners - region - intern_region (unchanged) - const - mk_const_internal -> intern_const - const_allocation - intern_const_alloc -> mk_const_alloc - layout - intern_layout -> mk_layout - adt_def - intern_adt_def -> mk_adt_def_from_data (unusual case, hard to avoid) - alloc_adt_def(!) -> mk_adt_def - external_constraints - intern_external_constraints -> mk_external_constraints Other - type_list - mk_type_list -> mk_type_list_from_iter - intern_type_list -> mk_type_list - tup - mk_tup -> mk_tup_from_iter - intern_tup -> mk_tup
2023-02-20:arrow_up: rust-analyzerLaurențiu Nicola-942/+1800
2023-02-13:arrow_up: rust-analyzerLaurențiu Nicola-9698/+11188
2023-01-11Change `src/test` to `tests` in source files, fix tidy and testsAlbert Larsan-2/+2
2023-01-09:arrow_up: rust-analyzerarcnmx-5744/+14558
Merge commit '368e0bb32f1178cf162c2ce5f7e10b7ae211eb26'
2022-11-23:arrow_up: rust-analyzerLaurențiu Nicola-895/+2089
2022-11-09Rollup merge of #104211 - lnicola:rust-analyzer-2022-11-09, r=lnicolaMichael Goulet-422/+1216
:arrow_up: rust-analyzer r? ``@ghost``
2022-11-09:arrow_up: rust-analyzerLaurențiu Nicola-422/+1216