Skip to content

Commit 97fb15d

Browse files
committed
Don't emit the OS error in a note
This makes it possible to make the normalization of the error message more precise, allowing us to not normalize all notes away.
1 parent f249832 commit 97fb15d

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

compiler/rustc_macros/src/diagnostics/fluent.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,12 @@ pub(crate) fn fluent_messages(input: proc_macro::TokenStream) -> proc_macro::Tok
9797
let resource_contents = match read_to_string(absolute_ftl_path) {
9898
Ok(resource_contents) => resource_contents,
9999
Err(e) => {
100-
Diagnostic::spanned(resource_span, Level::Error, "could not open Fluent resource")
101-
.note(e.to_string())
102-
.emit();
100+
Diagnostic::spanned(
101+
resource_span,
102+
Level::Error,
103+
format!("could not open Fluent resource: {}", e.to_string()),
104+
)
105+
.emit();
103106
return failed(&crate_name);
104107
}
105108
};

tests/ui-fulldeps/fluent-messages/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// normalize-stderr-test "note.*" -> "note: os-specific message"
1+
// normalize-stderr-test "could not open Fluent resource:.*" -> "could not open Fluent resource: os-specific message"
22

33
#![feature(rustc_private)]
44
#![crate_type = "lib"]

tests/ui-fulldeps/fluent-messages/test.stderr

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
1-
error: could not open Fluent resource
1+
error: could not open Fluent resource: os-specific message
22
--> $DIR/test.rs:24:24
33
|
44
LL | fluent_messages! { "/definitely_does_not_exist.ftl" }
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6-
|
7-
= note: os-specific message
86

9-
error: could not open Fluent resource
7+
error: could not open Fluent resource: os-specific message
108
--> $DIR/test.rs:31:24
119
|
1210
LL | fluent_messages! { "../definitely_does_not_exist.ftl" }
1311
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14-
|
15-
= note: os-specific message
1612

1713
error: could not parse Fluent resource
1814
--> $DIR/test.rs:38:24
@@ -89,23 +85,23 @@ error: invalid escape `\n` in Fluent resource
8985
LL | fluent_messages! { "./invalid-escape.ftl" }
9086
| ^^^^^^^^^^^^^^^^^^^^^^
9187
|
92-
= note: os-specific message
88+
= note: Fluent does not interpret these escape sequences (<https://projectfluent.org/fluent/guide/special.html>)
9389

9490
error: invalid escape `\"` in Fluent resource
9591
--> $DIR/test.rs:99:24
9692
|
9793
LL | fluent_messages! { "./invalid-escape.ftl" }
9894
| ^^^^^^^^^^^^^^^^^^^^^^
9995
|
100-
= note: os-specific message
96+
= note: Fluent does not interpret these escape sequences (<https://projectfluent.org/fluent/guide/special.html>)
10197

10298
error: invalid escape `\'` in Fluent resource
10399
--> $DIR/test.rs:99:24
104100
|
105101
LL | fluent_messages! { "./invalid-escape.ftl" }
106102
| ^^^^^^^^^^^^^^^^^^^^^^
107103
|
108-
= note: os-specific message
104+
= note: Fluent does not interpret these escape sequences (<https://projectfluent.org/fluent/guide/special.html>)
109105

110106
error: aborting due to 13 previous errors
111107

0 commit comments

Comments
 (0)