{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/28160","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/28160/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/28160/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/28160/events","html_url":"https://github.com/rust-lang/rust/issues/28160","id":104352618,"number":28160,"title":"Settle execution order uncertainty for `+=`","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},"labels":[{"url":"https://api.github.com/repos/rust-lang/rust/labels/I-needs-decision","name":"I-needs-decision","color":"e11d21"},{"url":"https://api.github.com/repos/rust-lang/rust/labels/I-nominated","name":"I-nominated","color":"e10c02"},{"url":"https://api.github.com/repos/rust-lang/rust/labels/T-lang","name":"T-lang","color":"bfd4f2"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":19,"created_at":"2015-09-01T20:54:18Z","updated_at":"2015-09-03T18:41:12Z","closed_at":null,"body":"When translating something like `a += b` to MIR, an uncertainty arose about what the semantics of\r\n\r\n    a = 0;\r\n    a += { a = 22; 2 }\r\n\r\nought to be. Should resulting value of `a` be `24` or `2`, basically? The current MIR yields 24, on the basis that this is more-or-less what will happen in the case of overloading as well (presuming non-lexical lifetimes, since I think otherwise you get a borrowck error)."},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/137538410","html_url":"https://github.com/rust-lang/rust/issues/28160#issuecomment-137538410","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/28160","id":137538410,"user":{"login":"eddyb","id":77424,"avatar_url":"https://avatars.githubusercontent.com/u/77424?v=3","gravatar_id":"","url":"https://api.github.com/users/eddyb","html_url":"https://github.com/eddyb","followers_url":"https://api.github.com/users/eddyb/followers","following_url":"https://api.github.com/users/eddyb/following{/other_user}","gists_url":"https://api.github.com/users/eddyb/gists{/gist_id}","starred_url":"https://api.github.com/users/eddyb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eddyb/subscriptions","organizations_url":"https://api.github.com/users/eddyb/orgs","repos_url":"https://api.github.com/users/eddyb/repos","events_url":"https://api.github.com/users/eddyb/events{/privacy}","received_events_url":"https://api.github.com/users/eddyb/received_events","type":"User","site_admin":false},"created_at":"2015-09-03T18:41:12Z","updated_at":"2015-09-03T18:41:12Z","body":"On IRC I came up with this example which seems to make the smarter schemes fall apart:\r\n```rust\r\nlet mut boxed = Box::new(vec![...]);\r\n(*boxed).push({\r\n    mem::replace(&mut boxed, Box::new(vec![])).len()\r\n})\r\n```\r\nDo we need to differentiate between `GEP`-style lvalue computations (lvalue -> lvalue with only offsets) and lvalue computations that actually load data from memory?\r\nThe result of the former (such as struct/tuple field accesses) *should* be the same before and after any possible expression that may mutate the lvalues in question."}}