]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoAuto merge of #68717 - petrochenkov:stabexpat, r=varkor
bors [Tue, 19 May 2020 03:11:32 +0000 (03:11 +0000)]
Auto merge of #68717 - petrochenkov:stabexpat, r=varkor

Stabilize fn-like proc macros in expression, pattern and statement positions

I.e. all the positions in which stable `macro_rules` macros are supported.

Depends on https://github.com/rust-lang/rust/pull/68716 ("Stabilize `Span::mixed_site`").

cc https://github.com/rust-lang/rust/issues/54727
cc https://github.com/rust-lang/rust/issues/54727#issuecomment-580647446

Stabilization report: https://github.com/rust-lang/rust/pull/68717#issuecomment-623197503.

4 years agoAuto merge of #72330 - Dylan-DPC:rollup-yuxadv8, r=Dylan-DPC
bors [Mon, 18 May 2020 22:50:40 +0000 (22:50 +0000)]
Auto merge of #72330 - Dylan-DPC:rollup-yuxadv8, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #71599 (Support coercion between (FnDef | Closure) and (FnDef | Closure))
 - #71973 (Lazy normalization of constants (Reprise))
 - #72283 (Drop Elaboration Elaboration)
 - #72290 (Add newer rust versions to linker-plugin-lto.md)
 - #72318 (Add help text for remote-test-client)

Failed merges:

r? @ghost

4 years agoAuto merge of #72332 - mati865:ci-fix, r=pietroalbini
bors [Mon, 18 May 2020 18:40:07 +0000 (18:40 +0000)]
Auto merge of #72332 - mati865:ci-fix, r=pietroalbini

CI: Workaround MSYS2 issue

4 years agoUpdate pacman first
Mateusz Mikuła [Mon, 18 May 2020 17:57:18 +0000 (19:57 +0200)]
Update pacman first

4 years agoRollup merge of #72318 - tblah:remote-test-client-doc, r=nikomatsakis
Dylan DPC [Mon, 18 May 2020 17:04:08 +0000 (19:04 +0200)]
Rollup merge of #72318 - tblah:remote-test-client-doc, r=nikomatsakis

Add help text for remote-test-client

Add help text describing the usage of remote-test-client

4 years agoRollup merge of #72290 - elichai:2020-doc-lto, r=wesleywiser
Dylan DPC [Mon, 18 May 2020 17:04:06 +0000 (19:04 +0200)]
Rollup merge of #72290 - elichai:2020-doc-lto, r=wesleywiser

Add newer rust versions to linker-plugin-lto.md

Hi,
This doc got a bit out of date,
it's hosted here: https://doc.rust-lang.org/rustc/linker-plugin-lto.html
you can check the versions I've added via:
```bash
$ rustup install 1.38.0
$ rustc +1.38.0 -vV
rustc 1.38.0 (625451e37 2019-09-23)
binary: rustc
commit-hash: 625451e376bb2e5283fc4741caa0a3e8a2ca4d54
commit-date: 2019-09-23
host: x86_64-unknown-linux-gnu
release: 1.38.0
LLVM version: 9.0

$ rustup install 1.43.1
$ rustc +1.43.1 -vV
rustc 1.43.1 (8d69840ab 2020-05-04)
binary: rustc
commit-hash: 8d69840ab92ea7f4d323420088dd8c9775f180cd
commit-date: 2020-05-04
host: x86_64-unknown-linux-gnu
release: 1.43.1
LLVM version: 9.0
```

4 years agoRollup merge of #72283 - jonas-schievink:elaborate-drop-elaboration, r=cramertj
Dylan DPC [Mon, 18 May 2020 17:04:04 +0000 (19:04 +0200)]
Rollup merge of #72283 - jonas-schievink:elaborate-drop-elaboration, r=cramertj

Drop Elaboration Elaboration

As in, adding more documentation to it.

4 years agoRollup merge of #71973 - lcnr:lazy-norm, r=nikomatsakis
Dylan DPC [Mon, 18 May 2020 17:04:03 +0000 (19:04 +0200)]
Rollup merge of #71973 - lcnr:lazy-norm, r=nikomatsakis

Lazy normalization of constants (Reprise)

Continuation of #67890 by @skinny121.

Initial implementation of #60471 for constants.

Perform normalization/evaluation of constants lazily, which is known as lazy normalization. Lazy normalization is only enabled when using `#![feature(lazy_normalization_consts)]`, by default constants are still evaluated eagerly as there are currently.

Lazy normalization of constants is achieved with a new ConstEquate predicate which type inferences uses to delay checking whether constants are equal to each other until later, avoiding cycle errors.

Note this doesn't allow the use of generics within repeat count expressions as that is still evaluated during conversion to mir. There are also quite a few other known problems with lazy normalization which will be fixed in future PRs.

r? @nikomatsakis

fixes #71922, fixes #71986

4 years agoRollup merge of #71599 - ldm0:fnclo, r=nikomatsakis
Dylan DPC [Mon, 18 May 2020 17:04:01 +0000 (19:04 +0200)]
Rollup merge of #71599 - ldm0:fnclo, r=nikomatsakis

Support coercion between (FnDef | Closure) and (FnDef | Closure)

Fixes #46742, fixes #48109
Inject `Closure` into the `FnDef x FnDef` coercion special case, which makes coercion of `(FnDef | Closure) x (FnDef | Closure)` possible, where closures should be **non-capturing**.

4 years agoAdd remote-test-client help text
Tom Eccles [Mon, 18 May 2020 11:32:58 +0000 (12:32 +0100)]
Add remote-test-client help text

