]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #84064 - hyd-dev:unknown-lints, r=petrochenkov
bors [Sun, 18 Apr 2021 02:12:13 +0000 (02:12 +0000)]
Auto merge of #84064 - hyd-dev:unknown-lints, r=petrochenkov

Do not ignore path segments in the middle in `#[allow]`/`#[warn]`/`#[deny]`/`#[forbid]` attributes

Fixes #83477.

3 years agoAuto merge of #84061 - AngelicosPhosphoros:issue-75598-add-inline-always-arithmetic...
bors [Sat, 17 Apr 2021 23:31:10 +0000 (23:31 +0000)]
Auto merge of #84061 - AngelicosPhosphoros:issue-75598-add-inline-always-arithmetic, r=nagisa

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
r? `@nagisa`

3 years agoAuto merge of #84279 - Dylan-DPC:rollup-k7otd7e, r=Dylan-DPC
bors [Sat, 17 Apr 2021 20:41:37 +0000 (20:41 +0000)]
Auto merge of #84279 - Dylan-DPC:rollup-k7otd7e, r=Dylan-DPC

Rollup of 4 pull requests

Successful merges:

 - #83237 (rustdoc: use more precise relative URLs)
 - #84150 (rustdoc: move some search code into search.js)
 - #84203 (rustdoc: Give a more accurate span for anchor failures)
 - #84257 (Add documentation to help people find `Ipv4Addr::UNSPECIFIED`)

Failed merges:

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

3 years agoRollup merge of #84257 - joshtriplett:inaddr-any, r=m-ou-se
Dylan DPC [Sat, 17 Apr 2021 20:31:34 +0000 (22:31 +0200)]
Rollup merge of #84257 - joshtriplett:inaddr-any, r=m-ou-se

Add documentation to help people find `Ipv4Addr::UNSPECIFIED`

People looking for `INADDR_ANY` don't always find `Ipv4Addr::UNSPECIFIED`;
add some documentation to help.

3 years agoRollup merge of #84203 - jyn514:anchor-span, r=euclio
Dylan DPC [Sat, 17 Apr 2021 20:31:33 +0000 (22:31 +0200)]
Rollup merge of #84203 - jyn514:anchor-span, r=euclio

rustdoc: Give a more accurate span for anchor failures

r? `@euclio`

3 years agoRollup merge of #84150 - jsha:defer-search-js, r=GuillaumeGomez
Dylan DPC [Sat, 17 Apr 2021 20:31:32 +0000 (22:31 +0200)]
Rollup merge of #84150 - jsha:defer-search-js, r=GuillaumeGomez

rustdoc: move some search code into search.js

This reduces main.s from 3094 lines to 1587. Also it saves some bytes
of download in the case where search isn't used.

There were a fair number of variables that needed to be accessible in
both main.js and search.js, but I didn't want to put too many symbols in
the global namespace, so I consolidated much of the search-related
state and functions into a new object `window.searchState`.

Demo at https://hoffman-andrews.com/rust/move-search/std/?search=foo

3 years agoRollup merge of #83237 - notriddle:short-links, r=jyn514
Dylan DPC [Sat, 17 Apr 2021 20:31:31 +0000 (22:31 +0200)]
Rollup merge of #83237 - notriddle:short-links, r=jyn514

rustdoc: use more precise relative URLs

This is a fairly large diff, and will probably conflict with https://github.com/rust-lang/rust/pull/82815 since it reduces (but does not eliminate) the use of the old depth variable.

Instead of using a depth counter and adding "../" to get to the top, this commit makes rustdoc actually compare the path of what it's linking from to the path that it's linking to. This makes the resulting HTML shorter.

Here's a comparison of one of the largest (non-source) files in the Rust standard library docs (about 4% improvement before gzipping).

    $ wc -c struct.Wrapping.old.html struct.Wrapping.new.html
    2387389 struct.Wrapping.old.html
    2298538 struct.Wrapping.new.html

Most if it can be efficiently gzipped away.

    $ wc -c struct.Wrapping.old.html.gz struct.Wrapping.new.html.gz
    70679 struct.Wrapping.old.html.gz
    70050 struct.Wrapping.new.html.gz

But it also makes a difference in the final DOM size, reducing it from 91MiB to 82MiB.

3 years agorustdoc: Give a more accurate span for anchor failures
Joshua Nelson [Wed, 14 Apr 2021 20:59:41 +0000 (16:59 -0400)]
rustdoc: Give a more accurate span for anchor failures

