| 1545 | match tc.tick() { |
| 1546 | Err(TcError::MaxRecFuel) => {}, |
| 1547 | other => panic!("expected MaxRecFuel at zero fuel, got {other:?}"), |
| 1548 | } |
| 1549 | } |
| 1550 | |
| 1551 | // ---- with_infer_only ---- |
| 1552 | |
| 1553 | #[test] |
| 1554 | fn with_infer_only_scoping() { |
| 1555 | let mut tc = new_tc(); |
| 1556 | assert!(!tc.infer_only); |
| 1557 | let r = tc.with_infer_only(|tc| { |
| 1558 | assert!(tc.infer_only); |
| 1559 | 42 |
| 1560 | }); |
| 1561 | assert_eq!(r, 42); |
| 1562 | assert!(!tc.infer_only); |
| 1563 | } |
| 1564 | |
| 1565 | #[test] |
| 1566 | fn with_infer_only_nested_restores() { |
| 1567 | let mut tc = new_tc(); |
| 1568 | tc.infer_only = true; |
| 1569 | tc.with_infer_only(|tc| { |
| 1570 | assert!(tc.infer_only); |
| 1571 | }); |
| 1572 | assert!(tc.infer_only, "outer infer_only=true must be preserved"); |