]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoAuto merge of #43716 - MaloJaffre:_-in-literals, r=petrochenkov
bors [Tue, 12 Sep 2017 01:25:23 +0000 (01:25 +0000)]
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!

6 years agorustdoc: extend UdpSocket API doc (#657)
Frank Rehberger [Wed, 6 Sep 2017 22:54:28 +0000 (00:54 +0200)]
rustdoc: extend UdpSocket API doc (#657)

rustdoc: type-fixes

6 years agoAuto merge of #44498 - alexcrichton:fix-nightlies, r=alexcrichton
bors [Mon, 11 Sep 2017 22:49:20 +0000 (22:49 +0000)]
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

6 years agoAuto merge of #44442 - Aaron1011:promote-static-ref, r=eddyb
bors [Mon, 11 Sep 2017 20:02:19 +0000 (20:02 +0000)]
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

6 years agorustbuild: Fix a distribution bug with rustdoc
Alex Crichton [Mon, 11 Sep 2017 18:01:48 +0000 (11:01 -0700)]
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

6 years agoAdd doc example to str::from_boxed_utf8_unchecked
Tommy Ip [Mon, 11 Sep 2017 16:28:28 +0000 (17:28 +0100)]
Add doc example to str::from_boxed_utf8_unchecked

Fixes #44463.

6 years agoupdate mdbook
steveklabnik [Mon, 11 Sep 2017 15:55:07 +0000 (11:55 -0400)]
update mdbook

6 years agoAuto merge of #44435 - alexcrichton:in-scope, r=michaelwoerister
bors [Mon, 11 Sep 2017 15:35:35 +0000 (15:35 +0000)]
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

6 years agorustc: Remove HirId from queries
Alex Crichton [Fri, 8 Sep 2017 20:51:57 +0000 (13:51 -0700)]
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

6 years agoUpdate comment to properly describe static promotion restrictions
Aaron Hill [Mon, 11 Sep 2017 14:51:28 +0000 (10:51 -0400)]
Update comment to properly describe static promotion restrictions

6 years agoAuto merge of #44440 - cuviper:min_global_align, r=japaric
bors [Mon, 11 Sep 2017 12:53:21 +0000 (12:53 +0000)]
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

6 years agoAuto merge of #44410 - alexcrichton:fix-travis, r=Mark-Simulacrum
bors [Mon, 11 Sep 2017 09:47:06 +0000 (09:47 +0000)]
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.

6 years agoAuto merge of #44385 - alexcrichton:new-sccache-keys, r=alexcrichton
bors [Mon, 11 Sep 2017 07:18:27 +0000 (07:18 +0000)]
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!

6 years agoRemoved trailing whitespace
42triangles [Mon, 11 Sep 2017 06:28:14 +0000 (08:28 +0200)]
Removed trailing whitespace

6 years agoAdded an example for `std::str::into_boxed_bytes()`
42triangles [Mon, 11 Sep 2017 06:13:57 +0000 (08:13 +0200)]
Added an example for `std::str::into_boxed_bytes()`

6 years agorustc: use ConstVal::Unevaluated instead of mir::Literal::Item.
Eduard-Mihai Burtescu [Sun, 3 Sep 2017 17:34:48 +0000 (20:34 +0300)]
rustc: use ConstVal::Unevaluated instead of mir::Literal::Item.

6 years agorustc: evaluate fixed-length array length expressions lazily.
Eduard-Mihai Burtescu [Mon, 7 Aug 2017 05:08:53 +0000 (08:08 +0300)]
rustc: evaluate fixed-length array length expressions lazily.

6 years agorustc: remove obsolete const_val::ErrKind::{Negate,Not}On.
Eduard-Mihai Burtescu [Tue, 15 Aug 2017 15:35:31 +0000 (18:35 +0300)]
rustc: remove obsolete const_val::ErrKind::{Negate,Not}On.

6 years agorustc: use ty::Const for the length of TyArray.
Eduard-Mihai Burtescu [Sat, 5 Aug 2017 13:11:24 +0000 (16:11 +0300)]
rustc: use ty::Const for the length of TyArray.

6 years agorustc: replace usize with u64 and ConstUsize.
Eduard-Mihai Burtescu [Sat, 5 Aug 2017 09:27:28 +0000 (12:27 +0300)]
rustc: replace usize with u64 and ConstUsize.

6 years agorustc: introduce ty::Const { ConstVal, Ty }.
Eduard-Mihai Burtescu [Fri, 4 Aug 2017 08:25:13 +0000 (11:25 +0300)]
rustc: introduce ty::Const { ConstVal, Ty }.

6 years agorustc: intern ConstVal's in TyCtxt.
Eduard-Mihai Burtescu [Thu, 3 Aug 2017 21:41:44 +0000 (00:41 +0300)]
rustc: intern ConstVal's in TyCtxt.

6 years agoAuto merge of #44383 - qmx:gh/40473/no-inline-trait-method, r=nikomatsakis
bors [Mon, 11 Sep 2017 04:59:28 +0000 (04:59 +0000)]
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.

6 years agoAuto merge of #44375 - topecongiro:macrodef-span, r=petrochenkov
bors [Mon, 11 Sep 2017 02:23:24 +0000 (02:23 +0000)]
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

6 years agoAuto merge of #44316 - eddyb:no-local-var-def-id, r=michaelwoerister
bors [Sun, 10 Sep 2017 21:55:43 +0000 (21:55 +0000)]
Auto merge of #44316 - eddyb:no-local-var-def-id, r=michaelwoerister

Use NodeId/HirId instead of DefId for local variables.

r? @michaelwoerister

6 years agoimplement unsafe pointer methods
Alexis Beingessner [Thu, 17 Aug 2017 21:45:01 +0000 (17:45 -0400)]
implement unsafe pointer methods

6 years agoAuto merge of #44220 - kennytm:fix-44216-instance-plus-max-duration-should-panic...
bors [Sun, 10 Sep 2017 18:37:27 +0000 (18:37 +0000)]
Auto merge of #44220 - kennytm:fix-44216-instance-plus-max-duration-should-panic, r=alexcrichton

Properly detect overflow in Instance ± Duration.

Fix #44216.
Fix #42622

The computation `Instant::now() + Duration::from_secs(u64::max_value())` now panics. The call `receiver.recv_timeout(Duration::from_secs(u64::max_value()))`, which involves such time addition, will also panic.

The reason #44216 arises is because of an unchecked cast from `u64` to `i64`, making the duration equivalent to -1 second.

Note that the current implementation is over-conservative, since e.g. (-2⁶²) + (2⁶³) is perfectly fine for an `i64`, yet this is rejected because (2⁶³) overflows the `i64`.

6 years agoAdd doc examples to str::from_utf8_unchecked_mut
Ethan Dagner [Sun, 10 Sep 2017 18:27:57 +0000 (12:27 -0600)]
Add doc examples to str::from_utf8_unchecked_mut

Fixes #44461

6 years agoAutodetect the type of allocator crate used
Michal 'vorner' Vaner [Sun, 10 Sep 2017 17:59:42 +0000 (19:59 +0200)]
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.

6 years agoAdd explanations for undocumented labels
Carol (Nichols || Goulding) [Sun, 10 Sep 2017 17:31:08 +0000 (13:31 -0400)]
Add explanations for undocumented labels

6 years agoAlphabetize current label explanations
Carol (Nichols || Goulding) [Sun, 10 Sep 2017 17:21:37 +0000 (13:21 -0400)]
Alphabetize current label explanations

So that you can scroll down the list of labels along with these
explanations.

6 years agoParse nested closure with two consecutive parameter lists properly
Wonwoo Choi [Thu, 7 Sep 2017 06:07:49 +0000 (15:07 +0900)]
Parse nested closure with two consecutive parameter lists properly

6 years agoAuto merge of #44079 - gaurikholkar:named_conf, r=nikomatsakis
bors [Sun, 10 Sep 2017 15:32:20 +0000 (15:32 +0000)]
Auto merge of #44079 - gaurikholkar:named_conf, r=nikomatsakis

Extend E0623 for LateBound and EarlyBound Regions

This is a fix for #43882
```
fn foo<'a,'b>(x: &mut Vec<&'a u8>, y: &'b u8) {
    x.push(y);
}
```
now gives

```
error[E0623]: lifetime mismatch
  --> $DIR/ex3-both-anon-regions-latebound-regions.rs:12:12
   |
11 | fn foo<'a,'b>(x: &mut Vec<&'a u8>, y: &'b u8) {
   |                           ------      ------ these two types are declared with different lifetimes...
12 |     x.push(y);
   |            ^ ...but data from `y` flows into `x` here
```
cc @nikomatsakis @arielb1

Please ignore the second commit. It will be merged in a separate PR.

6 years agoActually fix the trailing whitespace
smt923 [Sun, 10 Sep 2017 13:25:23 +0000 (14:25 +0100)]
Actually fix the trailing whitespace

6 years agoFix markdown link for Utf8Error
smt923 [Sun, 10 Sep 2017 13:12:23 +0000 (14:12 +0100)]
Fix markdown link for Utf8Error

6 years agoAdd doc example to String::as_mut_str
Tommy Ip [Sat, 9 Sep 2017 12:08:26 +0000 (13:08 +0100)]
Add doc example to String::as_mut_str

Fixes #44429.

6 years agoFix trailing whitespace
smt923 [Sun, 10 Sep 2017 13:08:20 +0000 (14:08 +0100)]
Fix trailing whitespace

6 years agoAuto merge of #44474 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Sun, 10 Sep 2017 12:48:55 +0000 (12:48 +0000)]
Auto merge of #44474 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 13 pull requests

- Successful merges: #44262, #44329, #44332, #44347, #44372, #44384, #44387, #44396, #44449, #44451, #44457, #44464, #44467
- Failed merges:

6 years agoRollup merge of #44467 - toidiu:ak-44382, r=frewsxcv
Guillaume Gomez [Sun, 10 Sep 2017 12:03:32 +0000 (14:03 +0200)]
Rollup merge of #44467 - toidiu:ak-44382, r=frewsxcv

documentation update to demonstrate mutability

#44467

- demonstrate correct implementation returns `Some`
- demonstrate out of bounds returns `None`
- demonstrate mutability

6 years agoRollup merge of #44464 - Dushistov:master, r=alexcrichton
Guillaume Gomez [Sun, 10 Sep 2017 12:03:31 +0000 (14:03 +0200)]
Rollup merge of #44464 - Dushistov:master, r=alexcrichton

add test for #41229

Closes #41229

6 years agoRollup merge of #44457 - napen123:master, r=frewsxcv
Guillaume Gomez [Sun, 10 Sep 2017 12:03:30 +0000 (14:03 +0200)]
Rollup merge of #44457 - napen123:master, r=frewsxcv

Add doc examples for str::as_bytes_mut

Fixes #44427

6 years agoRollup merge of #44451 - Zoxc:gen-panic, r=eddyb
Guillaume Gomez [Sun, 10 Sep 2017 12:03:29 +0000 (14:03 +0200)]
Rollup merge of #44451 - Zoxc:gen-panic, r=eddyb

Fix bitrotted generator panic emission

r? @eddyb

6 years agoRollup merge of #44449 - tommyip:doc_string_as_str, r=frewsxcv
Guillaume Gomez [Sun, 10 Sep 2017 12:03:28 +0000 (14:03 +0200)]
Rollup merge of #44449 - tommyip:doc_string_as_str, r=frewsxcv

Add doc example to String::as_str

Fixes #44428.

6 years agoRollup merge of #44396 - joshlf:tls-comment, r=alexcrichton
Guillaume Gomez [Sun, 10 Sep 2017 12:03:27 +0000 (14:03 +0200)]
Rollup merge of #44396 - joshlf:tls-comment, r=alexcrichton

std::thread::LocalKey: Document limitation with initializers

Document that if a `LocalKey`'s initializer recursively depends on itself, initialization will result in infinite recursion.

6 years agoRollup merge of #44387 - est31:update_compiler_builtins, r=Mark-Simulacrum
Guillaume Gomez [Sun, 10 Sep 2017 12:03:26 +0000 (14:03 +0200)]
Rollup merge of #44387 - est31:update_compiler_builtins, r=Mark-Simulacrum

Update the libcompiler_builins submodule

Pulls in https://github.com/rust-lang-nursery/compiler-builtins/pull/187 for nicer build output :)

6 years agoRollup merge of #44384 - alexcrichton:osx-segfault, r=estebank
Guillaume Gomez [Sun, 10 Sep 2017 12:03:25 +0000 (14:03 +0200)]
Rollup merge of #44384 - alexcrichton:osx-segfault, r=estebank

std: Fix a segfault on OSX with backtraces

Apparently `dladdr` can succeed but still give you NULL pointers!

Closes #44379

6 years agoRollup merge of #44372 - bgermann:master, r=alexcrichton
Guillaume Gomez [Sun, 10 Sep 2017 12:03:24 +0000 (14:03 +0200)]
Rollup merge of #44372 - bgermann:master, r=alexcrichton

Use memalign instead of posix_memalign for Solaris

As pointed out in https://github.com/rust-lang/libc/commit/deb61c8,
Solaris 10 does not support posix_memalign.
Use memalign for all Solaris versions instead.
With this change applied I am able to cross-build rustc for Solaris 10.

6 years agoRollup merge of #44347 - GuillaumeGomez:rustdoc-false-positive, r=QuietMisdreavus
Guillaume Gomez [Sun, 10 Sep 2017 12:03:23 +0000 (14:03 +0200)]
Rollup merge of #44347 - GuillaumeGomez:rustdoc-false-positive, r=QuietMisdreavus

Reduce false positives number in rustdoc html diff

cc @rust-lang/dev-tools
r? @nrc

Very simple trick but should lighten html diff a bit

6 years agoRollup merge of #44332 - tirr-c:issue-44021, r=petrochenkov
Guillaume Gomez [Sun, 10 Sep 2017 12:03:22 +0000 (14:03 +0200)]
Rollup merge of #44332 - tirr-c:issue-44021, r=petrochenkov

Expect pipe symbol after closure parameter list

Fixes #44021.

---

Originally, the parser just called `bump` to discard following token after parsing closure parameter list, because it assumes `|` is following. However, the following code breaks the assumption:

```rust
struct MyStruct;
impl MyStruct {
   fn f() {|x, y}
}
```

Here, the parameter list is `x, y` and the following token is `}`. The parser discards `}`, and then we have a curly bracket mismatch.

Indeed, this code has a syntax error. On current nightly, the compiler emits an syntax error, but with incorrect message and span, followed by an ICE.

```
error: expected expression, found `}`
 --> 44021.rs:4:1
  |
4 | }
  | ^

error: internal compiler error: unexpected panic
```

Even worse, on current stable(1.20.0), the compiler falls into an infinite loop.

This pull request fixes this problem. Now the compiler emits correct error message and span, and does not ICE.

```
error: expected one of `:`, `@`, or `|`, found `}`
 --> 44021.rs:3:20
  |
3 |     fn foo() {|x, y}
  |                    ^ expected one of `:`, `@`, or `|` here
```