4 years agoAuto merge of #72289 - RalfJung:abort_internal, r=Mark-Simulacrum
bors [Mon, 18 May 2020 11:11:19 +0000 (11:11 +0000)]
Auto merge of #72289 - RalfJung:abort_internal, r=Mark-Simulacrum

abort_internal is safe

`sys::abort_internal` is stably exposed as a safe function. Forward that assumption "inwards" to the `sys` module by making the function itself safe, too.

This corresponds to what https://github.com/rust-lang/rust/pull/72204 did for the intrinsic. We should probably wait until that lands because some of the intrinsic calls in this PR might then need adjustments.

4 years agoAuto merge of #72316 - RalfJung:rollup-70g6bln, r=RalfJung
bors [Mon, 18 May 2020 07:53:03 +0000 (07:53 +0000)]
Auto merge of #72316 - RalfJung:rollup-70g6bln, r=RalfJung

Rollup of 2 pull requests

Successful merges:

 - #72143 (make offset must_use)
 - #72307 (use the new interface to initialize conditional variables)

Failed merges:

r? @ghost

4 years agoRollup merge of #72307 - hermitcore:condvar, r=Mark-Simulacrum
Ralf Jung [Mon, 18 May 2020 06:48:45 +0000 (08:48 +0200)]
Rollup merge of #72307 - hermitcore:condvar, r=Mark-Simulacrum

use the new interface to initialize conditional variables

HermitCore introduce a new interface to intialize conditional variables.
Consequently, minor changes are required to support this interface.

4 years agoRollup merge of #72143 - rust-lang:steveklabnik-must-use, r=sfackler
Ralf Jung [Mon, 18 May 2020 06:48:43 +0000 (08:48 +0200)]
Rollup merge of #72143 - rust-lang:steveklabnik-must-use, r=sfackler

make offset must_use

https://djugei.github.io/bad-at-unsafe/ describes an error a user had when trying to use offset:

> At first I just assumed that the .add() and .offset() methods on pointers would mutate the pointer. They do not. Instead they return a new pointer, which gets dropped silently if you don't use it. Unlike for example Result, which is must_use annotated.

This PR only adds `offset`, because I wanted to float the idea; I'm imagining that there's more than just `add` and `offset` that could use this. I am also very open to re-wording the warning.

r? @rust-lang/libs

4 years agoAuto merge of #72300 - flip1995:clippyup, r=Mark-Simulacrum
bors [Mon, 18 May 2020 04:10:01 +0000 (04:10 +0000)]
Auto merge of #72300 - flip1995:clippyup, r=Mark-Simulacrum

Sync Clippy

cc rust-lang/rust-clippy#5608

Included changes:

- renames/merges of some lints
- ICE fix
- Downgrade useless_let_if_seq to nursery
- FP fixes
- formatting

r? @oli-obk

4 years agoAuto merge of #72269 - RalfJung:unsafe-borrow-of-packed, r=Mark-Simulacrum
bors [Mon, 18 May 2020 00:54:42 +0000 (00:54 +0000)]
Auto merge of #72269 - RalfJung:unsafe-borrow-of-packed, r=Mark-Simulacrum

move borrow-of-packed-field unsafety check out of loop

Looks like during the place refactoring, this code somehow got into this loop even though it does not actually depend on the loop variables.

4 years agominor changes to pass the format check
Stefan Lankes [Sun, 17 May 2020 22:06:32 +0000 (00:06 +0200)]
minor changes to pass the format check

4 years agouse new interface to initialize Condvar
Stefan Lankes [Sun, 17 May 2020 21:49:18 +0000 (23:49 +0200)]
use new interface to initialize Condvar

HermitCore introduce a new interface to intialize conditional variables.
Consequently, minor changes are required to support this interface.

4 years agoabort_internal is safe
Ralf Jung [Sun, 17 May 2020 17:37:44 +0000 (19:37 +0200)]
abort_internal is safe

4 years agoAuto merge of #72248 - petrochenkov:codemodel, r=Amanieu
bors [Sun, 17 May 2020 21:22:48 +0000 (21:22 +0000)]
Auto merge of #72248 - petrochenkov:codemodel, r=Amanieu

Cleanup and document `-C code-model`

r? @Amanieu

4 years agoAuto merge of #72295 - RalfJung:rollup-icmhbs7, r=RalfJung
bors [Sun, 17 May 2020 16:20:19 +0000 (16:20 +0000)]
Auto merge of #72295 - RalfJung:rollup-icmhbs7, r=RalfJung

Rollup of 3 pull requests

Successful merges:

 - #72259 (Disallow forbidden usage of non-ascii identifiers.)
 - #72261 (Break out early on empty span when generate_fn_span)
 - #72291 (bootstrap: fix typo)

Failed merges:

r? @ghost

4 years agoMerge commit 'e214ea82ad0a751563acf67e1cd9279cf302db3a' into clippyup
flip1995 [Sun, 17 May 2020 15:36:26 +0000 (17:36 +0200)]
Merge commit 'e214ea82ad0a751563acf67e1cd9279cf302db3a' into clippyup

4 years agomake many ptr functions must_use
Steve Klabnik [Tue, 12 May 2020 16:41:41 +0000 (11:41 -0500)]
make many ptr functions must_use

https://djugei.github.io/bad-at-unsafe/ describes an error a user had when trying to use offset:

