-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
Description
rust-analyzer version: 0.3.2086-standalone (7106cd3be 2024-08-25)
rustc version: rustc 1.80.1 (3f5fd8dd4 2024-08-06)
editor or extension: VSCode, rust-analyzer v0.3.2086 (error does not occur with v0.3.2078)
relevant settings: n/a
repository link (if public, optional): n/a
code snippet to reproduce:
cargo add schemars (reproducible both with stable v0.8.21 and prerelease v1.0.0-alpha.11)
#[derive(schemars::JsonSchema)]
pub struct X;
fn main() {
println!("{:?}", schemars::schema_for!(X))
}The code compiles and runs fine. When running cargo expand and using schemars v1.0.0-alpha.11, the derive expands to:
const _: () = {
#[automatically_derived]
#[allow(unused_braces)]
impl schemars::JsonSchema for X {
fn schema_name() -> schemars::_alloc::borrow::Cow<'static, str> {
schemars::_alloc::borrow::Cow::Borrowed("X")
}
fn schema_id() -> schemars::_alloc::borrow::Cow<'static, str> {
schemars::_alloc::borrow::Cow::Borrowed("rust_test::X")
}
fn json_schema(generator: &mut schemars::SchemaGenerator) -> schemars::Schema {
generator.subschema_for::<()>()
}
}
};...which rust-analyzer has no problems with.
SenojLuap, lefebvreb, zwazel, dd23, clintjedwards and 9 moremiseyu
