Commit graph

86242 commits

Author SHA1 Message Date
Denis Merigoux
51b7f2739b Generalized IntPredicate in the BuilderMethods trait 2018-11-16 14:11:09 +02:00
Denis Merigoux
14798d6937 Generalized BasicBlocks in BuilderMethods trait 2018-11-16 14:11:09 +02:00
Denis Merigoux
34c5dc045f Generalized base.rs#call_memcpy and everything that it uses
Generalized operand.rs#nontemporal_store and fixed tidy issues

Generalized operand.rs#nontemporal_store's implem even more
With a BuilderMethod trait implemented by Builder for LLVM

Cleaned builder.rs : no more code duplication, no more ValueTrait

Full traitification of builder.rs
2018-11-16 14:11:09 +02:00
Denis Merigoux
83b2152ce4 Reduced line length to pass tidy
Generalized FunctionCx

Added ValueTrait and first change

Generalize CondegenCx

Generalized the Builder struct defined in librustc_codegen_llvm/builder.rs
2018-11-16 14:11:09 +02:00
Denis Merigoux
c76fc3d804 Work around to fix issue https://github.com/rust-lang/rust/issues/53912 2018-11-16 14:11:09 +02:00
Irina Popa
5a9e6b8776 rustc_codegen_llvm: begin generalizing over backend values. 2018-11-16 14:10:53 +02:00
Oliver Scherer
9b8791179f Update stderr file 2018-11-16 09:04:35 +01:00
Andreas Jonson
03aaa4b659 remove unused dependency 2018-11-16 08:46:15 +01:00
bors
6b9b97bd9b Auto merge of #55948 - matthiaskrgr:clippy, r=oli-obk
submodules: update clippy from d8b42690 to 7e0ddef4

Fixes clippy toolstate.

Changes:
````
rustup https://github.com/rust-lang/rust/pull/55852/
Fix "too" -> "foo" typo in format.rs
Fix `use_self` violation
Fix wrong suggestion for `redundant_closure_call`
Check for common metadata
Fix `use_self` false positive on `use` statements
Fix `use_self` false positive
Remove `+` from `has_unary_equivalent`
Fix dogfood
Update println! formatting
Fix false positive in check mode caused by `gen_deprecated`
RIIR update lints: Add check mode (update_lints.py rewrite complete)
changed into_iter to iter and fixed a lint check
Fix `collapsible_if` error
Fix `possible_missing_comma` false positives
format code
fix comment spacing
change single char str to char
add lint to lintarray macro
Revert "small fix"
small fix
added float support for mistyped literal lints
tmp progress
````
2018-11-15 18:35:38 +00:00
Matthias Krüger
f354c85102 submodules: update clippy from d8b42690 to f5d868c9
Fixes clippy toolstate.

Changes:
````
rustup https://github.com/rust-lang/rust/pull/55852/
Fix "too" -> "foo" typo in format.rs
Fix `use_self` violation
Fix wrong suggestion for `redundant_closure_call`
Check for common metadata
Fix `use_self` false positive on `use` statements
Fix `use_self` false positive
Remove `+` from `has_unary_equivalent`
Fix dogfood
Update println! formatting
Fix false positive in check mode caused by `gen_deprecated`
RIIR update lints: Add check mode (update_lints.py rewrite complete)
changed into_iter to iter and fixed a lint check
Fix `collapsible_if` error
Fix `possible_missing_comma` false positives
format code
fix comment spacing
change single char str to char
add lint to lintarray macro
Revert "small fix"
small fix
added float support for mistyped literal lints
tmp progress
````
2018-11-15 17:49:24 +01:00
Oliver Scherer
c8a9300d8e Fix stability hole with static _ 2018-11-15 16:16:34 +01:00
Samuel Holland
8c8ff6a4e1 test/linkage-visibility: Ignore on musl targets
DynamicLibrary uses libc's dlsym() function internally to find symbols.
Some implementations of dlsym(), like musl's, only look at dynamically-
exported symbols, as found in shared libraries. To also export symbols
from the main executable, we would need to pass --export-dynamic to the
linker. Since this flag isn't available everywhere, ignore the test for
now.
2018-11-15 13:53:15 +00:00
Samuel Holland
4f9c860385 Add powerpc64-unknown-linux-musl target 2018-11-15 13:43:31 +00:00
Samuel Holland
2bb5029d74 Use the ELFv2 ABI on powerpc64 musl 2018-11-15 13:43:01 +00:00
Samuel Holland
346e97600b Fix powerpc64 ELFv2 big-endian struct-passing ABI
The requirements here are not "ELFv1" requirements, but big-endian
requirements, as the extension or non-extension of the argument is
necessary to put the argument in the correct half of the register.
Parameter passing in the ELFv2 ABI needs these same transformations.
Since this code makes no difference on little-endian machines, simplify
it to use the same code path everywhere.
2018-11-15 13:43:01 +00:00
Samuel Holland
81303d7d90 Add powerpc-unknown-linux-musl target 2018-11-15 13:42:57 +00:00
bors
9649c1f70f Auto merge of #55974 - pietroalbini:rollup, r=pietroalbini
Rollup of 17 pull requests

