suggest removing return type on use of void - #156381
Conversation
|
rustbot has assigned @ShoyuVanilla. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
|
just wondering how often is possible to see this? tbh i think is hard to know what user is meant by |
| && expected.starts_with("struct") | ||
| { | ||
| ("`async` blocks are only allowed in Rust 2018 or later".to_string(), suggestion) | ||
| } else if item_str.as_str() == "void" |
There was a problem hiding this comment.
Wouldn't it be nicer to add the new logic to compiler/rustc_lint/src/c_void_returns.rs that https://github.com/rust-lang/rust/pull/156379/changes added?
|
Reminder, once the PR becomes ready for a review, use |
There was a problem hiding this comment.
Can you add a test when there is a valid type called void please, so we can see how rustc behaves in that case? Probably best to have the void type privatley scoped inside a mod { } so we don't need another file for the test.
Also consider unifying this test with the existing core::ffi::c_void test somehow.
|
☔ The latest upstream changes (presumably #160112) made this pull request unmergeable. Please resolve the merge conflicts by rebasing. |
Fixes #100972 (comment).
This PR suggests removing the return type entirely if the user writes
-> void, expecting it to work like C or TypeScript.