Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Work around async_trait behavior #295

Merged
merged 2 commits into from
May 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/traverse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -736,8 +736,17 @@ fn diff_generics(
let old_count = old_gen.own_counts();
let new_count = new_gen.own_counts();

// NEEDSWORK: proper detection of what's going on here..
let was_async_trait_transformed = old_count.lifetimes > 0
&& old_gen.params[old_count.lifetimes - 1].name.as_str() == "'async_trait";

let self_add = if old_gen.has_self && new_gen.has_self {
1
if was_async_trait_transformed {
// async_trait transformation undoes the self lifetime?
0
} else {
1
}
} else if !old_gen.has_self && !new_gen.has_self {
0
} else {
Expand Down
2 changes: 2 additions & 0 deletions tests/full.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ mod full {
full_test!(libc0, "libc", "0.2.28", "0.2.31", cfg!(windows));
full_test!(libc1, "libc", "0.2.47", "0.2.48", true);
full_test!(rmpv, "rmpv", "0.4.0", "0.4.1", false);
// NOTE: this one is a regression test for the async-trait workaround (#295) mostly
full_test!(async_trait, "config", "0.13.0", "0.13.1", false);
// full_test!(mozjs, "mozjs", "0.2.0", "0.3.0");
// full_test!(rand, "rand", "0.3.10", "0.3.16");
// full_test!(serde_pre, "serde", "0.7.0", "1.0.0");
Expand Down
Loading