3 years agoAuto merge of #84270 - nagisa:nagisa/bump-llvm, r=cuviper
bors [Sat, 17 Apr 2021 18:10:41 +0000 (18:10 +0000)]
Auto merge of #84270 - nagisa:nagisa/bump-llvm, r=cuviper

Include a backport for wrong DWARF information

A partial fix for #83139

r? `@cuviper` or `@nikic`

3 years agorustdoc: move the cx argument to the end of the list
Michael Howell [Fri, 16 Apr 2021 19:29:35 +0000 (12:29 -0700)]
rustdoc: move the cx argument to the end of the list

This should help make things consistent.

3 years agorustdoc: change 'cx to 'tcx, to match the struct itself
Michael Howell [Fri, 16 Apr 2021 18:21:17 +0000 (11:21 -0700)]
rustdoc: change 'cx to 'tcx, to match the struct itself

3 years agoRemove assert that no longer matters
Michael Howell [Fri, 16 Apr 2021 17:06:48 +0000 (10:06 -0700)]
Remove assert that no longer matters

The function `to_src_with_space` doesn't even accept the cache as a parameter,
so it doesn't matter any more what's in it.

3 years agorustdoc: use more precise relative URLS
Michael Howell [Wed, 17 Mar 2021 18:41:01 +0000 (11:41 -0700)]
rustdoc: use more precise relative URLS

Instead of using a depth counter and adding "../" to get to the top,
this commit makes rustdoc actually compare the path of what it's
linking from to the path that it's linking to. This makes the resulting
HTML shorter.

Here's a comparison of one of the largest (non-source) files in the
Rust standard library docs (about 4% improvement before gzipping).

    $ wc -c struct.Wrapping.old.html struct.Wrapping.new.html
    2387389 struct.Wrapping.old.html
    2298538 struct.Wrapping.new.html

Most if it can be efficiently gzipped away.

    $ wc -c struct.Wrapping.old.html.gz struct.Wrapping.new.html.gz
    70679 struct.Wrapping.old.html.gz
    70050 struct.Wrapping.new.html.gz

But it also makes a difference in the final DOM size, reducing it from 91MiB to 82MiB.

3 years agoAuto merge of #84261 - Aaron1011:error-dup-revisions, r=Mark-Simulacrum
bors [Sat, 17 Apr 2021 15:29:34 +0000 (15:29 +0000)]
Auto merge of #84261 - Aaron1011:error-dup-revisions, r=Mark-Simulacrum

Error when compiletest is passed duplicate revisions

Currently, we allow the user to write things like
'// revisions: rpass1 rpass1', which will not test what they were
intending to test.

3 years agoAuto merge of #84260 - Aaron1011:global-alloc-eval-always, r=cjgillot
bors [Sat, 17 Apr 2021 12:48:50 +0000 (12:48 +0000)]
Auto merge of #84260 - Aaron1011:global-alloc-eval-always, r=cjgillot

Mark `has_global_allocator` query as `eval_always`

Fixes #84252

This query reads from untracked global state in `CStore`.

3 years agoInclude a backport for wrong DWARF information
Simonas Kazlauskas [Sat, 17 Apr 2021 11:53:33 +0000 (14:53 +0300)]
Include a backport for wrong DWARF information

A partial fix for #83139

3 years agoDo not ignore path segments in the middle in `#[allow]`/`#[warn]`/`#[deny]`/`#[forbid...
hyd-dev [Sat, 10 Apr 2021 17:08:31 +0000 (01:08 +0800)]
Do not ignore path segments in the middle in `#[allow]`/`#[warn]`/`#[deny]`/`#[forbid]` attributes

3 years agoAuto merge of #84246 - notriddle:rustdoc-path-printing-cleanup, r=jyn514
bors [Sat, 17 Apr 2021 09:58:27 +0000 (09:58 +0000)]
Auto merge of #84246 - notriddle:rustdoc-path-printing-cleanup, r=jyn514

rustdoc: get rid of unused path printing code

The code for printing a raw path is only used in utils.rs, which only prints the alternative (non-HTML) format. Path has
a function that does the same thing without HTML support, so use that instead.

3 years agoAuto merge of #84244 - ABouttefeux:closure-return-conflict-suggest, r=estebank
bors [Sat, 17 Apr 2021 07:17:31 +0000 (07:17 +0000)]
Auto merge of #84244 - ABouttefeux:closure-return-conflict-suggest, r=estebank

fix incomplete diagnostic notes when closure returns conflicting for genric type

fixes #84128
Correctly report the span on for conflicting return type in closures

