Skip to content

Commit 3908395

Browse files
authored
Merge pull request #100 from mindriot101/fix-build-problem
Fix build problem
2 parents a35d2fa + ce3019e commit 3908395

File tree

19 files changed

+229
-167
lines changed

19 files changed

+229
-167
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
1414
* (`fitsio`) add support for writing all integer header keys
1515

1616
### Changed
17+
18+
* (`fitsio`) fix errors with the system allocator, ensuring the package will run on the latest nightly and beta compilers [#100](https://github.com/mindriot101/rust-fitsio/pull/100)
19+
1720
### Removed
1821

1922
## [0.14.0] - 2018-04-21

bin/test

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,29 @@
22
set -e
33
set -x
44

5+
RUST_VERSION=${RUST_VERSION:-stable}
6+
7+
run_cargo() {
8+
if [ -z $TRAVIS ]; then
9+
# Not running on travis
10+
cargo +${RUST_VERSION} $*
11+
else
12+
# Running on travis
13+
cargo $*
14+
fi
15+
}
16+
517
export CARGO_TARGET_DIR=target
618

719
for toml in $(find . -maxdepth 2 -name "Cargo.toml"); do
8-
cargo test --manifest-path $toml
20+
run_cargo test --manifest-path $toml
921
done
1022

1123
# Test the bindgen feature
12-
cargo test --manifest-path fitsio/Cargo.toml --features bindgen --no-default-features
24+
run_cargo test --manifest-path fitsio/Cargo.toml --features bindgen --no-default-features
1325

1426
# Test the full example
15-
cargo run --manifest-path fitsio/Cargo.toml --example full_example
27+
run_cargo run --manifest-path fitsio/Cargo.toml --example full_example
1628

1729
# Test the array feature
18-
cargo test --manifest-path fitsio/Cargo.toml --features array
30+
run_cargo test --manifest-path fitsio/Cargo.toml --features array

bin/travis_test

Lines changed: 0 additions & 42 deletions
This file was deleted.

fitsio-derive/src/lib.rs

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,22 @@ pub fn read_row(input: TokenStream) -> TokenStream {
1414
let mut tokens = Vec::new();
1515

1616
match &input.data {
17-
&syn::Data::Struct(ref s) => match &s.fields {
18-
&syn::Fields::Named(ref fields) => for field in &fields.named {
19-
let ident = &field.ident.as_ref().unwrap();
20-
let ident_str = ident.to_string();
21-
if field.attrs.is_empty() {
22-
tokens.push(quote! {
23-
out.#ident = tbl.read_cell_value(fits_file, #ident_str, idx)?;
24-
});
25-
} else {
26-
for attr in &field.attrs {
27-
match attr.interpret_meta() {
28-
Some(syn::Meta::List(l)) => for entry in l.nested {
29-
match entry {
17+
&syn::Data::Struct(ref s) => {
18+
match &s.fields {
19+
&syn::Fields::Named(ref fields) => {
20+
for field in &fields.named {
21+
let ident = &field.ident.as_ref().unwrap();
22+
let ident_str = ident.to_string();
23+
if field.attrs.is_empty() {
24+
tokens.push(quote! {
25+
out.#ident = tbl.read_cell_value(fits_file, #ident_str, idx)?;
26+
});
27+
} else {
28+
for attr in &field.attrs {
29+
match attr.interpret_meta() {
30+
Some(syn::Meta::List(l)) => {
31+
for entry in l.nested {
32+
match entry {
3033
syn::NestedMeta::Meta(syn::Meta::NameValue(
3134
syn::MetaNameValue {
3235
ident: attr_ident,
@@ -54,18 +57,21 @@ pub fn read_row(input: TokenStream) -> TokenStream {
5457
}
5558
_ => panic!("Only #[fitsio(colname = \"...\")] is supported"),
5659
}
57-
},
58-
_ => panic!("Only #[fitsio(colname = \"...\")] is supported"),
60+
}
61+
}
62+
_ => panic!("Only #[fitsio(colname = \"...\")] is supported"),
63+
}
64+
}
5965
}
6066
}
6167
}
62-
},
63-
_ => panic!("Only #[fitsio(colname = \"...\")] is supported"),
64-
},
68+
_ => panic!("Only #[fitsio(colname = \"...\")] is supported"),
69+
}
70+
}
6571
_ => panic!("derive only possible for structs"),
6672
}
6773

68-
let expanded = quote!{
74+
let expanded = quote! {
6975
impl FitsRow for #name {
7076
fn from_table(
7177
tbl: &::fitsio::hdu::FitsHdu,

fitsio-sys-bindgen/build.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ fn main() {
3030
format!(
3131
"{} was not found in the pkg-config search path",
3232
package_name
33-
).as_ref(),
33+
)
34+
.as_ref(),
3435
) {
3536
let err_msg = format!(
3637
"

fitsio-sys/build.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ fn main() {
1515
format!(
1616
"{} was not found in the pkg-config search path",
1717
package_name
18-
).as_ref(),
18+
)
19+
.as_ref(),
1920
) {
2021
let err_msg = format!(
2122
"

fitsio/.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
target

fitsio/Dockerfile

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,28 @@
1-
FROM rust:1.24.1
1+
FROM rust:latest
22

33
RUN apt-get update && \
4-
apt-get install -y libcfitsio-dev pkg-config libclang-3.8-dev build-essential clang
4+
apt-get -yq dist-upgrade && \
5+
apt-get install -yq --no-install-recommends \
6+
libcfitsio-dev \
7+
pkg-config \
8+
libclang-3.8-dev \
9+
build-essential \
10+
clang \
11+
gdb \
12+
&& \
13+
apt-get clean && \
14+
rm -rf /var/lib/apt/lists/*
15+
16+
RUN rustup update && \
17+
rustup install stable && \
18+
rustup install nightly
519

620
VOLUME ["/project"]
721
WORKDIR "/project/fitsio"
22+
23+
RUN apt-get update && \
24+
apt-get install -yq --no-install-recommends \
25+
valgrind \
26+
&& \
27+
apt-get clean && \
28+
rm -rf /var/lib/apt/lists/*

fitsio/src/fitsfile.rs

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,8 @@ impl FitsFile {
549549
status,
550550
// unwrap guaranteed to succesed as status > 0
551551
message: status_to_string(status)?.unwrap(),
552-
}.into());
552+
}
553+
.into());
553554
}
554555

555556
let mut dimensions: Vec<_> = image_description.dimensions.clone().to_vec();
@@ -570,7 +571,8 @@ impl FitsFile {
570571
status,
571572
// unwrap guaranteed to succesed as status > 0
572573
message: status_to_string(status)?.unwrap(),
573-
}.into());
574+
}
575+
.into());
574576
}
575577

576578
// Current HDU should be at the new HDU
@@ -1073,7 +1075,8 @@ mod test {
10731075
let hdu = f.hdu(0).unwrap();
10741076
let naxis: i64 = hdu.read_key(&mut f, "NAXIS").unwrap();
10751077
assert_eq!(naxis, 0);
1076-
}).unwrap();
1078+
})
1079+
.unwrap();
10771080
});
10781081
}
10791082

@@ -1268,12 +1271,10 @@ mod test {
12681271
with_temp_file(|filename| {
12691272
{
12701273
let mut f = FitsFile::create(filename).open().unwrap();
1271-
let table_description = vec![
1272-
ColumnDescription::new("bar")
1273-
.with_type(ColumnDataType::Int)
1274-
.create()
1275-
.unwrap(),
1276-
];
1274+
let table_description = vec![ColumnDescription::new("bar")
1275+
.with_type(ColumnDataType::Int)
1276+
.create()
1277+
.unwrap()];
12771278
f.create_table("foo".to_string(), &table_description)
12781279
.unwrap();
12791280
}
@@ -1299,7 +1300,8 @@ mod test {
12991300
}
13001301
thing => panic!("{:?}", thing),
13011302
}
1302-
}).unwrap();
1303+
})
1304+
.unwrap();
13031305
});
13041306
}
13051307

@@ -1325,7 +1327,8 @@ mod test {
13251327
}
13261328
thing => panic!("{:?}", thing),
13271329
}
1328-
}).unwrap();
1330+
})
1331+
.unwrap();
13291332
});
13301333
}
13311334

@@ -1365,9 +1368,9 @@ mod test {
13651368
.read_region(&mut f, &vec![&xcoord, &ycoord, &zcoord])
13661369
.unwrap();
13671370

1368-
assert_eq!(read_data.len(), 96);
1369-
assert_eq!(read_data[0], 712);
1370-
assert_eq!(read_data[50], 942);
1371+
assert_eq!(read_data.len(), (6 - 2) * (17 - 11) * (7 - 3));
1372+
assert_eq!(read_data[0], 614);
1373+
assert_eq!(read_data[50], 958);
13711374
});
13721375
}
13731376

@@ -1442,12 +1445,10 @@ mod test {
14421445
fn test_creating_new_table_returns_hdu_object() {
14431446
with_temp_file(|filename| {
14441447
let mut f = FitsFile::create(filename).open().unwrap();
1445-
let table_description = vec![
1446-
ColumnDescription::new("bar")
1447-
.with_type(ColumnDataType::Int)
1448-
.create()
1449-
.unwrap(),
1450-
];
1448+
let table_description = vec![ColumnDescription::new("bar")
1449+
.with_type(ColumnDataType::Int)
1450+
.create()
1451+
.unwrap()];
14511452
let hdu: FitsHdu = f
14521453
.create_table("foo".to_string(), &table_description)
14531454
.unwrap();

fitsio/src/headers.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,8 @@ mod tests {
226226
f.hdu(0).unwrap().read_key::<String>(&mut f, "bar").unwrap(),
227227
"baz".to_string()
228228
);
229-
}).unwrap();
229+
})
230+
.unwrap();
230231
});
231232
}
232233

0 commit comments

Comments
 (0)