handle the case when container is not impl
This commit is contained in:
parent
bcf0e2f528
commit
c6d0a20f7b
2 changed files with 9 additions and 6 deletions
|
@ -16,12 +16,10 @@ pub enum AssocItemContainer {
|
|||
}
|
||||
|
||||
impl AssocItemContainer {
|
||||
/// Asserts that this is the `DefId` of an associated item declared
|
||||
/// in an impl, and returns the trait `DefId`.
|
||||
pub fn assert_impl(&self) -> DefId {
|
||||
pub fn impl_def_id(&self) -> Option<DefId> {
|
||||
match *self {
|
||||
ImplContainer(id) => id,
|
||||
_ => bug!("associated item has wrong container type: {:?}", self),
|
||||
ImplContainer(id) => Some(id),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue