Skip to content

Unused invalid code is accepted #368

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
XAMPPRocky opened this issue Jan 8, 2021 · 1 comment
Closed

Unused invalid code is accepted #368

XAMPPRocky opened this issue Jan 8, 2021 · 1 comment
Labels
a: error messages Issues specific to error messages c: rustc_codegen_spirv Issues specific to the rustc_codegen_spirv crate. t: enhancement A new feature or improvement to an existing one.

Comments

@XAMPPRocky
Copy link
Member

Currently unused code that is invalid on spirv-unknown-unknown will be accepted if it isn't being used in the code. This is pretty surprising behaviour as it can give you the false impression that we have features and support for features in the language. that we currently don't. For example we currently don't support options (see #234) but as shown below depending on whether the function is pub or not, you'll see an error. Is there a way to elevate some of the validation so that is checked against unused code?

// Compiles
fn foo () -> Option<u8> { Some(5u8) }
// Errors
pub fn foo () -> Option<u8> { Some(5u8) }
@XAMPPRocky XAMPPRocky added t: enhancement A new feature or improvement to an existing one. c: rustc_codegen_spirv Issues specific to the rustc_codegen_spirv crate. a: error messages Issues specific to error messages labels Jan 8, 2021
@khyperia
Copy link
Contributor

khyperia commented Apr 1, 2021

I don't think there's an easy way to fix this, and I don't think we're going to ever get around to doing it.

@khyperia khyperia closed this as completed Apr 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: error messages Issues specific to error messages c: rustc_codegen_spirv Issues specific to the rustc_codegen_spirv crate. t: enhancement A new feature or improvement to an existing one.
Projects
None yet
Development

No branches or pull requests

2 participants