]> git.lizzy.rs Git - rust.git/log
rust.git
3 years ago:arrow_up: rust-analyzer
Laurențiu Nicola [Wed, 14 Apr 2021 18:25:43 +0000 (21:25 +0300)]
:arrow_up: rust-analyzer

3 years agoAuto merge of #83948 - ABouttefeux:lint-nullprt-deref, r=RalfJung
bors [Wed, 14 Apr 2021 18:04:22 +0000 (18:04 +0000)]
Auto merge of #83948 - ABouttefeux:lint-nullprt-deref, r=RalfJung

add lint deref_nullptr detecting when a null ptr is dereferenced

fixes #83856
changelog: add lint that detect code like
```rust
unsafe {
      &*core::ptr::null::<i32>()
 };
unsafe {
     addr_of!(std::ptr::null::<i32>())
};
let x: i32 = unsafe {*core::ptr::null()};
let x: i32 = unsafe {*core::ptr::null_mut()};
unsafe {*(0 as *const i32)};
unsafe {*(core::ptr::null() as *const i32)};
```
```
warning: Dereferencing a null pointer causes undefined behavior
 --> src\main.rs:5:26
  |
5 |     let x: i32 = unsafe {*core::ptr::null()};
  |                          ^^^^^^^^^^^^^^^^^^
  |                          |
  |                          a null pointer is dereferenced
  |                          this code causes undefined behavior when executed
  |
  = note: `#[warn(deref_nullptr)]` on by default
```

Limitation:
It does not detect code like
```rust
const ZERO: usize = 0;
unsafe {*(ZERO as *const i32)};
```
or code where `0` is not directly a literal

3 years agoAuto merge of #84158 - cratelyn:patch-extern-c-unwind-behavior, r=nikomatsakis
bors [Wed, 14 Apr 2021 15:35:33 +0000 (15:35 +0000)]
Auto merge of #84158 - cratelyn:patch-extern-c-unwind-behavior, r=nikomatsakis

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 <sup>[1]</sup>.

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. <sup>[2]</sup>

*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. <sup>[3]</sup>

---

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

[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

3 years agoUpdate docs for unsafe_op_in_unsafe_fn stability.
Eric Huss [Wed, 14 Apr 2021 15:23:47 +0000 (08:23 -0700)]
Update docs for unsafe_op_in_unsafe_fn stability.

3 years agoFix typos in rustc_codegen_ssa/src/back/write.rs.
Edd Barrett [Wed, 14 Apr 2021 15:25:16 +0000 (16:25 +0100)]
Fix typos in rustc_codegen_ssa/src/back/write.rs.

3 years agoUpdate books
Eric Huss [Wed, 14 Apr 2021 15:24:06 +0000 (08:24 -0700)]
Update books

3 years agotest: add reasonable case
hi-rustin [Wed, 14 Apr 2021 14:31:44 +0000 (22:31 +0800)]
test: add reasonable case

3 years agotest: add more cases
hi-rustin [Wed, 14 Apr 2021 14:16:56 +0000 (22:16 +0800)]
test: add more cases

3 years agoAuto merge of #83068 - mockersf:method-trait-foreign-impl, r=GuillaumeGomez
bors [Wed, 14 Apr 2021 12:47:49 +0000 (12:47 +0000)]
Auto merge of #83068 - mockersf:method-trait-foreign-impl, r=GuillaumeGomez

rustdoc: links from items in a trait impl are inconsistent

Depending on where the struct implementing a trait is coming from, or the current page, the items in a trait impl are not linking to the same thing:

|item| trait page, implementors| trait page, implementations on Foreign Types|struct page, trait implementations|
|-|-|-|-|
|function|             link to current impl|link to first impl in the list|link to trait def
|default function |    not present         |not present                   |link to trait def
|default function with custom impl|link to current impl|link to trait def             |link to trait def
|constant|             link to current impl|link to trait def             |link to trait def
|associated type|      link to current impl|link to trait def             |link to trait def
||*missing link to trait def*|*function link wrong + missing link to current impl*|*missing link to current impl*|

<details>
  <summary>rust code with those cases</summary>

```rust
pub trait MyTrait {
    type Assoc;
    const VALUE: u32;
    fn trait_function(&self);
    fn defaulted(&self) {}
    fn defaulted_override(&self) {}
}

