11 Commits

Author SHA1 Message Date
Vadim Petrochenkov
46f48d31fe rustc_ast: Stop using "string typing" for doc comment tokens
Explicitly store their kind and style retrieved during lexing in the token
2020-08-06 22:13:11 +03:00
Aaron Hill
28946b3486
Track span of function in method calls, and use this in #[track_caller]
Fixes #69977

When we parse a chain of method calls like `foo.a().b().c()`, each
`MethodCallExpr` gets assigned a span that starts at the beginning of
the call chain (`foo`). While this is useful for diagnostics, it means
that `Location::caller` will return the same location for every call
in a call chain.

This PR makes us separately record the span of the function name and
arguments for a method call (e.g. `b()` in `foo.a().b().c()`). This
`Span` is passed through HIR lowering and MIR building to
`TerminatorKind::Call`, where it is used in preference to
`Terminator.source_info.span` when determining `Location::caller`.

This new span is also useful for diagnostics where we want to emphasize
a particular method call - for an example, see
https://github.com/rust-lang/rust/pull/72389#discussion_r436035990
2020-06-10 17:30:11 -04:00
Amanieu d'Antras
813a9fc4f1 Add asm! to AST 2020-05-18 14:39:54 +01:00
Camille GILLOT
d4e143ed2f Remove ast::{Ident, Name} reexports. 2020-05-08 13:13:15 +02:00
Mazdak Farrokhzad
91194f795c parse: move constraint/arg restriction to ast_validation. 2020-03-27 07:39:14 +01:00
Amanieu d'Antras
d162d096dd Rename asm! to llvm_asm!
asm! is left as a wrapper around llvm_asm! to maintain compatibility.
2020-03-26 15:49:22 +00:00
Vadim Petrochenkov
e809e0214e ast: Mac/Macro -> MacCall 2020-03-12 22:26:52 +03:00
bors
4a1b69d53a Auto merge of #69586 - petrochenkov:unmerge, r=Centril
ast: Unmerge structures for associated items and foreign items

Follow-up to https://github.com/rust-lang/rust/pull/69194.
r? @Centril
2020-03-06 02:22:49 +00:00
Mazdak Farrokhzad
176fe3f8ac encode ; stmt w/o expr as StmtKind::Empty 2020-03-01 23:02:17 +01:00
Vadim Petrochenkov
857e34c7a3 ast: Unmerge structures for associated items and foreign items 2020-03-01 13:47:48 +03:00
Vadim Petrochenkov
e94d3b70cb Move directory libsyntax -> librustc_ast 2020-02-29 20:47:10 +03:00