3 years agoAuto merge of #84243 - Soveu:fix-derive-macro-const-default, r=petrochenkov
bors [Sat, 17 Apr 2021 04:48:36 +0000 (04:48 +0000)]
Auto merge of #84243 - Soveu:fix-derive-macro-const-default, r=petrochenkov

Builtin derive macros: fix error with const generics default

This fixes a bug where builtin derive macros (like Clone, Debug) would basically copy-paste the default from a const generic, causing a compile error with very confusing message - it would say defaults are not allowed in impl blocks, while pointing at struct/enum/union definition.

3 years agoAuto merge of #84113 - SNCPlay42:suggestion-extern-crate, r=petrochenkov
bors [Sat, 17 Apr 2021 02:23:10 +0000 (02:23 +0000)]
Auto merge of #84113 - SNCPlay42:suggestion-extern-crate, r=petrochenkov

Detect when suggested paths enter extern crates more rigorously

When reporting resolution errors, the compiler tries to avoid suggesting importing inaccessible paths from other crates. However, the search for suggestions only recognized when it was entering a crate root directly, and so failed to recognize a path like `crate::module::private_item`, where `module` was imported from another crate with `use other_crate::module`, as entering another crate.

Fixes #80079
Fixes #84081

3 years agoAuto merge of #84074 - notriddle:rustdoc-macro-visibility, r=jyn514
bors [Fri, 16 Apr 2021 23:41:43 +0000 (23:41 +0000)]
Auto merge of #84074 - notriddle:rustdoc-macro-visibility, r=jyn514

rustdoc: clean up and test macro visibility print

This fixes the overly-complex invariant mentioned in <https://github.com/rust-lang/rust/pull/83237#issuecomment-815346570>, where the macro source can't have any links in it only because the cache hasn't been populated yet.

3 years agoError when compiletest is passed duplicate revisions
Aaron Hill [Fri, 16 Apr 2021 21:05:59 +0000 (17:05 -0400)]
Error when compiletest is passed duplicate revisions

Currently, we allow the user to write things like
'// revisions: rpass1 rpass1', which will not test what they were
intending to test.

3 years agoMark `has_global_allocator` query as `eval_always`
Aaron Hill [Fri, 16 Apr 2021 20:28:54 +0000 (16:28 -0400)]
Mark `has_global_allocator` query as `eval_always`

Fixes #84252

This query reads from untracked global state in `CStore`.

3 years agoAdd documentation to help people find `Ipv4Addr::UNSPECIFIED`
Josh Triplett [Fri, 16 Apr 2021 19:57:20 +0000 (12:57 -0700)]
Add documentation to help people find `Ipv4Addr::UNSPECIFIED`

People looking for `INADDR_ANY` don't always find
`Ipv4Addr::UNSPECIFIED`; add some documentation and an alias to help.

3 years agoAuto merge of #84249 - crlf0710:fix_miri, r=RalfJung
bors [Fri, 16 Apr 2021 19:25:23 +0000 (19:25 +0000)]
Auto merge of #84249 - crlf0710:fix_miri, r=RalfJung

Update miri.

Fixes #84240.

r? `@RalfJung`

3 years agoUpdate miri.
Charles Lew [Fri, 16 Apr 2021 18:22:13 +0000 (02:22 +0800)]
Update miri.

3 years agoAuto merge of #83416 - alexcrichton:const-thread-local, r=sfackler
bors [Fri, 16 Apr 2021 16:36:46 +0000 (16:36 +0000)]
Auto merge of #83416 - alexcrichton:const-thread-local, r=sfackler

std: Add a variant of thread locals with const init

This commit adds a variant of the `thread_local!` macro as a new
`thread_local_const_init!` macro which requires that the initialization
expression is constant (e.g. could be stuck into a `const` if so
desired). This form of thread local allows for a more efficient
implementation of `LocalKey::with` both if the value has a destructor
and if it doesn't. If the value doesn't have a destructor then `with`
should desugar to exactly as-if you use `#[thread_local]` given
sufficient inlining.

The purpose of this new form of thread locals is to precisely be
equivalent to `#[thread_local]` on platforms where possible for values
which fit the bill (those without destructors). This should help close
the gap in performance between `thread_local!`, which is safe, relative
to `#[thread_local]`, which is not easy to use in a portable fashion.

3 years agostd: Add a variant of thread locals with const init
Alex Crichton [Tue, 23 Mar 2021 18:04:29 +0000 (11:04 -0700)]
std: Add a variant of thread locals with const init

