Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--Cargo.lock4
-rw-r--r--crates/ide-db/src/generated/lints.rs29
-rw-r--r--crates/ide/src/hover/tests.rs111
-rw-r--r--crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs29
-rw-r--r--crates/proc-macro-srv/src/server_impl/token_id.rs22
-rw-r--r--crates/proc-macro-srv/src/tests/mod.rs2
6 files changed, 25 insertions, 172 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 745a8097c8..2dbb3f5d69 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -902,9 +902,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "libc"
-version = "0.2.169"
+version = "0.2.172"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
+checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa"
[[package]]
name = "libloading"
diff --git a/crates/ide-db/src/generated/lints.rs b/crates/ide-db/src/generated/lints.rs
index 0a7a7d1fb2..706d04484f 100644
--- a/crates/ide-db/src/generated/lints.rs
+++ b/crates/ide-db/src/generated/lints.rs
@@ -3795,35 +3795,6 @@ The tracking issue for this feature is: [#64797]
deny_since: None,
},
Lint {
- label: "cfg_boolean_literals",
- description: r##"# `cfg_boolean_literals`
-
-The tracking issue for this feature is: [#131204]
-
-[#131204]: https://github.com/rust-lang/rust/issues/131204
-
-------------------------
-
-The `cfg_boolean_literals` feature makes it possible to use the `true`/`false`
-literal as cfg predicate. They always evaluate to true/false respectively.
-
-## Examples
-
-```rust
-#![feature(cfg_boolean_literals)]
-
-#[cfg(true)]
-const A: i32 = 5;
-
-#[cfg(all(false))]
-const A: i32 = 58 * 89;
-```
-"##,
- default_severity: Severity::Allow,
- warn_since: None,
- deny_since: None,
- },
- Lint {
label: "cfg_eval",
description: r##"# `cfg_eval`
diff --git a/crates/ide/src/hover/tests.rs b/crates/ide/src/hover/tests.rs
index 6b470d921f..80a2d4690d 100644
--- a/crates/ide/src/hover/tests.rs
+++ b/crates/ide/src/hover/tests.rs
@@ -6882,109 +6882,14 @@ pub fn foo() {}
#[test]
fn hover_feature() {
- check(
- r#"#![feature(intrinsics$0)]"#,
- expect![[r#"
- *intrinsics*
- ```
- intrinsics
- ```
- ___
-
- # `intrinsics`
-
- The tracking issue for this feature is: None.
-
- Intrinsics are rarely intended to be stable directly, but are usually
- exported in some sort of stable manner. Prefer using the stable interfaces to
- the intrinsic directly when you can.
-
- ------------------------
-
-
- ## Intrinsics with fallback logic
-
- Many intrinsics can be written in pure rust, albeit inefficiently or without supporting
- some features that only exist on some backends. Backends can simply not implement those
- intrinsics without causing any code miscompilations or failures to compile.
- All intrinsic fallback bodies are automatically made cross-crate inlineable (like `#[inline]`)
- by the codegen backend, but not the MIR inliner.
-
- ```rust
- #![feature(intrinsics)]
- #![allow(internal_features)]
-
- #[rustc_intrinsic]
- const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
- ```
-
- Since these are just regular functions, it is perfectly ok to create the intrinsic twice:
-
- ```rust
- #![feature(intrinsics)]
- #![allow(internal_features)]
-
- #[rustc_intrinsic]
- const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
-
- mod foo {
- #[rustc_intrinsic]
- const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {
- panic!("noisy const dealloc")
- }
- }
-
- ```
-
- The behaviour on backends that override the intrinsic is exactly the same. On other
- backends, the intrinsic behaviour depends on which implementation is called, just like
- with any regular function.
-
- ## Intrinsics lowered to MIR instructions
-
- Various intrinsics have native MIR operations that they correspond to. Instead of requiring
- backends to implement both the intrinsic and the MIR operation, the `lower_intrinsics` pass
- will convert the calls to the MIR operation. Backends do not need to know about these intrinsics
- at all. These intrinsics only make sense without a body, and can either be declared as a "rust-intrinsic"
- or as a `#[rustc_intrinsic]`. The body is never used, as calls to the intrinsic do not exist
- anymore after MIR analyses.
-
- ## Intrinsics without fallback logic
-
- These must be implemented by all backends.
-
- ### `#[rustc_intrinsic]` declarations
-
- These are written like intrinsics with fallback bodies, but the body is irrelevant.
- Use `loop {}` for the body or call the intrinsic recursively and add
- `#[rustc_intrinsic_must_be_overridden]` to the function to ensure that backends don't
- invoke the body.
-
- ### Legacy extern ABI based intrinsics
-
- These are imported as if they were FFI functions, with the special
- `rust-intrinsic` ABI. For example, if one was in a freestanding
- context, but wished to be able to `transmute` between types, and
- perform efficient pointer arithmetic, one would import those functions
- via a declaration like
-
- ```rust
- #![feature(intrinsics)]
- #![allow(internal_features)]
- # fn main() {}
-
- extern "rust-intrinsic" {
- fn transmute<T, U>(x: T) -> U;
-
- fn arith_offset<T>(dst: *const T, offset: isize) -> *const T;
- }
- ```
-
- As with any other FFI functions, these are by default always `unsafe` to call.
- You can add `#[rustc_safe_intrinsic]` to the intrinsic to make it safe to call.
-
- "#]],
- )
+ let (analysis, position) = fixture::position(r#"#![feature(intrinsics$0)]"#);
+ analysis
+ .hover(
+ &HoverConfig { links_in_hover: true, ..HOVER_BASE_CONFIG },
+ FileRange { file_id: position.file_id, range: TextRange::empty(position.offset) },
+ )
+ .unwrap()
+ .unwrap();
}
#[test]
diff --git a/crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs b/crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs
index 59293ee3f9..80f6d85a3d 100644
--- a/crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs
+++ b/crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs
@@ -11,7 +11,7 @@ use std::{
use intern::Symbol;
use proc_macro::bridge::{self, server};
-use span::{FileId, Span, FIXUP_ERASED_FILE_AST_ID_MARKER};
+use span::{Span, FIXUP_ERASED_FILE_AST_ID_MARKER};
use tt::{TextRange, TextSize};
use crate::server_impl::{literal_kind_to_internal, token_stream::TokenStreamBuilder, TopSubtree};
@@ -27,10 +27,6 @@ mod tt {
type TokenStream = crate::server_impl::TokenStream<Span>;
-#[derive(Copy, Clone, PartialEq, Eq, Debug)]
-pub struct SourceFile {
- file_id: FileId,
-}
pub struct FreeFunctions;
pub struct RaSpanServer {
@@ -46,7 +42,6 @@ pub struct RaSpanServer {
impl server::Types for RaSpanServer {
type FreeFunctions = FreeFunctions;
type TokenStream = TokenStream;
- type SourceFile = SourceFile;
type Span = Span;
type Symbol = Symbol;
}
@@ -245,25 +240,17 @@ impl server::TokenStream for RaSpanServer {
}
}
-impl server::SourceFile for RaSpanServer {
- fn eq(&mut self, file1: &Self::SourceFile, file2: &Self::SourceFile) -> bool {
- file1 == file2
- }
- fn path(&mut self, _file: &Self::SourceFile) -> String {
- // FIXME
- String::new()
- }
- fn is_real(&mut self, _file: &Self::SourceFile) -> bool {
- true
- }
-}
-
impl server::Span for RaSpanServer {
fn debug(&mut self, span: Self::Span) -> String {
format!("{:?}", span)
}
- fn source_file(&mut self, span: Self::Span) -> Self::SourceFile {
- SourceFile { file_id: span.anchor.file_id.file_id() }
+ fn file(&mut self, _: Self::Span) -> String {
+ // FIXME
+ String::new()
+ }
+ fn local_file(&mut self, _: Self::Span) -> Option<String> {
+ // FIXME
+ None
}
fn save_span(&mut self, _span: Self::Span) -> usize {
// FIXME, quote is incompatible with third-party tools
diff --git a/crates/proc-macro-srv/src/server_impl/token_id.rs b/crates/proc-macro-srv/src/server_impl/token_id.rs
index 409cf3cc78..4d7c7c4676 100644
--- a/crates/proc-macro-srv/src/server_impl/token_id.rs
+++ b/crates/proc-macro-srv/src/server_impl/token_id.rs
@@ -24,8 +24,6 @@ type Literal = tt::Literal;
type Span = tt::TokenId;
type TokenStream = crate::server_impl::TokenStream<Span>;
-#[derive(Clone)]
-pub struct SourceFile;
pub struct FreeFunctions;
pub struct TokenIdServer {
@@ -37,7 +35,6 @@ pub struct TokenIdServer {
impl server::Types for TokenIdServer {
type FreeFunctions = FreeFunctions;
type TokenStream = TokenStream;
- type SourceFile = SourceFile;
type Span = Span;
type Symbol = Symbol;
}
@@ -223,24 +220,15 @@ impl server::TokenStream for TokenIdServer {
}
}
-impl server::SourceFile for TokenIdServer {
- fn eq(&mut self, _file1: &Self::SourceFile, _file2: &Self::SourceFile) -> bool {
- true
- }
- fn path(&mut self, _file: &Self::SourceFile) -> String {
- String::new()
- }
- fn is_real(&mut self, _file: &Self::SourceFile) -> bool {
- true
- }
-}
-
impl server::Span for TokenIdServer {
fn debug(&mut self, span: Self::Span) -> String {
format!("{:?}", span.0)
}
- fn source_file(&mut self, _span: Self::Span) -> Self::SourceFile {
- SourceFile {}
+ fn file(&mut self, _span: Self::Span) -> String {
+ String::new()
+ }
+ fn local_file(&mut self, _span: Self::Span) -> Option<String> {
+ None
}
fn save_span(&mut self, _span: Self::Span) -> usize {
0
diff --git a/crates/proc-macro-srv/src/tests/mod.rs b/crates/proc-macro-srv/src/tests/mod.rs
index 15de88ea65..4bd365be7c 100644
--- a/crates/proc-macro-srv/src/tests/mod.rs
+++ b/crates/proc-macro-srv/src/tests/mod.rs
@@ -97,6 +97,7 @@ fn test_fn_like_macro_clone_raw_ident() {
}
#[test]
+#[cfg(not(bootstrap))]
fn test_fn_like_fn_like_span_join() {
assert_expand(
"fn_like_span_join",
@@ -111,6 +112,7 @@ fn test_fn_like_fn_like_span_join() {
}
#[test]
+#[cfg(not(bootstrap))]
fn test_fn_like_fn_like_span_ops() {
assert_expand(
"fn_like_span_ops",