From 42bcb4047d724b91b9026ac871cfe24f2e831f14 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 7 Apr 2016 16:47:12 -0700 Subject: [PATCH] rustdoc: Fix testing no_run code blocks This was a regression introduced by #31250 where the compiler deferred returning the results of compilation a little too late (after the `Stop` check was looked at). This commit alters the stop point to first try to return an erroneous `result` and only if it was successful return the sentinel `Err(0)`. Closes #31576 --- src/librustc_driver/driver.rs | 2 +- src/librustc_typeck/diagnostics.rs | 2 +- src/test/run-pass/coerce-expect-unsized.rs | 2 -- .../deriving-via-extension-hash-enum.rs | 2 -- src/test/run-pass/foreign-dupe.rs | 2 -- src/test/rustdoc/no-run-still-checks-lints.rs | 19 +++++++++++++++++++ 6 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 src/test/rustdoc/no-run-still-checks-lints.rs diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index f661b2a38b6..496cc4e8b26 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -193,7 +193,7 @@ macro_rules! controller_entry_point { (control.after_analysis.callback)(state); if control.after_analysis.stop == Compilation::Stop { - return Err(0usize); + return result.and_then(|_| Err(0usize)); } } diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index bef6c1ed43a..4a4bcd96ad0 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -632,7 +632,7 @@ fn bar(&mut self) { } For a somewhat artificial example: -```compile_fail +```compile_fail,ignore #![recursion_limit="2"] struct Foo; diff --git a/src/test/run-pass/coerce-expect-unsized.rs b/src/test/run-pass/coerce-expect-unsized.rs index f846ee8f3d0..e4792e7936b 100644 --- a/src/test/run-pass/coerce-expect-unsized.rs +++ b/src/test/run-pass/coerce-expect-unsized.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// pretty-expanded FIXME #23616 - #![allow(unknown_features)] #![feature(box_syntax)] diff --git a/src/test/run-pass/deriving-via-extension-hash-enum.rs b/src/test/run-pass/deriving-via-extension-hash-enum.rs index 249661f003f..cbe23ea0522 100644 --- a/src/test/run-pass/deriving-via-extension-hash-enum.rs +++ b/src/test/run-pass/deriving-via-extension-hash-enum.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// pretty-expanded FIXME #23616 - #[derive(Hash)] enum Foo { Bar(isize, char), diff --git a/src/test/run-pass/foreign-dupe.rs b/src/test/run-pass/foreign-dupe.rs index 6c393ce99e3..4e06c434ccc 100644 --- a/src/test/run-pass/foreign-dupe.rs +++ b/src/test/run-pass/foreign-dupe.rs @@ -10,8 +10,6 @@ // calling pin_thread and that's having weird side-effects. -// pretty-expanded FIXME #23616 - #![feature(libc)] mod rustrt1 { diff --git a/src/test/rustdoc/no-run-still-checks-lints.rs b/src/test/rustdoc/no-run-still-checks-lints.rs new file mode 100644 index 00000000000..a9df3c3c7f2 --- /dev/null +++ b/src/test/rustdoc/no-run-still-checks-lints.rs @@ -0,0 +1,19 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags:--test +// should-fail + +#![doc(test(attr(deny(warnings))))] + +/// ```no_run +/// let a = 3; +/// ``` +pub fn foo() {} -- 2.44.0