{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/53166","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/53166/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/53166/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/53166/events","html_url":"https://github.com/rust-lang/rust/issues/53166","id":348421778,"node_id":"MDU6SXNzdWUzNDg0MjE3Nzg=","number":53166,"title":"std-using paths work just fine in 2018 edition #![no_std]","user":{"login":"cramertj","id":5963049,"node_id":"MDQ6VXNlcjU5NjMwNDk=","avatar_url":"https://avatars1.githubusercontent.com/u/5963049?v=4","gravatar_id":"","url":"https://api.github.com/users/cramertj","html_url":"https://github.com/cramertj","followers_url":"https://api.github.com/users/cramertj/followers","following_url":"https://api.github.com/users/cramertj/following{/other_user}","gists_url":"https://api.github.com/users/cramertj/gists{/gist_id}","starred_url":"https://api.github.com/users/cramertj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cramertj/subscriptions","organizations_url":"https://api.github.com/users/cramertj/orgs","repos_url":"https://api.github.com/users/cramertj/repos","events_url":"https://api.github.com/users/cramertj/events{/privacy}","received_events_url":"https://api.github.com/users/cramertj/received_events","type":"User","site_admin":false},"labels":[{"id":203429200,"node_id":"MDU6TGFiZWwyMDM0MjkyMDA=","url":"https://api.github.com/repos/rust-lang/rust/labels/P-high","name":"P-high","color":"eb6420","default":false},{"id":211668100,"node_id":"MDU6TGFiZWwyMTE2NjgxMDA=","url":"https://api.github.com/repos/rust-lang/rust/labels/T-compiler","name":"T-compiler","color":"bfd4f2","default":false},{"id":211668019,"node_id":"MDU6TGFiZWwyMTE2NjgwMTk=","url":"https://api.github.com/repos/rust-lang/rust/labels/T-lang","name":"T-lang","color":"bfd4f2","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":25,"created_at":"2018-08-07T17:44:34Z","updated_at":"2018-09-27T14:12:13Z","closed_at":null,"author_association":"MEMBER","body":"Example:\r\n```rust\r\n#![no_std]\r\n\r\nuse std::io::{Write, stdout};\r\n\r\nfn main() {\r\n    stdout().write(b\"oh dear...\\n\").unwrap();\r\n}\r\n```\r\n\r\nrustc happily accepts this when passed `--edition 2018`. This makes sense-- it was always possible to reach `std` in `#![no_std]` crates if you wrote `extern crate std;`, but now that `extern crate` is redundant, that is no longer necessary. Unfortunately, that also means that projects attempting to test for `#![no_std]` compatibility no longer have an easy way to check that they've correctly cut out all `std`-based dependencies.\r\n\r\nWe could special case `std` paths to not work via the \"extern prelude\". This would work, but would require projects that want to optionally use `std` (who currently use `#[cfg(feature = \"std\")] extern crate std;`) to continue using `extern crate std;`, which is awkward both because (1) it'd be the only place where `extern crate` ever gets used in the `Rust` of the future and (2) you'd have to write paths like `crate::std::...` in order to refer to your locally-mounted `extern crate std`, which is all sorts of strange.\r\n\r\nAnother option could be to make cargo and rustc aware of \"no-std-ness\" and allow some sort of flag or option which could make `std` un-linkable, perhaps usable by something like this Cargo.toml:\r\n```toml\r\n[dependencies]\r\nstd = { optional = true }\r\n\r\n[features]\r\ndefault = [\"std\"]\r\n```\r\n\r\nHowever, this seems like a fairly complex addition and begins to interact with the various std-aware-cargo proposals.\r\n\r\nAnother option: do nothing. This isn't a huge deal, and as @MajorBreakfast [pointed out](https://github.com/rust-lang-nursery/futures-rs/pull/1185#discussion_r208318846), the issue will often be caught in CI by testing against targets that don't have `std` support. There are also various proposals like [the portability lint](https://github.com/rust-lang/rust/issues/41619) that could obsolete whatever change we come up with here."},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/425107948","html_url":"https://github.com/rust-lang/rust/issues/53166#issuecomment-425107948","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/53166","id":425107948,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNTEwNzk0OA==","user":{"login":"pnkfelix","id":173127,"node_id":"MDQ6VXNlcjE3MzEyNw==","avatar_url":"https://avatars0.githubusercontent.com/u/173127?v=4","gravatar_id":"","url":"https://api.github.com/users/pnkfelix","html_url":"https://github.com/pnkfelix","followers_url":"https://api.github.com/users/pnkfelix/followers","following_url":"https://api.github.com/users/pnkfelix/following{/other_user}","gists_url":"https://api.github.com/users/pnkfelix/gists{/gist_id}","starred_url":"https://api.github.com/users/pnkfelix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pnkfelix/subscriptions","organizations_url":"https://api.github.com/users/pnkfelix/orgs","repos_url":"https://api.github.com/users/pnkfelix/repos","events_url":"https://api.github.com/users/pnkfelix/events{/privacy}","received_events_url":"https://api.github.com/users/pnkfelix/received_events","type":"User","site_admin":false},"created_at":"2018-09-27T14:12:13Z","updated_at":"2018-09-27T14:12:13Z","author_association":"MEMBER","body":"assigning to self to see about this lint."}}
{"actor":{"display_login":"pnkfelix"}}