rust/compiler
Matthias Krüger 665a1a4b55
Rollup merge of #128865 - jieyouxu:unicurd, r=Urgau
Ensure let stmt compound assignment removal suggestion respect codepoint boundaries

Previously we would try to issue a suggestion for `let x <op>= 1`, i.e.
a compound assignment within a `let` binding, to remove the `<op>`. The
suggestion code unfortunately incorrectly assumed that the `<op>` is an
exactly-1-byte ASCII character, but this assumption is incorrect because
we also recover Unicode-confusables like `=` as `-=`. In this example,
the suggestion code used a `+ BytePos(1)` to calculate the span of the
`<op>` codepoint that looks like `-` but the mult-byte Unicode
look-alike would cause the suggested removal span to be inside a
multi-byte codepoint boundary, triggering a codepoint boundary
assertion.

The fix is to use `SourceMap::start_point(token_span)` which properly accounts for codepoint boundaries.

Fixes #128845.

cc #128790

r? ````@fmease````
2024-08-09 18:25:00 +02:00
..
rustc The rustc crate feature is called jemalloc 2024-07-15 13:01:20 -04:00
rustc_abi interpret: simplify pointer arithmetic logic 2024-08-01 14:25:19 +02:00
rustc_arena Reformat `use` declarations. 2024-07-29 08:26:52 +10:00
rustc_ast Reformat `use` declarations. 2024-07-29 08:26:52 +10:00
rustc_ast_ir Use dep: for crate dependencies 2024-07-15 12:40:10 -04:00
rustc_ast_lowering minor `effects` cleanups 2024-07-31 03:29:10 +00:00
rustc_ast_passes Rollup merge of #127921 - spastorino:stabilize-unsafe-extern-blocks, r=compiler-errors 2024-08-03 20:51:51 +02:00
rustc_ast_pretty Reformat `use` declarations. 2024-07-29 08:26:52 +10:00
rustc_attr Rollup merge of #128341 - Alexendoo:parse-version-pub, r=compiler-errors 2024-07-29 17:46:44 +02:00
rustc_baked_icu_data Use `tidy` to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_borrowck use stable sort to sort multipart diagnostics 2024-08-09 09:45:01 +02:00
rustc_builtin_macros Make `Span` optional in `BufferedEarlyLint` 2024-08-07 14:08:34 +02:00
rustc_codegen_cranelift Rename struct_tail_erasing_lifetimes to struct_tail_for_codegen 2024-08-08 12:15:16 -04:00
rustc_codegen_gcc Update compiler-builtins version to 0.1.118 2024-08-08 14:47:49 +02:00
rustc_codegen_llvm Rename struct_tail_erasing_lifetimes to struct_tail_for_codegen 2024-08-08 12:15:16 -04:00
rustc_codegen_ssa Rename struct_tail_erasing_lifetimes to struct_tail_for_codegen 2024-08-08 12:15:16 -04:00
rustc_const_eval Rename struct_tail_erasing_lifetimes to struct_tail_for_codegen 2024-08-08 12:15:16 -04:00
rustc_data_structures Tweak wording 2024-08-08 21:51:50 +02:00
rustc_driver Use `tidy` to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_driver_impl Add -Zerror-metrics=PATH to save diagnostic metadata to disk 2024-08-07 11:16:55 -07:00
rustc_error_codes Update E0517 message to reflect RFC 2195. 2024-08-07 23:11:30 -05:00
rustc_error_messages Reformat `use` declarations. 2024-07-29 08:26:52 +10:00
rustc_errors Rollup merge of #128852 - folkertdev:multipart-suggestion-stable-sort, r=compiler-errors 2024-08-09 18:24:58 +02:00
rustc_expand refactor(rustc_expand::mbe): Don't require full ExtCtxt when not necessary 2024-08-07 21:58:05 +02:00
rustc_feature Rollup merge of #127655 - RalfJung:invalid_type_param_default, r=compiler-errors 2024-08-05 05:40:19 +02:00
rustc_fluent_macro Reformat `use` declarations. 2024-07-29 08:26:52 +10:00
rustc_fs_util Reformat `use` declarations. 2024-07-29 08:26:52 +10:00
rustc_graphviz Reformat `use` declarations. 2024-07-29 08:26:52 +10:00
rustc_hir Rollup merge of #128377 - veera-sivarajan:fix-128249, r=davidtwco 2024-08-06 20:23:39 +02:00
rustc_hir_analysis Rename struct_tail_erasing_lifetimes to struct_tail_for_codegen 2024-08-08 12:15:16 -04:00
rustc_hir_pretty Reformat `use` declarations. 2024-07-29 08:26:52 +10:00
rustc_hir_typeck Rollup merge of #128864 - jieyouxu:funnicode, r=Urgau 2024-08-09 18:24:59 +02:00
rustc_incremental Reformat `use` declarations. 2024-07-29 08:26:52 +10:00
rustc_index Reformat `use` declarations. 2024-07-29 08:26:52 +10:00
rustc_index_macros Remove usage of specialization from newtype_index! 2024-06-30 16:42:53 +00:00
rustc_infer Use Vec in instantiate_binder_with_fresh_vars 2024-07-29 14:38:33 +03:00
rustc_interface Rollup merge of #128851 - compiler-errors:validate-mir-opt-mir, r=matthiaskrgr 2024-08-09 00:03:39 +02:00
rustc_lexer Reformat `use` declarations. 2024-07-29 08:26:52 +10:00
rustc_lint Auto merge of #128796 - matthiaskrgr:rollup-r7l68ph, r=matthiaskrgr 2024-08-07 20:00:29 +00:00
rustc_lint_defs Disallow setting built-in cfgs via set the command-line 2024-08-07 14:08:34 +02:00
rustc_llvm Disable MC/DC tests on LLVM 19 2024-07-30 10:22:48 +02:00
rustc_log Reformat `use` declarations. 2024-07-29 08:26:52 +10:00
rustc_macros Reformat `use` declarations. 2024-07-29 08:26:52 +10:00
rustc_metadata Reformat `use` declarations. 2024-07-29 08:26:52 +10:00
rustc_middle Auto merge of #128703 - compiler-errors:normalizing-tails, r=lcnr 2024-08-09 11:36:01 +00:00
rustc_mir_build Disallow enabling features without their implied features 2024-08-07 00:45:00 -04:00
rustc_mir_dataflow Stop using MoveDataParamEnv for places that don't need a param-env 2024-07-29 11:59:47 -04:00
rustc_mir_transform Don't inline tainted MIR bodies 2024-08-08 20:53:25 -04:00
rustc_monomorphize Rename struct_tail_erasing_lifetimes to struct_tail_for_codegen 2024-08-08 12:15:16 -04:00
rustc_next_trait_solver Don't implement AsyncFn for FnDef/FnPtr that wouldnt implement Fn 2024-08-08 14:07:31 -04:00
rustc_parse parser: ensure let stmt compound assignment removal suggestion respect codepoint boundaries 2024-08-09 05:56:50 +00:00
rustc_parse_format Reformat `use` declarations. 2024-07-29 08:26:52 +10:00
rustc_passes Rollup merge of #128552 - s7tya:check-no-sanitize-attribute-pos, r=BoxyUwU 2024-08-07 20:49:02 -05:00
rustc_pattern_analysis Use a separate pattern type for `rustc_pattern_analysis` diagnostics 2024-07-31 16:03:27 +10:00
rustc_privacy Reformat `use` declarations. 2024-07-29 08:26:52 +10:00
rustc_query_impl Reformat `use` declarations. 2024-07-29 08:26:52 +10:00
rustc_query_system chore: use shorthand initializer 2024-08-02 13:22:28 -04:00
rustc_resolve rm `declared_features` field in resolver 2024-08-08 20:30:20 +08:00
rustc_sanitizers Use ParamEnv::reveal_all in CFI 2024-08-02 23:24:50 -04:00
rustc_serialize Reformat `use` declarations. 2024-07-29 08:26:52 +10:00
rustc_session Rollup merge of #128806 - estebank:color-config, r=jieyouxu 2024-08-09 00:03:36 +02:00
rustc_smir Reformat `use` declarations. 2024-07-29 08:26:52 +10:00
rustc_span Rollup merge of #125048 - dingxiangfei2009:stable-deref, r=amanieu 2024-08-07 00:34:11 +02:00
rustc_symbol_mangling Reformat `use` declarations. 2024-07-29 08:26:52 +10:00
rustc_target Fix typo 2024-08-07 00:43:56 -04:00
rustc_trait_selection Rollup merge of #128791 - compiler-errors:async-fn-unsafe, r=lcnr 2024-08-09 00:03:36 +02:00
rustc_traits Reformat `use` declarations. 2024-07-29 08:26:52 +10:00
rustc_transmute Reformat `use` declarations. 2024-07-29 08:26:52 +10:00
rustc_ty_utils Rename struct_tail_erasing_lifetimes to struct_tail_for_codegen 2024-08-08 12:15:16 -04:00
rustc_type_ir Auto merge of #128689 - matthiaskrgr:rollup-ukyn8wq, r=matthiaskrgr 2024-08-05 17:03:58 +00:00
rustc_type_ir_macros Reformat `use` declarations. 2024-07-29 08:26:52 +10:00
stable_mir Reformat `use` declarations. 2024-07-29 08:26:52 +10:00