{"action":"created","comment":{"url":"https://api.github.com/repos/rust-lang/rfcs/pulls/comments/32196103","id":32196103,"diff_hunk":"@@ -0,0 +1,184 @@\n+- Start Date: 2015-01-18\n+- RFC PR: (leave this empty)\n+- Rust Issue: (leave this empty)\n+\n+# Summary\n+\n+Fix rustc’s handling of output (`-o`, `--out-dir` and `--emit`) options and their combinations.\n+\n+# Motivation\n+\n+rustc’s handling of various `-o`, `--out-dir`, and `--emit` command line option combinations is\n+very inconsistent and sometimes unexpected. For example, the compiler will use filename provided\n+via `-o` option for *some* of `--emit` targets, even though it emits a warning about filename being\n+ignored. The document aims to propose rules governing interactions of options which influence\n+compiler output.\n+\n+# Detailed design\n+\n+## `--out-dir`\n+\n+`--out-dir` is never ignored or adjusted, even in presence of other options that would usually\n+conflict with `--out-dir`. If the option is provided and the directory does not exist yet, the\n+compiler should create it. Defaults to `.`, otherwise known as current working directory or `$PWD`.\n+Value of this option from now on will be referred to as `[out-dir]`.\n+\n+Note, that a requirement for the compiler to create the output directory if it didn’t exist yet is\n+introduced. This is purely for convenience reasons: creating the output directory after a failure\n+and restarting the program is exceedingly common nowadays.\n+\n+## `--emit` and `--crate-type`\n+\n+The two options influence what and how many files the compiler has to write to the filesystem. The\n+common case compiler having to write one file only (e.g. `--emit` only has one value). In this case\n+the path to output file shall be built using these templates:\n+\n+* `[out-dir]/[filename][.extension]` if `[filename]` was [inferred][inferred].\n+* `[out-dir]/[filename]` otherwise;\n+\n+[inferred]: #-o-is-not-specified\n+\n+When there’s multiple files to output, each output file shall be written to path generated using\n+`[out-dir]/[filename][.extension]` template.\n+\n+What `[filename]` resolves to is specified in [section about `-o`](#-o).\n+\n+The `[.extension]` is file extension specific to the emitted target. This is a list of extensions\n+for each currently supported target:\n+\n+* asm – `.s`;\n+* llvm-bc – `.bc`;\n+* llvm-ir – `.ll`;\n+* obj – `.o`;\n+* dep-info – `.d`;\n+* link – depends on `crate-type`:\n+  * bin – no extension or `.exe`;\n+  * lib – `.rlib`;\n+  * rlib – `.rlib`;\n+  * dylib – `.so`, `.dll` or `.dylib`;\n+  * staticlib – `.a`.","path":"text/0000-output-options.md","position":59,"original_position":59,"commit_id":"a3298959db8f5b0ceb6f4f0e5d337b84f6f79ad6","original_commit_id":"a3298959db8f5b0ceb6f4f0e5d337b84f6f79ad6","user":{"login":"nagisa","id":679122,"avatar_url":"https://avatars.githubusercontent.com/u/679122?v=3","gravatar_id":"","url":"https://api.github.com/users/nagisa","html_url":"https://github.com/nagisa","followers_url":"https://api.github.com/users/nagisa/followers","following_url":"https://api.github.com/users/nagisa/following{/other_user}","gists_url":"https://api.github.com/users/nagisa/gists{/gist_id}","starred_url":"https://api.github.com/users/nagisa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nagisa/subscriptions","organizations_url":"https://api.github.com/users/nagisa/orgs","repos_url":"https://api.github.com/users/nagisa/repos","events_url":"https://api.github.com/users/nagisa/events{/privacy}","received_events_url":"https://api.github.com/users/nagisa/received_events","type":"User","site_admin":false},"body":"I’ll gladly append the list with any extensions that are used by linkers we strive to support in the future. I think it is also possible to make this part not normative, but informative instead, so any extensions when implementing a new linker could be added without an RFC or modification of this one.","created_at":"2015-06-11T07:35:59Z","updated_at":"2015-06-11T07:35:59Z","html_url":"https://github.com/rust-lang/rfcs/pull/595#discussion_r32196103","pull_request_url":"https://api.github.com/repos/rust-lang/rfcs/pulls/595","_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/comments/32196103"},"html":{"href":"https://github.com/rust-lang/rfcs/pull/595#discussion_r32196103"},"pull_request":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/595"}}},"pull_request":{"url":"https://api.github.com/repos/rust-lang/rfcs/pulls/595","id":27576048,"html_url":"https://github.com/rust-lang/rfcs/pull/595","diff_url":"https://github.com/rust-lang/rfcs/pull/595.diff","patch_url":"https://github.com/rust-lang/rfcs/pull/595.patch","issue_url":"https://api.github.com/repos/rust-lang/rfcs/issues/595","number":595,"state":"open","locked":false,"title":"Output option handling","user":{"login":"nagisa","id":679122,"avatar_url":"https://avatars.githubusercontent.com/u/679122?v=3","gravatar_id":"","url":"https://api.github.com/users/nagisa","html_url":"https://github.com/nagisa","followers_url":"https://api.github.com/users/nagisa/followers","following_url":"https://api.github.com/users/nagisa/following{/other_user}","gists_url":"https://api.github.com/users/nagisa/gists{/gist_id}","starred_url":"https://api.github.com/users/nagisa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nagisa/subscriptions","organizations_url":"https://api.github.com/users/nagisa/orgs","repos_url":"https://api.github.com/users/nagisa/repos","events_url":"https://api.github.com/users/nagisa/events{/privacy}","received_events_url":"https://api.github.com/users/nagisa/received_events","type":"User","site_admin":false},"body":"[Rendered]\r\n\r\n[Rendered]: https://github.com/nagisa/rfcs/blob/c1f2bc4a7dc176dfcef0b77eacbbb01ad9de1fff/text/0000-output-options.md","created_at":"2015-01-18T20:00:47Z","updated_at":"2015-06-11T07:36:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7e0400963401af97aa2d71ec0acd9ce65cfe77d4","assignee":{"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},"milestone":null,"commits_url":"https://api.github.com/repos/rust-lang/rfcs/pulls/595/commits","review_comments_url":"https://api.github.com/repos/rust-lang/rfcs/pulls/595/comments","review_comment_url":"https://api.github.com/repos/rust-lang/rfcs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rust-lang/rfcs/issues/595/comments","statuses_url":"https://api.github.com/repos/rust-lang/rfcs/statuses/a3298959db8f5b0ceb6f4f0e5d337b84f6f79ad6","head":{"label":"nagisa:master","ref":"master","sha":"a3298959db8f5b0ceb6f4f0e5d337b84f6f79ad6","user":{"login":"nagisa","id":679122,"avatar_url":"https://avatars.githubusercontent.com/u/679122?v=3","gravatar_id":"","url":"https://api.github.com/users/nagisa","html_url":"https://github.com/nagisa","followers_url":"https://api.github.com/users/nagisa/followers","following_url":"https://api.github.com/users/nagisa/following{/other_user}","gists_url":"https://api.github.com/users/nagisa/gists{/gist_id}","starred_url":"https://api.github.com/users/nagisa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nagisa/subscriptions","organizations_url":"https://api.github.com/users/nagisa/orgs","repos_url":"https://api.github.com/users/nagisa/repos","events_url":"https://api.github.com/users/nagisa/events{/privacy}","received_events_url":"https://api.github.com/users/nagisa/received_events","type":"User","site_admin":false},"repo":{"id":29438915,"name":"rfcs","full_name":"nagisa/rfcs","owner":{"login":"nagisa","id":679122,"avatar_url":"https://avatars.githubusercontent.com/u/679122?v=3","gravatar_id":"","url":"https://api.github.com/users/nagisa","html_url":"https://github.com/nagisa","followers_url":"https://api.github.com/users/nagisa/followers","following_url":"https://api.github.com/users/nagisa/following{/other_user}","gists_url":"https://api.github.com/users/nagisa/gists{/gist_id}","starred_url":"https://api.github.com/users/nagisa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nagisa/subscriptions","organizations_url":"https://api.github.com/users/nagisa/orgs","repos_url":"https://api.github.com/users/nagisa/repos","events_url":"https://api.github.com/users/nagisa/events{/privacy}","received_events_url":"https://api.github.com/users/nagisa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nagisa/rfcs","description":"RFCs for changes to Rust","fork":true,"url":"https://api.github.com/repos/nagisa/rfcs","forks_url":"https://api.github.com/repos/nagisa/rfcs/forks","keys_url":"https://api.github.com/repos/nagisa/rfcs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nagisa/rfcs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nagisa/rfcs/teams","hooks_url":"https://api.github.com/repos/nagisa/rfcs/hooks","issue_events_url":"https://api.github.com/repos/nagisa/rfcs/issues/events{/number}","events_url":"https://api.github.com/repos/nagisa/rfcs/events","assignees_url":"https://api.github.com/repos/nagisa/rfcs/assignees{/user}","branches_url":"https://api.github.com/repos/nagisa/rfcs/branches{/branch}","tags_url":"https://api.github.com/repos/nagisa/rfcs/tags","blobs_url":"https://api.github.com/repos/nagisa/rfcs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nagisa/rfcs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nagisa/rfcs/git/refs{/sha}","trees_url":"https://api.github.com/repos/nagisa/rfcs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nagisa/rfcs/statuses/{sha}","languages_url":"https://api.github.com/repos/nagisa/rfcs/languages","stargazers_url":"https://api.github.com/repos/nagisa/rfcs/stargazers","contributors_url":"https://api.github.com/repos/nagisa/rfcs/contributors","subscribers_url":"https://api.github.com/repos/nagisa/rfcs/subscribers","subscription_url":"https://api.github.com/repos/nagisa/rfcs/subscription","commits_url":"https://api.github.com/repos/nagisa/rfcs/commits{/sha}","git_commits_url":"https://api.github.com/repos/nagisa/rfcs/git/commits{/sha}","comments_url":"https://api.github.com/repos/nagisa/rfcs/comments{/number}","issue_comment_url":"https://api.github.com/repos/nagisa/rfcs/issues/comments{/number}","contents_url":"https://api.github.com/repos/nagisa/rfcs/contents/{+path}","compare_url":"https://api.github.com/repos/nagisa/rfcs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nagisa/rfcs/merges","archive_url":"https://api.github.com/repos/nagisa/rfcs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nagisa/rfcs/downloads","issues_url":"https://api.github.com/repos/nagisa/rfcs/issues{/number}","pulls_url":"https://api.github.com/repos/nagisa/rfcs/pulls{/number}","milestones_url":"https://api.github.com/repos/nagisa/rfcs/milestones{/number}","notifications_url":"https://api.github.com/repos/nagisa/rfcs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nagisa/rfcs/labels{/name}","releases_url":"https://api.github.com/repos/nagisa/rfcs/releases{/id}","created_at":"2015-01-18T19:58:45Z","updated_at":"2015-01-18T09:31:24Z","pushed_at":"2015-04-10T22:18:05Z","git_url":"git://github.com/nagisa/rfcs.git","ssh_url":"git@github.com:nagisa/rfcs.git","clone_url":"https://github.com/nagisa/rfcs.git","svn_url":"https://github.com/nagisa/rfcs","homepage":"","size":1821,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"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":"2a7a5fde8d51774e4ae5145049393dea554ecb77","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":17527989,"name":"rfcs","full_name":"rust-lang/rfcs","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/rfcs","description":"RFCs for changes to Rust","fork":false,"url":"https://api.github.com/repos/rust-lang/rfcs","forks_url":"https://api.github.com/repos/rust-lang/rfcs/forks","keys_url":"https://api.github.com/repos/rust-lang/rfcs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rust-lang/rfcs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rust-lang/rfcs/teams","hooks_url":"https://api.github.com/repos/rust-lang/rfcs/hooks","issue_events_url":"https://api.github.com/repos/rust-lang/rfcs/issues/events{/number}","events_url":"https://api.github.com/repos/rust-lang/rfcs/events","assignees_url":"https://api.github.com/repos/rust-lang/rfcs/assignees{/user}","branches_url":"https://api.github.com/repos/rust-lang/rfcs/branches{/branch}","tags_url":"https://api.github.com/repos/rust-lang/rfcs/tags","blobs_url":"https://api.github.com/repos/rust-lang/rfcs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rust-lang/rfcs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rust-lang/rfcs/git/refs{/sha}","trees_url":"https://api.github.com/repos/rust-lang/rfcs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rust-lang/rfcs/statuses/{sha}","languages_url":"https://api.github.com/repos/rust-lang/rfcs/languages","stargazers_url":"https://api.github.com/repos/rust-lang/rfcs/stargazers","contributors_url":"https://api.github.com/repos/rust-lang/rfcs/contributors","subscribers_url":"https://api.github.com/repos/rust-lang/rfcs/subscribers","subscription_url":"https://api.github.com/repos/rust-lang/rfcs/subscription","commits_url":"https://api.github.com/repos/rust-lang/rfcs/commits{/sha}","git_commits_url":"https://api.github.com/repos/rust-lang/rfcs/git/commits{/sha}","comments_url":"https://api.github.com/repos/rust-lang/rfcs/comments{/number}","issue_comment_url":"https://api.github.com/repos/rust-lang/rfcs/issues/comments{/number}","contents_url":"https://api.github.com/repos/rust-lang/rfcs/contents/{+path}","compare_url":"https://api.github.com/repos/rust-lang/rfcs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rust-lang/rfcs/merges","archive_url":"https://api.github.com/repos/rust-lang/rfcs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rust-lang/rfcs/downloads","issues_url":"https://api.github.com/repos/rust-lang/rfcs/issues{/number}","pulls_url":"https://api.github.com/repos/rust-lang/rfcs/pulls{/number}","milestones_url":"https://api.github.com/repos/rust-lang/rfcs/milestones{/number}","notifications_url":"https://api.github.com/repos/rust-lang/rfcs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rust-lang/rfcs/labels{/name}","releases_url":"https://api.github.com/repos/rust-lang/rfcs/releases{/id}","created_at":"2014-03-07T21:29:00Z","updated_at":"2015-06-08T15:42:34Z","pushed_at":"2015-06-10T17:55:13Z","git_url":"git://github.com/rust-lang/rfcs.git","ssh_url":"git@github.com:rust-lang/rfcs.git","clone_url":"https://github.com/rust-lang/rfcs.git","svn_url":"https://github.com/rust-lang/rfcs","homepage":"","size":10424,"stargazers_count":380,"watchers_count":380,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":206,"mirror_url":null,"open_issues_count":511,"forks":206,"open_issues":511,"watchers":380,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/595"},"html":{"href":"https://github.com/rust-lang/rfcs/pull/595"},"issue":{"href":"https://api.github.com/repos/rust-lang/rfcs/issues/595"},"comments":{"href":"https://api.github.com/repos/rust-lang/rfcs/issues/595/comments"},"review_comments":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/595/comments"},"review_comment":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/595/commits"},"statuses":{"href":"https://api.github.com/repos/rust-lang/rfcs/statuses/a3298959db8f5b0ceb6f4f0e5d337b84f6f79ad6"}}}}