Commit Graph

142395 Commits

Author SHA1 Message Date
Christiaan Dirkx
905d23b65c Move std::sys_common::alloc to std::sys::common 2021-04-14 13:24:10 +02:00
hi-rustin
0e9de930ac add macro-or-patterns-2021 test 2021-04-14 18:51:54 +08:00
bors
b1c675f3fc Auto merge of #7070 - camsteffen:changelog-stderr, r=flip1995
Fix changelog check output

Error messages are more helpful if you can see them.

changelog: none
2021-04-14 08:25:14 +00:00
bors
24921df7bd Auto merge of #7039 - phansch:melt-ice, r=flip1995
tabs_in_doc_comments: Fix ICE due to char indexing

This is a quick-fix for an ICE in `tabs_in_doc_comments`. The problem
was that we we're indexing into possibly multi-byte characters, such as '位'.

More specifically `get_chunks_of_tabs` was returning indices into
multi-byte characters. Those were passed on to a `Span` creation that
then caused the ICE.

This fix makes sure that we don't return indices that point inside a
multi-byte character. *However*, we are still iterating over unicode
codepoints, not grapheme clusters. So a seemingly single character like y̆ ,
which actually consists of two codepoints, will probably still cause
incorrect spans in the output. But I don't think we handle those cases
anywhere in Clippy currently?

Fixes #5835

changelog: Fix ICE in `tabs_in_doc_comments`
2021-04-14 04:53:24 +00:00
bors
19740d9334 Auto merge of #7076 - rail-rain:missing_const_for_fn, r=phansch
Fix a FP in `missing_const_for_fn`

where a function that calls a standard library function whose constness
is unstable is considered as being able to be a const function. Fixes #5995.

The core change is the move from `rustc_mir::const_eval::is_min_const_fn` to `rustc_mir::const_eval::is_const_fn`. I'm not clear about the difference in their purpose between them so I'm not sure if it's acceptable to call `qualify_min_const_fn::is_min_const_fn` this way now.

---

changelog: `missing_const_for_fn`: No longer lints when an unstably const function is called
2021-04-14 04:39:25 +00:00
Philipp Hansch
cbdebd97ec Explain why we use char_indices() instead of chars() 2021-04-14 06:30:51 +02:00
bors
d408fdd4a8 Auto merge of #83762 - camelid:bare-urls-note, r=jyn514
Add explanatory note to `bare_urls` lint

I think the lint is confusing otherwise since it doesn't fully explain
what the problem is.
2021-04-14 01:16:46 +00:00
Jacob Hoffman-Andrews
d44c6ed351 Updated tester.js for separate search.js 2021-04-13 16:43:14 -07:00
Jacob Hoffman-Andrews
52789498e9 Split search.js from search-index.js. 2021-04-13 14:59:54 -07:00
François Mockers
e36ca09101 remove line length ignore 2021-04-13 23:32:05 +02:00
rail
26a1989041 Fix a FP in missing_const_for_fn
where a function that calls a standard library function whose constness
is unstable is considered as being able to be a const function
2021-04-14 09:23:44 +12:00
Eric Huss
a8fbe2f22f Fix join_paths error display. 2021-04-13 14:20:49 -07:00
bors
8f3c2450c2 Auto merge of #7074 - camsteffen:diag-methods, r=llogiq
Split `is_diagnostic_assoc_item`

changelog: none

* Split `is_diagnostic_assoc_item` into `is_diag_item_method` and `is_diag_trait_item`
  * `is_diag_item_method` is a bit more nuanced with the `tcx.type_of(impl_id).ty_adt_def()` step, so it seems better to keep that separate.
  * No need to generalize over traits and Adt's since we know which one we want at compile time
  * "item" vs. "method" because a trait may have associated items.
