Commit Graph

70486 Commits

Author SHA1 Message Date
bors
5face5f4f5 Auto merge of #46292 - cramertj:update-libc, r=alexcrichton
Update libc to include latest Fuchsia fix

r? @alexcrichton

cc @smklein
2017-11-27 11:44:17 +00:00
Matthew Jasper
d64a31882f Update tests involving E0384 for mir-borrowck 2017-11-27 08:07:58 +00:00
Matthew Jasper
6853b34f0e Don't show first assignment in loops
Matches current ast-borrowck behavior.
2017-11-27 08:07:49 +00:00
Matthew Jasper
d409dbf983 Add initialization info to MoveData
* Used for new dataflow to track if a variable has every been initialized
* Used for other dataflows that need to be updated for initializations
2017-11-27 08:06:36 +00:00
bors
ea51b19dc7 Auto merge of #46286 - SimonSapin:patch-6, r=alexcrichton
Increment Nightly version to 1.24.0

The beta channel is now at 1.23.0-beta.1.
2017-11-27 07:54:39 +00:00
bors
8270faf8dc Auto merge of #46284 - SimonSapin:deprecate-formatter-flags, r=sfackler
Deprecate the Formatter::flags method, fix #46237

This fixes #46237.
2017-11-27 05:26:23 +00:00
bors
73df30d467 Auto merge of #46273 - semarie:openbsd-libc++, r=alexcrichton
make OpenBSD to use libc++ instead of (e)stdc++
2017-11-27 01:43:41 +00:00
Oliver Middleton
652a4bd26c impl From<bool> for AtomicBool 2017-11-27 01:23:04 +00:00
Taylor Cramer
9d96d77f77 Update libc to include latest Fuchsia fix 2017-11-26 17:01:15 -08:00
Simon Sapin
6c5f53e65e Stabilize const-calling existing const-fns in std
Fixes #46038
2017-11-26 23:43:44 +01:00
Simon Sapin
ef7cd00c8e
Increment Nightly version to 1.24.0
The beta channel is now at 1.23.0-beta.1.
2017-11-26 23:04:40 +01:00
Simon Sapin
a326d8d1ba Document non-obvious behavior of fmt::UpperHex & co for negative integers
Before stabilization I’d have suggested changing the behavior,
but that time is past.
2017-11-26 22:53:03 +01:00
Simon Sapin
5e11c8fc2b Deprecate the Formatter::flags method, fix #46237 2017-11-26 22:45:28 +01:00
bors
9015b142b4 Auto merge of #46168 - durka:macro-backtrace, r=durka
mention nightly in -Z external-macro-backtrace note

Fix #46167 by mentioning that you need nightly in the message that tells you to pass `-Z external-macro-backtrace`.

Rationale:

1. The reason for having this message is to increase discoverability of the functionality. If the message is only shown on nightly it's less disoverable.
2. The same approach is taken if you call a const fn in const context without its feature gate (previously, if you called it without `#![feature(const_fn)]`).

cc @kennytm
2017-11-26 21:30:28 +00:00
Esteban Küber
0b2d21e32b Make impl-trait ciclical reference error point to def_span 2017-11-26 12:35:19 -08:00
Esteban Küber
aabb604313 Move "auto trait leak" impl-trait cycle dependency test to ui 2017-11-26 12:32:30 -08:00
bors
827cb0d61e Auto merge of #46106 - est31:master, r=nikomatsakis
Add a MIR-borrowck-only output mode

Removes the `-Z borrowck-mir` flag in favour of a `-Z borrowck=mode` flag where mode can be `mir`, `ast`, or `compare`.

* The `ast` mode represents the current default, passing `-Z borrowck=ast` is equivalent to not passing it at all.
* The `compare` mode outputs both the output of the MIR borrow checker and the AST borrow checker, each error with `(Ast)` and `(Mir)` appended. This mode has the same behaviour as `-Z borrowck-mir` had before this commit.
* The `mir` mode only outputs the results of the MIR borrow checker, while suppressing the errors of the ast borrow checker

The PR also updates the tests to use the new flags.

closes  #46097
2017-11-26 19:03:57 +00:00
Alex Burka
5da957cbc6 mention nightly in -Z external-macro-backtrace note 2017-11-26 18:28:38 +00:00
Ariel Ben-Yehuda
f3b2d7f3a7 improve error messages 2017-11-26 19:01:19 +02:00
bors
71b21ed0da Auto merge of #46253 - eddyb:return-aliasing, r=nagisa
rustc_trans: don't apply noalias on returned references.

