Commit Graph

22983 Commits

Author SHA1 Message Date
Alex Crichton
c0388cd691 Rewrite lint passes with less visitor cruft
This purges about 500 lines of visitor cruft from lint passes. All lints are
handled in a much more sane way at this point. The other huge bonus of this
commit is that there are no more @-boxes in the lint passes, fixing the 500MB
memory regression seen when the lint passes were refactored.

Closes #8589
2013-10-03 10:25:14 -07:00
Alex Crichton
cdb7701434 rustdoc: Document what's going on throughout
This addresses some of @huonw's in #9691 about the startling lack of
documentation guiding one throughout the innards of rustdoc::html
2013-10-03 10:24:40 -07:00
Seo Sanghyeon
fbd56396bc Correctly report errors for ambiguous default methods 2013-10-04 01:10:28 +09:00
bors
ff30566954 auto merge of #9698 : sanxiyn/rust/android, r=huonw 2013-10-03 05:46:28 -07:00
bors
e08391c3f1 auto merge of #9699 : thestinger/rust/immediate, r=huonw,luqmana
struct Foo;
    fn foo() -> Foo { Foo }

Before:

    ; Function Attrs: nounwind readnone uwtable
    define void @_ZN3foo18he8ca29755dedebbaf4v0.0E(%struct.Foo* noalias nocapture sret, { i64, %tydesc*, i8*, i8*, i8 }* nocapture) #0 {
    "function top level":
      ret void
    }

After:

    ; Function Attrs: nounwind readnone uwtable
    define %struct.Foo @_ZN3foo18he8ca29755dedebbaf4v0.0E({ i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone) #0 {
    "function top level":
      ret %struct.Foo undef
    }
2013-10-03 04:26:32 -07:00
Daniel Micay
6d598989f6 Merge pull request #9697 from sfackler/issue_9155
Close out #9155
2013-10-03 04:13:10 -07:00
Daniel Micay
f504461a40 make C-like enums immediate
This fixes two existing bugs along the way:

* The `transmute` intrinsic did not correctly handle casts of immediate
  aggregates like newtype structs and tuples.
* The code for calling foreign functions used the wrong type to create
  an `alloca` temporary

    enum Foo { A, B }
    fn foo() -> Foo { A }

Before:

    ; Function Attrs: nounwind uwtable
    define void @_ZN3foo18hbedc642d5d9cf5aag4v0.0E(%enum.Foo* noalias nocapture sret, { i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone) #0 {
    "function top level":
      %2 = getelementptr inbounds %enum.Foo* %0, i64 0, i32 0
      store i64 0, i64* %2, align 8
      ret void
    }

After:

    ; Function Attrs: nounwind readnone uwtable
    define %enum.Foo @_ZN3foo18hbedc642d5d9cf5aag4v0.0E({ i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone) #0 {
    "function top level":
      ret %enum.Foo zeroinitializer
    }
2013-10-03 06:27:00 -04:00
Daniel Micay
249b356fb3 make unit structs immediate
struct Foo;
    fn foo() -> Foo { Foo }

Before:

    ; Function Attrs: nounwind readnone uwtable
    define void @_ZN3foo18he8ca29755dedebbaf4v0.0E(%struct.Foo* noalias nocapture sret, { i64, %tydesc*, i8*, i8*, i8 }* nocapture) #0 {
    "function top level":
      ret void
    }

After:

    ; Function Attrs: nounwind readnone uwtable
    define %struct.Foo @_ZN3foo18he8ca29755dedebbaf4v0.0E({ i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone) #0 {
    "function top level":
      ret %struct.Foo undef
    }
2013-10-03 03:59:58 -04:00
bors
8f40641e01 auto merge of #9691 : alexcrichton/rust/rustdoc, r=cmr
This slurps in the commits from #9684 as well as closing #9539.
2013-10-03 00:56:34 -07:00
Steven Fackler
435ca16f4f Close out #9155
Add a test to make sure it works and switch a private struct over to a
newtype.

Closes #9155
2013-10-03 00:15:54 -07:00
Seo Sanghyeon
0640ae0ecd Ignore tests on Android correctly 2013-10-03 15:48:44 +09:00
bors
b637798a5a auto merge of #9693 : sfackler/rust/newtype-removal, r=alexcrichton
UnboundedPipeStream is still a newtype since process::set_stdio needs to
look into its internals.

Closes #9667
2013-10-02 20:41:29 -07:00
Steven Fackler
019b131e12 Stop using newtype wrappers in std::rt::io
UnboundedPipeStream is still a newtype since process::set_stdio needs to
look into its internals.

