summaryrefslogtreecommitdiff
path: root/tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs
diff options
context:
space:
mode:
authornils <48135649+Nilstrieb@users.noreply.github.com>2023-03-28 12:51:13 +0200
committerGitHub <noreply@github.com>2023-03-28 12:51:13 +0200
commit7e90732abe9da454a7177971c55fa069c8d56e8d (patch)
treeca189cdc2109dc2e275ff4f897ce9e9870d50d07 /tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs
parent64710790d6ce6fce7aa33a07932fb46bdf54d7b3 (diff)
parent5456eecab0eb17bd34d3368db3bc6002ba619a64 (diff)
downloadrust-7e90732abe9da454a7177971c55fa069c8d56e8d.tar.gz
Rollup merge of #109470 - compiler-errors:gat-normalize-bound, r=jackh726
Correctly substitute GAT's type used in `normalize_param_env` in `check_type_bounds` Given: ```rust trait Foo { type Assoc<T>: PartialEq<Self::Assoc<i32>>; } impl Foo for () { type Assoc<T> = Wrapper<T>; } struct Wrapper<T>(T); impl<T> PartialEq<Wrapper<i32>> for Wrapper<T> { } ``` We add an additional predicate in the `normalize_param_env` in `check_type_bounds` that is used to normalize the GAT's bounds to check them in the impl. Problematically, though, that predicate is constructed to be `for<^0> <() as Foo>::Assoc<^0> => Wrapper<T>`, instead of `for<^0> <() as Foo>::Assoc<^0> => Wrapper<^0>`. That means `Self::Assoc<i32>` in the bounds that we're checking normalizes to `Wrapper<T>`, instead of `Wrapper<i32>`, and so the bound `Self::Assoc<T>: PartialEq<Self::Assoc<i32>>` normalizes to `Wrapper<T>: PartialEq<Wrapper<T>>`, which does not hold. Fixes this by properly substituting the RHS of that normalizes predicate that we add to the `normalize_param_env`. That means the bound is properly normalized to `Wrapper<T>: PartialEq<Wrapper<i32>>`, which *does* hold. --- The second commit in this PR just cleans up some substs stuff and some naming. r? `@jackh726` cc #87900
Diffstat (limited to 'tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs')
0 files changed, 0 insertions, 0 deletions