-
Notifications
You must be signed in to change notification settings - Fork 784
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add UI test to ensure only bare &self can be passed into traverse.
- Loading branch information
1 parent
e309a8e
commit 3ee383e
Showing
3 changed files
with
30 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use pyo3::prelude::*; | ||
use pyo3::PyVisit; | ||
|
||
#[pyclass] | ||
struct TraverseTriesToTakePyRef {} | ||
|
||
#[pymethods] | ||
impl TraverseTriesToTakePyRef { | ||
fn __traverse__(slf: PyRef<Self>, visit: PyVisit) {} | ||
} | ||
|
||
fn main() {} |
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,17 @@ | ||
error[E0308]: mismatched types | ||
--> tests/ui/traverse_bare_self.rs:8:6 | ||
| | ||
7 | #[pymethods] | ||
| ------------ arguments to this function are incorrect | ||
8 | impl TraverseTriesToTakePyRef { | ||
| ______^ | ||
9 | | fn __traverse__(slf: PyRef<Self>, visit: PyVisit) {} | ||
| |___________________^ expected fn pointer, found fn item | ||
| | ||
= note: expected fn pointer `for<'a, 'b> fn(&'a TraverseTriesToTakePyRef, PyVisit<'b>) -> Result<(), PyTraverseError>` | ||
found fn item `for<'a, 'b> fn(pyo3::PyRef<'a, TraverseTriesToTakePyRef>, PyVisit<'b>) {TraverseTriesToTakePyRef::__traverse__}` | ||
note: function defined here | ||
--> src/impl_/pymethods.rs | ||
| | ||
| pub unsafe fn call_traverse_impl<T>( | ||
| ^^^^^^^^^^^^^^^^^^ |