Unnamed repository; edit this file 'description' to name the repository.
Merge ref 'c78a29473a68' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: rust-lang/rust@c78a29473a68f07012904af11c92ecffa68fcc75 Filtered ref: rust-lang/rust-analyzer@d21f4bf288bf190976b4f6a3f283ed0449a94b2b Upstream diff: https://github.com/rust-lang/rust/compare/139651428df86cf88443295542c12ea617cbb587...c78a29473a68f07012904af11c92ecffa68fcc75 This merge was created using https://github.com/rust-lang/josh-sync.
The rustc-josh-sync Cronjob Bot 8 weeks ago
parent 8289ede · parent d21f4bf · commit 2ee4714
-rw-r--r--crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs14
-rw-r--r--crates/proc-macro-srv/src/server_impl/token_id.rs14
2 files changed, 10 insertions, 18 deletions
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 0890e72c4f..5eb16c37ac 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
@@ -62,8 +62,9 @@ impl server::Server for RaSpanServer<'_> {
self.tracked_paths.insert(path.into());
}
- fn literal_from_str(&mut self, s: &str) -> Result<Literal<Self::Span>, ()> {
+ fn literal_from_str(&mut self, s: &str) -> Result<Literal<Self::Span>, String> {
literal_from_str(s, self.call_site)
+ .map_err(|()| "cannot parse string into literal".to_string())
}
fn emit_diagnostic(&mut self, _: Diagnostic<Self::Span>) {
@@ -81,14 +82,9 @@ impl server::Server for RaSpanServer<'_> {
fn ts_is_empty(&mut self, stream: &Self::TokenStream) -> bool {
stream.is_empty()
}
- fn ts_from_str(&mut self, src: &str) -> Self::TokenStream {
- Self::TokenStream::from_str(src, self.call_site).unwrap_or_else(|e| {
- Self::TokenStream::from_str(
- &format!("compile_error!(\"failed to parse str to token stream: {e}\")"),
- self.call_site,
- )
- .unwrap()
- })
+ fn ts_from_str(&mut self, src: &str) -> Result<Self::TokenStream, String> {
+ Self::TokenStream::from_str(src, self.call_site)
+ .map_err(|e| format!("failed to parse str to token stream: {e}"))
}
fn ts_to_string(&mut self, stream: &Self::TokenStream) -> String {
stream.to_string()
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 70484c4dc2..e1c96095c8 100644
--- a/crates/proc-macro-srv/src/server_impl/token_id.rs
+++ b/crates/proc-macro-srv/src/server_impl/token_id.rs
@@ -67,8 +67,9 @@ impl server::Server for SpanIdServer<'_> {
self.tracked_paths.insert(path.into());
}
- fn literal_from_str(&mut self, s: &str) -> Result<Literal<Self::Span>, ()> {
+ fn literal_from_str(&mut self, s: &str) -> Result<Literal<Self::Span>, String> {
literal_from_str(s, self.call_site)
+ .map_err(|()| "cannot parse string into literal".to_string())
}
fn emit_diagnostic(&mut self, _: Diagnostic<Self::Span>) {}
@@ -84,14 +85,9 @@ impl server::Server for SpanIdServer<'_> {
fn ts_is_empty(&mut self, stream: &Self::TokenStream) -> bool {
stream.is_empty()
}
- fn ts_from_str(&mut self, src: &str) -> Self::TokenStream {
- Self::TokenStream::from_str(src, self.call_site).unwrap_or_else(|e| {
- Self::TokenStream::from_str(
- &format!("compile_error!(\"failed to parse str to token stream: {e}\")"),
- self.call_site,
- )
- .unwrap()
- })
+ fn ts_from_str(&mut self, src: &str) -> Result<Self::TokenStream, String> {
+ Self::TokenStream::from_str(src, self.call_site)
+ .map_err(|e| format!("failed to parse str to token stream: {e}"))
}
fn ts_to_string(&mut self, stream: &Self::TokenStream) -> String {
stream.to_string()