godot-rust / gdnative

Rust bindings for Godot 3
https://godot-rust.github.io
MIT License
3.61k stars 210 forks source link

Outdated links in error message #1059

Open Bogay opened 10 months ago

Bogay commented 10 months ago

Copied from discord:

Found outdated links in the error message. Perhaps the version string could be extracted from Cargo.toml at compile time to make it more consistent?

fn generate_error_with_docs(span: proc_macro2::Span, message: &str) -> syn::Error {
    syn::Error::new(
        span,
        format!(
            "{message}\n\texpecting #[variant(...)]. See documentation:\n\thttps://docs.rs/gdnative/0.9.0/gdnative/core_types/trait.ToVariant.html#field-attributes"
        ),
    )
}

https://github.com/godot-rust/gdnative/blob/6dc972190f6cefb15eef6588c81a015983718df5/gdnative-derive/src/variant/attr.rs#L72-L79

another one with similar signature:

https://github.com/godot-rust/gdnative/blob/6dc972190f6cefb15eef6588c81a015983718df5/gdnative-derive/src/variant/attr/field.rs#L36-L43

Bogay commented 10 months ago

Maybe related: https://github.com/godot-rust/gdnative/pull/1039

Should we put latest compatible Godot version in Cargo.toml?

Bogay commented 10 months ago

Oh, the links to godot doc are written in doc comments. So it's harder to generate it 🤔

chitoyuu commented 10 months ago

Doc comments are just sugar for #[doc] attributes so they can be generated using proc-macros. I guess we can also do text-based search & replace in the build script but that's much more of a risky option.