impl MyTrait for String {
    /// will link to trait def
    type Assoc = ();
    /// will link to trait def
    const VALUE: u32 = 5;
    /// will link to first foreign implementor
    fn trait_function(&self) {}
    /// will link to trait def
    fn defaulted_override(&self) {}
}

impl MyTrait for Vec<u8> {
    /// will link to trait def
    type Assoc = ();
    /// will link to trait def
    const VALUE: u32 = 5;
    /// will link to first foreign implementor
    fn trait_function(&self) {}
    /// will link to trait def
    fn defaulted_override(&self) {}
}

impl MyTrait for MyStruct {
    /// in trait page, will link to current impl
    ///
    /// in struct page, will link to trait def
    type Assoc = bool;
    /// in trait page, will link to current impl
    ///
    /// in struct page, will link to trait def
    const VALUE: u32 = 20;
    /// in trait page, will link to current impl
    ///
    /// in struct page, will link to trait def
    fn trait_function(&self) {}
    /// in trait page, will link to current impl
    ///
    /// in struct page, will link to trait def
    fn defaulted_override(&self) {}
}

pub struct MyStruct;
```
</details>

In this PR, I fixed all links to target the trait definition, and added an anchor-link to the current implementation appearing on mouse hover.

3 years agoUpdate documentation
Christiaan Dirkx [Wed, 14 Apr 2021 12:03:00 +0000 (14:03 +0200)]
Update documentation

3 years agoMerge branch 'master' into compiler/E0384-reduce-assertiveness
James Addison [Wed, 14 Apr 2021 11:52:06 +0000 (12:52 +0100)]
Merge branch 'master' into compiler/E0384-reduce-assertiveness

3 years agoMove `std::sys_common::alloc` to `std::sys::common`
Christiaan Dirkx [Wed, 24 Feb 2021 18:16:24 +0000 (19:16 +0100)]
Move `std::sys_common::alloc` to `std::sys::common`

3 years agoadd macro-or-patterns-2021 test
hi-rustin [Wed, 14 Apr 2021 10:51:54 +0000 (18:51 +0800)]
add macro-or-patterns-2021 test

3 years agoAuto merge of #83762 - camelid:bare-urls-note, r=jyn514
bors [Wed, 14 Apr 2021 01:16:46 +0000 (01:16 +0000)]
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.

3 years agoUpdated tester.js for separate search.js
Jacob Hoffman-Andrews [Tue, 13 Apr 2021 23:43:14 +0000 (16:43 -0700)]
Updated tester.js for separate search.js

3 years agoSplit search.js from search-index.js.
Jacob Hoffman-Andrews [Tue, 13 Apr 2021 21:59:54 +0000 (14:59 -0700)]
Split search.js from search-index.js.

3 years agoremove line length ignore
François Mockers [Tue, 13 Apr 2021 21:32:05 +0000 (23:32 +0200)]
remove line length ignore

3 years agoFix join_paths error display.
Eric Huss [Tue, 13 Apr 2021 21:20:49 +0000 (14:20 -0700)]
Fix join_paths error display.

3 years agoforgot test assertions for default method
François Mockers [Sat, 13 Mar 2021 14:24:00 +0000 (15:24 +0100)]
forgot test assertions for default method

3 years agoadd test
François Mockers [Sat, 13 Mar 2021 14:04:12 +0000 (15:04 +0100)]
add test

3 years agotidy format rust
François Mockers [Sat, 13 Mar 2021 01:33:04 +0000 (02:33 +0100)]
tidy format rust

3 years agoformat css
François Mockers [Sat, 13 Mar 2021 01:13:00 +0000 (02:13 +0100)]
format css

3 years agofix source link when in a trait implementation
François Mockers [Sat, 13 Mar 2021 00:40:13 +0000 (01:40 +0100)]
fix source link when in a trait implementation

3 years agoadd anchors links on hover to items from trait impl
François Mockers [Thu, 11 Mar 2021 02:32:30 +0000 (03:32 +0100)]
add anchors links on hover to items from trait impl

3 years agofix links from trait impl methods to trait declaration
François Mockers [Thu, 11 Mar 2021 02:31:54 +0000 (03:31 +0100)]
fix links from trait impl methods to trait declaration

3 years agoAuto merge of #84164 - LingMan:option_option, r=estebank
bors [Tue, 13 Apr 2021 18:04:20 +0000 (18:04 +0000)]
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

3 years agoAvoid an `Option<Option<_>>`
LingMan [Tue, 13 Apr 2021 16:42:19 +0000 (18:42 +0200)]
Avoid an `Option<Option<_>>`

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

3 years agoAuto merge of #84135 - rust-lang:GuillaumeGomez-patch-1, r=kennytm
bors [Tue, 13 Apr 2021 14:03:49 +0000 (14:03 +0000)]
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.

3 years agomove new c abi abort behavior behind feature gate
katelyn a. martin [Tue, 13 Apr 2021 13:55:21 +0000 (09:55 -0400)]
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

3 years agoAuto merge of #84153 - Dylan-DPC:rollup-5jiqrwu, r=Dylan-DPC
bors [Tue, 13 Apr 2021 11:22:10 +0000 (11:22 +0000)]
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

3 years agoRollup merge of #84141 - camelid:fix-typo, r=Dylan-DPC
Dylan DPC [Tue, 13 Apr 2021 09:10:44 +0000 (11:10 +0200)]
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.

3 years agoRollup merge of #84140 - b-naber:parser_past_eof, r=varkor
Dylan DPC [Tue, 13 Apr 2021 09:10:43 +0000 (11:10 +0200)]
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

3 years agoRollup merge of #84121 - workingjubilee:stabilize-btree-retain, r=dtolnay
Dylan DPC [Tue, 13 Apr 2021 09:10:42 +0000 (11:10 +0200)]
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.

3 years agoRollup merge of #84084 - m-ou-se:stabilize-zero, r=scottmcm
Dylan DPC [Tue, 13 Apr 2021 09:10:40 +0000 (11:10 +0200)]
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

3 years agoRollup merge of #83707 - exrook:unsafecell, r=m-ou-se
Dylan DPC [Tue, 13 Apr 2021 09:10:39 +0000 (11:10 +0200)]
Rollup merge of #83707 - exrook:unsafecell, r=m-ou-se

Remove `T: Debug` bound on UnsafeCell Debug impl

Prior art: #65013

3 years agoRollup merge of #83438 - CDirkx:releases, r=Mark-Simulacrum
Dylan DPC [Tue, 13 Apr 2021 09:10:38 +0000 (11:10 +0200)]
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)

3 years agoAuto merge of #84099 - tmiasko:asm-only-x86_64, r=Amanieu
bors [Tue, 13 Apr 2021 08:40:12 +0000 (08:40 +0000)]
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.

3 years agoFurther consolidate search-related vars and funcs
Jacob Hoffman-Andrews [Tue, 13 Apr 2021 07:35:36 +0000 (00:35 -0700)]
Further consolidate search-related vars and funcs

3 years agoConsolidate search-related vars and functions.
Jacob Hoffman-Andrews [Tue, 13 Apr 2021 06:50:18 +0000 (23:50 -0700)]
Consolidate search-related vars and functions.

This allows sharing across main.js and search.js without exporting too
many symbols into the global namespace.

3 years agoUpdate attribute tests
Manish Goregaokar [Tue, 13 Apr 2021 06:03:17 +0000 (23:03 -0700)]
Update attribute tests

3 years agoAuto merge of #84086 - m-ou-se:stabilze-is-subnormal, r=dtolnay
bors [Tue, 13 Apr 2021 05:59:10 +0000 (05:59 +0000)]
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

3 years agoMove search JS into search-index.js
Jacob Hoffman-Andrews [Mon, 12 Apr 2021 05:19:29 +0000 (22:19 -0700)]
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.

3 years agoAdd explanatory note to `bare_urls` lint
Camelid [Tue, 13 Apr 2021 01:35:06 +0000 (18:35 -0700)]
Add explanatory note to `bare_urls` lint

I think the lint is confusing otherwise since it doesn't fully explain
what the problem is.

3 years agoAuto merge of #84082 - andjo403:stabilize_nonzero_leading_trailing_zeros, r=m-ou-se
bors [Tue, 13 Apr 2021 03:18:10 +0000 (03:18 +0000)]
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

3 years agoAuto merge of #82992 - philippeitis:stabilize_bufreader_seek_relative, r=workingjubilee
bors [Tue, 13 Apr 2021 00:52:00 +0000 (00:52 +0000)]
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.

3 years agoCheck for asm support in UI tests that require it
Tomasz Miąsko [Tue, 13 Apr 2021 00:00:00 +0000 (00:00 +0000)]
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.

3 years agoCompiler error messages: reduce assertiveness of message E0384
James Addison [Mon, 12 Apr 2021 22:29:09 +0000 (23:29 +0100)]
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.

3 years agoAuto merge of #82918 - Manishearth:edition-2015-warn, r=oli-obk
bors [Mon, 12 Apr 2021 22:26:15 +0000 (22:26 +0000)]
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.

3 years agoAdd fast path when None delimiters are not involved
Aaron Hill [Mon, 12 Apr 2021 21:26:26 +0000 (17:26 -0400)]
Add fast path when None delimiters are not involved

3 years ago+ignore-tidy-filelength
Manish Goregaokar [Mon, 12 Apr 2021 20:18:36 +0000 (13:18 -0700)]
+ignore-tidy-filelength

3 years agoFix typo in error message
Camelid [Mon, 12 Apr 2021 19:33:52 +0000 (12:33 -0700)]
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.

3 years agoMove color to themes
Manish Goregaokar [Mon, 12 Apr 2021 19:42:13 +0000 (12:42 -0700)]
Move color to themes

3 years ago& -> &&
Manish Goregaokar [Mon, 12 Apr 2021 19:40:20 +0000 (12:40 -0700)]
& -> &&

3 years agoWrap toggle_open()
Manish Goregaokar [Mon, 12 Apr 2021 19:27:37 +0000 (12:27 -0700)]
Wrap toggle_open()

3 years agoAdd test for item hiding
Manish Goregaokar [Mon, 12 Apr 2021 19:14:41 +0000 (12:14 -0700)]
Add test for item hiding

3 years agoadd test
b-naber [Mon, 12 Apr 2021 19:06:11 +0000 (21:06 +0200)]
add test

3 years agodon't bump in check_mistyped_turbofish_with_multiple_type_params
b-naber [Mon, 12 Apr 2021 17:14:51 +0000 (19:14 +0200)]
don't bump in check_mistyped_turbofish_with_multiple_type_params

3 years agoshould_hide_fields > 12
Manish Goregaokar [Mon, 12 Apr 2021 18:41:01 +0000 (11:41 -0700)]
should_hide_fields > 12

3 years agoAuto merge of #83776 - jyn514:update-stdarch-docs, r=Amanieu
bors [Mon, 12 Apr 2021 18:29:25 +0000 (18:29 +0000)]
Auto merge of #83776 - jyn514:update-stdarch-docs, r=Amanieu

Update stdarch submodule (to before it switched to const generics)

https://github.com/rust-lang/rust/pull/83278#issuecomment-812389823: This unblocks #82539.

Major changes:
- More AVX-512 intrinsics.
- More ARM & AArch64 NEON intrinsics.
- Updated unstable WASM intrinsics to latest draft standards.
- std_detect is now a separate crate instead of a submodule of std.

I double-checked and the first use of const generics looks like https://github.com/rust-lang/stdarch/commit/8d5017861ed594a2baf169e632379862d516e013, which isn't included in this PR.

r? `@Amanieu`

3 years agoImprove code example for length comparison
Guillaume Gomez [Mon, 12 Apr 2021 17:59:52 +0000 (19:59 +0200)]
Improve code example for length comparison

3 years agoTurn old edition lints (anonymous-parameters, keyword-idents) into warn-by-default...
Manish Goregaokar [Mon, 8 Mar 2021 23:43:18 +0000 (15:43 -0800)]
Turn old edition lints (anonymous-parameters, keyword-idents) into warn-by-default on 2015

3 years agoAuto merge of #84103 - calebcartwright:bump-rls-rustfmt, r=Xanewok
bors [Mon, 12 Apr 2021 15:59:35 +0000 (15:59 +0000)]
Auto merge of #84103 - calebcartwright:bump-rls-rustfmt, r=Xanewok

update RLS and rustfmt

Fixes #83460 and fixes #83459

cc `@Xanewok`

3 years agoFix lookahead with None-delimited group
Aaron Hill [Mon, 12 Apr 2021 15:15:38 +0000 (11:15 -0400)]
Fix lookahead with None-delimited group

3 years agoAdd css classes
Manish Goregaokar [Sun, 28 Mar 2021 01:09:31 +0000 (18:09 -0700)]
Add css classes

3 years agoImprove CSS for "hide contents, not items"
Jacob Hoffman-Andrews [Sat, 27 Mar 2021 19:50:09 +0000 (12:50 -0700)]
Improve CSS for "hide contents, not items"

Introduce a first use of the `<details>` and `<summary>` tags as
replacements for the JS-built toggles. I think this has the potential to
replace all the JS toggles and generally clean up the JS, CSS, and HTML.

Split rendering of attributes into two cases: in the case where they are
rendered as descendents of a `<pre>` tag, where they use indent spaces and
newlines for formatting, matching their surrounding markup. In the case
where they are rendered as descendants of a `<code>` tag, they are
rendered as `<div>`. This let me clean up some fragile CSS that was
adjusting the margin-left of attributes depending on context.

Remove toggles for attributes. With the ALLOWED_ATTRIBUTES filter, it's
rare for an item to have more than one attribute, so hiding attributes
behind a toggle doesn't save any screen space in the common case.

Fix a couple of invocations of `matches!` that didn't compile on my
machine.

Fix a boolean for the JS `createToggle` call that was causing
"Expand description" to show up spuriously on already-expanded
descriptions.

Add JS for auto-hide settings and hide all / show all.

Remove a z-index property and some font color tweaks made unnecessary
by the <details> toggles.

Add CSS for the <details> toggles.

3 years agoUpdate src/librustdoc/html/render/print_item.rs
Manish Goregaokar [Mon, 22 Mar 2021 16:08:58 +0000 (09:08 -0700)]
Update src/librustdoc/html/render/print_item.rs

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoUpdate src/librustdoc/html/render/print_item.rs
Manish Goregaokar [Mon, 22 Mar 2021 16:08:52 +0000 (09:08 -0700)]
Update src/librustdoc/html/render/print_item.rs

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agorustdoc: Add setting for hiding large items
Manish Goregaokar [Sun, 21 Mar 2021 02:44:55 +0000 (19:44 -0700)]
rustdoc: Add setting for hiding large items

3 years agorustdoc: smartly hide associated items of traits if there are too many of them
Manish Goregaokar [Sun, 21 Mar 2021 02:39:29 +0000 (19:39 -0700)]
rustdoc: smartly hide associated items of traits if there are too many of them

3 years agorustdoc: hide fields of structs/unions > 5
Manish Goregaokar [Sun, 21 Mar 2021 02:11:49 +0000 (19:11 -0700)]
rustdoc: hide fields of structs/unions > 5

3 years agorustdoc: hide variants of enums > 5
Manish Goregaokar [Sun, 21 Mar 2021 02:02:25 +0000 (19:02 -0700)]
rustdoc: hide variants of enums > 5

3 years agorustdoc: Stop hiding entire item declarations
Manish Goregaokar [Sun, 21 Mar 2021 00:36:19 +0000 (17:36 -0700)]
rustdoc: Stop hiding entire item declarations

3 years agoMark Duration::is_zero as rustc_const_stable.
Mara Bos [Sun, 11 Apr 2021 09:36:35 +0000 (11:36 +0200)]
Mark Duration::is_zero as rustc_const_stable.

3 years agoStabilize duration_zero.
Mara Bos [Sun, 11 Apr 2021 09:24:17 +0000 (11:24 +0200)]
Stabilize duration_zero.

3 years agoupdate RLS and rustfmt
Caleb Cartwright [Sun, 11 Apr 2021 16:42:01 +0000 (11:42 -0500)]
update RLS and rustfmt

3 years agoUpdate stdarch submodule (to before it switched to const generics)
Joshua Nelson [Fri, 2 Apr 2021 08:11:46 +0000 (04:11 -0400)]
Update stdarch submodule (to before it switched to const generics)

This also includes a cherry-pick of
https://github.com/rust-lang/stdarch/commit/ec1461905b421cf0c56adeebb49bbf55bb33fd17
and https://github.com/rust-lang/stdarch/pull/1108 to fix a build
failure.

It also adds a re-export of various macros to the crate root of libstd -
previously they would show up automatically because std_detect was defined
in the same crate.

3 years agoAuto merge of #82300 - andersk:libtest-id, r=Amanieu
bors [Mon, 12 Apr 2021 13:30:30 +0000 (13:30 +0000)]
Auto merge of #82300 - andersk:libtest-id, r=Amanieu

libtest: Index tests by a unique TestId

This more robustly avoids problems with duplicate `TestDesc`. See #81852 and #82274.

Cc `@Mark-Simulacrum.`

3 years agoAuto merge of #84068 - Amanieu:fix_lint, r=lcnr
bors [Mon, 12 Apr 2021 10:49:39 +0000 (10:49 +0000)]
Auto merge of #84068 - Amanieu:fix_lint, r=lcnr

Add `bad_asm_style` to  HardwiredLints

This was missed when the lint was added, which prevents the lint from being ignored with `#[allow]`.

