]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoExpand `NtExpr` tokens only in key-value attributes
Vadim Petrochenkov [Sun, 27 Sep 2020 13:52:51 +0000 (16:52 +0300)]
Expand `NtExpr` tokens only in key-value attributes

3 years agoadd blacklist for unsupported calling conventions
Stephan [Mon, 2 Nov 2020 21:52:47 +0000 (22:52 +0100)]
add blacklist for unsupported calling conventions

3 years agoaddressed feedback
Rich Kadel [Mon, 2 Nov 2020 19:59:24 +0000 (11:59 -0800)]
addressed feedback

3 years agoUse reparsed `TokenStream` if we captured any inner attributes
Aaron Hill [Mon, 2 Nov 2020 18:22:03 +0000 (13:22 -0500)]
Use reparsed `TokenStream` if we captured any inner attributes

Fixes #78675

We now bail out of `prepend_attrs` if we ended up capturing any inner
attributes (which can happen in several places, due to token capturing
for `macro_rules!` arguments.

3 years agoMerge pull request #1105 from bjorn3/test_rustc_bootstrapping
bjorn3 [Mon, 2 Nov 2020 18:14:50 +0000 (19:14 +0100)]
Merge pull request #1105 from bjorn3/test_rustc_bootstrapping

Test bootstrapping of rustc using cg_clif

3 years agoadd mipsel_unknown_none target
Stephan [Mon, 2 Nov 2020 18:11:24 +0000 (19:11 +0100)]
add mipsel_unknown_none target

3 years agoTreat trailing semicolon as a statement in macro call
Aaron Hill [Sun, 25 Oct 2020 21:14:19 +0000 (17:14 -0400)]
Treat trailing semicolon as a statement in macro call

See https://github.com/rust-lang/rust/issues/61733#issuecomment-716188981

We now preserve the trailing semicolon in a macro invocation, even if
the macro expands to nothing. As a result, the following code no longer
compiles:

```rust
macro_rules! empty {
    () => { }
}

fn foo() -> bool { //~ ERROR mismatched
    { true } //~ ERROR mismatched
    empty!();
}
```

Previously, `{ true }` would be considered the trailing expression, even
though there's a semicolon in `empty!();`

This makes macro expansion more token-based.

3 years agoTest bootstrapping of rustc using cg_clif
bjorn3 [Sun, 1 Nov 2020 15:57:14 +0000 (16:57 +0100)]
Test bootstrapping of rustc using cg_clif

3 years agoRevert unintentional change
bjorn3 [Mon, 2 Nov 2020 17:54:10 +0000 (18:54 +0100)]
Revert unintentional change

3 years agoMerge pull request #1104 from bjorn3/build_system_refactor
bjorn3 [Mon, 2 Nov 2020 17:46:36 +0000 (18:46 +0100)]
Merge pull request #1104 from bjorn3/build_system_refactor

Build system refactor

3 years agoUpload prebuilt cg_clif
bjorn3 [Mon, 2 Nov 2020 17:24:21 +0000 (18:24 +0100)]
Upload prebuilt cg_clif

3 years agoRefactor the build system
bjorn3 [Mon, 2 Nov 2020 17:16:57 +0000 (18:16 +0100)]
Refactor the build system

3 years agoAuto merge of #78607 - HeroicKatora:post-order-walk-iter, r=davidtwco
bors [Mon, 2 Nov 2020 16:01:10 +0000 (16:01 +0000)]
Auto merge of #78607 - HeroicKatora:post-order-walk-iter, r=davidtwco

Transform post order walk to an iterative approach

The previous recursive approach might overflow the stack when walking a
particularly deep, list-like, graph. In particular, dominator
calculation for borrow checking does such a traversal and very long
functions might lead to a region dependency graph with in this
problematic structure.

This addresses what appears to be the cause of #78567 (`@SunHao-0` thanks for the stack trace).

3 years agoAuto merge of #78667 - pietroalbini:lldb-unbuffered, r=Mark-Simulacrum
bors [Mon, 2 Nov 2020 13:07:01 +0000 (13:07 +0000)]
Auto merge of #78667 - pietroalbini:lldb-unbuffered, r=Mark-Simulacrum

Try running lldb_batchmode.py with PYTHONUNBUFFERED

When reporting fatal errors, LLVM calls abort() to exit the program. There is a chance that might interfere with Python printing stuff to stdout, as by default it relies on buffering to increase performance.

This commit tries to disable Python buffering, to hopefully get useful logs while debugging #78665.

3 years agoImprove deprecation attribute diagnostic messages.
Mara Bos [Mon, 2 Nov 2020 12:17:14 +0000 (13:17 +0100)]
Improve deprecation attribute diagnostic messages.

(From the PR feedback.)

Co-authored-by: Esteban Küber <esteban@kuber.com.ar>
3 years agocompiletest: try running lldb_batchmode.py with PYTHONUNBUFFERED
Pietro Albini [Mon, 2 Nov 2020 12:20:16 +0000 (13:20 +0100)]
compiletest: try running lldb_batchmode.py with PYTHONUNBUFFERED

When reporting fatal errors, LLVM calls abort() to exit the program.
There is a chance that might interfere with Python printing stuff to
stdout, as by default it relies on buffering to increase performance.

This commit tries to disable Python buffering, to hopefully get useful
logs while debugging #78665.

3 years agoAuto merge of #78661 - JohnTitor:rollup-er2isja, r=JohnTitor
bors [Mon, 2 Nov 2020 10:42:45 +0000 (10:42 +0000)]
Auto merge of #78661 - JohnTitor:rollup-er2isja, r=JohnTitor

Rollup of 5 pull requests

Successful merges:

 - #78606 (Clarify handling of final line ending in str::lines())
 - #78610 (Do not remove tokens before AST json serialization)
 - #78620 (Trivial fixes to bitwise operator documentation)
 - #78627 (Point out that total_cmp is no strict superset of partial comparison)
 - #78637 (Add fetch_update methods to AtomicBool and AtomicPtr)

Failed merges:

r? `@ghost`

3 years agoAuto merge of #75020 - JohnTitor:fix-multispan, r=estebank,tmandry
bors [Mon, 2 Nov 2020 08:17:36 +0000 (08:17 +0000)]
Auto merge of #75020 - JohnTitor:fix-multispan, r=estebank,tmandry

Avoid complex diagnostics in snippets which contain newlines

Fixes #70935

r? `@estebank` `@tmandry`

3 years agoFix intrinsic size_of stable link
Ivan Tham [Mon, 2 Nov 2020 08:03:23 +0000 (16:03 +0800)]
Fix intrinsic size_of stable link

I noticed that it is pointing to the same link when I was reading
https://github.com/rust-lang/rust-clippy/issues/2997

3 years agoFix format
Yuki Okushi [Mon, 2 Nov 2020 07:59:11 +0000 (16:59 +0900)]
Fix format

3 years agoOnly separate notes if span is multiline
Yuki Okushi [Mon, 2 Nov 2020 07:54:53 +0000 (16:54 +0900)]
Only separate notes if span is multiline

3 years agoAdd "this has type `{}` which {}" note
Yuki Okushi [Thu, 22 Oct 2020 05:15:40 +0000 (14:15 +0900)]
Add "this has type `{}` which {}" note

3 years agoAddress some code reviews
Yuki Okushi [Sat, 10 Oct 2020 19:48:17 +0000 (04:48 +0900)]
Address some code reviews

3 years agoSeparate complex multispan into some notes
Yuki Okushi [Sat, 10 Oct 2020 18:05:57 +0000 (03:05 +0900)]
Separate complex multispan into some notes

3 years agoAvoid complex diagnostics in snippets which contain newlines
Yuki Okushi [Sat, 1 Aug 2020 16:29:21 +0000 (01:29 +0900)]
Avoid complex diagnostics in snippets which contain newlines

3 years agoFix ICE when a future-incompat-report has its command-line level capped
Aaron Hill [Mon, 2 Nov 2020 06:37:26 +0000 (01:37 -0500)]
Fix ICE when a future-incompat-report has its command-line level capped

Fixes #78660

With PR https://github.com/rust-lang/rust/pull/75534 merged, we now run
more lint-related code for future-incompat-report, even when their final
level is Allow. Some lint-related code was not expecting `Level::Allow`,
and had an explicit panic.

This PR explicitly tracks the lint level set on the command line before
`--cap-lints` is applied. This is used to emit a more precise error
note (e.g. we don't say that `-W lint-name` was specified on the
command line just because a lint was capped to Warn). As a result, we
can now correctly emit a note that `-A` was used if we got
`Level::Allow` from the command line (before the cap is applied).

3 years agoProvide diagnostic suggestion in ExprUseVisitor Delegate
Dhruv Jauhar [Sun, 1 Nov 2020 07:15:22 +0000 (02:15 -0500)]
Provide diagnostic suggestion in ExprUseVisitor Delegate

The [Delegate
trait](https://github.com/rust-lang/rust/blob/981346fc07dd5ef414c5b1b21999f7604cece006/compiler/rustc_typeck/src/expr_use_visitor.rs#L28-L38)
currently use `PlaceWithHirId` which is composed of Hir `Place` and the
corresponding expression id.

Even though this is an accurate way of expressing how a Place is used,
it can cause confusion during diagnostics.

Eg:

```
let arr : [String; 5];

let [a, ...]     =   arr;
 ^^^ E1 ^^^      =  ^^E2^^
 ```

 Here `arr` is moved because of the binding created E1. However, when we
 point to E1 in diagnostics with the message `arr` was moved, it can be
 confusing.  Rather we would like to report E2 to the user.

Closes: https://github.com/rust-lang/project-rfc-2229/issues/20
3 years agoRollup merge of #78637 - mystor:atomic_ptr_bool, r=m-ou-se
Yuki Okushi [Mon, 2 Nov 2020 05:14:41 +0000 (14:14 +0900)]
Rollup merge of #78637 - mystor:atomic_ptr_bool, r=m-ou-se

Add fetch_update methods to AtomicBool and AtomicPtr

These methods were stabilized for the integer atomics in #71843, but the methods were not added for the non-integer atomics `AtomicBool` and `AtomicPtr`.

3 years agoRollup merge of #78627 - est31:total_cmp_no_superset, r=m-ou-se
Yuki Okushi [Mon, 2 Nov 2020 05:14:38 +0000 (14:14 +0900)]
Rollup merge of #78627 - est31:total_cmp_no_superset, r=m-ou-se

Point out that total_cmp is no strict superset of partial comparison

Partial comparison and total_cmp are not equal. This helps
preventing the mistake of creating float wrappers that
base their Ord impl on total_cmp and their PartialOrd impl on
the PartialOrd impl of the float type. PartialOrd and Ord
[are required to agree with each other](https://doc.rust-lang.org/std/cmp/trait.Ord.html#how-can-i-implement-ord).

3 years agoRollup merge of #78620 - gabhijit:bitops_doc_fix, r=m-ou-se
Yuki Okushi [Mon, 2 Nov 2020 05:14:36 +0000 (14:14 +0900)]
Rollup merge of #78620 - gabhijit:bitops_doc_fix, r=m-ou-se

Trivial fixes to bitwise operator documentation

Added fixes to documentation of `BitAnd`, `BitOr`, `BitXor` and
`BitAndAssign`, where the documentation for implementation on
`Vector<bool>` was using logical operators in place of the bitwise
operators.

r? @steveklabnik
Closes #78619

3 years agoRollup merge of #78610 - petrochenkov:nostriptok, r=Aaron1011
Yuki Okushi [Mon, 2 Nov 2020 05:14:34 +0000 (14:14 +0900)]
Rollup merge of #78610 - petrochenkov:nostriptok, r=Aaron1011

Do not remove tokens before AST json serialization

`TokenStripper` is error-prone and introduces one more use of `MutVisitor`.
It's much simpler to treat serialization as just one more place that wants lazy token stream to turn into a real token stream.
Also, no code is better than more code, in general.
r? @Aaron1011

(I also merged tests for `TokenStripper` ICEs into one.)

3 years agoRollup merge of #78606 - autarch:patch-1, r=m-ou-se
Yuki Okushi [Mon, 2 Nov 2020 05:14:33 +0000 (14:14 +0900)]
Rollup merge of #78606 - autarch:patch-1, r=m-ou-se

Clarify handling of final line ending in str::lines()

I found the description as it stands a bit confusing. I've added a bit more explanation to make it clear that a trailing line ending does not produce a final empty line.

3 years agoAuto merge of #78592 - fpoli:nll-facts-dir, r=matthewjasper
bors [Mon, 2 Nov 2020 04:39:05 +0000 (04:39 +0000)]
Auto merge of #78592 - fpoli:nll-facts-dir, r=matthewjasper

Add option to customize the nll-facts' folder location

This PR adds a `nll-facts-dir` option to specify the location of the directory in which NLL facts are dumped into. It works the same way `dump-mir-dir` controls the location used by the `dump-mir` option.

3 years agoDocument -Zinstrument-coverage
Rich Kadel [Sat, 31 Oct 2020 23:39:09 +0000 (16:39 -0700)]
Document -Zinstrument-coverage

3 years agoCorrected suggestion for generic parameters in `function_item_references` lint
Ayrton [Mon, 2 Nov 2020 03:14:21 +0000 (23:14 -0400)]
Corrected suggestion for generic parameters in `function_item_references` lint

This lint was incorrectly suggesting casting a function to a pointer without
specifying generic type parameters or const generics. This would cause a
compiler error since the missing parameters couldn't be inferred. This commit
fixed the suggestion and added a few tests with generics.

3 years agoAuto merge of #78645 - JulianKnodt:i78622, r=estebank
bors [Mon, 2 Nov 2020 02:18:36 +0000 (02:18 +0000)]
Auto merge of #78645 - JulianKnodt:i78622, r=estebank

Add delay_span_bug to no longer ICE

Fixes #78622

r? `@matthewjasper`

3 years agoAuto merge of #78605 - nox:relax-elf-relocations, r=nagisa
bors [Mon, 2 Nov 2020 00:12:32 +0000 (00:12 +0000)]
Auto merge of #78605 - nox:relax-elf-relocations, r=nagisa

Implement -Z relax-elf-relocations=yes|no

This lets rustc users tweak whether the linker should relax ELF relocations without recompiling a whole new target with its own libcore etc.

3 years agoinliner: Remove redundant loop
Tomasz Miąsko [Mon, 2 Nov 2020 00:00:00 +0000 (00:00 +0000)]
inliner: Remove redundant loop

No functional changes intended.

3 years agoAdd delay_span_bug to no longer ICE
kadmin [Sun, 1 Nov 2020 22:31:19 +0000 (22:31 +0000)]
Add delay_span_bug to no longer ICE

3 years agoImprove code in unindent_comment a bit more
Guillaume Gomez [Sun, 1 Nov 2020 15:40:48 +0000 (16:40 +0100)]
Improve code in unindent_comment a bit more

3 years agoAdd test for #[deprecated] attribute on trait impl block.
Mara Bos [Sun, 1 Nov 2020 12:09:03 +0000 (13:09 +0100)]
Add test for #[deprecated] attribute on trait impl block.

3 years agoTurn 'useless #[deprecated]' error into a lint.
Mara Bos [Sun, 1 Nov 2020 11:58:47 +0000 (12:58 +0100)]
Turn 'useless #[deprecated]' error into a lint.

3 years agoUse the right span for errors about #[deprecated] attributes.
Mara Bos [Sun, 1 Nov 2020 11:29:57 +0000 (12:29 +0100)]
Use the right span for errors about #[deprecated] attributes.

3 years agoDeny #[deprecated] on trait impl blocks.
Mara Bos [Sat, 31 Oct 2020 14:34:10 +0000 (15:34 +0100)]
Deny #[deprecated] on trait impl blocks.

They have no effect there, but were silently accepted.

3 years agoAdd fetch_update methods to AtomicBool and AtomicPtr
Nika Layzell [Sun, 1 Nov 2020 18:24:22 +0000 (13:24 -0500)]
Add fetch_update methods to AtomicBool and AtomicPtr

These methods were stabilized for the integer atomics in #71843, but the methods
were not added for the non-integer atomics `AtomicBool` and `AtomicPtr`.

3 years agoUpdate build instructions
bjorn3 [Sun, 1 Nov 2020 18:51:35 +0000 (19:51 +0100)]
Update build instructions

3 years agoMake it easier to use build_sysroot.sh
bjorn3 [Sun, 1 Nov 2020 18:47:14 +0000 (19:47 +0100)]
Make it easier to use build_sysroot.sh

3 years agoSplit the actual tests out into scripts/tests.sh
bjorn3 [Sun, 1 Nov 2020 18:39:44 +0000 (19:39 +0100)]
Split the actual tests out into scripts/tests.sh

3 years agoEnsure that sysroot build works with CARGO_TARGET_DIR set
bjorn3 [Sun, 1 Nov 2020 18:38:21 +0000 (19:38 +0100)]
Ensure that sysroot build works with CARGO_TARGET_DIR set

3 years agoPoint out that total_cmp is no strict superset of partial comparison
est31 [Sun, 1 Nov 2020 13:27:36 +0000 (14:27 +0100)]
Point out that total_cmp is no strict superset of partial comparison

Partial comparison and total_cmp are not equal. This helps
preventing the mistake of creating float wrappers that
base their Ord impl on total_cmp and their PartialOrd impl on
the PartialOrd impl of the float type. PartialOrd and Ord
are required to agree with each other.

3 years agoFix transmutes between vectors and integers
bjorn3 [Sun, 1 Nov 2020 17:35:19 +0000 (18:35 +0100)]
Fix transmutes between vectors and integers

Fixes #1102

3 years agoAuto merge of #75534 - Aaron1011:feature/new-future-breakage, r=pnkfelix
bors [Sun, 1 Nov 2020 16:52:28 +0000 (16:52 +0000)]
Auto merge of #75534 - Aaron1011:feature/new-future-breakage, r=pnkfelix

Implement rustc side of report-future-incompat

cc https://github.com/rust-lang/rust/issues/71249

This is an alternative to `@pnkfelix's` initial implementation in https://github.com/pnkfelix/rust/commits/prototype-rustc-side-of-report-future-incompat (mainly because I started working before seeing that branch :smile: ).

My approach outputs the entire original `Diagnostic`, in a way that is compatible with incremental compilation. This is not yet integrated with compiletest, but can be used manually by passing `-Z emit-future-incompat-report` to `rustc`.

Several changes are made to support this feature:
* The `librustc_session/lint` module is moved to a new crate `librustc_lint_defs` (name bikesheddable). This allows accessing lint definitions from `librustc_errors`.
* The `Lint` struct is extended with an `Option<FutureBreakage>`. When present, it indicates that we should display a lint in the future-compat report. `FutureBreakage` contains additional information that we may want to display in the report (currently, a `date` field indicating when the crate will stop compiling).
* A new variant `rustc_error::Level::Allow` is added. This is used when constructing a diagnostic for a future-breakage lint that is marked as allowed (via `#[allow]` or `--cap-lints`). This allows us to capture any future-breakage diagnostics in one place, while still discarding them before they are passed to the `Emitter`.
* `DiagnosticId::Lint` is extended with a `has_future_breakage` field, indicating whether or not the `Lint` has future breakage information (and should therefore show up in the report).
* `Session` is given access to the `LintStore` via a new `SessionLintStore` trait (since `librustc_session` cannot directly reference `LintStore` without a cyclic dependency). We use this to turn a string `DiagnosticId::Lint` back into a `Lint`, to retrieve the `FutureBreakage` data.

Currently, `FutureBreakage.date` is always set to `None`. However, this could potentially be interpreted by Cargo in the future.

I've enabled the future-breakage report for the `ARRAY_INTO_ITER` lint, which can be used to test out this PR. The intent is to use the field to allow Cargo to determine the date of future breakage (as described in [RFC 2834](https://github.com/rust-lang/rfcs/blob/master/text/2834-cargo-report-future-incompat.md)) without needing to parse the diagnostic itself.

cc `@pnkfelix`

3 years agoRemove incorrect statement about line ending content in lines doc change
Dave Rolsky [Sun, 1 Nov 2020 15:11:20 +0000 (09:11 -0600)]
Remove incorrect statement about line ending content in lines doc change

3 years agoAuto merge of #78553 - Nadrieril:fix-78549, r=varkor
bors [Sun, 1 Nov 2020 14:37:50 +0000 (14:37 +0000)]
Auto merge of #78553 - Nadrieril:fix-78549, r=varkor

Fix #78549

Before #78430, this worked because `specialize_constructor` didn't actually care too much which constructor was passed to it unless needed. That PR however handles `&str` as a special case, and I did not anticipate patterns for the `&str` type other than string literals.
I am not very confident there are not other similar oversights left, but hopefully only `&str` was different enough to break my assumptions.

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

3 years agoHide anonymous allocations from linked artifact
bjorn3 [Sun, 1 Nov 2020 13:45:41 +0000 (14:45 +0100)]
Hide anonymous allocations from linked artifact

3 years agoMerge pull request #1100 from mominul/trans->codegen
bjorn3 [Sun, 1 Nov 2020 13:44:25 +0000 (14:44 +0100)]
Merge pull request #1100 from mominul/trans->codegen

Rename trans to codegen

3 years agoRename trans to codegen
Muhammad Mominul Huque [Sun, 1 Nov 2020 13:24:30 +0000 (19:24 +0600)]
Rename trans to codegen

3 years agodocumentation examples fixes in rustfmt convention
Abhijit Gadgil [Sun, 1 Nov 2020 13:23:22 +0000 (18:53 +0530)]
documentation examples fixes in rustfmt convention

3 years agoAuto merge of #78623 - m-ou-se:rollup-m6y5j0m, r=m-ou-se
bors [Sun, 1 Nov 2020 11:54:58 +0000 (11:54 +0000)]
Auto merge of #78623 - m-ou-se:rollup-m6y5j0m, r=m-ou-se

Rollup of 6 pull requests

Successful merges:

 - #78073 (Add #[inline] to some functions in core::str.)
 - #78596 (Fix doc links to std::fmt)
 - #78599 (Add note to process::arg[s] that args shouldn't be escaped or quoted)
 - #78602 (fix various aliasing issues in the standard library)
 - #78603 (expand: Tweak a comment in implementation of `macro_rules`)
 - #78621 (Inline Default::default() for atomics)

Failed merges:

r? `@ghost`

3 years agoRollup merge of #78621 - solson:inline, r=m-ou-se
Mara Bos [Sun, 1 Nov 2020 10:53:39 +0000 (11:53 +0100)]
Rollup merge of #78621 - solson:inline, r=m-ou-se

Inline Default::default() for atomics

Functions like `AtomicUsize::default()` are not cross-crate inlineable before this PR ([see assembly output here](https://play.rust-lang.org/?version=stable&mode=release&edition=2018&gist=e353321766418f759c69fb141d3732f8)), which can lead to unexpected performance issues when initializing a large array using this function, e.g. as seen [here](https://github.com/spacejam/sled/blob/d513996a85875be8c813fd0e30a548b89682289a/src/histogram.rs#L53) which should turn into a simple loop writing zeroes but doesn't.

r? @m-ou-se

3 years agoRollup merge of #78603 - petrochenkov:fourdigits, r=matthewjasper
Mara Bos [Sun, 1 Nov 2020 10:53:37 +0000 (11:53 +0100)]
Rollup merge of #78603 - petrochenkov:fourdigits, r=matthewjasper

expand: Tweak a comment in implementation of `macro_rules`

The answer to the removed FIXME is that we don't apply mark to the span `sp` just because that span is no longer used. We could apply it, but that would just be unnecessary extra work.

The comments in code tell why the span is unused, it's a span of `$var` literally, which is lost for `tt` variables because their tokens are outputted directly, but kept for other variables which are outputted as [groups](https://doc.rust-lang.org/nightly/proc_macro/struct.Group.html) and `sp` is kept as the group's span.

Closes https://github.com/rust-lang/rust/issues/2887

3 years agoRollup merge of #78602 - RalfJung:raw-ptr-aliasing-issues, r=m-ou-se
Mara Bos [Sun, 1 Nov 2020 10:53:36 +0000 (11:53 +0100)]
Rollup merge of #78602 - RalfJung:raw-ptr-aliasing-issues, r=m-ou-se

fix various aliasing issues in the standard library

This fixes various cases where the standard library either used raw pointers after they were already invalidated by using the original reference again, or created raw pointers for one element of a slice and used it to access neighboring elements.

3 years agoRollup merge of #78599 - panstromek:master, r=m-ou-se
Mara Bos [Sun, 1 Nov 2020 10:53:34 +0000 (11:53 +0100)]
Rollup merge of #78599 - panstromek:master, r=m-ou-se

Add note to process::arg[s] that args shouldn't be escaped or quoted

This came out of discussion on [forum](https://users.rust-lang.org/t/how-to-get-full-output-from-command/50626), where I recently asked a question and it turned out that the problem was redundant quotation:

```rust
 Command::new("rg")
        .arg("\"pattern\"") // this will look for "pattern" with quotes included
```

This is something that has bitten me few times already (in multiple languages actually), so It'd be grateful to have it in the docs, even though it's not sctrictly Rust specific problem. Other users also agreed.

This can be really annoying to debug, because in many cases (inluding mine), quotes can be legal part of the argument, so the command doesn't fail, it just behaves unexpectedly. Not everybody (including me) knows that quotes around arguments are part of the shell and not part of the called program. Coincidentally, somoene had the same problem [yesterday](https://www.reddit.com/r/rust/comments/jkxelc/going_crazy_over_running_a_curl_process_from_rust/) on reddit.

I am not a native speaker, so I welcome any corrections or better formulation, I don't expect this to be merged as is. I was also reminded that this is platform/shell specific behaviour, but I didn't find a good way to formulate that briefly, any ideas welcome.

 It's also my first PR here, so I am not sure I did everything correctly, I did this just from Github UI.

3 years agoRollup merge of #78596 - pavlukivan:master, r=m-ou-se
Mara Bos [Sun, 1 Nov 2020 10:53:33 +0000 (11:53 +0100)]
Rollup merge of #78596 - pavlukivan:master, r=m-ou-se

Fix doc links to std::fmt

`std::format` and `core::write` macros' docs linked to `core::fmt` for format string reference, even though only `std::fmt` has format string documentation (and the link titles were `std::fmt`)

3 years agoRollup merge of #78073 - fusion-engineering-forks:inline, r=eddyb
Mara Bos [Sun, 1 Nov 2020 10:53:29 +0000 (11:53 +0100)]
Rollup merge of #78073 - fusion-engineering-forks:inline, r=eddyb

Add #[inline] to some functions in core::str.

Almost all str functions already had #[inline].

3 years agoAuto merge of #78531 - cuviper:unwrap-metadata, r=tmandry
bors [Sun, 1 Nov 2020 09:30:11 +0000 (09:30 +0000)]
Auto merge of #78531 - cuviper:unwrap-metadata, r=tmandry

rustc_llvm: unwrap LLVMMetadataRef before casting

Directly casting the opaque pointer was [reported] to cause an
"incomplete type" error with GCC 9.3:

```
llvm-wrapper/RustWrapper.cpp:939:31:   required from here
/usr/include/c++/9.3/type_traits:1301:12: error: invalid use of incomplete type 'struct LLVMOpaqueMetadata'
 1301 |     struct is_base_of
      |            ^~~~~~~~~~
In file included from [...]/rust/src/llvm-project/llvm/include/llvm-c/BitReader.h:23,
                 from llvm-wrapper/LLVMWrapper.h:1,
                 from llvm-wrapper/RustWrapper.cpp:1:
[...]/rust/src/llvm-project/llvm/include/llvm-c/Types.h:89:16: note: forward declaration of 'struct LLVMOpaqueMetadata'
   89 | typedef struct LLVMOpaqueMetadata *LLVMMetadataRef;
      |                ^~~~~~~~~~~~~~~~~~
```

[reported]: https://zulip-archive.rust-lang.org/182449tcompilerhelp/12215halprustcllvmbuildfail.html#214915124

A simple `unwrap` fixes the issue.

r? `@eddyb`

3 years agoMerge pull request #1099 from bjorn3/fix_rustc_bootstrap
bjorn3 [Sun, 1 Nov 2020 09:10:23 +0000 (10:10 +0100)]
Merge pull request #1099 from bjorn3/fix_rustc_bootstrap

Update Cranelift

3 years agoUpdate Cranelift
bjorn3 [Sun, 1 Nov 2020 08:50:33 +0000 (09:50 +0100)]
Update Cranelift

Fixes bootstrapping of rustc using cg_clif

Fixes #1097

3 years agoAuto merge of #78420 - estebank:suggest-assoc-fn, r=petrochenkov
bors [Sun, 1 Nov 2020 06:49:16 +0000 (06:49 +0000)]
Auto merge of #78420 - estebank:suggest-assoc-fn, r=petrochenkov

Suggest calling associated `fn` inside `trait`s

When calling a function that doesn't exist inside of a trait's
associated `fn`, and another associated `fn` in that trait has that
name, suggest calling it with the appropriate fully-qualified path.

Expand the label to be more descriptive.

Prompted by the following user experience:
https://users.rust-lang.org/t/cannot-find-function/50663

3 years agoInline Default::default() for atomics
Scott Olson [Sun, 1 Nov 2020 04:38:41 +0000 (04:38 +0000)]
Inline Default::default() for atomics

3 years agoFixes incorrect paranthesis.
Abhijit Gadgil [Sun, 1 Nov 2020 03:38:19 +0000 (09:08 +0530)]
Fixes incorrect paranthesis.

3 years agoTrivial fixes to bitwise operator documentation
Abhijit Gadgil [Sun, 1 Nov 2020 02:52:25 +0000 (08:22 +0530)]
Trivial fixes to bitwise operator documentation

Added fixes to documentation of `BitAnd`, `BitOr`, `BitXor` and
`BitAndAssign`, where the documentation for implementation on
`Vector<bool>` was using logical operators in place of the bitwise
operators.

r? @steveklabnik
cc #78619

3 years agoThe need for `Single` to cover `Unlistable` was a hack
Nadrieril [Sun, 1 Nov 2020 02:04:11 +0000 (02:04 +0000)]
The need for `Single` to cover `Unlistable` was a hack

It is now unneeded, since we handle `&str` patterns in a consistent way.

3 years agoFix #78549
Nadrieril [Sun, 1 Nov 2020 01:58:48 +0000 (01:58 +0000)]
Fix #78549

Before #78430, string literals worked because `specialize_constructor`
didn't actually care too much which constructor was passed to it unless
needed. Since then, string literals are special cased and a bit hacky. I
did not anticipate patterns for the `&str` type other than string
literals, hence this bug. This makes string literals less hacky.

3 years agoAuto merge of #78147 - tmiasko:validate-storage, r=jonas-schievink
bors [Sun, 1 Nov 2020 01:27:15 +0000 (01:27 +0000)]
Auto merge of #78147 - tmiasko:validate-storage, r=jonas-schievink

Assert that locals have storage when used

The validator in visit_local asserts that local has a stroage when used,
but visit_local is never called so validation is ineffective.

Use super_statement and super_terminator to ensure that locals are visited.

3 years agoDo not remove tokens before AST json serialization
Vadim Petrochenkov [Sat, 31 Oct 2020 19:47:57 +0000 (22:47 +0300)]
Do not remove tokens before AST json serialization

3 years agoAssert that locals have storage when used
Tomasz Miąsko [Sun, 25 Oct 2020 00:00:00 +0000 (00:00 +0000)]
Assert that locals have storage when used

The validator in visit_local asserts that local has a stroage when used,
but visit_local is never called so validation is ineffective.

Use super_statement and super_terminator to ensure that locals are visited.

3 years agoUpdate Cranelift
bjorn3 [Sat, 31 Oct 2020 18:38:35 +0000 (19:38 +0100)]
Update Cranelift

3 years agoMove post order walk to iterative approach
Andreas Molzer [Sat, 31 Oct 2020 16:56:13 +0000 (17:56 +0100)]
Move post order walk to iterative approach

The previous recursive approach might overflow the stack when walking a
particularly deep, list-like, graph. In particular, dominator
calculation for borrow checking does such a traversal and very long
functions might lead to a region dependency graph with in this
problematic structure.

3 years agoUse Pointer::dangling for ZST's in trans_const_value
bjorn3 [Sat, 31 Oct 2020 17:31:29 +0000 (18:31 +0100)]
Use Pointer::dangling for ZST's in trans_const_value

3 years agoAuto merge of #78594 - m-ou-se:rollup-h5c8frs, r=m-ou-se
bors [Sat, 31 Oct 2020 17:09:38 +0000 (17:09 +0000)]
Auto merge of #78594 - m-ou-se:rollup-h5c8frs, r=m-ou-se

Rollup of 7 pull requests

Successful merges:

 - #74622 (Add std::panic::panic_any.)
 - #77099 (make exp_m1 and ln_1p examples more representative of use)
 - #78526 (Strip tokens from trait and impl items before printing AST JSON)
 - #78550 (x.py setup: Create config.toml in the current directory, not the top-level directory)
 - #78577 (validator: Extend aliasing check to a call terminator)
 - #78581 (Constantify more BTreeMap and BTreeSet functions)
 - #78587 (parser: Cleanup `LazyTokenStream` and avoid some clones)

Failed merges:

r? `@ghost`

3 years agoClarify handling of final line ending in str::lines()
Dave Rolsky [Sat, 31 Oct 2020 16:34:32 +0000 (11:34 -0500)]
Clarify handling of final line ending in str::lines()

I found the description as it stands a bit confusing. I've added a bit more explanation to make it clear that a trailing line ending does not produce a final empty line.

3 years agoApply suggestions from code review
Matyáš Racek [Sat, 31 Oct 2020 16:28:44 +0000 (17:28 +0100)]
Apply suggestions from code review

Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
3 years agoImplement -Z relax-elf-relocations=yes|no
Anthony Ramine [Mon, 26 Oct 2020 19:55:07 +0000 (20:55 +0100)]
Implement -Z relax-elf-relocations=yes|no

This lets rustc users tweak whether the linker should relax ELF relocations,
namely whether it should emit R_X86_64_GOTPCRELX relocations instead of
R_X86_64_GOTPCREL, as the former is allowed by the ABI to be further
optimised. The default value is whatever the target defines.

3 years agofix aliasing issues in SipHasher
Ralf Jung [Wed, 28 Oct 2020 13:01:04 +0000 (14:01 +0100)]
fix aliasing issues in SipHasher

3 years agofix aliasing issue in binary_heap
Ralf Jung [Sat, 31 Oct 2020 15:22:24 +0000 (16:22 +0100)]
fix aliasing issue in binary_heap

3 years agofix aliasing issue in unix sleep function
Ralf Jung [Sat, 31 Oct 2020 15:16:54 +0000 (16:16 +0100)]
fix aliasing issue in unix sleep function

3 years agofix aliasing issues in u128 formatting code
Ralf Jung [Sat, 31 Oct 2020 15:13:33 +0000 (16:13 +0100)]
fix aliasing issues in u128 formatting code

3 years agoexpand: Tweak a comment in implementation of `macro_rules`
Vadim Petrochenkov [Sat, 31 Oct 2020 15:09:21 +0000 (18:09 +0300)]
expand: Tweak a comment in implementation of `macro_rules`

3 years agoRetagging: do not retag 'raw reborrows'
Ralf Jung [Sat, 31 Oct 2020 12:57:56 +0000 (13:57 +0100)]
Retagging: do not retag 'raw reborrows'

3 years agoAdd note to process::arg[s] that args shouldn't be escaped or quoted
Matyáš Racek [Sat, 31 Oct 2020 13:40:36 +0000 (14:40 +0100)]
Add note to process::arg[s] that args shouldn't be escaped or quoted

3 years agoFix doc links to std::fmt
Ivan Pavluk [Sat, 31 Oct 2020 10:50:08 +0000 (17:50 +0700)]
Fix doc links to std::fmt

std::format and core::write macros' docs linked to core::fmt for format string reference, even though only std::fmt has format string documentation and the link titles were std::fmt.

3 years agoImplement -Zfunction-sections
bjorn3 [Sat, 31 Oct 2020 09:13:35 +0000 (10:13 +0100)]
Implement -Zfunction-sections

3 years agoRustup to rustc 1.49.0-nightly (ffe52882e 2020-10-30)
bjorn3 [Sat, 31 Oct 2020 09:12:51 +0000 (10:12 +0100)]
Rustup to rustc 1.49.0-nightly (ffe52882e 2020-10-30)

3 years agoRollup merge of #78587 - petrochenkov:lazytok, r=Aaron1011
Mara Bos [Sat, 31 Oct 2020 08:49:41 +0000 (09:49 +0100)]
Rollup merge of #78587 - petrochenkov:lazytok, r=Aaron1011

parser: Cleanup `LazyTokenStream` and avoid some clones

by using a named struct instead of a closure.

r? @Aaron1011

3 years agoRollup merge of #78581 - a1phyr:const_btree_more, r=dtolnay
Mara Bos [Sat, 31 Oct 2020 08:49:39 +0000 (09:49 +0100)]
Rollup merge of #78581 - a1phyr:const_btree_more, r=dtolnay

Constantify more BTreeMap and BTreeSet functions

Just because we can:

- `BTreeMap::len`
- `BTreeMap::is_empty`
- `BTreeSet::len`
- `BTreeSet::is_empty`

Note that I put the `const` under `const_btree_new`, because I don't think their is a need to create another feature flag for that.

cc #71835

3 years agoRollup merge of #78577 - tmiasko:validate-aliasing, r=jonas-schievink
Mara Bos [Sat, 31 Oct 2020 08:49:38 +0000 (09:49 +0100)]
Rollup merge of #78577 - tmiasko:validate-aliasing, r=jonas-schievink

validator: Extend aliasing check to a call terminator

3 years agoRollup merge of #78550 - jyn514:setup, r=Mark-Simulacrum
Mara Bos [Sat, 31 Oct 2020 08:49:36 +0000 (09:49 +0100)]
Rollup merge of #78550 - jyn514:setup, r=Mark-Simulacrum

x.py setup: Create config.toml in the current directory, not the top-level directory

See https://github.com/rust-lang/rust/issues/78509 for discussion.

r? @pnkfelix
cc @cuviper @Mark-Simulacrum

3 years agoRollup merge of #78526 - Aaron1011:fix/assoc-tokens, r=estebank
Mara Bos [Sat, 31 Oct 2020 08:49:34 +0000 (09:49 +0100)]
Rollup merge of #78526 - Aaron1011:fix/assoc-tokens, r=estebank

Strip tokens from trait and impl items before printing AST JSON

Fixes #78510

3 years agoRollup merge of #77099 - tspiteri:exp_m1-examples, r=m-ou-se
Mara Bos [Sat, 31 Oct 2020 08:49:32 +0000 (09:49 +0100)]
Rollup merge of #77099 - tspiteri:exp_m1-examples, r=m-ou-se

make exp_m1 and ln_1p examples more representative of use

With this PR, the examples for `exp_m1` would fail if `x.exp() - 1.0` is used instead of `x.exp_m1()`, and the examples for `ln_1p` would fail if `(x + 1.0).ln()` is used instead of `x.ln_1p()`.