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

rust: updates for 1.64 #2637

Merged
merged 1 commit into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .cargo/config
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ xtask = "run --package xtask --"

[target.'cfg(feature = "cargo-clippy")']
rustflags = [
"-Aclippy::needless_borrow", # TODO: remove once msrv increased from 1.48
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lint started asking to remove & from &[x, y, z] slices in a lot of places which were incompatible with MSRV :(

"-Dclippy::checked_conversions",
"-Dclippy::dbg_macro",
"-Dclippy::explicit_into_iter_loop",
Expand Down
2 changes: 1 addition & 1 deletion pyo3-build-config/src/impl_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,7 @@ impl Sysconfigdata {
/// [`from_sysconfigdata`](InterpreterConfig::from_sysconfigdata).
pub fn parse_sysconfigdata(sysconfigdata_path: impl AsRef<Path>) -> Result<Sysconfigdata> {
let sysconfigdata_path = sysconfigdata_path.as_ref();
let mut script = fs::read_to_string(&sysconfigdata_path).with_context(|| {
let mut script = fs::read_to_string(sysconfigdata_path).with_context(|| {
format!(
"failed to read config from {}",
sysconfigdata_path.display()
Expand Down
2 changes: 1 addition & 1 deletion pyo3-build-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ pub mod pyo3_build_script_impl {
path.display()
)
})?;
std::fs::create_dir_all(&parent_dir).with_context(|| {
std::fs::create_dir_all(parent_dir).with_context(|| {
format!(
"failed to create config file directory {}",
parent_dir.display()
Expand Down
6 changes: 1 addition & 5 deletions pyo3-ffi/src/cpython/unicodeobject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,7 @@ pub unsafe fn PyUnicode_IS_COMPACT(op: *mut PyObject) -> c_uint {
#[inline]
#[cfg(target_endian = "little")]
pub unsafe fn PyUnicode_IS_COMPACT_ASCII(op: *mut PyObject) -> c_uint {
if (*(op as *mut PyASCIIObject)).ascii() != 0 && PyUnicode_IS_COMPACT(op) != 0 {
1
} else {
0
}
((*(op as *mut PyASCIIObject)).ascii() != 0 && PyUnicode_IS_COMPACT(op) != 0).into()
}

#[cfg(not(Py_3_12))]
Expand Down
14 changes: 4 additions & 10 deletions tests/ui/missing_intopy.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ error[E0599]: the method `assert_into_py_result` exists for struct `Blah`, but i
--> tests/ui/missing_intopy.rs:3:1
|
1 | struct Blah;
| ------------
| -----------
| |
| method `assert_into_py_result` not found for this
| method `assert_into_py_result` not found for this struct
| doesn't satisfy `Blah: IntoPy<Py<PyAny>>`
| doesn't satisfy `Blah: IntoPyResult<Blah>`
2 |
Expand All @@ -17,14 +17,8 @@ error[E0599]: the method `assert_into_py_result` exists for struct `Blah`, but i
note: the following trait must be implemented
--> src/conversion.rs
|
| / pub trait IntoPy<T>: Sized {
| | /// Performs the conversion.
| | fn into_py(self, py: Python<'_>) -> T;
| |
... |
| | }
| | }
| |_^
| pub trait IntoPy<T>: Sized {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the attribute macro `pyo3::pyfunction` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `Blah: IntoPyCallbackOutput<_>` is not satisfied
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/not_send.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ note: required because it's used within this closure
--> tests/ui/not_send.rs:4:22
|
4 | py.allow_threads(|| { drop(py); });
| ^^^^^^^^^^^^^^^^
= note: required because of the requirements on the impl of `Ungil` for `[closure@$DIR/tests/ui/not_send.rs:4:22: 4:38]`
| ^^
= note: required because of the requirements on the impl of `Ungil` for `[closure@$DIR/tests/ui/not_send.rs:4:22: 4:24]`
note: required by a bound in `pyo3::Python::<'py>::allow_threads`
--> src/marker.rs
|
Expand Down
9 changes: 3 additions & 6 deletions tests/ui/not_send2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,9 @@ error[E0277]: `UnsafeCell<PyObject>` cannot be shared between threads safely
note: required because it's used within this closure
--> tests/ui/not_send2.rs:8:26
|
8 | py.allow_threads(|| {
| __________________________^
9 | | println!("{:?}", string);
10 | | });
| |_________^
= note: required because of the requirements on the impl of `Ungil` for `[closure@$DIR/tests/ui/not_send2.rs:8:26: 10:10]`
8 | py.allow_threads(|| {
| ^^
= note: required because of the requirements on the impl of `Ungil` for `[closure@$DIR/tests/ui/not_send2.rs:8:26: 8:28]`
note: required by a bound in `pyo3::Python::<'py>::allow_threads`
--> src/marker.rs
|
Expand Down
9 changes: 3 additions & 6 deletions tests/ui/not_send3.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@ error[E0277]: `Rc<i32>` cannot be shared between threads safely
note: required because it's used within this closure
--> tests/ui/not_send3.rs:8:26
|
8 | py.allow_threads(|| {
| __________________________^
9 | | println!("{:?}", rc);
10 | | });
| |_________^
= note: required because of the requirements on the impl of `Ungil` for `[closure@$DIR/tests/ui/not_send3.rs:8:26: 10:10]`
8 | py.allow_threads(|| {
| ^^
= note: required because of the requirements on the impl of `Ungil` for `[closure@$DIR/tests/ui/not_send3.rs:8:26: 8:28]`
note: required by a bound in `pyo3::Python::<'py>::allow_threads`
--> src/marker.rs
|
Expand Down
2 changes: 1 addition & 1 deletion xtask/src/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub fn run(opts: DocOpts) -> anyhow::Result<()> {
"unstable-options",
"-Z",
"rustdoc-scrape-examples=examples",
]
][..]
})
.args(if opts.open { Some("--open") } else { None }),
)?;
Expand Down