Commit Graph

81634 Commits

Author SHA1 Message Date
Irina Popa
2dbde55395 rustc_codegen_llvm: use safe references for Builder. 2018-07-30 18:36:30 +03:00
Irina Popa
d04e66d114 rustc_codegen_llvm: use safe references for Type. 2018-07-30 18:36:29 +03:00
Irina Popa
249d5acaec rustc_codegen_llvm: use safe references for Context and Module. 2018-07-30 18:27:52 +03:00
Irina Popa
af04e9426c rustc_codegen_llvm: move from empty enums to extern types. 2018-07-30 18:12:47 +03:00
steveklabnik
7a8693861e update books for new release 2018-07-30 11:09:48 -04:00
Irina Popa
077be49bde rustc_llvm: move to rustc_codegen_llvm::llvm. 2018-07-30 18:03:50 +03:00
Alex Crichton
ca762ba954 rustc: Disallow machine applicability in foreign macros
Recent changes to lints disallowed lints from being emitted against code located
in foreign macros, except for future-incompatible lints. For a future
incompatible lint, however, the automatic suggestions may not be applicable!

This commit updates this code path to force all applicability suggestions made
to foreign macros to never be `MachineApplicable`. This should avoid rustfix
actually attempting fixing these suggestions, causing non-compiling code to be
produced.

Closes rust-lang/cargo#5799
2018-07-30 07:48:59 -07:00
flip1995
7b9388b7b5
Explain that the tool is responsible for unknown tool_lints 2018-07-30 16:10:55 +02:00
flip1995
d4ff949953
Add a test for the declare_tool_lint macro 2018-07-30 16:10:55 +02:00
flip1995
57c77426ae
Check if the lint_name is from a tool and if the tool_lint exists 2018-07-30 16:10:41 +02:00
Colin Finck
e50f4eeaad Add targets for HermitCore (https://hermitcore.org) to the Rust compiler and port libstd to it.
As a start, the port uses the simplest possible configuration (no jemalloc, abort on panic)
and makes use of existing Unix-specific code wherever possible.
It adds targets for x86_64 (current main HermitCore platform) and aarch64 (HermitCore platform
under development).

Together with the patches to "liblibc" and "llvm", this enables HermitCore applications to be
written in Rust.
2018-07-30 15:50:51 +02:00
bors
54628c8ea8 Auto merge of #52697 - ljedrz:misc_data_structures, r=Mark-Simulacrum
Simplify a few functions in rustc_data_structures

- drop `try!()` where it's superfluous
- change `try!()` to `?`
- squash a `push` with `push_str`
- refactor a push loop into an iterator
2018-07-30 12:20:58 +00:00
Ralf Jung
6d5694a021 fix memrchr in miri 2018-07-30 14:00:12 +02:00
Ralf Jung
aa7d7d0c2b improve test stage documentation 2018-07-30 13:10:55 +02:00
Ralf Jung
f8d1dc88a7 improve --stage documentation 2018-07-30 13:10:55 +02:00
bors
e4378412ec Auto merge of #52830 - matthewjasper:bootstrap-prep, r=matthewjasper
[NLL] Fix some things for bootstrap

Some changes that are required when bootstrapping rustc with NLL enabled.

* Remove a bunch of unused `mut`s that aren't needed, but the existing lint doesn't catch.
* Rewrite a function call to satisfy NLL borrowck. Note that the borrow is two-phase, but gets activated immediately by an unsizing coercion.

cc #51823
2018-07-30 10:19:38 +00:00
Simon Sapin
f162438fb3 Revert "Stabilize to_bytes and from_bytes for integers."
This reverts commit c8f9b84b39.
2018-07-30 11:55:20 +02:00
flip1995
4b466ee4f9
Introduce the declare_tool_lint macro 2018-07-30 11:20:11 +02:00
bors
5ed2b5120b Auto merge of #52722 - alexcrichton:more-identifier-lints, r=oli-obk
Tweak the raw_identifiers lints in 2018

* Enable the `raw_identifiers` feature automatically in the 2018 preview
* Only emit lint warnings if the `raw_identifiers` feature is activated

cc rust-lang/cargo#5783
2018-07-30 08:25:36 +00:00
bors
7bbcd005b3 Auto merge of #52805 - ljedrz:format_str_literal, r=petrochenkov
Don't format!() string literals

Prefer `to_string()` to `format!()` take 2, this time targetting string literals. In some cases (`&format!("...")` -> `"..."`) also removes allocations. Occurences of `format!("")` are changed to `String::new()`.
2018-07-30 06:29:39 +00:00
Donato Sciarra
c57deb923e Remove references to AUTHORS.txt file
Refer instead to thanks page.
2018-07-30 07:47:12 +02:00
Brad Gibson
56016cb1e0 resolved upstream merge conflicts 2018-07-29 22:13:12 -07:00
bors
a3f519df09 Auto merge of #52823 - RalfJung:test, r=eddyb
invalid_const_promotion: check if we get the right signal

r? @eddyb
2018-07-30 04:34:19 +00:00
kennytm
2994b27e40
Add timeout to use of curl in bootstrap.py. 2018-07-30 12:06:22 +08:00
Xidorn Quan
fc8bb9c42c Don't commit thread stack on Windows 2018-07-30 14:02:09 +10:00
toidiu
2b25ee0764 update comment 2018-07-29 21:12:58 -04:00
bors
b12235db09 Auto merge of #52828 - Mark-Simulacrum:clear-rustdoc-check, r=alexcrichton
Clear out rustdoc check builds if dependencies change

r? @alexcrichton
2018-07-30 01:08:13 +00:00
bors
866a713258 Auto merge of #52738 - ljedrz:push_to_extend, r=eddyb
Replace push loops with extend() where possible

Or set the vector capacity where I couldn't do it.

According to my [simple benchmark](https://gist.github.com/ljedrz/568e97621b749849684c1da71c27dceb) `extend`ing a vector can be over **10 times** faster than `push`ing to it in a loop:

10 elements (6.1 times faster):
```
test bench_extension ... bench:          75 ns/iter (+/- 23)
test bench_push_loop ... bench:         458 ns/iter (+/- 142)
```

100 elements (11.12 times faster):
```
test bench_extension ... bench:          87 ns/iter (+/- 26)
test bench_push_loop ... bench:         968 ns/iter (+/- 3,528)
```

1000 elements (11.04 times faster):
```
test bench_extension ... bench:         311 ns/iter (+/- 9)
test bench_push_loop ... bench:       3,436 ns/iter (+/- 233)
```

Seems like a good idea to use `extend` as much as possible.
2018-07-29 21:37:47 +00:00
bors
70cac59031 Auto merge of #51361 - oli-obk:sanity_check_consts, r=nikomatsakis
Do a basic sanity check for all constant values

## Motivation and high level overview

There has been some back and forth in this PR between @RalfJung and me in here about the motivation for this change and the stance it takes on unsafe coding guidelines.

The initial implementation ran its checks on every value read (so `*x`, `y = x`, ...). In unsafe code that isn't reasonable, because we might be invalidating invariants for a short time in order to build up a proper value.

The current implementation is a lint that runs its checks statics and constants. There is no need to check array lengths and enum variants, because it's a hard error to end up with anything but a number, and that one even has to have the required bits to be defined.

## What checks are done?

* Some type related checks
    * `char` needs to be a correct unicode character as defined by `char::from_u32`
    * A reference to a ZST must have the correct alignment (and be nonzero)
    * A reference to anything is dereferenced and its value is checked
* Layout checks use the information from `ty::Layout` to check
    * all fields of structs
    * all elements of arrays
    * enum discriminants
    * the fields of an enum variant (the variant is decided by the discriminant)
    * whether any union field succeeds in being checked (if none match the memory pattern, the check fails)
    * if the value is in the range described by the layout (e.g. for `NonZero*` types)

Changing the layout of a type will thus automatically cause the checks to check for the new layout.

fixes #51330
fixes #51471

cc @RalfJung

r? @eddyb
2018-07-29 19:37:28 +00:00
Ralf Jung
86e59ccf34 dont hardcode vtable size in codegen test 2018-07-29 20:24:26 +02:00
Ralf Jung
5ba76335bb update codegen tests 2018-07-29 20:24:26 +02:00
Oliver Schneider
3e8337eb3d Move a test that depends on the arch bitwidth to compile-fail 2018-07-29 20:24:26 +02:00
Oliver Schneider
b92f0478c1 Update miri submodule 2018-07-29 20:24:26 +02:00
Oliver Schneider
9377041de9 Sanity-check all constants 2018-07-29 20:22:15 +02:00
Matthew Jasper
18d5f82148 Change order of copy and borrow to avoid conflict
Note that the first argument is `self as &mut dyn Delegate`, so this
isn't allowed with two-phase borrows.
2018-07-29 18:04:09 +01:00
Matthew Jasper
503455bcc7 Remove unused muts 2018-07-29 18:04:09 +01:00
ljedrz
59c8a279da Replace push loops with collect() and extend() where possible 2018-07-29 18:53:22 +02:00
Vadim Petrochenkov
44422409a4 resolve: Modularize crate-local #[macro_export] macro_rules 2018-07-29 19:30:13 +03:00
Mark Rousskov
d68176e115 Clear out rustdoc check builds if dependencies change 2018-07-29 09:03:37 -06:00
Unknown
9845ee0886 fix coding style 2018-07-29 23:45:32 +09:00
bors
75af9df71b Auto merge of #52620 - mikhail-m1:51351, r=nikomatsakis
fix simple case of issue #51351 and #52133

r? @nikomatsakis
2018-07-29 13:23:01 +00:00
Ralf Jung
90165b82fc Make sure #47772 does not regress 2018-07-29 13:41:43 +02:00
bors
2a9dc245c6 Auto merge of #52755 - kennytm:update-rustfmt, r=nrc
Update rustfmt and RLS
2018-07-29 11:27:48 +00:00
varkor
9ccd7eef1e Fix -Wpessimizing-move warnings in rustllvm/PassWrapper 2018-07-29 12:20:06 +01:00
Ralf Jung
c7f01aa175 invalid_const_promotion: check if we get the right signal 2018-07-29 13:11:01 +02:00
kennytm
cab21f12d5
Update RLS and rustfmt. 2018-07-29 19:05:42 +08:00
kennytm
9c5c8d6491
Test clippy first to workaround the derive-new conflict. 2018-07-29 19:05:41 +08:00
Mikhail Modin
bb66d70b89 fix issues #51351 and #52133 2018-07-29 11:42:50 +01:00
bors
023fd7e74a Auto merge of #52767 - ljedrz:avoid_format, r=petrochenkov
Prefer to_string() to format!()

Simple benchmarks suggest in some cases it can be faster by even 37%:
```
test converting_f64_long  ... bench:         339 ns/iter (+/- 199)
test converting_f64_short ... bench:         136 ns/iter (+/- 34)
test converting_i32_long  ... bench:          87 ns/iter (+/- 16)
test converting_i32_short ... bench:          87 ns/iter (+/- 49)
test converting_str       ... bench:          54 ns/iter (+/- 15)
test formatting_f64_long  ... bench:         349 ns/iter (+/- 176)
test formatting_f64_short ... bench:         145 ns/iter (+/- 14)
test formatting_i32_long  ... bench:          98 ns/iter (+/- 14)
test formatting_i32_short ... bench:          93 ns/iter (+/- 15)
test formatting_str       ... bench:          86 ns/iter (+/- 23)
```
2018-07-29 09:33:37 +00:00
Josef Reinhard Brandl
ea25cf1cc6 Fix From<LocalWaker> 2018-07-29 10:45:17 +02:00