about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2020-11-02Separate complex multispan into some notesYuki Okushi-54/+144
2020-11-02Avoid complex diagnostics in snippets which contain newlinesYuki Okushi-0/+56
2020-11-02Auto merge of #78645 - JulianKnodt:i78622, r=estebankbors-1/+23
Add delay_span_bug to no longer ICE Fixes #78622 r? `@matthewjasper`
2020-11-02Auto merge of #78605 - nox:relax-elf-relocations, r=nagisabors-1/+8
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.
2020-11-01Add delay_span_bug to no longer ICEkadmin-1/+23
2020-11-01Auto merge of #75534 - Aaron1011:feature/new-future-breakage, r=pnkfelixbors-123/+539
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`
2020-11-01Auto merge of #78553 - Nadrieril:fix-78549, r=varkorbors-38/+86
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
2020-11-01Auto merge of #78623 - m-ou-se:rollup-m6y5j0m, r=m-ou-sebors-21/+55
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`
2020-11-01Rollup merge of #78621 - solson:inline, r=m-ou-seMara Bos-0/+2
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
2020-11-01Rollup merge of #78603 - petrochenkov:fourdigits, r=matthewjasperMara Bos-9/+11
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
2020-11-01Rollup merge of #78602 - RalfJung:raw-ptr-aliasing-issues, r=m-ou-seMara Bos-9/+17
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.
2020-11-01Rollup merge of #78599 - panstromek:master, r=m-ou-seMara Bos-0/+10
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.
2020-11-01Rollup merge of #78596 - pavlukivan:master, r=m-ou-seMara Bos-3/+3
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`)
2020-11-01Rollup merge of #78073 - fusion-engineering-forks:inline, r=eddybMara Bos-0/+12
Add #[inline] to some functions in core::str. Almost all str functions already had #[inline].
2020-11-01Auto merge of #78531 - cuviper:unwrap-metadata, r=tmandrybors-1/+1
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`
2020-11-01Auto merge of #78420 - estebank:suggest-assoc-fn, r=petrochenkovbors-49/+124
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
2020-11-01Inline Default::default() for atomicsScott Olson-0/+2
2020-11-01The need for `Single` to cover `Unlistable` was a hackNadrieril-18/+13
It is now unneeded, since we handle `&str` patterns in a consistent way.
2020-11-01Fix #78549Nadrieril-22/+75
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.
2020-11-01Auto merge of #78147 - tmiasko:validate-storage, r=jonas-schievinkbors-12/+24
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.
2020-10-31Assert that locals have storage when usedTomasz Miąsko-12/+24
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.
2020-10-31Auto merge of #78594 - m-ou-se:rollup-h5c8frs, r=m-ou-sebors-113/+219
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`
2020-10-31Apply suggestions from code reviewMatyáš Racek-4/+8
Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
2020-10-31Implement -Z relax-elf-relocations=yes|noAnthony Ramine-1/+8
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.
2020-10-31fix aliasing issues in SipHasherRalf Jung-1/+1
2020-10-31fix aliasing issue in binary_heapRalf Jung-2/+3
2020-10-31fix aliasing issue in unix sleep functionRalf Jung-1/+2
2020-10-31fix aliasing issues in u128 formatting codeRalf Jung-5/+11
2020-10-31expand: Tweak a comment in implementation of `macro_rules`Vadim Petrochenkov-9/+11
2020-10-31Add note to process::arg[s] that args shouldn't be escaped or quotedMatyáš Racek-0/+6
2020-10-31Fix doc links to std::fmtIvan Pavluk-3/+3
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.
2020-10-31Rollup merge of #78587 - petrochenkov:lazytok, r=Aaron1011Mara Bos-87/+77
parser: Cleanup `LazyTokenStream` and avoid some clones by using a named struct instead of a closure. r? @Aaron1011
2020-10-31Rollup merge of #78581 - a1phyr:const_btree_more, r=dtolnayMara Bos-4/+22
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
2020-10-31Rollup merge of #78577 - tmiasko:validate-aliasing, r=jonas-schievinkMara Bos-5/+40
validator: Extend aliasing check to a call terminator
2020-10-31Rollup merge of #78550 - jyn514:setup, r=Mark-SimulacrumMara Bos-1/+1
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
2020-10-31Rollup merge of #78526 - Aaron1011:fix/assoc-tokens, r=estebankMara Bos-0/+45
Strip tokens from trait and impl items before printing AST JSON Fixes #78510
2020-10-31Rollup merge of #77099 - tspiteri:exp_m1-examples, r=m-ou-seMara Bos-16/+20
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()`.
2020-10-31Rollup merge of #74622 - fusion-engineering-forks:panic-box, r=KodrAusMara Bos-0/+14
Add std::panic::panic_any. The discussion of #67984 lead to the conclusion that there should be a macro or function separate from `std::panic!()` for throwing arbitrary payloads, to make it possible to deprecate or disallow (in edition 2021) `std::panic!(arbitrary_payload)`. Alternative names: - `panic_with!(..)` - ~~`start_unwind(..)`~~ (panicking doesn't always unwind) - `throw!(..)` - `panic_throwing!(..)` - `panic_with_value(..)` - `panic_value(..)` - `panic_with(..)` - `panic_box(..)` - `panic(..)` The equivalent (private, unstable) function in `libstd` is called `std::panicking::begin_panic`. I suggest `panic_any`, because it allows for any (`Any + Send`) type. _Tracking issue: #78500_
2020-10-30Update Clippy path to `Lint`Aaron Hill-1/+1
2020-10-31Auto merge of #76257 - JulianKnodt:i75777, r=Dylan-DPCbors-0/+60
Add regression test This adds a regression test for #75777, effectively closing it since it is solved on nightly and beta. Closes #75777
2020-10-30Fix testAaron Hill-1/+1
2020-10-30Always pass `-Z future-incompat-report` to UI testsAaron Hill-28/+27
2020-10-30Don't display empty future-compat reportAaron Hill-16/+21
2020-10-30Update into-iter-on-arrays test to check future-incompat-reportAaron Hill-12/+165
2020-10-30Only error on unfixed diagnosticsAaron Hill-1/+3
2020-10-30Strip out non-diagnostic lines from rustfix inputAaron Hill-7/+20
2020-10-30Print future breakage reportAaron Hill-6/+9
2020-10-30Some workAaron Hill-19/+42
2020-10-30Implement rustc side of report-future-incompatAaron Hill-114/+332
2020-10-31parser: Cleanup `LazyTokenStream` and avoid some clonesVadim Petrochenkov-87/+77
by using a named struct instead of a closure.