3 years agoAuto merge of #84095 - infinity0:master, r=Mark-Simulacrum
bors [Mon, 12 Apr 2021 08:03:59 +0000 (08:03 +0000)]
Auto merge of #84095 - infinity0:master, r=Mark-Simulacrum

bootstrap: check local_rebuild before adding --cfg=bootstrap, closes #84057

3 years agoStabilize BTree{Map,Set}::retain
Jubilee Young [Mon, 12 Apr 2021 07:01:31 +0000 (00:01 -0700)]
Stabilize BTree{Map,Set}::retain

3 years agoAuto merge of #84090 - marmeladema:stabilize-duration-saturating-ops, r=m-ou-se
bors [Mon, 12 Apr 2021 05:44:25 +0000 (05:44 +0000)]
Auto merge of #84090 - marmeladema:stabilize-duration-saturating-ops, r=m-ou-se

Stabilize feature `duration_saturating_ops`

FCP here: https://github.com/rust-lang/rust/issues/76416#issuecomment-817201314

Closes #76416

r? `@m-ou-se`

3 years agoAuto merge of #84085 - m-ou-se:stabilize-atomic-fetch-update, r=kennytm
bors [Mon, 12 Apr 2021 03:13:33 +0000 (03:13 +0000)]
Auto merge of #84085 - m-ou-se:stabilize-atomic-fetch-update, r=kennytm

