Skip to content

Commit e0da6b2

Browse files
committedJul 14, 2020
switch from feature = "nightly" to autodetection due to rust-lang/cargo#3494
1 parent 0badd8b commit e0da6b2

File tree

35 files changed

+419
-371
lines changed

35 files changed

+419
-371
lines changed
 

‎Cargo.toml

+5-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ homepage = "https://github.com/alecmocatta/amadeus"
1717
documentation = "https://docs.rs/amadeus"
1818
readme = "README.md"
1919
edition = "2018"
20+
build = "src/build.rs"
2021

2122
[badges]
2223
azure-devops = { project = "alecmocatta/amadeus", pipeline = "tests", build = "26" }
@@ -30,10 +31,9 @@ parquet = ["amadeus-parquet", "amadeus-derive/parquet"]
3031
postgres = ["amadeus-postgres", "amadeus-derive/postgres"]
3132
csv = ["amadeus-serde", "amadeus-derive/serde"]
3233
json = ["amadeus-serde", "amadeus-derive/serde"]
33-
nightly = ["amadeus-core/nightly"]
3434

3535
[package.metadata.docs.rs]
36-
features = ["nightly", "constellation", "aws", "commoncrawl", "parquet", "postgres", "csv", "json"]
36+
features = ["constellation", "aws", "commoncrawl", "parquet", "postgres", "csv", "json"]
3737

3838
[dependencies]
3939
amadeus-core = { version = "=0.3.1", path = "amadeus-core" }
@@ -63,6 +63,9 @@ serde_json = "1.0"
6363
streaming_algorithms = "0.2"
6464
tokio = { version = "0.2", features = ["macros", "time"] }
6565

66+
[build-dependencies]
67+
rustversion = "1.0"
68+
6669
[patch.crates-io]
6770
vec-utils = { version = "*", git = "https://github.com/alecmocatta/vec-utils", branch = "stable" }
6871
streaming_algorithms = { version = "*", git = "https://github.com/alecmocatta/streaming_algorithms", branch = "stable" }

‎amadeus-aws/Cargo.toml

+4-3
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,12 @@ homepage = "https://github.com/alecmocatta/amadeus"
1313
documentation = "https://docs.rs/amadeus"
1414
readme = "README.md"
1515
edition = "2018"
16+
build = "src/build.rs"
1617

1718
[badges]
1819
azure-devops = { project = "alecmocatta/amadeus", pipeline = "tests", build = "26" }
1920
maintenance = { status = "actively-developed" }
2021

21-
[features]
22-
nightly = []
23-
2422
[dependencies]
2523
amadeus-core = { version = "=0.3.1", path = "../amadeus-core" }
2624
amadeus-types = { version = "=0.3.1", path = "../amadeus-types" }
@@ -43,3 +41,6 @@ vec-utils = "0.2"
4341
# dependency of rusoto_core/hyper-tls/native-tls; ensure it's vendored to simplify cross-compilation
4442
[target.'cfg(not(any(target_os = "windows", target_os = "macos", target_os = "ios")))'.dependencies]
4543
openssl = { version = "0.10", features = ["vendored"] }
44+
45+
[build-dependencies]
46+
rustversion = "1.0"

‎amadeus-aws/src/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../src/build.rs

‎amadeus-aws/src/cloudfront.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ impl Cloudfront {
5353
}
5454
}
5555

56-
#[cfg(not(feature = "nightly"))]
56+
#[cfg(not(nightly))]
5757
type Output = std::pin::Pin<Box<dyn Stream<Item = Result<CloudfrontRow, AwsError>> + Send>>;
58-
#[cfg(feature = "nightly")]
58+
#[cfg(nightly)]
5959
type Output = impl Stream<Item = Result<CloudfrontRow, AwsError>> + Send;
6060

