aboutsummaryrefslogtreecommitdiff
path: root/src/parse_assoc_type.rs
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-11-22 10:53:43 +0100
committerMartin Fischer <martin@push-f.com>2021-11-22 10:53:43 +0100
commit8178b4671b03a9c7d4dbe6c4ce66b9cb737c4e2d (patch)
tree7ffa56d4b74acacc35f6de6b9eea141643e51ce8 /src/parse_assoc_type.rs
parentad16a3e0ff064886a807c3c03610588f95943e2d (diff)
rename AssocTypeError variants
Diffstat (limited to 'src/parse_assoc_type.rs')
-rw-r--r--src/parse_assoc_type.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/parse_assoc_type.rs b/src/parse_assoc_type.rs
index df89a47..a02e06c 100644
--- a/src/parse_assoc_type.rs
+++ b/src/parse_assoc_type.rs
@@ -9,9 +9,9 @@ use crate::syn_utils::{iter_type, lifetime_bounds, trait_bounds};
#[derive(Debug)]
pub enum AssocTypeError {
- AssocTypeInBound,
+ NoTraitBound,
+ TraitBoundContainsAssocType,
GenericAssociatedType,
- NoIntoBound,
}
#[derive(Debug, Clone)]
@@ -64,7 +64,10 @@ pub fn parse_assoc_type(
if let GenericArgument::Type(into_type) = &args.args[0] {
// provide a better error message for type A: Into<Self::B>
if iter_type(into_type).any(match_assoc_type) {
- return Err((into_type.span(), AssocTypeError::AssocTypeInBound));
+ return Err((
+ into_type.span(),
+ AssocTypeError::TraitBoundContainsAssocType,
+ ));
}
// TODO: support lifetime GATs (see the currently failing tests/gats.rs)
@@ -89,7 +92,7 @@ pub fn parse_assoc_type(
}),
));
}
- Err((assoc_type.span(), AssocTypeError::NoIntoBound))
+ Err((assoc_type.span(), AssocTypeError::NoTraitBound))
}
#[cfg(test)]
@@ -122,7 +125,7 @@ mod tests {
assert!(matches!(
parse_assoc_type(&type1),
- Err((_, AssocTypeError::NoIntoBound))
+ Err((_, AssocTypeError::NoTraitBound))
));
}
@@ -135,7 +138,7 @@ mod tests {
assert!(matches!(
parse_assoc_type(&type1),
- Err((_, AssocTypeError::AssocTypeInBound))
+ Err((_, AssocTypeError::TraitBoundContainsAssocType))
));
}