Skip to main content

max / quasi

934 B · 20 lines History Blame Raw
1 //! R4(b) is refused by the macro, not by the borrow checker.
2 //!
3 //! Wiki `quasi-declare-form` section 11 reproduced the defect and measured its
4 //! incidence at zero written-out pairs across the ratified 514 shapes. So this
5 //! is a guard against reintroduction: nobody writes the split form today, and
6 //! the trap is only sprung on re-authoring.
7 //!
8 //! It has to be a compile-fail harness rather than an ordinary test, because
9 //! what is being asserted is *which* error comes out. Both a refused pair and
10 //! an accepted one fail to compile; the difference is that one names `label`
11 //! in the declaration and the other names a `let` in generated code that the
12 //! author never wrote and cannot find.
13
14 #[test]
15 fn a_complementary_pair_sharing_an_owned_binding_is_refused() {
16 let cases = trybuild::TestCases::new();
17 cases.compile_fail("tests/ui/complementary_pair.rs");
18 cases.pass("tests/ui/exclusive_dispatch.rs");
19 }
20