]> git.lizzy.rs Git - rust.git/commitdiff
rustdoc: Fix testing no_run code blocks
authorAlex Crichton <alex@alexcrichton.com>
Thu, 7 Apr 2016 23:47:12 +0000 (16:47 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Mon, 11 Apr 2016 16:26:59 +0000 (09:26 -0700)
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
src/librustc_typeck/diagnostics.rs
src/test/run-pass/coerce-expect-unsized.rs
src/test/run-pass/deriving-via-extension-hash-enum.rs
src/test/run-pass/foreign-dupe.rs
src/test/rustdoc/no-run-still-checks-lints.rs [new file with mode: 0644]

index f661b2a38b655d6d3510b8ba2e7a5e91eca22149..496cc4e8b26fa936758153fad23c58b986c9182e 100644 (file)
@@ -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));
                 }
             }
 
index bef6c1ed43aa6a08438152fb6ae93776e8256d26..4a4bcd96ad06c0fb58dd0ea79bf58d9f9e32b5c4 100644 (file)
@@ -632,7 +632,7 @@ fn bar(&mut self) { }
 
 For a somewhat artificial example:
 
-```compile_fail
+```compile_fail,ignore
 #![recursion_limit="2"]
 
 struct Foo;
index f846ee8f3d0b924035886db8f93ecda1c4464404..e4792e7936bc4e067feffd0e0319958073d19677 100644 (file)
@@ -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)]
 
index 249661f003f0644b62182dfb3edc2584a28a0c92..cbe23ea0522bab27c8a37e7105f2d997833444f7 100644 (file)
@@ -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),
index 6c393ce99e34df204e3d2c2eb8b2fcc7c0cae7db..4e06c434ccc1203b597f4cb066e516df95138965 100644 (file)
@@ -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 (file)
index 0000000..a9df3c3
--- /dev/null
@@ -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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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() {}