Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dependency on rustc_version. #1176

Merged
merged 4 commits into from
Oct 21, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 2 additions & 17 deletions Cargo.lock

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

4 changes: 1 addition & 3 deletions engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ thiserror = "1"
regex = "1.5"
indexmap = "1.8"
prettyplease = { version = "0.1.15", features = ["verbatim"] }

[build-dependencies]
rustc_version = "0.4"
rustversion = "1.0"

[dependencies.syn]
version = "1.0.39"
Expand Down
15 changes: 0 additions & 15 deletions engine/build.rs

This file was deleted.

3 changes: 0 additions & 3 deletions engine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// This feature=nightly could be set by build.rs, but since we only care
// about it for docs, we ask docs.rs to set it in the Cargo.toml.
#![cfg_attr(feature = "nightly", feature(doc_cfg))]
#![forbid(unsafe_code)]

mod ast_discoverer;
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ indoc = "1.0"
log = "0.4"
cxx = "1.0.78"
itertools = "0.10"
rustc_version = "0.4.0"
rustversion = "1.0"

[dependencies.syn]
version = "1.0.39"
Expand Down
22 changes: 13 additions & 9 deletions integration-tests/tests/cpprefs_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ use indoc::indoc;
use proc_macro2::TokenStream;
use quote::quote;

#[rustversion::nightly]
const fn arbitrary_self_types_supported() -> bool {
true
}

#[rustversion::not(nightly)]
const fn arbitrary_self_types_supported() -> bool {
false
}
adetaylor marked this conversation as resolved.
Show resolved Hide resolved

/// A positive test, we expect to pass.
fn run_cpprefs_test(
cxx_code: &str,
Expand All @@ -21,7 +31,7 @@ fn run_cpprefs_test(
generate: &[&str],
generate_pods: &[&str],
) {
if rustc_version::version_meta().unwrap().channel != rustc_version::Channel::Nightly {
if !arbitrary_self_types_supported() {
// "unsafe_references_wrapped" requires arbitrary_self_types, which requires nightly.
return;
}
Expand Down Expand Up @@ -62,10 +72,7 @@ fn test_method_call_mut() {
quote! {
let goat = ffi::Goat::new().within_unique_ptr();
let mut goat = autocxx::CppUniquePtrPin::new(goat);
// Only nightly supports calling methods on cpp refs
if rustc_version::version_meta().unwrap().channel == rustc_version::Channel::Nightly {
goat.as_cpp_mut_ref().add_a_horn();
}
goat.as_cpp_mut_ref().add_a_horn();
},
&["Goat"],
&[],
Expand Down Expand Up @@ -98,10 +105,7 @@ fn test_method_call_const() {
quote! {
let goat = ffi::Goat::new().within_unique_ptr();
let goat = autocxx::CppUniquePtrPin::new(goat);
// Only nightly supports calling methods on cpp refs
if rustc_version::version_meta().unwrap().channel == rustc_version::Channel::Nightly {
goat.as_cpp_ref().describe();
}
goat.as_cpp_ref().describe();
},
&["Goat"],
&[],
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![doc = include_str!("../README.md")]
#![cfg_attr(nightly, feature(receiver_trait))]

// Copyright 2020 Google LLC
//
Expand Down