Skip to content

Trailing whitespaces are stripped in raw string literals in doc tests #5978

Open
@Pistonight

Description

@Pistonight

Example:

/// Doc Test
/// ```rust
/// let expected = "\nfoo \n";
/// assert_eq!(expected, r#"
/// foo 
/// "#);
/// ```
pub fn main() {}

Note that the expected string has a space before the last newline.
cargo fmt strips the space in the raw string literal, causing passing doc tests to fail afterwards

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions