diff options
| author | David Wood <david@davidtw.co> | 2020-06-22 14:00:27 +0100 |
|---|---|---|
| committer | David Wood <david@davidtw.co> | 2020-07-20 19:35:32 +0100 |
| commit | f52c72948aa1dd718cc1f168d21c91c584c0a662 (patch) | |
| tree | 1879e860dbd4ac450fb15504a31d41be71d1102b /src/test/ui/polymorphization | |
| parent | 2989fea88a489a01b3e2243bb84b0ec20b8a0e28 (diff) | |
| download | rust-f52c72948aa1dd718cc1f168d21c91c584c0a662.tar.gz rust-f52c72948aa1dd718cc1f168d21c91c584c0a662.zip | |
ty: normalize fn sigs before subst
This commit normalizes function signatures for instances before substituting, a workaround for polymorphization considering parameters unused when they show up in the signature, but not the body (due to being normalized). Unfortunately, this causes test output to change with the parallel compiler only. Signed-off-by: David Wood <david@davidtw.co>
Diffstat (limited to 'src/test/ui/polymorphization')
| -rw-r--r-- | src/test/ui/polymorphization/normalized_sig_types.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/ui/polymorphization/normalized_sig_types.rs b/src/test/ui/polymorphization/normalized_sig_types.rs new file mode 100644 index 00000000000..fa76b7201e8 --- /dev/null +++ b/src/test/ui/polymorphization/normalized_sig_types.rs @@ -0,0 +1,25 @@ +// build-pass + +pub trait ParallelIterator: Sized { + fn drive<C: Consumer<()>>(_: C) { + C::into_folder(); + } +} + +pub trait Consumer<T>: Sized { + type Result; + fn into_folder() -> Self::Result; +} + +impl ParallelIterator for () {} + +impl<F: Fn(), T> Consumer<T> for F { + type Result = (); + fn into_folder() -> Self::Result { + unimplemented!() + } +} + +fn main() { + <()>::drive(|| ()); +} |
