Skip to content

pymodule, pyattr, pyclass, pygetset, and pymethod attrs generate numerous errors related to rustpython_vm when used #6092

@Aversefun

Description

@Aversefun

Summary

Using the exact code provided on https://rustpython.github.io/docs/interop/rust_from_python.html generates a lot of errors

Expected

It functions and creates a rustpython module.

Actual

[arthur@fullworld][~/notation]% RUSTFLAGS="-Zmacro-backtrace" cargo clippy                                                                                                   [git][git/.][main]
    Checking notation v1.0.0 (/home/arthur/notation)
error: #[pyclass(...)] doesn't contain 'no_attr' to remove
  --> src/plugins.rs:50:7
   |
50 |     #[pyclass]
   |       ^^^^^^^

error[E0432]: unresolved import `rustpython_vm`
  --> src/plugins.rs:39:1
   |
39 | #[pymodule]
   | ^^^^^^^^^^^
   | |
   | help: a similar path exists: `super::rustpython_vm`
   | in this attribute macro expansion
   |
  ::: /home/arthur/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustpython-derive-0.4.0/src/lib.rs:38:1
   |
38 | pub fn pymodule(attr: TokenStream, item: TokenStream) -> TokenStream {
   | -------------------------------------------------------------------- in this expansion of `#[pymodule]`

error[E0433]: failed to resolve: could not find `rustpython_vm` in the list of imported crates
  --> src/plugins.rs:39:1
   |
39 | #[pymodule]
   | ^^^^^^^^^^^
   | |
   | could not find `rustpython_vm` in the list of imported crates
   | in this attribute macro expansion
   |
  ::: /home/arthur/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustpython-derive-0.4.0/src/lib.rs:38:1
   |
38 | pub fn pymodule(attr: TokenStream, item: TokenStream) -> TokenStream {
   | -------------------------------------------------------------------- in this expansion of `#[pymodule]`

error: cannot find attribute `pyclass` in this scope
  --> src/plugins.rs:55:7
   |
55 |     #[pyclass]
   |       ^^^^^^^
   |
help: consider importing this attribute macro
   |
42 +     use crate::plugins::rustpython_vm::pyclass;
   |

error: cannot find attribute `pygetset` in this scope
  --> src/plugins.rs:57:11
   |
57 |         #[pygetset]
   |           ^^^^^^^^

error: cannot find attribute `pymethod` in this scope
  --> src/plugins.rs:62:11
   |
62 |         #[pymethod]
   |           ^^^^^^^^

error: cannot find attribute `pyattr` in this scope
  --> src/plugins.rs:49:7
   |
49 |     #[pyattr]
   |       ^^^^^^

error: cannot find attribute `pyclass` in this scope
  --> src/plugins.rs:50:7
   |
50 |     #[pyclass]
   |       ^^^^^^^
   |
help: consider importing this attribute macro
   |
42 +     use crate::plugins::rustpython_vm::pyclass;
   |

error[E0433]: failed to resolve: could not find `rustpython_vm` in the list of imported crates
  --> src/plugins.rs:39:1
   |
39 | #[pymodule]
   | ^^^^^^^^^^^
   | |
   | could not find `rustpython_vm` in the list of imported crates
   | in this attribute macro expansion
   |
  ::: /home/arthur/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustpython-derive-0.4.0/src/lib.rs:38:1
   |
38 | pub fn pymodule(attr: TokenStream, item: TokenStream) -> TokenStream {
   | -------------------------------------------------------------------- in this expansion of `#[pymodule]`
   |
help: consider importing this crate through its public re-export
   |
42 +     use crate::plugins::rustpython_vm;
   |

error[E0433]: failed to resolve: could not find `rustpython_vm` in the list of imported crates
  --> src/plugins.rs:39:1
   |
39 | #[pymodule]
   | ^^^^^^^^^^^
   | |
   | could not find `rustpython_vm` in the list of imported crates
   | in this attribute macro expansion
   |
  ::: /home/arthur/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustpython-derive-0.4.0/src/lib.rs:38:1
   |
38 | pub fn pymodule(attr: TokenStream, item: TokenStream) -> TokenStream {
   | -------------------------------------------------------------------- in this expansion of `#[pymodule]`
   |
help: consider importing this module
   |
42 +     use crate::plugins::rustpython_vm::builtins;
   |

error[E0425]: cannot find value `DEF` in this scope
  --> src/plugins.rs:39:1
   |
39 | #[pymodule]
   | ^^^^^^^^^^^
   | |
   | not found in this scope
   | in this attribute macro expansion
   |
  ::: /home/arthur/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustpython-derive-0.4.0/src/lib.rs:38:1
   |
38 | pub fn pymodule(attr: TokenStream, item: TokenStream) -> TokenStream {
   | -------------------------------------------------------------------- in this expansion of `#[pymodule]`

error[E0433]: failed to resolve: could not find `rustpython_vm` in the list of imported crates
  --> src/plugins.rs:39:1
   |
39 | #[pymodule]
   | ^^^^^^^^^^^
   | |
   | could not find `rustpython_vm` in the list of imported crates
   | in this attribute macro expansion
   |
  ::: /home/arthur/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustpython-derive-0.4.0/src/lib.rs:38:1
   |
38 | pub fn pymodule(attr: TokenStream, item: TokenStream) -> TokenStream {
   | -------------------------------------------------------------------- in this expansion of `#[pymodule]`
   |
help: consider importing one of these modules
   |
42 +     use crate::plugins::rustpython_stdlib::builtins;
   |
42 +     use crate::plugins::rustpython_vm::builtins;
   |

error[E0433]: failed to resolve: could not find `rustpython_vm` in the list of imported crates
  --> src/plugins.rs:39:1
   |
39 | #[pymodule]
   | ^^^^^^^^^^^
   | |
   | could not find `rustpython_vm` in the list of imported crates
   | in this attribute macro expansion
   |
  ::: /home/arthur/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustpython-derive-0.4.0/src/lib.rs:38:1
   |
38 | pub fn pymodule(attr: TokenStream, item: TokenStream) -> TokenStream {
   | -------------------------------------------------------------------- in this expansion of `#[pymodule]`
   |
help: consider importing this struct
   |
42 +     use crate::plugins::rustpython_vm::builtins::PyModule;
   |

error[E0433]: failed to resolve: could not find `rustpython_vm` in the list of imported crates
  --> src/plugins.rs:39:1
   |
39 | #[pymodule]
   | ^^^^^^^^^^^
   | |
   | could not find `rustpython_vm` in the list of imported crates
   | in this attribute macro expansion
   |
  ::: /home/arthur/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustpython-derive-0.4.0/src/lib.rs:38:1
   |
38 | pub fn pymodule(attr: TokenStream, item: TokenStream) -> TokenStream {
   | -------------------------------------------------------------------- in this expansion of `#[pymodule]`
   |
help: consider importing this module
   |
42 +     use crate::plugins::rustpython_vm::function;
   |

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `rustpython_vm`
  --> src/plugins.rs:39:1
   |
39 | #[pymodule]
   | ^^^^^^^^^^^
   | |
   | use of unresolved module or unlinked crate `rustpython_vm`
   | in this attribute macro expansion
   |
  ::: /home/arthur/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustpython-derive-0.4.0/src/lib.rs:38:1
   |
38 | pub fn pymodule(attr: TokenStream, item: TokenStream) -> TokenStream {
   | -------------------------------------------------------------------- in this expansion of `#[pymodule]`
   |
help: there is a crate or module with a similar name
   |
39 - #[pymodule]
39 + rustpython
   |
help: consider importing this struct
   |
42 +     use crate::plugins::rustpython_vm::function::PyMethodDef;
   |

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `rustpython_vm`
  --> src/plugins.rs:39:1
   |
39 | #[pymodule]
   | ^^^^^^^^^^^
   | |
   | use of unresolved module or unlinked crate `rustpython_vm`
   | in this attribute macro expansion
   |
  ::: /home/arthur/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustpython-derive-0.4.0/src/lib.rs:38:1
   |
38 | pub fn pymodule(attr: TokenStream, item: TokenStream) -> TokenStream {
   | -------------------------------------------------------------------- in this expansion of `#[pymodule]`
   |
help: there is a crate or module with a similar name
   |
39 - #[pymodule]
39 + rustpython
   |
help: consider importing this struct
   |
42 +     use crate::plugins::rustpython_vm::function::PyMethodFlags;
   |

Some errors have detailed explanations: E0425, E0432, E0433.
For more information about an error, try `rustc --explain E0425`.
error: could not compile `notation` (bin "notation") due to 16 previous errors

Python Documentation

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions