godot-rust / gdnative

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

Outdated links in error message #1059

Open Bogay opened 1 year ago

Bogay commented 1 year 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 1 year ago

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

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

Bogay commented 1 year ago

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

chitoyuu commented 1 year 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.