From 694432e935925a5a38fef14d7ad82ff3378410f2 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Wed, 28 Jan 2015 05:06:10 -0500 Subject: [PATCH] Adjust comment per nrc's suggestion. --- src/librustc/middle/traits/mod.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/librustc/middle/traits/mod.rs b/src/librustc/middle/traits/mod.rs index cf9e97ef24d..82a4a60cebb 100644 --- a/src/librustc/middle/traits/mod.rs +++ b/src/librustc/middle/traits/mod.rs @@ -399,11 +399,24 @@ pub fn normalize_param_env_or_error<'a,'tcx>(unnormalized_env: ty::ParameterEnvi match normalize_param_env(&unnormalized_env, cause) { Ok(p) => p, Err(errors) => { - // this isn't really the ideal place to report errors, but it seems ok + // I'm not wild about reporting errors here; I'd prefer to + // have the errors get reported at a defined place (e.g., + // during typeck). Instead I have all parameter + // environments, in effect, going through this function + // and hence potentially reporting errors. This ensurse of + // course that we never forget to normalize (the + // alternative seemed like it would involve a lot of + // manual invocations of this fn -- and then we'd have to + // deal with the errors at each of those sites). + // + // In any case, in practice, typeck constructs all the + // parameter environments once for every fn as it goes, + // and errors will get reported then; so after typeck we + // can be sure that no errors should occur. let infcx = infer::new_infer_ctxt(unnormalized_env.tcx); report_fulfillment_errors(&infcx, &errors); - // normalized failed? use what they gave us, it's better than nothing + // Normalized failed? use what they gave us, it's better than nothing. unnormalized_env } }