Commit Graph

23145 Commits

Author SHA1 Message Date
bors
e44b40ca3a auto merge of #9712 : ben0x539/rust/obsolete-syntax, r=pcwalton
Mostly as per a short discussion on irc. (@cmr)

    08:46 < cmr> so I'm thinking
    Obsolete{Let,With,FieldTerminator,ClassTraits,ModeInFnType,MoveInit,BinaryMove,I
    mplSyntax,MutOwnedPointer,MutVector,RecordType,RecordPattern,PostFnTySigil,Newty
    pEnum,Mode,ImplicitSelf,LifetimeNotation,Purity,StaticMethod,ConstItem,FixedLeng
    thVectorType}
    08:46 < cmr> Those are the ones that are older than 0.6
    08:46 < cmr> (at least!)

This PR removes these specific "obsolete syntax"/"suggestion for change" errors and just lets the parser run into regular parser errors for long-invalid syntax. I also removed `ObsoletePrivSection` which apparently dates further back than cmr or I could recall and `ObsoleteUnenforcedBound` which seemed unused. Also I removed `ObsoleteNewtypeEnum`.
2013-10-03 22:56:33 -07:00
Benjamin Herr
fa411500f9 Remove specific errors for very old obsolete syntax
Replaces existing tests for removed obsolete-syntax errors with tests
for the resulting regular errors, adds a test for each of the removed
parser errors to make sure that obsolete forms don't start working
again, removes some obsolete/superfluous tests that were now failing.

Deletes some amount of dead code in the parser, also includes some small
changes to parser error messages to accomodate new tests.
2013-10-04 07:09:28 +02:00
bors
3f32898a7b auto merge of #9711 : sanxiyn/rust/ambiguous-default-method, r=alexcrichton
Fix #8808.
2013-10-03 20:21:31 -07:00
bors
4bae639d86 auto merge of #9705 : luisbg/rust/strptime, r=alexcrichton
do_strptime() and do_strftime()

I don't see any reason why src/libextra/time.rs has two functions that just call a very similar function, which only use is to be called by them.
strftime() just calls do_strftime()
strptime() just calls do_strptime()
and the do_functions aren't called by anyone else.
the parameters and return types are exactly the same in both levels, so I just have removed the second layer.

Unless there is a need for that second level.
2013-10-03 14:01:41 -07:00
Luis de Bethencourt
a0c59941e3 extra: remove unnecessary second level functions
do_strptime() and do_strftime()
2013-10-03 16:01:42 -04:00
bors
012f909f35 auto merge of #9522 : steveklabnik/rust/doc_std_opts, r=alexcrichton
Added an overview with a 'real' example, as well as toy implementations of all of
the traits.

Closes #9356.
2013-10-03 12:46:32 -07:00
Steve Klabnik
28e88b4c6f Update std::ops docs as per feedback
from @chris-morgan
2013-10-03 12:37:33 -07:00
bors
9344e2a866 auto merge of #9686 : alexcrichton/rust/lint, r=thestinger
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:31:33 -07:00
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
Alex Crichton
88593fc3fc Document logging and remove old functions
This adds a large doc-block to the top of the std::logging module explaining how
to use it. This is mostly just making sure that all the information in the
manual's section about logging is also here (in case someone decides to look
into this module first).

This also removes the old console_{on,off} methods. As far as I can tell, the
functions were only used by the compiler, and there's no reason for them to be
used because they're all turned off by default anyway (maybe they were turned on
by default at some point...)

I believe that this is the final nail in the coffin and closes #5021
2013-10-03 09:16:31 -07:00
Alex Crichton
a1ffb06ac8 Use the correct logging crate while monomorphing
This makes sure that the top-level crate name is correct when emitting log
statements for a monomorphized function in another crate. This happens by
tracing the monomorphized ID back to the external source and then using that
crate index to get the name of the crate.

Closes #3046
2013-10-03 09:16:31 -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