about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2020-11-02Auto merge of #78661 - JohnTitor:rollup-er2isja, r=JohnTitorbors-90/+5
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`
2020-11-02Auto merge of #75020 - JohnTitor:fix-multispan, r=estebank,tmandrybors-29/+123
Avoid complex diagnostics in snippets which contain newlines Fixes #70935 r? `@estebank` `@tmandry`
2020-11-02Fix formatYuki Okushi-90/+95
2020-11-02Only separate notes if span is multilineYuki Okushi-5/+14
2020-11-02Add "this has type `{}` which {}" noteYuki Okushi-0/+4
2020-11-02Address some code reviewsYuki Okushi-94/+85
2020-11-02Separate complex multispan into some notesYuki Okushi-29/+114
2020-11-02Rollup merge of #78610 - petrochenkov:nostriptok, r=Aaron1011Yuki Okushi-90/+5
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.)
2020-11-02Auto merge of #78592 - fpoli:nll-facts-dir, r=matthewjasperbors-2/+4
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.
2020-11-02Auto merge of #78645 - JulianKnodt:i78622, r=estebankbors-1/+7
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/+7
2020-11-01Auto merge of #75534 - Aaron1011:feature/new-future-breakage, r=pnkfelixbors-114/+324
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-32/+55
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-9/+11
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 #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-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-27/+55
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-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-16/+44
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-01Do not remove tokens before AST json serializationVadim Petrochenkov-90/+5
2020-10-31Assert that locals have storage when usedTomasz Miąsko-12/+21
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-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-31expand: Tweak a comment in implementation of `macro_rules`Vadim Petrochenkov-9/+11
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 #78577 - tmiasko:validate-aliasing, r=jonas-schievinkMara Bos-5/+40
validator: Extend aliasing check to a call terminator
2020-10-31Rollup merge of #78526 - Aaron1011:fix/assoc-tokens, r=estebankMara Bos-0/+11
Strip tokens from trait and impl items before printing AST JSON Fixes #78510
2020-10-30Fix testAaron Hill-1/+1
2020-10-30Some workAaron Hill-5/+11
2020-10-30Implement rustc side of report-future-incompatAaron Hill-114/+318
2020-10-31parser: Cleanup `LazyTokenStream` and avoid some clonesVadim Petrochenkov-87/+77
by using a named struct instead of a closure.
2020-10-30Auto merge of #78182 - LeSeulArtichaut:ty-visitor-contolflow, r=lcnr,oli-obkbors-371/+516
TypeVisitor: use `std::ops::ControlFlow` instead of `bool` Implements MCP rust-lang/compiler-team#374. Blocked on FCP in rust-lang/compiler-team#374. r? `@lcnr` cc `@jonas-schievink`
2020-10-30Add option to customize the nll-facts' folder locationFederico Poli-2/+4
2020-10-30Add back missing commentsJoshua Nelson-2/+5
2020-10-30Fix even more clippy warningsJoshua Nelson-520/+276
2020-10-30Fix some more clippy warningsJoshua Nelson-97/+71
2020-10-30Remove implicit `Continue` typeLeSeulArtichaut-134/+128
2020-10-30Use `ControlFlow::is{break,continue}`LeSeulArtichaut-23/+23
2020-10-30TypeVisitor: use `ControlFlow` in rustc_{mir,privacy,traits,typeck}LeSeulArtichaut-122/+171
2020-10-30TypeVisitor: use `ControlFlow` in rustc_{infer,lint,trait_selection}LeSeulArtichaut-82/+106
2020-10-30TypeVisitor: use `std::ops::ControlFlow` instead of `bool`LeSeulArtichaut-164/+242
2020-10-30Auto merge of #78562 - JohnTitor:rollup-otg906u, r=JohnTitorbors-55/+32
Rollup of 8 pull requests Successful merges: - #77334 (Reorder benches const variable) - #77888 (Simplify a nested bool match) - #77921 (f64: Refactor collapsible_if) - #78523 (Revert invalid `fn` return type parsing change) - #78524 (Avoid BorrowMutError with RUSTC_LOG=debug) - #78545 (Make anonymous binders start at 0) - #78554 (Improve wording of `core::ptr::drop_in_place` docs) - #78556 (Link to pass docs from NRVO module docs) Failed merges: - #78424 (Fix some more clippy warnings) r? `@ghost`
2020-10-30Rollup merge of #78556 - camelid:mir-opt-nrvo-docs, r=jyn514Yuki Okushi-0/+2
Link to pass docs from NRVO module docs It can be easy to miss that this is documented on the pass's struct if you are looking at the module docs. Cc https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/what.20is.20NRVO.3F
2020-10-30Rollup merge of #78545 - jackh726:anonymous, r=oli-obkYuki Okushi-16/+8
Make anonymous binders start at 0 A few changes to some test outputs, but these actually look *more* correct to me.
2020-10-30Rollup merge of #78524 - tmiasko:source-files-borrow, r=Aaron1011Yuki Okushi-8/+11
Avoid BorrowMutError with RUSTC_LOG=debug ```console $ touch empty.rs $ env RUSTC_LOG=debug rustc +stage1 --crate-type=lib empty.rs ``` Fails with a `BorrowMutError` because source map files are already borrowed while `features_query` attempts to format a log message containing a span. Release the borrow before the query to avoid the issue.
2020-10-30Rollup merge of #78523 - estebank:fix-return-type-parse-regression, r=dtolnayYuki Okushi-13/+4
Revert invalid `fn` return type parsing change Revert one of the changes in #78379. Fix #78507.
2020-10-30Rollup merge of #77888 - LingMan:ast_pretty_tt_prepend_space, r=jyn514Yuki Okushi-18/+7
Simplify a nested bool match Logically this first eliminates the innermost match by merging the patterns. Then, in a second step, turns the newly innermost match into a `matches!` call.
2020-10-30Auto merge of #78393 - SNCPlay42:match-if-guard, r=tmandrybors-0/+12
Always record reference to binding in match if guards When encountering a binding from a `match` pattern in its `if` guard when computing a generator's interior types, we must always record the type of a reference to the binding because of how `if` guards are lowered to MIR. This was missed in #75213 because the binding in that test case was autorefed and we recorded that adjusted type anyway. Fixes #78366
2020-10-29Link to pass docs from NRVO module docsCamelid-0/+2
2020-10-30Auto merge of #78432 - sexxi-goose:fix-77993-take3, r=nikomatsakisbors-6/+37
Handle type errors in closure/generator upvar_tys Fixes #77993