Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proc-macro panicked: called Rust::unwrap() on an Err value: ParseFloatError #9795

Closed
gleich opened this issue Aug 6, 2021 · 8 comments · Fixed by #9806
Closed

proc-macro panicked: called Rust::unwrap() on an Err value: ParseFloatError #9795

gleich opened this issue Aug 6, 2021 · 8 comments · Fixed by #9806
Labels
A-macro macro expansion

Comments

@gleich
Copy link

gleich commented Aug 6, 2021

Hello rust-analyzer team! First of all, thank you for the work that you do here. I don't wanna waste your time so I'll cut right to the chase. I am getting the error proc macro returned error: proc-macro panicked: called `Result::unwrap()` on an `Err` value: ParseFloatError { kind: Invalid } on the following code:

use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug)]
pub struct Config {
	pub name: String,
	pub school_level: String,
	pub school_type: String,
}

This error is highlighted on the whole struct as well as the attribute. Below is some more information:

Name of the file: conf.rs.
File link: gleich/kiwi/src/conf.rs
Repo link: https://github.com/gleich/kiwi
Rust version: rustc 1.54.0 (a178d0322 2021-07-26)
RA version: 950efff 2021-08-05 nightly (tried with RA stable)

Because this error is a rust-analyzer problem running cargo check or cargo build doesn't have this error.

@f32by
Copy link

f32by commented Aug 6, 2021

Same problem, too.
It works in nightly-2021-08-04-x86_64-apple-darwin rustc 1.56.0-nightly (a6ece5615 2021-08-03) but crashes in nightly-2021-08-05-x86_64-apple-darwin rustc 1.56.0-nightly (25b764849 2021-08-04).

@hex0x0000
Copy link

Same error

@bjorn3
Copy link
Member

bjorn3 commented Aug 6, 2021

The difference between those rustc version is: rust-lang/rust@a6ece56...25b7648 This is probably caused by rust-lang/rust#87267 which added a new Literal::to_string method to the proc-macro abi.

@bjorn3 bjorn3 added the A-macro macro expansion label Aug 6, 2021
@bjorn3
Copy link
Member

bjorn3 commented Aug 6, 2021

#9550 (comment): @alexjg would you mind updating the proc-macro abi for nightly?

@alexjg
Copy link
Contributor

alexjg commented Aug 6, 2021

I'll sort it this weekend

@alexjg
Copy link
Contributor

alexjg commented Aug 7, 2021

I'm unable to reproduce this problem with the given repository, toolchain and analyzer versions. Furthermore, all the tests for the proce macro server crate pass in current nightly or in the 2021-08-04 toolchain. Does anyone have a reproducing example I can get a look at? I'm reluctant to make a change without being able to check that it fixes the problem.

It is possible that this only occurs on darwin platforms, I'm running linux so wouldn't be able to test that. Does anyone have access to both platforms to test this hypothesis?

@lnicola
Copy link
Member

lnicola commented Aug 7, 2021

The test pass, but rust-analyzer analysis-stats . on the RA repo crashes. I'm on Linux, too.

@alexjg
Copy link
Contributor

alexjg commented Aug 7, 2021

Ah, that's done the trick, I'll get fixing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macro macro expansion
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants