{"action":"created","comment":{"url":"https://api.github.com/repos/rust-lang/rfcs/pulls/comments/97457235","pull_request_review_id":18067669,"id":97457235,"diff_hunk":"@@ -0,0 +1,574 @@\n+- Feature Name: N/A\n+- Start Date: 2016-11-15\n+- RFC PR: (leave this empty)\n+- Rust Issue: (leave this empty)\n+\n+# Summary\n+[summary]: #summary\n+\n+There has long been a desire to expand the number of platform- and\n+architecture-specific APIs in the standard library, and to offer subsets of the\n+standard library for working in constrained environments. At the same time, we\n+want to retain the property that Rust code is portable by default.\n+\n+This RFC proposes a new *portability lint*, which threads the needle between\n+these two desires. The lint piggybacks on the existing `cfg` system, so that\n+using APIs involving `cfg` will generate a warning unless there is explicit\n+acknowledgment of the portability implications.\n+\n+The lint is intended to make the existing `std::os` module obsolete, to allow\n+expansion (and subsetting) of the standard library, and to provide deeper\n+checking for portability across the ecosystem.\n+\n+# Motivation\n+[motivation]: #motivation\n+\n+## Background: portability and the standard library\n+\n+One of the goals of the standard library is to provide an interface to hardware\n+and system services. In doing so, there were several competing principles that\n+we wanted to embrace:\n+\n+- Rust should provide ergonomic and productive APIs for system services.\n+- Rust should encourage portability by default.\n+- Rust should provide zero-cost access to low-level system services.\n+- Rust should be usable in a wide range of contexts, including\n+  resource-constrained and kernel environments.\n+\n+The way we balanced these principles was roughly as follows:\n+\n+- We identified a set of \"mainstream\" platforms, consisting of 32- and 64-bit\n+  machines running Windows, Linux, or macOS. \"Portability by default\" thus more\n+  specifically means portability *to mainstream platforms*.\n+\n+- We present an ergonomic, primary API surface which is portable across these\n+  mainstream platforms (see `std::{fs, net, env, process, sync}` etc.).\n+\n+- We *also* provide separate access to low-level or OS-specific services via the\n+  `std::os` module. APIs in this module are largely traits that extend the\n+  cross-platform APIs, and in particular can expose their OS-level\n+  representation. The fact that these APIs require explicitly importing from\n+  `std::os` provided a small \"speed bump\" for venturing out of guaranteed\n+  mainstream platform portability.\n+\n+- Finally, for working in low-level and embedded contexts, we stabilized\n+  `libcore`, a subset of `libstd` that excludes all OS services and allocation,\n+  but *still* makes some hardware assumptions (e.g. about atomics and floating\n+  point support).\n+\n+## Problems with the status quo\n+\n+The above strategy has served us fairly well in the first year since Rust 1.0,\n+but it's increasingly holding us back from enhancements we'd like to make, and\n+even for the needs it covers, it's suboptimal in a few ways.\n+\n+**Problems with `std::os`**:\n+\n+* The `std::os` module has submodules that correspond to a hierarchy of OS\n+  types. For example, there is a `unix` submodule that applies to several\n+  operating systems, but there's also a `linux` submodule with Linux-specific\n+  extensions. There are a couple of problems with such an organization. Most\n+  importantly, it's not at all clear how to use the module hierarchy to organize\n+  features like [fixed-size atomic types][more-atomics], where the types\n+  available vary in a fine-grained way based on the CPU family; [SIMD] is even\n+  worse. But even just for operating systems, organizing into a hierarchy\n+  becomes difficult as we gain more and more APIs, some of which are only\n+  available on particular *versions* of a given operating system.\n+\n+* The \"speed bump\" for using `std::os` is minimal and easy to miss; it's just an\n+  import that looks the same as any other. Moreover, it doesn't provide any help\n+  with the ecosystem beyond `std`. There's no simple way to tell whether a crate\n+  you're relying on is portable to the same degree as `std` is, and the `os`\n+  submodule pattern has not really caught on in the wider ecosystem.\n+\n+* Platform-specific APIs don't live in their \"natural location\". The majority of\n+  `std::os` works through extension traits to enhance the functionality of\n+  standard primitives. For example `std::os::unix::io::AsRawFd` is a trait with\n+  the `as_raw_fd` method (to extract a file descriptor). If you were to ignore\n+  Windows, however, one might expect this API instead to live as a method\n+  directly on types like `File`, `TcpStream`, etc. Forcing code to live in\n+  `std::os` thus comes at a mild cost for both ergonomics and discoverability.\n+  This problem is even worse for features like adding more atomic types or SIMD.\n+\n+**Problems with `libcore`/the facade**:\n+\n+* Embedded libraries typically wish to never use functions in the standard\n+  library that abort on allocation failure (e.g. `Vec::push`). We'd like to\n+  provide some way for these libraries to use and interoperate with the standard\n+  collection types, but only have access to an alternative API surface (e.g. a\n+  `try_push` method provided via an extension trait). It's not clear how to do\n+  that with the current [facade] setup.\n+\n+* Kernels and embedded environments often want to","path":"text/0000-portability-lint.md","position":102,"original_position":102,"commit_id":"5fa743f4c710cebf4852b12f620a694cd63ab0d8","original_commit_id":"5fa743f4c710cebf4852b12f620a694cd63ab0d8","user":{"login":"japaric","id":5018213,"avatar_url":"https://avatars.githubusercontent.com/u/5018213?v=3","gravatar_id":"","url":"https://api.github.com/users/japaric","html_url":"https://github.com/japaric","followers_url":"https://api.github.com/users/japaric/followers","following_url":"https://api.github.com/users/japaric/following{/other_user}","gists_url":"https://api.github.com/users/japaric/gists{/gist_id}","starred_url":"https://api.github.com/users/japaric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/japaric/subscriptions","organizations_url":"https://api.github.com/users/japaric/orgs","repos_url":"https://api.github.com/users/japaric/repos","events_url":"https://api.github.com/users/japaric/events{/privacy}","received_events_url":"https://api.github.com/users/japaric/received_events","type":"User","site_admin":false},"body":"[I thought this was already solved?](https://github.com/rust-lang/rfcs/issues/1364#issuecomment-236374104) Using the right codegen options removed the LLVM assertions that x86 devs were seeing by lowering float operations to intrinsics (software implementations) *without* having to modify the `core` crate. cc @steveklabnik @phil-opp Does the #rust-osdev community still recommend patching `core` to remove floats?\r\n\r\nOn the ARM Cortex-M side of embedded development, if your hardware doesn't have floating point instructions then you use, for example, the `thumbv7em-none-eabi` target instead of the \"hard float\" variant: `thumbv7em-none-eabihf`, which does have floating point instructions. No need to strip anything from the `core` crate.","created_at":"2017-01-24T01:30:17Z","updated_at":"2017-01-24T01:30:17Z","html_url":"https://github.com/rust-lang/rfcs/pull/1868#discussion_r97457235","pull_request_url":"https://api.github.com/repos/rust-lang/rfcs/pulls/1868","_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/comments/97457235"},"html":{"href":"https://github.com/rust-lang/rfcs/pull/1868#discussion_r97457235"},"pull_request":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/1868"}}},"pull_request":{"url":"https://api.github.com/repos/rust-lang/rfcs/pulls/1868","id":102778308,"html_url":"https://github.com/rust-lang/rfcs/pull/1868","diff_url":"https://github.com/rust-lang/rfcs/pull/1868.diff","patch_url":"https://github.com/rust-lang/rfcs/pull/1868.patch","issue_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1868","number":1868,"state":"open","locked":false,"title":"RFC: A portability lint","user":{"login":"aturon","id":709807,"avatar_url":"https://avatars.githubusercontent.com/u/709807?v=3","gravatar_id":"","url":"https://api.github.com/users/aturon","html_url":"https://github.com/aturon","followers_url":"https://api.github.com/users/aturon/followers","following_url":"https://api.github.com/users/aturon/following{/other_user}","gists_url":"https://api.github.com/users/aturon/gists{/gist_id}","starred_url":"https://api.github.com/users/aturon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aturon/subscriptions","organizations_url":"https://api.github.com/users/aturon/orgs","repos_url":"https://api.github.com/users/aturon/repos","events_url":"https://api.github.com/users/aturon/events{/privacy}","received_events_url":"https://api.github.com/users/aturon/received_events","type":"User","site_admin":false},"body":"There has long been a desire to expand the number of platform- and architecture-specific APIs in the standard library, and to offer subsets of the standard library for working in constrained environments. At the same time, we want to retain the property that Rust code is portable by default.\r\n\r\nThis RFC proposes a new *portability lint*, which threads the needle between these two desires. The lint piggybacks on the existing `cfg` system, so that using APIs involving `cfg` will generate a warning unless there is explicit acknowledgment of the portability implications.\r\n\r\nThe lint is intended to make the existing `std::os` module obsolete, to allow expansion (and subsetting) of the standard library, and to provide deeper checking for portability across the ecosystem.\r\n\r\n[Rendered](https://github.com/aturon/rfcs/blob/scenarios/text/0000-portability-lint.md)","created_at":"2017-01-23T18:56:08Z","updated_at":"2017-01-24T01:30:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"04215754076bba9cdb3df60116491a665588d1e8","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/rust-lang/rfcs/pulls/1868/commits","review_comments_url":"https://api.github.com/repos/rust-lang/rfcs/pulls/1868/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/1868/comments","statuses_url":"https://api.github.com/repos/rust-lang/rfcs/statuses/5fa743f4c710cebf4852b12f620a694cd63ab0d8","head":{"label":"aturon:scenarios","ref":"scenarios","sha":"5fa743f4c710cebf4852b12f620a694cd63ab0d8","user":{"login":"aturon","id":709807,"avatar_url":"https://avatars.githubusercontent.com/u/709807?v=3","gravatar_id":"","url":"https://api.github.com/users/aturon","html_url":"https://github.com/aturon","followers_url":"https://api.github.com/users/aturon/followers","following_url":"https://api.github.com/users/aturon/following{/other_user}","gists_url":"https://api.github.com/users/aturon/gists{/gist_id}","starred_url":"https://api.github.com/users/aturon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aturon/subscriptions","organizations_url":"https://api.github.com/users/aturon/orgs","repos_url":"https://api.github.com/users/aturon/repos","events_url":"https://api.github.com/users/aturon/events{/privacy}","received_events_url":"https://api.github.com/users/aturon/received_events","type":"User","site_admin":false},"repo":{"id":20423396,"name":"rfcs","full_name":"aturon/rfcs","owner":{"login":"aturon","id":709807,"avatar_url":"https://avatars.githubusercontent.com/u/709807?v=3","gravatar_id":"","url":"https://api.github.com/users/aturon","html_url":"https://github.com/aturon","followers_url":"https://api.github.com/users/aturon/followers","following_url":"https://api.github.com/users/aturon/following{/other_user}","gists_url":"https://api.github.com/users/aturon/gists{/gist_id}","starred_url":"https://api.github.com/users/aturon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aturon/subscriptions","organizations_url":"https://api.github.com/users/aturon/orgs","repos_url":"https://api.github.com/users/aturon/repos","events_url":"https://api.github.com/users/aturon/events{/privacy}","received_events_url":"https://api.github.com/users/aturon/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aturon/rfcs","description":"RFCs for changes to Rust","fork":true,"url":"https://api.github.com/repos/aturon/rfcs","forks_url":"https://api.github.com/repos/aturon/rfcs/forks","keys_url":"https://api.github.com/repos/aturon/rfcs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aturon/rfcs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aturon/rfcs/teams","hooks_url":"https://api.github.com/repos/aturon/rfcs/hooks","issue_events_url":"https://api.github.com/repos/aturon/rfcs/issues/events{/number}","events_url":"https://api.github.com/repos/aturon/rfcs/events","assignees_url":"https://api.github.com/repos/aturon/rfcs/assignees{/user}","branches_url":"https://api.github.com/repos/aturon/rfcs/branches{/branch}","tags_url":"https://api.github.com/repos/aturon/rfcs/tags","blobs_url":"https://api.github.com/repos/aturon/rfcs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aturon/rfcs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aturon/rfcs/git/refs{/sha}","trees_url":"https://api.github.com/repos/aturon/rfcs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aturon/rfcs/statuses/{sha}","languages_url":"https://api.github.com/repos/aturon/rfcs/languages","stargazers_url":"https://api.github.com/repos/aturon/rfcs/stargazers","contributors_url":"https://api.github.com/repos/aturon/rfcs/contributors","subscribers_url":"https://api.github.com/repos/aturon/rfcs/subscribers","subscription_url":"https://api.github.com/repos/aturon/rfcs/subscription","commits_url":"https://api.github.com/repos/aturon/rfcs/commits{/sha}","git_commits_url":"https://api.github.com/repos/aturon/rfcs/git/commits{/sha}","comments_url":"https://api.github.com/repos/aturon/rfcs/comments{/number}","issue_comment_url":"https://api.github.com/repos/aturon/rfcs/issues/comments{/number}","contents_url":"https://api.github.com/repos/aturon/rfcs/contents/{+path}","compare_url":"https://api.github.com/repos/aturon/rfcs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aturon/rfcs/merges","archive_url":"https://api.github.com/repos/aturon/rfcs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aturon/rfcs/downloads","issues_url":"https://api.github.com/repos/aturon/rfcs/issues{/number}","pulls_url":"https://api.github.com/repos/aturon/rfcs/pulls{/number}","milestones_url":"https://api.github.com/repos/aturon/rfcs/milestones{/number}","notifications_url":"https://api.github.com/repos/aturon/rfcs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aturon/rfcs/labels{/name}","releases_url":"https://api.github.com/repos/aturon/rfcs/releases{/id}","deployments_url":"https://api.github.com/repos/aturon/rfcs/deployments","created_at":"2014-06-02T23:35:56Z","updated_at":"2017-01-14T22:13:33Z","pushed_at":"2017-01-23T18:55:32Z","git_url":"git://github.com/aturon/rfcs.git","ssh_url":"git@github.com:aturon/rfcs.git","clone_url":"https://github.com/aturon/rfcs.git","svn_url":"https://github.com/aturon/rfcs","homepage":"","size":3574,"stargazers_count":36,"watchers_count":36,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":0,"forks":11,"open_issues":0,"watchers":36,"default_branch":"master"}},"base":{"label":"rust-lang:master","ref":"master","sha":"a6db7a2e442272501accc86cfd39a58a68a423ab","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}","deployments_url":"https://api.github.com/repos/rust-lang/rfcs/deployments","created_at":"2014-03-07T21:29:00Z","updated_at":"2017-01-22T13:54:33Z","pushed_at":"2017-01-23T23:22:31Z","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":3525,"stargazers_count":867,"watchers_count":867,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":382,"mirror_url":null,"open_issues_count":683,"forks":382,"open_issues":683,"watchers":867,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/1868"},"html":{"href":"https://github.com/rust-lang/rfcs/pull/1868"},"issue":{"href":"https://api.github.com/repos/rust-lang/rfcs/issues/1868"},"comments":{"href":"https://api.github.com/repos/rust-lang/rfcs/issues/1868/comments"},"review_comments":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/1868/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/1868/commits"},"statuses":{"href":"https://api.github.com/repos/rust-lang/rfcs/statuses/5fa743f4c710cebf4852b12f620a694cd63ab0d8"}}}}
{"actor":{"display_login":"japaric"}}