From 8befd920d6f921760580267ce33179437b4fd990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Sun, 9 Jul 2023 09:26:05 +0300 Subject: [PATCH 1/2] Remove old section about downloading the server from the manual --- docs/user/manual.adoc | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/docs/user/manual.adoc b/docs/user/manual.adoc index b23c7c35d5..31035c4b72 100644 --- a/docs/user/manual.adoc +++ b/docs/user/manual.adoc @@ -64,22 +64,8 @@ You can install the latest release of the plugin from https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer[the marketplace]. Note that the plugin may cause conflicts with the -https://marketplace.visualstudio.com/items?itemName=rust-lang.rust[official Rust plugin]. -It is recommended to disable the Rust plugin when using the rust-analyzer extension. - -By default, the plugin will prompt you to download the matching version of the server as well: - -image::https://user-images.githubusercontent.com/9021944/75067008-17502500-54ba-11ea-835a-f92aac50e866.png[] - -[NOTE] -==== -To disable this notification put the following to `settings.json` - -[source,json] ----- -{ "rust-analyzer.updates.askBeforeDownload": false } ----- -==== +https://marketplace.visualstudio.com/items?itemName=rust-lang.rust[previous official Rust plugin]. +The latter is no longer maintained and should be uninstalled. The server binary is stored in the extension install directory, which starts with `rust-lang.rust-analyzer-` and is located under: From aa52cbf784b17819663f9a2b0b68e63460957a79 Mon Sep 17 00:00:00 2001 From: hkalbasi Date: Sun, 9 Jul 2023 23:17:51 +0330 Subject: [PATCH 2/2] Support read_via_copy intrinsic --- .../hir-ty/src/consteval/tests/intrinsics.rs | 18 ++++++++++++++++++ crates/hir-ty/src/mir/eval/shim.rs | 7 +++++++ 2 files changed, 25 insertions(+) diff --git a/crates/hir-ty/src/consteval/tests/intrinsics.rs b/crates/hir-ty/src/consteval/tests/intrinsics.rs index b74133e24f..89f3a6d490 100644 --- a/crates/hir-ty/src/consteval/tests/intrinsics.rs +++ b/crates/hir-ty/src/consteval/tests/intrinsics.rs @@ -163,6 +163,24 @@ fn transmute() { ); } +#[test] +fn read_via_copy() { + check_number( + r#" + extern "rust-intrinsic" { + pub fn read_via_copy(e: *const T) -> T; + pub fn volatile_load(e: *const T) -> T; + } + + const GOAL: i32 = { + let x = 2; + read_via_copy(&x) + volatile_load(&x) + }; + "#, + 4, + ); +} + #[test] fn const_eval_select() { check_number( diff --git a/crates/hir-ty/src/mir/eval/shim.rs b/crates/hir-ty/src/mir/eval/shim.rs index 6cdf9f03c9..8f22bb3656 100644 --- a/crates/hir-ty/src/mir/eval/shim.rs +++ b/crates/hir-ty/src/mir/eval/shim.rs @@ -888,6 +888,13 @@ impl Evaluator<'_> { } not_supported!("FnOnce was not available for executing const_eval_select"); } + "read_via_copy" | "volatile_load" => { + let [arg] = args else { + return Err(MirEvalError::TypeError("read_via_copy args are not provided")); + }; + let addr = Address::from_bytes(arg.interval.get(self)?)?; + destination.write_from_interval(self, Interval { addr, size: destination.size }) + } _ => not_supported!("unknown intrinsic {name}"), } }