Closes #9667
2013-10-02 20:37:17 -07:00
bors
ccd9a963f7 auto merge of #9681 : skade/rust/str-from-str, r=huonw
This fixes an issue for APIs that return FromStr. Before this change,
they would have to offer a seperate function for returning the source
string.
2013-10-02 18:16:29 -07:00
bors
20760739e9 auto merge of #9689 : luisbg/rust/strftime, r=alexcrichton
Plus testing added for %X and %x which were supported but not tested.

Working towards #2350
2013-10-02 17:01:32 -07:00
Alex Crichton
d06043ba0b rustdoc: Generate hyperlinks between crates
The general idea of hyperlinking between crates is that it should require as
little configuration as possible, if any at all. In this vein, there are two
separate ways to generate hyperlinks between crates:

1. When you're generating documentation for a crate 'foo' into folder 'doc',
   then if foo's external crate dependencies already have documented in the
   folder 'doc', then hyperlinks will be generated. This will work because all
   documentation is in the same folder, allowing links to work seamlessly both
   on the web and on the local filesystem browser.

   The rationale for this use case is a package with multiple libraries/crates
   that all want to link to one another, and you don't want to have to deal with
   going to the web. In theory this could be extended to have a RUST_PATH-style
   searching situtation, but I'm not sure that it would work seamlessly on the
   web as it does on the local filesystem, so I'm not attempting to explore this
   case in this pull request. I believe to fully realize this potential rustdoc
   would have to be acting as a server instead of a static site generator.

2. One of foo's external dependencies has a #[doc(html_root_url = "...")]
   attribute. This means that all hyperlinks to the dependency will be rooted at
   this url.

   This use case encompasses all packages using libstd/libextra. These two
   crates now have this attribute encoded (currently at the /doc/master url) and
   will be read by anything which has a dependency on libstd/libextra. This
   should also work for arbitrary crates in the wild that have online
   documentation. I don't like how the version is hard-wired into the url, but I
   think that this may be a case-by-case thing which doesn't end up being too
   bad in the long run.

Closes #9539
2013-10-02 16:17:08 -07:00
Jordi Boggiano
f00d72b78b Make source links highlight the entire definition and not just the first line 2013-10-02 16:17:07 -07:00
Luis de Bethencourt
8f6e43e273 extra: %W and %+ support in time::strftime
Plus testing added for %X and %x which were supported but not tested.

Working towards #2350
2013-10-02 18:01:44 -04:00
bors
371a7ec569 auto merge of #9675 : sfackler/rust/lint, r=alexcrichton
Closes #9671
2013-10-02 13:26:36 -07:00
Jordi Boggiano
49e6db7f35 Prevent source view from wrapping lines 2013-10-02 12:32:20 -07:00
Jordi Boggiano
1501d65112 Highlight line numbers of the lines referred to in the url hash 2013-10-02 12:32:16 -07:00
bors
353578a7b3 auto merge of #9680 : thestinger/rust/overflow, r=huonw
This is pointless, since it's just used to load an `undef` value and
never touched again.
2013-10-02 12:11:39 -07:00
Vadim Chugunov
4e59ab097a Package system runtime dependencies into Windows distribution. 2013-10-02 11:40:50 -07:00
Vadim Chugunov
1a6b6c4301 Package system runtime dependencies into snapshots 2013-10-02 11:40:44 -07:00
bors
aaeb7605c9 auto merge of #9670 : luisbg/rust/strftime, r=alexcrichton 2013-10-02 10:11:38 -07:00
Steven Fackler
b7fe83d573 Check enums in missing_doc lint
Closes #9671
2013-10-02 08:57:03 -07:00
Luis de Bethencourt
1005b7976b extra: %G, %g and %V support in time::strftime
Fixes #2350
2013-10-02 11:22:59 -04:00
bors
c44826fdcd auto merge of #9677 : thestinger/rust/immediate, r=huonw
C-like enums are excluded from this for now, because the code paths
specific to them need to be changed.

    fn foo() -> Option<~int> { Some(~5) }

Before:

    ; Function Attrs: uwtable
    define void @_ZN3foo18hdec6e36682b87eeaf4v0.0E(%"enum.std::option::Option<~int>[#1]"* noalias nocapture sret, { i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone) #0 {
    "function top level":
      %2 = tail call %"enum.std::libc::types::common::c95::c_void[#1]"* @"_ZN2rt11global_heap10malloc_raw17h56c543b77f9b78aY11v0.9$x2dpreE"({ i64, %tydesc*, i8*, i8*, i8 }* undef, i64 8)
      %3 = bitcast %"enum.std::libc::types::common::c95::c_void[#1]"* %2 to i64*
      store i64 5, i64* %3, align 8
      %4 = getelementptr inbounds %"enum.std::option::Option<~int>[#1]"* %0, i64 0, i32 0
      store i64* %3, i64** %4, align 8
      ret void
    }

