rust/compiler
Sasha f6d18db402 Use string literal directly when available in format
Previous implementation used the `Parser::parse_expr` function in order
to extract the format expression. If the first comma following the
format expression was mistakenly replaced with a dot, then the next
format expression was eaten by the function, because it looked as a
syntactically valid expression, which resulted in incorrectly spanned
error messages.

The way the format expression is exctracted is changed: we first look at
the first available token in the first argument supplied to the
`format!` macro call. If it is a string literal, then it is promoted as
a format expression immediatly, otherwise we fall back to the original
`parse_expr`-related method.

This allows us to ensure that the parser won't consume too much tokens
when a typo is made.

A test has been created so that it is ensured that the issue is properly
fixed.
2020-08-30 22:09:58 +02:00
..
rustc mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_apfloat mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_arena mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_ast mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_ast_lowering mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_ast_passes mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_ast_pretty mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_attr mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_builtin_macros Use string literal directly when available in format 2020-08-30 22:09:58 +02:00
rustc_codegen_llvm mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_codegen_ssa mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_data_structures mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_driver mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_error_codes mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_errors mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_expand mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_feature mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_fs_util mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_graphviz mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_hir mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_hir_pretty mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_incremental mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_index mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_infer mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_interface mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_lexer mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_lint mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_macros mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_metadata mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_middle mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_mir mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_mir_build mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_parse Use string literal directly when available in format 2020-08-30 22:09:58 +02:00
rustc_parse_format mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_passes mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_plugin_impl mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_privacy mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_query_system mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_resolve mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_save_analysis mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_serialize mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_session mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_span mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_symbol_mangling mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_target mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_trait_selection mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_traits mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_ty mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_typeck mv compiler to compiler/ 2020-08-30 18:45:07 +03:00