Skip to content

Commit c880d0a

Browse files
committed
Add an xfailed test case and a CONTRIBUTING.md file
1 parent 0873553 commit c880d0a

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

CONTRIBUTING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## Pull request procedure
2+
3+
Pull requests should be targeted at Rust's `incoming` branch (note that by default Github will aim them at the `master` branch) -- see "Changing The Commit Range and Destination Repository" in Github's documentation on [pull requests](https://help.github.com/articles/using-pull-requests). Before pushing to your Github repo and issuing the pull request, please do two things:
4+
5+
1. [Rebase](http://git-scm.com/book/en/Git-Branching-Rebasing) your local changes against the `incoming` branch. Resolve any conflicts that arise.
6+
2. Run the full Rust test suite with the `make check` command. You're not off the hook even if you just stick to documentation; code examples in the docs are tested as well!
7+
8+
Pull requests will be treated as "review requests", and we will give feedback we expect to see corrected on [style](https://github.com/mozilla/rust/wiki/Note-style-guide) and substance before pulling. Changes contributed via pull request should focus on a single issue at a time, like any other. We will not look kindly on pull-requests that try to "sneak" unrelated changes in.
9+
10+
Normally, all pull requests must include regression tests (see [[Note-testsuite]]) that test your change. Occasionally, a change will be very difficult to test for. In those cases, please include a note in your commit message explaining why.
11+
12+
For more details, please refer to [[Note-development-policy]].

src/test/run-pass/recursion.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// xfail-test
12+
enum Nil {Nil}
13+
struct Cons<T> {head:int, tail:T}
14+
trait Dot {fn dot(other:self) -> int;}
15+
impl Nil:Dot {
16+
fn dot(_:Nil) -> int {0}
17+
}
18+
impl<T:Dot> Cons<T>:Dot {
19+
fn dot(other:Cons<T>) -> int {
20+
self.head * other.head + self.tail.dot(other.tail)
21+
}
22+
}
23+
fn test<T:Dot> (n:int, i:int, first:T, second:T) ->int {
24+
match n {
25+
0 => {first.dot(second)}
26+
// Error message should be here. It should be a type error
27+
// to instantiate `test` at a type other than T. (See #4287)
28+
_ => {test (n-1, i+1, Cons {head:2*i+1, tail:first}, Cons{head:i*i, tail:second})}
29+
}
30+
}
31+
fn main() {
32+
let n = test(1, 0, Nil, Nil);
33+
io::println(fmt!("%d", n));
34+
}

0 commit comments

Comments
 (0)