Stabilize atomic_fetch_update methods on AtomicBool and AtomicPtr.

FCP completed here: https://github.com/rust-lang/rust/issues/78639#issuecomment-817201315

3 years agoAuto merge of #84112 - Dylan-DPC:rollup-tapsrzz, r=Dylan-DPC
bors [Mon, 12 Apr 2021 00:38:20 +0000 (00:38 +0000)]
Auto merge of #84112 - Dylan-DPC:rollup-tapsrzz, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #83669 (Issue 81508 fix)
 - #84014 (Improve trait/impl method discrepancy errors)
 - #84059 (Bump libc dependency of std to 0.2.93)
 - #84067 (clean up example on read_to_string)
 - #84079 (Improve test for `rustdoc::bare_urls` lint)
 - #84094 (Remove FixedSizeArray)
 - #84101 (rustdoc: Move crate loader to collect_intra_doc_links::early )

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #84101 - jyn514:early-pass, r=Manishearth
Dylan DPC [Sun, 11 Apr 2021 23:04:10 +0000 (01:04 +0200)]
Rollup merge of #84101 - jyn514:early-pass, r=Manishearth

rustdoc: Move crate loader to collect_intra_doc_links::early

This groups the similar code together, and also allows making most of collect_intra_doc_links private again.

This builds on https://github.com/rust-lang/rust/pull/84066, but it wouldn't be too hard to base it off master if you want this to land first.
Helps with https://github.com/rust-lang/rust/issues/83761.

