diff --git a/src/test/compile-fail/issue-3601.rs b/src/test/compile-fail/issue-3601.rs new file mode 100644 index 0000000000000..884e0ee2ff815 --- /dev/null +++ b/src/test/compile-fail/issue-3601.rs @@ -0,0 +1,31 @@ +struct HTMLImageData { + mut image: Option<~str> +} + +struct ElementData { + kind: ~ElementKind +} + +enum ElementKind { + HTMLImageElement(HTMLImageData) +} + +enum NodeKind { + Element(ElementData) +} + +enum NodeData = { + kind: ~NodeKind +}; + +fn main() { + let id = HTMLImageData { image: None }; + let ed = ElementData { kind: ~HTMLImageElement(id) }; + let n = NodeData({kind : ~Element(ed)}); + match n.kind { + ~Element(ed) => match ed.kind { + ~HTMLImageElement(d) if d.image.is_some() => { true } + }, + _ => fail ~"WAT" //~ ERROR wat + }; +} diff --git a/src/test/run-pass/issue-3609.rs b/src/test/run-pass/issue-3609.rs new file mode 100644 index 0000000000000..9eff98ff42409 --- /dev/null +++ b/src/test/run-pass/issue-3609.rs @@ -0,0 +1,28 @@ +extern mod std; + +use pipes::Chan; + +type RingBuffer = ~[float]; +type SamplesFn = fn~ (samples: &RingBuffer); + +enum Msg +{ + GetSamples(~str, SamplesFn), // sample set name, callback which receives samples +} + +fn foo(name: ~str, samples_chan: Chan) { + do task::spawn + |copy name| + { + let callback: SamplesFn = + |buffer| + { + for uint::range(0, buffer.len()) + |i| {error!("%?: %f", i, buffer[i])} + }; + samples_chan.send(GetSamples(copy name, callback)); + }; +} + +fn main() {} +