]> git.lizzy.rs Git - rust.git/commitdiff
review comments
authorEsteban Küber <esteban@kuber.com.ar>
Tue, 3 Sep 2019 03:51:31 +0000 (20:51 -0700)
committerEsteban Küber <esteban@kuber.com.ar>
Tue, 3 Sep 2019 03:51:31 +0000 (20:51 -0700)
src/librustc_typeck/constrained_generic_params.rs
src/test/ui/issues/issue-36836.rs
src/test/ui/issues/issue-36836.stderr

index c95f81506cd59471917dcb16aec23b8359c18eb9..dd44f86717fe5fd1fe472261ca6a99ee4fa14957 100644 (file)
@@ -36,8 +36,8 @@ pub fn parameters_for_impl<'tcx>(
 /// uniquely determined by `t` (see RFC 447). If it is true, return the list
 /// of parameters whose values are needed in order to constrain `ty` - these
 /// differ, with the latter being a superset, in the presence of projections.
-pub fn parameters_for<'tcx, T: TypeFoldable<'tcx>>(
-    t: &T,
+pub fn parameters_for<'tcx>(
+    t: &impl TypeFoldable<'tcx>,
     include_nonconstraining: bool,
 ) -> Vec<Parameter> {
     let mut collector = ParameterCollector {
index 56d5a7cca4566287a8c9010bfadbabf2a068b452..99c56213153e40180d74baa9bfc54b9ed8681b27 100644 (file)
@@ -1,3 +1,13 @@
+// Previously, in addition to the real cause of the problem as seen below,
+// the compiler would tell the user:
+//
+// ```
+// error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or
+// predicates
+// ```
+//
+// With this test, we check that only the relevant error is emitted.
+
 trait Foo {}
 
 impl<T> Foo for Bar<T> {} //~ ERROR cannot find type `Bar` in this scope
index bfda9b0bbdd7e56ad7519bbe535c7bf968c6502f..418194fac9923c49e5cefcb5215eb37117365864 100644 (file)
@@ -1,5 +1,5 @@
 error[E0412]: cannot find type `Bar` in this scope
-  --> $DIR/issue-36836.rs:3:17
+  --> $DIR/issue-36836.rs:13:17
    |
 LL | impl<T> Foo for Bar<T> {}
    |                 ^^^ not found in this scope