Skip to content

Commit

Permalink
Tidy no longer fails when there are no files or subdirectories in a t…
Browse files Browse the repository at this point in the history
…est directory.
  • Loading branch information
davidtwco committed Aug 14, 2018
1 parent 3fc7ab2 commit ed79c31
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0507]: cannot move out of borrowed content
--> $DIR/borrowck-feature-nll-overrides-migrate.rs:32:17
|
LL | (|| { let bar = foo; bar.take() })();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content

error: aborting due to previous error

For more information about this error, try `rustc --explain E0507`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0507]: cannot move out of borrowed content
--> $DIR/borrowck-feature-nll-overrides-migrate.rs:32:17
|
LL | (|| { let bar = foo; bar.take() })();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content

error: aborting due to previous error

For more information about this error, try `rustc --explain E0507`.
24 changes: 24 additions & 0 deletions src/test/ui/borrowck/borrowck-migrate-to-nll.edition.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
warning[E0507]: cannot move out of borrowed content
--> $DIR/borrowck-migrate-to-nll.rs:35:17
|
LL | (|| { let bar = foo; bar.take() })();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
|
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
It represents potential unsoundness in your code.
This warning will become a hard error in the future.

warning[E0507]: cannot move out of `foo`, as it is immutable for the pattern guard
--> $DIR/borrowck-migrate-to-nll.rs:35:17
|
LL | (|| { let bar = foo; bar.take() })();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| cannot move out of `foo`, as it is immutable for the pattern guard
| cannot move
|
= note: variables bound in patterns are immutable until the end of the pattern guard
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
It represents potential unsoundness in your code.
This warning will become a hard error in the future.

24 changes: 24 additions & 0 deletions src/test/ui/borrowck/borrowck-migrate-to-nll.zflag.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
warning[E0507]: cannot move out of borrowed content
--> $DIR/borrowck-migrate-to-nll.rs:35:17
|
LL | (|| { let bar = foo; bar.take() })();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
|
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
It represents potential unsoundness in your code.
This warning will become a hard error in the future.

warning[E0507]: cannot move out of `foo`, as it is immutable for the pattern guard
--> $DIR/borrowck-migrate-to-nll.rs:35:17
|
LL | (|| { let bar = foo; bar.take() })();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| cannot move out of `foo`, as it is immutable for the pattern guard
| cannot move
|
= note: variables bound in patterns are immutable until the end of the pattern guard
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
It represents potential unsoundness in your code.
This warning will become a hard error in the future.

12 changes: 12 additions & 0 deletions src/test/ui/borrowck/issue-45983.migrate.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
error: borrowed data cannot be stored outside of its closure
--> $DIR/issue-45983.rs:36:27
|
LL | let x = None;
| - borrowed data cannot be stored into here...
LL | give_any(|y| x = Some(y));
| --- ^ cannot be stored outside of its closure
| |
| ...because it cannot outlive this closure

error: aborting due to previous error

18 changes: 18 additions & 0 deletions src/test/ui/obsolete-in-place/bad.bad.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
error: emplacement syntax is obsolete (for now, anyway)
--> $DIR/bad.rs:19:5
|
LL | x <- y; //[bad]~ ERROR emplacement syntax is obsolete
| ^^^^^^
|
= note: for more information, see <https://github.com/rust-lang/rust/issues/27779#issuecomment-378416911>

error: emplacement syntax is obsolete (for now, anyway)
--> $DIR/bad.rs:20:5
|
LL | in(foo) { bar }; //[bad]~ ERROR emplacement syntax is obsolete
| ^^^^^^^^^^^^^^^
|
= note: for more information, see <https://github.com/rust-lang/rust/issues/27779#issuecomment-378416911>

error: aborting due to 2 previous errors

20 changes: 11 additions & 9 deletions src/tools/tidy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,18 @@ fn walk_many(paths: &[&Path], skip: &mut dyn FnMut(&Path) -> bool, f: &mut dyn F
}

fn walk(path: &Path, skip: &mut dyn FnMut(&Path) -> bool, f: &mut dyn FnMut(&Path)) {
for entry in t!(fs::read_dir(path), path) {
let entry = t!(entry);
let kind = t!(entry.file_type());
let path = entry.path();
if kind.is_dir() {
if !skip(&path) {
walk(&path, skip, f);
if let Ok(dir) = fs::read_dir(path) {
for entry in dir {
let entry = t!(entry);
let kind = t!(entry.file_type());
let path = entry.path();
if kind.is_dir() {
if !skip(&path) {
walk(&path, skip, f);
}
} else {
f(&path);
}
} else {
f(&path);
}
}
}

0 comments on commit ed79c31

Please sign in to comment.