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
This commit is contained in:
Alex Crichton 2016-04-07 16:47:12 -07:00
parent 470ca1c3ff
commit 42bcb4047d
6 changed files with 21 additions and 8 deletions

View File

@ -193,7 +193,7 @@ pub fn compile_input(sess: &Session,
(control.after_analysis.callback)(state); (control.after_analysis.callback)(state);
if control.after_analysis.stop == Compilation::Stop { if control.after_analysis.stop == Compilation::Stop {
return Err(0usize); return result.and_then(|_| Err(0usize));
} }
} }

View File

@ -632,7 +632,7 @@ recursion limit (which can be set via the `recursion_limit` attribute).
For a somewhat artificial example: For a somewhat artificial example:
```compile_fail ```compile_fail,ignore
#![recursion_limit="2"] #![recursion_limit="2"]
struct Foo; struct Foo;

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
// pretty-expanded FIXME #23616
#![allow(unknown_features)] #![allow(unknown_features)]
#![feature(box_syntax)] #![feature(box_syntax)]

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
// pretty-expanded FIXME #23616
#[derive(Hash)] #[derive(Hash)]
enum Foo { enum Foo {
Bar(isize, char), Bar(isize, char),

View File

@ -10,8 +10,6 @@
// calling pin_thread and that's having weird side-effects. // calling pin_thread and that's having weird side-effects.
// pretty-expanded FIXME #23616
#![feature(libc)] #![feature(libc)]
mod rustrt1 { mod rustrt1 {

View File

@ -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() {}