about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2021-03-28Rollup merge of #83526 - klensy:lazy-too, r=petrochenkovYuki Okushi-12/+13
lazily calls some fns Replaced some fn's with it's lazy variants.
2021-03-28Rollup merge of #83348 - osa1:issue83344, r=jackh726Yuki Okushi-4/+6
format macro argument parsing fix When the character next to `{}` is "shifted" (when mapping a byte index in the format string to span) we should avoid shifting the span end index, so first map the index of `}` to span, then bump the span, instead of first mapping the next byte index to a span (which causes bumping the end span too much). Regression test added. Fixes #83344 --- r? ```@estebank```
2021-03-27format macro argument parsing fixÖmer Sinan Ağacan-4/+6
When the character next to `{}` is "shifted" (when mapping a byte index in the format string to span) we should avoid shifting the span end index, so first map the index of `}` to span, then bump the span, instead of first mapping the next byte index to a span (which causes bumping the end span too much). Regression test added. Fixes #83344
2021-03-27lazily calls some fnsklensy-12/+13
2021-03-27Rollup merge of #83525 - rust-lang:lcnr-doc-patch, r=jonas-schievinkYuki Okushi-1/+1
fix doc comment for `ty::Dynamic`
2021-03-27Rollup merge of #83343 - osa1:issue83340, r=jackh726Yuki Okushi-14/+9
Simplify and fix byte skipping in format! string parser Fixes '\\' handling in format strings. Fixes #83340
2021-03-26fix doc comment for `ty::Dynamiclcnr-1/+1
2021-03-26Auto merge of #83488 - Aaron1011:ban-expr-inner-attrs, r=petrochenkovbors-30/+45
Ban custom inner attributes in expressions and statements Split out from https://github.com/rust-lang/rust/pull/82608 Custom inner attributes are unstable, so this won't break any stable users. This allows us to speed up token collection, and avoid a redundant call to `collect_tokens_no_attrs` when parsing an `Expr` that has outer attributes. r? `@petrochenkov`
2021-03-26Auto merge of #83404 - michaelwoerister:issue83045, r=eddybbors-3/+8
Fix #83045 by moving some crate loading verification code to a better place r? `@eddyb`
2021-03-26Auto merge of #82980 - tmiasko:import-cold-multiplier, r=michaelwoeristerbors-0/+3
Import small cold functions The Rust code is often written under an assumption that for generic methods inline attribute is mostly unnecessary, since for optimized builds using ThinLTO, a method will be code generated in at least one CGU and available for import. For example, deref implementations for Box, Vec, MutexGuard, and MutexGuard are not currently marked as inline, neither is identity implementation of From trait. In PGO builds, when functions are determined to be cold, the default multiplier of zero will stop the import, no matter how trivial the implementation. Increase slightly the default multiplier from 0 to 0.1. r? `@ghost`
2021-03-26Fix #83045 by moving some crate loading verification code to a better place.Michael Woerister-3/+8
2021-03-26Auto merge of #83503 - Dylan-DPC:rollup-mqvjfav, r=Dylan-DPCbors-88/+92
Rollup of 8 pull requests Successful merges: - #83055 ([rustdoc] Don't document stripped items in JSON renderer.) - #83437 (Refactor #82270 as lint instead of an error) - #83444 (Fix bootstrap tests on beta) - #83456 (Add docs for Vec::from functions) - #83463 (ExitStatusExt: Fix missing word in two docs messages) - #83470 (Fix patch note about #80653 not mentioning nested nor recursive) - #83485 (Mark asm tests as requiring LLVM 10.0.1) - #83486 (Don't ICE when using `#[global_alloc]` on a non-item statement) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-03-26Rollup merge of #83486 - Aaron1011:fix/global-alloc-error, r=petrochenkovDylan DPC-16/+16
Don't ICE when using `#[global_alloc]` on a non-item statement Fixes #83469 We need to return an `Annotatable::Stmt` if we were passed an `Annotatable::Stmt`
2021-03-26Rollup merge of #83437 - Amanieu:asm_syntax, r=petrochenkovDylan DPC-72/+76
Refactor #82270 as lint instead of an error This PR fixes several issues with #82270 which generated an error when `.intel_syntax` or `.att_syntax` was used in inline assembly: - It is now a warn-by-default lint instead of an error. - The lint only triggers on x86. `.intel_syntax` and `.att_syntax` are only valid on x86. - The lint no longer provides machine-applicable suggestions for two reasons: - These changes should not be made automatically since changes to assembly code can be very subtle. - The template string is not always just a string: it can contain macro invocation (`concat!`), raw strings, escape characters, etc. cc ``@asquared31415``
2021-03-26Auto merge of #83465 - michaelwoerister:safe-read_raw_bytes, r=cjgillotbors-45/+48
Allow for reading raw bytes from rustc_serialize::Decoder without unsafe code The current `read_raw_bytes` method requires using `MaybeUninit` and `unsafe`. I don't think this is necessary. Let's see if a safe interface has any performance drawbacks. This is a followup to #83273 and will make it easier to rebase #82183. r? `@cjgillot`
2021-03-25Avoid double-collection for expression nonterminalsAaron Hill-17/+17
2021-03-25Ban custom inner attributes in expressions and statementsAaron Hill-13/+28
2021-03-25Don't ICE when using `#[global_alloc]` on a non-item statementAaron Hill-16/+16
Fixes #83469 We need to return an `Annotatable::Stmt` if we were passed an `Annotatable::Stmt`
2021-03-25Auto merge of #82743 - jackh726:resolve-refactor, r=nikomatsakisbors-178/+351
Refactor rustc_resolve::late::lifetimes to resolve per-item There are some changes to tests that I'd like some feedback on; so this is still WIP. The reason behind this change will (hopefully) allow us to (as part of #76814) be able to essentially use the lifetime resolve code to resolve *all* late bound vars (including those of super traits). Currently, it only resolves those that are *syntactically* in scope. In #76814, I'm essentially finding that I would essentially have to redo the passing of bound vars through scopes (i.e. when instantiating a poly trait ref), and that's what this code does anyways. However, to be able to do this (ask super traits what bound vars are in scope), we have to be able to resolve items separately. The first commit is actually partially orthogonal. Essentially removing one use of late bound debruijn indices. Not exactly sure who would be best to review here. Let r? `@nikomatsakis`
2021-03-25Auto merge of #83424 - cjgillot:noparam, r=lcnrbors-54/+6
GenericParam does not need to be a HIR owner. The special case is not required. Universal impl traits design to regular generic parameters, and their content is owned by the enclosing item. Existential (and opaque) impl traits generate their own enclosing item, and are collected through it.
2021-03-25write-up what is happeningNiko Matsakis-0/+28
2021-03-25Refactor #82270 as lint instead of an errorAmanieu d'Antras-72/+76
2021-03-25Auto merge of #83387 - cuviper:min-llvm-10, r=nagisabors-110/+1
Update the minimum external LLVM to 10 r? `@nikic`
2021-03-25Allow for reading raw bytes from rustc_serialize::Decoder without unsafe code.Michael Woerister-45/+48
2021-03-25Auto merge of #82565 - m-ou-se:ununstabilize-bits, r=kennytmbors-3/+0
Revert reverting of stabilizing integer::BITS. Now that `lexical-core` has an updated version that won't break with this stabilization, let's try to stabilize this again. See https://github.com/rust-lang/rust/issues/81654#issuecomment-778564715 Tracking issue with FCP: https://github.com/rust-lang/rust/issues/76904
2021-03-25Auto merge of #83445 - erikdesjardins:rmunion, r=RalfJungbors-1/+33
RemoveZsts: don't touch unions This should fix a Miri ICE r? `@RalfJung`
2021-03-25Auto merge of #83307 - richkadel:cov-unused-functions-1.1, r=tmandrybors-209/+456
coverage bug fixes and optimization support Adjusted LLVM codegen for code compiled with `-Zinstrument-coverage` to address multiple, somewhat related issues. Fixed a significant flaw in prior coverage solution: Every counter generated a new counter variable, but there should have only been one counter variable per function. This appears to have bloated .profraw files significantly. (For a small program, it increased the size by about 40%. I have not tested large programs, but there is anecdotal evidence that profraw files were way too large. This is a good fix, regardless, but hopefully it also addresses related issues. Fixes: #82144 Invalid LLVM coverage data produced when compiled with -C opt-level=1 Existing tests now work up to at least `opt-level=3`. This required a detailed analysis of the LLVM IR, comparisons with Clang C++ LLVM IR when compiled with coverage, and a lot of trial and error with codegen adjustments. The biggest hurdle was figuring out how to continue to support coverage results for unused functions and generics. Rust's coverage results have three advantages over Clang's coverage results: 1. Rust's coverage map does not include any overlapping code regions, making coverage counting unambiguous. 2. Rust generates coverage results (showing zero counts) for all unused functions, including generics. (Clang does not generate coverage for uninstantiated template functions.) 3. Rust's unused functions produce minimal stubbed functions in LLVM IR, sufficient for including in the coverage results; while Clang must generate the complete LLVM IR for each unused function, even though it will never be called. This PR removes the previous hack of attempting to inject coverage into some other existing function instance, and generates dedicated instances for each unused function. This change, and a few other adjustments (similar to what is required for `-C link-dead-code`, but with lower impact), makes it possible to support LLVM optimizations. Fixes: #79651 Coverage report: "Unexecuted instantiation:..." for a generic function from multiple crates Fixed by removing the aforementioned hack. Some "Unexecuted instantiation" notices are unavoidable, as explained in the `used_crate.rs` test, but `-Zinstrument-coverage` has new options to back off support for either unused generics, or all unused functions, which avoids the notice, at the cost of less coverage of unused functions. Fixes: #82875 Invalid LLVM coverage data produced with crate brotli_decompressor Fixed by disabling the LLVM function attribute that forces inlining, if `-Z instrument-coverage` is enabled. This attribute is applied to Rust functions with `#[inline(always)], and in some cases, the forced inlining breaks coverage instrumentation and reports. FYI: `@wesleywiser` r? `@tmandry`
2021-03-25Rollup merge of #83442 - durin42:remove-questionable-macros, r=cuviperYuki Okushi-7/+0
LLVMWrapper: attractive nuisance macros This came up in the review of #83425: it's hard to imagine a use of LLVM_VERSION_LE() or LLVM_VERSION_EQ() that's not asking for trouble when a point release gets created, so let's just discard them to prevent the issue.
2021-03-25Rollup merge of #83427 - llogiq:refactor-emitter, r=estebankYuki Okushi-20/+14
small cleanups in rustc_errors / emitter This is either moving code around so it gets called less often or using if let instead of match in a few cases.
2021-03-24Revert "Revert stabilizing integer::BITS."Mara Bos-3/+0
2021-03-24Review commentsJack Huey-20/+51
2021-03-24resolve late lifetimes by itemJack Huey-173/+287
This reverts commit 22ae20733515d710c1134600bc1e29cdd76f6b9b.
2021-03-24Use `EvaluatedToOkModuloRegions` whenever we erase regionsAaron Hill-1/+14
Fixes #80691 When we evaluate a trait predicate, we convert an `EvaluatedToOk` result to `EvaluatedToOkModuloRegions` if we erased any regions. We cache the result under a region-erased 'freshened' predicate, so `EvaluatedToOk` may not be correct for other predicates that have the same cache key.
2021-03-24LLVMWrapper: attractive nuisance macrosAugie Fackler-7/+0
THis came up in the review of #83425: it's hard to imagine a use of LLVM_VERSION_LE() or LLVM_VERSION_EQ() that's not asking for trouble when a point release gets created, so let's just discard them to prevent the issue.
2021-03-24RemoveZsts: don't touch unionsErik Desjardins-1/+33
2021-03-24Auto merge of #83364 - sexxi-goose:fix-83176, r=nikomatsakisbors-19/+4
2229 migration: Don't try resolve regions before writeback In the analysis use `resolve_vars_if_possible` instead of `fully_resolve`, because we might not have performed regionck yet. Fixes: #83176 r? `@nikomatsakis`
2021-03-24Auto merge of #83050 - osa1:issue83048, r=matthewjasperbors-24/+31
Run analyses before thir-tree dumps Fixes #83048
2021-03-24Auto merge of #75384 - JulianKnodt:cg_def, r=varkor,lcnrbors-145/+237
implement `feature(const_generics_defaults)` Implements const generics defaults `struct Example<const N: usize=3>`, as well as a query for getting the default of a given const-parameter's def id. There are some remaining FIXME's but they were specified as not blocking for merging this PR. This also puts the defaults behind the unstable feature gate `#![feature(const_generics_defaults)]`. ~~This currently creates a field which is always false on `GenericParamDefKind` for future use when consts are permitted to have defaults. I'm not sure if this is exactly what is best for adding default parameters, but I mimicked the style of type defaults, so hopefully this is ok.~~ r? `@lcnr`
2021-03-24Rollup merge of #83392 - ehuss:w-help-edition, r=varkorDylan DPC-1/+6
Change `-W help` to display edition level. `-W help` was not honoring the `--edition` flag when displaying the default lint level. It was using the edition for sorting, but not for the final display. This isn't important right now as there aren't any edition-specific lint levels. Also, the `declare_lint` macro is broken and doesn't even allow setting them right now. However, I figure it wouldn't hurt to fix this before I forget about it, in case edition-specific lints are ever used in the future.
2021-03-24Rollup merge of #83391 - hyd-dev:uwtable, r=alexcrichtonDylan DPC-2/+12
Allow not emitting `uwtable` on Android `uwtable` is marked as required on Android, so it can't be disabled via `-C force-unwind-tables=no`. However, I found that the reason it's marked as required was to resolve a [backtrace issue in Gecko](https://github.com/rust-lang/rust/issues/49867), and I haven't find any other reasons that make it required ([yet](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Unwind.20tables.20are.20strictly.20required.20on.20Windows.20and.20Android)). Therefore, I assume it's safe to turn it off if a (nice) backtrace is not needed, and submit this PR to allow `-C force-unwind-tables=no` when targeting Android. Note that I haven't tested this change on Android as I don't have an Android environment for testing.
2021-03-24Rollup merge of #83313 - cjgillot:assert, r=michaelwoeristerDylan DPC-0/+28
Only enable assert_dep_graph when query-dep-graph is enabled. This is a debugging option. The only effect should be on rustc tests. r? ``@michaelwoerister``
2021-03-23Changes from review commentsRich Kadel-26/+33
2021-03-24small cleanups in rustc_errors / emitterAndre Bogus-20/+14
2021-03-23GenericParam does not need to be a HIR owner.Camille GILLOT-54/+6
2021-03-23Update to not have extra matchkadmin-28/+10
2021-03-23Update with commentskadmin-30/+39
2021-03-23Update with commentskadmin-17/+16
A bunch of nits fixed, and a new test for pretty printing the AST.
2021-03-23Add query for const_param_defaultkadmin-27/+52
2021-03-23progress, stuff compiles nowlcnr-53/+68
2021-03-23Some refactoringvarkor-40/+52