Add --wrap-unsafe-ops
option (#2354) · rust-lang/rust-bindgen@046d6f9 (original) (raw)
107 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -89,8 +89,6 @@ jobs: | ||
89 | 89 | |
90 | 90 | - name: Test expectations |
91 | 91 | run: cd bindgen-tests/tests/expectations && cargo test |
92 | -env: | |
93 | -RUSTFLAGS: "-D unsafe_op_in_unsafe_fn -D unused_unsafe" | |
94 | 92 | |
95 | 93 | test: |
96 | 94 | runs-on: ${{matrix.os}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -154,6 +154,8 @@ | ||
154 | 154 | ## Added |
155 | 155 | |
156 | 156 | ## Changed |
157 | +* Only wrap unsafe operations in unsafe blocks if the `--wrap_unsafe_ops` | |
158 | + option is enabled. | |
157 | 159 | |
158 | 160 | * Replace the `name: &str` argument for `ParseCallbacks::add_derives` by |
159 | 161 | `info: DeriveInfo`. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -562,6 +562,9 @@ where | ||
562 | 562 | .value_name("override") |
563 | 563 | .multiple_occurrences(true) |
564 | 564 | .number_of_values(1), |
565 | +Arg::new("wrap-unsafe-ops") | |
566 | +.long("wrap-unsafe-ops") | |
567 | +.help("Wrap unsafe operations in unsafe blocks."), | |
565 | 568 | Arg::new("V") |
566 | 569 | .long("version") |
567 | 570 | .help("Prints the version, and exits"), |
@@ -1085,5 +1088,9 @@ where | ||
1085 | 1088 | } |
1086 | 1089 | } |
1087 | 1090 | |
1091 | +if matches.is_present("wrap-unsafe-ops") { | |
1092 | + builder = builder.wrap_unsafe_ops(true); | |
1093 | +} | |
1094 | + | |
1088 | 1095 | Ok((builder, output, verbose)) |
1089 | 1096 | } |