-
Notifications
You must be signed in to change notification settings - Fork 782
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1746 from davidhewitt/doc-attributes-1.54
pyo3-macros-backend: support macros inside doc attributes
- Loading branch information
Showing
10 changed files
with
136 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use pyo3::prelude::*; | ||
use pyo3::types::IntoPyDict; | ||
|
||
#[macro_use] | ||
#[path = "../common.rs"] | ||
mod common; | ||
|
||
#[pyclass] | ||
/// The MacroDocs class. | ||
#[doc = concat!("Some macro ", "class ", "docs.")] | ||
/// A very interesting type! | ||
struct MacroDocs {} | ||
|
||
#[pymethods] | ||
impl MacroDocs { | ||
#[doc = concat!("A macro ", "example.")] | ||
/// With mixed doc types. | ||
fn macro_doc(&self) {} | ||
} | ||
|
||
#[test] | ||
fn meth_doc() { | ||
Python::with_gil(|py| { | ||
let d = [("C", py.get_type::<MacroDocs>())].into_py_dict(py); | ||
py_assert!( | ||
py, | ||
*d, | ||
"C.__doc__ == 'The MacroDocs class.\\nSome macro class docs.\\nA very interesting type!'" | ||
); | ||
py_assert!( | ||
py, | ||
*d, | ||
"C.macro_doc.__doc__ == 'A macro example.\\nWith mixed doc types.'" | ||
); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//! Functionality which is not only not supported on MSRV, | ||
//! but can't even be cfg-ed out on MSRV because the compiler doesn't support | ||
//! the syntax. | ||
// TODO(#1782) rustversion attribute can't go on modules until Rust 1.42, so this | ||
// funky dance has to happen... | ||
mod requires_1_54 { | ||
#[rustversion::since(1.54)] | ||
include!("not_msrv/requires_1_54.rs"); | ||
} |