Successful merges:

 - #55182 (Redox: Update to new changes)
 - #55211 (Add BufWriter::buffer method)
 - #55507 (Add link to std::mem::size_of to size_of intrinsic documentation)
 - #55530 (Speed up String::from_utf16)
 - #55556 (Use `Mmap` to open the rmeta file.)
 - #55622 (NetBSD: link libstd with librt in addition to libpthread)
 - #55750 (Make `NodeId` and `HirLocalId` `newtype_index`)
 - #55778 (Wrap some query results in `Lrc`.)
 - #55781 (More precise spans for temps and their drops)
 - #55785 (Add mem::forget_unsized() for forgetting unsized values)
 - #55852 (Rewrite `...` as `..=` as a `MachineApplicable` 2018 idiom lint)
 - #55865 (Unix RwLock: avoid racy access to write_locked)
 - #55901 (fix various typos in doc comments)
 - #55926 (Change sidebar selector to fix compatibility with docs.rs)
 - #55930 (A handful of hir tweaks)
 - #55932 (core/char: Speed up `to_digit()` for `radix <= 10`)
 - #55956 (add tests for some fixed ICEs)

Failed merges:

r? @ghost
2018-11-15 12:43:01 +00:00
Pietro Albini
d0e08ce88e
Rollup merge of #55956 - euclio:issue-55587, r=estebank
add tests for some fixed ICEs

Fixes #55587.
Fixes #54348.

Looks like these ICEs are already fixed in nightly, so this PR just adds tests.

r? @estebank
2018-11-15 11:04:47 +01:00
Pietro Albini
f40f04bcc1
Rollup merge of #55932 - Turbo87:to_digit, r=alexcrichton
core/char: Speed up `to_digit()` for `radix <= 10`

I noticed that `char::to_digit()` seemed to do a bit of extra work for handling `[a-zA-Z]` characters. Since `to_digit(10)` seems to be the most common case (at least in the `rust` codebase) I thought it might be valuable to create a fast path for that case, and according to the benchmarks that I added in one of the commits it seems to pay off. I also created another fast path for the `radix < 10` case, which also seems to have a positive effect.

It is very well possible that I'm measuring something entirely unrelated though, so please verify these numbers and let me know if I missed something!

### Before

```
# Run 1
test char::methods::bench_to_digit_radix_10      ... bench:      16,265 ns/iter (+/- 1,774)
test char::methods::bench_to_digit_radix_16      ... bench:      13,938 ns/iter (+/- 2,479)
test char::methods::bench_to_digit_radix_2       ... bench:      13,090 ns/iter (+/- 524)
test char::methods::bench_to_digit_radix_36      ... bench:      14,236 ns/iter (+/- 1,949)

# Run 2
test char::methods::bench_to_digit_radix_10      ... bench:      16,176 ns/iter (+/- 1,589)
test char::methods::bench_to_digit_radix_16      ... bench:      13,896 ns/iter (+/- 3,140)
test char::methods::bench_to_digit_radix_2       ... bench:      13,158 ns/iter (+/- 1,112)
test char::methods::bench_to_digit_radix_36      ... bench:      14,206 ns/iter (+/- 1,312)

# Run 3
test char::methods::bench_to_digit_radix_10      ... bench:      16,221 ns/iter (+/- 2,423)
test char::methods::bench_to_digit_radix_16      ... bench:      14,361 ns/iter (+/- 3,926)
test char::methods::bench_to_digit_radix_2       ... bench:      13,097 ns/iter (+/- 671)
test char::methods::bench_to_digit_radix_36      ... bench:      14,388 ns/iter (+/- 1,068)
```