This commit adds a variant of the `thread_local!` macro as a new
`thread_local_const_init!` macro which requires that the initialization
expression is constant (e.g. could be stuck into a `const` if so
desired). This form of thread local allows for a more efficient
implementation of `LocalKey::with` both if the value has a destructor
and if it doesn't. If the value doesn't have a destructor then `with`
should desugar to exactly as-if you use `#[thread_local]` given
sufficient inlining.

The purpose of this new form of thread locals is to precisely be
equivalent to `#[thread_local]` on platforms where possible for values
which fit the bill (those without destructors). This should help close
the gap in performance between `thread_local!`, which is safe, relative
to `#[thread_local]`, which is not easy to use in a portable fashion.

3 years agorustdoc: get rid of unused path printing code
Michael Howell [Fri, 16 Apr 2021 15:46:47 +0000 (08:46 -0700)]
rustdoc: get rid of unused path printing code

The code for printing a raw path is only used in utils.rs,
which only prints the alternative (non-HTML) format. Path has
a function that does the same thing without HTML support,
so use that instead.

3 years agofix reporting return type in some cases
Aliénore Bouttefeux [Fri, 16 Apr 2021 15:04:15 +0000 (17:04 +0200)]
fix reporting return type in some cases

3 years agobuiltin derive macros: fix error with const generics default
Soveu [Fri, 16 Apr 2021 14:29:11 +0000 (16:29 +0200)]
builtin derive macros: fix error with const generics default

3 years agoAuto merge of #84241 - Dylan-DPC:rollup-jk9nt6k, r=Dylan-DPC
bors [Fri, 16 Apr 2021 13:46:01 +0000 (13:46 +0000)]
Auto merge of #84241 - Dylan-DPC:rollup-jk9nt6k, r=Dylan-DPC

Rollup of 4 pull requests

Successful merges:

 - #83337 (rustdoc: Hide item contents, not items)
 - #83944 (Fix a couple resolve bugs from binder refactor)
 - #84145 (Address comments for vecdeque_binary_search #78021)
 - #84172 (Compiler error messages: reduce assertiveness of message E0384)

Failed merges:

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

3 years agoRollup merge of #84172 - jayaddison:compiler/E0384-reduce-assertiveness, r=petrochenkov
Dylan DPC [Fri, 16 Apr 2021 12:08:33 +0000 (14:08 +0200)]
Rollup merge of #84172 - jayaddison:compiler/E0384-reduce-assertiveness, r=petrochenkov

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.

Resolves #84144

3 years agoRollup merge of #84145 - vojtechkral:vecdeque-binary-search, r=m-ou-se
Dylan DPC [Fri, 16 Apr 2021 12:08:32 +0000 (14:08 +0200)]
Rollup merge of #84145 - vojtechkral:vecdeque-binary-search, r=m-ou-se

Address comments for vecdeque_binary_search #78021

3 years agoRollup merge of #83944 - jackh726:binder-refactor-fix2, r=lcnr
Dylan DPC [Fri, 16 Apr 2021 12:08:31 +0000 (14:08 +0200)]
Rollup merge of #83944 - jackh726:binder-refactor-fix2, r=lcnr

Fix a couple resolve bugs from binder refactor

Fixes #83753
Fixes #83907

3 years agoRollup merge of #83337 - Manishearth:item-hide, r=GuillaumeGomez
Dylan DPC [Fri, 16 Apr 2021 12:08:30 +0000 (14:08 +0200)]
Rollup merge of #83337 - Manishearth:item-hide, r=GuillaumeGomez

rustdoc: Hide item contents, not items

This tweaks rustdoc to hide item contents instead of items, and only when there are too many of them.

This means that users will _always_ see the type parameters, and will _often_ see fields/etc as long as they are small. Traits have some heuristics for hiding only the methods or only the methods and the consts, since the associated types are super important.

I'm happy to play around with the heuristics here; we could potentially make it so that structs/enums/etc are always hidden but traits will try really hard to show type aliases.

This needs a test, but you can see it rendered at https://manishearth.net/sand/doc_render/bar/

<details>

<summary> Code example </summary>

