• Home
  • Raw
  • Download

Lines Matching +full:not +full:- +full:date

3 //! with `--version`. The path to the compiler is determined first via the
4 //! `RUSTC` environment variable. If it is not set, then `rustc` is used. If
16 //! println!("cargo:rustc-cfg=question_mark_operator");
23 //! * Check that the running compiler was released on or after `2018-12-18`:
28 //! match rustc::is_min_date("2018-12-18") {
36 //! released _prior to_ or _exactly on_ a certain date.
56 //! println!("cargo:rustc-cfg=has_doc_cfg");
67 //! Some(c) => format!("No, the channel {} is not stable.", c),
72 //! To interact with the version, release date, and release channel as structs,
73 //! use [`Version`], [`Date`], and [`Channel`], respectively. The [`triple()`]
87 mod date; module
94 #[doc(inline)] pub use date::*;
96 /// Parses (version, date) as available from rustc version string.
97 fn version_and_date_from_rustc_version(s: &str) -> (Option<String>, Option<String>) { in version_and_date_from_rustc_version()
101 let date = components.filter(|c| c.ends_with(')')).next() in version_and_date_from_rustc_version() localVariable
103 (version.map(|s| s.to_string()), date.map(|s| s.to_string())) in version_and_date_from_rustc_version()
106 /// Parses (version, date) as available from rustc verbose version output.
107 fn version_and_date_from_rustc_verbose_version(s: &str) -> (Option<String>, Option<String>) { in version_and_date_from_rustc_verbose_version()
108 let (mut version, mut date) = (None, None); in version_and_date_from_rustc_verbose_version()
115 date = date.or(d); in version_and_date_from_rustc_verbose_version()
118 Some("commit-date:") if line.ends_with("unknown") => date = None, in version_and_date_from_rustc_verbose_version()
119 Some("commit-date:") => date = split(line), in version_and_date_from_rustc_verbose_version()
124 (version, date) in version_and_date_from_rustc_verbose_version()
127 /// Returns (version, date) as available from `rustc --version`.
128 fn get_version_and_date() -> Option<(Option<String>, Option<String>)> { in get_version_and_date()
130 Command::new(rustc).arg("--verbose").arg("--version").output().ok() in get_version_and_date()
135 /// Reads the triple of [`Version`], [`Channel`], and [`Date`] of the installed
138 /// If any attribute cannot be determined (see the [top-level
142 /// [`Channel::read()`], or [`Date::read()`].
143 pub fn triple() -> Option<(Version, Channel, Date)> { in triple()
145 Some((Some(version), Some(date))) => (version, date), in triple()
152 Some(channel) => match Date::parse(&date_str) { in triple()
153 Some(date) => Some((version, channel, date)), in triple()
163 /// some date.
165 /// The format of `min_date` must be YYYY-MM-DD. For instance: `2016-12-20` or
166 /// `2017-01-09`.
168 /// If the date cannot be retrieved or parsed, or if `min_date` could not be
171 pub fn is_min_date(min_date: &str) -> Option<bool> { in is_min_date()
172 match (Date::read(), Date::parse(min_date)) { in is_min_date()
179 /// some date.
181 /// The format of `max_date` must be YYYY-MM-DD. For instance: `2016-12-20` or
182 /// `2017-01-09`.
184 /// If the date cannot be retrieved or parsed, or if `max_date` could not be
187 pub fn is_max_date(max_date: &str) -> Option<bool> { in is_max_date()
188 match (Date::read(), Date::parse(max_date)) { in is_max_date()
195 /// some date.
197 /// The format of `date` must be YYYY-MM-DD. For instance: `2016-12-20` or
198 /// `2017-01-09`.
200 /// If the date cannot be retrieved or parsed, or if `date` could not be parsed,
202 /// release on `date` and `false` otherwise.
203 pub fn is_exact_date(date: &str) -> Option<bool> { in is_exact_date()
204 match (Date::read(), Date::parse(date)) { in is_exact_date()
205 (Some(rustc_date), Some(date)) => Some(rustc_date == date), in is_exact_date()
213 /// The format of `min_version` is a semantic version: `1.3.0`, `1.15.0-beta`,
214 /// `1.14.0`, `1.16.0-nightly`, etc.
216 /// If the version cannot be retrieved or parsed, or if `min_version` could not
219 pub fn is_min_version(min_version: &str) -> Option<bool> { in is_min_version()
229 /// The format of `max_version` is a semantic version: `1.3.0`, `1.15.0-beta`,
230 /// `1.14.0`, `1.16.0-nightly`, etc.
232 /// If the version cannot be retrieved or parsed, or if `max_version` could not
235 pub fn is_max_version(max_version: &str) -> Option<bool> { in is_max_version()
244 /// The format of `version` is a semantic version: `1.3.0`, `1.15.0-beta`,
245 /// `1.14.0`, `1.16.0-nightly`, etc.
247 /// If the version cannot be retrieved or parsed, or if `version` could not be
250 pub fn is_exact_version(version: &str) -> Option<bool> { in is_exact_version()
262 /// via the `allow-features` compiler flag, which this function _does not_
267 /// If the version could not be determined, returns `None`. Otherwise returns
269 pub fn is_feature_flaggable() -> Option<bool> { in is_feature_flaggable()
276 /// feature is not disabled via exclusion in `allow-features` via `RUSTFLAGS` or
277 /// `CARGO_ENCODED_RUSTFLAGS`. If the version could not be determined, returns
286 /// println!("cargo:rustc-cfg=has_doc_cfg");
289 pub fn supports_feature(feature: &str) -> Option<bool> { in supports_feature()
301 const ALLOW_FEATURES: &'static str = "allow-features="; in supports_feature()
305 .map(|flag| flag.trim_left_matches("-Z").trim()) in supports_feature()
315 // contain an `allow-features` flag, assume compiler allows all features. in supports_feature()
363 "rustc 1.20.0-nightly" => "1.20.0-nightly", None, in test_version_parse()
367 "rustc 1.5.1-beta" => "1.5.1-beta", None, in test_version_parse()
368 "rustc 1.20.0 (2017-07-09)" => "1.20.0", Some("2017-07-09"), in test_version_parse()
369 "rustc 1.20.0-dev (2017-07-09)" => "1.20.0-dev", Some("2017-07-09"), in test_version_parse()
370 "rustc 1.20.0-nightly (d84693b93 2017-07-09)" => "1.20.0-nightly", Some("2017-07-09"), in test_version_parse()
371 "rustc 1.20.0 (d84693b93 2017-07-09)" => "1.20.0", Some("2017-07-09"), in test_version_parse()
372 "rustc 1.30.0-nightly (3bc2ca7e4 2018-09-20)" => "1.30.0-nightly", Some("2018-09-20"), in test_version_parse()
379 "rustc 1.0.0 (a59de37e9 2015-05-13) (built 2015-05-14)\n\ in test_verbose_version_parse()
381 commit-hash: a59de37e99060162a2674e3ff45409ac73595c0e\n\ in test_verbose_version_parse()
382 commit-date: 2015-05-13\n\ in test_verbose_version_parse()
383 build-date: 2015-05-14\n\ in test_verbose_version_parse()
384 host: x86_64-unknown-linux-gnu\n\ in test_verbose_version_parse()
385 release: 1.0.0" => "1.0.0", Some("2015-05-13"), in test_verbose_version_parse()
387 "rustc 1.0.0 (a59de37e9 2015-05-13) (built 2015-05-14)\n\ in test_verbose_version_parse()
388 commit-hash: a59de37e99060162a2674e3ff45409ac73595c0e\n\ in test_verbose_version_parse()
389 commit-date: 2015-05-13\n\ in test_verbose_version_parse()
390 build-date: 2015-05-14\n\ in test_verbose_version_parse()
391 host: x86_64-unknown-linux-gnu\n\ in test_verbose_version_parse()
392 release: 1.0.0" => "1.0.0", Some("2015-05-13"), in test_verbose_version_parse()
394 "rustc 1.50.0 (cb75ad5db 2021-02-10)\n\ in test_verbose_version_parse()
396 commit-hash: cb75ad5db02783e8b0222fee363c5f63f7e2cf5b\n\ in test_verbose_version_parse()
397 commit-date: 2021-02-10\n\ in test_verbose_version_parse()
398 host: x86_64-unknown-linux-gnu\n\ in test_verbose_version_parse()
399 release: 1.50.0" => "1.50.0", Some("2021-02-10"), in test_verbose_version_parse()
401 "rustc 1.52.0-nightly (234781afe 2021-03-07)\n\ in test_verbose_version_parse()
403 commit-hash: 234781afe33d3f339b002f85f948046d8476cfc9\n\ in test_verbose_version_parse()
404 commit-date: 2021-03-07\n\ in test_verbose_version_parse()
405 host: x86_64-unknown-linux-gnu\n\ in test_verbose_version_parse()
406 release: 1.52.0-nightly\n\ in test_verbose_version_parse()
407 LLVM version: 12.0.0" => "1.52.0-nightly", Some("2021-03-07"), in test_verbose_version_parse()
411 commit-hash: unknown\n\ in test_verbose_version_parse()
412 commit-date: unknown\n\ in test_verbose_version_parse()
413 host: x86_64-unknown-linux-gnu\n\ in test_verbose_version_parse()
419 commit-hash: unknown\n\ in test_verbose_version_parse()
420 commit-date: unknown\n\ in test_verbose_version_parse()
421 host: x86_64-unknown-linux-gnu\n\ in test_verbose_version_parse()
424 "rustc 1.50.0 (Fedora 1.50.0-1.fc33)\n\ in test_verbose_version_parse()
426 commit-hash: unknown\n\ in test_verbose_version_parse()
427 commit-date: unknown\n\ in test_verbose_version_parse()
428 host: x86_64-unknown-linux-gnu\n\ in test_verbose_version_parse()
433 fn read_static(verbose: bool, channel: &str, minor: usize) -> String { in read_static()
442 .join(format!("rustc-1.{}.0", minor)); in read_static()
454 "2015-05-13", "2015-06-19", "2015-08-03", "2015-09-15", "2015-10-27",
455 "2015-12-04", "2016-01-19", "2016-02-29", "2016-04-11", "2016-05-18",
456 "2016-07-03", "2016-08-15", "2016-09-23", "2016-11-07", "2016-12-16",
457 "2017-01-19", "2017-03-10", "2017-04-24", "2017-06-06", "2017-07-17",
458 "2017-08-27", "2017-10-09", "2017-11-20", "2018-01-01", "2018-02-12",
459 "2018-03-25", "2018-05-07", "2018-06-19", "2018-07-30", "2018-09-11",
460 "2018-10-24", "2018-12-04", "2019-01-16", "2019-02-28", "2019-04-10",
461 "2019-05-20", "2019-07-03", "2019-08-13", "2019-09-23", "2019-11-04",
462 "2019-12-16", "2020-01-27", "2020-03-09", "2020-04-20", "2020-06-01",
463 "2020-07-13", "2020-08-24", "2020-10-07", "2020-11-16", "2020-12-29",
464 "2021-02-10",
477 let (version, date) = (&format!("1.{}.0", v), Some(DATES[v])); in test_stable_compatibility()
478 check_terse_parse!(read_static(false, "stable", v) => version, date,); in test_stable_compatibility()
479 check_verbose_parse!(read_static(true, "stable", v) => version, date,); in test_stable_compatibility()