Skip to content
Myr

Merge pull request #204 from dtolnay/assoc

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Parse associated type constraints in dyn trait object types

authored by David Tolnay · committed by GitHub · parents 210d741, 6f18821 · Browse files · 2 files+16 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+16 added−4 removed

  • tests:+12 added−4 removed
  • other:+4 added−0 removed

2 files+16 added−4 removed

modified:src/ensure.rs+4 added
501 unmodified lines
502 (generic $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} $dup:tt $life:lifetime $($rest:tt)*) => {503 $crate::__parse_ensure!(arglist $stack $bail ($($fuel)*) {($($buf)* $life) $($parse)*} ($($rest)*) $($rest)*)504 };505506 (generic $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($assoc:ident $eq:tt $($dup:tt)*) $ident:ident = $($rest:tt)*) => {507 $crate::__parse_ensure!(type (arglist $stack) $bail ($($fuel)*) {($($buf)* $assoc $eq) $($parse)*} ($($rest)*) $($rest)*)508 };509510 (generic $stack:tt $bail:tt (~$($fuel:tt)*) $parse:tt $dup:tt $($rest:tt)*) => {511 $crate::__parse_ensure!(type (arglist $stack) $bail ($($fuel)*) $parse $dup $($rest)*)512 };513
207 unmodified lines
modified:tests/test_ensure.rs+12 added-4 removed
534 unmodified lines
535 test,536 "Condition failed: `f as fn() -> ! as usize * 0 != 0` (0 vs 0)",537 );538539 trait EqDebug<T>: PartialEq<T> + Debug {}540 impl<S, T> EqDebug<T> for S where S: PartialEq<T> + Debug {}539 trait EqDebug<T>: PartialEq<T> + Debug {540 type Assoc;541 }542543 impl<S, T> EqDebug<T> for S544 where545 S: PartialEq<T> + Debug,546 {547 type Assoc = bool;548 }549542 let test = || Ok(ensure!(&0 as &dyn EqDebug<i32> != &0));550 let test = || Ok(ensure!(&0 as &dyn EqDebug<i32, Assoc = bool> != &0));551 assert_err(552 test,545 "Condition failed: `&0 as &dyn EqDebug<i32> != &0` (0 vs 0)",553 "Condition failed: `&0 as &dyn EqDebug<i32, Assoc = bool> != &0` (0 vs 0)",554 );555556 let test = || {557 Ok(ensure!(
23 unmodified lines