In #45225 frozen returned `&T` were accidentally maked `noalias`, unlike `&mut T`.
Return value `noalias` is only sound for functions that return dynamic allocations, e.g. `Box`, and using it on anything else can lead to miscompilation, as LLVM assumes certain usage patterns.
Fixes #46239.
2017-11-26 16:38:36 +00:00
est31
d79179891a Use the official abbrev. 2017-11-26 16:59:47 +01:00
est31
755fa9c23e Update tests for -Zborrowck-mir -> -Zborrowck=mode migration 2017-11-26 16:39:15 +01:00
est31
c9af68e90c Replace -Zborrowck-mir with -Zborrowck=mode
where mode is one of {ast,mir,compare}.

This commit only implements the functionality.
The tests will be updated in a follow up commit.
2017-11-26 16:36:52 +01:00
colinmarsh19
096e698e4e
Changed to correct quotes 2017-11-26 07:40:29 -07:00
colinmarsh19
f6b80d4164
Added .rs extension 2017-11-26 07:36:56 -07:00
Ariel Ben-Yehuda
47d53e8d78 mark rustfmt as broken
There's a trailing whitespace problem in one of the tests. @nrc said
he'll go fix it quickly, but until then I'll like to land this PR.

I suspect this happened because one of the dependencies in the
Cargo.lock I updated had changed the format of the XML they emit, but
that has to be investigated.
2017-11-26 16:12:43 +02:00
Ariel Ben-Yehuda
7dbbbf6607 fix NetBSD 2017-11-26 16:12:43 +02:00
Ariel Ben-Yehuda
617b413e18 limit packed copy-out to non-generic Copy structs 2017-11-26 16:12:43 +02:00
Ariel Ben-Yehuda
dee8a71cd5 fix #[derive] implementation for repr(packed) structs
Fix the derive implementation for repr(packed) structs to move the
fields out instead of calling functions on references to each subfield.

That's it, `#[derive(PartialEq)]` on a packed struct now does:
```Rust
fn eq(&self, other: &Self) {
    let field_0 = self.0;
    let other_field_0 = other.0;
    &field_0 == &other_field_0
}
```

Instead of
```Rust
fn eq(&self, other: &Self) {
    let ref field_0 = self.0;
    let ref other_field_0 = other.0;
    &*field_0 == &*other_field_0
}
```

Taking (unaligned) references to each subfield is undefined, unsound and
is an error with MIR effectck, so it had to be prevented. This causes
a borrowck error when a `repr(packed)` struct has a non-Copy field (and
therefore is a [breaking-change]), but I don't see a sound way to avoid
that error.
2017-11-26 16:12:43 +02:00
Ariel Ben-Yehuda
1a2d443f55 make accessing packed fields a future-compat warning 2017-11-26 16:12:42 +02:00
Ariel Ben-Yehuda
06eb5a6645 fix codegen of drops of fields of packed structs 2017-11-26 16:12:42 +02:00
Ariel Ben-Yehuda
3801c0594c update Cargo.lock & rustdoc
This is required because the old version depended on tendril 0.3.1,
which used `repr(packed)` incorrectly - see
https://github.com/kuchiki-rs/kuchiki/pull/38
2017-11-26 16:12:42 +02:00
Ariel Ben-Yehuda
bdb72edb5c make accesses to fields of packed structs unsafe
To handle packed structs with destructors (which you'll think are a rare
case, but the `#[repr(packed)] struct Packed<T>(T);` pattern is
ever-popular, which requires handling packed structs with destructors to
avoid monomorphization-time errors), drops of subfields of packed
structs should drop a local move of the field instead of the original
one.

cc #27060 - this should deal with that issue after codegen of drop glue
is updated.

The new errors need to be changed to future-compatibility warnings, but
I'll rather do a crater run first with them as errors to assess the
impact.
2017-11-26 16:12:42 +02:00
Ariel Ben-Yehuda
c48650ec25 fix treatment of local types in "remote coherence" mode 2017-11-26 16:12:42 +02:00
Ritiek Malhotra
1be38e0316 MIR: Fix value moved diagnose messages
MIR: adopt borrowck test

Fix trailing whitespace

span_bug! on unexpected action

Make RegionVid use newtype_index!

Closes #45843

Check rvalue aggregates during check_stmt in tycheck, add initial, (not passing) test

Fix failing test

Remove attributes and test comments accidentally left behind, add in span_mirbugs