6 years agoRollup merge of #44329 - nrc:pulldown-warn-fix, r=ollie27
Guillaume Gomez [Sun, 10 Sep 2017 12:03:21 +0000 (14:03 +0200)]
Rollup merge of #44329 - nrc:pulldown-warn-fix, r=ollie27

Fixup some nits from #44238

r? @ollie27

6 years agoRollup merge of #44262 - alexcrichton:repr-128-gate, r=nikomatsakis
Guillaume Gomez [Sun, 10 Sep 2017 12:03:20 +0000 (14:03 +0200)]
Rollup merge of #44262 - alexcrichton:repr-128-gate, r=nikomatsakis

rustc: Separately feature gate repr(i128)

Brought up during the discussion of #35118, the support for this is still
somewhat buggy and so stabilization likely wants to be considered independently
of the type itself.

6 years agoAuto merge of #44312 - eddyb:static-by-any-other-name, r=alexcrichton
bors [Sun, 10 Sep 2017 10:09:47 +0000 (10:09 +0000)]
Auto merge of #44312 - eddyb:static-by-any-other-name, r=alexcrichton

Use rvalue promotion to 'static instead of static items.

Fixes #44240. Among other things, in crates that do a lot of formatting, this could reduce the number of items, although I haven't measured the performance benefits. If there's a codegen slowdown, that should IMO be solved by caching the output of miri, *not* by using `static`.

