Skip to content

Backwards incompatibility for ArgMatches and UnwindSafe #3876

Closed
@doivosevic

Description

@doivosevic

Please complete the following tasks

Rust Version

1.60

Clap Version

between 3.1.18 and 3.2.6

Minimal reproducible code

fn a(a: ArgMatches) {
    b(a)
}

fn b<T: UnwindSafe>(b: T) {
    
}

Steps to reproduce the bug with the above code

cargo check

Actual Behaviour

Compile should pass

Expected Behaviour

Compile fails

Additional Context

This looks like a backwards incompatibility

Debug Output


error[E0277]: the type `(dyn std::any::Any + Sync + std::marker::Send + 'static)` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
  --> index/src/utils.rs:31:7
   |
31 |     b(a)
   |     - ^ `(dyn std::any::Any + Sync + std::marker::Send + 'static)` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
   |     |
   |     required by a bound introduced by this call
   |
   = help: the trait `RefUnwindSafe` is not implemented for `(dyn std::any::Any + Sync + std::marker::Send + 'static)`
   = note: required because of the requirements on the impl of `UnwindSafe` for `Arc<(dyn std::any::Any + Sync + std::marker::Send + 'static)>`
   = note: required because it appears within the type `parser::matches::any_value::AnyValue`
   = note: required because of the requirements on the impl of `UnwindSafe` for `Unique<parser::matches::any_value::AnyValue>`
   = note: required because it appears within the type `alloc::raw_vec::RawVec<parser::matches::any_value::AnyValue>`
   = note: required because it appears within the type `Vec<parser::matches::any_value::AnyValue>`
   = note: required because of the requirements on the impl of `UnwindSafe` for `Unique<Vec<parser::matches::any_value::AnyValue>>`
   = note: required because it appears within the type `alloc::raw_vec::RawVec<Vec<parser::matches::any_value::AnyValue>>`
   = note: required because it appears within the type `Vec<Vec<parser::matches::any_value::AnyValue>>`
   = note: required because it appears within the type `parser::matches::matched_arg::MatchedArg`
   = note: required because it appears within the type `indexmap::Bucket<clap::util::id::Id, parser::matches::matched_arg::MatchedArg>`
   = note: required because of the requirements on the impl of `UnwindSafe` for `Unique<indexmap::Bucket<clap::util::id::Id, parser::matches::matched_arg::MatchedArg>>`
   = note: required because it appears within the type `alloc::raw_vec::RawVec<indexmap::Bucket<clap::util::id::Id, parser::matches::matched_arg::MatchedArg>>`
   = note: required because it appears within the type `Vec<indexmap::Bucket<clap::util::id::Id, parser::matches::matched_arg::MatchedArg>>`
   = note: required because it appears within the type `indexmap::map::core::IndexMapCore<clap::util::id::Id, parser::matches::matched_arg::MatchedArg>`
   = note: required because it appears within the type `indexmap::map::IndexMap<clap::util::id::Id, parser::matches::matched_arg::MatchedArg>`
   = note: required because it appears within the type `ArgMatches`
note: required by a bound in `b`
  --> index/src/utils.rs:34:9
   |
34 | fn b<T: UnwindSafe>(b: T) {
   |         ^^^^^^^^^^ required by this bound in `b`

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-parsingArea: Parser's logic and needs it changed somehow.C-bugCategory: bugS-waiting-on-decisionStatus: Waiting on a go/no-go before implementing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions