File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -291,9 +291,7 @@ impl<N: ToOptionString> ItemIdentifier<N> {
291
291
pub fn with_name ( name : N , entity : & Entity < ' _ > , _context : & Context < ' _ > ) -> Self {
292
292
let file = entity
293
293
. get_location ( )
294
- . unwrap_or_else ( || panic ! ( "no entity location: {entity:?}" ) )
295
- . get_expansion_location ( )
296
- . file ;
294
+ . and_then ( |loc| loc. get_expansion_location ( ) . file ) ;
297
295
298
296
let mut location = if let Some ( file) = file {
299
297
Location :: from_file ( file)
Original file line number Diff line number Diff line change @@ -2342,7 +2342,10 @@ impl Ty {
2342
2342
} if pointee. is_object_like ( ) => {
2343
2343
write ! ( f, "{}" , pointee. behind_pointer( ) )
2344
2344
}
2345
- Self :: IncompleteArray { .. } => unimplemented ! ( "incomplete array in typedef" ) ,
2345
+ Self :: IncompleteArray { .. } => {
2346
+ error ! ( "incomplete array in typedef" ) ;
2347
+ write ! ( f, "{}" , self . behind_pointer( ) )
2348
+ }
2346
2349
// We mark `typedefs` as-if behind a pointer, as even though
2347
2350
// typedefs are _usually_ to a pointer of the type (handled
2348
2351
// above), we sometimes have typedefs to the inner type as well.
Original file line number Diff line number Diff line change @@ -1285,7 +1285,7 @@ impl Stmt {
1285
1285
}
1286
1286
EntityKind :: FieldDecl => {
1287
1287
drop ( span) ;
1288
- let name = entity. get_name ( ) . expect ( "struct/union field name" ) ;
1288
+ let name = entity. get_name ( ) . unwrap_or_else ( || "__unknown__" . into ( ) ) ;
1289
1289
let _span = debug_span ! ( "field" , name) . entered ( ) ;
1290
1290
1291
1291
let ty = entity. get_type ( ) . expect ( "struct/union field type" ) ;
@@ -1553,7 +1553,7 @@ impl Stmt {
1553
1553
error ! ( ?value, ?entity, "got variable value twice" ) ;
1554
1554
}
1555
1555
}
1556
- _ => panic ! ( "unknown vardecl child in {id:?}: {entity:?} " ) ,
1556
+ _ => error ! ( ?id , ?entity , "unknown vardecl child" ) ,
1557
1557
} ) ;
1558
1558
1559
1559
vec ! [ Self :: VarDecl {
You can’t perform that action at this time.
0 commit comments