about summary refs log tree commit diff
path: root/compiler/rustc_fluent_macro
diff options
context:
space:
mode:
authorXiretza <xiretza@xiretza.xyz>2024-08-19 07:46:17 +0000
committerXiretza <xiretza@xiretza.xyz>2024-09-17 14:49:33 +0000
commit5b3bde953ed70df2f22650f77cf5c13a4dc15836 (patch)
tree25ccaeb209bd81fced50cd97778568f7df10cb9d /compiler/rustc_fluent_macro
parent0a253246f73eb72f14fb218867b6ace3014e0286 (diff)
downloadrust-5b3bde953ed70df2f22650f77cf5c13a4dc15836.tar.gz
rust-5b3bde953ed70df2f22650f77cf5c13a4dc15836.zip
fluent_macro: fix diagnostics for fluent parse failures
This line number calculation was both wrong and unnecessary.
Diffstat (limited to 'compiler/rustc_fluent_macro')
-rw-r--r--compiler/rustc_fluent_macro/src/fluent.rs17
1 files changed, 0 insertions, 17 deletions
diff --git a/compiler/rustc_fluent_macro/src/fluent.rs b/compiler/rustc_fluent_macro/src/fluent.rs
index ca8bace28f3..37e610a85a6 100644
--- a/compiler/rustc_fluent_macro/src/fluent.rs
+++ b/compiler/rustc_fluent_macro/src/fluent.rs
@@ -138,25 +138,8 @@ pub(crate) fn fluent_messages(input: proc_macro::TokenStream) -> proc_macro::Tok
                 // with a lowercase as rustc errors do.
                 err.replace_range(0..1, &err.chars().next().unwrap().to_lowercase().to_string());
 
-                let line_starts: Vec<usize> = std::iter::once(0)
-                    .chain(
-                        this.source()
-                            .char_indices()
-                            .filter_map(|(i, c)| Some(i + 1).filter(|_| c == '\n')),
-                    )
-                    .collect();
-                let line_start = line_starts
-                    .iter()
-                    .enumerate()
-                    .map(|(line, idx)| (line + 1, idx))
-                    .filter(|(_, idx)| **idx <= pos.start)
-                    .last()
-                    .unwrap()
-                    .0;
-
                 let message = annotate_snippets::Level::Error.title(&err).snippet(
                     Snippet::source(this.source())
-                        .line_start(line_start)
                         .origin(&relative_ftl_path)
                         .fold(true)
                         .annotation(annotate_snippets::Level::Error.span(pos.start..pos.end - 1)),