* Replaces the usage of the `sym::slice` diagnostic item with the `slice_alloc` lang item. The diagnostic item should be removed from rustc because it is on the `slice_alloc` impl, not slice itself (and it's not needed).
2021-04-13 20:31:22 +00:00
François Mockers
7f395302d3 forgot test assertions for default method 2021-04-13 22:14:35 +02:00
François Mockers
26ffef061f add test 2021-04-13 22:14:35 +02:00
François Mockers
b9f9a2a68f tidy format rust 2021-04-13 22:14:34 +02:00
François Mockers
df100f7c53 format css 2021-04-13 22:13:42 +02:00
François Mockers
838c2ef111 fix source link when in a trait implementation 2021-04-13 22:13:41 +02:00
François Mockers
45964368f4 add anchors links on hover to items from trait impl 2021-04-13 22:10:19 +02:00
François Mockers
e1b6bb214f fix links from trait impl methods to trait declaration 2021-04-13 22:09:08 +02:00
Cameron Steffen
0d144298ee Improve changelog check error handling 2021-04-13 14:53:12 -05:00
Cameron Steffen
76bd5d232c Refactor diagnostic item methods 2021-04-13 14:10:40 -05:00
Camille GILLOT
22f6448bed Lower async fn in traits.
An error is already created by AST validation.
2021-04-13 20:57:44 +02:00
bors
132b4e5d16 Auto merge of #84164 - LingMan:option_option, r=estebank
Avoid an `Option<Option<_>>`

By simply swapping the calls to `map` and `and_then` around the complexity of
handling an `Option<Option<_>>` disappears.

`@rustbot` modify labels +C-cleanup +T-compiler
2021-04-13 18:04:20 +00:00
LingMan
28aed81f7d Avoid an Option<Option<_>>
By simply swapping the calls to `map` and `and_then` around the complexity of
handling an `Option<Option<_>>` disappears.
2021-04-13 18:42:19 +02:00
bors
5c1304205b Auto merge of #84135 - rust-lang:GuillaumeGomez-patch-1, r=kennytm
Improve code example for length comparison

Small fix/improvement: it's much safer to check that you're under the length of an array rather than chacking that you're equal to it. It's even more true in case you update the length of the array while iterating.
2021-04-13 14:03:49 +00:00
AnthonyMikh
7efba4f982 Implement indexing slices with pairs of ops::Bound<usize> 2021-04-13 09:57:24 -04:00
katelyn a. martin
3e16d233d8 move new c abi abort behavior behind feature gate
### Background

    In #76570, new ABI strings including `C-unwind` were introduced.
    Their behavior is specified in RFC 2945 [1].

    However, it was reported in the #ffi-unwind stream of the Rust
    community Zulip that this had altered the way that `extern "C"`
    functions behaved even when the `c_unwind` feature gate was not
    active. [2]

 ### Overview

    This makes a small patch to
    `rustc_mir_build::build::should_abort_on_panic`, so that the same
    behavior from before is in place when the `c_unwind` gate is not
    active.

    `rustc_middle::ty::layout::fn_can_unwind` is not touched, as the
    visible behavior should not differ before/after #76570. [3]

 ### Footnotes

 [1]: https://github.com/rust-lang/rfcs/blob/master/text/2945-c-unwind-abi.md
 [2]: https://rust-lang.zulipchat.com/#narrow/stream/210922-project-ffi-unwind/topic/Is.20unwinding.20through.20extern.20C.20UB.3F/near/230112325
 [3]: https://github.com/rust-lang/rust/pull/76570/files#diff-b0320c2b8868f325d83c027fc5d71732636e9763551e35895488f30fe057c6e9L2599-R2617
2021-04-13 09:55:21 -04:00
bors
5258a74c88 Auto merge of #84153 - Dylan-DPC:rollup-5jiqrwu, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #83438 (Update RELEASES.md)
 - #83707 (Remove `T: Debug` bound on UnsafeCell Debug impl)
 - #84084 (Stabilize duration_zero.)
 - #84121 (Stabilize BTree{Map,Set}::retain)
 - #84140 (Don't call bump in check_mistyped_turbofish_with_multiple_type_params)
 - #84141 (Fix typo in error message)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-04-13 11:22:10 +00:00
Dylan DPC
91c08288c4
Rollup merge of #84141 - camelid:fix-typo, r=Dylan-DPC
Fix typo in error message

Also tweaked the message a bit by

- removing the hyphen, because in my opinion the hyphen makes the
  message a bit harder to read, especially combined with the backticks;
- adding the word "be", because I think it's a bit clearer that way.
2021-04-13 11:10:44 +02:00
Dylan DPC
e40d7e6d84
Rollup merge of #84140 - b-naber:parser_past_eof, r=varkor
Don't call bump in check_mistyped_turbofish_with_multiple_type_params

Fixes https://github.com/rust-lang/rust/issues/84117
2021-04-13 11:10:43 +02:00
Dylan DPC
cf67c9bbf7
Rollup merge of #84121 - workingjubilee:stabilize-btree-retain, r=dtolnay
Stabilize BTree{Map,Set}::retain

Closes #79025.
FCP concluded here: https://github.com/rust-lang/rust/issues/79025#issuecomment-817201302

This is an approved feature on BTree{Map,Set} to mirror a functionality in Hash{Map,Set}, which has had some adequate testing since its introduction in https://github.com/rust-lang/rust/pull/79026 and doesn't seem to have caused any problems since.
2021-04-13 11:10:42 +02:00
Dylan DPC
3d6a364e33
Rollup merge of #84084 - m-ou-se:stabilize-zero, r=scottmcm
Stabilize duration_zero.

FCP here: https://github.com/rust-lang/rust/issues/73544#issuecomment-817201305
2021-04-13 11:10:40 +02:00
Dylan DPC
1cc4b6de3e
Rollup merge of #83707 - exrook:unsafecell, r=m-ou-se
Remove `T: Debug` bound on UnsafeCell Debug impl

Prior art: #65013
2021-04-13 11:10:39 +02:00
Dylan DPC
9191dee5b8
Rollup merge of #83438 - CDirkx:releases, r=Mark-Simulacrum
Update RELEASES.md

A couple of things that were missing in the release notes:

- `Div` and `Rem` by their `NonZero` variant is now implemented for all unsigned integers (#79134)
- Stabilization of `VecDeque::range` and `VecDeque::range_mut` (#79022, stabilization version corrected to 1.51.0 #80448)
- Deprecation of `spin_loop_hint` (#80966)
2021-04-13 11:10:38 +02:00
bors
2e7eb85b1d Auto merge of #84099 - tmiasko:asm-only-x86_64, r=Amanieu
Check for asm support in UI tests that require it

Add `needs-asm-support` compiletest directive, and use it in asm tests
that require asm support without relying on any architecture specific
features.

Closes #84038.
2021-04-13 08:40:12 +00:00
Jacob Hoffman-Andrews
11f854db4f Further consolidate search-related vars and funcs 2021-04-13 00:35:36 -07:00
Jacob Hoffman-Andrews
95d652ebce Consolidate search-related vars and functions.
This allows sharing across main.js and search.js without exporting too
many symbols into the global namespace.
2021-04-13 00:07:01 -07:00
Manish Goregaokar
55b29443db Update attribute tests 2021-04-12 23:03:17 -07:00
bors
23aef90b4e Auto merge of #84086 - m-ou-se:stabilze-is-subnormal, r=dtolnay
Stabilize is_subnormal.

FCP completed here: https://github.com/rust-lang/rust/issues/79288#issuecomment-817201311
2021-04-13 05:59:10 +00:00
Jacob Hoffman-Andrews
276ee6f542 Move search JS into search-index.js
Export a few variables and functions into the global scope because they
are needed both by main.js and search-index.js.
2021-04-12 22:52:16 -07:00
Camelid
dbbbdf1097 Add explanatory note to bare_urls lint
I think the lint is confusing otherwise since it doesn't fully explain
what the problem is.
2021-04-12 20:25:20 -07:00
bors
7ce470fd9b Auto merge of #84082 - andjo403:stabilize_nonzero_leading_trailing_zeros, r=m-ou-se
Stabilize nonzero_leading_trailing_zeros

Stabilizing nonzero_leading_trailing_zeros and due to this also stabilizing the intrinsic cttz_nonzero

FCP finished here: https://github.com/rust-lang/rust/issues/79143#issuecomment-817216153
`@rustbot` modify labels: +T-libs

Closes #79143
2021-04-13 03:18:10 +00:00
bors
d4d7ebf142 Auto merge of #82992 - philippeitis:stabilize_bufreader_seek_relative, r=workingjubilee
Stabilize `bufreader_seek_relative`

This PR marks `BufReader::seek_relative` as stable - the associated issue, #31100, has passed the final comment period without any issues, and from what I understand, the only thing left to stabilize this is to submit a PR marking the method as stable.

Closes #31100.
2021-04-13 00:52:00 +00:00
Tomasz Miąsko
da40e69b60 Check for asm support in UI tests that require it
Add `needs-asm-support` compiletest directive, and use it in asm tests
that require asm support without relying on any architecture specific
features.
2021-04-13 00:00:00 +00:00
James Addison
0174dd6f92 Compiler error messages: reduce assertiveness of message E0384
This message is emitted as guidance by the compiler when a developer attempts to reassign a value to an immutable variable.  Following the message will always currently work, but it may not always be the best course of action; following the 'consider ...' messaging pattern provides a hint to the developer that it could be wise to explore other alternatives.
2021-04-12 23:29:09 +01:00
bors
11d0528483 Auto merge of #82918 - Manishearth:edition-2015-warn, r=oli-obk
Turn old edition lint (anonymous-parameters) into warn-by-default on 2015

This makes `anonymous_parameters` <s>and `keyword_idents` </s>warn-by-default on the 2015 edition. I would also like to do this for `absolute_paths_not_starting_with_crate`, but I feel that case is slightly less clear-cut.

Note that this only affects code on the 2015 edition, such code is illegal in future editions anyway.

This was spurred by https://github.com/dtolnay/syn/issues/972: old edition syntax breaks tooling (like syn), and while the tooling should be free to find its balance on how much to support prior editions, it does seem like we should be nudging such code towards the newer edition, and we can do that by turning this Allow lint into a Warn.

In general, I feel like migration lints from an old edition should be made Warn after a year or so, and idiom lints for the new edition should be made Warn after a couple months.

cc `@m-ou-se,` this is for stuff from the 2015-2018 migration but you might be interested.
2021-04-12 22:26:15 +00:00
Aaron Hill
c6d67f8317
Add fast path when None delimiters are not involved 2021-04-12 17:26:26 -04:00
Manish Goregaokar
5c2820b913 +ignore-tidy-filelength 2021-04-12 13:35:48 -07:00
Camelid
1e2635815f Fix typo in error message
Also tweaked the message a bit by

- removing the hyphen, because in my opinion the hyphen makes the
  message a bit harder to read, especially combined with the backticks;
- adding the word "be", because I think it's a bit clearer that way.
2021-04-12 13:08:15 -07:00