### After

```
# Run 1
test char::methods::bench_to_digit_radix_10      ... bench:      11,521 ns/iter (+/- 552)
test char::methods::bench_to_digit_radix_16      ... bench:      12,926 ns/iter (+/- 684)
test char::methods::bench_to_digit_radix_2       ... bench:      11,266 ns/iter (+/- 1,085)
test char::methods::bench_to_digit_radix_36      ... bench:      14,213 ns/iter (+/- 614)

# Run 2
test char::methods::bench_to_digit_radix_10      ... bench:      11,424 ns/iter (+/- 1,042)
test char::methods::bench_to_digit_radix_16      ... bench:      12,854 ns/iter (+/- 1,193)
test char::methods::bench_to_digit_radix_2       ... bench:      11,193 ns/iter (+/- 716)
test char::methods::bench_to_digit_radix_36      ... bench:      14,249 ns/iter (+/- 3,514)

# Run 3
test char::methods::bench_to_digit_radix_10      ... bench:      11,469 ns/iter (+/- 685)
test char::methods::bench_to_digit_radix_16      ... bench:      12,852 ns/iter (+/- 568)
test char::methods::bench_to_digit_radix_2       ... bench:      11,275 ns/iter (+/- 1,356)
test char::methods::bench_to_digit_radix_36      ... bench:      14,188 ns/iter (+/- 1,501)
```

I ran the benchmark using:

```sh
python x.py bench src/libcore --stage 1 --keep-stage 0 --test-args "bench_to_digit"
```
2018-11-15 11:04:46 +01:00
Pietro Albini
c915f921d7
Rollup merge of #55930 - ljedrz:hir_bonuses, r=cramertj
A handful of hir tweaks

- remove an unused `hir_vec` macro pattern
- simplify `fmt::Debug` for `hir::Path` (take advantage of the `Display` implementation)
- remove an unused type alias (`CrateConfig`)
- simplify a `match` expression (join common patterns)
2018-11-15 11:04:45 +01:00
Pietro Albini
12556a4b8f
Rollup merge of #55926 - cynecx:fix-rustdoc-mobile-css, r=GuillaumeGomez
Change sidebar selector to fix compatibility with docs.rs

Fix for #55883.
2018-11-15 11:04:43 +01:00
Pietro Albini
66fcb3ceb2
Rollup merge of #55901 - euclio:speling, r=petrochenkov
fix various typos in doc comments
2018-11-15 11:04:42 +01:00
Pietro Albini
fb4553299c
Rollup merge of #55865 - RalfJung:unix-rwlock, r=alexcrichton
Unix RwLock: avoid racy access to write_locked

We should only access `write_locked` if we really got the lock.
2018-11-15 11:04:41 +01:00
Pietro Albini
3c7acc7878
Rollup merge of #55852 - varkor:dotdotequals-lint, r=zackmdavis
Rewrite `...` as `..=` as a `MachineApplicable` 2018 idiom lint

Fixes https://github.com/rust-lang/rust/issues/51043.
2018-11-15 11:04:40 +01:00
Pietro Albini
202724cddc
Rollup merge of #55785 - stjepang:unsized-drop-forget, r=alexcrichton
Add mem::forget_unsized() for forgetting unsized values

~~Allows passing values of `T: ?Sized` types to `mem::drop` and `mem::forget`.~~

Adds `mem::forget_unsized()` that accepts `T: ?Sized`.

I had to revert the PR that removed the `forget` intrinsic and replaced it with `ManuallyDrop`: https://github.com/rust-lang/rust/pull/40559
We can't use `ManuallyDrop::new()` here because it needs `T: Sized` and we don't have support for unsized return values yet (will we ever?).

r? @eddyb
2018-11-15 11:04:38 +01:00
Pietro Albini
6ca7bc0eb8
Rollup merge of #55781 - pnkfelix:issue-54382-more-precise-spans-for-temps-and-their-drops, r=davidtwco
More precise spans for temps and their drops