r? @alexcrichton

6 years agofix "correct" case in diagnostic error message
Niko Matsakis [Sun, 10 Sep 2017 10:08:29 +0000 (06:08 -0400)]
fix "correct" case in diagnostic error message

6 years agoUse rvalue promotion to 'static instead of static items.
Eduard-Mihai Burtescu [Mon, 4 Sep 2017 10:23:49 +0000 (13:23 +0300)]
Use rvalue promotion to 'static instead of static items.

6 years agoAuto merge of #44418 - alexcrichton:remove-dep-graph, r=michaelwoerister
bors [Sun, 10 Sep 2017 07:33:46 +0000 (07:33 +0000)]
Auto merge of #44418 - alexcrichton:remove-dep-graph, r=michaelwoerister

rustc: Remove `DepGraph` handling from rustc_metadata

This should now be entirely tracked through queries, so no need to have a
`DepGraph` in the `CStore` object any more!

cc #44390

6 years agoAuto merge of #44260 - alexcrichton:hardlink-no-copy, r=Mark-Simulacrum
bors [Sun, 10 Sep 2017 04:36:15 +0000 (04:36 +0000)]
Auto merge of #44260 - alexcrichton:hardlink-no-copy, r=Mark-Simulacrum

rustbuild: Switch back to using hard links