```rust
pub struct PubStruct {
    pub a: usize,
    pub b: usize,
}

pub struct BigPubStruct {
    pub a: usize,
    pub b: usize,
    pub c: usize,
    pub d: usize,
    pub e: usize,
    pub f: usize,
}

pub union BigUnion {
    pub a: usize,
    pub b: usize,
    pub c: usize,
    pub d: usize,
    pub e: usize,
    pub f: usize,
}

pub union Union {
    pub a: usize,
    pub b: usize,
    pub c: usize,
}

pub struct PrivStruct {
    a: usize,
    b: usize,
}

pub enum Enum {
    A, B, C,
    D {
        a: u8,
        b: u8
    }
}

pub enum LargeEnum {
    A, B, C, D, E, F, G, H, I, J
}

pub trait Trait {
    type A;
    #[must_use]
    fn foo();
    fn bar();
}

pub trait GinormousTrait {
    type A;
    type B;
    type C;
    type D;
    type E;
    type F;
    const N: usize = 1;
    #[must_use]
    fn foo();
    fn bar();
}

pub trait HugeTrait {
    type A;
    const M: usize = 1;
    const N: usize = 1;
    const O: usize = 1;
    const P: usize = 1;
    const Q: usize = 1;
    #[must_use]
    fn foo();
    fn bar();
}

pub trait BigTrait {
    type A;
    #[must_use]
    fn foo();
    fn bar();
    fn baz();
    fn quux();
    fn frob();
    fn greeble();
}

#[macro_export]
macro_rules! foo {
    (a) => {a};
}
```

</details>

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

3 years agoAuto merge of #84230 - cuviper:llvm-12, r=nikic
bors [Fri, 16 Apr 2021 10:55:43 +0000 (10:55 +0000)]
Auto merge of #84230 - cuviper:llvm-12, r=nikic

Update to LLVM 12.0.0 final

3 years agoAuto merge of #84217 - crlf0710:remove_main_attr_pure, r=petrochenkov
bors [Fri, 16 Apr 2021 08:01:45 +0000 (08:01 +0000)]
Auto merge of #84217 - crlf0710:remove_main_attr_pure, r=petrochenkov

Remove #[main] attribute.

This removes the #[main] attribute support from the compiler according to the decisions within #29634. For existing use cases within test harness generation, replaced it with a newly-introduced internal attribute `#[rustc_main]`.

This is first part extracted from #84062 .

Closes #29634.

r? `@petrochenkov`

3 years agoAuto merge of #84228 - SkiFire13:fix-84213, r=estebank
bors [Fri, 16 Apr 2021 05:13:43 +0000 (05:13 +0000)]
Auto merge of #84228 - SkiFire13:fix-84213, r=estebank

Suggest to borrow after failing to cast from T to *const/mut T

Fixes #84213

3 years agoRemove #[main] attribute.
Charles Lew [Thu, 8 Apr 2021 13:37:38 +0000 (21:37 +0800)]
Remove #[main] attribute.

3 years agoAuto merge of #84220 - gpluscb:weak_doc, r=jyn514
bors [Fri, 16 Apr 2021 02:31:15 +0000 (02:31 +0000)]
Auto merge of #84220 - gpluscb:weak_doc, r=jyn514

Correct outdated documentation for rc::Weak

This was overlooked in ~~#50357~~ #51901

3 years agoAuto merge of #84226 - Aaron1011:track-link-dead-code, r=Mark-Simulacrum
bors [Fri, 16 Apr 2021 00:01:49 +0000 (00:01 +0000)]
Auto merge of #84226 - Aaron1011:track-link-dead-code, r=Mark-Simulacrum

Track `-C link-dead-code` during incremental compilation

This option influences monomorphization, which participates in
incremental compilation.

3 years agoUpdate to LLVM 12.0.0 final
Josh Stone [Thu, 15 Apr 2021 22:22:24 +0000 (15:22 -0700)]
Update to LLVM 12.0.0 final

3 years agoAdd regression test
Giacomo Stevanato [Thu, 15 Apr 2021 21:17:44 +0000 (23:17 +0200)]
Add regression test

3 years agoAdd suggestion to borrow when casting T to *const/mut T
Giacomo Stevanato [Thu, 15 Apr 2021 21:17:15 +0000 (23:17 +0200)]
Add suggestion to borrow when casting T to *const/mut T

3 years agoVecDeque: Improve doc comments in binary search fns
Vojtech Kral [Thu, 15 Apr 2021 07:33:46 +0000 (09:33 +0200)]
VecDeque: Improve doc comments in binary search fns

Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
3 years agoVecDeque: Add partition_point() #78021
Vojtech Kral [Sun, 4 Apr 2021 12:50:44 +0000 (14:50 +0200)]
VecDeque: Add partition_point() #78021

