diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-01-23 20:13:05 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-23 20:13:05 +0100 |
| commit | 5adef281d69b9ef4d3a7885ed9d494044767d954 (patch) | |
| tree | df5aaa5cec5a9f4e689d5181611f5e12f9613557 | |
| parent | 552b564df09f453191ef1839aeac83a915e8b503 (diff) | |
| parent | 4ff7e6e3e385f5205731737f756b5db8de7d9a93 (diff) | |
| download | rust-5adef281d69b9ef4d3a7885ed9d494044767d954.tar.gz rust-5adef281d69b9ef4d3a7885ed9d494044767d954.zip | |
Rollup merge of #93226 - compiler-errors:issue-93141, r=jackh726
Normalize field access types during borrowck I think a normalize was just left out here, since we normalize analogously throughout this file. Fixes #93141
| -rw-r--r-- | compiler/rustc_borrowck/src/type_check/mod.rs | 1 | ||||
| -rw-r--r-- | src/test/ui/generic-associated-types/issue-93141.rs | 25 |
2 files changed, 26 insertions, 0 deletions
diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs index b6f5f4998a6..73103643e3e 100644 --- a/compiler/rustc_borrowck/src/type_check/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/mod.rs @@ -758,6 +758,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> { }, ProjectionElem::Field(field, fty) => { let fty = self.sanitize_type(place, fty); + let fty = self.cx.normalize(fty, location); match self.field_ty(place, base, field, location) { Ok(ty) => { let ty = self.cx.normalize(ty, location); diff --git a/src/test/ui/generic-associated-types/issue-93141.rs b/src/test/ui/generic-associated-types/issue-93141.rs new file mode 100644 index 00000000000..39ca77d13db --- /dev/null +++ b/src/test/ui/generic-associated-types/issue-93141.rs @@ -0,0 +1,25 @@ +// check-pass + +#![feature(generic_associated_types)] + +pub trait Fooey: Sized { + type Context<'c> where Self: 'c; +} + +pub struct Handle<E: Fooey>(Option<Box<dyn for<'c> Fn(&mut E::Context<'c>)>>); + +fn tuple<T>() -> (Option<T>,) { (Option::None,) } + +pub struct FooImpl {} +impl Fooey for FooImpl { + type Context<'c> = &'c (); +} + +impl FooImpl { + pub fn fail1() -> Handle<Self> { + let (tx,) = tuple(); + Handle(tx) + } +} + +fn main() {} |
