Commit Graph

77452 Commits

Author SHA1 Message Date
Anthony Ramine
a7c4b5c97a Properly handle ranges of signed enums using both extremums (fixes #49973) 2018-04-15 13:38:00 +02:00
Oliver Schneider
907df8c0f7
Add a tracking issue for making the warning a lint 2018-04-15 13:28:15 +02:00
Niko Matsakis
96dba9358c s/use_mir/use_mir_borrowck/ 2018-04-15 07:13:44 -04:00
Niko Matsakis
45d281d7fa remove -Znll -- borrowck=mir implies nll now 2018-04-15 07:13:42 -04:00
Niko Matsakis
818ae6fece don't expose the borrows field 2018-04-15 07:06:30 -04:00
Niko Matsakis
033c4f2e3c just use an iterator 2018-04-15 07:06:30 -04:00
Niko Matsakis
df233f0f2c stop using borrows for anything but iterating over live data 2018-04-15 07:06:30 -04:00
Niko Matsakis
d4005a2bc9 thread borrow-set around more 2018-04-15 07:06:30 -04:00
Niko Matsakis
a849da626d remove ReserveOrActivateIndex 2018-04-15 07:06:29 -04:00
Niko Matsakis
d32e5aac3d use the activations_at_location map to check activations
Not gen bits
2018-04-15 07:06:29 -04:00
Niko Matsakis
e1f82aa590 determine whether a borrow is active based solely on the location 2018-04-15 07:06:29 -04:00
Niko Matsakis
f93d5d30bd add useful debug 2018-04-15 07:06:29 -04:00
Niko Matsakis
8e783da222 encapsulate ReserveOrActivateIndex into the borrows dataflow 2018-04-15 07:06:29 -04:00
Niko Matsakis
5f7b74f832 construct the BorrowSet outside of borrows 2018-04-15 07:06:29 -04:00
Niko Matsakis
e1123674b1 extract code to build borrow-set into borrow_check::borrow_set
Also:

- Extract common helper functions into a helper trait.
- Kill a bit of dead code.
2018-04-15 07:06:29 -04:00
Niko Matsakis
70592664b6 relocate BorrowData etc into borrow_check::borrow_set 2018-04-15 07:06:27 -04:00
Niko Matsakis
6c528ce784 gather activation locations for 2-phase borrows in 1 pass 2018-04-15 06:56:48 -04:00
Niko Matsakis
517e7fd2a1 remove assigned_map (appears to be dead code) 2018-04-15 06:56:48 -04:00
bors
602b3957f1 Auto merge of #49885 - spastorino:fn_ref_unsound, r=nikomatsakis
Fix unsoundness bug in functions input references

Fixes #48803

r? @nikomatsakis
2018-04-15 09:14:43 +00:00
Anthony Ramine
b59fa0d9e8 Remove #[inline(always)] on Vec::into_boxed_slice 2018-04-15 10:34:57 +02:00
bors
56109dbf70 Auto merge of #49884 - alexcrichton:less-unwrap, r=Mark-Simulacrum
core: Remove panics from some `Layout` methods

`Layout` is often used at the core of allocation APIs and is as a result pretty
sensitive to codegen in various circumstances. I was profiling `-C opt-level=z`
with a wasm project recently and noticed that the `unwrap()` wasn't removed
inside of `Layout`, causing the program to be much larger than it otherwise
would be. If inlining were more aggressive LLVM would have figured out that the
panic could be eliminated, but in general the methods here can't panic in the
first place!

As a result this commit makes the following tweaks:

* Removes `unwrap()` and replaces it with `unsafe` in `Layout::new` and
  `Layout::for_value`. For posterity though a debug assertion was left behind.
* Removes an `unwrap()` in favor of `?` in the `repeat` method. The comment
  indicating that the function call couldn't panic wasn't quite right in that if
  `alloc_size` becomes too large and if `align` is high enough it could indeed
  cause a panic.

This'll hopefully mean that panics never get introduced into code in the first
place, ensuring that `opt-level=z` is closer to `opt-level=s` in this regard.
2018-04-15 06:33:48 +00:00
Simon Sapin
7cbeddb7b7 Deprecate Read::chars and char::decode_utf8
Per FCP:

* https://github.com/rust-lang/rust/issues/27802#issuecomment-377537778
* https://github.com/rust-lang/rust/issues/33906#issuecomment-377534308
2018-04-15 08:18:00 +02:00
bors
bc001fa07f Auto merge of #49881 - varkor:partialord-opt, r=Manishearth
Fix derive(PartialOrd) and optimise final field operation

```rust
// Before (`lt` on 2-field struct)
self.f1 < other.f1 || (!(other.f1 < self.f1) &&
(self.f2 < other.f2 || (!(other.f2 < self.f2) &&
(false)
))
)

// After
self.f1 < other.f1 || (!(other.f1 < self.f1) &&
self.f2 < other.f2
)

// Before (`le` on 2-field struct)
self.f1 < other.f1 || (!(other.f1 < self.f1) &&
(self.f2 < other.f2 || (!(other.f2 < self.f2) &&
(true)
))
)

// After
self.f1 < other.f1 || (self.f1 == other.f1 &&
self.f2 <= other.f2
)
```

(The big diff is mainly because of a past faulty rustfmt application that I corrected 😒)

Fixes #49650 and fixes #49505.
2018-04-15 03:54:15 +00:00
bors
d4d43e2483 Auto merge of #48173 - GuillaumeGomez:error-codes-libsyntax_ext, r=estebank
Add error codes for libsyntax_ext

I intend to add error codes for `libsyntax_ext` as well. However, they cannot be used at stage 0 directly so I thought it might be possible to enable them at the stage 1 only so we can have access to the macros. However, the error code registration seems to not work this way. Currently I get the following error:

```
error: used diagnostic code E0660 not registered
  --> libsyntax_ext/asm.rs:93:25
   |
93 |                         span_err!(cx, sp, E0660, "malformed inline assembly");
   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error: used diagnostic code E0661 not registered
   --> libsyntax_ext/asm.rs:151:33
    |
151 | /                                 span_err!(cx, sp, E0661,
152 | |                                           "output operand constraint lacks '=' or '+'");
    | |________________________________________________________________________________________^
    |
    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error: aborting due to 2 previous errors

error: Could not compile `syntax_ext`.
```

If anyone has an idea, I'd gladly take it. I'm trying to figure this out on my side as well. I also opened this PR to know if it was worth it to continue (maybe we don't want this?).

Anyway, any answer for both questions is very welcome!

cc @rust-lang/compiler
2018-04-15 01:26:11 +00:00
Dylan MacKenzie
d5bee64df4 Prefer unprefixed paths for well known structs 2018-04-14 15:32:24 -07:00
Dylan MacKenzie
182d99cfd1 Add doc links to std::os extension traits
Add documentation links to the original type for various OS-specific
extension traits and normalize the language for introducing such traits.
Also, remove some outdated comments around the extension trait
definitions.
2018-04-14 15:32:24 -07:00
bors
bd40cbbe1f Auto merge of #49850 - alexcrichton:moreinline, r=sfackler
core: Inline `From<AllocErr> for CollectionAllocErr`

This shows up in allocations of vectors and such, so no need for it to not be
inlined!
2018-04-14 20:22:19 +00:00
Guillaume Gomez
f367567e06 ignore stage1 testing 2018-04-14 18:04:16 +02:00
Guillaume Gomez
5d52ef5091 Add tests and longer error explanation 2018-04-14 17:25:35 +02:00
Guillaume Gomez
44c686113f Add error codes for libsyntax_ext 2018-04-14 17:25:35 +02:00
Guillaume Gomez
c83c7c91f5 Add doc 2018-04-14 17:20:36 +02:00
Guillaume Gomez
d08f8978e7 Small size reduction 2018-04-14 17:13:46 +02:00
Guillaume Gomez
47a9ffa573 Add multi-query search 2018-04-14 17:01:28 +02:00
Nikita Popov
cbabb1be32 Remove warning about f64->f32 cast being potential UB
As discussed in #15536, the LLVM documentation incorrect described
overflowing f64->f32 casts as being undefined behavior. LLVM never
treated them as such, and the documentation has been adjusted in
https://reviews.llvm.org/rL329065. As such, this warning can now
be removed.

Closes #49622.
2018-04-14 16:21:46 +02:00
Andre Bogus
c68c90a232 stabilize fetch_nand 2018-04-14 15:51:31 +02:00
bors
21dae950be Auto merge of #49939 - kennytm:rollup, r=kennytm
Rollup of 14 pull requests

Successful merges: #49908, #49876, #49916, #49951, #49465, #49922, #49866, #49915, #49886, #49913, #49852, #49958, #49871, #49864

Failed merges:
2018-04-14 13:11:24 +00:00
kennytm
0e9d6f9bb0
Rollup merge of #49864 - QuietMisdreavus:doctest-target-features, r=GuillaumeGomez
add target features when extracting and running doctests

When rendering documentation, rustdoc will happily load target features into the cfg environment from the current target, but fails to do this when doing anything with doctests. This would lead to situations where, thanks to https://github.com/rust-lang/rust/pull/48759, functions tagged with `#[target_feature]` couldn't run doctests, thanks to the automatic `#[doc(cfg(target_feature = "..."))]`.

Currently, there's no way to pass codegen options to rustdoc that will affect its rustc sessions, but for now this will let you use target features that come default on the platform you're targeting.

Fixes https://github.com/rust-lang/rust/issues/49723
2018-04-14 18:50:41 +08:00
kennytm
709ec4010d
Rollup merge of #49871 - SimonSapin:int-bytes, r=sfackler
Add to_bytes and from_bytes to primitive integers

Discussion issue turned tracking issue: https://github.com/rust-lang/rust/issues/49792
2018-04-14 18:49:58 +08:00
kennytm
9659f052a4
Rollup merge of #49958 - glandium:cleanup, r=SimonSapin
Cleanup liballoc use statements

Some modules were still using the deprecated `allocator` module, use the
`alloc` module instead.

Some modules were using `super` while it's not needed.

Some modules were more or less ordering them, and other not, so the
latter have been modified to match the others.
2018-04-14 18:48:09 +08:00
Simon Sapin
447299130a Add to_bytes and from_bytes to primitive integers 2018-04-14 12:31:22 +02:00
bors
cfc3465b9d Auto merge of #49289 - varkor:emit-metadata-without-link, r=michaelwoerister
Make --emit=metadata output metadata regardless of link

Fixes #40109. I'm not sure whether this condition was important here or not, but I can't see why it is required (removing it doesn't cause the error the comment warns about, so I'm assuming it's safe). If this is too heavy-handed, I can special-case on `OutputType::Metadata`.

r? @nrc
2018-04-14 10:27:03 +00:00
Oliver Schneider
7f7d4c376a
Get rid of redundant HashSet 2018-04-14 12:22:10 +02:00
Oliver Schneider
748e71e8f4
Reduce the number of calls to cdata 2018-04-14 12:21:46 +02:00
Oliver Schneider
04b3ab67d9
Encode items before encoding the list of AllocIds 2018-04-14 12:21:46 +02:00
Oliver Schneider
6f251c2a03
Use LazySeq instead of Vec 2018-04-14 12:21:46 +02:00
Oliver Schneider
62c0501be8
Stop referring to statics' AllocIds directly 2018-04-14 12:21:46 +02:00
Oliver Schneider
a67ded06a3
Don't recurse into allocations, use a global table instead 2018-04-14 12:21:46 +02:00
Mike Hommey
e35499ca15 Replace remaining uses of deprecated Heap with Global 2018-04-14 16:48:27 +09:00
Mike Hommey
4c8e9b9751 Replace remaining uses of deprecated std::heap with std::alloc 2018-04-14 16:47:38 +09:00
kennytm
e681ba22d2
Rollup merge of #49922 - f-bro:zmiri, r=oli-obk
Remove -Zmiri debugging option
2018-04-14 15:23:37 +08:00