[rust-dev] no error or warning when an unknown attribute is used

Ben Harris mail at bharr.is
Wed Jul 16 06:51:36 PDT 2014


Did it come up as an unused-attribute warning?


On 16 July 2014 21:38, Ilya Dmitrichenko <errordeveloper at gmail.com> wrote:

> Hi List,
>
> Using serialize crate, I have made a typo in attribute name and wrote
> 'derives' instead of 'deriving' and I got an error message about
> `ToJson` trait not being implemented.
>
> Here is what I did:
>
> > cat foo.rs
> extern crate serialize;
> use serialize::json;
>
> #[derive(Decodable, Encodable)]
> pub struct Data {
>   test: bool,
>   uuid: int,
>   time: f64,
> }
>
> fn main() {
>   let data = Data { test: true, uuid: 123, time: 34349480.24 };
>   json::encode(&data);
> }
>
> > rustc foo.rs
> foo.rs:13:3: 13:15 error: failed to find an implementation of trait
>
> serialize::serialize::Encodable<serialize::json::Encoder<'_>,std::io::IoError>
> for Data
> foo.rs:13   json::encode(&data);
>                 ^~~~~~~~~~~~
>
> The compiler happily skipped over unknown attribute... Is this a
> desired behaviour or a known issues?
>
> Cheers,
> --
> Ilya
> _______________________________________________
> Rust-dev mailing list
> Rust-dev at mozilla.org
> https://mail.mozilla.org/listinfo/rust-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140716/659a6782/attachment.html>


More information about the Rust-dev mailing list