1. 21 9月, 2013 20 次提交
  2. 20 9月, 2013 20 次提交
    • B
      auto merge of #9337 : steveklabnik/rust/rustpkg_usage, r=catamorphism · f4479727
      bors 提交于
      When I took out the ability to make a new project by name, I forgot to
      update the usage to reflect the changes.
      f4479727
    • B
      auto merge of #9332 : eugals/rust/master, r=alexcrichton · 89cc8529
      bors 提交于
      It is intended to optimize/beautify the code generated in a few trivial trait operations.
      Let's take the following code as an example:
      ```
      trait Stuff {
          fn bar(&self);
      }
      
      fn callBar(s: &Stuff) {
          s.bar();
      }
      
      struct Foo;
      
      impl Stuff for Foo {
          fn bar(&self) {
          }
      }
      
      pub fn main() {
          let o = Foo;
          callBar(&o as &Stuff);
      }
      ```
      
      At present it is translated into something like:
      ```
      define void @_ZN7callBar_UUID.0E({ i32, %tydesc*, i8*, i8*, i8 }*, { %tydesc*, i8* }*) #4 {
      "function top level":
        %__trait_callee = alloca { %tydesc*, i8* }
        %__auto_borrow_obj = alloca { %tydesc*, i8* }
        %2 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 0
        %3 = load %tydesc** %2
        %4 = getelementptr inbounds { %tydesc*, i8* }* %__auto_borrow_obj, i32 0, i32 0
        store %tydesc* %3, %tydesc** %4
        %5 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 1
        %6 = load i8** %5
        %7 = getelementptr inbounds { %tydesc*, i8* }* %__auto_borrow_obj, i32 0, i32 1
        store i8* %6, i8** %7
        %8 = bitcast { %tydesc*, i8* }* %__auto_borrow_obj to i8*
        %9 = bitcast { %tydesc*, i8* }* %__trait_callee to i8*
        call void @llvm.memcpy.p0i8.p0i8.i32(i8* %9, i8* %8, i32 8, i32 4, i1 false)
        %10 = getelementptr inbounds { %tydesc*, i8* }* %__trait_callee, i32 0, i32 1
        %11 = load i8** %10
        %12 = bitcast i8* %11 to { i32, %tydesc*, i8*, i8*, i8 }*
        %13 = getelementptr inbounds { %tydesc*, i8* }* %__trait_callee, i32 0, i32 0
        %14 = bitcast %tydesc** %13 to [1 x i8*]**
        %15 = load [1 x i8*]** %14
        %16 = getelementptr inbounds [1 x i8*]* %15, i32 0, i32 1
        %17 = load i8** %16
        %18 = bitcast i8* %17 to void ({ i32, %tydesc*, i8*, i8*, i8 }*)*
        call void %18({ i32, %tydesc*, i8*, i8*, i8 }* %12)
        ret void
      }
      
      ...
      
      define void @_ZN4main_UUID.0E({ i32, %tydesc*, i8*, i8*, i8 }*) #4 {
      "function top level":
        %o = alloca %struct.Foo
        %1 = alloca { %tydesc*, i8* }
        %__auto_borrow_obj = alloca { %tydesc*, i8* }
        %2 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 1
        %3 = bitcast i8** %2 to %struct.Foo**
        store %struct.Foo* %o, %struct.Foo** %3
        %4 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 0
        %5 = bitcast %tydesc** %4 to { %tydesc*, void ({ i32, %tydesc*, i8*, i8*, i8 }*)* }**
        store { %tydesc*, void ({ i32, %tydesc*, i8*, i8*, i8 }*)* }* @vtable1081, { %tydesc*, void ({ i32, %tydesc*, i8*, i8*, i8 }*)* }** %5
        %6 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 0
        %7 = load %tydesc** %6
        %8 = getelementptr inbounds { %tydesc*, i8* }* %__auto_borrow_obj, i32 0, i32 0
        store %tydesc* %7, %tydesc** %8
        %9 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 1
        %10 = load i8** %9
        %11 = getelementptr inbounds { %tydesc*, i8* }* %__auto_borrow_obj, i32 0, i32 1
        store i8* %10, i8** %11
        call void @_ZN7callBar_UUID.0E({ i32, %tydesc*, i8*, i8*, i8 }* undef, { %tydesc*, i8* }* %__auto_borrow_obj)
        ret void
      }
      ```
      
      If you apply my patch, it would become way shorter and cleaner:
      ```
      define void @_ZN7callBar_UUID.0E({ i32, %tydesc*, i8*, i8*, i8 }*, { %tydesc*, i8* }*) #4 {
      "function top level":
        %2 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 1
        %3 = load i8** %2
        %4 = bitcast i8* %3 to { i32, %tydesc*, i8*, i8*, i8 }*
        %5 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 0
        %6 = bitcast %tydesc** %5 to [1 x i8*]**
        %7 = load [1 x i8*]** %6
        %8 = getelementptr inbounds [1 x i8*]* %7, i32 0, i32 1
        %9 = load i8** %8
        %10 = bitcast i8* %9 to void ({ i32, %tydesc*, i8*, i8*, i8 }*)*
        call void %10({ i32, %tydesc*, i8*, i8*, i8 }* %4)
        ret void
      }
      
      ...
      
      define void @_ZN4main_UUID.0E({ i32, %tydesc*, i8*, i8*, i8 }*) #4 {
      "function top level":
        %o = alloca %struct.Foo
        %1 = alloca { %tydesc*, i8* }
        %2 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 1
        %3 = bitcast i8** %2 to %struct.Foo**
        store %struct.Foo* %o, %struct.Foo** %3
        %4 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 0
        %5 = bitcast %tydesc** %4 to { %tydesc*, void ({ i32, %tydesc*, i8*, i8*, i8 }*)* }**
        store { %tydesc*, void ({ i32, %tydesc*, i8*, i8*, i8 }*)* }* @vtable1081, { %tydesc*, void ({ i32, %tydesc*, i8*, i8*, i8 }*)* }** %5
        call void @_ZN7callBar_UUID.0E({ i32, %tydesc*, i8*, i8*, i8 }* undef, { %tydesc*, i8* }* %1)
        ret void
      }
      ```
      
      Although this change doesn't increase the compilation speed much (I mentioned only about 1-2% boost on "rustc -O -Z time-passes syntax.rs"), but I still think it's a good thing to do as it greatly simplifies/clarifies LL generated in some cases which would definitely help in the future code generation investigations.
      
      I don't provide any new test cases in this patch as it is merely an optimization.
      
      Sorry guys, I somehow messed my previous PR and I don't see any better way to fix as to recreate it here.
      89cc8529
    • B
      auto merge of #9326 : NiccosSystem/rust/master, r=bstrie · 44997a12
      bors 提交于
      44997a12
    • H
      Uncomment a test. Fixes #4449. · 76a53911
      Huon Wilson 提交于
      76a53911
    • B
      auto merge of #9322 : catamorphism/rust/rustpkg-discovered-outputs, r=brson · 176051c6
      bors 提交于
      r? @brson as per #9112
      
      Closes #9112
      176051c6
    • B
      auto merge of #9321 : chris-morgan/rust/lowercase-nan-methods, r=brson · ccb80ab4
      bors 提交于
      This is for consistency in naming conventions.
      
      - ``std::num::Float::NaN()`` is changed to ``nan()``;
      - ``std::num::Float.is_NaN()`` is changed to ``is_nan()``; and
      - ``std::num::strconv::NumStrConv::NaN()`` is changed to ``nan()``.
      
      Fixes #9319.
      ccb80ab4
    • B
      auto merge of #9320 :... · e5fdc7de
      bors 提交于
      auto merge of #9320 : chris-morgan/rust/unreachable-macro-part-two-of-two-containing-the-destruction-of-the-unreachable-function, r=alexcrichton
      
      This is the second of two parts of #8991, now possible as a new snapshot
      has been made. (The first part implemented the unreachable!() macro; it
      was #8992, 6b7b8f26.)
      
      ``std::util::unreachable()`` is removed summarily; any code which used
      it should now use the ``unreachable!()`` macro.
      
      Closes #9312.
      
      Closes #8991.
      e5fdc7de
    • B
      auto merge of #9315 : thestinger/rust/doc, r=alexcrichton · c7c769d8
      bors 提交于
      This also renames the section, as managed vectors cannot be resized
      (since it would invalidate the other references).
      c7c769d8
    • D
      util: remove unused `with` function · 807725b9
      Daniel Micay 提交于
      807725b9
    • B
      auto merge of #9308 : ben0x539/rust/lexer-error-spans, r=alexcrichton · 7f826cb2
      bors 提交于
      Previously, the lexer calling `rdr.fatal(...)` would report the span of
      the last complete token, instead of a span within the erroneous token
      (besides one span fixed in 1ac90bb7).
      
      This branch adds wrappers around `rdr.fatal(...)` that sets the span
      explicilty, so that all fatal errors in `libsyntax/parse/lexer.rs` now
      report the offending code more precisely. A number of tests try to
      verify that, though the `compile-fail` testing setup can only check that
      the spans are on the right lines, and the "unterminated string/block
      comment" errors can't have the line marked at all, so that's incomplete.
      
      This closes #9149.
      
      Also, the lexer errors now report the offending code in the error message,
      not just via the span, just like other errors do.
      7f826cb2
    • B
      auto merge of #9285 : sfackler/rust/future, r=alexcrichton · 407d179f
      bors 提交于
      The `Drop` implementation was used to prevent `Future` from being implicitly copyable. Since `~fn`s are no longer copyable, this is no longer needed. I added a cfail test to make sure that this is actually the case.
      
      I method-ized all of the `Future` creation methods and added a new one, `spawn_with`, which is similar to `task::spawn_with`.
      
      I also got rid of some unused imports in tests.
      407d179f
    • F
      fixed another test. · 4e543f7a
      Felix S. Klock II 提交于
      4e543f7a
    • F
      fix bug in test. · 9627e80c
      Felix S. Klock II 提交于
      9627e80c
    • F
    • D
      restore auto-detection of text files · 9e3258e5
      Daniel Micay 提交于
      We force the usage of LF line endings, but *only* in text files.
      9e3258e5
    • B
      auto merge of #9342 : alexcrichton/rust/ignore-libuv-signal-tests, r=brson · 570431fc
      bors 提交于
      They're causing syscalls to get interrupted, and std::io doesn't correctly
      handle EINTR
      570431fc
    • S
      Clean up unused imports · 963707f4
      Steven Fackler 提交于
      963707f4
    • S
      Add Future::spawn_with · 48d5b4b8
      Steven Fackler 提交于
      48d5b4b8
    • S
      Modernize extra::future API · ff853893
      Steven Fackler 提交于
      ff853893
    • A
      Ignore io::process tests · 5165ecde
      Alex Crichton 提交于
      They're causing syscalls to get interrupted, and std::io doesn't correctly
      handle EINTR
      5165ecde