File tree 3 files changed +27
-3
lines changed
3 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -192,8 +192,11 @@ impl Translate for BufferEmitter {
192
192
impl Emitter for BufferEmitter {
193
193
fn emit_diagnostic ( & mut self , diag : & Diagnostic ) {
194
194
let mut buffer = self . buffer . borrow_mut ( ) ;
195
- // FIXME(davidtwco): need to support translation here eventually
196
- buffer. messages . push ( format ! ( "error from rustc: {}" , diag. message[ 0 ] . 0 . expect_str( ) ) ) ;
195
+
196
+ let fluent_args = self . to_fluent_args ( diag. args ( ) ) ;
197
+ let translated_main_message = self . translate_message ( & diag. message [ 0 ] . 0 , & fluent_args) ;
198
+
199
+ buffer. messages . push ( format ! ( "error from rustc: {}" , translated_main_message) ) ;
197
200
if diag. is_error ( ) {
198
201
buffer. has_errors = true ;
199
202
}
Original file line number Diff line number Diff line change @@ -99,3 +99,9 @@ pub fn indent_after_fenced() {}
99
99
/// ```
100
100
pub fn invalid ( ) { }
101
101
//~^^^^ WARNING could not parse code block as Rust code
102
+
103
+ /// ```
104
+ /// fn wook_at_my_beautifuw_bwaces_plz() {);
105
+ /// ```
106
+ pub fn uwu ( ) { }
107
+ //~^^^^ WARNING could not parse code block as Rust code
Original file line number Diff line number Diff line change @@ -150,5 +150,20 @@ help: mark blocks that do not contain Rust code as text
150
150
LL | /// ```text
151
151
| ++++
152
152
153
- warning: 12 warnings emitted
153
+ warning: could not parse code block as Rust code
154
+ --> $DIR/invalid-syntax.rs:103:5
155
+ |
156
+ LL | /// ```
157
+ | _____^
158
+ LL | | /// fn wook_at_my_beautifuw_bwaces_plz() {);
159
+ LL | | /// ```
160
+ | |_______^
161
+ |
162
+ = note: error from rustc: mismatched closing delimiter: `)`
163
+ help: mark blocks that do not contain Rust code as text
164
+ |
165
+ LL | /// ```text
166
+ | ++++
167
+
168
+ warning: 13 warnings emitted
154
169
You can’t perform that action at this time.
0 commit comments