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
use globset::Glob;use serde::Deserialize;#[derive(Deserialize)]structTest{foo:Vec<Glob>,}fnmain(){// let test = "\"test\"";// let tmp = toml::de::from_str::<&str>(test).unwrap();// let tmp2 = toml_edit::easy::from_str::<&str>(test).unwrap();let text = r#"foo=["hello", "world"]"#;let tmp = toml::de::from_str::<Test>(text).unwrap();let tmp2 = toml_edit::easy::from_str::<Test>(text).unwrap();}
With the following Cargo.toml file
[package]
edition = "2021"name = "toml_repro"version = "0.1.0"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
globset = {version = "0.4.10", features = ["serde1"]}
serde = "1.0.152"toml = "0.5"toml_edit = {version = "0.17.1", features = ["easy", "serde"]}
The crash occurs on line 16, showing that while toml can successfully deserialize into the Glob, toml_edit::easy cannot. This appears to be due to the implementation of Deserialize for Glob using &str::deserialize as opposed to String::deserialize.
Another incompatibility I found while trying to reproduce the issue: if you uncomment the commented lines in the code above, you will get a compiler error on line 12 but not on line 11.
The text was updated successfully, but these errors were encountered:
As for the other issue mentioned (parsing "\"test\""), that is because toml was very loose in its parsing, with Deserializer automatically parsing any toml value when the type wasn't used for parsing a toml document. We've made this more strict in #457 where Deserializer only handles documents and ValueDeserializer handles values.
Closing this as Not Planned as the current behavior is expected
The following test crashes:
With the following
Cargo.toml
fileThe crash occurs on line 16, showing that while
toml
can successfully deserialize into theGlob
,toml_edit::easy
cannot. This appears to be due to the implementation ofDeserialize
forGlob
using&str::deserialize
as opposed toString::deserialize
.Another incompatibility I found while trying to reproduce the issue: if you uncomment the commented lines in the code above, you will get a compiler error on line 12 but not on line 11.
The text was updated successfully, but these errors were encountered: