rust/compiler/rustc_builtin_macros/src
Matthias Krüger b4266b0bcd
Rollup merge of #135557 - estebank:wtf8, r=fee1-dead
Point at invalid utf-8 span on user's source code

```
error: couldn't read `$DIR/not-utf8-bin-file.rs`: stream did not contain valid UTF-8
  --> $DIR/not-utf8-2.rs:6:5
   |
LL |     include!("not-utf8-bin-file.rs");
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: byte `193` is not valid utf-8
  --> $DIR/not-utf8-bin-file.rs:2:14
   |
LL |     let _ = "�|�␂!5�cc␕␂��";
   |              ^
   = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info)
```

When we attempt to load a Rust source code file, if there is a OS file failure we try reading the file as bytes. If that succeeds we try to turn it into UTF-8. If *that* fails, we provide additional context about *where* the file has the first invalid UTF-8 character.

Fix #76869.
2025-01-22 20:37:24 +01:00
..
assert Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
deriving Use E0665 for missing #[default] error 2024-12-21 19:14:58 +00:00
format_foreign Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
alloc_error_handler.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
asm.rs Account for format_args in HiddenUnicodeCodepoints lint 2024-12-31 05:03:22 +00:00
assert.rs Speed up Parser::expected_token_types. 2024-12-19 16:05:41 +11:00
autodiff.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
cfg.rs Speed up Parser::expected_token_types. 2024-12-19 16:05:41 +11:00
cfg_accessible.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
cfg_eval.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
cmdline_attrs.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
compile_error.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
concat.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
concat_bytes.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
concat_idents.rs Rollup merge of #134161 - nnethercote:overhaul-token-cursors, r=spastorino 2024-12-18 22:56:53 +08:00
derive.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
edition_panic.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
env.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
errors.rs add suggestion for wrongly ordered format parameters 2024-12-30 06:14:26 -08:00
format.rs Rollup merge of #134877 - DavisRayM:129966-format-string-help-message, r=estebank 2025-01-01 16:35:30 +11:00
format_foreign.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
global_allocator.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
lib.rs Point at invalid utf-8 span on user's source code 2025-01-22 00:52:27 +00:00
log_syntax.rs Adjust some pubs. 2024-04-26 13:29:20 +10:00
pattern_type.rs Speed up Parser::expected_token_types. 2024-12-19 16:05:41 +11:00
proc_macro_harness.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
source_util.rs Point at invalid utf-8 span on user's source code 2025-01-22 00:52:27 +00:00
standard_library_imports.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
test.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
test_harness.rs remove support for the #[start] attribute 2025-01-21 06:59:15 -07:00
trace_macros.rs Rollup merge of #134161 - nnethercote:overhaul-token-cursors, r=spastorino 2024-12-18 22:56:53 +08:00
util.rs Account for format_args in HiddenUnicodeCodepoints lint 2024-12-31 05:03:22 +00:00