From b13392f77151c8fe83c8ac9e4d29a24702df5f4e Mon Sep 17 00:00:00 2001 From: Jeffrey Seyfried Date: Sun, 21 May 2017 22:35:39 +0000 Subject: [PATCH] Improve `Self`. --- src/librustc_resolve/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 552023d022f..f1be821d526 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -1519,7 +1519,11 @@ impl<'a> Resolver<'a> { path_span: Span) -> Option> { if ns == TypeNS { - ident.ctxt = ident.ctxt.modern(); + ident.ctxt = if ident.name == keywords::SelfType.name() { + SyntaxContext::empty() // FIXME(jseyfried) improve `Self` hygiene + } else { + ident.ctxt.modern() + } } // Walk backwards up the ribs in scope.