Skip to content

line num capped to 2 digits in errors #65059

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
bjorn3 opened this issue Oct 3, 2019 · 2 comments
Closed

line num capped to 2 digits in errors #65059

bjorn3 opened this issue Oct 3, 2019 · 2 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-frontend Area: Compiler frontend (errors, parsing and HIR) C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@bjorn3
Copy link
Member

bjorn3 commented Oct 3, 2019

error[E0282]: type annotations needed for `std::result::Result<(), E>`
 --> sysroot_src/src/libtest/lib.rs:1627:42
  |
16|     let result = Ok(testfn());
  |         ------ consider giving `result` the explicit type `std::result::Result<(), E>`, with the type parameters specified
...
16|         Err(e) => calc_result(&desc, Err(e.as_ref())),
  |                                          ^ cannot infer type
  |
  = note: type must be known at this point

Compare sysroot_src/src/libtest/lib.rs:1627:42 with 16| let result = Ok(testfn());.

$ rustc -V
rustc 1.40.0-nightly (2daa404e9 2019-10-02)
$ git diff
diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs
index 8b76080..7d57460 100644
--- a/src/libtest/lib.rs
+++ b/src/libtest/lib.rs
@@ -1493,7 +1493,7 @@ pub fn run_test(
         report_time: bool,
         strategy: RunStrategy,
         monitor_ch: Sender<MonitorMsg>,
-        testfn: Box<dyn FnOnce() + Send>,
+        testfn: Box<impl FnOnce() + Send + 'static>,
         concurrency: Concurrent,
     ) {
         let name = desc.name.clone();
@@ -1509,7 +1509,7 @@ pub fn run_test(
         // If the platform is single-threaded we're just going to run
         // the test synchronously, regardless of the concurrency
         // level.
-        let supports_threads = !cfg!(target_os = "emscripten") && !cfg!(target_arch = "wasm32");
+        let supports_threads = false;
         if concurrency == Concurrent::Yes && supports_threads {
             let cfg = thread::Builder::new().name(name.as_slice().to_owned());
             cfg.spawn(runtest).unwrap();
@@ -1531,20 +1531,8 @@ pub fn run_test(
                 (benchfn.clone())(harness)
             });
         }
-        DynTestFn(f) => {
-            match strategy {
-                RunStrategy::InProcess => (),
-                _ => panic!("Cannot run dynamic test fn out-of-process"),
-            };
-            run_test_inner(
-                desc,
-                opts.nocapture,
-                opts.report_time,
-                strategy,
-                monitor_ch,
-                Box::new(move || __rust_begin_short_backtrace(f)),
-                concurrency
-            );
+        DynTestFn(_f) => {
+            unimplemented!();
         }
         StaticTestFn(f) => run_test_inner(
             desc,
@@ -1623,7 +1611,7 @@ fn run_test_in_process(desc: TestDesc,
     } else {
         None
     };
-    let result = catch_unwind(AssertUnwindSafe(testfn));
+    let result = Ok(testfn());
     let exec_time = start.map(|start| {
         let duration = start.elapsed();
         TestExecTime(duration)
@jonas-schievink jonas-schievink added A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-frontend Area: Compiler frontend (errors, parsing and HIR) I-nominated labels Oct 3, 2019
@Mark-Simulacrum
Copy link
Member

There is already a fix in-queue for this I believe (possibly even landed) and this is a duplicate of another issue.

@AnthonyMikh
Copy link
Contributor

AnthonyMikh commented Oct 3, 2019

There is already a fix in-queue for this I believe (possibly even landed) and this is a duplicate of another issue.

Indeed: this issue is duplicate of #65001 and was fixed in #65010 that was included in rollup #65038 (already merged).

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-frontend Area: Compiler frontend (errors, parsing and HIR) C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants