Rocket/core/lib/build.rs
Sergio Benitez 52320020bc Use thread-safe 'CookieJar's.
The user-facing changes effected by this commit are:

  * The 'http::Cookies<'_>' guard is now '&http::CookieJar<'_>'.
  * The "one-at-a-time" jar restriction is no longer imposed.
  * 'CookieJar' retrieval methods return 'http::CookieCrumb'.
  * The 'private-cookies' feature is now called 'secrets'.
  * Docs flag private cookie methods with feature cfg.
  * Local, async request dispatching is never serialized.
  * 'Client::cookies()' returns the tracked 'CookieJar'.
  * 'LocalResponse::cookies()' returns a 'CookieJar'.
  * 'Response::cookies()' returns an 'impl Iterator'.
  * A path of '/' is set by default on all cookies.
  * 'SameSite=strict' is set by default on all cookies.
  * 'LocalRequest::cookies()' accepts any 'Cookie' iterator.
  * The 'Debug' impl for 'Request' prints the cookie jar.

Resolves #1332.
2020-08-16 02:19:45 -07:00

30 lines
1.1 KiB
Rust

//! Ensures Rocket isn't compiled with an incompatible version of Rust.
use yansi::{Paint, Color::{Red, Yellow}};
const MIN_VERSION: &'static str = "1.45.0";
macro_rules! err {
($version:expr, $msg:expr) => (
eprintln!("{} {}", Red.paint("Error:").bold(), Paint::new($msg).bold());
eprintln!("Installed version: {}", Yellow.paint(format!("{}", $version)));
eprintln!("Minimum required: {}", Yellow.paint(format!("{}", MIN_VERSION)));
)
}
fn main() {
if let Some(version) = version_check::Version::read() {
if !version.at_least(MIN_VERSION) {
err!(version, "Rocket requires a more recent version of rustc.");
panic!("Aborting compilation due to incompatible compiler.")
}
} else {
println!("cargo:warning={}", "Rocket was unable to check rustc compiler compatibility.");
println!("cargo:warning={}", "Build may fail due to incompatible rustc version.");
}
if let Some(true) = version_check::is_feature_flaggable() {
println!("cargo:rustc-cfg=nightly");
}
}