This PR has two main enhancements:

 1. when possible during code generation for a statement (like `expr();`), pass along the span of a statement, and then attribute the drops of temporaries from that statement to the statement's end-point (which will be the semicolon if it is a statement that is terminating by a semicolon).
 2. when evaluating a block expression into a MIR temp, use the span of the block's tail expression (rather than the span of whole block including its statements and curly-braces) for the span of the temp.

Each of these individually increases the precision of our diagnostic output; together they combine to make a much clearer picture about the control flow through the spans.

Fix #54382
2018-11-15 11:04:37 +01:00
Pietro Albini
97d0d8964e
Rollup merge of #55778 - nnethercote:LrcPreds, r=eddyb
Wrap some query results in `Lrc`.

So that the frequent clones in `try_get` are cheaper.
2018-11-15 11:04:36 +01:00
Pietro Albini
1d5829d87f
Rollup merge of #55750 - oli-obk:node_id_x, r=michaelwoerister
Make `NodeId` and `HirLocalId` `newtype_index`
2018-11-15 11:04:35 +01:00
Pietro Albini
756870a2ff
Rollup merge of #55622 - jakllsch:netbsd-librt, r=alexcrichton
NetBSD: link libstd with librt in addition to libpthread

Some aio(3) and mq(3) functions in the libc crate actually come from NetBSD librt, not libc or libpthread.
2018-11-15 11:04:34 +01:00
Pietro Albini
9c5b8aad1d
Rollup merge of #55556 - nnethercote:MmapMeta, r=eddyb
Use `Mmap` to open the rmeta file.

Because those files are quite large, contribute significantly to peak
memory usage, but only a small fraction of the data is ever read.

r? @eddyb
2018-11-15 11:04:32 +01:00
Pietro Albini
3b40434940
Rollup merge of #55530 - ljedrz:speed_up_String_from_utf16, r=SimonSapin
Speed up String::from_utf16

Collecting into a `Result` is idiomatic, but not necessarily fast due to rustc not being able to preallocate for the resulting collection. This is fine in case of an error, but IMO we should optimize for the common case, i.e. a successful conversion.

This changes the behavior of `String::from_utf16` from collecting into a `Result` to pushing to a preallocated `String` in a loop.

