summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2020-12-10Fix exhaustiveness in case a byte string literal is used at slice typeoli-0/+9
2020-12-10Revert "Prevent forbid from being ignored if overriden at the same level."Mark Rousskov-19/+1
This reverts commit afa2a675453091773eb9dd1b19389725526224b9.
2020-11-12Auto merge of #78782 - petrochenkov:nodoctok, r=Aaron1011bors-2/+2
Do not collect tokens for doc comments Doc comment is a single token and AST has all the information to re-create it precisely. Doc comments are also responsible for majority of calls to `collect_tokens` (with `num_calls == 1` and `num_calls == 0`, cc https://github.com/rust-lang/rust/pull/78736). (I also moved token collection into `fn parse_attribute` to deduplicate code a bit.) r? `@Aaron1011`
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 #78830 - lcnr:mir-folder, r=oli-obkDylan DPC-17/+14
fix `super_visit_with` for `Terminator` fixes https://github.com/rust-lang/rust/pull/78182#discussion_r509265149 r? `@oli-obk` cc `@LeSeulArtichaut`
2020-11-09Rollup merge of #78502 - matthewjasper:chalkup, r=nikomatsakisDylan DPC-43/+27
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-09Rollup merge of #78345 - jyn514:proper-names, r=varkorDylan DPC-21/+44
Fix handling of item names for HIR - Handle variants, fields, macros in `Node::ident()` - Handle the crate root in `opt_item_name` - Rewrite `item_name` in terms of `opt_item_name` I need this for both https://github.com/rust-lang/rust/pull/77820 and https://github.com/rust-lang/rust/pull/78082, so splitting it out into a separate PR so it can land early.
2020-11-09Rollup merge of #77640 - ethanboxx:int_error_matching_attempt_2, r=KodrAusDylan DPC-2/+4
Refactor IntErrorKind to avoid "underflow" terminology This PR is a continuation of #76455 # Changes - `Overflow` renamed to `PosOverflow` and `Underflow` renamed to `NegOverflow` after discussion in #76455 - Changed some of the parsing code to return `InvalidDigit` rather than `Empty` for strings "+" and "-". https://users.rust-lang.org/t/misleading-error-in-str-parse-for-int-types/49178 - Carry the problem `char` with the `InvalidDigit` variant. - Necessary changes were made to the compiler as it depends on `int_error_matching`. - Redid tests to match on specific errors. r? ```@KodrAus```
2020-11-09Do not collect tokens for doc commentsVadim Petrochenkov-2/+2
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-21/+46
- 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-07fix `super_visit_with` for `Terminator`Bastian Kauschke-17/+14
2020-11-06Auto merge of #78267 - richkadel:llvm-coverage-counters-2.0.3r1, r=tmandrybors-25/+71
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-5/+5
Add non_autolinks lint Part of #77501. r? `@jyn514`
2020-11-05Addressed all feedback to dateRich Kadel-14/+0
2020-11-05Rust coverage before splitting instrument_coverage.rsRich Kadel-25/+85
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-5/+5
2020-11-05Rollup merge of #78758 - eltociear:patch-1, r=jyn514Mara Bos-1/+1
Fixed typo in comment paramter -> parameter
2020-11-05Rollup merge of #78742 - vn-ki:fix-issue-78655, r=oli-obkMara Bos-3/+9
make intern_const_alloc_recursive return error fix #78655 r? ``@oli-obk``
2020-11-05Rollup merge of #78733 - matthiaskrgr:cl11ppy, r=jyn514Mara Bos-2/+2
fix a couple of clippy warnings: filter_next manual_strip redundant_static_lifetimes single_char_pattern unnecessary_cast unused_unit op_ref redundant_closure useless_conversion
2020-11-05Fixed typo in commentIkko Ashimine-1/+1
paramter -> parameter
2020-11-04make intern_const_alloc_recursive return error fix #78655Vishnunarayan K I-3/+9
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-49/+15
2020-11-04fix a couple of clippy warnings:Matthias Krüger-2/+2
filter_next manual_strip redundant_static_lifetimes single_char_pattern unnecessary_cast unused_unit op_ref redundant_closure useless_conversion
2020-11-04Move ZST constant to the top of the impl blockoli-2/+2
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-20/+23
2020-11-04Add helper for getting an `int` out of a `Scalar`oli-0/+8
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-6/+3
2020-11-04No need for a `zst` constructor method when we can have a constantoli-6/+1
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-32/+32
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