After:

    ; Function Attrs: uwtable
    define %"enum.std::option::Option<~int>[#1]" @_ZN3foo18h2cbf6557a3143edah4v0.0E({ i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone) #0 {
    "function top level":
      %1 = tail call %"enum.std::libc::types::common::c95::c_void[#1]"* @"_ZN2rt11global_heap10malloc_raw18hb1e9dd1beab35edau11v0.9$x2dpreE"({ i64, %tydesc*, i8*, i8*, i8 }* undef, i64 8)
      %2 = bitcast %"enum.std::libc::types::common::c95::c_void[#1]"* %1 to i64*
      store i64 5, i64* %2, align 8
      %oldret = insertvalue %"enum.std::option::Option<~int>[#1]" undef, i64* %2, 0
      ret %"enum.std::option::Option<~int>[#1]" %oldret
    }
2013-10-02 07:56:36 -07:00
Erick Tryzelaar
01be9e9904 extra: Add ToBigInt and ToBigUint traits 2013-10-02 07:55:42 -07:00
Erick Tryzelaar
9de7ad2d8c std: Swap {To,From}Primitive to use the 64bit as the unimplemented version
One downside with this current implementation is that since BigInt's
default is now 64 bit, we can convert larger BigInt's to a primitive,
however the current implementation on 32 bit architectures does not
take advantage of this fact.
2013-10-02 07:55:42 -07:00
Erick Tryzelaar
5a64e1a35a test: add compile-fail test for #[deriving(FromPrimitive)] 2013-10-02 07:55:41 -07:00
Erick Tryzelaar
8f8cc061d9 syntax: swap from .span_fatal to .span_err in #[deriving(FromPrimitive)] 2013-10-02 07:55:41 -07:00
Erick Tryzelaar
0feaccf526 syntax: Add #[deriving(FromPrimitive)] syntax extension
Right now this only works for c-style enums.
2013-10-02 07:55:41 -07:00
Erick Tryzelaar
d9d1dfc195 std: Replace num::IntConvertible with {To,From}Primitive 2013-10-02 07:55:41 -07:00
Daniel Micay
f2932e4661 make small (<= size_of::<int>()) enums immediate
C-like enums are excluded from this for now, because the code paths
specific to them need to be changed.

    fn foo() -> Option<~int> { Some(~5) }

Before:

    ; Function Attrs: uwtable
    define void @_ZN3foo18hdec6e36682b87eeaf4v0.0E(%"enum.std::option::Option<~int>[#1]"* noalias nocapture sret, { i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone) #0 {
    "function top level":
      %2 = tail call %"enum.std::libc::types::common::c95::c_void[#1]"* @"_ZN2rt11global_heap10malloc_raw17h56c543b77f9b78aY11v0.9$x2dpreE"({ i64, %tydesc*, i8*, i8*, i8 }* undef, i64 8)
      %3 = bitcast %"enum.std::libc::types::common::c95::c_void[#1]"* %2 to i64*
      store i64 5, i64* %3, align 8
      %4 = getelementptr inbounds %"enum.std::option::Option<~int>[#1]"* %0, i64 0, i32 0
      store i64* %3, i64** %4, align 8
      ret void
    }

After:

    ; Function Attrs: uwtable
    define %"enum.std::option::Option<~int>[#1]" @_ZN3foo18h2cbf6557a3143edah4v0.0E({ i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone) #0 {
    "function top level":
      %1 = tail call %"enum.std::libc::types::common::c95::c_void[#1]"* @"_ZN2rt11global_heap10malloc_raw18hb1e9dd1beab35edau11v0.9$x2dpreE"({ i64, %tydesc*, i8*, i8*, i8 }* undef, i64 8)
      %2 = bitcast %"enum.std::libc::types::common::c95::c_void[#1]"* %1 to i64*
      store i64 5, i64* %2, align 8
      %oldret = insertvalue %"enum.std::option::Option<~int>[#1]" undef, i64* %2, 0
      ret %"enum.std::option::Option<~int>[#1]" %oldret
    }
