mirror of
https://github.com/allankoechke/rust.git
synced 2026-11-30 11:05:36 +00:00
fix: panic on unreasonable cases instead of going silent
This commit is contained in:
@@ -175,12 +175,12 @@ impl SingleAttributeParser for RustcLegacyConstGenericsParser {
|
||||
// Invalid targets are already diagnosed by target checking.
|
||||
return;
|
||||
}
|
||||
let Some(item) = cx.target_item else { return };
|
||||
let ItemKind::Fn(function) = &item.kind else { return };
|
||||
let Some(index_list) = rustc_attr_ir::find_attr!(cx.parsed_attrs, RustcLegacyConstGenerics { fn_indexes, .. } => fn_indexes)
|
||||
else {
|
||||
return;
|
||||
let item = cx.target_item.expect("missing AST target item for Target::Fn");
|
||||
let ItemKind::Fn(function) = &item.kind else {
|
||||
panic!("expected fn AST target item for Target::Fn");
|
||||
};
|
||||
let index_list = rustc_attr_ir::find_attr!(cx.parsed_attrs, RustcLegacyConstGenerics { fn_indexes, .. } => fn_indexes)
|
||||
.expect("missing parsed RustcLegacyConstGenerics attribute in finalize_check");
|
||||
let generics = &function.generics;
|
||||
|
||||
for param in &generics.params {
|
||||
|
||||
Reference in New Issue
Block a user