{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/25110","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/25110/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/25110/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/25110/events","html_url":"https://github.com/rust-lang/rust/issues/25110","id":73163345,"number":25110,"title":"Bound on Types Only Conditionally Enforced","user":{"login":"kyledewey","id":992190,"avatar_url":"https://avatars.githubusercontent.com/u/992190?v=3","gravatar_id":"","url":"https://api.github.com/users/kyledewey","html_url":"https://github.com/kyledewey","followers_url":"https://api.github.com/users/kyledewey/followers","following_url":"https://api.github.com/users/kyledewey/following{/other_user}","gists_url":"https://api.github.com/users/kyledewey/gists{/gist_id}","starred_url":"https://api.github.com/users/kyledewey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kyledewey/subscriptions","organizations_url":"https://api.github.com/users/kyledewey/orgs","repos_url":"https://api.github.com/users/kyledewey/repos","events_url":"https://api.github.com/users/kyledewey/events{/privacy}","received_events_url":"https://api.github.com/users/kyledewey/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rust-lang/rust/labels/A-typesystem","name":"A-typesystem","color":"d7e102"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-05-05T00:15:33Z","updated_at":"2015-05-13T19:35:39Z","closed_at":null,"body":"The following code is accepted by the compiler:\r\n\r\n```rust\r\ntrait ImplMe {}\r\nimpl<'a, A> ImplMe for A where &'a A : 'a {}\r\n```\r\n\r\n...however, the following highly similar code is rejected:\r\n\r\n```rust\r\ntrait ImplMe<'a, A> {}\r\nimpl<'a, A> ImplMe<'a, A> for A where &'a A : 'a {}\r\n```\r\n\r\nThe code is rejected with:\r\n```\r\ninconsistent.rs:3:1: 3:52 error: the parameter type `A` may not live long enough [E0309]\r\ninconsistent.rs:3 impl<'a, A> ImplMe<'a, A> for A where &'a A : 'a {}\r\n                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\ninconsistent.rs:3:1: 3:52 help: consider adding an explicit lifetime bound `A: 'a`...\r\ninconsistent.rs:3:1: 3:52 note: ...so that the reference type `&A` does not outlive the data it points at\r\ninconsistent.rs:3 impl<'a, A> ImplMe<'a, A> for A where &'a A : 'a {}\r\n                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n```\r\n\r\nThe only difference between the two code snippets is whether or not the `ImplMe` trait takes parameters.  `ImplMe` puts no additional constraints on the parameters.  I'm unsure what the correct behavior is here, though at the very least it seems odd to me that this seemingly inconsequential change causes a problem.\r\n\r\nVersion information:\r\n\r\n```\r\nrustc --version\r\nrustc 1.1.0-nightly (ce1150b9f 2015-05-04) (built 2015-05-03)\r\n```"},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/101788332","html_url":"https://github.com/rust-lang/rust/issues/25110#issuecomment-101788332","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/25110","id":101788332,"user":{"login":"nikomatsakis","id":155238,"avatar_url":"https://avatars.githubusercontent.com/u/155238?v=3","gravatar_id":"","url":"https://api.github.com/users/nikomatsakis","html_url":"https://github.com/nikomatsakis","followers_url":"https://api.github.com/users/nikomatsakis/followers","following_url":"https://api.github.com/users/nikomatsakis/following{/other_user}","gists_url":"https://api.github.com/users/nikomatsakis/gists{/gist_id}","starred_url":"https://api.github.com/users/nikomatsakis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikomatsakis/subscriptions","organizations_url":"https://api.github.com/users/nikomatsakis/orgs","repos_url":"https://api.github.com/users/nikomatsakis/repos","events_url":"https://api.github.com/users/nikomatsakis/events{/privacy}","received_events_url":"https://api.github.com/users/nikomatsakis/received_events","type":"User","site_admin":false},"created_at":"2015-05-13T19:35:39Z","updated_at":"2015-05-13T19:35:39Z","body":"So, I've been swamped the last few days -- I apologize for not getting to this yet. I agree that it looks like there is some sort of bug here, but I'm not sure which of the examples is wrong! I'll try to dig into it more shortly."}}