pmeunier / carnix

Support rust editions

By andir on February 17, 2019
This patch is not signed.
8pcBAtmobyqgYGqkvTieAvQKnxshTwQL2XXPhxbASRPdUAuhUaSNASMjxpqUcbmQnKPkLrYZFYLKPrRWsbfRiaZK
This patch is in the following branches:
master
In file src/krate.rs
40
41
42
    pub description: Option<String>,
    pub edition: Option<String>,
}
1008
1009
1010
1011
1012
1013
        )?;

        if let Some(ref edition) = meta.edition {
            writeln!(w, "{}  edition = {};", indent, edition)?;
        }

101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
        // CARGO_PKG_AUTHORS environment variable at build time.
        let edition = v.get("package").and_then(|p| p.get("edition").map(|s| s.to_string()));
        let description = v.get("package").and_then(|p| p.get("description").map(|s| s.to_string()));
        let authors = v.get("package")
            .and_then(|x| x.get("authors"))
            .and_then(|x| x.as_array())
            .map(|x| {
                x.iter()
                    .map(|y| y.as_str().unwrap().to_owned())
                    .collect::<Vec<_>>()
            })
            .unwrap_or_else(Vec::new);

        let (default_features, declared_features) = features(v);
        let include = include(v);
        Ok(Meta {
            src: prefetch.prefetch,
            include,
            dependencies,
            declared_dependencies: declared_dependencies(v),
            target_dependencies,
            build_dependencies,
            crate_file: crate_file(v),
            lib_name: lib_name(v),
            proc_macro: is_proc_macro(v),
            plugin: is_plugin(v),
            crate_type: crate_type(v),
            default_features,
            declared_features,
            use_default_features: None,
            features: BTreeSet::new(),
            build: build(v),
            implied_features: implied,
            bins: bins(v),
            authors,
            description,
            edition
        })