According to [my simple benchmark](https://gist.github.com/ljedrz/953a3fb74058806519bd4d640d6f65ae) this change makes `String::from_utf16` around **twice** as fast.
2018-11-15 11:04:31 +01:00
Pietro Albini
d7c833b7ef
Rollup merge of #55507 - fhartwig:size_of_intrinsic_docs, r=frewsxcv
Add link to std::mem::size_of to size_of intrinsic documentation

The other intrinsics with safe/stable alternatives already have documentation to this effect.
2018-11-15 11:04:30 +01:00
Pietro Albini
b20bba4f37
Rollup merge of #55211 - fintelia:bufwriter-buffer, r=shepmaster
Add BufWriter::buffer method

CC #45323
2018-11-15 11:04:28 +01:00
Pietro Albini
f4ecc1f521
Rollup merge of #55182 - jD91mZM2:rebased, r=alexcrichton
Redox: Update to new changes

These are all cherry-picked from our fork:

 - Remove the `env:` scheme
 - Update `execve` system call to `fexec`
 - Interpret shebangs: these are no longer handled by the kernel, which like usual tries to be as minimal as possible
2018-11-15 11:04:27 +01:00
Ralf Jung
b8915f2ba8 fix other affected tests 2018-11-15 10:59:42 +01:00
Ralf Jung
a3770c2547 do not accept out-of-bounds pointers in enum discriminants, they might be NULL 2018-11-15 10:59:39 +01:00
bors
99e3fca27d Auto merge of #54906 - qnighy:fix-issue-50452, r=nikomatsakis
Reattach all grandchildren when constructing specialization graph.

Specialization graphs are constructed by incrementally adding impls in the order of declaration. If the impl being added has its specializations in the graph already, they should be reattached under the impl. However, the current implementation only reattaches the one found first. Therefore, in the following specialization graph,

```
  Tr1
   |
   I3
  /  \
 I1  I2
```

If `I1`, `I2`, and `I3` are declared in this order, the compiler mistakenly constructs the following graph:

```
  Tr1
  /  \
 I3  I2
  |
 I1
```

This patch fixes the reattach procedure to include all specializing grandchildren-to-be.

Fixes #50452.
2018-11-15 09:51:53 +00:00
Ralf Jung
ffb6ba0828 validation: better error when the enum discriminant is Undef 2018-11-15 09:58:09 +01:00
ljedrz
e6e5635730 ty: return impl Iterator from Predicate::walk_tys 2018-11-15 09:22:00 +01:00
Ralf Jung
62cf9abcf6 rename FrameInfo span field to call_site 2018-11-15 08:59:49 +01:00
Ralf Jung
e4d03f82b5 miri value visitor: provide place when visiting a primitive 2018-11-15 08:51:32 +01:00
Ralf Jung
c5bc83b60d expose MutValueVisitor 2018-11-15 08:51:32 +01:00
Blitzerr
6779bb485c capture_disjoint_fields(rust-lang#53488)
Refactoring out the HirId of the UpvarId in another struct.
2018-11-14 21:18:48 -08:00
Eric Huss
7f4bc2247a Clean up some non-mod-rs stuff. 2018-11-14 18:55:41 -08:00
bors
4ec0ba9545 Auto merge of #55716 - RalfJung:escape-to-raw, r=oli-obk
Add escape-to-raw MIR statement

Add a new MIR "ghost state statement": Escaping a ptr to permit raw accesses.

~~This includes #55549, [click here](https://github.com/RalfJung/rust/compare/miri-visitor...RalfJung:escape-to-raw) for just the new commits.~~
2018-11-15 01:12:01 +00:00
Stepan Koltsov
a1f83e75af Stress test for MPSC
`concurrent_recv_timeout_and_upgrade` reproduces a problem 100%
times on my MacBook with command:

```
./x.py test --stage 0 ./src/test/run-pass/mpsc_stress.rs
```

Thus it is commented out.

Other tests cases were useful for catching another test cases
which may arise during the fix.

This diff is a part of my previous rewrite attempt: #42883

CC #39364
2018-11-15 00:18:19 +00:00
QuietMisdreavus
aa3d7a4e6e properly calculate spans for intra-doc link resolution errors 2018-11-14 18:14:31 -06:00
bors
7d3b9b1640 Auto merge of #55939 - alexcrichton:path-regression-again, r=sfackler
std: Synchronize access to global env during `exec`

This commit, after reverting #55359, applies a different fix for #46775
while also fixing #55775. The basic idea was to go back to pre-#55359
libstd, and then fix #46775 in a way that doesn't expose #55775.

The issue described in #46775 boils down to two problems:

* First, the global environment is reset during `exec` but, but if the
  `exec` call fails then the global environment was a dangling pointer
  into free'd memory as the block of memory was deallocated when
  `Command` is dropped. This is fixed in this commit by installing a
  `Drop` stack object which ensures that the `environ` pointer is
  preserved on a failing `exec`.

* Second, the global environment was accessed in an unsynchronized
  fashion during `exec`. This was fixed by ensuring that the
  Rust-specific environment lock is acquired for these system-level
  operations.

Thanks to Alex Gaynor for pioneering the solution here!

Closes #55775
2018-11-14 22:15:35 +00:00
Ralf Jung
b396505425 put file and line into miri backtrace 2018-11-14 23:14:57 +01:00
Alex Crichton
4032b7a429 std: Synchronize access to global env during exec
This commit, after reverting #55359, applies a different fix for #46775
while also fixing #55775. The basic idea was to go back to pre-#55359
libstd, and then fix #46775 in a way that doesn't expose #55775.

The issue described in #46775 boils down to two problems:

* First, the global environment is reset during `exec` but, but if the
  `exec` call fails then the global environment was a dangling pointer
  into free'd memory as the block of memory was deallocated when
  `Command` is dropped. This is fixed in this commit by installing a
  `Drop` stack object which ensures that the `environ` pointer is
  preserved on a failing `exec`.

* Second, the global environment was accessed in an unsynchronized
  fashion during `exec`. This was fixed by ensuring that the
  Rust-specific environment lock is acquired for these system-level
  operations.

Thanks to Alex Gaynor for pioneering the solution here!

Closes #55775

Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
2018-11-14 12:46:57 -08:00