Normalize LvalueTy for ops and format code to satisfy tidy check

only normalize operand types when in an ADT constructor

avoid early return

handle the active field index in unions

normalize types in ADT constructor

Fixes #45940

Fix borrowck compiler errors for upvars contain "spurious" dereferences

Fixes #46003

added associated function Box::leak

Box::leak - improve documentation

Box::leak - fixed bug in documentation

Box::leak - relaxed constraints wrt. lifetimes

Box::leak - updated documentation

Box::leak - made an oops, fixed now =)

Box::leak: update unstable issue number (46179).

Add test for #44953

Add missing Debug impls to std_unicode

Also adds #![deny(missing_debug_implementations)] so they don't get
missed again.

Amend RELEASES for 1.22.1

and fix the date for 1.22.0

Rename param in `[T]::swap_with_slice` from `src` to `other`.

The idea of ‘source’ and ‘destination’ aren’t very applicable for this
operation since both slices can both be considered sources and
destinations.

Clarify stdin behavior of `Command::output`.

Fixes #44929.

Add hints for the case of confusing enum with its variants

Add failing testcases

Add module population and case of enum in place of expression

Use for_each_child_stable in find_module

Use multiline text for crate conflict diagnostics

Make float::from_bits transmute (and update the documentation to reflect this).

The current implementation/documentation was made to avoid sNaN because of
potential safety issues implied by old/bad LLVM documentation. These issues
aren't real, so we can just make the implementation transmute (as permitted
by the existing documentation of this method).

Also the documentation didn't actually match the behaviour: it said we may
change sNaNs, but in fact we canonicalized *all* NaNs.

Also an example in the documentation was wrong: it said we *always* change
sNaNs, when the documentation was explicitly written to indicate it was
implementation-defined.

This makes to_bits and from_bits perfectly roundtrip cross-platform, except
for one caveat: although the 2008 edition of IEEE-754 specifies how to
interpet the signaling bit, earlier editions didn't. This lead to some platforms
picking the opposite interpretation, so all signaling NaNs on x86/ARM are quiet
on MIPS, and vice-versa.

NaN-boxing is a fairly important optimization, while we don't even guarantee
that float operations properly preserve signalingness. As such, this seems like
the more natural strategy to take (as opposed to trying to mangle the signaling
bit on a per-platform basis).

This implementation is also, of course, faster.

Simplify an Iterator::fold to Iterator::any

This method of once-diagnostics doesn't allow nesting

UI tests extract the regular output from the 'rendered' field in json

Merge cfail and ui tests into ui tests

Add a MIR pass to lower 128-bit operators to lang item calls

Runs only with `-Z lower_128bit_ops` since it's not hooked into targets yet.

Include tuple projections in MIR tests

Add type checking for the lang item

As part of doing so, add more lang items instead of passing u128 to the i128 ones where it doesn't matter in twos-complement.

Handle shifts properly

* The overflow-checking shift items need to take a full 128-bit type, since they need to be able to detect idiocy like `1i128 << (1u128 << 127)`
* The unchecked ones just take u32, like the `*_sh?` methods in core
* Because shift-by-anything is allowed, cast into a new local for every shift

incr.comp.: Make sure we don't lose unused green results from the query cache.

rustbuild: Update LLVM and enable ThinLTO

