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

codegen/builder: Assert the main thread is initalized #1607

Merged
merged 1 commit into from
Oct 19, 2024
Merged
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
8 changes: 7 additions & 1 deletion src/codegen/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ use super::{
use crate::{
analysis::{
self, bounds::BoundType, object::has_builder_properties, record_type::RecordType,
ref_mode::RefMode, rust_type::RustType,
ref_mode::RefMode, rust_type::RustType, safety_assertion_mode::SafetyAssertionMode,
},
env::Env,
library::{self, Nullable},
nameutil,
traits::IntoString,
writer::safety_assertion_mode_to_str,
};

pub fn generate(w: &mut dyn Write, env: &Env, analysis: &analysis::object::Info) -> Result<()> {
Expand Down Expand Up @@ -456,6 +457,11 @@ fn generate_builder(w: &mut dyn Write, env: &Env, analysis: &analysis::object::I
pub fn build(self) -> {name} {{",
name = analysis.name,
)?;
writeln!(
w,
"{}",
safety_assertion_mode_to_str(SafetyAssertionMode::InMainThread)
bilelmoussaoui marked this conversation as resolved.
Show resolved Hide resolved
)?;

// The split allows us to not have clippy::let_and_return lint disabled
if let Some(code) = analysis.builder_postprocess.as_ref() {
Expand Down
Loading