( env_consts: LeanList<LeanBorrowed<'_>>, names: LeanArray<LeanBorrowed<'_>>, expect_pass: LeanArray<LeanBorrowed<'_>>, quiet: LeanBool<LeanBorrowed<'_>>, )
| 220 | /// `IX_KERNEL_CHECK_NAME_CHARS`. |
| 221 | #[unsafe(no_mangle)] |
| 222 | pub extern "C" fn rs_kernel_check_consts( |
| 223 | env_consts: LeanList<LeanBorrowed<'_>>, |
| 224 | names: LeanArray<LeanBorrowed<'_>>, |
| 225 | expect_pass: LeanArray<LeanBorrowed<'_>>, |
| 226 | quiet: LeanBool<LeanBorrowed<'_>>, |
| 227 | ) -> LeanIOResult<LeanOwned> { |
| 228 | let total_start = Instant::now(); |
| 229 | let quiet = quiet.to_bool(); |
| 230 | |
| 231 | // --------------------------------------------------------------------- |
| 232 | // Decode inputs |
| 233 | // --------------------------------------------------------------------- |
| 234 | let t0 = Instant::now(); |
| 235 | let rust_env = decode_env(env_consts); |
| 236 | // Decode names structurally — no `Name.toString` / `parse_name` dance. |
| 237 | // The resulting `Name`s are byte-for-byte the same as the kernel's |
| 238 | // stored names (same component strings, same content hash). |
| 239 | let names_vec: Vec<Name> = decode_name_array(&names); |
| 240 | // `Array Bool` elements are boxed tagged scalars: |
| 241 | // `lean_box(n) = (n << 1) | 1`, so `Bool.false` has raw value 1 and |
| 242 | // `Bool.true` has raw value 3. `unbox_usize()` (= `as_raw() >> 1`) |
| 243 | // recovers the ctor tag (0 = false, 1 = true). |
| 244 | let expect_pass_vec: Vec<bool> = |
| 245 | expect_pass.map(|b| b.unbox_usize() == 1).into_iter().collect(); |
| 246 | eprintln!("[rs_kernel_check] read env: {:>8.1?}", t0.elapsed()); |
| 247 | |
| 248 | // --------------------------------------------------------------------- |
| 249 | // Compile Lean → Ixon |
| 250 | // --------------------------------------------------------------------- |
| 251 | let t1 = Instant::now(); |
| 252 | let rust_env_arc = Arc::new(rust_env); |
| 253 | let compile_state = |
| 254 | match compile_env_with_options(&rust_env_arc, CompileOptions::default()) { |
| 255 | Ok(s) => s, |
| 256 | Err(e) => { |
| 257 | return build_uniform_error( |
| 258 | names_vec.len(), |
| 259 | &format!("[compile] {e:?}"), |
| 260 | ); |
| 261 | }, |
| 262 | }; |
| 263 | eprintln!("[rs_kernel_check] compile: {:>8.1?}", t1.elapsed()); |
| 264 | |
| 265 | let CompileState { env: ixon_env, ungrounded: compile_ungrounded, .. } = |
| 266 | compile_state; |
| 267 | |
| 268 | // Snapshot per-constant compile failures (ill-formed inductives, |
| 269 | // cascading MissingConstant, etc.) keyed by `Name` so the check loop |
| 270 | // can skip the kernel and report them as compile-side rejections. |
| 271 | // `compile_env` no longer aborts on per-block failure; it populates |
| 272 | // `CompileState.ungrounded` and continues, letting good constants still |
| 273 | // compile cleanly. |
| 274 | let ungrounded: FxHashMap<Name, String> = compile_ungrounded |
| 275 | .iter() |
| 276 | .map(|e| (e.key().clone(), e.value().clone())) |
| 277 | .collect(); |
| 278 | drop(compile_ungrounded); |
| 279 | drop(rust_env_arc); |
nothing calls this directly
no test coverage detected