Skip to content

Commit

Permalink
Add an xfailed test case and a CONTRIBUTING.md file
Browse files Browse the repository at this point in the history
  • Loading branch information
catamorphism committed Dec 27, 2012
1 parent 0873553 commit c880d0a
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
12 changes: 12 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Pull request procedure

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:

1. [Rebase](http://git-scm.com/book/en/Git-Branching-Rebasing) your local changes against the `incoming` branch. Resolve any conflicts that arise.
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!

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.

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.

For more details, please refer to [[Note-development-policy]].
34 changes: 34 additions & 0 deletions src/test/run-pass/recursion.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-test
enum Nil {Nil}
struct Cons<T> {head:int, tail:T}
trait Dot {fn dot(other:self) -> int;}
impl Nil:Dot {
fn dot(_:Nil) -> int {0}
}
impl<T:Dot> Cons<T>:Dot {
fn dot(other:Cons<T>) -> int {
self.head * other.head + self.tail.dot(other.tail)
}
}
fn test<T:Dot> (n:int, i:int, first:T, second:T) ->int {
match n {
0 => {first.dot(second)}
// Error message should be here. It should be a type error
// to instantiate `test` at a type other than T. (See #4287)
_ => {test (n-1, i+1, Cons {head:2*i+1, tail:first}, Cons{head:i*i, tail:second})}
}
}
fn main() {
let n = test(1, 0, Nil, Nil);
io::println(fmt!("%d", n));
}

0 comments on commit c880d0a

Please sign in to comment.