Skip to content

Commit fb4134e

Browse files
committed
Ensure defaults are normalized after application
Thanks to @eddyb for bringing this bug to my attention.
1 parent 8b00850 commit fb4134e

File tree

1 file changed

+4
-2
lines changed
  • src/librustc_typeck/check

1 file changed

+4
-2
lines changed

src/librustc_typeck/check/mod.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1876,9 +1876,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
18761876
let _ = self.infcx().commit_if_ok(|_: &infer::CombinedSnapshot| {
18771877
for &(ref ty, ref default) in &has_user_default {
18781878
let default = default.clone();
1879+
let normalized_default = self.inh.normalize_associated_types_in(codemap::DUMMY_SP, 0, &default.ty);
18791880
match infer::mk_eqty(self.infcx(), false,
18801881
infer::Misc(codemap::DUMMY_SP), // default.origin_span),
1881-
ty, default.ty) {
1882+
ty, normalized_default) {
18821883
Ok(()) => {}
18831884
Err(_) => {
18841885
conflicts.push((*ty, default));
@@ -1975,9 +1976,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
19751976
// reporting for more then one conflict.
19761977
for &(ref ty, ref default) in tys_with_defaults {
19771978
let default = default.clone();
1979+
let normalized_default = self.inh.normalize_associated_types_in(codemap::DUMMY_SP, 0, &default.ty);
19781980
match infer::mk_eqty(self.infcx(), false,
19791981
infer::Misc(codemap::DUMMY_SP), // default.origin_span),
1980-
ty, default.ty) {
1982+
ty, normalized_default) {
19811983
Ok(()) => {}
19821984
Err(_) => {
19831985
result = Some(default);

0 commit comments

Comments
 (0)