Commit Graph

67884 Commits

Author SHA1 Message Date
bors
2fdccaffe6 Auto merge of #44015 - kennytm:hasher, r=alexcrichton
impl Hasher for {&mut Hasher, Box<Hasher>}

**Rationale:** The `Hash` trait has `fn hash<H: Hasher>(&self, state: &mut H)`, which can only accept a `Sized` hasher, even if the `Hasher` trait is object-safe. We cannot retroactively add the `?Sized` bound without breaking stability, thus implementing `Hasher` to a trait object reference is the next best solution.

**Warning:** These `impl` are insta-stable, and should need an FCP. I don't think a full RFC is necessary.
2017-09-12 21:39:08 +00:00
leonardo.yvens
4738231cc7 Remove deprecated lang items
They have been deprecated for years and there is no trace left of them
in the compiler.
2017-09-12 17:04:26 -03:00
Guillaume Gomez
742ff5a489 Fix rendering of const keyword for functions 2017-09-12 21:55:24 +02:00
Aidan Hobson Sayers
15887d786b Correctly bubble up errors from libbacktrace 2017-09-12 20:27:54 +01:00
bors
dd08c30703 Auto merge of #44133 - vorner:allocator-kind-autodetect, r=alexcrichton
Autodetect the type of allocator crate used

Annotate the allocator crates (allocator_system, allocator_jemalloc) by the type of allocator they are. If one is requested as an exe allocator, detect its type by the flags.

This has the effect that using this (de jure wrong) configuration in the target spec works instead of producing a really unhelpful and arcane linker error:

"exe-allocation-crate": "alloc_system"

Fixes #43524.

There are two yet unsolved FIXME's, I'll be glad for some advice on what to do with them.
2017-09-12 18:12:21 +00:00
Michael Woerister
54fa047d92 Remove the cstore reference from Session in order to prepare encapsulating CrateStore access in tcx. 2017-09-12 07:19:06 -07:00
gaurikholkar
6e3cdcea4c Adding changes for trait objects 2017-09-12 18:22:22 +05:30
bors
a7b7dce02d Auto merge of #44413 - est31:move_man, r=nikomatsakis
Move the man directory to a subdirectory

There is no reason it should be in the top directory.
2017-09-12 12:41:23 +00:00
gaurikholkar
93529b40ca add ui test for fn items, tidy fixes 2017-09-12 16:48:18 +05:30
rwakulszowa
b8e0989445 Add an example of std::str::encode_utf16
Closes #44419
2017-09-12 11:59:42 +01:00
bors
817e1b81e2 Auto merge of #44344 - jonhoo:entry_or_default, r=BurntSushi
Add or_default to Entry APIs

As argued for in #44324, this PR adds a new `or_default` method to the various `Entry` APIs (currently just for `BTreeMap` and `HashMap`) when `V: Default`. This method is effectively a shorthand for `or_insert_with(Default::default)`.
2017-09-12 09:54:59 +00:00
kennytm
143e2dcd5c
Disable the new Hasher tests on Emscripten. 2017-09-12 17:28:07 +08:00
kennytm
0bbe468271
impl Hasher for {&mut Hasher, Box<Hasher>} 2017-09-12 17:28:07 +08:00
bors
8fc0fc8c2d Auto merge of #44310 - ldr709:master, r=BurntSushi
Additional traits for std::mem::ManuallyDrop

The first commit adds `Clone` and `Copy` trait implementations for `ManuallyDrop`. Although `Drop` and `Copy` cannot be used together, this may be useful for generics.

The second commit adds implementations common traits. I do not think this is necessary, as they could be implemented in a wrapper type outside the standard library, but it would make `ManuallyDrop` more convenient to use.
2017-09-12 07:13:40 +00:00
gaurikholkar
a128051f87 fixes 2017-09-12 10:10:11 +05:30
gaurikholkar
54af57018b correct depth initialisation 2017-09-12 10:06:29 +05:30
gaurikholkar
b2d869dc80 add logs 2017-09-12 10:06:29 +05:30
gaurikholkar
ed1181272e extend E0623 for fns 2017-09-12 10:06:29 +05:30
gaurikholkar
2f50c33290 Adding E0623 for structs 2017-09-12 10:06:29 +05:30
Jacob Kiesel
4de0cf122d Try using ref to raw conversion 2017-09-11 22:23:56 -06:00
bors
3cb24bd37b Auto merge of #44275 - eddyb:deferred-ctfe, r=nikomatsakis
Evaluate fixed-length array length expressions lazily.

