Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions compiler/rustc_codegen_ssa/src/codegen_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -930,13 +930,19 @@ fn autodiff_attrs(tcx: TyCtxt<'_>, id: DefId) -> Option<AutoDiffAttrs> {
}
}

// Validate input and return activities
let mut msg = "".to_string();
for &input in &arg_activities {
if !valid_input_activity(mode, input) {
span_bug!(attr.span(), "Invalid input activity {} for {} mode", input, mode);
msg = format!("Invalid input activity {} for {} mode", input, mode);
}
}
if !valid_ret_activity(mode, ret_activity) {
span_bug!(attr.span(), "Invalid return activity {} for {} mode", ret_activity, mode);
msg = format!("Invalid return activity {} for {} mode", ret_activity, mode);
}
if msg != "".to_string() {
tcx.dcx().struct_span_err(attr.span(), msg).with_note("invalid activity").emit();
return Some(AutoDiffAttrs::error());
}

Some(AutoDiffAttrs { mode, ret_activity, input_activity: arg_activities })
Expand Down
Loading