{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/cargo/issues/1570","repository_url":"https://api.github.com/repos/rust-lang/cargo","labels_url":"https://api.github.com/repos/rust-lang/cargo/issues/1570/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/cargo/issues/1570/comments","events_url":"https://api.github.com/repos/rust-lang/cargo/issues/1570/events","html_url":"https://github.com/rust-lang/cargo/issues/1570","id":72624513,"number":1570,"title":"Add dependency of examples towards features","user":{"login":"tomaka","id":1412254,"avatar_url":"https://avatars.githubusercontent.com/u/1412254?v=3","gravatar_id":"","url":"https://api.github.com/users/tomaka","html_url":"https://github.com/tomaka","followers_url":"https://api.github.com/users/tomaka/followers","following_url":"https://api.github.com/users/tomaka/following{/other_user}","gists_url":"https://api.github.com/users/tomaka/gists{/gist_id}","starred_url":"https://api.github.com/users/tomaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomaka/subscriptions","organizations_url":"https://api.github.com/users/tomaka/orgs","repos_url":"https://api.github.com/users/tomaka/repos","events_url":"https://api.github.com/users/tomaka/events{/privacy}","received_events_url":"https://api.github.com/users/tomaka/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rust-lang/cargo/labels/A-features","name":"A-features","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2015-05-02T10:06:58Z","updated_at":"2016-07-18T05:01:29Z","closed_at":null,"body":"Cargo should allow writing:\r\n\r\n```toml\r\n[package]\r\n# ...\r\n\r\n[features]\r\na = []\r\n\r\n[example]\r\nsrc = \"examples/example-that-uses-a.rs\"\r\nfeatures = [\"a\"]\r\n```\r\n\r\n`example-that-uses-a` would only be compiled if you call `cargo test --features \"a\"`.\r\nMore formally, examples should have the possibiliy to declare a list of features that must be enabled for this example to be compiled.\r\n\r\nThe motivation is to avoid having to write [ugly code like this one](https://github.com/tomaka/glium/blob/master/examples/image.rs#L4-L22).\r\nNewcomers often copy-paste a library's examples to get started, and don't necessarly understand what the `#![cfg(feature)]` thing is and that they shouldn't copy it.\r\n"},"comment":{"url":"https://api.github.com/repos/rust-lang/cargo/issues/comments/233228932","html_url":"https://github.com/rust-lang/cargo/issues/1570#issuecomment-233228932","issue_url":"https://api.github.com/repos/rust-lang/cargo/issues/1570","id":233228932,"user":{"login":"alexcrichton","id":64996,"avatar_url":"https://avatars.githubusercontent.com/u/64996?v=3","gravatar_id":"","url":"https://api.github.com/users/alexcrichton","html_url":"https://github.com/alexcrichton","followers_url":"https://api.github.com/users/alexcrichton/followers","following_url":"https://api.github.com/users/alexcrichton/following{/other_user}","gists_url":"https://api.github.com/users/alexcrichton/gists{/gist_id}","starred_url":"https://api.github.com/users/alexcrichton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexcrichton/subscriptions","organizations_url":"https://api.github.com/users/alexcrichton/orgs","repos_url":"https://api.github.com/users/alexcrichton/repos","events_url":"https://api.github.com/users/alexcrichton/events{/privacy}","received_events_url":"https://api.github.com/users/alexcrichton/received_events","type":"User","site_admin":false},"created_at":"2016-07-18T05:01:29Z","updated_at":"2016-07-18T05:01:29Z","body":"@adamcrume there was a [rebased version](https://github.com/rust-lang/cargo/pull/2325) of the original PR, and it basically just needs a revival at this point I believe with some comments addressed (all on the PR itself)"}}
{"actor":{"display_login":"alexcrichton"}}