about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2021-01-08Rollup merge of #79675 - CraftSpider:79669, r=estebankYuki Okushi-0/+4
Make sure rust-call errors occur correctly for traits Fixes #79669 Adds trait method resolution to the error, and adds UI tests to ensure it doesn't happen again. Opening as draft because I'm getting weird link errors from unrelated code on my machine, and want to see what CI thinks.
2021-01-07Auto merge of #80709 - lzutao:target-enumerate, r=petrochenkovbors-53/+102
Limit target endian to an enum instead of free string This is #77604 revived.
2021-01-08Rollup merge of #80784 - petrochenkov:nontspan, r=Aaron1011Yuki Okushi-30/+14
rustc_parse: Better spans for synthesized token streams I think using the nonterminal span for synthesizing its tokens is a better approximation than using `DUMMY_SP` or the attribute span like #79472 did in `expand.rs`. r? `@Aaron1011`
2021-01-08Rollup merge of #80780 - lianghanzhen:master, r=petrochenkovYuki Okushi-1/+1
Return EOF_CHAR constant instead of magic char.
2021-01-08Rollup merge of #80750 - GuillaumeGomez:cleanup-to_string, r=lzutaoYuki Okushi-1/+1
Don't use to_string on Symbol in rustc_passes/check_attr.rs Improve code from #80686. r? ``@lzutao``
2021-01-08Rollup merge of #80659 - pierwill:edit-tokenstream, r=davidtwcoYuki Okushi-16/+17
Edit rustc_ast::tokenstream docs Fix some punctuation and wording, and add intra-documentation links.
2021-01-08Rollup merge of #80521 - richkadel:llvm-coverage-counters-2.4.0, r=wesleywiserYuki Okushi-2/+17
MIR Inline is incompatible with coverage Fixes: #80060 Fixed by disabling inlining if `-Zinstrument-coverage` is set. The PR also adds additional use cases to the coverage test for doctests. r? `@wesleywiser` cc: `@tmandry`
2021-01-08Rollup merge of #80012 - sasurau4:feature/point-constant-identifier-E0435, ↵Yuki Okushi-19/+73
r=petrochenkov Add pointing const identifier when emitting E0435 Fix #79919
2021-01-07rustc_parse: Better spans for synthesized token streamsVadim Petrochenkov-30/+14
2021-01-07Return EOF_CHAR constant instead of magic char.Hanzhen Liang-1/+1
2021-01-07Refine E0435 descriptionDaiki Ihara-0/+6
2021-01-07Add pointing const identifier when emitting E0435Daiki Ihara-19/+67
2021-01-07Auto merge of #80648 - Aaron1011:expn-data-private, r=petrochenkovbors-27/+63
Make `ExpnData` fields `krate` and `orig_id` private These fields are only used by hygiene serialized, and should not be accessed by anything outside of `rustc_span`.
2021-01-07Auto merge of #80200 - mahkoh:dst-offset, r=nagisabors-10/+44
Optimize DST field access For struct X<T: ?Sized>(T) struct Y<T: ?Sized>(u8, T) the offset of the unsized field is 0 mem::align_of_val(&self.1) respectively. This patch changes the expression used to compute these offsets so that the optimizer can perform this optimization. Consider ```rust fn f(x: &X<dyn Any>) -> &dyn Any { &x.0 } ``` Before: ```asm test: movq %rsi, %rdx movq 16(%rsi), %rax leaq -1(%rax), %rcx negq %rax andq %rcx, %rax addq %rdi, %rax retq ``` After: ```asm test: movq %rsi, %rdx movq %rdi, %rax retq ```
2021-01-07Auto merge of #80425 - camelid:resolve-moduledata-docs, r=petrochenkovbors-28/+44
Document `ModuleData` and improve names - Document `ModuleData` - Rename `ModuleData.normal_ancestor_id` to `nearest_parent_mod` - Rename `Resolver::nearest_mod_parent` to `nearest_parent_mod` cc https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/mentoring/near/221029702 r? `@petrochenkov`
2021-01-06Auto merge of #80754 - sunfishcode:path-cleanup/rustc-fs-util, r=davidtwcobors-2/+4
Optimize away a `fs::metadata` call. This also eliminates a use of a `Path` convenience function, in support of #80741, refactoring `std::path` to focus on pure data structures and algorithms.
2021-01-06Rename to `nearest_parent_mod`Camelid-27/+35
* Rename `ModuleData.normal_ancestor_id` to `nearest_parent_mod` `normal_ancestor_id` is a very confusing name if you don't already understand what it means. Adding docs helps, but using a clearer and more obvious name is also important. * Rename `Resolver::nearest_mod_parent` to `nearest_parent_mod` * Add more docs
2021-01-06Document `ModuleData`Camelid-6/+14
* Convert comments on fields to doc comments so they're visible in API docs * Add new documentation * Get rid of "normal module" terminology
2021-01-06Optimize away a `fs::metadata` call.Dan Gohman-2/+4
This also eliminates a use of a `Path` convenience function, in support of #80741, refactoring `std::path` to focus on pure data structures and algorithms.
2021-01-06Change related spec files to use the new enumLzu Tao-37/+50
2021-01-06Prefer enum Endian in rustc_target::TargetLzu Tao-16/+52
2021-01-06Auto merge of #80714 - jakevossen5:master, r=lcnrbors-1/+1
fixed const_generics error help Closes https://github.com/rust-lang/rust/issues/80702
2021-01-06Don't use to_string on SymbolGuillaume Gomez-1/+1
2021-01-06Auto merge of #80415 - cjgillot:issue-77828, r=petrochenkovbors-8/+17
Compute parent module when collecting hir::MacroDef. Fixes #77828. r? `@jyn514`
2021-01-05Do not swallow parent for MacroDef.Camille GILLOT-1/+1
2021-01-05Compute parent module when collecting hir::MacroDef.Camille GILLOT-7/+16
2021-01-05Auto merge of #80711 - camelid:intrinsic-of-val-safety, r=oli-obkbors-2/+0
Make `size_of_val` and `min_align_of_val` intrinsics unsafe Fixes #80668. r? `@oli-obk`
2021-01-05Auto merge of #80686 - GuillaumeGomez:error-doc-alias-same-name, r=jyn514bors-1/+12
Error when #[doc(alias)] has same name as the item Something I came across when reviewing some doc alias PRs. r? `@jyn514`
2021-01-05fixed const_generics error helpJake Vossen-1/+1
2021-01-04Make `size_of_val` and `min_align_of_val` intrinsics unsafeCamelid-2/+0
2021-01-05Rollup merge of #80643 - LingMan:unwrap, r=oli-obkYuki Okushi-8/+7
Move variable into the only branch where it is relevant At the `if` branch `filter` (the `let` binding) is `None` iff `filter` (the parameter) was `None`. We can branch on the parameter, move the binding into the `if`, and the complexity of handling `Option<Option<_>` largely dissolves. `@rustbot` modify labels +C-cleanup +T-compiler Note: I have no idea how hot this code is. If this method frequently gets called with a `None` filter, there might be a small perf improvement.
2021-01-05Rollup merge of #80637 - LingMan:filter, r=oli-obkYuki Okushi-19/+9
Use Option::filter instead of open-coding it `@rustbot` modify labels +C-cleanup +T-compiler
2021-01-05Rollup merge of #80538 - JulianKnodt:err_usize, r=lcnrYuki Okushi-41/+69
Add check for `[T;N]`/`usize` mismatch in astconv Helps clarify the issue in #80506 by adding a specific check for mismatches between [T;N] and usize. r? `@lcnr`
2021-01-04Auto merge of #80624 - RalfJung:place-ref, r=oli-obkbors-111/+61
use PlaceRef more consistently instead of loosely coupled local+projection Instead of working directly with the `projections` array, use `iter_projections` and `last_projection`. This avoids having to construct new `PlaceRef` from the pieces everywhere. I only did this for a few files, to see how people think about this. If y'all are happy with this, I'll open an E-mentor issue to complete this. I grepped for `Place::ty_from` to find the places that need adjusting -- this could miss some, but I am not sure what else to grep for.
2021-01-04Inlining enabled by -mir-opt-level > 1 is incompatible with coverageRich Kadel-2/+17
Fixes: #80060 Also adds additional test cases for coverage of doctests.
2021-01-04Add an error in case the doc alias is the same as the item it's aliasingGuillaume Gomez-1/+12
2021-01-04Auto merge of #80651 - GroteGnoom:issue-78123-fix, r=Nadrierilbors-0/+5
Add note to non-exhaustive match on reference to empty Rust prints "type `&A` is non-empty" even is A is empty. This is the intended behavior, but can be confusing. This commit adds a note to non-exhaustive pattern errors if they are a reference to something uninhabited. I did not add tests to check that the note is not shown for non-references or inhabited references, because this is already done in other tests. Maybe the added test is superfluous, because `always-inhabited-union-ref` already checks for this case. This does not handle &&Void or &&&void etc. I could add those as special cases as well and ignore people who need quadruple references. Fixes #78123
2021-01-04Add check for array/usize mismatch in astconvkadmin-41/+69
2021-01-04Auto merge of #80610 - Aaron1011:unhash-def-path-hash, r=varkorbors-10/+12
Use `UnhashMap` whenever we have a key of `DefPathHash`
2021-01-04Auto merge of #80418 - oli-obk:this_could_have_been_so_simple, r=RalfJungbors-7/+104
Allow references to interior mutable data behind a feature gate supercedes #80373 by simply not checking for interior mutability on borrows of locals that have `StorageDead` and thus can never be leaked to the final value of the constant tracking issue: https://github.com/rust-lang/rust/issues/80384 r? `@RalfJung`
2021-01-03Edit rustc_ast::tokenstream docspierwill-16/+17
Fix some punctuation and wording, and add intra-documentation links.
2021-01-03Add note to non-exhaustive match on reference to emptyDaniel Noom-0/+5
Rust prints "type `&A` is non-empty" even is A is empty. This is the intended behavior, but can be confusing. This commit adds a note to non-exhaustive pattern errors if they are a reference to something uninhabited. I did not add tests to check that the note is not shown for non-references or inhabited references, because this is already done in other tests. Maybe the added test is superfluous, because `always-inhabited-union-ref` already checks for this case. This does not handle &&Void or &&&void etc. I could add those as special cases as well and ignore people who need quadruple references. Fixes #78123
2021-01-03Rollup merge of #80646 - bugadani:meta, r=petrochenkovGuillaume Gomez-17/+12
Clean up in `each_child_of_item` This PR hopes to eliminate some of the surprising elements I encountered while reading the function. - `macros_only` is checked against inside the loop body, but if it is `true`, the loop is skipped anyway - only query `span` when relevant - no need to allocate attribute vector
2021-01-03Rollup merge of #80628 - matthiaskrgr:match_ref_pats, r=varkorGuillaume Gomez-87/+85
reduce borrowing and (de)referencing around match patterns (clippy::match_ref_pats)
2021-01-03Stylistic fixes to diagnostic messagesoli-3/+3
2021-01-03Refactor the non-transient cell borrow error diagnosticoli-3/+22
2021-01-03Dangling pointers point to everything and nothingOli Scherer-2/+1
Co-authored-by: Ralf Jung <post@ralfj.de>
2021-01-03Grammar fixesOli Scherer-1/+1
Co-authored-by: Ralf Jung <post@ralfj.de>
2021-01-03Make `ExpnData` fields `krate` and `orig_id` privateAaron Hill-27/+63
These fields are only used by hygiene serialized, and should not be accessed by anything outside of `rustc_span`.
2021-01-03Update now-more-precise operation with a preciser messageoli-2/+2