Commit Graph

15 Commits

Author SHA1 Message Date
Tobias Bucher
7f64fe4e27 Remove all i suffixes 2015-01-30 04:38:54 +01:00
Niko Matsakis
f4e29e7e9a Fixup various places that were doing &T+'a and do &(T+'a) 2014-11-26 11:42:06 -05:00
Patrick Walton
e9ad12c0ca librustc: Forbid private types in public APIs.
This breaks code like:

    struct Foo {
        ...
    }

    pub fn make_foo() -> Foo {
        ...
    }

Change this code to:

    pub struct Foo {    // note `pub`
        ...
    }

    pub fn make_foo() -> Foo {
        ...
    }

The `visible_private_types` lint has been removed, since it is now an
error to attempt to expose a private type in a public API. In its place
a `#[feature(visible_private_types)]` gate has been added.

Closes #16463.

RFC #48.

[breaking-change]
2014-09-22 20:05:45 -07:00
Niko Matsakis
1b487a8906 Implement generalized object and type parameter bounds (Fixes #16462) 2014-08-27 21:46:52 -04:00
Patrick Walton
6f99a27886 librustc: Implement lifetime elision.
This implements RFC 39. Omitted lifetimes in return values will now be
inferred to more useful defaults, and an error is reported if a lifetime
in a return type is omitted and one of the two lifetime elision rules
does not specify what it should be.

This primarily breaks two uncommon code patterns. The first is this:

    unsafe fn get_foo_out_of_thin_air() -> &Foo {
        ...
    }

This should be changed to:

    unsafe fn get_foo_out_of_thin_air() -> &'static Foo {
        ...
    }

The second pattern that needs to be changed is this:

    enum MaybeBorrowed<'a> {
        Borrowed(&'a str),
        Owned(String),
    }

    fn foo() -> MaybeBorrowed {
        Owned(format!("hello world"))
    }

Change code like this to:

    enum MaybeBorrowed<'a> {
        Borrowed(&'a str),
        Owned(String),
    }

    fn foo() -> MaybeBorrowed<'static> {
        Owned(format!("hello world"))
    }

Closes #15552.

[breaking-change]
2014-07-19 13:10:58 -07:00
Niko Matsakis
9e3d0b002a librustc: Remove the fallback to int from typechecking.
This breaks a fair amount of code. The typical patterns are:

* `for _ in range(0, 10)`: change to `for _ in range(0u, 10)`;

* `println!("{}", 3)`: change to `println!("{}", 3i)`;

* `[1, 2, 3].len()`: change to `[1i, 2, 3].len()`.

RFC #30. Closes #6023.

[breaking-change]
2014-06-24 17:18:48 -07:00
Huon Wilson
6d778ff610 Remove outdated and unnecessary std::vec_ng::Vec imports.
(And fix some tests.)
2014-03-22 01:08:57 +11:00
Patrick Walton
af79a5aa7d test: Make manual changes to deal with the fallout from removal of
`~[T]` in test, libgetopts, compiletest, librustdoc, and libnum.
2014-03-21 23:37:21 +11:00
Patrick Walton
579eb2400b test: Automatically remove all ~[T] from tests. 2014-03-21 23:37:21 +11:00
Brendan Zabarauskas
4fc0452ace Remove re-exports of std::io::stdio::{print, println} in the prelude.
The `print!` and `println!` macros are now the preferred method of printing, and so there is no reason to export the `stdio` functions in the prelude. The functions have also been replaced by their macro counterparts in the tutorial and other documentation so that newcomers don't get confused about what they should be using.
2014-01-11 10:46:00 +11:00
Brian Anderson
d323632669 'borrowed pointer' -> 'reference' 2014-01-07 18:49:13 -08:00
Erik Price
5731ca3078 Make 'self lifetime illegal.
Also remove all instances of 'self within the codebase.

This fixes #10889.
2013-12-11 10:54:06 -08:00
Alex Crichton
630082ca89 rpass: Remove usage of fmt! 2013-09-30 23:21:19 -07:00
Alex Crichton
30862a64c2 Fix run-pass tests to have 'pub fn main'
This is required by the check-fast target because each test is slurped up into a
submodule.
2013-09-25 00:43:37 -07:00
Huon Wilson
12099ce94c Tests for fixed issues.
Closes #3794.
Closes #4025.
Closes #5688.
Closes #5708.
Closes #7012.
Closes #7327.
2013-09-03 20:00:42 +10:00