3 years agoVecDeque: binary_search_by(): return right away if hit found at back.first() #78021
Vojtech Kral [Mon, 12 Apr 2021 22:10:03 +0000 (00:10 +0200)]
VecDeque: binary_search_by(): return right away if hit found at back.first() #78021

3 years agoAuto merge of #84205 - workingjubilee:more-simd-intrin, r=bjorn3
bors [Thu, 15 Apr 2021 21:00:11 +0000 (21:00 +0000)]
Auto merge of #84205 - workingjubilee:more-simd-intrin, r=bjorn3

Add simd_{round,trunc} intrinsics

LLVM supports many functions from math.h in its IR. Many of these
have SIMD instructions on various platforms. So, let's add round and
trunc so std::arch can use them.

Yes, exact comparison is intentional: rounding must always return a
valid integer-equal value, except for inf/NAN.

3 years agoTrack `-C link-dead-code` during incremental compilation
Aaron Hill [Thu, 15 Apr 2021 19:05:26 +0000 (15:05 -0400)]
Track `-C link-dead-code` during incremental compilation

This option influences monomorphization, which participates in
incremental compilation.

3 years agoAuto merge of #84222 - Aaron1011:fix/anon-const-lint, r=lcnr
bors [Thu, 15 Apr 2021 18:08:17 +0000 (18:08 +0000)]
Auto merge of #84222 - Aaron1011:fix/anon-const-lint, r=lcnr

Run buffered lints attached to anon consts

Fixes #84195

3 years agoAuto merge of #84209 - pickfire:patch-3, r=jyn514
bors [Thu, 15 Apr 2021 15:18:16 +0000 (15:18 +0000)]
Auto merge of #84209 - pickfire:patch-3, r=jyn514

Merge same condition branch in vec spec_extend

Follow up of https://github.com/rust-lang/rust/pull/83726#discussion_r613438246

3 years agoRun buffered lints attached to anon consts
Aaron Hill [Thu, 15 Apr 2021 15:11:44 +0000 (11:11 -0400)]
Run buffered lints attached to anon consts

Fixes #84195

3 years agoCorrect outdated rc::Weak::default documentation
MarRue [Thu, 15 Apr 2021 12:54:39 +0000 (14:54 +0200)]
Correct outdated rc::Weak::default documentation

3 years agoAuto merge of #84088 - m-ou-se:stabilize-option-insert, r=m-ou-se
bors [Thu, 15 Apr 2021 12:37:19 +0000 (12:37 +0000)]
Auto merge of #84088 - m-ou-se:stabilize-option-insert, r=m-ou-se

Stabilize option_insert.

FCP finished here: https://github.com/rust-lang/rust/issues/78271#issuecomment-817201319

3 years agoAuto merge of #84215 - RalfJung:miri, r=RalfJung
bors [Thu, 15 Apr 2021 09:36:48 +0000 (09:36 +0000)]
Auto merge of #84215 - RalfJung:miri, r=RalfJung

update Miri

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

3 years agoupdate Miri
Ralf Jung [Thu, 15 Apr 2021 09:06:06 +0000 (11:06 +0200)]
update Miri

3 years agoAuto merge of #84193 - ehuss:unsafe_op_in_unsafe_fn-docs, r=RalfJung
bors [Thu, 15 Apr 2021 07:11:18 +0000 (07:11 +0000)]
Auto merge of #84193 - ehuss:unsafe_op_in_unsafe_fn-docs, r=RalfJung

Update docs for unsafe_op_in_unsafe_fn stability.

The unsafe_op_in_unsafe_fn lint was stabilized in #79208, but the bottom of this documentation wasn't updated.

I'm just guessing at the reason here, hopefully it is close to correct. The only discussion I found is https://github.com/rust-lang/rust/issues/71668#issuecomment-730399862 which didn't really explain the thought process behind the decision.

3 years agoAuto merge of #84198 - mlodato517:patch-1, r=jyn514
bors [Thu, 15 Apr 2021 04:08:33 +0000 (04:08 +0000)]
Auto merge of #84198 - mlodato517:patch-1, r=jyn514

Fix small typo in Drop documentation

3 years agoMerge same condition branch in vec spec_extend
Ivan Tham [Thu, 15 Apr 2021 03:58:02 +0000 (11:58 +0800)]
Merge same condition branch in vec spec_extend

3 years agoAuto merge of #84206 - Dylan-DPC:rollup-knl2jgq, r=Dylan-DPC
bors [Wed, 14 Apr 2021 23:51:33 +0000 (23:51 +0000)]
Auto merge of #84206 - Dylan-DPC:rollup-knl2jgq, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #82492 (Move `std::sys_common::alloc` to new module `std::sys::common`)
 - #84177 (Fix join_paths error display.)
 - #84185 (add more pat2021 tests)
 - #84191 (Update books)
 - #84192 (Fix typos in rustc_codegen_ssa/src/back/write.rs.)
 - #84196 (:arrow_up: rust-analyzer)
 - #84201 (rustdoc: Note that forbidding anchors in links to primitives is a bug)

Failed merges:

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

3 years agoRollup merge of #84201 - jyn514:primitive-warnings, r=cuviper
Dylan DPC [Wed, 14 Apr 2021 23:27:58 +0000 (01:27 +0200)]
Rollup merge of #84201 - jyn514:primitive-warnings, r=cuviper

rustdoc: Note that forbidding anchors in links to primitives is a bug

cc https://github.com/rust-lang/rust/issues/83083, https://github.com/rust-lang/rust/pull/84147#discussion_r613518820

r? `@cuviper`

3 years agoRollup merge of #84196 - lnicola:rust-analyzer-2021-04-12, r=jonas-schievink
Dylan DPC [Wed, 14 Apr 2021 23:27:57 +0000 (01:27 +0200)]
Rollup merge of #84196 - lnicola:rust-analyzer-2021-04-12, r=jonas-schievink

:arrow_up: rust-analyzer

3 years agoRollup merge of #84192 - vext01:backend-write-typos, r=wesleywiser
Dylan DPC [Wed, 14 Apr 2021 23:27:56 +0000 (01:27 +0200)]
Rollup merge of #84192 - vext01:backend-write-typos, r=wesleywiser

Fix typos in rustc_codegen_ssa/src/back/write.rs.

Just a couple of typos I spotted when reading this comment about the job server.

3 years agoRollup merge of #84191 - ehuss:update-books, r=ehuss
Dylan DPC [Wed, 14 Apr 2021 23:27:55 +0000 (01:27 +0200)]
Rollup merge of #84191 - ehuss:update-books, r=ehuss

Update books

## nomicon

1 commits in 6fe476943afd53a9a6e91f38a6ea7bb48811d8ff..8551afbb2ca6f5ea37fe58380318b209785e4e02
2021-03-10 07:28:57 +0900 to 2021-04-01 21:58:50 +0900
- Add example of thinking about Send/Sync's soundness (rust-lang-nursery/nomicon#259)

## reference