The `copy` function historically in rustbuild used hard links to speed up the
copy operations that it does. This logic was backed out, however, in #39518 due
to a bug that only showed up on Windows, described in #39504. The cause
described in #39504 happened because Cargo, on a fresh build, would overwrite
the previous artifacts with new hard links that Cargo itself manages.

This behavior in Cargo was fixed in rust-lang/cargo#4390 where it no longer
should overwrite files on fresh builds, opportunistically leaving the filesystem
intact and not touching it.

Hopefully this can help speed up local builds by doing fewer copies all over the
place!

6 years agoRelaxed error pattern, and add test for SystemTime as well.
kennytm [Sat, 9 Sep 2017 17:48:43 +0000 (01:48 +0800)]
Relaxed error pattern, and add test for SystemTime as well.

6 years agorustbuild: Switch back to using hard links
Alex Crichton [Sat, 2 Sep 2017 03:46:51 +0000 (20:46 -0700)]
rustbuild: Switch back to using hard links

The `copy` function historically in rustbuild used hard links to speed up the
copy operations that it does. This logic was backed out, however, in #39518 due
to a bug that only showed up on Windows, described in #39504. The cause
described in #39504 happened because Cargo, on a fresh build, would overwrite
the previous artifacts with new hard links that Cargo itself manages.

