Skip to content

Commit 528a770

Browse files
committed
---
yaml --- r: 41495 b: refs/heads/master c: c880d0a h: refs/heads/master i: 41493: c00b8c3 41491: 014bd4e 41487: 8ac1adf v: v3
1 parent 767c139 commit 528a770

File tree

3 files changed

+47
-1
lines changed

3 files changed

+47
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 08735536809d9bcafacf689cdb5e5314f1510b87
2+
refs/heads/master: c880d0ab7688af2cf5ed547019c22e10d81f7cb4
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2f46b763da2c098913884f101b6d71d69af41b49
55
refs/heads/try: 3d5418789064fdb463e872a4e651af1c628a3650

trunk/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]].

trunk/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)