You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem is it's really hard to do, because the macro doesn't even know that the attribute takes a Uri, it just generates the code for the type checker to validate later (the only checking it does is whether it's a string literal so it'll generate .parse() instead of .into()). I feel like there must be some way to do it, but I haven't found it yet.
Aah ok I see, the parser would need more context information.
EDIT
The big caveat for this: currently, the macro is not able to validate the string at compile time, and the conversion will panic at runtime if the string is invalid.
The following snippet will fail at runtime:
The reason for this is that "sub/path.css" is not a valid URI. If you do the following
you will get a failure at compile-time, because here the contents of
href
must be a Uri (the first versionusing str.parse::<Uri>().unwrap()
).It would be good if the proc macro tries this Uri conversion at compile-time, and rejects the program if the string isn't a valid Uri.
Unrelated, but TIL that './relative/path' is not a valid URI, at least according to hyper/http.
The text was updated successfully, but these errors were encountered: