You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Badly behaved Encode and Decode impls for FileMap #42374
The impls added in #22235 violate some assumptions in libserialize by trying to serialize multiple values for the "lines" field. When decoding, it ends up hitting this unwrap.
thread 'main' panicked at 'assertion failed: sentinel == STR_SENTINEL', /rustc/70b3681bf621bc0de91ffab711b2350068b4c466/compiler/rustc_serialize/src/opaque.rs:656:9
stack backtrace:
0: rust_begin_unwind
at /rustc/70b3681bf621bc0de91ffab711b2350068b4c466/library/std/src/panicking.rs:584:5
1: core::panicking::panic_fmt
at /rustc/70b3681bf621bc0de91ffab711b2350068b4c466/library/core/src/panicking.rs:142:14
2: core::panicking::panic
at /rustc/70b3681bf621bc0de91ffab711b2350068b4c466/library/core/src/panicking.rs:48:5
3: <rustc_serialize::opaque::Decoder as rustc_serialize::serialize::Decoder>::read_str
4: <alloc::string::String as rustc_serialize::serialize::Decodable<D>>::decode
5: <std::path::PathBuf as rustc_serialize::serialize::Decodable<D>>::decode
6: rustc_span::_DERIVE_rustc_serialize_Decodable_D_FOR_RealFileName::<impl rustc_serialize::serialize::Decodable<__D> for rustc_span::RealFileName>::decode
7: rustc_span::_DERIVE_rustc_serialize_Decodable_D_FOR_FileName::<impl rustc_serialize::serialize::Decodable<__D> for rustc_span::FileName>::decode
8: <rustc_span::SourceFile as rustc_serialize::serialize::Decodable<D>>::decode
9: rust_out::main
10: core::ops::function::FnOnce::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
as it detected an invalid string serialization.
JSON deserialization support of rustc_serialize has been removed somewhat recently. Furthermore I don't think it is necessary for us to be robust against all corrupt metadata as we have to abort some way or another anyway. I think this issue should be closed.
Activity
dtolnay commentedon Jun 2, 2017
Side note: this unreachable is reachable.
pnkfelix commentedon Apr 19, 2019
The tests here need to be updated; e.g. PR #52953 renamed
FileMaptoSourceFile, so the second example now needs to be written like (play):(or you can rename it in the code itself rather than use
use ... as ...;)When you run it today, it does this:
which seems better than what @dtolnay was previously seeing.
bjorn3 commentedon May 15, 2022
Updated test case:
This now panics with
as it detected an invalid string serialization.
JSON deserialization support of rustc_serialize has been removed somewhat recently. Furthermore I don't think it is necessary for us to be robust against all corrupt metadata as we have to abort some way or another anyway. I think this issue should be closed.
saethlin commentedon Sep 12, 2023
I agree.