r? manishearth

Fixes https://github.com/rust-lang/rust/issues/84046

3 years agoRollup merge of #84094 - tmiasko:remove-fixed-size-array, r=m-ou-se
Dylan DPC [Sun, 11 Apr 2021 23:04:09 +0000 (01:04 +0200)]
Rollup merge of #84094 - tmiasko:remove-fixed-size-array, r=m-ou-se

Remove FixedSizeArray

Remove `FixedSizeArray` trait, it has been superseded by const generics.

Closes #27778.

3 years agoRollup merge of #84079 - camelid:improve-bare-urls-test, r=jyn514
Dylan DPC [Sun, 11 Apr 2021 23:04:08 +0000 (01:04 +0200)]
Rollup merge of #84079 - camelid:improve-bare-urls-test, r=jyn514

Improve test for `rustdoc::bare_urls` lint

- Rename `url-improvements` test to `bare-urls`
- Run rustfix for `bare-urls` test

3 years agoRollup merge of #84067 - rust-lang:steveklabnik-patch-1, r=joshtriplett
Dylan DPC [Sun, 11 Apr 2021 23:04:07 +0000 (01:04 +0200)]
Rollup merge of #84067 - rust-lang:steveklabnik-patch-1, r=joshtriplett

clean up example on read_to_string