This behavior in Cargo was fixed in rust-lang/cargo#4390 where it no longer
should overwrite files on fresh builds, opportunistically leaving the filesystem
intact and not touching it.

Hopefully this can help speed up local builds by doing fewer copies all over the
place!

6 years agorustc: Remove `DepGraph` handling from rustc_metadata
Alex Crichton [Thu, 7 Sep 2017 19:35:21 +0000 (12:35 -0700)]
rustc: Remove `DepGraph` handling from rustc_metadata

This should now be entirely tracked through queries, so no need to have a
`DepGraph` in the `CStore` object any more!

6 years agoFix incorrect markdown title
smt923 [Sun, 10 Sep 2017 03:33:24 +0000 (04:33 +0100)]
Fix incorrect markdown title

6 years agoAdded short examples for 'str::from_utf8_mut'
smt923 [Sun, 10 Sep 2017 03:10:19 +0000 (04:10 +0100)]
Added short examples for 'str::from_utf8_mut'

6 years agoAuto merge of #44274 - Mark-Simulacrum:rustdoc-tests, r=alexcrichton
bors [Sun, 10 Sep 2017 01:24:14 +0000 (01:24 +0000)]
Auto merge of #44274 - Mark-Simulacrum:rustdoc-tests, r=alexcrichton

Test rustdoc.

Also fixes the broken tests.

r? @alexcrichton

6 years agodocumentation update to demonstrate mutability
toidiu [Sat, 9 Sep 2017 20:56:12 +0000 (16:56 -0400)]
documentation update to demonstrate mutability

6 years agoadd test for #41229
Evgeniy A. Dushistov [Sat, 9 Sep 2017 20:12:41 +0000 (23:12 +0300)]
add test for #41229

Closes #41229

