From 456248eabf1d711fc01170a6ca268ea2a2ae6c2b Mon Sep 17 00:00:00 2001 From: Yong Wen Chua Date: Wed, 14 Feb 2018 13:20:31 +0800 Subject: [PATCH] Bump rocket to 0.3.6 (#34) * Bump rocket to 0.3.6 - Remove `build.rs` - the minimum nightly version is enforced by Rocket - Remove the pinning to a specific Nightly version. The latest nightly should work. - Added a minimum nightly matrix * Fix Rocket's minimum * Fix travis build script --- .travis.yml | 10 ++++-- Cargo.toml | 7 +--- README.md | 4 +-- build.rs | 86 -------------------------------------------------- rust-toolchain | 2 +- src/lib.rs | 1 - 6 files changed, 11 insertions(+), 99 deletions(-) delete mode 100644 build.rs diff --git a/.travis.yml b/.travis.yml index 2c7fa11..0c9fc8e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,9 @@ sudo: false language: rust rust: -- nightly-2017-12-18 +- nightly +# Minimum Rust set by Rocket +- nightly-2018-01-13 env: global: - TRAVIS_CARGO_NIGHTLY_FEATURE="" @@ -19,10 +21,12 @@ before_script: - | pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH +# Remove rust-toolchain override for tests +- rm rust-toolchain script: - | travis-cargo build -- "${CARGO_FLAGS}" && travis-cargo test -- "${CARGO_FLAGS}" && - travis-cargo --only nightly-2017-12-18 doc -- --no-deps "${CARGO_FLAGS}" + travis-cargo --only nightly doc -- --no-deps "${CARGO_FLAGS}" after_success: -- test $CARGO_FLAGS = "--all-features" && travis-cargo --only nightly-2017-12-18 doc-upload +- test $CARGO_FLAGS = "--all-features" && travis-cargo --only nightly doc-upload diff --git a/Cargo.toml b/Cargo.toml index b409e47..f77236e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,6 @@ name = "rocket_cors" version = "0.2.1" license = "Apache-2.0" authors = ["Yong Wen Chua "] -build = "build.rs" description = "Cross-origin resource sharing (CORS) for Rocket.rs applications" homepage = "https://github.com/lawliet89/rocket_cors" repository = "https://github.com/lawliet89/rocket_cors" @@ -22,7 +21,7 @@ serialization = ["serde", "serde_derive", "unicase_serde", "url_serde"] [dependencies] log = "0.3" -rocket = "0.3" +rocket = "0.3.6" unicase = "2.0" url = "1.5.1" @@ -32,10 +31,6 @@ serde_derive = { version = "1.0", optional = true } unicase_serde = { version = "0.1.0", optional = true } url_serde = { version = "0.2.0", optional = true } -[build-dependencies] -ansi_term = "0.9" -version_check = "0.1" - [dev-dependencies] hyper = "0.10" rocket_codegen = "0.3" diff --git a/README.md b/README.md index d270326..5e14762 100644 --- a/README.md +++ b/README.md @@ -21,8 +21,8 @@ Rocket requires nightly Rust. You should probably install Rust with See [installation instructions](https://rocket.rs/guide/getting-started/#installing-rust). -In particular, `rocket_cors` is currently targetted for `nightly-2017-12-18`. Newer nightlies -might work, but it's not guaranteed. +In particular, `rocket_cors` is currently targetted for the latest `nightly`. Older nightlies might +work, but they are subject to the minimum that Rocket sets. ## Installation diff --git a/build.rs b/build.rs deleted file mode 100644 index 81469cf..0000000 --- a/build.rs +++ /dev/null @@ -1,86 +0,0 @@ -//! This tiny build script ensures that the crate is not compiled with an -//! incompatible version of rust. -//! This scipt was stolen from `rocket_codegen`. - -extern crate ansi_term; -extern crate version_check; - -use ansi_term::Color::{Red, Yellow, Blue, White}; -use version_check::{is_nightly, is_min_version, is_min_date}; - -// Specifies the minimum nightly version that is targetted -// Note that sometimes the `rustc` date might be older than the nightly version, -// usually one day older -const MIN_DATE: &'static str = "2017-12-17"; -const MIN_VERSION: &'static str = "1.24.0-nightly"; - -// Convenience macro for writing to stderr. -macro_rules! printerr { - ($($arg:tt)*) => ({ - use std::io::prelude::*; - write!(&mut ::std::io::stderr(), "{}\n", format_args!($($arg)*)) - .expect("Failed to write to stderr.") - }) -} - -fn main() { - let ok_nightly = is_nightly(); - let ok_version = is_min_version(MIN_VERSION); - let ok_date = is_min_date(MIN_DATE); - - let print_version_err = |version: &str, date: &str| { - printerr!( - "{} {}. {} {}.", - White.paint("Installed version is:"), - Yellow.paint(format!("{} ({})", version, date)), - White.paint("Minimum required:"), - Yellow.paint(format!("{} ({})", MIN_VERSION, MIN_DATE)) - ); - }; - - match (ok_nightly, ok_version, ok_date) { - (Some(is_nightly), Some((ok_version, version)), Some((ok_date, date))) => { - if !is_nightly { - printerr!( - "{} {}", - Red.bold().paint("Error:"), - White.paint("rocket_cors requires a nightly version of Rust.") - ); - print_version_err(&*version, &*date); - printerr!( - "{}{}{}", - Blue.paint("See the README ("), - White.paint("https://github.com/lawliet89/rocket_cors"), - Blue.paint(") for more information.") - ); - panic!("Aborting compilation due to incompatible compiler.") - } - - if !ok_version || !ok_date { - printerr!( - "{} {}", - Red.bold().paint("Error:"), - White.paint("rocket_cors requires a more recent version of rustc.") - ); - printerr!( - "{}{}{}", - Blue.paint("Use `"), - White.paint("rustup update"), - Blue.paint("` or your preferred method to update Rust.") - ); - print_version_err(&*version, &*date); - panic!("Aborting compilation due to incompatible compiler.") - } - } - _ => { - println!( - "cargo:warning={}", - "rocket_cors was unable to check rustc compatibility." - ); - println!( - "cargo:warning={}", - "Build may fail due to incompatible rustc version." - ); - } - } -} diff --git a/rust-toolchain b/rust-toolchain index dac456d..bf867e0 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2017-12-18 +nightly diff --git a/src/lib.rs b/src/lib.rs index 682203b..1207505 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -485,7 +485,6 @@ dead_code, deprecated, exceeding_bitshifts, - fat_ptr_transmutes, improper_ctypes, missing_docs, mutable_transmutes,