summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty
AgeCommit message (Collapse)AuthorLines
2020-12-10Fix exhaustiveness in case a byte string literal is used at slice typeoli-0/+9
2020-11-10Rollup merge of #78890 - o752d:patch-2, r=jyn514Jonas Schievink-1/+1
comment attribution fix comment means to refer to the macro in its direct scope
2020-11-10Rollup merge of #78875 - petrochenkov:cleantarg, r=Mark-SimulacrumJonas Schievink-7/+6
rustc_target: Further cleanup use of target options Follow up to https://github.com/rust-lang/rust/pull/77729. Implements items 2 and 4 from the list in https://github.com/rust-lang/rust/pull/77729#issue-500228243. The first commit collapses uses of `target.options.foo` into `target.foo`. The second commit renames some target options to avoid tautology: `target.target_endian` -> `target.endian` `target.target_c_int_width` -> `target.c_int_width` `target.target_os` -> `target.os` `target.target_env` -> `target.env` `target.target_vendor` -> `target.vendor` `target.target_family` -> `target.os_family` `target.target_mcount` -> `target.mcount` r? `@Mark-Simulacrum`
2020-11-09Rollup merge of #78502 - matthewjasper:chalkup, r=nikomatsakisDylan DPC-1/+1
Update Chalk to 0.36.0 This PR updates Chalk and fixes a number of bugs in the chalk integration code. cc `@rust-lang/wg-traits` r? `@nikomatsakis`
2020-11-09comment attribution fixo752d-1/+1
comment means to refer to the macro in its direct scope
2020-11-09Rollup merge of #78674 - tmiasko:inline-substs-for-mir-body, r=oli-obkDylan DPC-2/+25
inliner: Use substs_for_mir_body Changes from 68965 extended the kind of instances that are being inlined. For some of those, the `instance_mir` returns a MIR body that is already expressed in terms of the types found in substitution array, and doesn't need further substitution. Use `substs_for_mir_body` to take that into account. Resolves #78529. Resolves #78560.
2020-11-08rustc_target: Rename some target options to avoid tautologyVadim Petrochenkov-6/+5
`target.target_endian` -> `target.endian` `target.target_c_int_width` -> `target.c_int_width` `target.target_os` -> `target.os` `target.target_env` -> `target.env` `target.target_vendor` -> `target.vendor` `target.target_family` -> `target.os_family` `target.target_mcount` -> `target.mcount`
2020-11-08Collapse all uses of `target.options.foo` into `target.foo`Vadim Petrochenkov-1/+1
with an eye on merging `TargetOptions` into `Target`. `TargetOptions` as a separate structure is mostly an implementation detail of `Target` construction, all its fields logically belong to `Target` and available from `Target` through `Deref` impls.
2020-11-07Remove unused `from_hir` callJoshua Nelson-5/+3
2020-11-07Fix handling of item names for HIRJoshua Nelson-20/+45
- Handle variants, fields, macros in `Node::ident()` - Handle the crate root in `opt_item_name` - Factor out `item_name_from_def_id` to reduce duplication - Look at HIR before the DefId for `opt_item_name` This gives accurate spans, which are not available from serialized metadata. - Don't panic on the crate root in `opt_item_name` - Add comments
2020-11-06Auto merge of #78267 - richkadel:llvm-coverage-counters-2.0.3r1, r=tmandrybors-0/+1
Working expression optimization, and some improvements to branch-level source coverage This replaces PR #78040 after reorganizing the original commits (by request) into a more logical sequence of major changes. Most of the work is in the MIR `transform/coverage/` directory (originally, `transform/instrument_coverage.rs`). Note this PR includes some significant additional debugging capabilities, to help myself and any future developer working on coverage improvements or issues. In particular, there's a new Graphviz (.dot file) output for the coverage graph (the `BasicCoverageBlock` control flow graph) that provides ways to get some very good insight into the relationships between the MIR, the coverage graph BCBs, coverage spans, and counters. (There are also some cool debugging options, available via environment variable, to alter how some data in the graph appears.) And the code for this Graphviz view is actually generic... it can be used by any implementation of the Rust `Graph` traits. Finally (for now), I also now output information from `llvm-cov` that shows the actual counters and spans it found in the coverage map, and their counts (from the `--debug` flag). I found this to be enormously helpful in debugging some coverage issues, so I kept it in the test results as well for additional context. `@tmandry` `@wesleywiser` r? `@tmandry` Here's an example of the new coverage graph: * Within each `BasicCoverageBlock` (BCB), you can see each `CoverageSpan` and its contributing statements (MIR `Statement`s and/or `Terminator`s) * Each `CoverageSpan` has a `Counter` or and `Expression`, and `Expression`s show their Add/Subtract operation with nested operations. (This can be changed to show the Counter and Expression IDs instead, or in addition to, the BCB.) * The terminators of all MIR `BasicBlock`s in the BCB, including one final `Terminator` * If an "edge counter" is required (because we need to count an edge between blocks, in some cases) the edge's Counter or Expression is shown next to its label. (Not shown in the example below.) (FYI, Edge Counters are converted into a new MIR `BasicBlock` with `Goto`) <img width="1116" alt="Screen Shot 2020-10-17 at 12 23 29 AM" src="https://user-images.githubusercontent.com/3827298/96331095-616cb480-100f-11eb-8212-60f2d433e2d8.png"> r? `@tmandry` FYI: `@wesleywiser`
2020-11-06Auto merge of #77856 - GuillaumeGomez:automatic-links-lint, r=jyn514,ollie27bors-1/+1
Add non_autolinks lint Part of #77501. r? `@jyn514`
2020-11-05Rust coverage before splitting instrument_coverage.rsRich Kadel-0/+1
2020-11-06inliner: Use substs_for_mir_bodyTomasz Miąsko-2/+25
Changes from 68965 extended the kind of instances that are being inlined. For some of those, the `instance_mir` returns a MIR body that is already expressed in terms of the types found in substitution array, and doesn't need further substitution. Use `substs_for_mir_body` to take that into account.
2020-11-05Fix even more URLsGuillaume Gomez-1/+1
2020-11-05Fixed typo in commentIkko Ashimine-1/+1
paramter -> parameter
2020-11-04Make `ScalarInt` entirely independent of MIR interpretationoli-4/+3
2020-11-04Document an `unwrap`oli-1/+4
2020-11-04`u128` truncation and sign extension are not just interpreter relatedoli-12/+11
2020-11-04Update compiler/rustc_middle/src/ty/consts/int.rsOli Scherer-1/+1
Co-authored-by: Ralf Jung <post@ralfj.de>
2020-11-04Simplify `assert_bits` imploli-4/+3
2020-11-04Do not raise interp errors from the scalar int moduleoli-18/+15
2020-11-04Add `is_null` helperoli-0/+5
This is cheaper than creating a null-`ScalarInt` and comparing and then just throwing it away.
2020-11-04Explain why we forward to self-printing during self-printingoli-1/+2
2020-11-04catch conversion errors during `ptr_sized_op`oli-1/+1
2020-11-04Replace `Scalar::zst` with a `Scalar::ZST` constantoli-2/+2
2020-11-04No need for a `zst` constructor method when we can have a constantoli-5/+0
2020-11-04Update commentoli-3/+2
2020-11-04Unaligned reads are UB in Rust irrelevant on which platform we areoli-4/+4
2020-11-04Remove outdated FIXMEoli-1/+0
2020-11-04s/Scalar::Raw/Scalar::Intoli-9/+9
2020-11-04Fix cranelift buildoli-0/+14
2020-11-04Explain the use of blocks around `self.data` accessesoli-0/+14
2020-11-04Use packed struct instead of manually packing into an arrayoli-36/+39
2020-11-04Encode `ScalarInt::bytes` as `u128` instead of `[u8; 16]` to see if that ↵Oliver Scherer-1/+15
caused the performance regression
2020-11-04Split the "raw integer bytes" part out of `Scalar`Oliver Scherer-46/+252
2020-10-30Auto merge of #78182 - LeSeulArtichaut:ty-visitor-contolflow, r=lcnr,oli-obkbors-111/+152
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-30Fix query cycle when tracing explicit_item_boundsMatthew Jasper-1/+1
2020-10-30Remove implicit `Continue` typeLeSeulArtichaut-64/+58
2020-10-30Use `ControlFlow::is{break,continue}`LeSeulArtichaut-6/+4
2020-10-30TypeVisitor: use `std::ops::ControlFlow` instead of `bool`LeSeulArtichaut-110/+159
2020-10-30Rollup merge of #78545 - jackh726:anonymous, r=oli-obkYuki Okushi-2/+3
Make anonymous binders start at 0 A few changes to some test outputs, but these actually look *more* correct to me.
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
2020-10-29Make anonymous binders start at 0Jack Huey-2/+3
2020-10-29Rollup merge of #78244 - workingjubilee:dogfood-fancy-ranges, r=varkorJonas Schievink-5/+5
Dogfood {exclusive,half-open} ranges in compiler (nfc) In particular, this allows us to write more explicit matches that avoid the pitfalls of using a fully general fall-through case, yet remain fairly ergonomic. Less logic is in guard cases, more is in the actual exhaustive case analysis. No functional changes.
2020-10-28Dogfood {exclusive,half-open} ranges in compiler (nfc)Jubilee Young-5/+5
In particular, this allows us to write more explicit matches that avoid the pitfalls of using a fully general fall-through case, yet remain fairly ergonomic. Less logic is in guard cases, more is in the actual exhaustive case analysis. No functional changes.
2020-10-28Auto merge of #78323 - est31:smaller_list_overlap, r=varkorbors-0/+4
Iterate over the smaller list If there are two lists of different sizes, iterating over the smaller list and then looking up in the larger list is cheaper than vice versa, because lookups scale sublinearly.
2020-10-27Address commentsRoxane-9/+20
2020-10-27Auto merge of #77502 - varkor:const-generics-suggest-enclosing-braces, ↵bors-1/+1
r=petrochenkov Suggest that expressions that look like const generic arguments should be enclosed in brackets I pulled out the changes for const expressions from https://github.com/rust-lang/rust/pull/71592 (without the trait object diagnostic changes) and made some small changes; the implementation is `@estebank's.` We're also going to want to make some changes separately to account for trait objects (they result in poor diagnostics, as is evident from one of the test cases here), such as an adaption of https://github.com/rust-lang/rust/pull/72273. Fixes https://github.com/rust-lang/rust/issues/70753. r? `@petrochenkov`
2020-10-27Handle type errors in closure/generator upvar_tysAman Arora-7/+27
Co-authored-by: Roxane Fruytier <roxane.fruytier@hotmail.com>