2013-10-02 10:02:52 -04:00
Daniel Micay
abe648d608 treat uninhabited enums as voidish 2013-10-02 10:02:52 -04:00
Florian Gilcher
4dc3ff9c80 Add an implementation of FromStr for ~str and @str
This fixes an issue for APIs that return FromStr. Before this change,
they would have to offer a seperate function for returning the source
string.
2013-10-02 15:37:59 +02:00
bors
17548378a7 auto merge of #9679 : pnkfelix/rust/de-pub-resolve-code, r=huonw
r? anyone

For context (and the archaeological dig that @huonw did to see how this arose), see:
  https://botbot.me/mozilla/rust-internals/msg/6547222/
2013-10-02 06:36:30 -07:00
Daniel Micay
ee114b6cb1 avoid alloca in with_overflow intrinsics
This is pointless, since it's just used to load an `undef` value and
never touched again.
2013-10-02 08:53:47 -04:00
Felix S. Klock II
55da145ab1 De-pub resolve.rs 2013-10-02 14:33:01 +02:00
bors
d616603c84 auto merge of #9673 : huonw/rust/macros, r=catamorphism
That is, only a single expression or item gets parsed, so if there are
any extra tokens (e.g. the start of another item/expression) the user
should be told, rather than silently dropping them.

An example:

    macro_rules! foo {
        () => {
            println("hi");
            println("bye);
        }
    }

would expand to just `println("hi")`, which is almost certainly not
what the programmer wanted.

Fixes #8012.
2013-10-02 04:21:26 -07:00
bors
d00c9269dc auto merge of #9665 : alexcrichton/rust/snapshot, r=brson
Uses the new snapshots to kill the old `loop` and introduce the new `continue`.
2013-10-02 02:31:29 -07:00
bors
97cd495aca auto merge of #9638 : pnkfelix/rust/fsk-issue7526-attempt-to-catch-nonuc-statics-in-match-patterns, r=alexcrichton
r? anyone

Address scariest part of #7526 by adding a new more specific lint (that is set to warn by default, rather than allow).
2013-10-02 01:16:31 -07:00
bors
33a5928b46 auto merge of #9656 : thestinger/rust/immediate, r=alexcrichton
fn foo() -> (u32, u8, u8, u8, u8) {
        (4, 5, 6, 7, 8)
    }

Before:

    ; Function Attrs: nounwind uwtable
    define void @_ZN3foo18hbb616262f874f8daf4v0.0E({ i32, i8, i8, i8, i8 }* noalias nocapture sret, { i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone) #0 {
    "function top level":
      %2 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 0
      store i32 4, i32* %2, align 4
      %3 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 1
      store i8 5, i8* %3, align 4
      %4 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 2
      store i8 6, i8* %4, align 1
      %5 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 3
      store i8 7, i8* %5, align 2
      %6 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 4
      store i8 8, i8* %6, align 1
      ret void
    }

After:

    ; Function Attrs: nounwind readnone uwtable
    define { i32, i8, i8, i8, i8 } @_ZN3foo18hbb616262f874f8daf4v0.0E({ i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone) #0 {
    "function top level":
      ret { i32, i8, i8, i8, i8 } { i32 4, i8 5, i8 6, i8 7, i8 8 }
    }
2013-10-01 21:56:27 -07:00
Huon Wilson
8284df9e7c syntax: indicate an error when a macro ignores trailing tokens.
That is, only a single expression or item gets parsed, so if there are
any extra tokens (e.g. the start of another item/expression) the user
should be told, rather than silently dropping them.

An example:

    macro_rules! foo {
        () => {
            println("hi");
            println("bye);
        }
    }

would expand to just `println("hi")`, which is almost certainly not
what the programmer wanted.

Fixes #8012.
2013-10-02 14:43:15 +10:00
Luis de Bethencourt
c463772ebd extra: %U support in time::strftime
Fixes #2350
2013-10-01 22:20:46 -04:00
bors
1d6c01148c auto merge of #9600 : MicahChalmer/rust/fill-with-code-around, r=catamorphism
This fixes a problem with paragraph fills: hitting M-q on a single-line-style (`//`) comment with code immediately before or after it would try to fill the code as part of the paragraph too.
2013-10-01 18:56:26 -07:00
Huon Wilson
bbbafc4e46 syntax: remove some dead code. 2013-10-02 11:43:10 +10:00
bors
88b0b511be auto merge of #9578 : alexcrichton/rust/un-ignore-libuv-process-tests, r=brson
Closes #9341
2013-10-01 17:41:29 -07:00
Alex Crichton
02cbfce0b3 Move the rt::io::process tests to run-pass
Closes #9341
2013-10-01 17:04:17 -07:00