Skip to content

Commit

Permalink
Parse - Handle $:ty in use
Browse files Browse the repository at this point in the history
  • Loading branch information
thepowersgang committed Jun 22, 2024
1 parent b0d67c0 commit baee367
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Notes/UpgradeQuirks.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,4 @@
- `TypeVisitable` only implies `Clone`, not `Copy`
- So, rustc is skipping the `fn iter` and using the `Deref<Target=[T]>` impl and ending up at slice's `iter`
- mrustc picks the top level one, becuase impl bounds don't restrict method resolution.

- `use $ty::*;` - where `$ty:ty` in a `macro_rules`
11 changes: 11 additions & 0 deletions src/parse/root.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1531,6 +1531,17 @@ void Parse_Use_Root(TokenStream& lex, ::std::vector<AST::UseItem::Ent>& entries)
}
GET_CHECK_TOK(tok, lex, TOK_DOUBLE_COLON);
break;
case TOK_INTERPOLATED_TYPE: {
if( !tok.frag_type().is_path() ) {
throw ParseError::Unexpected(lex, tok);
}
auto& p = tok.frag_type().path();
if( p.m_class.is_UFCS() ) {
throw ParseError::Unexpected(lex, tok);
}
path = std::move(tok.frag_type().path());
GET_CHECK_TOK(tok, lex, TOK_DOUBLE_COLON);
} break;
case TOK_INTERPOLATED_PATH:
path = mv$(tok.frag_path());
GET_CHECK_TOK(tok, lex, TOK_DOUBLE_COLON);
Expand Down

0 comments on commit baee367

Please sign in to comment.