This is the same thing, but simpler.

This came out of a comment from a user: https://news.ycombinator.com/item?id=25318117 but rather than hide the signature of main, I think a `use` plus not including the `'static` makes more sense.

3 years agoRollup merge of #84059 - zvirja:update-libc, r=JohnTitor
Dylan DPC [Sun, 11 Apr 2021 23:04:06 +0000 (01:04 +0200)]
Rollup merge of #84059 - zvirja:update-libc, r=JohnTitor

Bump libc dependency of std to 0.2.93

Update `libc` dependency of `std` to the latest version. That allows to consume the https://github.com/rust-lang/libc/pull/2131 fix and fix build for the `mipsel-unknown-linux-uclibc` target.

r? `@JohnTitor`

3 years agoRollup merge of #84014 - estebank:cool-bears-hot-tip, r=varkor
Dylan DPC [Sun, 11 Apr 2021 23:04:04 +0000 (01:04 +0200)]
Rollup merge of #84014 - estebank:cool-bears-hot-tip, r=varkor

Improve trait/impl method discrepancy errors

* Use more accurate spans
* Clean up some code by removing previous hack
* Provide structured suggestions

Structured suggestions are particularly useful for cases where arbitrary self types are used, like in custom `Future`s, because the way to write `self: Pin<&mut Self>` is not necessarily self-evident when first encountered.

