1. 13 11月, 2018 15 次提交
    • K
      Rollup merge of #55863 - dwijnand:patch-1, r=bluss · 910289c9
      kennytm 提交于
      Fix a typo in std::panic
      910289c9
    • K
      Rollup merge of #55858 - GuillaumeGomez:fixes-rustdoc-codeblocks, r=QuietMisdreavus · 828dd17a
      kennytm 提交于
      Small fixes on code blocks in rustdoc
      
      It currently has a little margin issue with the `i` and there were js errors.
      
      r? @QuietMisdreavus
      828dd17a
    • K
      Rollup merge of #55843 - Axary:master, r=sfackler · 196db96d
      kennytm 提交于
      add FromIterator<A> to Box<[A]>
      196db96d
    • K
      Rollup merge of #55840 - dlrobertson:fix_stage0_download, r=alexcrichton · 5b572fb8
      kennytm 提交于
      Fix TLS errors when downloading stage0
      
      While attempting to test #49878 on Windows I hit the following error when attempting to download stage0.
      
      ```
      The request was aborted: Could not create SSL/TLS secure channel
      ```
      
      Instead of using the shell, we can just use `urllib`, which seems to fix the issue.
      5b572fb8
    • K
      Rollup merge of #55837 - Centril:spökdata-skall-vara-strukturellt-matchbar, r=eddyb · f73df10c
      kennytm 提交于
      Make PhantomData #[structural_match]
      
      fixes https://github.com/rust-lang/rust/issues/55028
      
      This makes `PhantomData<T>` structurally matchable, irrespective of whether `T` is, per the discussion on this week's language team meeting (the general consensus was that this was a bug-fix).
      
      All types containing `PhantomData<T>` and which used `#[derive(PartialEq, Eq)]` and were previously not `#[structural_match]` only because of `PhantomData<T>` will now be `#[structural_match]`.
      
      r? @nikomatsakis
      f73df10c
    • K
      Rollup merge of #55805 - nnethercote:mv-static_assert, r=Mark-Simulacrum · 98bc7d63
      kennytm 提交于
      Move `static_assert!` into librustc_data_structures
      98bc7d63
    • K
      Rollup merge of #55804 - QuietMisdreavus:eager-crate-inline, r=pnkfelix · d811f844
      kennytm 提交于
      rustdoc: don't inline `pub use some_crate` unless directly asked to
      
      cc https://github.com/rust-lang/rust/issues/52509 (fixes it? i'm not sure about my comment summoning the docs team)
      
      When rustdoc encounters a `pub use` statement for an item from another crate, it will eagerly inline its contents into your crate. This somewhat clashes with the new paths behavior in Rust 2018, in which crates are implicitly linked and re-exported with `pub use` instead of `pub extern crate`. In rust 2015, `pub extern crate` would only create a single line for its re-export in the docs, so i'm making it do the same with `pub use some_crate;`.
      
      The exact new behavior is like this: *If rustdoc sees a `pub use` statement, and the item being imported is the root of another crate, it will only inline it if `#[doc(inline)]` is provided.* I made it only avoid crate roots because otherwise it would stop inlining any module, which may or may not be what people want.
      d811f844
    • K
      Rollup merge of #55754 - spastorino:fix-process-output-docs, r=alexcrichton · a8bcf612
      kennytm 提交于
      Avoid converting bytes to UTF-8 strings to print, just pass bytes to stdout/err
      
      r? @nikomatsakis
      a8bcf612
    • K
    • B
      Auto merge of #55052 - newpavlov:patch-2, r=alexcrichton · c4371c85
      bors 提交于
      Use read_unaligned instead of read in transmute_copy
      
      Closes: #55044
      
      This change could result in performance regression on non-x86 platforms. (but it also can fix some of UB which lurks in existing programs) An alternative would be to update `transmute_copy` documentation with alignment requirements.
      c4371c85
    • N
      Move two `static_assert!`s to better spots. · 2bd4d5b1
      Nicholas Nethercote 提交于
      And make them x86_64-only so they can use `==` instead of `<=`.
      2bd4d5b1
    • N
      fb3dd9f6
    • N
      Move a `static_assert!` to a better spot. · 49f482f5
      Nicholas Nethercote 提交于
      And make it x86_64-only so it can use `==` instead of `<=`.
      49f482f5
    • N
      Move `static_assert!` into librustc_data_structures. · ab8a947f
      Nicholas Nethercote 提交于
      This means it can be used by more crates.
      ab8a947f
    • B
      Auto merge of #55278 - Centril:constification-1, r=alexcrichton · 65204a97
      bors 提交于
      Minor standard library constification
      
      This PR makes some bits of the standard library into `const fn`s.
      I've tried to be as aggressive as I possibly could in the constification.
      The list is rather small due to how restrictive `const fn` is at the moment.
      
      r? @oli-obk cc @rust-lang/libs
      
      Stable public APIs affected:
      + [x] `Cell::as_ptr`
      + [x] `UnsafeCell::get`
      + [x] `char::is_ascii`
      + [x] `iter::empty`
      + [x] `ManuallyDrop::{new, into_inner}`
      + [x] `RangeInclusive::{start, end}`
      + [x] `NonNull::as_ptr`
      + [x] `{[T], str}::as_ptr`
      + [x] `Duration::{as_secs, subsec_millis, subsec_micros, subsec_nanos}`
      + [x] `CStr::as_ptr`
      + [x] `Ipv4Addr::is_unspecified`
      + [x] `Ipv6Addr::new`
      + [x] `Ipv6Addr::octets`
      
      Unstable public APIs affected:
      + [x] `Duration::{as_millis, as_micros, as_nanos, as_float_secs}`
      + [x] `Wrapping::{count_ones, count_zeros, trailing_zeros, rotate_left, rotate_right, swap_bytes, reverse_bits, from_be, from_le, to_be, to_le, leading_zeros, is_positive, is_negative, leading_zeros}`
      + [x] `core::convert::identity`
      
      --------------------------
      
      ## Removed from list in first pass:
      
      Stable public APIs affected:
      + [ ] `BTree{Map, Set}::{len, is_empty}`
      + [ ] `VecDeque::is_empty`
      + [ ] `String::{is_empty, len}`
      + [ ] `FromUtf8Error::utf8_error`
      + [ ] `Vec<T>::{is_empty, len}`
      + [ ] `Layout::size`
      + [ ] `DecodeUtf16Error::unpaired_surrogate`
      + [ ] `core::fmt::{fill, width, precision, sign_plus, sign_minus, alternate, sign_aware_zero_pad}`
      + [ ] `panic::Location::{file, line, column}`
      + [ ] `{ChunksExact, RChunksExact}::remainder`
      + [ ] `Utf8Error::valid_up_to`
      + [ ] `VacantEntry::key`
      + [ ] `NulError::nul_position`
      + [ ] `IntoStringError::utf8_error`
      + [ ] `IntoInnerError::error`
      + [ ] `io::Chain::get_ref`
      + [ ] `io::Take::{limit, get_ref}`
      + [ ] `SocketAddrV6::{flowinfo, scope_id}`
      + [ ] `PrefixComponent::{kind, as_os_str}`
      + [ ] `Path::{ancestors, display}`
      + [ ] `WaitTimeoutResult::timed_out`
      + [ ] `Receiver::{iter, try_iter}`
      + [ ] `thread::JoinHandle::thread`
      + [ ] `SystemTimeError::duration`
      
      Unstable public APIs affected:
      + [ ] `core::fmt::Arguments::new_v1`
      + [ ] `core::fmt::Arguments::new_v1_formatted`
      + [ ] `Pin::{get_ref, into_ref}`
      + [ ] `Utf8Lossy::chunks`
      + [ ] `LocalWaker::as_waker`
      + [ ] `panic::PanicInfo::{internal_constructor, message, location}`
      + [ ] `panic::Location::{internal_constructor }`
      
      ## Removed from list in 2nd pass:
      
      Stable public APIs affected:
      + [ ] `LinkedList::{new, iter, is_empty, len}`
      + [ ] `mem::forget`
      + [ ] `Cursor::{new, get_ref, position}`
      + [ ] `io::{empty, repeat, sink}`
      + [ ] `PoisonError::new`
      + [ ] `thread::Builder::new`
      + [ ] `process::Stdio::{piped, inherit, null}`
      
      Unstable public APIs affected:
      + [ ] `io::Initializer::{zeroing, should_initialize}`
      65204a97
  2. 12 11月, 2018 11 次提交
    • B
      Auto merge of #55604 - nnethercote:avoid-associated_items-Box, r=nnethercote · 0195812a
      bors 提交于
      Avoid the Box in `TyCtxt::associated_items`.
      
      This reduces instruction counts on `packed_simd` by 2%.
      
      r? @nikomatsakis
      0195812a
    • N
      Avoid the Box in `TyCtxt::associated_items`. · e927a244
      Niko Matsakis 提交于
      This reduces instruction counts on packed_simd by 2%.
      e927a244
    • B
      Auto merge of #55701 - tromey:ice-fix, r=matthewjasper · d1d79ae3
      bors 提交于
      Fix emission of niche-filling discriminant values
      
      Bug #55606 points out a regression introduced by #54004; namely that
      an assertion can erroneously fire when a niche-filling discriminant
      value is emitted.
      
      This fixes the bug by removing the assertion, and furthermore by
      arranging for the discriminant value to be masked according to the
      size of the niche.  This makes handling the discriminant a bit simpler
      for debuggers.
      
      The test case is from Jonathan Turner.
      
      Closes #55606
      d1d79ae3
    • D
      Fix TLS errors when downloading stage0 · c2112381
      Dan Robertson 提交于
      c2112381
    • B
      Auto merge of #55525 - nnethercote:MatcherPos-stack-SmallVec, r=nnethercote · d8f4c9ff
      bors 提交于
      Make `MatcherPos::stack` a `SmallVec`.
      
      This avoids some allocations.
      
      This seems like a trivial change, but the compiler rejects it:
      ```
         Compiling syntax v0.0.0 (/home/njn/moz/rust1/src/libsyntax)
      error[E0597]: `initial` does not live long enough=========>           ] 89/110: syntax
         --> libsyntax/ext/tt/macro_parser.rs:647:57
          |
      647 |     let mut cur_items = smallvec![MatcherPosHandle::Ref(&mut initial)];
          |                                                         ^^^^^^^^^^^^ borrowed value does not live long enough
      ...
      762 | }
          | -
          | |
          | `initial` dropped here while still borrowed
          | borrow later used here, when `initial` is dropped
      
      error: aborting due to previous error
      ```
      This is either a compiler bug, or there's some subtle thing I don't understand. The lifetimes sure seem straightforward: `initial` is declared, and then `cur_items` is declared immediately afterward, and it uses a reference to `initial`. The error message makes it sound like the compiler is dropping the variables in the wrong order.
      
      r? @nikomatsakis, any idea what the problem is?
      d8f4c9ff
    • N
      Make `MatcherPos::stack` a `SmallVec`. · 68e76dca
      Niko Matsakis 提交于
      This avoids some allocations.
      68e76dca
    • B
      Auto merge of #55698 - nikic:remove-llvm-4-support, r=alexcrichton · 775eab58
      bors 提交于
      Remove support for building against LLVM 4
      
      With emscripten removed in #55626, we no longer need to support building against LLVM 4.
      775eab58
    • B
      Auto merge of #55660 - alexcrichton:cleanup-alloc-system, r=dtolnay,SimonSapin · ca79ecd6
      bors 提交于
      Remove the `alloc_system` crate
      
      In what's hopefully one of the final nails in the coffin of the "old allocator story of yore" this PR deletes the `alloc_system` crate and all traces of it from the compiler. The compiler no longer needs to inject allocator crates anywhere and the `alloc_system` crate has no real reason to exist outside the standard library.
      
      The unstable `alloc_system` crate is folded directly into the standard library where its stable interface, the `System` type, remains the same. All unstable traces of `alloc_system` are removed, however.
      ca79ecd6
    • A
      std: Delete the `alloc_system` crate · cc759034
      Alex Crichton 提交于
      This commit deletes the `alloc_system` crate from the standard
      distribution. This unstable crate is no longer needed in the modern
      stable global allocator world, but rather its functionality is folded
      directly into the standard library. The standard library was already the
      only stable location to access this crate, and as a result this should
      not affect any stable code.
      cc759034
    • A
      rustc: Clean up allocator injection logic · d3939322
      Alex Crichton 提交于
      This commit cleans up allocator injection logic found in the compiler
      around selecting the global allocator. It turns out that now that
      jemalloc is gone the compiler never actually injects anything! This
      means that basically everything around loading crates here and there can
      be easily pruned.
      
      This also removes the `exe_allocation_crate` option from custom target
      specs as it's no longer used by the compiler anywhere.
      d3939322
    • B
      Auto merge of #55657 - davidtwco:issue-55651, r=pnkfelix · 5a2ca1a6
      bors 提交于
      NLL Diagnostic Review 3: Unions not reinitialized after assignment into field
      
      Fixes #55651, #55652.
      
      This PR makes two changes:
      
      First, it updates the dataflow builder to add an init for the place
      containing a union if there is an assignment into the field of
      that union.
      
      Second, it stops a "use of uninitialized" error occuring when there is an
      assignment into the field of an uninitialized union that was previously
      initialized. Making this assignment would re-initialize the union, as
      tested in `src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr`.
      The check for previous initialization ensures that we do not start
      supporting partial initialization yet (cc #21232, #54499, #54986).
      
      This PR also fixes #55652 which was marked as requiring investigation
      as the changes in this PR add an error that was previously missing
      (and mentioned in the review comments) and confirms that the error
      that was present is correct and a result of earlier partial
      initialization changes in NLL.
      
      r? @pnkfelix (due to earlier work with partial initialization)
      cc @nikomatsakis
      5a2ca1a6
  3. 11 11月, 2018 14 次提交
    • B
      Auto merge of #55674 - oli-obk:miri_engine_refactoring, r=RalfJung · a88613c8
      bors 提交于
      Miri engine refactoring
      
      r? @RalfJung
      
      split out the "just moves stuff around" part of https://github.com/rust-lang/rust/pull/55293
      a88613c8
    • A
      change attribute to stable · ab55d9b5
      Axary 提交于
      ab55d9b5
    • A
      Merge branch 'master' of https://github.com/rust-lang/rust · 50307942
      Axary 提交于
      50307942
    • D
      Fix a typo in std::panic · 20ef40ae
      Dale Wijnand 提交于
      20ef40ae
    • B
      Auto merge of #55859 - pietroalbini:rollup, r=kennytm · b76ee832
      bors 提交于
      Rollup of 17 pull requests
      
      Successful merges:
      
       - #55630 (resolve: Filter away macro prelude in modules with `#[no_implicit_prelude]` on 2018 edition)
       - #55687 (Take supertraits into account when calculating associated types)
       - #55745 (Convert `outlives_components`' return value to a `SmallVec` outparam.)
       - #55764 (Fix Rc/Arc allocation layout)
       - #55792 (Prevent ICE in const-prop array oob check)
       - #55799 (Removed unneeded instance of `// revisions` from a lint test)
       - #55800 (Fix ICE in `return_type_impl_trait`)
       - #55801 (NLL: Update box insensitivity test)
       - #55802 (Don't inline virtual calls (take 2))
       - #55816 (Use `SmallVec` to avoid allocations in `from_decimal_string`.)
       - #55819 (Typecheck patterns of all match arms first, so we get types for bindings)
       - #55822 (ICE with #![feature(nll)] and elided lifetimes)
       - #55828 (Add missing `rustc_promotable` attribute to unsigned `min_value` and `max_value`)
       - #55839 (Fix docstring spelling mistakes)
       - #55844 (Fix documentation typos.)
       - #55845 (Set BINARYEN_TRAP_MODE=clamp)
       - #55856 (rustdoc: refactor: move all static-file include!s into a single module)
      b76ee832
    • K
      Rollup merge of #55856 - QuietMisdreavus:static-discharge, r=GuillaumeGomez · 7031e4e7
      kennytm 提交于
      rustdoc: refactor: move all static-file include!s into a single module
      
      This is a smaller refactor that creates a new module `rustdoc::html::static_files`, which contains a bunch of `static` variables with all the files in `html/static` that we use. The idea behind moving them all here was to remove the duplicate `include_bytes!()` that are used by the theme-checker code. It also continues to centralize more operations in rustdoc.
      7031e4e7
    • K
      Rollup merge of #55845 - nikic:emscripten-clamp-mode, r=alexcrichton · d0b68c0d
      kennytm 提交于
      Set BINARYEN_TRAP_MODE=clamp
      
      This fixes the wasm32-unknown-emscripten test failure mentioned in https://github.com/rust-lang/rust/pull/55626#issuecomment-437084774, by making binaryen operate in clamp rather than trap mode.
      
      The issue is that the current `-Zsaturating-float-casts` implementation uses `fpto[us]i` unconditionally (and selects afterwards), which does not work with trapping implementations of fpto[su]i, which emscripten uses by default.
      
      I've left a FIXME to drop this flag once we have a better solution for saturating casts on the LLVM side.
      ;
      d0b68c0d
    • K
      Rollup merge of #55630 - petrochenkov:noprelude, r=Centril · 75e920f8
      kennytm 提交于
      resolve: Filter away macro prelude in modules with `#[no_implicit_prelude]` on 2018 edition
      
      This is a tiny thing.
      For historical reasons macro prelude (macros from `#[macro_use] extern crate ...`, including `extern crate std`) is still available in modules with `#[no_implicit_prelude]`.
      This PR provides proper isolation and removes those names from scope.
      
      `#[no_implicit_prelude]` modules still have built-in types (`u8`), built-in attributes (`#[inline]`) and built-in macros (`env!("PATH")`) in scope. We can introduce some `#[no_implicit_prelude_at_all]` to remove those as well, but that's a separate issue.
      
      The change is done only on 2018 edition for backward compatibility.
      I'm pretty sure this can be done on 2015 as well because `#[no_implicit_prelude]` is rarely used, but I don't want to go through the crater/deprecation process right now, maybe later.
      
      cc https://github.com/rust-lang/rust/issues/53977
      r? @ghost
      75e920f8
    • B
      Auto merge of #54993 - TimNN:pda-tdl, r=eddyb · 9b8f9029
      bors 提交于
      Support for the program data address space option of LLVM's Target Datalayout
      
      This was introduced recently (specifically, for AVR, cc @dylanmckay).
      
      (I came up with this when attempting to run [avr-rust](https://github.com/avr-rust/rust) rebased on the latest [rust-lang](https://github.com/rust-lang/rust) commits. If this requires a different design, some additional discussions, or is not something to pursue right now, I'd be happy to close this PR).
      
      Note that this somewhat overlaps with @DiamondLovesYou's #51576, I think, although the implementation here is significantly simpler: Since the address space applies to _all_ program data, we can just check the pointee's type whenever we create an LLVM pointer type. If it is a function we use the program data address space; if not we use the default address space.
      
      cc @EddyB, who has been reviewing #51576
      
      Ref: https://llvm.org/docs/LangRef.html#data-layout
      9b8f9029
    • P
      Rollup merge of #55844 - waywardmonkeys:typo-fixes, r=varkor · 17ae5076
      Pietro Albini 提交于
      Fix documentation typos.
      17ae5076
    • P
      Rollup merge of #55839 - dralley:docstring-spelling, r=TimNN · 417b10a0
      Pietro Albini 提交于
      Fix docstring spelling mistakes
      417b10a0
    • P
      Rollup merge of #55828 - oli-obk:promotion_strikes_again, r=eddyb · 0f1c1eb4
      Pietro Albini 提交于
      Add missing `rustc_promotable` attribute to unsigned `min_value` and `max_value`
      
      cc @pnkfelix
      
      fixes #55806
      0f1c1eb4
    • P
      Rollup merge of #55822 - davidtwco:issue-55394, r=pnkfelix · 4c50964c
      Pietro Albini 提交于
      ICE with #![feature(nll)] and elided lifetimes
      
      Fixes #55394.
      
      This commit fixes an ICE and determines the correct return span in cases
      with a method implemented on a struct with an an elided lifetime.
      
      r? @pnkfelix
      4c50964c
    • P
      Rollup merge of #55819 - pnkfelix:issue-55810-must-typeck-pats-eagerly, r=oli-obk · c4ca49ae
      Pietro Albini 提交于
      Typecheck patterns of all match arms first, so we get types for bindings
      
      Fix eventually (after backport to beta) the issue #55810
      c4ca49ae