Skip to content

Commit

Permalink
Bug 1730397 - Update packed_simd to a version that supports rustc >= …
Browse files Browse the repository at this point in the history
…1.56. r=hsivonen

Differential Revision: https://phabricator.services.mozilla.com/D125604
  • Loading branch information
glandium committed Sep 17, 2021
1 parent c0ad5b0 commit 66da78e
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .cargo/config.in
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ rev = "746743227485a83123784df0c53227ab466612ed"
[source."https://github.com/hsivonen/packed_simd"]
git = "https://github.com/hsivonen/packed_simd"
replace-with = "vendored-sources"
rev = "6a16f954950401b92b4e220fbf2dfaf6f00e1fb2"
rev = "8b4bd7d8229660a749dbe419a57ea01df9de5453"

[source."https://github.com/hsivonen/chardetng_c"]
git = "https://github.com/hsivonen/chardetng_c"
Expand Down
3 changes: 2 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ opt-level = 2
chardetng = { git = "https://github.com/hsivonen/chardetng", rev="302c995f91f44cf26e77dc4758ad56c3ff0153ad" }
chardetng_c = { git = "https://github.com/hsivonen/chardetng_c", rev="ed8a4c6f900a90d4dbc1d64b856e61490a1c3570" }
libudev-sys = { path = "dom/webauthn/libudev-sys" }
packed_simd = { git = "https://github.com/hsivonen/packed_simd", rev="6a16f954950401b92b4e220fbf2dfaf6f00e1fb2" }
packed_simd = { git = "https://github.com/hsivonen/packed_simd", rev="8b4bd7d8229660a749dbe419a57ea01df9de5453" }
minidump_writer_linux = { git = "https://github.com/msirringhaus/minidump_writer_linux.git", rev = "029ac0d54b237f27dc7d8d4e51bc0fb076e5e852" }
# The following overrides point to dummy projects, as a temporary measure until this is resolved:
# https://github.com/rust-lang/cargo/issues/6179
Expand Down
2 changes: 1 addition & 1 deletion third_party/rust/packed_simd/.cargo-checksum.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions third_party/rust/packed_simd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ default = []
into_bits = []
libcore_neon = []

[build-dependencies]
rustc_version = "0.2"

[dev-dependencies]
paste = "^0.1.3"
arrayvec = { version = "^0.5", default-features = false }
Expand Down
26 changes: 26 additions & 0 deletions third_party/rust/packed_simd/build.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,34 @@
use rustc_version::{version_meta, Channel, Version};

fn main() {
println!("cargo:rustc-env=RUSTC_BOOTSTRAP=1");
let target = std::env::var("TARGET")
.expect("TARGET environment variable not defined");
if target.contains("neon") {
println!("cargo:rustc-cfg=libcore_neon");
}
let ver_meta = version_meta().unwrap();
let old_const_generics =
if ver_meta.semver < Version::parse("1.56.0-alpha").unwrap() {
true
} else if ver_meta.semver >= Version::parse("1.57.0-alpha").unwrap() {
false
} else {
match ver_meta.channel {
Channel::Stable | Channel::Beta => false,
Channel::Nightly | Channel::Dev
if ver_meta
.commit_date
.as_deref()
.map(|d| d < "2021-08-31")
.unwrap_or(false) =>
{
true
}
_ => false,
}
};
if old_const_generics {
println!("cargo:rustc-cfg=const_generics");
}
}
3 changes: 2 additions & 1 deletion third_party/rust/packed_simd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,9 @@
//! Numeric casts are not very "precise": sometimes lossy, sometimes value
//! preserving, etc.
#![cfg_attr(const_generics, feature(const_generics))]
#![cfg_attr(not(const_generics), feature(adt_const_params))]
#![feature(
const_generics,
repr_simd,
rustc_attrs,
platform_intrinsics,
Expand Down

0 comments on commit 66da78e

Please sign in to comment.