File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ use std::process::Command;
3
3
use std:: str;
4
4
5
5
fn main ( ) {
6
- println ! ( "cargo:rerun-if-changed=build.rs " ) ;
6
+ println ! ( "cargo:rerun-if-env- changed=DOCS_RS " ) ;
7
7
8
8
let compiler = match rustc_minor_version ( ) {
9
9
Some ( compiler) => compiler,
@@ -17,6 +17,10 @@ fn main() {
17
17
if compiler < 47 {
18
18
println ! ( "cargo:rustc-cfg=self_span_hack" ) ;
19
19
}
20
+
21
+ if compiler >= 75 && env:: var_os ( "DOCS_RS" ) . is_none ( ) {
22
+ println ! ( "cargo:rustc-cfg=native_async_fn_in_trait" ) ;
23
+ }
20
24
}
21
25
22
26
fn rustc_minor_version ( ) -> Option < u32 > {
Original file line number Diff line number Diff line change 12
12
//! Rust 1.39 did not include support for async fn in traits. Trying to include
13
13
//! an async fn in a trait produces the following error:
14
14
//!
15
- //! ```compile_fail
15
+ #![ cfg_attr( not( native_async_fn_in_trait) , doc = "```compile_fail" ) ]
16
+ #![ cfg_attr( native_async_fn_in_trait, doc = "```" ) ]
16
17
//! trait MyTrait {
17
18
//! async fn f() {}
18
19
//! }
19
- //! ```
20
+ #! [ doc = " ```" ]
20
21
//!
21
22
//! ```text
22
23
//! error[E0706]: trait fns cannot be declared `async`
You can’t perform that action at this time.
0 commit comments