parent
1bc51f1728
commit
1330b1cdf5
31
src/test/compile-fail/issue-3601.rs
Normal file
31
src/test/compile-fail/issue-3601.rs
Normal file
@ -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
|
||||
};
|
||||
}
|
28
src/test/run-pass/issue-3609.rs
Normal file
28
src/test/run-pass/issue-3609.rs
Normal file
@ -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<Msg>) {
|
||||
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() {}
|
||||
|
Loading…
Reference in New Issue
Block a user