summary refs log tree commit diff
path: root/src/librustc_ast_lowering/expr.rs
AgeCommit message (Collapse)AuthorLines
2020-05-30Rollup merge of #72625 - Amanieu:asm-srcloc, r=petrochenkovRalf Jung-1/+2
Improve inline asm error diagnostics Previously we were just using the raw LLVM error output (with line, caret, etc) as the diagnostic message, which ends up looking rather out of place with our existing diagnostics. The new diagnostics properly format the diagnostics and also take advantage of LLVM's per-line `srcloc` attribute to map an error in inline assembly directly to the relevant line of source code. Incidentally also fixes #71639 by disabling `srcloc` metadata during LTO builds since we don't know what crate it might have come from. We can only resolve `srcloc`s from the currently crate since it indexes into the source map for the current crate. Fixes #72664 Fixes #71639 r? @petrochenkov ### Old style ```rust #![feature(llvm_asm)] fn main() { unsafe { let _x: i32; llvm_asm!( "mov $0, $1 invalid_instruction $0, $1 mov $0, $1" : "=&r" (_x) : "r" (0) :: "intel" ); } } ``` ``` error: <inline asm>:3:14: error: invalid instruction mnemonic 'invalid_instruction' invalid_instruction ecx, eax ^~~~~~~~~~~~~~~~~~~ --> src/main.rs:6:9 | 6 | / llvm_asm!( 7 | | "mov $0, $1 8 | | invalid_instruction $0, $1 9 | | mov $0, $1" ... | 12 | | :: "intel" 13 | | ); | |__________^ ``` ### New style ```rust #![feature(asm)] fn main() { unsafe { asm!( "mov {0}, {1} invalid_instruction {0}, {1} mov {0}, {1}", out(reg) _, in(reg) 0i64, ); } } ``` ``` error: invalid instruction mnemonic 'invalid_instruction' --> test.rs:7:14 | 7 | invalid_instruction {0}, {1} | ^ | note: instantiated into assembly here --> <inline asm>:3:14 | 3 | invalid_instruction rax, rcx | ^^^^^^^^^^^^^^^^^^^ ```
2020-05-29Improve inline asm error diagnosticsAmanieu d'Antras-1/+2
2020-05-26Update src/librustc_ast_lowering/expr.rsAmanieu d'Antras-1/+1
Co-authored-by: Oliver Scherer <github35764891676564198441@oli-obk.de>
2020-05-26Eagerly lower asm sub-expressions to HIR even if there is an errorAmanieu d'Antras-33/+35
Fixes #72570
2020-05-20Rollup merge of #72275 - marmeladema:fix-issue-71104-2, r=ecstatic-morseDylan DPC-1/+0
Continue lowering for unsupported async generator instead of returning an error. This way the hir is "valid" and we can remove one more call to `opt_node_id_to_hir_id` but an error is still emitted. This is another partial fix for #71104 r? @eddyb
2020-05-18Move InlineAsmTemplatePiece and InlineAsmOptions to librustc_astAmanieu d'Antras-2/+2
2020-05-18Implement att_syntax optionAmanieu d'Antras-0/+9
2020-05-18Implement AST lowering for asm!Amanieu d'Antras-2/+294
2020-05-16Continue lowering for unsupported async generator instead of returning an error.marmeladema-1/+0
This way the hir is "valid" and we can remove one more call to `opt_node_id_to_hir_id` but an error is still emitted. This is another partial fix for #71104
2020-05-08Remove ast::{Ident, Name} reexports.Camille GILLOT-1/+1
2020-05-02Move ensure_sufficient_stack to data_structuresSimonas Kazlauskas-1/+1
We anticipate this to have uses in all sorts of crates and keeping it in `rustc_data_structures` enables access to it from more locations without necessarily pulling in the large `librustc` crate.
2020-05-02Prevent stack overflow for deeply recursive codeOliver Scherer-176/+191
2020-04-24Use correct span on while (let) loweringflip1995-6/+2
2020-04-16Auto merge of #70831 - sfackler:shrink-future-stack, r=matthewjasperbors-11/+34
Remove a stack frame from .await calls The stack frames when `.await`ing one async fn from another currently look like this: ``` 12: foo::b::{{closure}} at src/main.rs:2 13: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll at /home/sfackler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/future/mod.rs:66 14: core::future::poll_with_context at /home/sfackler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/future/mod.rs:84 15: foo::a::{{closure}} at src/main.rs:6 ``` Since the move away from using TLS to pass the Context around, it's now easy to remove frame 14 by removing poll_with_context in favor of calling Future::poll directly. This still leaves the `GenFuture` frame, but that seems significantly harder to deal with. It also improves diagnostics a bit since they no longer talk about the private poll_with_context function.
2020-04-13Use clearer message when obligation is caused by await exprTyler Mandry-2/+2
2020-04-05Remove a stack frame from .await callsSteven Fackler-11/+34
2020-03-26Rename asm! to llvm_asm!Amanieu d'Antras-6/+6
asm! is left as a wrapper around llvm_asm! to maintain compatibility.
2020-03-21lowering: bug! -> panic!Mazdak Farrokhzad-2/+1
2020-03-17Don't create AST fragments when lowering to HIRJonas Schievink-29/+33
2020-03-17Split up large `FnDecl` expressionJonas Schievink-14/+13
2020-03-17Improve comments in HIR lowering codeJonas Schievink-2/+3
2020-03-17FormatJonas Schievink-7/+3
2020-03-17Make async/await lowering use resume argumentsJonas Schievink-19/+76
2020-03-12ast: `Mac`/`Macro` -> `MacCall`Vadim Petrochenkov-1/+1
2020-03-01Rollup merge of #69580 - matthiaskrgr:map_clone, r=CentrilYuki Okushi-1/+1
use .copied() instead of .map(|x| *x) on iterators
2020-02-29Rename `syntax` to `rustc_ast` in source codeVadim Petrochenkov-4/+4
2020-02-29use .copied() instead of .map(|x| *x) on iteratorsMatthias Krüger-1/+1
2020-02-27don't use .into() to convert types into identical types.Matthias Krüger-4/+3
example: let s: String = format!("hello").into();
2020-02-17Rename `FunctionRetTy` to `FnRetTy`Yuki Okushi-4/+4
2020-02-13IsAsync -> enum Async { Yes { span: Span, .. }, No }Mazdak Farrokhzad-1/+1
use new span for better diagnostics.
2020-02-04Update error message with too many parametersJonas Schievink-1/+1
2020-02-02Allow 0 or 1 explicit generator parametersJonas Schievink-2/+2
2020-01-21lowering: cleanup some hofsMazdak Farrokhzad-12/+3
2020-01-18remove rustc_error_codes deps except in rustc_driverMazdak Farrokhzad-1/+0
2020-01-16don't clone types that are copyMatthias Krüger-3/+3
found via clippy
2020-01-10Fix ICE #68058Yuki Okushi-1/+6
2020-01-08- remove syntax::{span_warn!, span_err!, span_fatal!. struct_err!}Mazdak Farrokhzad-5/+13
- remove syntax::{help!, span_help!, span_note!} - remove unused syntax::{struct_span_fatal, struct_span_err_or_warn!, span_err_or_warn!} - lintify check_for_bindings_named_same_as_variants + conflicting_repr_hints - inline syntax::{struct_span_warn!, diagnostic_used!} - stringify_error_code! -> error_code! & use it more. - find_plugin_registrar: de-fatalize an error - de-fatalize metadata errors - move type_error_struct! to rustc_typeck - struct_span_err! -> rustc_errors
2020-01-05Remove rustc_hir reexports in rustc::hir.Mazdak Farrokhzad-2/+2
2020-01-05simplify reexports in rustc::hirMazdak Farrokhzad-4/+4
2019-12-31Revert "core: add IntoFuture trait and support for await"Wesley Wiser-20/+4
This reverts commit f35517ee861dc012ccc26083dd4520045e2c4f6f.
2019-12-31nix `lower_label` identity function.Mazdak Farrokhzad-21/+7
2019-12-31librustc_ast_lowering: fix misc fallout.Mazdak Farrokhzad-9/+9
2019-12-31librustc_ast_lowering: move the files.Mazdak Farrokhzad-0/+1454