{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/26701","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/26701/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/26701/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/26701/events","html_url":"https://github.com/rust-lang/rust/issues/26701","id":92261230,"number":26701,"title":"Shadowed variable isn't droped until the end of outer scope","user":{"login":"arthurprs","id":715958,"avatar_url":"https://avatars.githubusercontent.com/u/715958?v=3","gravatar_id":"","url":"https://api.github.com/users/arthurprs","html_url":"https://github.com/arthurprs","followers_url":"https://api.github.com/users/arthurprs/followers","following_url":"https://api.github.com/users/arthurprs/following{/other_user}","gists_url":"https://api.github.com/users/arthurprs/gists{/gist_id}","starred_url":"https://api.github.com/users/arthurprs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arthurprs/subscriptions","organizations_url":"https://api.github.com/users/arthurprs/orgs","repos_url":"https://api.github.com/users/arthurprs/repos","events_url":"https://api.github.com/users/arthurprs/events{/privacy}","received_events_url":"https://api.github.com/users/arthurprs/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-07-01T03:40:54Z","updated_at":"2015-07-01T20:11:45Z","closed_at":"2015-07-01T20:11:45Z","body":"```\r\nstruct Test {\r\n\tn: usize\r\n}\r\n\r\nimpl Drop for Test {\r\n\tfn drop(&mut self) {\r\n\t\tprintln!(\"dropping {}\", self.n);\r\n\t}\r\n}\r\n\r\nfn main() {\r\n    println!(\"Hello, world!\");\r\n    let a = Test { n: 1};\r\n    println!(\"Hello, world 2.0!\");\r\n    let a = Test { n: 2};\r\n    println!(\"Hello, world 3.0!\");\r\n}\r\n```\r\n\r\nproduces\r\n\r\n```\r\nHello, world!\r\nHello, world 2.0!\r\nHello, world 3.0!\r\ndropping 2\r\ndropping 1\r\n```\r\n\r\nI think most people would expect \"dropping 1\" to appear just before \"Hello, world 3.0!\"\r\n\r\nIs this expected?\r\n\r\nIf yes, what's the reasoning? This is totally unexpected. I stumbled across this just now trying to understand why one of my tests were failing. After baning my head into a wall for some time I tried to insert a drop() just before the shadowing and voilà."},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/117811774","html_url":"https://github.com/rust-lang/rust/issues/26701#issuecomment-117811774","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/26701","id":117811774,"user":{"login":"huonw","id":1203825,"avatar_url":"https://avatars.githubusercontent.com/u/1203825?v=3","gravatar_id":"","url":"https://api.github.com/users/huonw","html_url":"https://github.com/huonw","followers_url":"https://api.github.com/users/huonw/followers","following_url":"https://api.github.com/users/huonw/following{/other_user}","gists_url":"https://api.github.com/users/huonw/gists{/gist_id}","starred_url":"https://api.github.com/users/huonw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huonw/subscriptions","organizations_url":"https://api.github.com/users/huonw/orgs","repos_url":"https://api.github.com/users/huonw/repos","events_url":"https://api.github.com/users/huonw/events{/privacy}","received_events_url":"https://api.github.com/users/huonw/received_events","type":"User","site_admin":false},"created_at":"2015-07-01T20:11:45Z","updated_at":"2015-07-01T20:11:45Z","body":"Closing since it's not a bug (and 1.0 has been released), but feel free to continue the discussion (here is fine, but users.rust-lang.org or internals.rust-lang.org might be more appropriate)."}}