Skip to content

Commit eede09e

Browse files
author
bors-servo
authored
Auto merge of #470 - emilio:template-fun-ty, r=fitzgen
Fix a recent template-specialization-related regression. r? @upsuper
2 parents 4c45407 + 439d89d commit eede09e

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ name = "bindgen"
1313
readme = "README.md"
1414
repository = "https://github.com/servo/rust-bindgen"
1515
documentation = "https://docs.rs/bindgen"
16-
version = "0.20.5"
16+
version = "0.21.0"
1717
build = "build.rs"
1818

1919
[badges]

src/clang.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -787,12 +787,14 @@ impl Type {
787787
// Yep, the spelling of this containing type-parameter is extremely
788788
// nasty... But can happen in <type_traits>. Unfortunately I couldn't
789789
// reduce it enough :(
790-
!self.spelling().contains("type-parameter") &&
791-
self.template_args()
792-
.map_or(false, |mut args| {
793-
args.len() > 0 &&
794-
!args.any(|t| t.spelling().contains("type-parameter"))
795-
})
790+
self.template_args().map_or(false, |args| {
791+
args.len() > 0
792+
}) && match self.declaration().kind() {
793+
CXCursor_ClassTemplatePartialSpecialization |
794+
CXCursor_TypeAliasTemplateDecl |
795+
CXCursor_TemplateTemplateParameter => false,
796+
_ => true,
797+
}
796798
}
797799
}
798800

src/ir/ty.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,8 @@ impl Type {
622622
// Same here, with template specialisations we can safely
623623
// assume this is a Comp(..)
624624
} else if ty.is_fully_specialized_template() {
625-
debug!("Template specialization: {:?}", ty);
625+
debug!("Template specialization: {:?}, {:?} {:?}",
626+
ty, location, canonical_ty);
626627
let complex =
627628
CompInfo::from_ty(potential_id, ty, location, ctx)
628629
.expect("C'mon");

0 commit comments

Comments
 (0)