How should I use rust-analyzer with #[no_core]?
#22160
-
|
To address the obligatory elephant in the room, I am aware that #![feature(arbitrary_self_types, intrinsics, lang_items, no_core, rustc_attrs)]
#![rustc_coherence_is_core]
#![allow(internal_features)]
#![no_core]
impl u32 {
fn increment(&self) -> u32 {
saturating_add(*self, 1)
}
}
#[unsafe(no_mangle)]
pub extern "C" fn test() -> u32 {
let x = 12u32;
x.increment()
}
#[lang = "copy"]
pub trait Copy {}
impl Copy for u32 {}
#[lang = "sized"]
pub trait Sized: MetaSized {}
#[lang = "meta_sized"]
pub trait MetaSized: PointeeSized {}
#[lang = "pointee_sized"]
pub trait PointeeSized {}
#[lang = "freeze"]
pub trait Freeze {}
#[rustc_intrinsic]
pub const fn saturating_add<T: Copy>(a: T, b: T) -> T;
#[lang = "receiver"]
pub trait Receiver: PointeeSized {
#[lang = "receiver_target"]
type Target: ?Sized;
}NOTE: I understand the semantic issues with the traits above. This is just a minimal reproduction anyone could compile and inspect. Now, I'd expect |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Yes, you will have to fake the sysroot. You might be able to do so by changing |
Beta Was this translation helpful? Give feedback.
Yes, you will have to fake the sysroot. You might be able to do so by changing
rust-analyzer.cargo.sysroot, or you will need to use rust-project.json. We don't support that because that is simpler and more performant to us, and we won't change this to support the perma-unstable#![no_core].