{"action":"created","comment":{"url":"https://api.github.com/repos/rust-lang/rust-by-example/pulls/comments/36786569","id":36786569,"diff_hunk":"@@ -1,24 +1,41 @@\n-struct Book {\n-    // `String` is a heap allocated string\n-    title: String,\n-    author: String,\n-    year: i32,\n-}\n+// This example uses `main()` at the top so it can be read top to\n+// bottom. `main()` is usually at the bottom.\n+fn main() {\n+    // Create variables which will be borrowed.\n+    let (four, nine) = (4, 9);\n+\n+    // Borrows (`&`) of both variables are passed into the function.\n+    // If a borrow is truly a borrow, the variable must be returned,\n+    // otherwise a borrow would be transferring ownership. This means","path":"examples/scope/lifetime/explicit/explicit.rs","position":15,"original_position":15,"commit_id":"eceddd750dcb9c5fcb828439bb117def98ff43f4","original_commit_id":"eceddd750dcb9c5fcb828439bb117def98ff43f4","user":{"login":"mdinger","id":4156987,"avatar_url":"https://avatars.githubusercontent.com/u/4156987?v=3","gravatar_id":"","url":"https://api.github.com/users/mdinger","html_url":"https://github.com/mdinger","followers_url":"https://api.github.com/users/mdinger/followers","following_url":"https://api.github.com/users/mdinger/following{/other_user}","gists_url":"https://api.github.com/users/mdinger/gists{/gist_id}","starred_url":"https://api.github.com/users/mdinger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdinger/subscriptions","organizations_url":"https://api.github.com/users/mdinger/orgs","repos_url":"https://api.github.com/users/mdinger/repos","events_url":"https://api.github.com/users/mdinger/events{/privacy}","received_events_url":"https://api.github.com/users/mdinger/received_events","type":"User","site_admin":false},"body":"I don't like this change. As written, I'm trying to leverage the idea that people understand that borrows must always come back. If they don't come back then they can't be borrows; they must be transfers. It's the only option.\r\n\r\nWith your suggestion, I would immediately ask \"why must they be returned\"? I wouldn't necessarily see any reason they must be returned other than that is what the docs say.","created_at":"2015-08-11T19:17:53Z","updated_at":"2015-08-11T19:17:53Z","html_url":"https://github.com/rust-lang/rust-by-example/pull/607#discussion_r36786569","pull_request_url":"https://api.github.com/repos/rust-lang/rust-by-example/pulls/607","_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust-by-example/pulls/comments/36786569"},"html":{"href":"https://github.com/rust-lang/rust-by-example/pull/607#discussion_r36786569"},"pull_request":{"href":"https://api.github.com/repos/rust-lang/rust-by-example/pulls/607"}}},"pull_request":{"url":"https://api.github.com/repos/rust-lang/rust-by-example/pulls/607","id":38720246,"html_url":"https://github.com/rust-lang/rust-by-example/pull/607","diff_url":"https://github.com/rust-lang/rust-by-example/pull/607.diff","patch_url":"https://github.com/rust-lang/rust-by-example/pull/607.patch","issue_url":"https://api.github.com/repos/rust-lang/rust-by-example/issues/607","number":607,"state":"open","locked":false,"title":"Rewrite lifetimes section","user":{"login":"mdinger","id":4156987,"avatar_url":"https://avatars.githubusercontent.com/u/4156987?v=3","gravatar_id":"","url":"https://api.github.com/users/mdinger","html_url":"https://github.com/mdinger","followers_url":"https://api.github.com/users/mdinger/followers","following_url":"https://api.github.com/users/mdinger/following{/other_user}","gists_url":"https://api.github.com/users/mdinger/gists{/gist_id}","starred_url":"https://api.github.com/users/mdinger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdinger/subscriptions","organizations_url":"https://api.github.com/users/mdinger/orgs","repos_url":"https://api.github.com/users/mdinger/repos","events_url":"https://api.github.com/users/mdinger/events{/privacy}","received_events_url":"https://api.github.com/users/mdinger/received_events","type":"User","site_admin":false},"body":"~~[WIP]~~\r\n\r\n* I tried pretty hard to make it read decently (I'm not that great at it though). Hopefully it is.\r\n* ~~I completely glossed over elision and I may just insert a link to the book section where it discusses elision...not sure~~\r\n* I tried to give answers to most of the questions asked on this [users thread](https://users.rust-lang.org/t/what-needs-to-be-explained-about-lifetime-parameters/291) but I'm not sure what they are all asking exactly.\r\n* These examples are mostly simple. I'm not sure what kind of concepts the more complex ones use.\r\n\r\n[TODO]\r\n\r\n* Need to add `See also` sections\r\n* ~~[This reddit thread](https://www.reddit.com/r/rust/comments/3aahl1/outside_of_closures_what_are_some_other_uses_for/) details a more advanced example which I don't get yet. Maybe I'll look at it again later.~~ [Defer to later]\r\n* ~~Some testcases might be nice.~~ [Defer to later]\r\n\r\n[EDIT]\r\n* Added a section on lifetime coercion\r\n* Added a section on elision. It's pretty brief and then defers to the book.\r\n\r\nFixes #154","created_at":"2015-06-28T05:05:02Z","updated_at":"2015-08-11T19:17:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6b15722ddc3a7c6b79b96b074666e21d34c6a6de","assignee":{"login":"steveklabnik","id":27786,"avatar_url":"https://avatars.githubusercontent.com/u/27786?v=3","gravatar_id":"","url":"https://api.github.com/users/steveklabnik","html_url":"https://github.com/steveklabnik","followers_url":"https://api.github.com/users/steveklabnik/followers","following_url":"https://api.github.com/users/steveklabnik/following{/other_user}","gists_url":"https://api.github.com/users/steveklabnik/gists{/gist_id}","starred_url":"https://api.github.com/users/steveklabnik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steveklabnik/subscriptions","organizations_url":"https://api.github.com/users/steveklabnik/orgs","repos_url":"https://api.github.com/users/steveklabnik/repos","events_url":"https://api.github.com/users/steveklabnik/events{/privacy}","received_events_url":"https://api.github.com/users/steveklabnik/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/rust-lang/rust-by-example/pulls/607/commits","review_comments_url":"https://api.github.com/repos/rust-lang/rust-by-example/pulls/607/comments","review_comment_url":"https://api.github.com/repos/rust-lang/rust-by-example/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rust-lang/rust-by-example/issues/607/comments","statuses_url":"https://api.github.com/repos/rust-lang/rust-by-example/statuses/eceddd750dcb9c5fcb828439bb117def98ff43f4","head":{"label":"mdinger:lifetimes","ref":"lifetimes","sha":"eceddd750dcb9c5fcb828439bb117def98ff43f4","user":{"login":"mdinger","id":4156987,"avatar_url":"https://avatars.githubusercontent.com/u/4156987?v=3","gravatar_id":"","url":"https://api.github.com/users/mdinger","html_url":"https://github.com/mdinger","followers_url":"https://api.github.com/users/mdinger/followers","following_url":"https://api.github.com/users/mdinger/following{/other_user}","gists_url":"https://api.github.com/users/mdinger/gists{/gist_id}","starred_url":"https://api.github.com/users/mdinger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdinger/subscriptions","organizations_url":"https://api.github.com/users/mdinger/orgs","repos_url":"https://api.github.com/users/mdinger/repos","events_url":"https://api.github.com/users/mdinger/events{/privacy}","received_events_url":"https://api.github.com/users/mdinger/received_events","type":"User","site_admin":false},"repo":{"id":20778346,"name":"rust-by-example","full_name":"mdinger/rust-by-example","owner":{"login":"mdinger","id":4156987,"avatar_url":"https://avatars.githubusercontent.com/u/4156987?v=3","gravatar_id":"","url":"https://api.github.com/users/mdinger","html_url":"https://github.com/mdinger","followers_url":"https://api.github.com/users/mdinger/followers","following_url":"https://api.github.com/users/mdinger/following{/other_user}","gists_url":"https://api.github.com/users/mdinger/gists{/gist_id}","starred_url":"https://api.github.com/users/mdinger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdinger/subscriptions","organizations_url":"https://api.github.com/users/mdinger/orgs","repos_url":"https://api.github.com/users/mdinger/repos","events_url":"https://api.github.com/users/mdinger/events{/privacy}","received_events_url":"https://api.github.com/users/mdinger/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mdinger/rust-by-example","description":"Learn Rust with practical examples","fork":true,"url":"https://api.github.com/repos/mdinger/rust-by-example","forks_url":"https://api.github.com/repos/mdinger/rust-by-example/forks","keys_url":"https://api.github.com/repos/mdinger/rust-by-example/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mdinger/rust-by-example/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mdinger/rust-by-example/teams","hooks_url":"https://api.github.com/repos/mdinger/rust-by-example/hooks","issue_events_url":"https://api.github.com/repos/mdinger/rust-by-example/issues/events{/number}","events_url":"https://api.github.com/repos/mdinger/rust-by-example/events","assignees_url":"https://api.github.com/repos/mdinger/rust-by-example/assignees{/user}","branches_url":"https://api.github.com/repos/mdinger/rust-by-example/branches{/branch}","tags_url":"https://api.github.com/repos/mdinger/rust-by-example/tags","blobs_url":"https://api.github.com/repos/mdinger/rust-by-example/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mdinger/rust-by-example/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mdinger/rust-by-example/git/refs{/sha}","trees_url":"https://api.github.com/repos/mdinger/rust-by-example/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mdinger/rust-by-example/statuses/{sha}","languages_url":"https://api.github.com/repos/mdinger/rust-by-example/languages","stargazers_url":"https://api.github.com/repos/mdinger/rust-by-example/stargazers","contributors_url":"https://api.github.com/repos/mdinger/rust-by-example/contributors","subscribers_url":"https://api.github.com/repos/mdinger/rust-by-example/subscribers","subscription_url":"https://api.github.com/repos/mdinger/rust-by-example/subscription","commits_url":"https://api.github.com/repos/mdinger/rust-by-example/commits{/sha}","git_commits_url":"https://api.github.com/repos/mdinger/rust-by-example/git/commits{/sha}","comments_url":"https://api.github.com/repos/mdinger/rust-by-example/comments{/number}","issue_comment_url":"https://api.github.com/repos/mdinger/rust-by-example/issues/comments{/number}","contents_url":"https://api.github.com/repos/mdinger/rust-by-example/contents/{+path}","compare_url":"https://api.github.com/repos/mdinger/rust-by-example/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mdinger/rust-by-example/merges","archive_url":"https://api.github.com/repos/mdinger/rust-by-example/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mdinger/rust-by-example/downloads","issues_url":"https://api.github.com/repos/mdinger/rust-by-example/issues{/number}","pulls_url":"https://api.github.com/repos/mdinger/rust-by-example/pulls{/number}","milestones_url":"https://api.github.com/repos/mdinger/rust-by-example/milestones{/number}","notifications_url":"https://api.github.com/repos/mdinger/rust-by-example/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mdinger/rust-by-example/labels{/name}","releases_url":"https://api.github.com/repos/mdinger/rust-by-example/releases{/id}","created_at":"2014-06-12T18:30:07Z","updated_at":"2015-04-14T02:28:46Z","pushed_at":"2015-08-09T15:54:05Z","git_url":"git://github.com/mdinger/rust-by-example.git","ssh_url":"git@github.com:mdinger/rust-by-example.git","clone_url":"https://github.com/mdinger/rust-by-example.git","svn_url":"https://github.com/mdinger/rust-by-example","homepage":"http://rustbyexample.com","size":6105,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rust-lang:master","ref":"master","sha":"65fc5eaf95c844da4d47417ad27e40e740bc7670","user":{"login":"rust-lang","id":5430905,"avatar_url":"https://avatars.githubusercontent.com/u/5430905?v=3","gravatar_id":"","url":"https://api.github.com/users/rust-lang","html_url":"https://github.com/rust-lang","followers_url":"https://api.github.com/users/rust-lang/followers","following_url":"https://api.github.com/users/rust-lang/following{/other_user}","gists_url":"https://api.github.com/users/rust-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-lang/subscriptions","organizations_url":"https://api.github.com/users/rust-lang/orgs","repos_url":"https://api.github.com/users/rust-lang/repos","events_url":"https://api.github.com/users/rust-lang/events{/privacy}","received_events_url":"https://api.github.com/users/rust-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":19126114,"name":"rust-by-example","full_name":"rust-lang/rust-by-example","owner":{"login":"rust-lang","id":5430905,"avatar_url":"https://avatars.githubusercontent.com/u/5430905?v=3","gravatar_id":"","url":"https://api.github.com/users/rust-lang","html_url":"https://github.com/rust-lang","followers_url":"https://api.github.com/users/rust-lang/followers","following_url":"https://api.github.com/users/rust-lang/following{/other_user}","gists_url":"https://api.github.com/users/rust-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-lang/subscriptions","organizations_url":"https://api.github.com/users/rust-lang/orgs","repos_url":"https://api.github.com/users/rust-lang/repos","events_url":"https://api.github.com/users/rust-lang/events{/privacy}","received_events_url":"https://api.github.com/users/rust-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rust-lang/rust-by-example","description":"Learn Rust with examples (Live code editor included)","fork":false,"url":"https://api.github.com/repos/rust-lang/rust-by-example","forks_url":"https://api.github.com/repos/rust-lang/rust-by-example/forks","keys_url":"https://api.github.com/repos/rust-lang/rust-by-example/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rust-lang/rust-by-example/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rust-lang/rust-by-example/teams","hooks_url":"https://api.github.com/repos/rust-lang/rust-by-example/hooks","issue_events_url":"https://api.github.com/repos/rust-lang/rust-by-example/issues/events{/number}","events_url":"https://api.github.com/repos/rust-lang/rust-by-example/events","assignees_url":"https://api.github.com/repos/rust-lang/rust-by-example/assignees{/user}","branches_url":"https://api.github.com/repos/rust-lang/rust-by-example/branches{/branch}","tags_url":"https://api.github.com/repos/rust-lang/rust-by-example/tags","blobs_url":"https://api.github.com/repos/rust-lang/rust-by-example/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rust-lang/rust-by-example/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rust-lang/rust-by-example/git/refs{/sha}","trees_url":"https://api.github.com/repos/rust-lang/rust-by-example/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rust-lang/rust-by-example/statuses/{sha}","languages_url":"https://api.github.com/repos/rust-lang/rust-by-example/languages","stargazers_url":"https://api.github.com/repos/rust-lang/rust-by-example/stargazers","contributors_url":"https://api.github.com/repos/rust-lang/rust-by-example/contributors","subscribers_url":"https://api.github.com/repos/rust-lang/rust-by-example/subscribers","subscription_url":"https://api.github.com/repos/rust-lang/rust-by-example/subscription","commits_url":"https://api.github.com/repos/rust-lang/rust-by-example/commits{/sha}","git_commits_url":"https://api.github.com/repos/rust-lang/rust-by-example/git/commits{/sha}","comments_url":"https://api.github.com/repos/rust-lang/rust-by-example/comments{/number}","issue_comment_url":"https://api.github.com/repos/rust-lang/rust-by-example/issues/comments{/number}","contents_url":"https://api.github.com/repos/rust-lang/rust-by-example/contents/{+path}","compare_url":"https://api.github.com/repos/rust-lang/rust-by-example/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rust-lang/rust-by-example/merges","archive_url":"https://api.github.com/repos/rust-lang/rust-by-example/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rust-lang/rust-by-example/downloads","issues_url":"https://api.github.com/repos/rust-lang/rust-by-example/issues{/number}","pulls_url":"https://api.github.com/repos/rust-lang/rust-by-example/pulls{/number}","milestones_url":"https://api.github.com/repos/rust-lang/rust-by-example/milestones{/number}","notifications_url":"https://api.github.com/repos/rust-lang/rust-by-example/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rust-lang/rust-by-example/labels{/name}","releases_url":"https://api.github.com/repos/rust-lang/rust-by-example/releases{/id}","created_at":"2014-04-24T22:22:40Z","updated_at":"2015-08-11T10:36:35Z","pushed_at":"2015-08-11T19:14:07Z","git_url":"git://github.com/rust-lang/rust-by-example.git","ssh_url":"git@github.com:rust-lang/rust-by-example.git","clone_url":"https://github.com/rust-lang/rust-by-example.git","svn_url":"https://github.com/rust-lang/rust-by-example","homepage":"http://rustbyexample.com","size":58419,"stargazers_count":1804,"watchers_count":1804,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":248,"mirror_url":null,"open_issues_count":59,"forks":248,"open_issues":59,"watchers":1804,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust-by-example/pulls/607"},"html":{"href":"https://github.com/rust-lang/rust-by-example/pull/607"},"issue":{"href":"https://api.github.com/repos/rust-lang/rust-by-example/issues/607"},"comments":{"href":"https://api.github.com/repos/rust-lang/rust-by-example/issues/607/comments"},"review_comments":{"href":"https://api.github.com/repos/rust-lang/rust-by-example/pulls/607/comments"},"review_comment":{"href":"https://api.github.com/repos/rust-lang/rust-by-example/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rust-lang/rust-by-example/pulls/607/commits"},"statuses":{"href":"https://api.github.com/repos/rust-lang/rust-by-example/statuses/eceddd750dcb9c5fcb828439bb117def98ff43f4"}}}}