Skip to content

Parsing problem(?) with Box<dyn FnOnce()> #62

@ijackson

Description

@ijackson

Another oddity I'm afraid. This:

use fehler::throws;

#[throws(std::io::Error)] // ERROR: Wrapper type must be a normal path type
pub fn zonk() {
  let mut _unused : Box<dyn FnOnce()> = Box::new(||());
}

pub fn works0() -> Result<(), std::io::Error> {
  let mut _unused : Box<dyn FnOnce()> = Box::new(||());
  Ok(())
}

pub fn works1() {
  let mut _unused : Box<dyn FnOnce()> = Box::new(||());
}

#[throws(std::io::Error)]
pub fn works2() {
  let mut _unused : Box<()> = Box::new(());
}

Produces this:

error: custom attribute panicked
 --> src/lib.rs:4:1
  |
3 | #[throws(std::io::Error)] // ERROR: Wrapper type must be a normal path type
  | ^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: message: Wrapper type must be a normal path type

I think zonk should compile and be equivalent to works0. Again, this test case is minimised from a larger program. Thanks for your attention.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions