Rollup merge of #103142 - fmease:fix-103052, r=oli-obk
Make diagnostic for unsatisfied `Termination` bounds more precise Don't blindly emit a diagnostic claiming that “*`main` has an invalid return type*” if we encounter a type that should but doesn't implement `std::process::Termination` and isn't actually the return type of the program entry `main`. Fixes #103052. ``@rustbot`` label A-diagnostics T-compiler T-libs r? diagnostics
This commit is contained in:
commit
472a8742a6
8 changed files with 78 additions and 5 deletions
|
@ -164,6 +164,10 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
flags.push((sym::from_desugaring, Some(format!("{:?}", k))));
|
||||
}
|
||||
|
||||
if let ObligationCauseCode::MainFunctionType = obligation.cause.code() {
|
||||
flags.push((sym::cause, Some("MainFunctionType".to_string())));
|
||||
}
|
||||
|
||||
// Add all types without trimmed paths.
|
||||
ty::print::with_no_trimmed_paths!({
|
||||
let generics = self.tcx.generics_of(def_id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue