Skip to content

Commit 42bcb40

Browse files
committed
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
1 parent 470ca1c commit 42bcb40

File tree

6 files changed

+21
-8
lines changed

6 files changed

+21
-8
lines changed

src/librustc_driver/driver.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ pub fn compile_input(sess: &Session,
193193
(control.after_analysis.callback)(state);
194194

195195
if control.after_analysis.stop == Compilation::Stop {
196-
return Err(0usize);
196+
return result.and_then(|_| Err(0usize));
197197
}
198198
}
199199

src/librustc_typeck/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ recursion limit (which can be set via the `recursion_limit` attribute).
632632
633633
For a somewhat artificial example:
634634
635-
```compile_fail
635+
```compile_fail,ignore
636636
#![recursion_limit="2"]
637637
638638
struct Foo;

src/test/run-pass/coerce-expect-unsized.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// pretty-expanded FIXME #23616
12-
1311
#![allow(unknown_features)]
1412
#![feature(box_syntax)]
1513

src/test/run-pass/deriving-via-extension-hash-enum.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// pretty-expanded FIXME #23616
12-
1311
#[derive(Hash)]
1412
enum Foo {
1513
Bar(isize, char),

src/test/run-pass/foreign-dupe.rs

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
// calling pin_thread and that's having weird side-effects.
1212

13-
// pretty-expanded FIXME #23616
14-
1513
#![feature(libc)]
1614

1715
mod rustrt1 {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// compile-flags:--test
12+
// should-fail
13+
14+
#![doc(test(attr(deny(warnings))))]
15+
16+
/// ```no_run
17+
/// let a = 3;
18+
/// ```
19+
pub fn foo() {}

0 commit comments

Comments
 (0)