6 years agoDon't promote references to statics that occur in non-static locations
Aaron Hill [Sat, 9 Sep 2017 20:01:45 +0000 (16:01 -0400)]
Don't promote references to statics that occur in non-static locations

6 years agoRotate Travis/AppVeyor S3 keys
Alex Crichton [Thu, 7 Sep 2017 05:47:56 +0000 (22:47 -0700)]
Rotate Travis/AppVeyor S3 keys

Haven't done this in awhile so seems like a good idea!

6 years agoAuto merge of #44251 - kennytm:osx-backtrace, r=alexcrichton
bors [Sat, 9 Sep 2017 17:32:13 +0000 (17:32 +0000)]
Auto merge of #44251 - kennytm:osx-backtrace, r=alexcrichton

Add libbacktrace support for Apple platforms (resubmitted)

Resubmitting #43422 rebased on the current master (cc @JohnColanduoni).

I have added an additional commit to fallback to `dladdr`-based `resolve_symbol` if `libbacktrace` returns `None`, otherwise the stack trace will be full of `<unknown>` when you forget to pass the `-g` flag (actually it seems — at least on macOS — the `dladdr` symbol is more accurate than the `libbacktrace` one).

6 years agoAdd doc examples for str::as_bytes_mut
Ethan Dagner [Sat, 9 Sep 2017 16:27:47 +0000 (10:27 -0600)]
Add doc examples for str::as_bytes_mut

Fixes #44427

6 years agoStabilize drop_types_in_const.
Eduard-Mihai Burtescu [Sat, 2 Sep 2017 07:35:01 +0000 (10:35 +0300)]
Stabilize drop_types_in_const.

6 years agoAuto merge of #44212 - eddyb:drop-const, r=nikomatsakis
bors [Sat, 9 Sep 2017 11:48:57 +0000 (11:48 +0000)]
Auto merge of #44212 - eddyb:drop-const, r=nikomatsakis

Allow Drop types in const's too, with #![feature(drop_types_in_const)].

Implements the remaining amendment, see #33156. cc @SergioBenitez

r? @nikomatsakis

6 years agoAuto merge of #44438 - Xaeroxe:clamp, r=Mark-Simulacrum
bors [Sat, 9 Sep 2017 09:13:03 +0000 (09:13 +0000)]
Auto merge of #44438 - Xaeroxe:clamp, r=Mark-Simulacrum

Revert clamp

Revert clamp per https://github.com/rust-lang/rust/issues/44095#issuecomment-328218316 while we take time to assess the potential backwards compatibility damage done by it.

6 years agoFix bitrotted generator panic emission
John Kåre Alsaker [Sat, 9 Sep 2017 09:11:13 +0000 (11:11 +0200)]
Fix bitrotted generator panic emission

6 years agoAdd `impl From<Vec<Span>> for MultiSpan`.
Sergio Benitez [Sat, 9 Sep 2017 09:07:31 +0000 (02:07 -0700)]
Add `impl From<Vec<Span>> for MultiSpan`.

6 years agoAdd doc example to String::as_str
Tommy Ip [Sat, 9 Sep 2017 08:05:54 +0000 (09:05 +0100)]
Add doc example to String::as_str

Fixes #44428.

6 years agoAuto merge of #44335 - arielb1:node-hashing, r=alexcrichton
bors [Sat, 9 Sep 2017 05:58:13 +0000 (05:58 +0000)]
Auto merge of #44335 - arielb1:node-hashing, r=alexcrichton

Avoid hashing when creating a DepNode from a HirId

Instead, combine the already-present DefPathHash with the 32-bit
ItemLocalIndex.

Should fix #44323.

r? @alexcrichton

6 years agoadding E0623 for LateBound regions
gaurikholkar [Fri, 25 Aug 2017 06:21:22 +0000 (11:51 +0530)]
adding E0623 for LateBound regions

6 years agoAdd feature gate to doctests.
J. Cliff Dyer [Fri, 8 Sep 2017 21:20:31 +0000 (17:20 -0400)]
Add feature gate to doctests.

6 years agoFix regression in promotion of rvalues referencing a static
Aaron Hill [Sat, 9 Sep 2017 00:22:50 +0000 (20:22 -0400)]
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