> At first I just assumed that the .add() and .offset() methods on pointers would mutate the pointer. They do not. Instead they return a new pointer, which gets dropped silently if you don't use it. Unlike for example Result, which is must_use annotated.

4 years agoRollup merge of #72291 - RalfJung:format-typo, r=jonas-schievink
Ralf Jung [Sun, 17 May 2020 14:24:29 +0000 (16:24 +0200)]
Rollup merge of #72291 - RalfJung:format-typo, r=jonas-schievink

bootstrap: fix typo

4 years agoRollup merge of #72261 - csmoe:issue-72095, r=estebank
Ralf Jung [Sun, 17 May 2020 14:24:27 +0000 (16:24 +0200)]
Rollup merge of #72261 - csmoe:issue-72095, r=estebank

Break out early on empty span when generate_fn_span

Closes #72095
r? @oli-obk
cc @estebank @tmandry

4 years agoRollup merge of #72259 - crlf0710:ascii_only_check, r=petrochenkov
Ralf Jung [Sun, 17 May 2020 14:24:26 +0000 (16:24 +0200)]
Rollup merge of #72259 - crlf0710:ascii_only_check, r=petrochenkov

Disallow forbidden usage of non-ascii identifiers.

Part of RFC2457, this tightens allowed identifiers back to ascii only in two situations.

r? @petrochenkov

4 years agoAuto merge of #72204 - RalfJung:abort, r=Mark-Simulacrum
bors [Sun, 17 May 2020 12:49:01 +0000 (12:49 +0000)]
Auto merge of #72204 - RalfJung:abort, r=Mark-Simulacrum

make abort intrinsic safe, and correct its documentation

Turns out `std::process::abort` is not the same as the intrinsic, the comment was just wrong. Quoting from the unix implementation:
```
// On Unix-like platforms, libc::abort will unregister signal handlers
// including the SIGABRT handler, preventing the abort from being blocked, and
// fclose streams, with the side effect of flushing them so libc buffered
// output will be printed.  Additionally the shell will generally print a more
// understandable error message like "Abort trap" rather than "Illegal
// instruction" that intrinsics::abort would cause, as intrinsics::abort is
// implemented as an illegal instruction.
```

4 years agoAuto merge of #5568 - ThibsG:RenameIdentityConversionLint, r=flip1995
bors [Sun, 17 May 2020 11:29:04 +0000 (11:29 +0000)]
Auto merge of #5568 - ThibsG:RenameIdentityConversionLint, r=flip1995

Rename lint `identity_conversion` to `useless_conversion`

Lint name `identity_conversion` was misleading, so this PR renames it to `useless_conversion`.

As decision has not really came up in the issue comments, this PR will probably need discussion.

fixes #3106

changelog: Rename lint `identity_conversion` to `useless_conversion`

4 years agoAuto merge of #5529 - alex-700:improve-option-and-then-some-lint, r=phansch
bors [Sun, 17 May 2020 10:58:56 +0000 (10:58 +0000)]
Auto merge of #5529 - alex-700:improve-option-and-then-some-lint, r=phansch

Improve `option_and_then_some` lint

fixed #5492

changelog: Improve and generalize `option_and_then_some` and rename it to `bind_instead_of_map`.

4 years agoupdate tests
Bastian Kauschke [Sun, 17 May 2020 09:42:41 +0000 (11:42 +0200)]
update tests

4 years agobootstrap: fix typo
Ralf Jung [Sun, 17 May 2020 09:40:58 +0000 (11:40 +0200)]
bootstrap: fix typo

4 years agomake abort intrinsic safe, and correct its documentation
Ralf Jung [Sun, 17 May 2020 09:06:59 +0000 (11:06 +0200)]
make abort intrinsic safe, and correct its documentation

4 years agoAuto merge of #72135 - oli-obk:const_prop_deaggregates, r=wesleywiser
bors [Sun, 17 May 2020 09:18:12 +0000 (09:18 +0000)]
Auto merge of #72135 - oli-obk:const_prop_deaggregates, r=wesleywiser

Propagate locals, even if they have unpropagatable assignments somewhere

Second try for https://github.com/rust-lang/rust/pull/71946#discussion_r422967292

r? @wesleywiser

cc @rust-lang/wg-mir-opt @RalfJung

4 years agoimprove and generalize `option_and_then_some` lint
Aleksei Latyshev [Sat, 25 Apr 2020 20:33:11 +0000 (23:33 +0300)]
improve and generalize `option_and_then_some` lint

- rename it to bind_instead_of_map

4 years agoUpdate linker-plugin-lto.md to contain up to rust 1.43
Elichai Turkel [Sun, 17 May 2020 09:16:43 +0000 (12:16 +0300)]
Update linker-plugin-lto.md to contain up to rust 1.43

4 years agoLogically seperate lazy norm from `const_generics`
Bastian Kauschke [Sun, 17 May 2020 08:36:56 +0000 (10:36 +0200)]
Logically seperate lazy norm from `const_generics`

4 years agothe best way to fix bugs is by ignoring them
Bastian Kauschke [Tue, 12 May 2020 08:55:11 +0000 (10:55 +0200)]
the best way to fix bugs is by ignoring them

4 years agochalk
Bastian Kauschke [Tue, 12 May 2020 08:53:20 +0000 (10:53 +0200)]
chalk

4 years agocorrectly handle escaping bound variables
Bastian Kauschke [Fri, 8 May 2020 21:13:49 +0000 (23:13 +0200)]
correctly handle escaping bound variables

4 years agoadd docs
Bastian Kauschke [Fri, 8 May 2020 19:10:33 +0000 (21:10 +0200)]
add docs

4 years agomerge lazy_normalization_consts into const_generics
Bastian Kauschke [Fri, 15 May 2020 14:14:37 +0000 (16:14 +0200)]
merge lazy_normalization_consts into const_generics

4 years agoexplicitly handle errors in `select`
Bastian Kauschke [Thu, 7 May 2020 10:45:15 +0000 (12:45 +0200)]
explicitly handle errors in `select`

4 years agoexplicitly handle errors in fulfill
Bastian Kauschke [Thu, 7 May 2020 08:26:12 +0000 (10:26 +0200)]
explicitly handle errors in fulfill

4 years agoupdate tests and add relevant feature gate test
Bastian Kauschke [Tue, 5 May 2020 20:47:54 +0000 (22:47 +0200)]
update tests and add relevant feature gate test

4 years agokeep the good old lazy_normalization hack alive
Bastian Kauschke [Tue, 5 May 2020 20:47:47 +0000 (22:47 +0200)]
keep the good old lazy_normalization hack alive

4 years agoinitial cleanup
Bastian Kauschke [Tue, 5 May 2020 15:57:23 +0000 (17:57 +0200)]
initial cleanup

4 years agoPut lazy normalization behind a feature gate
Ben Lewis [Sat, 4 Jan 2020 05:54:19 +0000 (18:54 +1300)]
Put lazy normalization behind a feature gate

4 years agoAdd lazy normalization tests
Ben Lewis [Sat, 4 Jan 2020 00:42:02 +0000 (13:42 +1300)]
Add lazy normalization tests

4 years agoEmit `ConstEquate` obligation after checking/unifying for inference variables. This...
Ben Lewis [Thu, 2 Jan 2020 02:41:34 +0000 (15:41 +1300)]
Emit `ConstEquate` obligation after checking/unifying for inference variables. This means
a inference variable can be unified with an unevaluated const.

4 years agoAssume unevaluated consts are equal to the other consts and add ConstEquate obligatio...
Ben Lewis [Fri, 28 Feb 2020 21:03:04 +0000 (10:03 +1300)]
Assume unevaluated consts are equal to the other consts and add ConstEquate obligation. This delays
the need to evaluate consts eagerly and therefore gets around const eval query cycles.

4 years agoAuto merge of #72208 - tmandry:fix-fuchsia-solink, r=Mark-Simulacrum
bors [Sun, 17 May 2020 05:58:54 +0000 (05:58 +0000)]
Auto merge of #72208 - tmandry:fix-fuchsia-solink, r=Mark-Simulacrum

Don't pass --dynamic-linker for Fuchsia dylibs

This was causing a PT_INTERP header in Fuchsia dylibs (implying that
they're executable when they're not).

r? @Mark-Simulacrum
cc @frobtech @petrhosek

4 years agoAuto merge of #5608 - flip1995:rustup, r=phansch
bors [Sun, 17 May 2020 05:41:39 +0000 (05:41 +0000)]
Auto merge of #5608 - flip1995:rustup, r=phansch

Rustup with git subtree

The commits from the last rustup #5587, are again included in this rustup, since I rebased the rustup. Lesson learned: never rebase, only merge when working with git subtree.

changelog: none

4 years agoBless mir-opt tests to account for #72220
Wesley Wiser [Sun, 17 May 2020 02:12:01 +0000 (22:12 -0400)]
Bless mir-opt tests to account for #72220

4 years agoAuto merge of #72286 - Dylan-DPC:rollup-n3rk6df, r=Dylan-DPC
bors [Sun, 17 May 2020 01:31:15 +0000 (01:31 +0000)]
Auto merge of #72286 - Dylan-DPC:rollup-n3rk6df, r=Dylan-DPC

Rollup of 4 pull requests

Successful merges:

 - #72233 (Fix {:#?} representation of proc_macro::Literal)
 - #72277 (emphasize that ManuallyDrop is safe-to-access and unsafe-to-drop)
 - #72281 (Fix whitespace in `?Sized` structured suggestion)
 - #72282 (Fix issue number typo in note)

Failed merges:

r? @ghost

4 years agoRollup merge of #72282 - jonas-schievink:issue-typo, r=Dylan-DPC
Dylan DPC [Sat, 16 May 2020 23:51:35 +0000 (01:51 +0200)]
Rollup merge of #72282 - jonas-schievink:issue-typo, r=Dylan-DPC

Fix issue number typo in note

4 years agoRollup merge of #72281 - estebank:fix-ws-sugg, r=Dylan-DPC
Dylan DPC [Sat, 16 May 2020 23:51:33 +0000 (01:51 +0200)]
Rollup merge of #72281 - estebank:fix-ws-sugg, r=Dylan-DPC

Fix whitespace in `?Sized` structured suggestion

4 years agoRollup merge of #72277 - RalfJung:manually-drop-docs, r=Mark-Simulacrum
Dylan DPC [Sat, 16 May 2020 23:51:31 +0000 (01:51 +0200)]
Rollup merge of #72277 - RalfJung:manually-drop-docs, r=Mark-Simulacrum

emphasize that ManuallyDrop is safe-to-access and unsafe-to-drop

This seems to sometimes confused people, and generally seems reasonable to state in the top-level summary of the type.

4 years agoRollup merge of #72233 - dtolnay:literal, r=petrochenkov
Dylan DPC [Sat, 16 May 2020 23:51:30 +0000 (01:51 +0200)]
Rollup merge of #72233 - dtolnay:literal, r=petrochenkov

Fix {:#?} representation of proc_macro::Literal

Before:

```rust
TokenStream [
    Ident {
        ident: "name",
        span: #0 bytes(37..41),
    },
    Punct {
        ch: '=',
        spacing: Alone,
        span: #0 bytes(42..43),
    },
    Literal { lit: Lit { kind: Str, symbol: "SNPP", suffix: None }, span: Span { lo: BytePos(44), hi: BytePos(50), ctxt: #0 } },
    Punct {
        ch: ',',
        spacing: Alone,
        span: #0 bytes(50..51),
    },
    Ident {
        ident: "owner",
        span: #0 bytes(56..61),
    },
    Punct {
        ch: '=',
        spacing: Alone,
        span: #0 bytes(62..63),
    },
    Literal { lit: Lit { kind: Str, symbol: "Canary M Burns", suffix: None }, span: Span { lo: BytePos(64), hi: BytePos(80), ctxt: #0 } },
]
```

After:

```rust
TokenStream [
    Ident {
        ident: "name",
        span: #0 bytes(37..41),
    },
    Punct {
        ch: '=',
        spacing: Alone,
        span: #0 bytes(42..43),
    },
    Literal {
        kind: Str,
        symbol: "SNPP",
        suffix: None,
        span: #0 bytes(44..50),
    },
    Punct {
        ch: ',',
        spacing: Alone,
        span: #0 bytes(50..51),
    },
    Ident {
        ident: "owner",
        span: #0 bytes(56..61),
    },
    Punct {
        ch: '=',
        spacing: Alone,
        span: #0 bytes(62..63),
    },
    Literal {
        kind: Str,
        symbol: "Canary M Burns",
        suffix: None,
        span: #0 bytes(64..80),
    },
]
```

4 years agoRun fmt
flip1995 [Sat, 16 May 2020 23:18:43 +0000 (01:18 +0200)]
Run fmt

4 years agoRe-remove util/dev
flip1995 [Sat, 16 May 2020 23:14:28 +0000 (01:14 +0200)]
Re-remove util/dev

Maybe someday, git subtree will do it right

4 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Sat, 16 May 2020 23:13:02 +0000 (01:13 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

4 years agoAuto merge of #72178 - tmiasko:inliner-lifetimes, r=nikic
bors [Sat, 16 May 2020 22:16:48 +0000 (22:16 +0000)]
Auto merge of #72178 - tmiasko:inliner-lifetimes, r=nikic

Consistently use LLVM lifetime markers during codegen

Ensure that inliner inserts lifetime markers if they have been emitted during
codegen. Otherwise if allocas from inlined functions are merged together,
lifetime markers from one function might invalidate load & stores performed
by the other one.

Fixes #72154.

4 years agosimplify multispan_sugg interface
Aleksei Latyshev [Sat, 25 Apr 2020 17:52:00 +0000 (20:52 +0300)]
simplify multispan_sugg interface

- add `multispan_sugg_with_applicability`
- not it gets `&str` instead of `String`, like in `diag.multispan_suggestion`

4 years agoImprove documentation for drop elaboration
Jonas Schievink [Sat, 16 May 2020 20:10:05 +0000 (22:10 +0200)]
Improve documentation for drop elaboration

4 years agoRename lint `identity_conversion` to `useless_conversion`
ThibsG [Mon, 4 May 2020 15:09:02 +0000 (17:09 +0200)]
Rename lint `identity_conversion` to `useless_conversion`

4 years agoAuto merge of #5563 - ThibsG:MergeLints, r=flip1995
bors [Sat, 16 May 2020 20:17:11 +0000 (20:17 +0000)]
Auto merge of #5563 - ThibsG:MergeLints, r=flip1995

Merge some lints together

This PR merges following lints:

- `block_in_if_condition_expr` and `block_in_if_condition_stmt` → `blocks_in_if_conditions`
- `option_map_unwrap_or`, `option_map_unwrap_or_else` and `result_map_unwrap_or_else` → `map_unwrap`
- `option_unwrap_used` and `result_unwrap_used` → `unwrap_used`
- `option_expect_used` and `result_expect_used` → `expect_used`
- `wrong_pub_self_convention` into `wrong_self_convention`
- `for_loop_over_option` and `for_loop_over_result` → `for_loops_over_fallibles`

Lints that have already been merged since the issue was created:
- [x] `new_without_default` and `new_without_default_derive` → `new_without_default`

Need more discussion:
- `string_add` and `string_add_assign`: do we agree to merge them or not? Is there something more to do? → **not merge finally**
- `identity_op` and `modulo_one` → `useless_arithmetic`: seems outdated, since `modulo_arithmetic` has been created.

fixes #1078

changelog: Merging some lints together:
- `block_in_if_condition_expr` and `block_in_if_condition_stmt` → `blocks_in_if_conditions`
- `option_map_unwrap_or`, `option_map_unwrap_or_else` and `result_map_unwrap_or_else` → `map_unwrap_or`
- `option_unwrap_used` and `result_unwrap_used` → `unwrap_used`
- `option_expect_used` and `result_expect_used` → `expect_used`
- `for_loop_over_option` and `for_loop_over_result` → `for_loops_over_fallibles`

4 years agoFix issue number typo in note
Jonas Schievink [Sat, 16 May 2020 20:10:28 +0000 (22:10 +0200)]
Fix issue number typo in note

4 years agoFix whitespace in `?Sized` structured suggestion
Esteban Küber [Sat, 16 May 2020 19:56:21 +0000 (12:56 -0700)]
Fix whitespace in `?Sized` structured suggestion

4 years agoemphasize that ManuallyDrop is safe-to-access and unsafe-to-drop
Ralf Jung [Sat, 16 May 2020 09:14:00 +0000 (11:14 +0200)]
emphasize that ManuallyDrop is safe-to-access and unsafe-to-drop

4 years agoAuto merge of #72276 - RalfJung:rollup-nkfu3is, r=RalfJung
bors [Sat, 16 May 2020 17:47:21 +0000 (17:47 +0000)]
Auto merge of #72276 - RalfJung:rollup-nkfu3is, r=RalfJung

Rollup of 5 pull requests

Successful merges:

 - #72045 (Incomplete features can also be unsound)
 - #72047 (Literal error reporting cleanup)
 - #72060 (move `ty::List` into a new submodule)
 - #72094 (cmdline: Make target features individually overridable)
 - #72254 (Remove redundant backtick in error message.)

Failed merges:

r? @ghost

4 years agoRollup merge of #72254 - ehuss:double-backtick, r=dtolnay
Ralf Jung [Sat, 16 May 2020 17:46:37 +0000 (19:46 +0200)]
Rollup merge of #72254 - ehuss:double-backtick, r=dtolnay

Remove redundant backtick in error message.

The value passed in already has backticks surrounding the text.

4 years agoRollup merge of #72094 - petrochenkov:overfeature, r=nikic
Ralf Jung [Sat, 16 May 2020 17:46:36 +0000 (19:46 +0200)]
Rollup merge of #72094 - petrochenkov:overfeature, r=nikic

cmdline: Make target features individually overridable

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

Previously `-C target-feature=+avx2 -C target-feature=+fma` was equivalent to `-C target-feature=+fma` because the later `-C target-feature` option fully overridden previous `-C target-feature`.
With this PR `-C target-feature=+avx2 -C target-feature=+fma` is equivalent to `-C target-feature=+avx2,+fma` and the options are combined.

I'm not sure where the comma-separated features in a single option came from (clang uses a scheme with single feature per-option), but logically these features are entirely independent options.
So they should be overridable individually as well to be more useful in hierarchical build system, and more consistent with other rustc options and clang behavior as well.

Target feature options have a few other issues (https://github.com/rust-lang/rust/issues/44815), but fixing those is going to be a bit more invasive.

4 years agoRollup merge of #72060 - lcnr:move-list, r=estebank
Ralf Jung [Sat, 16 May 2020 17:46:34 +0000 (19:46 +0200)]
Rollup merge of #72060 - lcnr:move-list, r=estebank

move `ty::List` into a new submodule

`rustc_middle/ty` is currently right below the 3000 lines tidy file length limit.

Moves `rustc_middle::ty::List` to the private module `rustc_middle::ty::list` and adds
a `pub use self::list::List` at its previous location.

4 years agoRollup merge of #72047 - Julian-Wollersberger:literal_error_reporting_cleanup, r...
Ralf Jung [Sat, 16 May 2020 17:46:31 +0000 (19:46 +0200)]
Rollup merge of #72047 - Julian-Wollersberger:literal_error_reporting_cleanup, r=petrochenkov

Literal error reporting cleanup

While doing some performance work, I noticed some code duplication in `librustc_parser/lexer/mod.rs`, so I cleaned it up.

This PR is probably best reviewed commit by commit.

I'm not sure what the API stability practices for `librustc_lexer` are. Four public methods in `unescape.rs` can be removed, but two are used by clippy, so I left them in for now.
I could open a PR for Rust-Analyzer when this one lands.

But how do I open a PR for clippy? (Git submodules are frustrating to work with)

4 years agoRollup merge of #72047 - Julian-Wollersberger:literal_error_reporting_cleanup, r...
Ralf Jung [Sat, 16 May 2020 17:46:31 +0000 (19:46 +0200)]
Rollup merge of #72047 - Julian-Wollersberger:literal_error_reporting_cleanup, r=petrochenkov

Literal error reporting cleanup

While doing some performance work, I noticed some code duplication in `librustc_parser/lexer/mod.rs`, so I cleaned it up.

This PR is probably best reviewed commit by commit.

I'm not sure what the API stability practices for `librustc_lexer` are. Four public methods in `unescape.rs` can be removed, but two are used by clippy, so I left them in for now.
I could open a PR for Rust-Analyzer when this one lands.

But how do I open a PR for clippy? (Git submodules are frustrating to work with)

4 years agoRollup merge of #72045 - RalfJung:incomplete-unsound, r=petrochenkov
Ralf Jung [Sat, 16 May 2020 17:46:29 +0000 (19:46 +0200)]
Rollup merge of #72045 - RalfJung:incomplete-unsound, r=petrochenkov

Incomplete features can also be unsound

Some incomplete features do not just ICE, they are also currently unsound (e.g. https://github.com/rust-lang/rust/pull/72029, and also `specialization` -- which is not yet marked incomplete but [should be](https://github.com/rust-lang/rust/pull/71420)). This makes the message reflect that.

While at it I also added a link to the tracking issue, which hopefully should explain what is incomplete/unsound about the feature.

4 years agoDisallow forbidden usage of non-ascii identifiers.
Charles Lew [Sat, 16 May 2020 06:09:01 +0000 (14:09 +0800)]
Disallow forbidden usage of non-ascii identifiers.

4 years agoAuto merge of #72262 - Dylan-DPC:rollup-x56q1jj, r=Dylan-DPC
bors [Sat, 16 May 2020 14:15:18 +0000 (14:15 +0000)]
Auto merge of #72262 - Dylan-DPC:rollup-x56q1jj, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #71625 (Improve the documentation for ManuallyDrop to resolve conflicting usage of terminology)
 - #71919 (Update transitive dependency to work towards removing syn <1.0 dep)
 - #72166 (Simpler slice `Iterator` methods)
 - #72216 (Remove `lang_items\(\).*\.unwrap\(\)`)
 - #72230 (Updated documentation of Prefix::VerbatimDisk)
 - #72234 (Implement Default for proc_macro::TokenStream)
 - #72258 (Fix typo Arbintrary to Arbitrary)

Failed merges:

r? @ghost

4 years agomove borrow-of-packed-field unsafety check out of loop
Ralf Jung [Sat, 16 May 2020 14:04:31 +0000 (16:04 +0200)]
move borrow-of-packed-field unsafety check out of loop

4 years agoRollup merge of #72258 - Rustin-Liu:rustin-patch-typo, r=dtolnay
Dylan DPC [Sat, 16 May 2020 10:43:08 +0000 (12:43 +0200)]
Rollup merge of #72258 - Rustin-Liu:rustin-patch-typo, r=dtolnay

Fix typo Arbintrary to Arbitrary

Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
Closes #72122.

4 years agoRollup merge of #72234 - dtolnay:default, r=petrochenkov
Dylan DPC [Sat, 16 May 2020 10:43:06 +0000 (12:43 +0200)]
Rollup merge of #72234 - dtolnay:default, r=petrochenkov

Implement Default for proc_macro::TokenStream

Hopefully this is uncontroversial. The only reason we've made it this far without is that proc-macro2 snuck this in for their TokenStream.

4 years agoRollup merge of #72230 - SOF3:patch-1, r=kennytm
Dylan DPC [Sat, 16 May 2020 10:43:05 +0000 (12:43 +0200)]
Rollup merge of #72230 - SOF3:patch-1, r=kennytm

Updated documentation of Prefix::VerbatimDisk

PrefixComponent with Prefix::VerbatimDisk does not contain the trailing slash. The documentation here is also inconsistent with the documentation on other variants that reflect the `PrefixComponent::as_os_str()` return value.

4 years agoRollup merge of #72216 - doctorn:require-lang-item, r=lcnr
Dylan DPC [Sat, 16 May 2020 10:43:03 +0000 (12:43 +0200)]
Rollup merge of #72216 - doctorn:require-lang-item, r=lcnr

Remove `lang_items\(\).*\.unwrap\(\)`

Follows up #72170 to remove the remaining uses of `lang_items\(\).*\.unwrap\(\)` (avoids a bunch of potential ICEs when working in `#![no_core]`).

Resolves #72195

4 years agoRollup merge of #72166 - nnethercote:simpler-slice-Iterator-methods, r=cuviper
Dylan DPC [Sat, 16 May 2020 10:43:01 +0000 (12:43 +0200)]
Rollup merge of #72166 - nnethercote:simpler-slice-Iterator-methods, r=cuviper

Simpler slice `Iterator` methods

These reduce the amount of LLVM IR generated, helping compile times.

r? @cuviper

4 years agoRollup merge of #71919 - Xanewok:bump-syn-1, r=Xanewok
Dylan DPC [Sat, 16 May 2020 10:42:59 +0000 (12:42 +0200)]
Rollup merge of #71919 - Xanewok:bump-syn-1, r=Xanewok

Update transitive dependency to work towards removing syn <1.0 dep

This bumps a couple of transitive dependencies in hopes of eventually not transitively depending on syn <1.0 and friends. The only upstream changes that this is blocked on seems to be https://github.com/mattico/elasticlunr-rs/pull/27 and https://github.com/rust-lang/mdBook/pull/1210.

While working on https://github.com/rust-lang/rust/pull/71875 I noticed we still use syn 0.15 here and there so this is a drive-by PR which aims to help with things a bit.

4 years agoRollup merge of #71625 - Diggsey:improve-manually-drop-docs, r=RalfJung
Dylan DPC [Sat, 16 May 2020 10:42:55 +0000 (12:42 +0200)]
Rollup merge of #71625 - Diggsey:improve-manually-drop-docs, r=RalfJung

Improve the documentation for ManuallyDrop to resolve conflicting usage of terminology

cc @RalfJung

Follow-up from https://github.com/rust-lang/unsafe-code-guidelines/issues/233

4 years agoAuto merge of #71872 - nnethercote:less-aggressive-arena-growth, r=oli-obk
bors [Sat, 16 May 2020 10:32:46 +0000 (10:32 +0000)]
Auto merge of #71872 - nnethercote:less-aggressive-arena-growth, r=oli-obk

Be less aggressive with `DroplessArena`/`TypedArena` growth.

`DroplessArena` and `TypedArena` use an aggressive growth strategy: the first chunk is 4 KiB, the second is 8 KiB, and it keeps on doubling indefinitely. DHAT profiles show that sometimes this results in large chunks (e.g. 16-128 MiB) that are barely filled.

This commit changes things so that the doubling stops at 2 MiB. This is large enough that chunk allocations are still rare (you might get 100s instead of 10s of them) but avoids lots of unused space in the worst case. It makes the same change to `TypedArena`, too.

4 years agobreak out earlier on empty snippet
csmoe [Sat, 16 May 2020 10:29:46 +0000 (18:29 +0800)]
break out earlier on empty snippet

4 years agorustc-book: Document `-C code-model`
Vadim Petrochenkov [Sat, 16 May 2020 09:02:16 +0000 (12:02 +0300)]
rustc-book: Document `-C code-model`

4 years agorustc_target: Stop using "string typing" for code models
Vadim Petrochenkov [Thu, 7 May 2020 00:34:27 +0000 (03:34 +0300)]
rustc_target: Stop using "string typing" for code models

Introduce `enum CodeModel` instead.

4 years agoAuto merge of #5596 - ebroto:issue_5212, r=phansch
bors [Sat, 16 May 2020 08:49:15 +0000 (08:49 +0000)]
Auto merge of #5596 - ebroto:issue_5212, r=phansch

Fix comparison_chain false positive

changelog: comparison_chain: fix false positives when the binary operation is the same.

Fixes #5212

4 years agoAuto merge of #5602 - ebroto:issue_3430, r=phansch
bors [Sat, 16 May 2020 08:33:47 +0000 (08:33 +0000)]
Auto merge of #5602 - ebroto:issue_3430, r=phansch

identity_op: allow `1 << 0`

I went for accepting `1 << 0` verbatim instead of something more general as it seems to be what everyone in the issue thread needed.

changelog: identity_op: allow `1 << 0` as it's a common pattern in bit manipulation code.

Fixes #3430

4 years agoAuto merge of #71665 - RalfJung:miri-intern-no-ice, r=oli-obk
bors [Sat, 16 May 2020 07:14:52 +0000 (07:14 +0000)]
Auto merge of #71665 - RalfJung:miri-intern-no-ice, r=oli-obk

Miri interning: replace ICEs by proper errors

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

I also did some refactoring, as I kept being confused by all the parameters to `intern_shallow`, some of which have invalid combinations (such as a mutable const). So instead `InternMode` now contains all the information that is needed and invalid combinations are ruled out by the type system.

Also I removed interpreter errors from interning. We already ignored almost all errors, and the `ValidationFailure` errors that we handled separately actually cannot ever happen here. The only interpreter failure that was actually reachable was the UB on dangling pointers -- and arguably, a dangling raw pointer is not UB, so the error was not even correct. It's just that the rest of the compiler does not like "dangling" `AllocId`.

It should be possible to review the 3 commits separately.

r? @oli-obk
Cc @rust-lang/wg-const-eval

4 years agoFix typo Arbintrary to Arbitrary
Rustin-Liu [Sat, 16 May 2020 06:40:45 +0000 (14:40 +0800)]
Fix typo Arbintrary to Arbitrary

Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
4 years agoAuto merge of #72079 - semarie:openbsd-stacker, r=Mark-Simulacrum
bors [Sat, 16 May 2020 03:55:49 +0000 (03:55 +0000)]
Auto merge of #72079 - semarie:openbsd-stacker, r=Mark-Simulacrum

update stacker to 0.1.9 to unbreak build on OpenBSD

the version 0.1.8 of stacker (what is currently pinned in Cargo.lock) doesn't build on OpenBSD (see https://github.com/rust-lang/stacker/pull/34).

update the version to 0.1.9

4 years agoRemove redundant backtick in error message.
Eric Huss [Sat, 16 May 2020 03:51:12 +0000 (20:51 -0700)]
Remove redundant backtick in error message.

The value passed in already has backticks surrounding the text.

4 years agoAuto merge of #72251 - Dylan-DPC:rollup-4mik3o7, r=Dylan-DPC
bors [Sat, 16 May 2020 00:44:57 +0000 (00:44 +0000)]
Auto merge of #72251 - Dylan-DPC:rollup-4mik3o7, r=Dylan-DPC

Rollup of 9 pull requests

Successful merges:

 - #71662 (Implement FromStr for OsString)
 - #71677 (Add explicit references to the BuildHasher trait)
 - #71724 (Doc alias improvements)
 - #71948 (Suggest to await future before ? operator)
 - #72090 (rustc_driver: factor out computing the exit code)
 - #72206 (Cleanup stale 'FIXME(#64197)')
 - #72218 (make sure even unleashed miri does not do pointer stuff)
 - #72220 ([const-prop] Don't replace Rvalues that are already constants)
 - #72224 (doc: add links to rotate_(left|right))

Failed merges:

r? @ghost

4 years agoRollup merge of #72224 - lzutao:links, r=Dylan-DPC
Dylan DPC [Sat, 16 May 2020 00:37:29 +0000 (02:37 +0200)]
Rollup merge of #72224 - lzutao:links, r=Dylan-DPC

doc: add links to rotate_(left|right)

4 years agoRollup merge of #72220 - wesleywiser:const_prop_eval_consts, r=oli-obk
Dylan DPC [Sat, 16 May 2020 00:37:28 +0000 (02:37 +0200)]
Rollup merge of #72220 - wesleywiser:const_prop_eval_consts, r=oli-obk

[const-prop] Don't replace Rvalues that are already constants

This cleans up a few mir-opt tests which have slight changes to spans for `consts` as a result of replacing them with new Rvalues.

4 years agoRollup merge of #72218 - RalfJung:test-unleashed-ptrs, r=oli-obk
Dylan DPC [Sat, 16 May 2020 00:37:26 +0000 (02:37 +0200)]
Rollup merge of #72218 - RalfJung:test-unleashed-ptrs, r=oli-obk

make sure even unleashed miri does not do pointer stuff

r? @oli-obk