jethrogb / rust-core_io

Rust std::io with all the parts that don't work in core removed.
Apache License 2.0
36 stars 23 forks source link

cargo test fails to build #11

Open glandium opened 6 years ago

glandium commented 6 years ago

While src/lib.rs has a few definitions claiming they are there to make tests build, they fail to build. I guess they used to build a long time ago.

error[E0432]: unresolved import `error`
   --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/error.rs:505:9
    |
505 |     use error;
    |         ^^^^^ no `error` in the root. Did you mean to use `Error`?

error[E0432]: unresolved import `fmt`
   --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/error.rs:506:9
    |
506 |     use fmt;
    |         ^^^ no `fmt` in the root

error[E0433]: failed to resolve. Maybe a missing `extern crate sys;`?
   --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/error.rs:507:9
    |
507 |     use sys::os::error_string;
    |         ^^^ Maybe a missing `extern crate sys;`?

error[E0432]: unresolved import `sys`
   --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/error.rs:508:9
    |
508 |     use sys::decode_error_kind;
    |         ^^^ Maybe a missing `extern crate sys;`?

error[E0432]: unresolved import `test`
   --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/impls.rs:284:9
    |
284 |     use test;
    |         ^^^^ no `test` in the root

error[E0432]: unresolved import `test`
    --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/mod.rs:2074:9
     |
2074 |     use test;
     |         ^^^^ no `test` in the root

error[E0433]: failed to resolve. Use of undeclared type or module `Vec`
   --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/cursor.rs:327:26
    |
327 |         let mut writer = Vec::new();
    |                          ^^^ Use of undeclared type or module `Vec`

error[E0433]: failed to resolve. Use of undeclared type or module `Vec`
   --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/cursor.rs:337:38
    |
337 |         let mut writer = Cursor::new(Vec::new());
    |                                      ^^^ Use of undeclared type or module `Vec`

error[E0433]: failed to resolve. Use of undeclared type or module `Vec`
   --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/cursor.rs:347:23
    |
347 |         let mut vec = Vec::new();
    |                       ^^^ Use of undeclared type or module `Vec`

error[E0433]: failed to resolve. Use of undeclared type or module `Vec`
   --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/cursor.rs:480:21
    |
480 |         let mut v = Vec::new();
    |                     ^^^ Use of undeclared type or module `Vec`

error[E0433]: failed to resolve. Use of undeclared type or module `Vec`
   --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/cursor.rs:643:38
    |
643 |         let mut writer = Cursor::new(Vec::<u8>::new());
    |                                      ^^^ Use of undeclared type or module `Vec`

error[E0433]: failed to resolve. Use of undeclared type or module `Vec`
   --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/cursor.rs:677:33
    |
677 |         let mut r = Cursor::new(Vec::new());
    |                                 ^^^ Use of undeclared type or module `Vec`

error[E0433]: failed to resolve. Use of undeclared type or module `Vec`
   --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/cursor.rs:684:33
    |
684 |         let mut r = Cursor::new(Vec::new());
    |                                 ^^^ Use of undeclared type or module `Vec`

error[E0433]: failed to resolve. Use of undeclared type or module `Vec`
   --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/impls.rs:330:23
    |
330 |         let mut buf = Vec::with_capacity(1024);
    |                       ^^^ Use of undeclared type or module `Vec`

error[E0433]: failed to resolve. Use of undeclared type or module `Vec`
    --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/mod.rs:2081:21
     |
2081 |         let mut v = Vec::new();
     |                     ^^^ Use of undeclared type or module `Vec`

error[E0433]: failed to resolve. Use of undeclared type or module `Vec`
    --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/mod.rs:2086:21
     |
2086 |         let mut v = Vec::new();
     |                     ^^^ Use of undeclared type or module `Vec`

error[E0433]: failed to resolve. Use of undeclared type or module `String`
    --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/mod.rs:2114:21
     |
2114 |         let mut v = String::new();
     |                     ^^^^^^ Use of undeclared type or module `String`

error[E0433]: failed to resolve. Use of undeclared type or module `String`
    --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/mod.rs:2119:21
     |
2119 |         let mut v = String::new();
     |                     ^^^^^^ Use of undeclared type or module `String`

error[E0433]: failed to resolve. Use of undeclared type or module `Vec`
    --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/mod.rs:2147:21
     |
2147 |         let mut v = Vec::new();
     |                     ^^^ Use of undeclared type or module `Vec`

error[E0433]: failed to resolve. Use of undeclared type or module `Vec`
    --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/mod.rs:2152:21
     |
2152 |         let mut v = Vec::new();
     |                     ^^^ Use of undeclared type or module `Vec`

