Repository navigation
Compiler suggests using the removed placement syntax #51602
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTC-bugCategory: This is a bug.Category: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Description
Activity
- addedA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTC-bugCategory: This is a bug.Category: This is a bug.
on Jun 16, 2018 Could we just stop parsing
in «expr» «block»as anObsoleteInPlaceexpression? Will it break any macros or code behind#[cfg]?Yeah #50832.
#50832 was about
x <- ythoughI think the same issue applies though - the parser still needs to be able to recognise the code as something. So if there are crates using that syntax, they'll break in the same way.
Current output:
error: expected `{`, found `in` --> src/main.rs:2:10 | 2 | if i in 0..10 { | -- -^ | _____|____| | | | | | this `if` statement has a condition, but no block 3 | | break; 4 | | } | |_____- help: try placing this code inside a block: `{ (0..10) <- { break ; }; }`Still need to remove the suggestion, but otherwise the error would seem reasonable:
error: expected `{`, found `in` --> src/main.rs:2:10 | 2 | if i in 0..10 { | -- ^^ expected `{` | | | this `if` statement has a condition, but no block- addedE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
on Aug 8, 2018 @estebank should this be done only for
inkeyword or you also have other statements in mind.@PramodBisht I believe that
inand type ascription (:) are the only two that regularly cause problems with this kind of errors.- added a commit that references this issue
on Aug 16, 2018
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTC-bugCategory: This is a bug.Category: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
So I'm writing a hangman app in Rust and I get this weird error message. It doesn't make sense since
<-isn't even in Rust anymore.