Skip to content

Commit 3f97b2a

Browse files
Add ui tests
1 parent b10c044 commit 3f97b2a

File tree

5 files changed

+18
-7
lines changed

5 files changed

+18
-7
lines changed

src/libsyntax/parse/parser.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ use tokenstream::{self, Delimited, ThinTokenStream, TokenTree, TokenStream};
5757
use symbol::{Symbol, keywords};
5858
use util::ThinVec;
5959

60+
use std::cmp;
6061
use std::collections::HashSet;
6162
use std::mem;
62-
use std::path::{Path, PathBuf};
63-
use std::rc::Rc;
63+
use std::path::{self, Path, PathBuf};
6464
use std::slice;
6565

6666
bitflags! {
@@ -5367,7 +5367,7 @@ impl<'a> Parser<'a> {
53675367
"cannot declare a new module at this location");
53685368
if id_sp != syntax_pos::DUMMY_SP {
53695369
let src_path = PathBuf::from(self.sess.codemap().span_to_filename(id_sp));
5370-
if let Some(stem) = src_path.clone().file_stem() {
5370+
if let Some(stem) = src_path.file_stem() {
53715371
let mut dest_path = src_path.clone();
53725372
dest_path.set_file_name(stem);
53735373
dest_path.push("mod.rs");
@@ -5385,10 +5385,7 @@ impl<'a> Parser<'a> {
53855385
}
53865386
Err(err)
53875387
} else {
5388-
match paths.result {
5389-
Ok(succ) => Ok(succ),
5390-
Err(err) => Err(self.span_fatal_err(id_sp, err)),
5391-
}
5388+
paths.result.map_err(|err| self.span_fatal_err(id_sp, err))
53925389
}
53935390
}
53945391

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: cannot declare a new module at this location
2+
--> $DIR/auxiliary/foo/bar.rs:11:9
3+
|
4+
11 | pub mod baz;
5+
| ^^^
6+
|
7+
note: maybe move this module `$DIR/auxiliary/foo/bar.rs` to its own directory via `$DIR/auxiliary/foo/bar/mod.rs`
8+
--> $DIR/auxiliary/foo/bar.rs:11:9
9+
|
10+
11 | pub mod baz;
11+
| ^^^
12+
13+
error: aborting due to previous error
14+

0 commit comments

Comments
 (0)