parser: Don't panic when finding associated constants to a primitive.
We don't handle it, but no reason to panic. Fixes #493
This commit is contained in:
+15
-4
@@ -707,11 +707,22 @@ impl Parse {
|
||||
return;
|
||||
}
|
||||
};
|
||||
if ty.is_none() {
|
||||
return;
|
||||
}
|
||||
|
||||
let impl_path = ty.unwrap().get_root_path().unwrap();
|
||||
let ty = match ty {
|
||||
Some(ty) => ty,
|
||||
None => return,
|
||||
};
|
||||
|
||||
let impl_path = match ty.get_root_path() {
|
||||
Some(p) => p,
|
||||
None => {
|
||||
warn!(
|
||||
"Couldn't find path for {:?}, skipping associated constants",
|
||||
ty
|
||||
);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
for item in items.into_iter() {
|
||||
if let syn::Visibility::Public(_) = item.vis {
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
@@ -0,0 +1,4 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
@@ -0,0 +1,4 @@
|
||||
#include <cstdarg>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <new>
|
||||
@@ -0,0 +1,4 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
@@ -0,0 +1,4 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
@@ -0,0 +1,4 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
@@ -0,0 +1,4 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
@@ -0,0 +1,7 @@
|
||||
pub trait F {
|
||||
const B: u8;
|
||||
}
|
||||
|
||||
impl F for u16 {
|
||||
const B: u8 = 3;
|
||||
}
|
||||
Reference in New Issue
Block a user