Skip to content
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
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ opt-level = 3

[profile.test]
opt-level = 3
lto = "thin"
# https://github.com/rust-lang/rust/issues/92869

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is totally unexpected effect

# lto = "thin"

[profile.bench]
lto = true
Expand Down
2 changes: 1 addition & 1 deletion common/src/boxvec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ pub struct Drain<'a, T> {
}

unsafe impl<'a, T: Sync> Sync for Drain<'a, T> {}
unsafe impl<'a, T: Send> Send for Drain<'a, T> {}
unsafe impl<'a, T: Sync> Send for Drain<'a, T> {}

impl<T> Iterator for Drain<'_, T> {
type Item = T;
Expand Down
3 changes: 3 additions & 0 deletions common/src/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ struct PointersInner<T> {
_pin: PhantomPinned,
}

unsafe impl<T: Send> Send for PointersInner<T> {}
unsafe impl<T: Sync> Sync for PointersInner<T> {}

unsafe impl<T: Send> Send for Pointers<T> {}
unsafe impl<T: Sync> Sync for Pointers<T> {}

Expand Down
1 change: 1 addition & 0 deletions compiler/src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ struct CompileContext {
}

#[derive(Debug, Clone, Copy, PartialEq)]
#[allow(clippy::enum_variant_names)]
enum FunctionContext {
NoFunction,
Function,
Expand Down
8 changes: 3 additions & 5 deletions derive/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ impl ItemMetaInner {
Err(syn::Error::new_spanned(
ident,
format!(
"#[{}({})] is not one of allowed attributes [{}]",
meta_ident.to_string(),
name,
"#[{meta_ident}({name})] is not one of allowed attributes [{}]",
allowed_names.join(", ")
),
))
Expand All @@ -116,7 +114,7 @@ impl ItemMetaInner {
if !lits.is_empty() {
return Err(syn::Error::new_spanned(
&meta_ident,
format!("#[{}(..)] cannot contain literal", meta_ident.to_string()),
format!("#[{meta_ident}(..)] cannot contain literal"),
));
}

Expand Down Expand Up @@ -381,7 +379,7 @@ impl AttributeExt for Attribute {
other.span(),
format!(
"#[{name}(...)] doesn't contain '{item}' to remove",
name = other.get_ident().unwrap().to_string(),
name = other.get_ident().unwrap(),
item = item_name
),
)),
Expand Down
3 changes: 3 additions & 0 deletions jit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ impl UnTypedAbiValue {
}
}

// we don't actually ever touch CompiledCode til we drop it, it should be safe.
// TODO: confirm with wasmtime ppl that it's not unsound?
#[allow(clippy::non_send_fields_in_send_ty)]
unsafe impl Send for CompiledCode {}
unsafe impl Sync for CompiledCode {}

Expand Down
8 changes: 4 additions & 4 deletions vm/src/codecs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,13 +455,13 @@ fn namereplace_errors(err: PyObjectRef, vm: &VirtualMachine) -> PyResult<(String
use std::fmt::Write;
let c_u32 = c as u32;
if let Some(c_name) = unicode_names2::name(c) {
write!(out, "\\N{{{}}}", c_name.to_string()).unwrap();
write!(out, "\\N{{{c_name}}}").unwrap();
} else if c_u32 >= 0x10000 {
write!(out, "\\U{:08x}", c_u32).unwrap();
write!(out, "\\U{c_u32:08x}").unwrap();
} else if c_u32 >= 0x100 {
write!(out, "\\u{:04x}", c_u32).unwrap();
write!(out, "\\u{c_u32:04x}").unwrap();
} else {
write!(out, "\\x{:02x}", c_u32).unwrap();
write!(out, "\\x{c_u32:02x}").unwrap();
}
}
Ok((out, range.end))
Expand Down
2 changes: 1 addition & 1 deletion vm/src/exceptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ impl VirtualMachine {
}?;

match offer_suggestions(exc, vm) {
Some(suggestions) => writeln!(output, ". Did you mean: '{}'?", suggestions.to_string()),
Some(suggestions) => writeln!(output, ". Did you mean: '{suggestions}'?"),
None => writeln!(output),
}
}
Expand Down
11 changes: 2 additions & 9 deletions vm/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,11 +413,7 @@ impl FormatSpec {
},
};

if raw_magnitude_string_result.is_err() {
return raw_magnitude_string_result;
}

let magnitude_string = self.add_magnitude_separators(raw_magnitude_string_result.unwrap());
let magnitude_string = self.add_magnitude_separators(raw_magnitude_string_result?);
let format_sign = self.sign.unwrap_or(FormatSign::Minus);
let sign_str = if num.is_sign_negative() && !num.is_nan() {
"-"
Expand Down Expand Up @@ -474,13 +470,10 @@ impl FormatSpec {
},
None => Ok(magnitude.to_str_radix(10)),
};
if raw_magnitude_string_result.is_err() {
return raw_magnitude_string_result;
}
let magnitude_string = format!(
"{}{}",
prefix,
self.add_magnitude_separators(raw_magnitude_string_result.unwrap())
self.add_magnitude_separators(raw_magnitude_string_result?)
);

let format_sign = self.sign.unwrap_or(FormatSign::Minus);
Expand Down
3 changes: 2 additions & 1 deletion vm/src/pyobjectrc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ pub struct PyWeak {

cfg_if::cfg_if! {
if #[cfg(feature = "threading")] {
#[allow(clippy::non_send_fields_in_send_ty)] // false positive?
unsafe impl Send for PyWeak {}
unsafe impl Sync for PyWeak {}
}
Expand Down Expand Up @@ -819,7 +820,7 @@ fn print_del_error(e: PyBaseExceptionRef, zelf: &PyObject, vm: &VirtualMachine)
let del_method = zelf.get_class_attr("__del__").unwrap();
let repr = &del_method.repr(vm);
match repr {
Ok(v) => println!("{}", v.to_string()),
Ok(v) => println!("{v}"),
Err(_) => println!("{}", del_method.class().name()),
}
let tb_module = vm.import("traceback", None, 0).unwrap();
Expand Down
8 changes: 4 additions & 4 deletions vm/src/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1956,10 +1956,6 @@ impl<'vm> Drop for ReprGuard<'vm> {
}
}

pub struct Interpreter {
vm: VirtualMachine,
}

/// The general interface for the VM
///
/// # Examples
Expand All @@ -1976,6 +1972,10 @@ pub struct Interpreter {
/// vm.run_code_obj(code_obj, scope).unwrap();
/// });
/// ```
pub struct Interpreter {
vm: VirtualMachine,
}

impl Interpreter {
pub fn new(settings: PySettings, init: InitParameter) -> Self {
Self::new_with_init(settings, |_| init)
Expand Down