@@ -399,11 +399,24 @@ pub fn normalize_param_env_or_error<'a,'tcx>(unnormalized_env: ty::ParameterEnvi
399399 match normalize_param_env ( & unnormalized_env, cause) {
400400 Ok ( p) => p,
401401 Err ( errors) => {
402- // this isn't really the ideal place to report errors, but it seems ok
402+ // I'm not wild about reporting errors here; I'd prefer to
403+ // have the errors get reported at a defined place (e.g.,
404+ // during typeck). Instead I have all parameter
405+ // environments, in effect, going through this function
406+ // and hence potentially reporting errors. This ensurse of
407+ // course that we never forget to normalize (the
408+ // alternative seemed like it would involve a lot of
409+ // manual invocations of this fn -- and then we'd have to
410+ // deal with the errors at each of those sites).
411+ //
412+ // In any case, in practice, typeck constructs all the
413+ // parameter environments once for every fn as it goes,
414+ // and errors will get reported then; so after typeck we
415+ // can be sure that no errors should occur.
403416 let infcx = infer:: new_infer_ctxt ( unnormalized_env. tcx ) ;
404417 report_fulfillment_errors ( & infcx, & errors) ;
405418
406- // normalized failed? use what they gave us, it's better than nothing
419+ // Normalized failed? use what they gave us, it's better than nothing.
407420 unnormalized_env
408421 }
409422 }
0 commit comments