Commit 42e03cc
committed
Add ub_checks for downcast_unchecked
Right now debug_assert! is used, which will not trigger in user code.
This is likely unacceptable for performance reasons,
since the optimizer can not understand virtual Any::type_id() calls.
This could potentially be fixed if we apply something like #[ffi_const]
to the Any::type_id() function (which would have wierder reaching benefits).
This cannot use the assert_unsafe_precondition! macro,
because that requires the assertion to work in a const context.1 parent 040a98a commit 42e03cc
4 files changed
+21
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
395 | | - | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
396 | 398 | | |
397 | 399 | | |
398 | 400 | | |
| |||
451 | 453 | | |
452 | 454 | | |
453 | 455 | | |
454 | | - | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
455 | 459 | | |
456 | 460 | | |
457 | 461 | | |
| |||
510 | 514 | | |
511 | 515 | | |
512 | 516 | | |
513 | | - | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
514 | 520 | | |
515 | 521 | | |
516 | 522 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2042 | 2042 | | |
2043 | 2043 | | |
2044 | 2044 | | |
| 2045 | + | |
| 2046 | + | |
| 2047 | + | |
2045 | 2048 | | |
2046 | 2049 | | |
2047 | 2050 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2754 | 2754 | | |
2755 | 2755 | | |
2756 | 2756 | | |
| 2757 | + | |
| 2758 | + | |
| 2759 | + | |
2757 | 2760 | | |
2758 | 2761 | | |
2759 | 2762 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
295 | | - | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
296 | 298 | | |
297 | 299 | | |
298 | 300 | | |
| |||
322 | 324 | | |
323 | 325 | | |
324 | 326 | | |
325 | | - | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
326 | 330 | | |
327 | 331 | | |
328 | 332 | | |
| |||
0 commit comments