Skip to content

Commit

Permalink
Merge pull request #40 from mcarton/bugfix/37
Browse files Browse the repository at this point in the history
Fix part of #37
  • Loading branch information
mcarton authored Aug 10, 2019
2 parents 9948fe6 + 3999f11 commit 0bd0e52
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ fn format_with(
// Leave off the type parameter bounds, defaults, and attributes
let phantom = generics.type_params().map(|tp| &tp.ident);

let ctor_ty_generics = ctor_ty_generics.as_turbofish();

quote!(
let #arg_n = {
struct Dummy #ty_generics (&'_derivative #ty, #phantom_path <(#(#phantom),*)>) #where_clause;
Expand All @@ -188,7 +190,7 @@ fn format_with(
}
}

Dummy:: #ctor_ty_generics (#arg_n, #phantom_path)
Dummy #ctor_ty_generics (#arg_n, #phantom_path)
};
)
}
12 changes: 12 additions & 0 deletions tests/issue-37-turbofish.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#[cfg(feature = "use_core")]
extern crate core;

#[macro_use]
extern crate derivative;

#[derive(Derivative)]
#[derivative(Debug)]
pub struct A {
#[derivative(Debug(format_with = "std::fmt::Debug::fmt"))]
v: u64,
}

0 comments on commit 0bd0e52

Please sign in to comment.