Skip to content

Commit a0d771d

Browse files
committed
Revert all changes - see what CI is doing
1 parent 4a8bdd9 commit a0d771d

File tree

17 files changed

+134
-61
lines changed

17 files changed

+134
-61
lines changed

.github/workflows/bindgen.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,20 @@ jobs:
5050
with:
5151
# MSRV below is documented in Cargo.toml and README.md, please update those if you
5252
# change this.
53-
toolchain: 1.70.0
53+
toolchain: 1.60.0
5454

5555
- name: Test lib with msrv
56-
run: cargo +1.70.0 test --package bindgen
56+
run: cargo +1.60.0 test --package bindgen
5757

5858
- name: Install msrv for cli
5959
uses: dtolnay/rust-toolchain@master
6060
with:
6161
# MSRV below is documented in Cargo.toml and README.md, please update those if you
6262
# change this.
63-
toolchain: 1.70.0
63+
toolchain: 1.64.0
6464

6565
- name: Test cli with msrv
66-
run: cargo +1.70.0 build --package bindgen-cli
66+
run: cargo +1.64.0 build --package bindgen-cli
6767

6868
minimal:
6969
runs-on: ubuntu-latest

Cargo.lock

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ extern "C" {
3939

4040
## MSRV
4141

42-
The `bindgen` minimum supported Rust version is **1.70.0**.
42+
The `bindgen` minimum supported Rust version is **1.60.0**.
4343

44-
The `bindgen-cli` minimum supported Rust version is **1.70.0**.
44+
The `bindgen-cli` minimum supported Rust version is **1.64.0**.
4545

4646
No MSRV bump policy has been established yet, so MSRV may increase in any release.
4747

bindgen-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ documentation = "https://docs.rs/bindgen"
1313
homepage = "https://rust-lang.github.io/rust-bindgen/"
1414
version = "0.69.4"
1515
edition = "2018"
16-
rust-version = "1.70.0"
16+
rust-version = "1.64.0"
1717

1818
[[bin]]
1919
path = "main.rs"

bindgen-tests/tests/quickchecking/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "quickchecking"
33
description = "Bindgen property tests with quickcheck. Generate random valid C code and pass it to the csmith/predicate.py script"
44
version = "0.0.0"
55
publish = false
6-
rust-version = "1.70"
6+
rust-version = "1.64"
77
edition = "2018"
88

99
[lib]
@@ -16,6 +16,7 @@ path = "src/bin.rs"
1616

1717
[dependencies]
1818
clap = "4"
19+
lazy_static = "1.0"
1920
quickcheck = "1.0"
2021
tempfile = "3"
2122

bindgen-tests/tests/quickchecking/src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
//! println!("{}", header);
1515
//! }
1616
//! ```
17+
//!
1718
#![deny(missing_docs)]
19+
#[macro_use]
20+
extern crate lazy_static;
1821

1922
use quickcheck::{Gen, QuickCheck, TestResult};
2023
use std::error::Error;
@@ -35,7 +38,10 @@ struct Context {
3538
}
3639

3740
// Initialize global context.
38-
static CONTEXT: Mutex<Context> = Mutex::new(Context { output_path: None });
41+
lazy_static! {
42+
static ref CONTEXT: Mutex<Context> =
43+
Mutex::new(Context { output_path: None });
44+
}
3945

4046
// Passes fuzzed header to the `csmith-fuzzing/predicate.py` script, returns
4147
// output of the associated command.

bindgen/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ version = "0.69.4"
1818
edition = "2018"
1919
build = "build.rs"
2020
# If you change this, also update README.md and msrv in .github/workflows/bindgen.yml
21-
rust-version = "1.70.0"
21+
rust-version = "1.60.0"
2222

2323
[lib]
2424
name = "bindgen"
@@ -30,6 +30,8 @@ bitflags = "2.2.1"
3030
cexpr = "0.6"
3131
clang-sys = { version = "1", features = ["clang_6_0"] }
3232
itertools = { version = ">=0.10,<0.13", default-features = false }
33+
lazy_static = "1"
34+
lazycell = "1"
3335
log = { version = "0.4", optional = true }
3436
prettyplease = { version = "0.2.7", optional = true, features = ["verbatim"] }
3537
proc-macro2 = { version = "1", default-features = false }

bindgen/callbacks.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,21 @@ pub use crate::ir::int::IntKind;
77
use std::fmt;
88

99
/// An enum to allow ignoring parsing of macros.
10-
#[derive(Copy, Clone, Debug, PartialEq, Eq, Default)]
10+
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
1111
pub enum MacroParsingBehavior {
1212
/// Ignore the macro, generating no code for it, or anything that depends on
1313
/// it.
1414
Ignore,
1515
/// The default behavior bindgen would have otherwise.
16-
#[default]
1716
Default,
1817
}
1918

19+
impl Default for MacroParsingBehavior {
20+
fn default() -> Self {
21+
MacroParsingBehavior::Default
22+
}
23+
}
24+
2025
/// A trait to allow configuring different kinds of types in different
2126
/// situations.
2227
pub trait ParseCallbacks: fmt::Debug {

bindgen/clang.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use std::fs::OpenOptions;
1414
use std::hash::Hash;
1515
use std::hash::Hasher;
1616
use std::os::raw::{c_char, c_int, c_longlong, c_uint, c_ulong, c_ulonglong};
17-
use std::sync::OnceLock;
1817
use std::{mem, ptr, slice};
1918

2019
/// Type representing a clang attribute.
@@ -1529,13 +1528,13 @@ impl Type {
15291528
pub(crate) fn is_associated_type(&self) -> bool {
15301529
// This is terrible :(
15311530
fn hacky_parse_associated_type<S: AsRef<str>>(spelling: S) -> bool {
1532-
static ASSOC_TYPE_RE: OnceLock<regex::Regex> = OnceLock::new();
1533-
ASSOC_TYPE_RE
1534-
.get_or_init(|| {
1535-
regex::Regex::new(r"typename type\-parameter\-\d+\-\d+::.+")
1536-
.unwrap()
1537-
})
1538-
.is_match(spelling.as_ref())
1531+
lazy_static! {
1532+
static ref ASSOC_TYPE_RE: regex::Regex = regex::Regex::new(
1533+
r"typename type\-parameter\-\d+\-\d+::.+"
1534+
)
1535+
.unwrap();
1536+
}
1537+
ASSOC_TYPE_RE.is_match(spelling.as_ref())
15391538
}
15401539

15411540
self.kind() == CXType_Unexposed &&

bindgen/codegen/mod.rs

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2608,7 +2608,7 @@ impl CodeGenerator for CompInfo {
26082608
ctx,
26092609
&canonical_ident,
26102610
flex_inner_ty,
2611-
&generic_param_names,
2611+
&*generic_param_names,
26122612
&impl_generics_labels,
26132613
));
26142614
}
@@ -3010,7 +3010,7 @@ impl Method {
30103010
}
30113011

30123012
/// A helper type that represents different enum variations.
3013-
#[derive(Copy, Clone, PartialEq, Eq, Debug, Default)]
3013+
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
30143014
pub enum EnumVariation {
30153015
/// The code for this enum will use a Rust enum. Note that creating this in unsafe code
30163016
/// (including FFI) with an invalid value will invoke undefined behaviour, whether or not
@@ -3027,7 +3027,6 @@ pub enum EnumVariation {
30273027
is_global: bool,
30283028
},
30293029
/// The code for this enum will use consts
3030-
#[default]
30313030
Consts,
30323031
/// The code for this enum will use a module containing consts
30333032
ModuleConsts,
@@ -3045,6 +3044,12 @@ impl EnumVariation {
30453044
}
30463045
}
30473046

3047+
impl Default for EnumVariation {
3048+
fn default() -> EnumVariation {
3049+
EnumVariation::Consts
3050+
}
3051+
}
3052+
30483053
impl fmt::Display for EnumVariation {
30493054
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
30503055
let s = match self {
@@ -3752,12 +3757,11 @@ impl CodeGenerator for Enum {
37523757
}
37533758

37543759
/// Enum for the default type of macro constants.
3755-
#[derive(Copy, Clone, PartialEq, Eq, Debug, Default)]
3760+
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
37563761
pub enum MacroTypeVariation {
37573762
/// Use i32 or i64
37583763
Signed,
37593764
/// Use u32 or u64
3760-
#[default]
37613765
Unsigned,
37623766
}
37633767

@@ -3771,6 +3775,12 @@ impl fmt::Display for MacroTypeVariation {
37713775
}
37723776
}
37733777

3778+
impl Default for MacroTypeVariation {
3779+
fn default() -> MacroTypeVariation {
3780+
MacroTypeVariation::Unsigned
3781+
}
3782+
}
3783+
37743784
impl std::str::FromStr for MacroTypeVariation {
37753785
type Err = std::io::Error;
37763786

@@ -3791,10 +3801,9 @@ impl std::str::FromStr for MacroTypeVariation {
37913801
}
37923802

37933803
/// Enum for how aliases should be translated.
3794-
#[derive(Copy, Clone, PartialEq, Eq, Debug, Default)]
3804+
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
37953805
pub enum AliasVariation {
37963806
/// Convert to regular Rust alias
3797-
#[default]
37983807
TypeAlias,
37993808
/// Create a new type by wrapping the old type in a struct and using #[repr(transparent)]
38003809
NewType,
@@ -3814,6 +3823,12 @@ impl fmt::Display for AliasVariation {
38143823
}
38153824
}
38163825

3826+
impl Default for AliasVariation {
3827+
fn default() -> AliasVariation {
3828+
AliasVariation::TypeAlias
3829+
}
3830+
}
3831+
38173832
impl std::str::FromStr for AliasVariation {
38183833
type Err = std::io::Error;
38193834

bindgen/ir/analysis/has_vtable.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ use std::cmp;
99
use std::ops;
1010

1111
/// The result of the `HasVtableAnalysis` for an individual item.
12-
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Default)]
12+
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
1313
pub(crate) enum HasVtableResult {
1414
/// The item does not have a vtable pointer.
15-
#[default]
1615
No,
1716

1817
/// The item has a vtable and the actual vtable pointer is within this item.
@@ -23,6 +22,12 @@ pub(crate) enum HasVtableResult {
2322
BaseHasVtable,
2423
}
2524

25+
impl Default for HasVtableResult {
26+
fn default() -> Self {
27+
HasVtableResult::No
28+
}
29+
}
30+
2631
impl HasVtableResult {
2732
/// Take the least upper bound of `self` and `rhs`.
2833
pub(crate) fn join(self, rhs: Self) -> Self {

bindgen/ir/analysis/mod.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,22 @@ pub(crate) trait MonotoneFramework: Sized + fmt::Debug {
125125

126126
/// Whether an analysis's `constrain` function modified the incremental results
127127
/// or not.
128-
#[derive(Debug, Copy, Clone, PartialEq, Eq, Default)]
128+
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
129129
pub(crate) enum ConstrainResult {
130130
/// The incremental results were updated, and the fix-point computation
131131
/// should continue.
132132
Changed,
133133

134134
/// The incremental results were not updated.
135-
#[default]
136135
Same,
137136
}
138137

138+
impl Default for ConstrainResult {
139+
fn default() -> Self {
140+
ConstrainResult::Same
141+
}
142+
}
143+
139144
impl ops::BitOr for ConstrainResult {
140145
type Output = Self;
141146

bindgen/ir/analysis/sizedness.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,13 @@ use std::{cmp, ops};
2424
///
2525
/// We initially assume that all types are `ZeroSized` and then update our
2626
/// understanding as we learn more about each type.
27-
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Default)]
27+
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
2828
pub(crate) enum SizednessResult {
2929
/// The type is zero-sized.
3030
///
3131
/// This means that if it is a C++ type, and is not being used as a base
3232
/// member, then we must add an `_address` byte to enforce the
3333
/// unique-address-per-distinct-object-instance rule.
34-
#[default]
3534
ZeroSized,
3635

3736
/// Whether this type is zero-sized or not depends on whether a type
@@ -63,6 +62,12 @@ pub(crate) enum SizednessResult {
6362
NonZeroSized,
6463
}
6564

65+
impl Default for SizednessResult {
66+
fn default() -> Self {
67+
SizednessResult::ZeroSized
68+
}
69+
}
70+
6671
impl SizednessResult {
6772
/// Take the least upper bound of `self` and `rhs`.
6873
pub(crate) fn join(self, rhs: Self) -> Self {

bindgen/ir/annotations.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ use std::str::FromStr;
99
use crate::clang;
1010

1111
/// What kind of visibility modifier should be used for a struct or field?
12-
#[derive(Copy, PartialEq, Eq, PartialOrd, Ord, Clone, Debug, Default)]
12+
#[derive(Copy, PartialEq, Eq, PartialOrd, Ord, Clone, Debug)]
1313
pub enum FieldVisibilityKind {
1414
/// Fields are marked as private, i.e., struct Foo {bar: bool}
1515
Private,
1616
/// Fields are marked as crate public, i.e., struct Foo {pub(crate) bar: bool}
1717
PublicCrate,
1818
/// Fields are marked as public, i.e., struct Foo {pub bar: bool}
19-
#[default]
2019
Public,
2120
}
2221

@@ -45,6 +44,12 @@ impl std::fmt::Display for FieldVisibilityKind {
4544
}
4645
}
4746

47+
impl Default for FieldVisibilityKind {
48+
fn default() -> Self {
49+
FieldVisibilityKind::Public
50+
}
51+
}
52+
4853
/// What kind of accessor should we provide for a field?
4954
#[derive(Copy, PartialEq, Eq, Clone, Debug)]
5055
pub(crate) enum FieldAccessorKind {

0 commit comments

Comments
 (0)