about summary refs log tree commit diff
path: root/src/librustc_middle
AgeCommit message (Collapse)AuthorLines
2020-06-22Revert "Rollup merge of #72389 - Aaron1011:feature/move-fn-self-msg, ↵Aaron Hill-28/+7
r=nikomatsakis" This reverts commit 372cb9b69c76a042d0b9d4b48ff6084f64c84a2c, reversing changes made to 5c61a8dc34c3e2fc6d7f02cb288c350f0233f944.
2020-06-21num_counters to u32, after implementing TypeFoldableRich Kadel-1/+2
2020-06-21Auto merge of #73180 - matthewjasper:predicate-cache, r=nikomatsakisbors-81/+286
Cache flags and escaping vars for predicates With predicates becoming interned (rust-lang/compiler-team#285) this is now possible and could be a perf win. It would become an even larger win once we have recursive predicates. cc @lcnr @nikomatsakis r? @ghost
2020-06-21Auto merge of #72936 - jackh726:chalk-more, r=nikomatsakisbors-53/+46
Upgrade Chalk Things done in this PR: - Upgrade Chalk to `0.11.0` - Added compare-mode=chalk - Bump rustc-hash in `librustc_data_structures` to `1.1.0` to match Chalk - Removed `RustDefId` since the builtin type support is there - Add a few more `FIXME(chalk)`s for problem spots I hit when running all tests with chalk - Added some more implementation code for some newer builtin Chalk types (e.g. `FnDef`, `Array`) - Lower `RegionOutlives` and `ObjectSafe` predicates - Lower `Dyn` without the region - Handle `Int`/`Float` `CanonicalVarKind`s - Uncomment some Chalk tests that actually work now - Remove the revisions in `src/test/ui/coherence/coherence-subtyping.rs` since they aren't doing anything different r? @nikomatsakis
2020-06-21remove switch_ty reliance in codegenRalf Jung-0/+2
2020-06-21Make is_freeze and is_copy_modulo_regions take TyCtxtAtRalf Jung-11/+5
2020-06-21Cache flags and escaping vars for predicatesMatthew Jasper-28/+202
Also hash predicates by address
2020-06-21Cache decoded predicate shorthandsMatthew Jasper-53/+84
2020-06-20Auto merge of #73563 - Manishearth:rollup-oowgwwm, r=Manishearthbors-22/+35
Rollup of 9 pull requests Successful merges: - #72456 (Try to suggest dereferences on trait selection failed) - #72788 (Projection bound validation) - #72790 (core/time: Add Duration methods for zero) - #73227 (Allow multiple `asm!` options groups and report an error on duplicate options) - #73287 (lint: normalize projections using opaque types) - #73291 (Pre-compute `LocalDefId` <-> `HirId` mappings and remove `NodeId` <-> `HirId` conversion APIs) - #73378 (Remove use of specialization from librustc_arena) - #73411 (Update bootstrap to rustc 1.45.0-beta.2 (1dc0f6d8e 2020-06-15)) - #73443 (ci: allow gating GHA on everything but macOS) Failed merges: r? @ghost
2020-06-20Rollup merge of #73378 - matthewjasper:arena-not-special, r=oli-obkManish Goregaokar-1/+0
Remove use of specialization from librustc_arena This reworks the macro so that specialization, `transmute` and `#[marker]` are not used. r? @oli-obk
2020-06-20Rollup merge of #73291 - marmeladema:hir-id-ification-fix, r=petrochenkovManish Goregaokar-16/+7
Pre-compute `LocalDefId` <-> `HirId` mappings and remove `NodeId` <-> `HirId` conversion APIs cc #50928 I don't know who is exactly the best person to review this. r? @petrochenkov
2020-06-20Rollup merge of #73539 - LukasKalbertodt:deprecate-vec-remove-item, ↵Ralf Jung-1/+0
r=Mark-Simulacrum Deprecate `Vec::remove_item` In #40062 we decided to remove that method. In #71834 it was said that we want to deprecate it for a few cycles before removing it. That's what this PR does.
2020-06-20Move bounds on associated types to the typeMatthew Jasper-0/+10
Given `trait X { type U; }` the bound `<Self as X>::U` now lives on the type, rather than the trait. This is feature gated on `feature(generic_associated_types)` for now until more testing can be done. The also enabled type-generic associated types since we no longer need "implies bounds".
2020-06-20Don't set STILL_FURTHER_SPECIALIZABLE for regions/bound variablesMatthew Jasper-5/+0
2020-06-20Consider fewer predicates for projection candidatesMatthew Jasper-0/+18
We now require that projection candidates are applicable with the idenitity substs of the trait, rather than allowing predicates that are only applicable for certain substs.
2020-06-20Remove uses of `Vec::remove_item`Lukas Kalbertodt-1/+0
2020-06-20Remove `HirId` to `NodeId` conversion APIsmarmeladema-12/+4
2020-06-20Remove `NodeId` to `HirId` conversion APIsmarmeladema-1/+0
2020-06-20Move `trait_map` into `hir::Crate`marmeladema-3/+3
2020-06-20int -> i32Bastian Kauschke-22/+24
2020-06-19Rollup merge of #73458 - tmiasko:arena-layout, r=matthewjasperManish Goregaokar-12/+5
Use alloc::Layout in DroplessArena API
2020-06-19Rollup merge of #73452 - matthewjasper:auto-rec, r=nikomatsakisManish Goregaokar-0/+10
Unify region variables when projecting associated types This is required to avoid cycles when evaluating auto trait predicates. Notably, this is required to be able add Chalk types to `CtxtInterners` for `cfg(parallel_compiler)`. r? @nikomatsakis
2020-06-19Rollup merge of #73442 - ↵Manish Goregaokar-2/+13
davidtwco:issue-72181-pretty-print-const-val-enum-no-variants, r=oli-obk pretty/mir: const value enums with no variants Fixes #72181. This PR modifies the pretty printer and const eval in the MIR so that `destructure_const` (used in `pretty_print_const_value`) can handle enums with no variants (or types containing enums with no variants). I'm not convinced that this is the correct approach, folks more familiar with `destructure_const` would be able to say - happy to adjust the PR. Looking through `destructure_const` and the functions that it invokes, it didn't seem like it was written to handle zero-variant-enums - I assume that case is handled earlier in some way so `destructure_const` doesn't need to under normal circumstances. It didn't seem like it would be straightforward to make `destructure_const` handle this case in a first-class-feeling way (e.g. adding a `Variants::None` variant), so this PR makes some minimal changes to avoid ICEs.
2020-06-19Rollup merge of #73359 - jonas-schievink:do-the-shimmy, r=matthewjasperManish Goregaokar-11/+41
shim.rs: avoid creating `Call` terminators calling `Self` Also contains some cleanup and doc comment additions so I could make sense of the code. Fixes https://github.com/rust-lang/rust/issues/73109 Closes https://github.com/rust-lang/rust/pull/73175 r? @matthewjasper
2020-06-19Rollup merge of #73347 - tmiasko:incompatible-sanitizers, r=nikicManish Goregaokar-10/+7
Diagnose use of incompatible sanitizers Emit an error when incompatible sanitizer are configured through command line options. Previously the last one configured prevailed and others were silently ignored. Additionally use a set to represent configured sanitizers, making it possible to enable multiple sanitizers at once. At least in principle, since currently all of them are considered to be incompatible with others.
2020-06-19Rollup merge of #72689 - lcnr:common_str, r=estebankManish Goregaokar-6/+3
add str to common types I already expected this to be the case and it may slightly improve perf. Afaict if we ever want to change str into a lang item this would have to get reverted. As that would be fairly simple I don't believe this to cause any problems in the future.
2020-06-19Account for multiple impl/dyn Trait in return type when suggesting `'_`Esteban Küber-36/+27
2020-06-19Change InternedAdtDef to &'tcx AdtDefJack Huey-2/+2
2020-06-19Update chalk to 0.11.0Jack-2/+1
2020-06-19Lower constsJack Huey-1/+2
2020-06-19Update chalk and add LifetimeOutlives and ObjectSafe loweringJack Huey-1/+1
2020-06-19Update ChalkJack Huey-1/+1
2020-06-19Remove RustDefIdJack Huey-17/+3
2020-06-19Implement fn_def_datumJack Huey-1/+1
2020-06-19Use builtin types for Never, Array, and FnDefJack Huey-3/+1
2020-06-19Update chalkJack Huey-27/+42
2020-06-19Update chalkJack Huey-7/+3
2020-06-19Add compare-mode=chalk and add a little bit more implementations and fixmesJack Huey-3/+1
2020-06-19code coverage foundation for hash and num_countersRich Kadel-4/+59
Replaced dummy values for hash and num_counters with computed values, and refactored InstrumentCoverage pass to simplify injecting more counters per function in upcoming versions. Improved usage documentation and error messaging.
2020-06-19Rollup merge of #73357 - petrochenkov:tmap, r=davidtwcoManish Goregaokar-10/+10
Use `LocalDefId` for import IDs in trait map cc https://github.com/rust-lang/rust/pull/73291#discussion_r439734867
2020-06-19Rollup merge of #73257 - davidtwco:issue-73249-improper-ctypes-projection, ↵Manish Goregaokar-23/+13
r=lcnr,varkor ty: projections in `transparent_newtype_field` Fixes #73249. This PR modifies `transparent_newtype_field` so that it handles projections with generic parameters, where `normalize_erasing_regions` would ICE.
2020-06-19pretty/mir: const value enums with no variantsDavid Wood-2/+13
This commit modifies the pretty printer and const eval in the MIR so that `destructure_const` (used in `pretty_print_const_value`) can handle enums with no variants (or types containing enums with no variants). Signed-off-by: David Wood <david@davidtw.co>
2020-06-19Rollup merge of #73011 - richkadel:llvm-count-from-mir-pass, r=tmandryRalf Jung-0/+28
first stage of implementing LLVM code coverage This PR replaces #70680 (WIP toward LLVM Code Coverage for Rust) since I am re-implementing the Rust LLVM code coverage feature in a different part of the compiler (in MIR pass(es) vs AST). This PR updates rustc with `-Zinstrument-coverage` option that injects the llvm intrinsic `instrprof.increment()` for code generation. This initial version only injects counters at the top of each function, and does not yet implement the required coverage map. Upcoming PRs will add the coverage map, and add more counters and/or counter expressions for each conditional code branch. Rust compiler MCP https://github.com/rust-lang/compiler-team/issues/278 Relevant issue: #34701 - Implement support for LLVMs code coverage instrumentation ***[I put together some development notes here, under a separate branch.](https://github.com/richkadel/rust/blob/cfa0b21d34ee64e4ebee226101bd2ef0c6757865/src/test/codegen/coverage-experiments/README-THIS-IS-TEMPORARY.md)***
2020-06-19ty: simplify `transparent_newtype_field`David Wood-13/+1
This commit removes the normalization from `transparent_newtype_field` - turns out it wasn't necessary and that makes it a bunch simpler - particularly when handling projections. Signed-off-by: David Wood <david@davidtw.co>
2020-06-19lint: unify enum variant, union and struct logicDavid Wood-27/+25
This commit applies the changes introduced in #72890 to both enum variants and unions - where the logic prior to #72890 was duplicated. Signed-off-by: David Wood <david@davidtw.co>
2020-06-19ty: projections in `transparent_newtype_field`David Wood-4/+8
This commit modifies `transparent_newtype_field` so that it handles projections with generic parameters, where `normalize_erasing_regions` would ICE. Signed-off-by: David Wood <david@davidtw.co>
2020-06-19Rollup merge of #72497 - RalfJung:tag-term, r=oli-obkRalf Jung-32/+32
tag/niche terminology cleanup The term "discriminant" was used in two ways throughout the compiler: * every enum variant has a corresponding discriminant, that can be given explicitly with `Variant = N`. * that discriminant is then encoded in memory to store which variant is active -- but this encoded form of the discriminant was also often called "discriminant", even though it is conceptually quite different (e.g., it can be smaller in size, or even use niche-filling). After discussion with @eddyb, this renames the second term to "tag". The way the tag is encoded can be either `TagEncoding::Direct` (formerly `DiscriminantKind::Tag`) or `TagEncoding::Niche` (formerly `DiscrimianntKind::Niche`). This finally resolves some long-standing confusion I had about the handling of variant indices and discriminants, which surfaced in https://github.com/rust-lang/rust/pull/72419. (There is also a `DiscriminantKind` type in libcore, it remains unaffected. I think this corresponds to the discriminant, not the tag, so that seems all right.) r? @eddyb
2020-06-18Rollup merge of #73034 - doctorn:nomangle-inline-linkage, r=matthewjasperManish Goregaokar-4/+4
Export `#[inline]` fns with extern indicators In ancient history (#36280) we stopped `#[inline]` fns being codegened if they weren't used. However, - #72944 - #72463 observe that when writing something like ```rust #![crate_type = "cdylib"] #[no_mangle] #[inline] pub extern "C" fn foo() { // ... } ``` we really _do_ want `foo` to be codegened. This change makes this the case. Resolves #72944, resolves #72463 (and maybe some more)
2020-06-18Rollup merge of #72814 - RalfJung:mir-visir-terminator, r=oli-obkManish Goregaokar-46/+34
remove visit_terminator_kind from MIR visitor For some reason, we had both `visit_terminator` and `visit_terminator_kind`. In contrast, for `Statement` we just have `visit_statement`. So this cleans things up by removing `visit_terminator_kind` and porting its users to `visit_terminator`.
2020-06-18Rollup merge of #72804 - estebank:opaque-missing-lts-in-fn-2, r=nikomatsakisManish Goregaokar-9/+17
Further tweak lifetime errors involving `dyn Trait` and `impl Trait` in return position * Suggest substituting `'static` lifetime in impl/dyn `Trait + 'static` instead of `Trait + 'static + '_` * When `'static` is explicit, also suggest constraining argument with it * Reduce verbosity of suggestion message and mention lifetime in label * Tweak output for overlapping required/captured spans * Give these errors an error code Follow up to #72543. r? @nikomatsakis