6 years agoAuto merge of #44269 - nikomatsakis:issue-43613-limit-cache-obligations, r=arielb1
bors [Fri, 8 Sep 2017 23:47:16 +0000 (23:47 +0000)]
Auto merge of #44269 - nikomatsakis:issue-43613-limit-cache-obligations, r=arielb1

limit and clear cache obligations opportunistically

Keeping **all** the obligations for every projection is wasteful of
memory and compilation time. We only really care about those
subobligations that may inform the result of the projection (i.e., may
help to resolve any inference variables that appear within).
Therefore, we can clear the subobligations from the cache that don't
potentially affect the result of the projection. On every cache hit,
we also take the opportunity to check if the type variables have been
resolved *yet* and, if so, clear out the pending obligations.

Fixes #43613.

r? @arielb1

NB -- not sure how to test for this. Probably we should add the #43613 test case to perf.

6 years agoAdd a test for `min_global_align`
Josh Stone [Fri, 8 Sep 2017 22:55:28 +0000 (15:55 -0700)]
Add a test for `min_global_align`

6 years agoRevert "Add clamp functions"
Jacob Kiesel [Fri, 8 Sep 2017 22:07:21 +0000 (16:07 -0600)]
Revert "Add clamp functions"

This reverts commit c589f867f89d4e6e48c6602aed8e878208d4822f.

6 years agoRevert "Add NAN examples"
Jacob Kiesel [Fri, 8 Sep 2017 22:07:19 +0000 (16:07 -0600)]
Revert "Add NAN examples"

This reverts commit f74c5d2e18e50c24de2cc1192bf2088cdaa61916.

6 years agoRevert "Fix f32 examples."
Jacob Kiesel [Fri, 8 Sep 2017 22:07:17 +0000 (16:07 -0600)]
Revert "Fix f32 examples."

This reverts commit 61f20f8df02e53ee60dc1719ce0e502eecebf8b4.

6 years agoRevert "Fix f64 examples"
Jacob Kiesel [Fri, 8 Sep 2017 22:07:15 +0000 (16:07 -0600)]
Revert "Fix f64 examples"

This reverts commit 576426a05a1a6cb33eece7082d7341b7c6bb5277.

6 years agoRevert "Fix documentation and formatting."
Jacob Kiesel [Fri, 8 Sep 2017 22:07:13 +0000 (16:07 -0600)]
Revert "Fix documentation and formatting."

This reverts commit 2e34ff767113c6a15c5862b0646ca9ad7ffd81b1.

6 years agoRevert "Add panic unit tests"
Jacob Kiesel [Fri, 8 Sep 2017 22:07:09 +0000 (16:07 -0600)]
Revert "Add panic unit tests"

This reverts commit b762283e57ff71f6763effb9cfc7fc0c7967b6b0.

6 years agoAdd `TargetOptions::min_global_align`, with s390x at 16-bit
Josh Stone [Fri, 8 Sep 2017 21:49:51 +0000 (14:49 -0700)]
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.

6 years agoUse NodeId/HirId instead of DefId for local variables.
Eduard-Mihai Burtescu [Sat, 29 Apr 2017 11:39:47 +0000 (14:39 +0300)]
Use NodeId/HirId instead of DefId for local variables.

6 years agosimplify
Douglas Campos [Fri, 8 Sep 2017 15:06:28 +0000 (11:06 -0400)]
simplify

6 years agoUpdate liblibc submodule to include latest uclibc changes
Tobias Schaffner [Fri, 8 Sep 2017 12:34:10 +0000 (14:34 +0200)]
Update liblibc submodule to include latest uclibc changes

6 years agoMove the stack size value for L4Re to the min_stack_size function
Sebastian Humenda [Thu, 7 Sep 2017 19:04:24 +0000 (21:04 +0200)]
Move the stack size value for L4Re to the min_stack_size function

6 years agoRe-enable networking module fo rL4Re
Sebastian Humenda [Wed, 6 Sep 2017 14:01:51 +0000 (16:01 +0200)]
Re-enable networking module fo rL4Re

As suggested in the discussion of PR #43972, std should provide a uniform API to
all platforms. Since there's no networking on L4Re, this now is a module in
`sys::net` providing types and functions/methods returning an error for each
action.

6 years agoAdd modifications needed for L4re in libstd
Tobias Schaffner [Fri, 18 Aug 2017 09:50:20 +0000 (11:50 +0200)]
Add modifications needed for L4re in libstd

