1. 31 1月, 2015 29 次提交
    • A
      rollup merge of #21631: tbu-/isize_police · 188d7c0b
      Alex Crichton 提交于
      Conflicts:
      	src/libcoretest/iter.rs
      188d7c0b
    • A
      4c25687c
    • A
      f6dd25bb
    • A
      rollup merge of #21760: brson/snaps · 83972176
      Alex Crichton 提交于
      83972176
    • A
      rollup merge of #21783: lukesteensen/patch-1 · eb3a0609
      Alex Crichton 提交于
      eb3a0609
    • A
      rollup merge of #21780: steveklabnik/no_as_slice · a75e308a
      Alex Crichton 提交于
      Use auto deref instead.
      a75e308a
    • A
      rollup merge of #21765: P1start/non-ascii-style-lints · 6ea5fb8a
      Alex Crichton 提交于
      An alternative to #21749.
      
      This also refactors the naming lint code a little bit and slightly rephrases some warnings (`uppercase` → `upper case`).
      
      Closes #21735.
      6ea5fb8a
    • A
      rollup merge of #21762: brson/users · 62a8462b
      Alex Crichton 提交于
      62a8462b
    • A
      rollup merge of #21753: dzamlo/master · 9d970c65
      Alex Crichton 提交于
      Before, unknown -Z option would result in a "error: unknown codegen option"
      message instead of "error: unknown debugging option".
      9d970c65
    • A
      rollup merge of #21747: nikomatsakis/issue-21726-projection-subtyping · 42e4c1ae
      Alex Crichton 提交于
      Make subtyping for projection types stricter. Fixes #21726.
      
      r? @pnkfelix
      42e4c1ae
    • A
      rollup merge of #21739: alexcrichton/better-print · c8f2726b
      Alex Crichton 提交于
      Closes rust-lang/cargo#1234
      c8f2726b
    • A
    • A
      rollup merge of #21736: sfackler/bufread-capacity-fix · ebee4b4b
      Alex Crichton 提交于
      We don't care about how much space the allocation has, but the actual
      usable space in the buffer.
      
      r? @alexcrichton
      ebee4b4b
    • A
      rollup merge of #21733: mneumann/fix-io-rename-df · f8b3d5c2
      Alex Crichton 提交于
      f8b3d5c2
    • A
      rollup merge of #21720: huonw/simd-cmp · c0705c1f
      Alex Crichton 提交于
      Previously comparisons of SIMD types were always signed, even unsigned
      comparisons, meaning 0xFFFF_FFFF_u32 < 0 inside a SIMD vector.
      
      Fixes #21719.
      c0705c1f
    • A
      rollup merge of #21718: alexcrichton/stabilize-from-str · ac1a03d7
      Alex Crichton 提交于
      This commits adds an associated type to the `FromStr` trait representing an
      error payload for parses which do not succeed. The previous return value,
      `Option<Self>` did not allow for this form of payload. After the associated type
      was added, the following attributes were applied:
      
      * `FromStr` is now stable
      * `FromStr::Err` is now stable
      * `FromStr::from_str` is now stable
      * `StrExt::parse` is now stable
      * `FromStr for bool` is now stable
      * `FromStr for $float` is now stable
      * `FromStr for $integral` is now stable
      * Errors returned from stable `FromStr` implementations are stable
      * Errors implement `Display` and `Error` (both impl blocks being `#[stable]`)
      
      Closes #15138
      ac1a03d7
    • A
      rollup merge of #21706: reem/missing-zeroable-impl-for-unique · 0ba812fb
      Alex Crichton 提交于
      This allows the use of `NonZero<Unique<T>>` for owned,
      non-null raw pointers.
      
      cc https://github.com/Gankro/collect-rs/pull/103
      0ba812fb
    • A
      rollup merge of #21704: FlaPer87/macro-reexport · 692a3661
      Alex Crichton 提交于
      Conflicts:
      	src/libstd/lib.rs
      692a3661
    • A
      rollup merge of #21702: nikomatsakis/issue-21636 · 103f1459
      Alex Crichton 提交于
      Check and extract bindings from trait definitions.
      
      Fixes #21636.
      
      r? @nick29581
      103f1459
    • A
      rollup merge of #21693: tomjakubowski/rustdoc-fix-21442 · 16120e9a
      Alex Crichton 提交于
      Fix #21442
      16120e9a
    • A
      rollup merge of #21678: vojtechkral/threads-native-names · b70ec4d9
      Alex Crichton 提交于
      Fixes #10302
      
      I really am not sure I'm doing this right, so here goes nothing...
      
      Also testing this isn't easy. I don't have any other *nix boxes besides a Linux one.
      
      Test code:
      
      ```rust
      use std::thread;
      use std::io::timer::sleep;
      use std::time::duration::Duration;
      
      fn make_thread<'a>(i: i64) -> thread::JoinGuard<'a, ()>
      {
      	thread::Builder::new().name(format!("MyThread{}", i).to_string()).scoped(move ||
      	{
      		println!("Start: {}", i);
      		sleep(Duration::seconds(i));
      		println!("End: {}", i);
      	})
      }
      
      fn main()
      {
      	let mut guards = vec![make_thread(3)];
      
      	for i in 4i64..16
      	{
      		guards.push(make_thread(i));
      	}
      }
      ```
      
      GDB output on my machine:
      
      ```
      (gdb) info threads
        Id   Target Id         Frame
        15   Thread 0x7fdfbb35f700 (LWP 23575) "MyThread3" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0
        14   Thread 0x7fdfba7ff700 (LWP 23576) "MyThread4" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0
        13   Thread 0x7fdfba5fe700 (LWP 23577) "MyThread5" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0
        12   Thread 0x7fdfba3fd700 (LWP 23578) "MyThread6" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0
        11   Thread 0x7fdfb8dfe700 (LWP 23580) "MyThread4" 0x00007fdfbb746193 in select () from /usr/lib/libc.so.6
        10   Thread 0x7fdfb8fff700 (LWP 23579) "MyThread7" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0
        9    Thread 0x7fdfb8bfd700 (LWP 23581) "MyThread8" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0
        8    Thread 0x7fdfb3fff700 (LWP 23582) "MyThread9" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0
        7    Thread 0x7fdfb3dfe700 (LWP 23583) "MyThread10" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0
        6    Thread 0x7fdfb3bfd700 (LWP 23584) "MyThread11" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0
        5    Thread 0x7fdfb2bff700 (LWP 23585) "MyThread12" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0
        4    Thread 0x7fdfb29fe700 (LWP 23586) "MyThread13" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0
        3    Thread 0x7fdfb27fd700 (LWP 23587) "MyThread14" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0
        2    Thread 0x7fdfb1bff700 (LWP 23588) "MyThread15" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0
      * 1    Thread 0x7fdfbc411800 (LWP 23574) "threads" 0x00007fdfbbe2e505 in pthread_join () from /usr/lib/libpthread.so.0
      ```
      (I'm not sure why one of the threads is duplicated, but it does that without my patch too...)
      b70ec4d9
    • A
      rollup merge of #21495: richo/unexported-unmangled-lint · b446c5b6
      Alex Crichton 提交于
      The usecase is that functions made visible to systems outside of the
      rust ecosystem require the symbol to be visible.
      
      This adds a lint for functions that are not exported, but also not mangled.
      
      It has some gotchas:
      
      [ ]: There is fallout in core that needs taking care of
      [ ]: I'm not convinced the error message is correct
      [ ]: It has no tests
      
      ~~However, there's an underlying issue which I'd like feedback on- which is that my belief that that non-pub functions would not have their symbols exported, however that seems not to be the case in the first case that this lint turned up in rustc (`rust_fail`), which intuition suggests has been working.~~
      
      This seems to be a separate bug in rust, wherein the symbols are exported in binaries, but not in rlibs or dylibs. This lint would catch that case.
      b446c5b6
    • A
      rollup merge of #21494: jatinn/jsnav · 9ff540ba
      Alex Crichton 提交于
      Added javascript code to insert next/prev links in the rust book.
      Related Issue - https://github.com/rust-lang/rust/issues/20835
      9ff540ba
    • A
      rollup merge of #21385: nick29581/save-fix2 · 15dd0a5a
      Alex Crichton 提交于
      r? @huonw
      15dd0a5a
    • A
      rollup merge of #20790: japaric/for-loops · 341e858b
      Alex Crichton 提交于
      As per [RFC #235][rfc], you can now do:
      
      [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0235-collections-conventions.md#intoiterator-and-iterable
      
      ``` rust
      let mut v = vec![1];
      
      // iterate over immutable references
      for x in &v {
          assert_eq!(x, &1);
      }
      
      // iterate over mutable references
      for x in &mut v {
          assert_eq!(x, &mut 1);
      }
      
      // iterate over values, this consumes `v`
      for x in v {
          assert_eq!(x, 1);
      }
      ```
      
      [breaking-change]s
      
      For loops now "consume" (move) the iterator, this breaks iterating over mutable references to iterators, and also breaks multiple iterations over the same iterator:
      
      ``` rust
      fn foo(mut it: &mut Iter) {  // `Iter` implements `Iterator`
          for x in it { .. }  //~ error: `&mut Iter` doesn't implement Iterator
      }
      
      fn bar() {
          for x in it { .. }  //~ note: `it` moved here
          for x in it { .. }  //~ error: `it` has been moved
      }
      ```
      
      Both cases can be fixed using the `by_ref()` adapter to create an iterator from the mutable reference:
      
      ``` rust
      fn foo(mut it: &mut Iter) {
          for x in it.by_ref() { .. }
      }
      
      fn bar() {
          for x in it.by_ref() { .. }
          for x in it { .. }
      }
      ```
      
      This PR also makes iterator non-implicitly copyable, as this was source of subtle bugs in the libraries. You can still use `clone()` to explictly copy the iterator.
      
      Finally, since the for loops are implemented in the frontend and use global paths to `IntoIterator`, `Iterator` and `Option` variants, users of the `core` crate will have to use add an `std` module to the root of their crate to be able to use for loops:
      
      ``` rust
      #![no_std]
      
      extern crate core;
      
      fn main() {
          for x in 0..10 {}
      }
      
      #[doc(hidden)]
      mod std {
          // these imports are needed to use for-loops
          pub use core::iter;
          pub use core::option;
      }
      ```
      
      ---
      
      r? @nikomatsakis @aturon
      cc #18424
      closes #18045
      341e858b
    • L
      Fix a missed io => old_io · 0a488185
      Luke Steensen 提交于
      0a488185
    • A
      std: Stabilize the std::fmt module · 62273575
      Alex Crichton 提交于
      This commit performs a final stabilization pass over the std::fmt module,
      marking all necessary APIs as stable. One of the more interesting aspects of
      this module is that it exposes a good deal of its runtime representation to the
      outside world in order for `format_args!` to be able to construct the format
      strings. Instead of hacking the compiler to assume that these items are stable,
      this commit instead lays out a story for the stabilization and evolution of
      these APIs.
      
      There are three primary details used by the `format_args!` macro:
      
      1. `Arguments` - an opaque package of a "compiled format string". This structure
         is passed around and the `write` function is the source of truth for
         transforming a compiled format string into a string at runtime. This must be
         able to be constructed in stable code.
      
      2. `Argument` - an opaque structure representing an argument to a format string.
         This is *almost* a trait object as it's just a pointer/function pair, but due
         to the function originating from one of many traits, it's not actually a
         trait object. Like `Arguments`, this must be constructed from stable code.
      
      3. `fmt::rt` - this module contains the runtime type definitions primarily for
         the `rt::Argument` structure. Whenever an argument is formatted with
         nonstandard flags, a corresponding `rt::Argument` is generated describing how
         the argument is being formatted. This can be used to construct an
         `Arguments`.
      
      The primary interface to `std::fmt` is the `Arguments` structure, and as such
      this type name is stabilize as-is today. It is expected for libraries to pass
      around an `Arguments` structure to represent a pending formatted computation.
      
      The remaining portions are largely "cruft" which would rather not be stabilized,
      but due to the stability checks they must be. As a result, almost all pieces
      have been renamed to represent that they are "version 1" of the formatting
      representation. The theory is that at a later date if we change the
      representation of these types we can add new definitions called "version 2" and
      corresponding constructors for `Arguments`.
      
      One of the other remaining large questions about the fmt module were how the
      pending I/O reform would affect the signatures of methods in the module. Due to
      [RFC 526][rfc], however, the writers of fmt are now incompatible with the
      writers of io, so this question has largely been solved. As a result the
      interfaces are largely stabilized as-is today.
      
      [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0526-fmt-text-writer.md
      
      Specifically, the following changes were made:
      
      * The contents of `fmt::rt` were all moved under `fmt::rt::v1`
      * `fmt::rt` is stable
      * `fmt::rt::v1` is stable
      * `Error` is stable
      * `Writer` is stable
      * `Writer::write_str` is stable
      * `Writer::write_fmt` is stable
      * `Formatter` is stable
      * `Argument` has been renamed to `ArgumentV1` and is stable
      * `ArgumentV1::new` is stable
      * `ArgumentV1::from_uint` is stable
      * `Arguments::new_v1` is stable (renamed from `new`)
      * `Arguments::new_v1_formatted` is stable (renamed from `with_placeholders`)
      * All formatting traits are now stable, as well as the `fmt` method.
      * `fmt::write` is stable
      * `fmt::format` is stable
      * `Formatter::pad_integral` is stable
      * `Formatter::pad` is stable
      * `Formatter::write_str` is stable
      * `Formatter::write_fmt` is stable
      * Some assorted top level items which were only used by `format_args!` were
        removed in favor of static functions on `ArgumentV1` as well.
      * The formatting-flag-accessing methods remain unstable
      
      Within the contents of the `fmt::rt::v1` module, the following actions were
      taken:
      
      * Reexports of all enum variants were removed
      * All prefixes on enum variants were removed
      * A few miscellaneous enum variants were renamed
      * Otherwise all structs, fields, and variants were marked stable.
      
      In addition to these actions in the `std::fmt` module, many implementations of
      `Show` and `String` were stabilized as well.
      
      In some other modules:
      
      * `ToString` is now stable
      * `ToString::to_string` is now stable
      * `Vec` no longer implements `fmt::Writer` (this has moved to `String`)
      
      This is a breaking change due to all of the changes to the `fmt::rt` module, but
      this likely will not have much impact on existing programs.
      
      Closes #20661
      [breaking-change]
      62273575
    • A
      std: Stabilize FromStr and parse · 0cdde6e5
      Alex Crichton 提交于
      This commits adds an associated type to the `FromStr` trait representing an
      error payload for parses which do not succeed. The previous return value,
      `Option<Self>` did not allow for this form of payload. After the associated type
      was added, the following attributes were applied:
      
      * `FromStr` is now stable
      * `FromStr::Err` is now stable
      * `FromStr::from_str` is now stable
      * `StrExt::parse` is now stable
      * `FromStr for bool` is now stable
      * `FromStr for $float` is now stable
      * `FromStr for $integral` is now stable
      * Errors returned from stable `FromStr` implementations are stable
      * Errors implement `Display` and `Error` (both impl blocks being `#[stable]`)
      
      Closes #15138
      0cdde6e5
    • S
      Don't use as_slice() in docs · 19a1f7ed
      Steve Klabnik 提交于
      Use deref coercions instead.
      19a1f7ed
  2. 30 1月, 2015 11 次提交