3 years agoRollup merge of #83669 - kwj2104:issue-81508-fix, r=varkor
Dylan DPC [Sun, 11 Apr 2021 23:04:03 +0000 (01:04 +0200)]
Rollup merge of #83669 - kwj2104:issue-81508-fix, r=varkor

Issue 81508 fix

Fix #81508

**Problem**: When variable name is used incorrectly as path, error and warning point to undeclared/unused name, when in fact the name is used, just incorrectly (should be used as a variable, not part of a path).

**Summary for fix**: When path resolution errs, diagnostics checks for variables in ```ValueNS``` that have the same name (e.g., variable rather than path named Foo), and adds additional suggestion that user may actually intend to use the variable name rather than a path.

The fix does not suppress or otherwise change the *warning* that results. I did not find a straightforward way in the code to modify this, but would love to make changes here as well with any guidance.

3 years agodetect when suggested paths enter extern crates more rigorously
SNCPlay42 [Sun, 11 Apr 2021 22:44:54 +0000 (23:44 +0100)]
detect when suggested paths enter extern crates more rigorously

3 years agoAuto merge of #84100 - sjakobi:77548-reenable-check, r=jyn514
bors [Sun, 11 Apr 2021 22:11:31 +0000 (22:11 +0000)]
Auto merge of #84100 - sjakobi:77548-reenable-check, r=jyn514

