Skip to content

Loading…

Remove unnecessary lifetime annotations. #176

Merged
merged 1 commit into from

3 participants

@utkarshkukreti

A patch to make this possible just landed in Rust master a few hours ago.

@aochagavia
Collaborator

Are these errors legit or caused by using an older version of rustc? I have tried some code in the playpen but got the same errors as Travis.

@pfalabella
Collaborator

it seems like Travis lags a bit behind current nightlies. I tried compiling one of the changed files locally and it works. Nightlies version for reference (on windows 7):

 $ rustc --version
rustc 0.12.0-pre-nightly (f15d6d28396e8700b6c3f2704204a2769e710403 2014-07-20 22:46:29 +0000) 

lifetime elision issue for reference is rust-lang/rust#15767.

@utkarshkukreti utkarshkukreti Remove unnecessary lifetime annotations.
A patch to make this possible just landed in Rust master a few hours
ago.
726d78c
@utkarshkukreti

@pfalabella is right. It's passing now on Travis.

@pfalabella
Collaborator

by the way... if I try running the 9_billion_names_of_God_the_integer.exe, it crashes on windows when trying to calculate the last sum.
I have never tried running it before, so it might be an issue I've always had but never noticed... Could you please try running it on your machine?

rows
1: 1,
2: 1, 1,
3: 1, 1, 1,
4: 1, 2, 1, 1,
5: 1, 2, 2, 1, 1,
6: 1, 3, 3, 2, 1, 1,
7: 1, 3, 4, 3, 2, 1, 1,
8: 1, 4, 5, 5, 3, 2, 1, 1,
9: 1, 4, 7, 6, 5, 3, 2, 1, 1,
10: 1, 5, 8, 9, 7, 5, 3, 2, 1, 1,
sums
23: 1255
123: 2552338241
1234: 156978797223733228787865722354959930

Program received signal SIGILL, Illegal instruction.
0x004fba70 in oom::hea464ba6c9767073pPa ()
@aochagavia
Collaborator

Awesome! Thanks!

@aochagavia aochagavia merged commit 5eaa79a into Hoverbear:master

1 check passed

Details continuous-integration/travis-ci The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 21, 2014
  1. @utkarshkukreti

    Remove unnecessary lifetime annotations.

    utkarshkukreti committed
    A patch to make this possible just landed in Rust master a few hours
    ago.
Showing with 7 additions and 7 deletions.
  1. +3 −3 src/24_game.rs
  2. +1 −1 src/9_billion_names_of_God_the_integer.rs
  3. +1 −1 src/dot_product.rs
  4. +1 −1 src/four_bit_adder.rs
  5. +1 −1 src/stack.rs
View
6 src/24_game.rs
@@ -89,7 +89,7 @@ struct Lexer<'a> {
}
impl <'a> Lexer<'a> {
- fn new(input_str: &'a str) -> Lexer<'a> {
+ fn new(input_str: &str) -> Lexer {
Lexer { input_str: input_str, offset: 0u }
}
@@ -204,7 +204,7 @@ struct Parser<'a> {
}
impl <'a> Parser<'a> {
- fn new(input_str: &'a str) -> Parser<'a> {
+ fn new(input_str: &str) -> Parser {
Parser {
operators: Vec::new(),
operands: Vec::new(),
@@ -358,4 +358,4 @@ fn parse()
fn try_check_values() {
let m = &mut [1,2,3,4];
assert!(check_values(m, "1+3 -(4/2)"));
-}
+}
View
2 src/9_billion_names_of_God_the_integer.rs
@@ -6,7 +6,7 @@ use num::bigint::BigUint;
use std::string::String;
use std::cmp::min;
-fn cumu<'a>(num: uint, cache: &'a mut Vec<Vec<BigUint>>) -> &'a Vec<BigUint> {
+fn cumu(num: uint, cache: &mut Vec<Vec<BigUint>>) -> &Vec<BigUint> {
let len = cache.len();
for l in range(len, num+1) {
let initial_value:BigUint = from_str("0").unwrap();
View
2 src/dot_product.rs
@@ -3,7 +3,7 @@
use std::ops::{Add, Mul};
use std::num::Zero;
-fn dotp<'a, T:Add<T, T> + Mul<T, T> + Zero + Copy>(this: &'a [T], other: &'a [T]) -> T {
+fn dotp<T:Add<T, T> + Mul<T, T> + Zero + Copy>(this: &[T], other: &[T]) -> T {
assert!(this.len() == other.len(), "The dimensions must be equal");
let zero : T = Zero::zero();
View
2 src/four_bit_adder.rs
@@ -51,7 +51,7 @@ impl fmt::Show for Nibble {
// We implement Deref so we can index the Nibble easily
impl<'a> Deref<[bool,.. 4]> for Nibble {
- fn deref<'a>(&'a self) -> &'a [bool,.. 4] {
+ fn deref(&self) -> &[bool,.. 4] {
let Nibble(ref inner) = *self;
inner
}
View
2 src/stack.rs
@@ -22,7 +22,7 @@ impl<T> Stack<T> {
}
// Returns a reference of the element at the top of the stack
- fn peek<'r>(&'r self) -> Option<&'r T> {
+ fn peek(&self) -> Option<&T> {
self.vec.last()
}
Something went wrong with that request. Please try again.