6161
FnMutNamed! {
@@ -103,7 +103,7 @@ FnMutNamed! {
103103
}
104104
.flatten_stream()
105105
.map(|x: Result<Result<CloudfrontRow, _>, _>| x.and_then(identity));
106-
#[cfg(not(feature = "nightly"))]
106+
#[cfg(not(nightly))]
107107
let ret = ret.boxed();
108108
ret
109109
}
@@ -114,13 +114,13 @@ impl Source for Cloudfront {
114114
type Error = AwsError;
115115

116116
type ParStream = DistParStream<Self::DistStream>;
117-
#[cfg(not(feature = "nightly"))]
117+
#[cfg(not(nightly))]
118118
#[allow(clippy::type_complexity)]
119119
type DistStream = amadeus_core::par_stream::FlatMap<
120120
amadeus_core::into_par_stream::IterDistStream<std::vec::IntoIter<String>>,
121121
Closure,
122122
>;
123-
#[cfg(feature = "nightly")]
123+
#[cfg(nightly)]
124124
type DistStream = impl DistributedStream<Item = Result<Self::Item, Self::Error>>;
125125

126126
fn par_stream(self) -> Self::ParStream {

‎amadeus-aws/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//! This is a support crate of [Amadeus](https://github.com/constellation-rs/amadeus) and is not intended to be used directly. These types are re-exposed in [`amadeus::source`](https://docs.rs/amadeus/0.3/amadeus/source/index.html).
88
99
#![doc(html_root_url = "https://docs.rs/amadeus-aws/0.3.1")]
10-
#![cfg_attr(feature = "nightly", feature(type_alias_impl_trait))]
10+
#![cfg_attr(nightly, feature(type_alias_impl_trait))]
1111
#![warn(
1212
// missing_copy_implementations,
1313
// missing_debug_implementations,

‎amadeus-commoncrawl/Cargo.toml

+4-3
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,12 @@ homepage = "https://github.com/alecmocatta/amadeus"
1313
documentation = "https://docs.rs/amadeus"
1414
readme = "README.md"
1515
edition = "2018"
16+
build = "src/build.rs"
1617

1718
[badges]
1819
azure-devops = { project = "alecmocatta/amadeus", pipeline = "tests", build = "26" }
1920
maintenance = { status = "actively-developed" }
2021

21-
[features]
22-
nightly = []
23-
2422
[dependencies]
2523
amadeus-core = { version = "=0.3.1", path = "../amadeus-core" }
2624
amadeus-types = { version = "=0.3.1", path = "../amadeus-types" }
@@ -37,3 +35,6 @@ url = { version = "2.1", features = ["serde"] }
3735
# dependency of reqwest/native-tls; ensure it's vendored to simplify cross-compilation
3836
[target.'cfg(not(any(target_os = "windows", target_os = "macos", target_os = "ios")))'.dependencies]
3937
openssl = { version = "0.10", features = ["vendored"] }
38+
39+
[build-dependencies]
40+
rustversion = "1.0"

‎amadeus-commoncrawl/src/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../src/build.rs

‎amadeus-commoncrawl/src/lib.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//! This is a support crate of [Amadeus](https://github.com/constellation-rs/amadeus) and is not intended to be used directly. These types are re-exposed in [`amadeus::source`](https://docs.rs/amadeus/0.3/amadeus/source/index.html).
88
99
#![doc(html_root_url = "https://docs.rs/amadeus-commoncrawl/0.3.1")]
10-
#![cfg_attr(feature = "nightly", feature(type_alias_impl_trait))]
10+
#![cfg_attr(nightly, feature(type_alias_impl_trait))]
1111
#![warn(
1212
// missing_copy_implementations,
1313
// missing_debug_implementations,
@@ -80,9 +80,9 @@ impl CommonCrawl {
8080
}
8181
}
8282

83-
#[cfg(not(feature = "nightly"))]
83+
#[cfg(not(nightly))]
8484
type Output = std::pin::Pin<Box<dyn Stream<Item = Result<Webpage<'static>, io::Error>> + Send>>;
85-
#[cfg(feature = "nightly")]
85+
#[cfg(nightly)]
8686
type Output = impl Stream<Item = Result<Webpage<'static>, io::Error>> + Send;
8787

8888
FnMutNamed! {
@@ -99,7 +99,7 @@ FnMutNamed! {
9999
WarcParser::new(body)
100100
}
101101
.flatten_stream();
102-
#[cfg(not(feature = "nightly"))]
102+
#[cfg(not(nightly))]
103103
let ret = ret.boxed();
104104
ret
105105
}
@@ -110,13 +110,13 @@ impl Source for CommonCrawl {
110110
type Error = io::Error;
111111

112112
type ParStream = DistParStream<Self::DistStream>;
113-
#[cfg(not(feature = "nightly"))]
113+
#[cfg(not(nightly))]
114114
#[allow(clippy::type_complexity)]
115115
type DistStream = amadeus_core::par_stream::FlatMap<
116116
amadeus_core::into_par_stream::IterDistStream<std::vec::IntoIter<String>>,
117117
Closure,
118118
>;
119-
#[cfg(feature = "nightly")]
119+
#[cfg(nightly)]
120120
type DistStream = impl DistributedStream<Item = Result<Self::Item, Self::Error>>;
121121

122122
fn par_stream(self) -> Self::ParStream {

‎amadeus-core/Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,12 @@ homepage = "https://github.com/alecmocatta/amadeus"
1313
documentation = "https://docs.rs/amadeus"
1414
readme = "README.md"
1515
edition = "2018"
16+
build = "src/build.rs"
1617

1718
[badges]
1819
azure-devops = { project = "alecmocatta/amadeus", pipeline = "tests", build = "26" }
1920
maintenance = { status = "actively-developed" }
2021

21-
[features]
22-
# uses Fn*() sugar (better docs), and SIMD for streaming_algorithms
23-
nightly = ["streaming_algorithms/nightly"]
24-
2522
[dependencies]
2623
async-trait = "0.1"
2724
derive-new = "0.5"
@@ -39,3 +36,6 @@ streaming_algorithms = "0.2"
3936
sum = { version = "0.1", features = ["futures", "serde"] }
4037
walkdir = "2.2"
4138
widestring = "0.4"
39+
40+
[build-dependencies]
41+
rustversion = "1.0"

‎amadeus-core/src/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../src/build.rs

‎amadeus-core/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//! This is a support crate of [Amadeus](https://github.com/constellation-rs/amadeus) and is not intended to be used directly. All functionality is re-exposed in [`amadeus`](https://docs.rs/amadeus/0.3/amadeus/).
88
99
#![doc(html_root_url = "https://docs.rs/amadeus-core/0.3.1")]
10-
#![cfg_attr(feature = "nightly", feature(unboxed_closures))]
10+
#![cfg_attr(nightly, feature(unboxed_closures))]
1111
#![recursion_limit = "25600"]
1212
#![warn(
1313
// missing_copy_implementations,

‎amadeus-core/src/par_pipe.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -288,4 +288,4 @@ macro_rules! pipe {
288288
}
289289

290290
pipe!(ParallelPipe ParallelSink FromParallelStream Send ops assert_parallel_pipe assert_parallel_sink);
291-
pipe!(DistributedPipe DistributedSink FromDistributedStream ProcessSend traits assert_distributed_pipe assert_distributed_sink cfg_attr(not(feature = "nightly"), serde_closure::desugar));
291+
pipe!(DistributedPipe DistributedSink FromDistributedStream ProcessSend traits assert_distributed_pipe assert_distributed_sink cfg_attr(not(nightly), serde_closure::desugar));

‎amadeus-core/src/par_stream.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ stream!(ParallelStream ParallelPipe ParallelSink FromParallelStream IntoParallel
482482
}
483483
});
484484

485-
stream!(DistributedStream DistributedPipe DistributedSink FromDistributedStream IntoDistributedStream into_dist_stream DistStream ProcessPool ProcessSend traits assert_distributed_stream cfg_attr(not(feature = "nightly"), serde_closure::desugar) {
485+
stream!(DistributedStream DistributedPipe DistributedSink FromDistributedStream IntoDistributedStream into_dist_stream DistStream ProcessPool ProcessSend traits assert_distributed_stream cfg_attr(not(nightly), serde_closure::desugar) {
486486
async fn reduce<P, B, R1, R2, R3>(
487487
mut self, pool: &P, reduce_a_factory: R1, reduce_b_factory: R2, reduce_c: R3,
488488
) -> B

‎amadeus-core/src/par_stream/identity.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl_par_dist! {
2929
mod workaround {
3030
use super::*;
3131

32-
#[cfg_attr(not(feature = "nightly"), serde_closure::desugar)]
32+
#[cfg_attr(not(nightly), serde_closure::desugar)]
3333
#[doc(hidden)]
3434
impl Identity {
3535
pub fn pipe<S>(self, sink: S) -> Pipe<Self, S> {

‎amadeus-core/src/pool.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ impl<T: ?Sized> ProcessSend for T where T: Send + Serialize + for<'de> Deseriali
1010

1111
type Result<T> = std::result::Result<T, Box<dyn Error + Send>>;
1212

13-
#[cfg_attr(not(feature = "nightly"), serde_closure::desugar)]
13+
#[cfg_attr(not(nightly), serde_closure::desugar)]
1414
pub trait ProcessPool: Clone + Send + Sync + RefUnwindSafe + UnwindSafe + Unpin {
1515
type ThreadPool: ThreadPool + 'static;
1616

@@ -31,7 +31,7 @@ pub trait ThreadPool: Clone + Send + Sync + RefUnwindSafe + UnwindSafe + Unpin {
3131
T: Send + 'static;
3232
}
3333

34-
#[cfg_attr(not(feature = "nightly"), serde_closure::desugar)]
34+
#[cfg_attr(not(nightly), serde_closure::desugar)]
3535
impl<P: ?Sized> ProcessPool for &P
3636
where
3737
P: ProcessPool,

‎amadeus-parquet/Cargo.toml

+5-3
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,12 @@ homepage = "https://github.com/alecmocatta/amadeus"
1313
documentation = "https://docs.rs/amadeus"
1414
readme = "README.md"
1515
edition = "2018"
16+
build = "src/build.rs"
1617

1718
[badges]
1819
azure-devops = { project = "alecmocatta/amadeus", pipeline = "tests", build = "26" }
1920
maintenance = { status = "actively-developed" }
2021

21-
[features]
22-
nightly = []
23-
2422
[dependencies]
2523
amadeus-core = { version = "=0.3.1", path = "../amadeus-core" }
2624
amadeus-types = { version = "=0.3.1", path = "../amadeus-types" }
@@ -36,6 +34,7 @@ linked-hash-map = "0.5"
3634
lz4 = "1.23"
3735
num-bigint = "0.3"
3836
quick-error = "1.2.2"
37+
rustversion = "1.0"
3938
serde = { version = "1.0", features = ["derive"] }
4039
serde_closure = "0.3"
4140
snap = "1.0"
@@ -46,6 +45,9 @@ zstd = "0.4"
4645
[dev-dependencies]
4746
rand = "0.7"
4847

48+
[build-dependencies]
49+
rustversion = "1.0"
50+
4951
[[test]]
5052
name = "derive"
5153
test = false

‎amadeus-parquet/src/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../src/build.rs

‎amadeus-parquet/src/internal/record/impls.rs

+29-29
Original file line numberDiff line numberDiff line change
@@ -181,32 +181,32 @@ macro_rules! array {
181181
}
182182
}
183183

184-
// Specialize the implementation to avoid passing a potentially large array around
184+
// TODO: Specialize the implementation to avoid passing a potentially large array around
185185
// on the stack.
186-
impl ParquetData for Box<[u8; $i]> {
187-
type Schema = FixedByteArraySchema<[u8; $i]>;
188-
type Reader = BoxFixedLenByteArrayReader<[u8; $i]>;
189-
190-
fn parse(
191-
schema: &Type, predicate: Option<&Self::Predicate>, repetition: Option<Repetition>,
192-
) -> Result<(String, Self::Schema)> {
193-
<[u8; $i]>::parse(schema, predicate, repetition)
194-
}
195-
196-
fn reader(
197-
_schema: &Self::Schema, path: &mut Vec<String>, def_level: i16, rep_level: i16,
198-
paths: &mut HashMap<ColumnPath, ColumnReader>, batch_size: usize,
199-
) -> Self::Reader {
200-
let col_path = ColumnPath::new(path.to_vec());
201-
let col_reader = paths.remove(&col_path).unwrap();
202-
BoxFixedLenByteArrayReader::<[u8; $i]> {
203-
column: TypedTripletIter::<FixedLenByteArrayType>::new(
204-
def_level, rep_level, col_reader, batch_size,
205-
),
206-
marker: PhantomData,
207-
}
208-
}
209-
}
186+
// impl ParquetData for Box<[u8; $i]> {
187+
// type Schema = FixedByteArraySchema<[u8; $i]>;
188+
// type Reader = BoxFixedLenByteArrayReader<[u8; $i]>;
189+
190+
// fn parse(
191+
// schema: &Type, predicate: Option<&Self::Predicate>, repetition: Option<Repetition>,
192+
// ) -> Result<(String, Self::Schema)> {
193+
// <[u8; $i]>::parse(schema, predicate, repetition)
194+
// }
195+
196+
// fn reader(
197+
// _schema: &Self::Schema, path: &mut Vec<String>, def_level: i16, rep_level: i16,
198+
// paths: &mut HashMap<ColumnPath, ColumnReader>, batch_size: usize,
199+
// ) -> Self::Reader {
200+
// let col_path = ColumnPath::new(path.to_vec());
201+
// let col_reader = paths.remove(&col_path).unwrap();
202+
// BoxFixedLenByteArrayReader::<[u8; $i]> {
203+
// column: TypedTripletIter::<FixedLenByteArrayType>::new(
204+
// def_level, rep_level, col_reader, batch_size,
205+
// ),
206+
// marker: PhantomData,
207+
// }
208+
// }
209+
// }
210210
)*};
211211
}
212212
amadeus_types::array!(array);
@@ -219,18 +219,18 @@ impl<T> ParquetData for Box<T>
219219
where
220220
T: ParquetData,
221221
{
222-
default type Schema = BoxSchema<T::Schema>;
223-
default type Reader = BoxReader<T::Reader>;
222+
type Schema = BoxSchema<T::Schema>;
223+
type Reader = BoxReader<T::Reader>;
224224
type Predicate = T::Predicate;
225225

226-
default fn parse(
226+
fn parse(
227227
schema: &Type, predicate: Option<&Self::Predicate>, repetition: Option<Repetition>,
228228
) -> Result<(String, Self::Schema)> {
229229
T::parse(schema, predicate, repetition)
230230
.map(|(name, schema)| (name, type_coerce(BoxSchema(schema))))
231231
}
232232

233-
default fn reader(
233+
fn reader(
234234
schema: &Self::Schema, path: &mut Vec<String>, def_level: i16, rep_level: i16,
235235
paths: &mut HashMap<ColumnPath, ColumnReader>, batch_size: usize,
236236
) -> Self::Reader {

‎amadeus-parquet/src/internal/util/io.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// under the License.
1717

1818
use std::{
19-
cell::RefCell, cmp, fs::File, io::{self, BufWriter, Cursor, Initializer, Read, Seek, SeekFrom, Write}, rc::Rc
19+
cell::RefCell, cmp, fs::File, io::{self, BufWriter, Cursor, Read, Seek, SeekFrom, Write}, rc::Rc
2020
};
2121

2222
use crate::internal::file::reader::ParquetReader;
@@ -57,7 +57,8 @@ impl<R: ParquetReader> Read for BufReader<R> {
5757
self.offset += read as u64;
5858
Ok(read)
5959
}
60-
unsafe fn initializer(&self) -> Initializer {
60+
#[cfg(nightly)]
61+
unsafe fn initializer(&self) -> std::io::Initializer {
6162
self.inner.initializer()
6263
}
6364
}
@@ -68,6 +69,9 @@ impl<R: ParquetReader> Seek for BufReader<R> {
6869
SeekFrom::Current(n) => n,
6970
SeekFrom::End(n) => self.len as i64 + n - self.offset as i64,
7071
};
72+
#[cfg(not(nightly))]
73+
let _ = self.inner.seek(SeekFrom::Current(offset))?;
74+
#[cfg(nightly)]
7175
self.inner.seek_relative(offset)?;
7276
self.offset = (self.offset as i64 + offset) as u64;
7377
Ok(self.offset)

0 commit comments

Comments
 (0)
Please sign in to comment.