tidy: Re-enable the "ignoring line length unnecessarily" check

Closes #77548.

3 years agoMove crate loader to collect_intra_doc_links::early
Joshua Nelson [Sun, 11 Apr 2021 13:28:03 +0000 (09:28 -0400)]
Move crate loader to collect_intra_doc_links::early

This groups the similar code together, and also allows making most of collect_intra_doc_links private again

3 years agoAuto merge of #83482 - hyd-dev:uwtable, r=nagisa
bors [Sun, 11 Apr 2021 19:50:19 +0000 (19:50 +0000)]
Auto merge of #83482 - hyd-dev:uwtable, r=nagisa

Allow using `-C force-unwind-tables=no` when `panic=unwind`

It seems LLVM still generates proper unwind tables even there is no `uwtable` attribute, unless I looked at the wrong place :thinking::
https://github.com/llvm/llvm-project/blob/c21016715f0ee4a36affdf7150ac135ca98b0eae/llvm/include/llvm/IR/Function.h#L666

Therefore, I *assume* it's safe to omit `uwtable` even when `panic=unwind`, and this PR removes the restriction that disallows using `-C force-unwind-tables=no` when `panic=unwind`.

3 years agoAdd some #[inline(always)] to arithmetic methods of integers
AngelicosPhosphoros [Sat, 10 Apr 2021 15:48:10 +0000 (18:48 +0300)]
Add some #[inline(always)] to arithmetic methods of integers

I tried to add it only to methods which return results of intrinsics and don't have any branching.
Branching could made performance of debug builds (`-Copt-level=0`) worse.
Main goal of changes is allowing wider optimizations in `-Copt-level=1`.

Closes: https://github.com/rust-lang/rust/issues/75598
3 years agoStabilize nonzero_leading_trailing_zeros
Andreas Jonson [Sun, 11 Apr 2021 17:15:55 +0000 (19:15 +0200)]
Stabilize nonzero_leading_trailing_zeros

3 years agostabilize const_cttz
Andreas Jonson [Sun, 11 Apr 2021 16:38:05 +0000 (18:38 +0200)]
stabilize const_cttz

3 years agotidy: Re-enable the "ignoring file length unnecessarily" check
Simon Jakobi [Sun, 11 Apr 2021 14:38:13 +0000 (16:38 +0200)]
tidy: Re-enable the "ignoring file length unnecessarily" check

Closes #77548.

3 years agoAllow using `-C force-unwind-tables=no` when `panic=unwind`
hyd-dev [Thu, 25 Mar 2021 10:49:35 +0000 (18:49 +0800)]
Allow using `-C force-unwind-tables=no` when `panic=unwind`

3 years agoAdd test to allow bad_asm_style
Amanieu d'Antras [Sun, 11 Apr 2021 14:11:02 +0000 (15:11 +0100)]
Add test to allow bad_asm_style