This commit updates LLVM to fix #45511 (https://reviews.llvm.org/D39981) and
also reenables ThinLTO for libtest now that we shouldn't hit #45768. This also
opportunistically enables ThinLTO for libstd which was previously blocked
(#45661) on test failures related to debuginfo with a presumed cause of #45511.

Closes #45511

std: Flag Windows TLS dtor symbol as #[used]

Turns out ThinLTO was internalizing this symbol and eliminating it. Worse yet if
you compiled with LTO turns out no TLS destructors would run on Windows! The
`#[used]` annotation should be a more bulletproof implementation (in the face of
LTO) of preserving this symbol all the way through in LLVM and ensuring it makes
it all the way to the linker which will take care of it.

Add enum InitializationRequiringAction

Fix tidy tests
2017-11-26 19:41:52 +05:30
bors
0400312e17 Auto merge of #46203 - nikomatsakis:type-foldable-macro, r=eddyb
introduce macros for type-foldable and lift, convert stuff to use them

A random commit from a branch I've shelved for the time being that made `TypeFoldable` stuff a bit less annoying to write.

r? @eddyb
2017-11-26 14:10:38 +00:00
David Tolnay
5d8d04ab4a
Compiletest libc dependency can be unix-only
In main.rs libc is imported as:

    #[cfg(unix)]
    extern crate libc;
2017-11-26 05:08:31 -08:00
Guillaume Gomez
0a1219809d Fix global search 2017-11-26 13:13:14 +01:00
bors
2ca00a9489 Auto merge of #46100 - KiChjang:mass-dead-check, r=nikomatsakis
Kill the storage for all locals on returning terminators

Fixes #45704.
2017-11-26 11:43:19 +00:00
bors
2c115551c4 Auto merge of #46272 - kennytm:rollup, r=kennytm
Rollup of 7 pull requests

- Successful merges: #46201, #46224, #46234, #46252, #46259, #46264, #46269
- Failed merges:
2017-11-26 09:15:06 +00:00
Sébastien Marie
3ef39d3cb6 make OpenBSD to use libc++ instead of (e)stdc++ 2017-11-26 10:08:25 +01:00
kennytm
0d664f9d80 Rollup merge of #46269 - udoprog:check-links, r=KodrAus
Check tail node in check_links
2017-11-26 15:01:40 +08:00
kennytm
1aa4dd028d Rollup merge of #46264 - scottmcm:mir-array-len, r=arielb1
InstCombine Len([_; N]) => const N in MIR

A small opportunity I noticed in passing.

Not super exciting on its own, but opens the door for a const propagation pass that could completely remove const bounds checks from arrays at MIR time, for example.
2017-11-26 15:01:39 +08:00
kennytm
788fed8158 Rollup merge of #46259 - bjorn3:display_lang_item, r=nagisa
Derive Debug for LangItem
2017-11-26 15:01:38 +08:00
kennytm
f95011bd0e Rollup merge of #46252 - zilbuz:msvc-doc, r=kennytm
Update MSVC compilation instructions regarding path length on Windows

Fix #46214
2017-11-26 15:01:37 +08:00
kennytm
fbfedc7e5a Rollup merge of #46234 - lucasem:core-marker-typo, r=frewsxcv
core::marker fix typo
2017-11-26 15:01:36 +08:00
kennytm
4c8cddb11b Rollup merge of #46224 - GuillaumeGomez:io-missing-link, r=QuietMisdreavus
Remove invalid doc link

r? @rust-lang/docs
2017-11-26 15:01:35 +08:00
kennytm
2cac14e2f9 Rollup merge of #46201 - davidalber:eprint-in-fmt-doc, r=frewsxcv
Adding `eprint*!` to the list of macros in the `format!` family

The `eprint!` and `eprintln!` macros were added in 7612727. The `std::fmt` documentation does not mention these macros next to `print!` and `println!` in the [Related macros](https://doc.rust-lang.org/std/fmt/#related-macros) section, and I did not find evidence that this omission was deliberate. This PR adds such documentation.

The first modification is to add `eprint!` and `eprintln!` to the list of related macros in the `format!` family. This is how it appears with this change:

![image](https://user-images.githubusercontent.com/933552/33159527-67056caa-cfc8-11e7-8b7d-4224ef2fce4e.png)

The second modification adds a sub-section for `eprint!` and `eprintln!`. Here is how the new section appears:

![image](https://user-images.githubusercontent.com/933552/33159541-97d03bee-cfc8-11e7-8b95-4d3632b5ab7b.png)
2017-11-26 15:01:34 +08:00
bors
d4dc289f4b Auto merge of #45990 - murarth:rc-from-strs, r=alexcrichton
Implement `Rc`/`Arc` conversions for string-like types

Provides the following conversion implementations:

* `From<`{`CString`,`&CStr`}`>` for {`Arc`,`Rc`}`<CStr>`
* `From<`{`OsString`,`&OsStr`}`>` for {`Arc`,`Rc`}`<OsStr>`
* `From<`{`PathBuf`,`&Path`}`>` for {`Arc`,`Rc`}`<Path>`

Closes #45008
2017-11-26 06:49:43 +00:00
Murarth
1bbc776446 Implement Rc/Arc conversions for string-like types
Provides the following conversion implementations:

* `From<`{`CString`,`&CStr`}`>` for {`Arc`,`Rc`}`<CStr>`
* `From<`{`OsString`,`&OsStr`}`>` for {`Arc`,`Rc`}`<OsStr>`
* `From<`{`PathBuf`,`&Path`}`>` for {`Arc`,`Rc`}`<Path>`
2017-11-25 22:13:11 -07:00