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;
33use std:: str;
44
55fn main ( ) {
6- println ! ( "cargo:rerun-if-changed=build.rs " ) ;
6+ println ! ( "cargo:rerun-if-env- changed=DOCS_RS " ) ;
77
88 let compiler = match rustc_minor_version ( ) {
99 Some ( compiler) => compiler,
@@ -17,6 +17,10 @@ fn main() {
1717 if compiler < 47 {
1818 println ! ( "cargo:rustc-cfg=self_span_hack" ) ;
1919 }
20+
21+ if compiler >= 75 && env:: var_os ( "DOCS_RS" ) . is_none ( ) {
22+ println ! ( "cargo:rustc-cfg=native_async_fn_in_trait" ) ;
23+ }
2024}
2125
2226fn rustc_minor_version ( ) -> Option < u32 > {
Original file line number Diff line number Diff line change 1212//! Rust 1.39 did not include support for async fn in traits. Trying to include
1313//! an async fn in a trait produces the following error:
1414//!
15- //! ```compile_fail
15+ #![ cfg_attr( not( native_async_fn_in_trait) , doc = "```compile_fail" ) ]
16+ #![ cfg_attr( native_async_fn_in_trait, doc = "```" ) ]
1617//! trait MyTrait {
1718//! async fn f() {}
1819//! }
19- //! ```
20+ #! [ doc = " ```" ]
2021//!
2122//! ```text
2223//! error[E0706]: trait fns cannot be declared `async`
You can’t perform that action at this time.
0 commit comments