error[E0433]: failed to resolve. Use of undeclared type or module `Vec`
    --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/mod.rs:2158:21
     |
2158 |         let mut v = Vec::new();
     |                     ^^^ Use of undeclared type or module `Vec`

error[E0433]: failed to resolve. Use of undeclared type or module `String`
    --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/mod.rs:2168:21
     |
2168 |         let mut v = String::new();
     |                     ^^^^^^ Use of undeclared type or module `String`

error[E0433]: failed to resolve. Use of undeclared type or module `String`
    --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/mod.rs:2173:21
     |
2173 |         let mut v = String::new();
     |                     ^^^^^^ Use of undeclared type or module `String`

error[E0433]: failed to resolve. Use of undeclared type or module `String`
    --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/mod.rs:2178:21
     |
2178 |         let mut v = String::new();
     |                     ^^^^^^ Use of undeclared type or module `String`

error[E0433]: failed to resolve. Use of undeclared type or module `Vec`
    --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/mod.rs:2245:23
     |
2245 |         let mut cat = Vec::new();
     |                       ^^^ Use of undeclared type or module `Vec`

error[E0433]: failed to resolve. Use of undeclared type or module `String`
    --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/mod.rs:2281:21
     |
2281 |         let mut s = String::new();
     |                     ^^^^^^ Use of undeclared type or module `String`

error[E0433]: failed to resolve. Use of undeclared type or module `Vec`
    --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/mod.rs:2293:27
     |
2293 |             let mut vec = Vec::with_capacity(1024);
     |                           ^^^ Use of undeclared type or module `Vec`

error[E0425]: cannot find function `error_string` in this scope
   --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/error.rs:513:19
    |
513 |         let msg = error_string(code);
    |                   ^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `Vec` in this scope
    --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/mod.rs:2157:62
     |
2157 |         let data = (0..cap).map(|i| (i / 3) as u8).collect::<Vec<_>>();
     |                                                              ^^^ not found in this scope

error[E0405]: cannot find trait `BufRead` in this scope
    --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/mod.rs:2232:14
     |
2232 |         impl BufRead for R {
     |              ^^^^^^^ not found in this scope

error[E0405]: cannot find trait `BufRead` in this scope
    --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/mod.rs:2244:25
     |
2244 |     fn cmp_bufread<Br1: BufRead, Br2: BufRead>(mut br1: Br1, mut br2: Br2, exp: &[u8]) {
     |                         ^^^^^^^ not found in this scope

error[E0405]: cannot find trait `BufRead` in this scope
    --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/mod.rs:2244:39
     |
2244 |     fn cmp_bufread<Br1: BufRead, Br2: BufRead>(mut br1: Br1, mut br2: Br2, exp: &[u8]) {
     |                                       ^^^^^^^ not found in this scope

error[E0425]: cannot find function `read_to_end` in module `super`
    --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/mod.rs:2294:20
     |
2294 |             super::read_to_end(&mut lr, &mut vec)
     |                    ^^^^^^^^^^^ not found in `super`
help: possible candidates are found in other modules, you can import them into scope
     |
2071 |     use io::cursor::tests::read_to_end;
     |
2071 |     use io::tests::read_to_end;
     |

error[E0658]: box expression syntax is experimental; you can call `Box::new` instead. (see issue #27779)
   --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/error.rs:516:32
    |
516 |               repr: Repr::Custom(box Custom {
    |  ________________________________^
517 | |                 kind: ErrorKind::InvalidInput,
518 | |                 error: box Error {
519 | |                     repr: super::Repr::Os(code)
520 | |                 },
521 | |             })
    | |_____________^
    |
    = help: add #![feature(box_syntax)] to the crate attributes to enable

error[E0658]: box expression syntax is experimental; you can call `Box::new` instead. (see issue #27779)
   --> /tmp/core-io/src/cb56b2d1522e83c5bb0613abcf78b686e994df9e/error.rs:518:24
    |
518 |                   error: box Error {
    |  ________________________^
519 | |                     repr: super::Repr::Os(code)
520 | |                 },
    | |_________________^
    |
    = help: add #![feature(box_syntax)] to the crate attributes to enable

error: aborting due to 35 previous errors
jethrogb commented 6 years ago

Tests never worked. I didn't see much value in retaining them as the source is a straight port from Rust's git master, which should have all the tests already being run.

I assume you're talking about this comment:

// Needed for older compilers, to ignore vec!/format! macros in tests

The compiler used to expand macros in conditionally-compiled items that were not enabled. Thus, non-test builds would fail to compile when encountering undefined macros in the tests. This is no longer the case.

You're welcome to make the tests work and submit a PR. See the instructions for editing patches.