Unnamed repository; edit this file 'description' to name the repository.
Auto merge of #152965 - JonathanBrouwer:rollup-QnrcBRx, r=JonathanBrouwer
Rollup of 14 pull requests Successful merges: - rust-lang/rust#150468 (rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing) - rust-lang/rust#151628 (Fix ICE in const eval of packed SIMD types with non-power-of-two element counts) - rust-lang/rust#151871 (don't use env with infer vars) - rust-lang/rust#152591 (Simplify internals of `{Rc,Arc}::default`) - rust-lang/rust#152865 (Fixed ByteStr not padding within its Display trait when no specific alignment is mentioned) - rust-lang/rust#147859 (reduce the amount of panics in `{TokenStream, Literal}::from_str` calls) - rust-lang/rust#152705 (Test(lib/win/proc): Skip `raw_attributes` doctest under Win7) - rust-lang/rust#152767 (fix typo in `carryless_mul` macro invocation) - rust-lang/rust#152837 (fix(codegen): Use `body_codegen_attrs` For Caller In `adjust_target_feature_sig`) - rust-lang/rust#152871 (Fix warnings in rs{begin,end}.rs files) - rust-lang/rust#152879 (Remove `impl IntoQueryParam<P> for &'a P`.) - rust-lang/rust#152933 (Start migration for `LintDiagnostic` items by adding API and migrating `LinkerOutput` lint) - rust-lang/rust#152937 (remove unneeded reboxing) - rust-lang/rust#152953 (Fix typo in armv7a-vex-v5.md)
bors 8 weeks ago
parent cd38bcd · parent 9714e99 · commit d21f4bf
-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 c114d52ec3..d85deba757 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()