Skip to content

Commit

Permalink
Fix a few tests with target-specific output
Browse files Browse the repository at this point in the history
Enable one fully ignored test
  • Loading branch information
petrochenkov committed Oct 21, 2018
1 parent 7977250 commit 21d67c4
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/libsyntax/parse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ fn file_to_source_file(sess: &ParseSess, path: &Path, spanopt: Option<Span>)
match sess.source_map().load_file(path) {
Ok(source_file) => source_file,
Err(e) => {
let msg = format!("couldn't read {:?}: {}", path.display(), e);
let msg = format!("couldn't read {}: {}", path.display(), e);
match spanopt {
Some(sp) => sess.span_diagnostic.span_fatal(sp, &msg).raise(),
None => sess.span_diagnostic.fatal(&msg).raise()
Expand Down
12 changes: 4 additions & 8 deletions src/test/ui/parser/issue-5806.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// ignore-windows
// ignore-freebsd
// ignore-openbsd
// ignore-netbsd
// ignore-bitrig

// compile-flags: -Z parse-only
// normalize-stderr-test: "parser:.*\(" -> "parser: $$ACCESS_DENIED_MSG ("
// normalize-stderr-test: "os error \d+" -> "os error $$ACCESS_DENIED_CODE"

#[path = "../compile-fail"]
mod foo; //~ ERROR: a directory
#[path = "../parser"]
mod foo; //~ ERROR couldn't read

fn main() {}
8 changes: 8 additions & 0 deletions src/test/ui/parser/issue-5806.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: couldn't read $DIR/../parser: $ACCESS_DENIED_MSG (os error $ACCESS_DENIED_CODE)
--> $DIR/issue-5806.rs:16:5
|
LL | mod foo; //~ ERROR couldn't read
| ^^^

error: aborting due to previous error

1 change: 0 additions & 1 deletion src/test/ui/parser/mod_file_not_exist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
// except according to those terms.

// ignore-windows

// compile-flags: -Z parse-only

mod not_a_real_file; //~ ERROR file not found for module `not_a_real_file`
Expand Down
11 changes: 11 additions & 0 deletions src/test/ui/parser/mod_file_not_exist.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error[E0583]: file not found for module `not_a_real_file`
--> $DIR/mod_file_not_exist.rs:14:5
|
LL | mod not_a_real_file; //~ ERROR file not found for module `not_a_real_file`
| ^^^^^^^^^^^^^^^
|
= help: name the file either not_a_real_file.rs or not_a_real_file/mod.rs inside the directory "$DIR"

error: aborting due to previous error

For more information about this error, try `rustc --explain E0583`.
16 changes: 1 addition & 15 deletions src/test/ui/parser/mod_file_not_exist_windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// ignore-android
// ignore-bitrig
// ignore-cloudabi
// ignore-dragonfly
// ignore-emscripten
// ignore-freebsd
// ignore-gnu
// ignore-haiku
// ignore-ios
// ignore-linux
// ignore-macos
// ignore-netbsd
// ignore-openbsd
// ignore-solaris

// only-windows
// compile-flags: -Z parse-only

mod not_a_real_file; //~ ERROR file not found for module `not_a_real_file`
Expand Down
11 changes: 11 additions & 0 deletions src/test/ui/parser/mod_file_not_exist_windows.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error[E0583]: file not found for module `not_a_real_file`
--> $DIR/mod_file_not_exist_windows.rs:14:5
|
LL | mod not_a_real_file; //~ ERROR file not found for module `not_a_real_file`
| ^^^^^^^^^^^^^^^
|
= help: name the file either not_a_real_file.rs or not_a_real_file/mod.rs inside the directory "$DIR"

error: aborting due to previous error

For more information about this error, try `rustc --explain E0583`.
1 change: 1 addition & 0 deletions src/test/ui/parser/mod_file_with_path_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// except according to those terms.

// compile-flags: -Z parse-only
// normalize-stderr-test: "not_a_real_file.rs:.*\(" -> "not_a_real_file.rs: $$FILE_NOT_FOUND_MSG ("

#[path = "not_a_real_file.rs"]
mod m; //~ ERROR not_a_real_file.rs
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/parser/mod_file_with_path_attr.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: couldn't read "C:/msys64/home/we/rust/src/test/ui/parser/not_a_real_file.rs": The system cannot find the file specified. (os error 2)
--> $DIR/mod_file_with_path_attr.rs:14:5
error: couldn't read $DIR/not_a_real_file.rs: $FILE_NOT_FOUND_MSG (os error 2)
--> $DIR/mod_file_with_path_attr.rs:15:5
|
LL | mod m; //~ ERROR not_a_real_file.rs
| ^
Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/parser/regions-out-of-scope-slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only
// blk region isn't supported in the front-end

// ignore-test blk region isn't supported in the front-end
// compile-flags: -Z parse-only

fn foo(cond: bool) {
// Here we will infer a type that uses the
// region of the if stmt then block, but in the scope:
let mut x; //~ ERROR foo
let mut x;

if cond {
x = &'blk [1,2,3];
x = &'blk [1,2,3]; //~ ERROR expected `:`, found `[`
}
}

Expand Down
8 changes: 8 additions & 0 deletions src/test/ui/parser/regions-out-of-scope-slice.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: expected `:`, found `[`
--> $DIR/regions-out-of-scope-slice.rs:21:19
|
LL | x = &'blk [1,2,3]; //~ ERROR expected `:`, found `[`
| ^ expected `:`

error: aborting due to previous error

0 comments on commit 21d67c4

Please sign in to comment.