This is in preparation for polymorphic array lengths (aka `[T; T::A]`) and const generics.
We need deferred const-evaluation to break cycles when array types show up in positions which require knowing the array type to typeck the array length, e.g. the array type is in a `where` clause.

The final step - actually passing bounds in scope to array length expressions from the parent - is not done because it still produces cycles when *normalizing* `ParamEnv`s, and @nikomatsakis' in-progress lazy normalization work is needed to deal with that uniformly.

However, the changes here are still useful to unlock work on const generics, which @EpicatSupercell manifested interest in, and I might be mentoring them for that, but we need this baseline first.

r? @nikomatsakis cc @oli-obk
2017-09-12 04:14:07 +00:00
Jeremy Soller
914853bbfa Fix tidy checks 2017-09-11 19:46:18 -06:00
bors
11f64d8f88 Auto merge of #43716 - MaloJaffre:_-in-literals, r=petrochenkov
Accept underscores in unicode escapes

Fixes #43692.

I don't know if this need an RFC, but at least the impl is here!
2017-09-12 01:25:23 +00:00
Jeremy Soller
e2820ea06c Sync with upstream syscall library 2017-09-11 18:46:01 -06:00
Frank Rehberger
85a9d97884 rustdoc: extend UdpSocket API doc (#657)
rustdoc: type-fixes
2017-09-12 01:50:32 +02:00
bors
07d950f38f Auto merge of #44498 - alexcrichton:fix-nightlies, r=alexcrichton
rustbuild: Fix a distribution bug with rustdoc

Apparently `File::create` was called when there was an existing hard link or the
like, causing an existing file to get accidentally truncated!

Closes #44487
2017-09-11 22:49:20 +00:00
Guillaume Gomez
79f888da68 Add arrow and improve display 2017-09-11 22:31:37 +02:00
Guillaume Gomez
9c12e5d4e8 add test 2017-09-11 22:31:05 +02:00
Guillaume Gomez
a095ee48d5 Add class for codeblocks 2017-09-11 22:31:02 +02:00
bors
eba374fb21 Auto merge of #44442 - Aaron1011:promote-static-ref, r=eddyb
Fix regression in promotion of rvalues referencing a static

This commit makes librustc_passes::consts::CheckCrateVisitor properly
mark expressions as promotable if they reference a static, as it's
perfectly fine for one static to reference another. It fixes a
regression that prevented a temporary rvalue from referencing a static
if it was itself declared within a static.

Prior to commit https://github.com/rust-lang/rust/commit/b8c05fe90bc,
`region::ScopeTree` would only register a 'terminating scope' for function
bodies. Thus, while rvalues in a static that referenced a static would be marked
unpromotable, the lack of enclosing scope would cause
mem_categorization::MemCategorizationContext::cat_rvalue_node
to compute a 'temporary scope' of `ReStatic`. Since this had the same
effect as explicitly selecting a scope of `ReStatic`
due to the rvalue being marked by CheckCrateVisitor as promotable,
no issue occurred.

However, commit https://github.com/rust-lang/rust/commit/b8c05fe90bc
made ScopeTree unconditionally register a 'terminating scope'
Since mem_categorization would now compute a non-static 'temporary scope', the
aforementioned rvalues would be erroneously marked as living for too
short a time.

By fixing the behavior of CheckCrateVisitor, this commit avoids changing
mem_categorization's behavior, while ensuring that temporary values in
statics are still allowed to reference other statics.

Fixes issue #44373
2017-09-11 20:02:19 +00:00
Alex Crichton
eb26d5b7c9 rustbuild: Fix a distribution bug with rustdoc
Apparently `File::create` was called when there was an existing hard link or the
like, causing an existing file to get accidentally truncated!

Closes #44487
2017-09-11 11:01:48 -07:00
Tommy Ip
ede6dfd72a Add doc example to str::from_boxed_utf8_unchecked
Fixes #44463.
2017-09-11 17:28:28 +01:00
steveklabnik
f3d6f120e8 update mdbook 2017-09-11 11:56:35 -04:00
bors
efa3ec67e2 Auto merge of #44435 - alexcrichton:in-scope, r=michaelwoerister
rustc: Remove HirId from queries

This'll allow us to reconstruct query parameters purely from the `DepNode`
they're associated with.

Closes #44414
2017-09-11 15:35:35 +00:00
Alex Crichton
caaf365a9d rustc: Remove HirId from queries
This'll allow us to reconstruct query parameters purely from the `DepNode`
they're associated with. Some queries could move straight to `HirId` but others
that don't always have a correspondance between `HirId` and `DefId` moved to
two-level maps where the query operates over a `DefIndex`, returning a map,
which is then keyed off `ItemLocalId`.

Closes #44414
2017-09-11 07:53:48 -07:00
Aaron Hill
fb540e3de4 Update comment to properly describe static promotion restrictions 2017-09-11 10:51:28 -04:00
bors
19d30fcdb2 Auto merge of #44440 - cuviper:min_global_align, r=japaric
Add `TargetOptions::min_global_align`, with s390x at 16-bit

The SystemZ `LALR` instruction provides PC-relative addressing for globals,
but only to *even* addresses, so other compilers make sure that such
globals are always 2-byte aligned.  In Clang, this is modeled with
`TargetInfo::MinGlobalAlign`, and `TargetOptions::min_global_align` now
serves the same purpose for rustc.

In Clang, the only targets that set this are SystemZ, Lanai, and NVPTX, and
the latter two don't have targets in rust master.

Fixes #44411.
r? @eddyb
2017-09-11 12:53:21 +00:00
bors
5d744e94c2 Auto merge of #44410 - alexcrichton:fix-travis, r=Mark-Simulacrum
Fix sanitizer tests on buggy kernels

Travis recently pushed an update to the Linux environments, namely the kernels
that we're running on. This in turn caused some of the sanitizer tests we run to
fail. We also apparently weren't the first to hit these failures! Detailed in
google/sanitizers#837 these tests were failing due to a specific commit in the
kernel which has since been backed out, but for now work around the buggy kernel
that's deployed on Travis and eventually we should be able to remove these
flags.
2017-09-11 09:47:06 +00:00
bors
a0b34199ba Auto merge of #44385 - alexcrichton:new-sccache-keys, r=alexcrichton
Rotate Travis/AppVeyor S3 keys

Haven't done this in awhile so seems like a good idea!
2017-09-11 07:18:27 +00:00
42triangles
f452acbb5e Removed trailing whitespace 2017-09-11 08:28:14 +02:00
42triangles
833a9b567a Added an example for std::str::into_boxed_bytes() 2017-09-11 08:13:57 +02:00
Eduard-Mihai Burtescu
57ebd28fdb rustc: use ConstVal::Unevaluated instead of mir::Literal::Item. 2017-09-11 08:41:16 +03:00
Eduard-Mihai Burtescu
74349fa288 rustc: evaluate fixed-length array length expressions lazily. 2017-09-11 08:41:16 +03:00
Eduard-Mihai Burtescu
88217618ec rustc: remove obsolete const_val::ErrKind::{Negate,Not}On. 2017-09-11 08:41:15 +03:00
Eduard-Mihai Burtescu
8a9b78f5cc rustc: use ty::Const for the length of TyArray. 2017-09-11 08:41:15 +03:00
Eduard-Mihai Burtescu
3ce31eb990 rustc: replace usize with u64 and ConstUsize. 2017-09-11 08:41:15 +03:00
Eduard-Mihai Burtescu
932289c12d rustc: introduce ty::Const { ConstVal, Ty }. 2017-09-11 08:41:15 +03:00
Eduard-Mihai Burtescu
50076b00c2 rustc: intern ConstVal's in TyCtxt. 2017-09-11 08:41:03 +03:00
bors
909733286f Auto merge of #44383 - qmx:gh/40473/no-inline-trait-method, r=nikomatsakis
MIR: should not inline trait method

Fixes #40473.

The idea here is bailing out of inlining if we're talking about a trait method.
2017-09-11 04:59:28 +00:00
bors
e6bce95094 Auto merge of #44375 - topecongiro:macrodef-span, r=petrochenkov
Add visibility to span for macros 2.0

cc https://github.com/rust-lang-nursery/rustfmt/issues/1949.
r? @nrc
2017-09-11 02:23:24 +00:00