Skip to content

Commit d21f4bf

Browse files
committed
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)
2 parents cd38bcd + 9714e99 commit d21f4bf

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ impl server::Server for RaSpanServer<'_> {
6262
self.tracked_paths.insert(path.into());
6363
}
6464

65-
fn literal_from_str(&mut self, s: &str) -> Result<Literal<Self::Span>, ()> {
65+
fn literal_from_str(&mut self, s: &str) -> Result<Literal<Self::Span>, String> {
6666
literal_from_str(s, self.call_site)
67+
.map_err(|()| "cannot parse string into literal".to_string())
6768
}
6869

6970
fn emit_diagnostic(&mut self, _: Diagnostic<Self::Span>) {
@@ -81,14 +82,9 @@ impl server::Server for RaSpanServer<'_> {
8182
fn ts_is_empty(&mut self, stream: &Self::TokenStream) -> bool {
8283
stream.is_empty()
8384
}
84-
fn ts_from_str(&mut self, src: &str) -> Self::TokenStream {
85-
Self::TokenStream::from_str(src, self.call_site).unwrap_or_else(|e| {
86-
Self::TokenStream::from_str(
87-
&format!("compile_error!(\"failed to parse str to token stream: {e}\")"),
88-
self.call_site,
89-
)
90-
.unwrap()
91-
})
85+
fn ts_from_str(&mut self, src: &str) -> Result<Self::TokenStream, String> {
86+
Self::TokenStream::from_str(src, self.call_site)
87+
.map_err(|e| format!("failed to parse str to token stream: {e}"))
9288
}
9389
fn ts_to_string(&mut self, stream: &Self::TokenStream) -> String {
9490
stream.to_string()

crates/proc-macro-srv/src/server_impl/token_id.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ impl server::Server for SpanIdServer<'_> {
6767
self.tracked_paths.insert(path.into());
6868
}
6969

70-
fn literal_from_str(&mut self, s: &str) -> Result<Literal<Self::Span>, ()> {
70+
fn literal_from_str(&mut self, s: &str) -> Result<Literal<Self::Span>, String> {
7171
literal_from_str(s, self.call_site)
72+
.map_err(|()| "cannot parse string into literal".to_string())
7273
}
7374

7475
fn emit_diagnostic(&mut self, _: Diagnostic<Self::Span>) {}
@@ -84,14 +85,9 @@ impl server::Server for SpanIdServer<'_> {
8485
fn ts_is_empty(&mut self, stream: &Self::TokenStream) -> bool {
8586
stream.is_empty()
8687
}
87-
fn ts_from_str(&mut self, src: &str) -> Self::TokenStream {
88-
Self::TokenStream::from_str(src, self.call_site).unwrap_or_else(|e| {
89-
Self::TokenStream::from_str(
90-
&format!("compile_error!(\"failed to parse str to token stream: {e}\")"),
91-
self.call_site,
92-
)
93-
.unwrap()
94-
})
88+
fn ts_from_str(&mut self, src: &str) -> Result<Self::TokenStream, String> {
89+
Self::TokenStream::from_str(src, self.call_site)
90+
.map_err(|e| format!("failed to parse str to token stream: {e}"))
9591
}
9692
fn ts_to_string(&mut self, stream: &Self::TokenStream) -> String {
9793
stream.to_string()

0 commit comments

Comments
 (0)