10 commits in fd97729e2d82f8b08d68a31c9bfdf0c37a7fd542..e1abb17cd94cd5a8a374b48e1bc8134a2208ed48
2021-03-28 14:29:19 -0700 to 2021-04-07 08:09:48 -0700
- Update introduction.md (rust-lang-nursery/reference#1004)
- clarify UB for raw ptr deref (rust-lang-nursery/reference#1000)
- Update lint level documentation. (rust-lang-nursery/reference#998)
- Add rustdoc to tool lints. (rust-lang-nursery/reference#997)
- Link to ptr::addr_of on raw pointer docs (rust-lang-nursery/reference#993)
- apply rust-lang-nursery/reference#950 to STYLE.md (rust-lang-nursery/reference#980)
- Tuple Passover rust-lang-nursery/reference#2 (rust-lang-nursery/reference#990)
- Fix typo in macros-by-example.md (rust-lang-nursery/reference#996)
- Clarify object safety rules for methods striked from the vtable (rust-lang-nursery/reference#965)
- Add const generic args to const contexts. (rust-lang-nursery/reference#995)

## rust-by-example

1 commits in 29d91f591c90dd18fdca6d23f1a9caf9c139d0d7..c80f0b09fc15b9251825343be910c08531938ab2
2021-03-23 09:03:39 -0300 to 2021-04-08 10:28:17 -0300
- fix compile bug with panic! (rust-lang/rust-by-example#1433)

## rustc-dev-guide

11 commits in 0687daac28939c476df51778f5a1d1aff1a3fddf..a9bd2bbf31e4f92b5d3d8e80b22839d0cc7a2022
2021-03-28 13:33:56 -0400 to 2021-04-09 18:12:21 -0400
- Improve formatting and update info in "method lookup" section
- Change wording a bit: `module` =&gt; `crate`
- fix typo (rust-lang/rustc-dev-guide#1107)
- fix typo
- Mention CI build of LLVM in build instruction
- Fix rustdocs test command typo (rust-lang/rustc-dev-guide#1103)
- Update the "LLVM updates" section
- Fix a link about Rustdoc internals
- Add quickstart for adding a new optimization (rust-lang/rustc-dev-guide#1094)
- Add back example of {{cwd}} (rust-lang/rustc-dev-guide#1099)
- Document test input normalization

## embedded-book

1 commits in d3f2ace94d51610cf3e3c265705bb8416d37f8e4..569c3391f5c0cc43433bc77831d17f8ff4d76602
2021-03-17 07:53:09 +0000 to 2021-04-07 08:32:11 +0000
- Make it easier to copy and paste example commands.  (rust-embedded/book#289)

3 years agoRollup merge of #84185 - hi-rustin:rustin-patch-macro, r=nikomatsakis
Dylan DPC [Wed, 14 Apr 2021 23:27:54 +0000 (01:27 +0200)]
Rollup merge of #84185 - hi-rustin:rustin-patch-macro, r=nikomatsakis

add more pat2021 tests

close https://github.com/rust-lang/rust/issues/84138

r? ```@nikomatsakis```

3 years agoRollup merge of #84177 - ehuss:join_paths-err, r=kennytm
Dylan DPC [Wed, 14 Apr 2021 23:27:53 +0000 (01:27 +0200)]
Rollup merge of #84177 - ehuss:join_paths-err, r=kennytm

Fix join_paths error display.

On unix, the error from `join_paths` looked like this:

```
path segment contains separator `58`
```

This PR changes it to look like this:

```
path segment contains separator `:`
```

3 years agoRollup merge of #82492 - CDirkx:sys_common_alloc, r=m-ou-se
Dylan DPC [Wed, 14 Apr 2021 23:27:52 +0000 (01:27 +0200)]
Rollup merge of #82492 - CDirkx:sys_common_alloc, r=m-ou-se

Move `std::sys_common::alloc` to new module `std::sys::common`

https://github.com/rust-lang/rust/blob/6b56603e35b39c9f6cc76782330e5e415f9e43d5/library/std/src/sys_common/mod.rs#L7-L13

It was my impression that the goal for `std::sys` has changed from extracting it into a separate crate to making std work with features. However the fact remains that there is a lot of interdependence between `sys` and `sys_common`, this is because `sys_common` contains two types of code:

- abstractions over the different platform implementations in `std::sys` (for example [`std::sys_common::mutex`](https://github.com/rust-lang/rust/blob/master/library/std/src/sys_common/mutex.rs))
- code shared between platforms (for example [`std::sys_common::alloc`](https://github.com/rust-lang/rust/blob/master/library/std/src/sys_common/alloc.rs))

This PR attempts to address this by adding a new module `common` to `std::sys` which will contain code shared between platforms, `alloc.rs` in this case but more can be moved over in the future.

3 years agoAdd more SIMD math.h intrinsics
Jubilee Young [Wed, 14 Apr 2021 22:07:36 +0000 (15:07 -0700)]
Add more SIMD math.h intrinsics

LLVM supports many functions from math.h in its IR. Many of these have
single-instruction variants on various platforms. So, let's add them so
std::arch can use them.

Yes, exact comparison is intentional: rounding must always return a
valid integer-equal value, except for inf/NAN.

3 years agoAuto merge of #84130 - Aaron1011:fix/none-delim-lookahead, r=petrochenkov
bors [Wed, 14 Apr 2021 20:45:23 +0000 (20:45 +0000)]
Auto merge of #84130 - Aaron1011:fix/none-delim-lookahead, r=petrochenkov

Fix lookahead with None-delimited group

Fixes https://github.com/rust-lang/rust/issues/84162, a regression introduced by https://github.com/rust-lang/rust/pull/82608.

3 years agorustdoc: Note that forbidding anchors in links to primitives is a bug
Joshua Nelson [Wed, 14 Apr 2021 20:39:58 +0000 (16:39 -0400)]
rustdoc: Note that forbidding anchors in links to primitives is a bug

3 years agoFix small typo in Drop documentation
Mark Lodato [Wed, 14 Apr 2021 20:05:56 +0000 (16:05 -0400)]
Fix small typo in Drop documentation

3 years agoUpdate comment on search.js static file.
Jacob Hoffman-Andrews [Wed, 14 Apr 2021 19:17:24 +0000 (12:17 -0700)]
Update comment on search.js static file.

3 years agoChange root_path to static_root_path
Jacob Hoffman-Andrews [Wed, 14 Apr 2021 18:56:53 +0000 (11:56 -0700)]
Change root_path to static_root_path

Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
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