Bump MSRV to 1.36.0

This commit is contained in:
Graham Esau 2020-09-21 08:42:07 +01:00
parent 7a1e02eefd
commit 5ca2d08013
8 changed files with 38 additions and 82 deletions

View file

@ -1,6 +1,6 @@
name: CI
on: [push, pull_request]
on: [push, pull_request, workflow_dispatch]
jobs:
ci:
@ -8,13 +8,13 @@ jobs:
strategy:
matrix:
rust:
- 1.32.0
- 1.36.0
- stable
- beta
- nightly
include:
- rust: 1.32.0
test_features: "--features impl_json_schema,chrono,indexmap,either,uuid"
- rust: 1.36.0
test_features: "--all-features"
- rust: stable
test_features: "--all-features"
- rust: beta

View file

@ -14,6 +14,9 @@
- `SchemaSettings` no longer implements `PartialEq`
- `SchemaGenerator::into_definitions()` - this has been superseded by `SchemaGenerator::take_definitions()`
### Changed (**BREAKING CHANGES**):
- Minimum supported rust version is now 1.36.0
### Fixed:
- **BREAKING CHANGE** unknown items in `#[schemars(...)]` attributes now cause a compilation error (https://github.com/GREsau/schemars/issues/18)

View file

@ -3,7 +3,7 @@
[![CI Build](https://img.shields.io/github/workflow/status/GREsau/schemars/CI?logo=GitHub)](https://github.com/GREsau/schemars/actions)
[![Crates.io](https://img.shields.io/crates/v/schemars)](https://crates.io/crates/schemars)
[![Docs](https://docs.rs/schemars/badge.svg)](https://docs.rs/schemars)
[![rustc 1.32+](https://img.shields.io/badge/schemars-rustc_1.32+-lightgray.svg)](https://blog.rust-lang.org/2019/01/17/Rust-1.32.0.html)
[![rustc 1.36+](https://img.shields.io/badge/schemars-rustc_1.36+-lightgray.svg)](https://blog.rust-lang.org/2019/07/04/Rust-1.36.0.html)
Generate JSON Schema documents from Rust code

View file

@ -16,7 +16,7 @@ build = "build.rs"
schemars_derive = { version = "=0.8.0-alpha-4", optional = true, path = "../schemars_derive" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
dyn-clone = "= 1.0.1"
dyn-clone = "1.0"
chrono = { version = "0.4", default-features = false, optional = true }
indexmap = { version = "1.2", features=["serde-1"], optional = true }

View file

@ -1,23 +1,11 @@
use std::env;
use std::process::Command;
use std::str::{self, FromStr};
// Based on https://github.com/serde-rs/serde/blob/master/serde/build.rs
fn main() {
let minor = match rustc_minor_version() {
Some(minor) => minor,
None => return,
};
let target = env::var("TARGET").unwrap();
let emscripten = target == "asmjs-unknown-emscripten" || target == "wasm32-unknown-emscripten";
// Atomic types, and non-zero signed integers stabilized in Rust 1.34:
// https://blog.rust-lang.org/2019/04/11/Rust-1.34.0.html#library-stabilizations
if minor >= 34 {
println!("cargo:rustc-cfg=num_nonzero_signed");
// Whitelist of archs that support std::sync::atomic module. Ideally we
// would use #[cfg(target_has_atomic = "...")] but it is not stable yet.
// Instead this is based on rustc's src/librustc_target/spec/*.rs.
@ -34,34 +22,4 @@ fn main() {
if has_atomic32 {
println!("cargo:rustc-cfg=std_atomic");
}
}
}
fn rustc_minor_version() -> Option<u32> {
let rustc = match env::var_os("RUSTC") {
Some(rustc) => rustc,
None => return None,
};
let output = match Command::new(rustc).arg("--version").output() {
Ok(output) => output,
Err(_) => return None,
};
let version = match str::from_utf8(&output.stdout) {
Ok(version) => version,
Err(_) => return None,
};
let mut pieces = version.split('.');
if pieces.next() != Some("rustc 1") {
return None;
}
let next = match pieces.next() {
Some(next) => next,
None => return None,
};
u32::from_str(next).ok()
}

View file

@ -55,7 +55,6 @@ mod ffi;
#[cfg(feature = "indexmap")]
mod indexmap;
mod maps;
#[cfg(num_nonzero_signed)]
mod nonzero_signed;
mod nonzero_unsigned;
mod primitives;

View file

@ -1,5 +1,4 @@
use crate::schema::{RootSchema, Schema, SchemaObject, SingleOrVec};
use std::fmt::Debug;
/// TODO document
pub trait Visitor {

View file

@ -1,21 +1,18 @@
mod util;
#[cfg(num_nonzero_signed)]
mod nonzero_ints {
use super::*;
use schemars::JsonSchema;
use util::*;
use super::*;
use schemars::JsonSchema;
use util::*;
#[derive(Debug, JsonSchema)]
struct MyStruct {
#[derive(Debug, JsonSchema)]
struct MyStruct {
unsigned: u32,
nonzero_unsigned: std::num::NonZeroU32,
signed: i32,
nonzero_signed: std::num::NonZeroI32,
}
#[test]
fn nonzero_ints() -> TestResult {
test_default_generated_schema::<MyStruct>("nonzero_ints")
}
}
#[test]
fn nonzero_ints() -> TestResult {
test_default_generated_schema::<MyStruct>("nonzero_ints")
}