Skip to content

Un-skipped whitespace after backslash in string literal should be warned about #87318

Closed
@scottmcm

Description

@scottmcm
let b = "foo\
         bar";
let c = "foo\
         bar";
dbg!((b,c));

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=a8ab2d71eb82732581a9b6aedde68aed

[src/main.rs:6] (b, c) = (
    "foobar",
    "foo\u{a0}      bar",
)

Like we have confusables lints, I think this should have a warning noting that the particular kind of whitespace is not actually being skipped here, since that's completely invisible when looking at the code.

(Based on rust-lang/reference#1042 I think this would warn for things where char::is_whitespace is true but that isn't ' ', '\t', '\r', or '\n' -- with #87319 being a related lint that would warn on '\r' and '\n' after the first one.)

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions