Skip to content

pretty printer is injecting extra newlines/spaces in funky ways in some run-fail tests #23623

Closed
@pnkfelix

Description

@pnkfelix

From end of the following build log:

http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/4172/steps/test/logs/stdio

From narrowing the test down a little, it seems to be due to those tests mixing comments at the end of a statement with further multi-line comments further down.

In particular, here is my attempt to produce a more minimal test case:

Input:

// bogus.rs
fn main() {
    let x = 1; // hi

    // first
    // second
    assert_eq!(x, 2_i8);
}

Transcript of a run:

% DYLD_LIBRARY_PATH=$(pwd)/x86_64-apple-darwin/stage2/lib:$DYLD_LIBRARY_PATH x86_64-apple-darwin/stage2/bin/compiletest --compile-lib-path x86_64-apple-darwin/stage2/lib --run-lib-path x86_64-apple-darwin/stage2/lib/rustlib/x86_64-apple-darwin/lib --rustc-path x86_64-apple-darwin/stage2/bin/rustc --clang-path "/Users/fklock/bin/clang++" --llvm-bin-path $(pwd)/x86_64-apple-darwin/llvm/Release+Asserts/bin --aux-base $(pwd)/../src/test/auxiliary/ --stage-id stage2-x86_64-apple-darwin --target x86_64-apple-darwin --host x86_64-apple-darwin --gdb-version="Not there; switching to /usr/bin/gdb" --lldb-version="lldb-320.4.160" --android-cross-path="" --adb-path="/Users/fklock/bin/adb" --adb-test-dir= --host-rustcflags "   --cfg rtopt --cfg debug  -O -L x86_64-apple-darwin/rt" --lldb-python-dir="" --target-rustcflags "   --cfg rtopt --cfg debug  -O -L x86_64-apple-darwin/rt" bogus --src-base $(pwd)/../src/test/run-fail/ --build-base x86_64-apple-darwin/test/run-fail/ --mode pretty
Could not extract GDB version from line 'Not there; switching to /usr/bin/gdb'

running 1 test
test [pretty] run-fail/bogus.rs ... FAILED

failures:

---- [pretty] run-fail/bogus.rs stdout ----

error: pretty-printed source does not match expected source

expected:
------------------------------------------
// bogus.rs
fn main() {
    let x = 1; // hi

     // first
     // second

    assert_eq!(x , 2_i8);
}

------------------------------------------
actual:
------------------------------------------
// bogus.rs
fn main() {
    let x = 1; // hi

     // first
     // second


    assert_eq!(x , 2_i8);
}

------------------------------------------


thread '[pretty] run-fail/bogus.rs' panicked at 'explicit panic', /Users/fklock/Dev/Mozilla/rust-oflo/src/compiletest/runtest.rs:318



failures:
    [pretty] run-fail/bogus.rs

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured

thread '<main>' panicked at 'Some tests failed', /Users/fklock/Dev/Mozilla/rust-oflo/src/compiletest/compiletest.rs:256

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-prettyArea: Pretty printing (including `-Z unpretty`)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions