Commit graph

123358 commits

Author SHA1 Message Date
Takayuki Nakata
b4091032ab Use .is_some() not Some(_) 2020-07-14 08:08:13 +09:00
bjorn3
ff796b6d70 Rename collapsable_if fix suggestion to "collapse nested if block"
The name "try" is confusing when shown as quick fix by rust-analyzer
2020-07-13 17:54:57 +02:00
Lynoure Braakman
d27e7d04a1 Clarify the description for rfind
Changes the example code to illustrate the difference between
find and rfind
2020-07-13 17:41:27 +02:00
Takayuki Nakata
f2419b9d62 Refactoring to use `constant_context
Use `constant_context`, `.is_str()` and `builtin_index()` to simplify.
2020-07-14 00:23:20 +09:00
bors
4b8700879c Auto merge of #5792 - flip1995:rollup-torc1we, r=flip1995
Rollup of 5 pull requests

Successful merges:

 - #5443 (Some accuracy lints for floating point operations)
 - #5752 (Move range_minus_one to pedantic)
 - #5756 (unnecessary_sort_by: avoid linting if key borrows)
 - #5784 (Fix out of bounds access by checking length equality BEFORE accessing by index.)
 - #5786 (fix phrase in new_lint issue template)

Failed merges:

r? @ghost

changelog: rollup
2020-07-13 14:21:20 +00:00
Philipp Krones
314b068e2d
Rollup merge of #5786 - matthiaskrgr:new_lint_issue_templ, r=phansch
fix phrase in new_lint issue template

changelog: none
2020-07-13 15:59:46 +02:00
Philipp Krones
26ede3115f
Rollup merge of #5784 - matthiaskrgr:ice_5780, r=phansch
Fix out of bounds access by checking length equality BEFORE accessing by index.

Fixes #5780

changelog: fix out of bounds access in unnested_or_patterns lint.

Edit: I did not bother reducing a testcase from `librustc_typeck` crate but I can confirm that with the change the crash no longer occurs.
2020-07-13 15:59:45 +02:00
Philipp Krones
32ef448bdb
Rollup merge of #5756 - ebroto:5754_sort_by, r=flip1995
unnecessary_sort_by: avoid linting if key borrows

changelog: Avoid linting if key borrows in [`unnecessary_sort_by`]

Fixes #5754
Closes #2313
2020-07-13 15:59:44 +02:00
Philipp Krones
019e281d15
Rollup merge of #5752 - chrisduerr:pedantic_ranges, r=flip1995
Move range_minus_one to pedantic

This moves the range_minus_one lint to the pedantic category, so there
will not be any warnings emitted by default. This should work around
problems where the suggestion is impossible to resolve due to the range
consumer only accepting a specific range implementation, rather than the
`RangeBounds` trait (see #3307).

While it is possible to work around this by extracting the boundary into
a variable, I don't think clippy should encourage people to disable or
work around lints, but instead the lints should be fixable. So hopefully
this will help until a proper implementation checks what the range is
used for.

*Please keep the line below*
changelog: move [`range_minus_one`] to pedantic
2020-07-13 15:59:42 +02:00
Philipp Krones
75d43aac73
Rollup merge of #5443 - thiagoarrais:issue-2040, r=flip1995
Some accuracy lints for floating point operations

This will add some lints for accuracy on floating point operations suggested by @clarfon in #2040 (fixes #2040).

These are the remaining lints:

- [x] x.powi(2) => x * x
- [x] x.logN() / y.logN() => x.logbase(y)
- [x] x.logbase(E) => x.log()
- [x] x.logbase(10) => x.log10()
- [x] x.logbase(2) => x.log2().
- [x] x * PI / 180 => x.to_radians()
- [x] x * 180 / PI => x.to_degrees()
- [x] (x + 1).log() => x.log_1p()
- [x] sqrt(x * x + y * y) => x.hypot(y)

changelog: Included some accuracy lints for floating point operations
2020-07-13 15:59:41 +02:00
bors
fa4a737fba Auto merge of #5790 - flip1995:rustup, r=flip1995
Rustup

r? @ghost

changelog: none
2020-07-13 13:53:11 +00:00
wangtheo
8df79fcc76
Remove trailing whitespace 2020-07-13 09:44:48 -04:00
Pankaj Chaudhary
bc2b37aad7 Merge branch 'master' into E0688 2020-07-13 14:57:22 +05:30
PankajChaudhary5
e3ae4c7345 Added proper explanation of ErrorCode-E0688 2020-07-13 14:05:48 +05:30
Teddy_Wang
eac809244e Removed trailing whitespace 2020-07-13 01:52:10 -04:00
Teddy_Wang
5ff7e1ad2c Added ui tests for volatile and nearby intrinsics 2020-07-13 00:47:09 -04:00
Teddy_Wang
9a3a31a153 Added tests for volatile and nearbyint intrinsics 2020-07-12 22:38:37 -04:00
Adrian Cruceru
ed587f83cf Update llvm-project to latest origin/rustc/10.0-2020-05-05 commit which includes LVI segfault fix 2020-07-12 18:49:14 +00:00
Jarek Samic
8c45cf8e60 Add Ayu theme to rustdoc 2020-07-12 14:48:13 -04:00
Jarek Samic
0e89f50f6e Clean up handling of style files in rustdoc
Disable all themes other than `light.css` to prevent rule conflicts
2020-07-12 14:37:22 -04:00
Jake Goulding
9741fbd202 Don't allow DESTDIR to influence LLVM builds
When running a command like `DESTDIR=foo x.py install` in a completely
clean build directory, this will cause LLVM to be installed into
`DESTDIR`, which then causes the build to fail later when it attempts
to *use* those LLVM files.
2020-07-12 14:34:33 -04:00
Erin Power
ffac887908 Update RELEASES.md for 1.45.0 2020-07-12 14:06:53 -04:00
Esteban Küber
5daedea3db Detect tuple struct incorrectly used as struct pat 2020-07-12 10:34:48 -07:00
David Wood
083c2f6ceb
pprust: support multiline comments within lines
This commit adds support to rustc_ast_pretty for multiline comments that
start and end within a line of source code.

Signed-off-by: David Wood <david@davidtw.co>
2020-07-12 18:22:09 +01:00
Lzu Tao
879afd5116 process_unix: prefer i32::*_be_bytes over manually shifting bytes 2020-07-12 16:47:15 +00:00
David Wood
5afbc5201c
typeck: report placeholder type error w/out span
This commit fixes a regression introduced in rust-lang/rust#70369 which
meant that an error was not being emitted for invalid placeholder types
when there wasn't a span available.

Signed-off-by: David Wood <david@davidtw.co>
2020-07-12 16:40:22 +01:00
Lzu Tao
e31898b024 Reduce unsafe scope 2020-07-12 14:51:04 +00:00
Lzu Tao
0281a05f66 Prefer empty OsStr over unsafe cast from [u8] 2020-07-12 14:51:04 +00:00
Lzu Tao
b1d6798899 Rewrite parse_two_comps 2020-07-12 14:51:04 +00:00
Lzu Tao
27a966a149 Make use of slice::strip_prefix and slice pattern 2020-07-12 14:51:04 +00:00
Lzu Tao
90a7d2470a Make is_valid_drive_letter function 2020-07-12 14:51:04 +00:00
Lzu Tao
0ff820cb62 Move constants to top file 2020-07-12 14:51:04 +00:00
Lzu Tao
1e05e09fe9 Remove the useless indentation 2020-07-12 14:51:04 +00:00
Ralf Jung
ff5e1078fc assign tracking issue 2020-07-12 12:48:43 +02:00
Ralf Jung
7dc388654d adjust remaining targets 2020-07-12 11:46:42 +02:00
Ralf Jung
8082fb988a rename fast_thread_local -> thread_local_dtor; thread_local -> thread_local_key 2020-07-12 11:46:42 +02:00
Lzu Tao
9a8b516de0 Sorting feature attributes in std 2020-07-12 09:40:12 +00:00
bors
9d09331e00 Auto merge of #74245 - Manishearth:rollup-r0xq9dn, r=Manishearth
Rollup of 10 pull requests

Successful merges:

 - #72920 (Stabilize `transmute` in constants and statics but not const fn)
 - #73715 (debuginfo:  Mangle tuples to be natvis friendly, typedef basic types)
 - #74066 (Optimize is_ascii for str and [u8].)
 - #74116 (Fix cross compilation of LLVM to aarch64 Windows targets)
 - #74167 (linker: illumos ld does not support --eh-frame-hdr)
 - #74168 (Add a help to use `in_band_lifetimes` in nightly)
 - #74197 (Reword incorrect `self` token suggestion)
 - #74213 (Minor refactor for rustc_resolve diagnostics match)
 - #74240 (Fix #74081 and add the test case from #74236)
 - #74241 (update miri)

Failed merges:

r? @ghost
2020-07-12 08:57:10 +00:00
Matthias Krüger
2c5f8ab582 fix phrase in new_lint issue template 2020-07-11 23:42:56 +02:00
Alex Gaynor
905b5ad80a
don't mark linux kernel module targets as a unix environment 2020-07-11 17:20:33 -04:00
Manish Goregaokar
c8c4fd7cb1 Correctly sort const_fn_transmute 2020-07-11 08:55:05 -07:00
Manish Goregaokar
95c5fb850e
Rollup merge of #74241 - RalfJung:miri, r=RalfJung
update miri

This incorporates https://github.com/rust-lang/miri/pull/1474. [Last time](https://github.com/rust-lang/rust/pull/74146) that change caused trouble but I fixed xargo since then and [now it should work](https://github.com/rust-lang/rust/pull/74146#issuecomment-657051446).

Cc @rust-lang/miri r? @ghost
2020-07-11 08:53:29 -07:00
Manish Goregaokar
aa04ffb61a
Rollup merge of #74240 - da-x:fix-74081, r=Manishearth
Fix #74081 and add the test case from #74236
2020-07-11 08:53:27 -07:00
Manish Goregaokar
6204a73efa
Rollup merge of #74213 - pickfire:patch-1, r=jonas-schievink
Minor refactor for rustc_resolve diagnostics match

Use `matches!` instead of old `if let`
2020-07-11 08:53:25 -07:00
Manish Goregaokar
e15fa4537c
Rollup merge of #74197 - estebank:self-sugg, r=petrochenkov
Reword incorrect `self` token suggestion
2020-07-11 08:53:23 -07:00
Manish Goregaokar
9f7b64eecb
Rollup merge of #74168 - JohnTitor:help-for-in-band-lifetimes, r=petrochenkov
Add a help to use `in_band_lifetimes` in nightly

Fixes #73775
2020-07-11 08:53:21 -07:00
Manish Goregaokar
8f8ff1505f
Rollup merge of #74167 - jclulow:illumos-linker-eh-frame-hdr-fix, r=petrochenkov
linker: illumos ld does not support --eh-frame-hdr

As of rust-lang/rust#73564, the --eh-frame-hdr flag is unconditionally
passed to linkers on many platforms.  The illumos link editor does not
currently support this flag.

The linker machinery in the Rust toolchain currently seems to use the
(potentially cross-compiled) target to choose linker flags, rather than
looking at what might be running on the build system.  Disabling the
flag for all illumos/Solaris targets seems like the best we can do for
now without more serious surgery.
2020-07-11 08:53:19 -07:00
Manish Goregaokar
9614238314
Rollup merge of #74116 - arlosi:aarch64build, r=pietroalbini
Fix cross compilation of LLVM to aarch64 Windows targets

When cross-compiling, the LLVM build system recurses to build tools that need to run on the host system. However, since we pass cmake defines to set the compiler and target, LLVM still compiles these tools for the target system, rather than the host. The tools then fail to execute during the LLVM build.

This change sets defines for the tools that need to run on the host (llvm-nm, llvm-tablegen, and llvm-config), so that the LLVM build does not attempt to build them, and instead relies on the tools already built.

If compiling with clang-cl, adds the `--target` option to specify the target triple. MSVC compilers do not require this, since there is a separate compiler binary for each cross-compilation target.

Related issue: #72881
Requires LLVM change: rust-lang/llvm-project#67
2020-07-11 08:53:18 -07:00
Manish Goregaokar
1979fa86f9
Rollup merge of #74066 - thomcc:optimize-is-ascii, r=nagisa
Optimize is_ascii for str and [u8].

This optimizes the `is_ascii` function for `[u8]` and `str`. I've been surprised this wasn't done for a while, so I just did it.

Benchmarks comparing before/after look like:

```
test ascii::long_readonly::is_ascii_slice_iter_all              ... bench:         174 ns/iter (+/- 79) = 40172 MB/s
test ascii::long_readonly::is_ascii_slice_libcore               ... bench:          16 ns/iter (+/- 5) = 436875 MB/s
test ascii::medium_readonly::is_ascii_slice_iter_all            ... bench:          12 ns/iter (+/- 3) = 2666 MB/s
test ascii::medium_readonly::is_ascii_slice_libcore             ... bench:           2 ns/iter (+/- 0) = 16000 MB/s
test ascii::short_readonly::is_ascii_slice_iter_all             ... bench:           3 ns/iter (+/- 0) = 2333 MB/s
test ascii::short_readonly::is_ascii_slice_libcore              ... bench:           4 ns/iter (+/- 0) = 1750 MB/s
```

(Taken on a x86_64 macbook 2.9 GHz Intel Core i9 with 6 cores)

Where `is_ascii_slice_iter_all` is the old version, and `is_ascii_slice_libcore` is the new.

I tried to document the code well, so hopefully it's understandable. It has fairly exhaustive tests ensuring size/align doesn't get violated -- because `miri` doesn't really help a lot for this sort of code right now, I tried to `debug_assert` all the safety invariants I'm depending on. (Of course, none of them are required for correctness or soundness -- just allows us to test that this sort of pointer manipulation is sound and such).

Anyway, thanks. Let me know if you have questions/desired changes.
2020-07-11 08:53:16 -07:00
Manish Goregaokar
084ac77cf2
Rollup merge of #73715 - MaulingMonkey:pr-natvis-tuples, r=Amanieu
debuginfo:  Mangle tuples to be natvis friendly, typedef basic types

These changes are meant to unblock rust-lang/rust#70052 "Update hashbrown to 0.8.0" by allowing the use of `tuple<u64, u64>` as a .natvis expression in MSVC style debuggers (MSVC, WinDbg, CDB, etc.)

* f8eb81b does the actual mangling of `(u64, u64)` -> `tuple<u64, 64>`
* 24a728a allows `u64` to resolve (fixing `$T1` / `$T2` when used to visualize `HashMap<u64, u64, ...>`)
2020-07-11 08:53:13 -07:00