This commit adds the needed modifications to compile the std crate
for the L4 Runtime environment (L4Re).

A target for the L4Re was introduced in commit:
c151220a84e40b65e45308cc0f3bbea4466d3acf

In many aspects implementations for linux also apply for the L4Re
microkernel.

Two uncommon characteristics had to be resolved:
* L4Re has no network funktionality
* L4Re has a maximum stacksize of 1Mb for threads

Co-authored-by: Sebastian Humenda <sebastian.humenda@tu-dresden.de>
6 years agoMatch c_char definitions and enable signal reset for L4Re
Sebastian Humenda [Thu, 17 Aug 2017 11:23:00 +0000 (13:23 +0200)]
Match c_char definitions and enable signal reset for L4Re

*   Match definition of c_char in os/raw.rs with the libc definition

    Due to historic reasons, os/raw.rs redefines types for c_char from
    libc, but these didn't match. Now they do :).

*   Enable signal reset on exec for L4Re

    L4Re has full signal emulation and hence it needs to reset the
    signal set of the child with sigemptyset. However, gid and uid
    should *not* be set.

6 years agoMove the man directory to a subdirectory
est31 [Fri, 8 Sep 2017 10:37:39 +0000 (12:37 +0200)]
Move the man directory to a subdirectory

There is no reason it should be in the top directory.

6 years agoAuto merge of #44142 - alexcrichton:dllimport-query, r=nikomatsakis
bors [Fri, 8 Sep 2017 09:47:58 +0000 (09:47 +0000)]
Auto merge of #44142 - alexcrichton:dllimport-query, r=nikomatsakis

Migrate a slew of metadata methods to queries

This PR intends to make more progress on #41417, knocking off some low-hanging fruit.

Closes #44190
cc #44137

6 years agoAuto merge of #43742 - epdtry:pprust-expr-fix, r=petrochenkov
bors [Fri, 8 Sep 2017 06:56:09 +0000 (06:56 +0000)]
Auto merge of #43742 - epdtry:pprust-expr-fix, r=petrochenkov

pprust: fix parenthesization of exprs

The pretty printer in `syntax::print::pprust` currently relies on the presence of `ExprKind::Paren` hints in order to correctly parenthesize expressions in its output.  If `Paren` nodes are missing, it sometimes produces wrong output, such as printing `1 - (2 - 3)` as `1 - 2 - 3`.  This PR fixes `pprust` to correctly print expressions regardless of the presence or absence of `Paren` nodes.  This should make `pprust` easier to use with programmatically constructed ASTs.

A few notes:

 * I added a function for assigning precedence values to exprs in `syntax::util::parser`, since there is already code there for assigning precedence values to binops.  Let me know if I should move this somewhere more `pprust`-specific.

 * I also moved the `contains_exterior_struct_lit` function from `rustc_lint::unused::UnusedParens` into `syntax::util::parser`, since it's needed for determining the correct parenthesization of `if`/`while` conditional expressions.

 * I couldn't find a good way to compare two exprs for equivalence while ignoring semantically-irrelevant details like spans.  So the test for the new behavior relies on a slight hack: it adds `Paren` nodes everywhere, so that the pretty-printed version exactly reflects the structure of the AST, and then compares the printed strings.  This works, but let me know if there's a better way.

6 years agoFix sanitizer tests on buggy kernels
Alex Crichton [Thu, 7 Sep 2017 20:36:23 +0000 (13:36 -0700)]
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.

6 years agoClose doc examples and trim whitespace.
J. Cliff Dyer [Thu, 7 Sep 2017 23:06:57 +0000 (19:06 -0400)]
Close doc examples and trim whitespace.

6 years agoAuto merge of #44399 - alexcrichton:tmp-travis-downgrade, r=alexcrichton
bors [Thu, 7 Sep 2017 22:45:48 +0000 (22:45 +0000)]
Auto merge of #44399 - alexcrichton:tmp-travis-downgrade, r=alexcrichton

travis: Downgrade to previous images temporarily

Travis is in the process of [rolling out an update][update] but looks like our
tests are breaking, let's temporarily roll back to get the queue moving again.

[update]: https://blog.travis-ci.com/2017-08-29-trusty-image-updates