about summary refs log tree commit diff
path: root/compiler/rustc_middle
AgeCommit message (Collapse)AuthorLines
2021-11-29Prepare for more ParamEnv flagsOli Scherer-10/+15
2021-11-28Remove unused root_parent.Camille GILLOT-12/+4
2021-11-28Remove eval_always for lib_features.Camille GILLOT-7/+1
2021-11-28Take a LocalDefId in expect_*item.Camille GILLOT-15/+15
2021-11-27Visit type in process_projection_elem.Camille GILLOT-1/+5
2021-11-27Remove erroneous merge conflictAlan Egerton-4/+0
2021-11-26Small mir-opt refactorScott McMurray-0/+8
Hopefully-non-controversial changes from some not-ready-yet work that I'd figured I'd submit on their own.
2021-11-26Unwrap the results of type foldersLeSeulArtichaut-14/+17
Co-authored-by: Alan Egerton <eggyal@gmail.com>
2021-11-26Adapt `TypeFolder` implementors to return a `Result`LeSeulArtichaut-97/+136
Co-authored-by: Alan Egerton <eggyal@gmail.com>
2021-11-26Make `TypeFoldable` implementors short-circuit on errorLeSeulArtichaut-195/+222
Co-authored-by: Alan Egerton <eggyal@gmail.com>
2021-11-26Make `TypeFolder::fold_*` return `Result`LeSeulArtichaut-8/+19
2021-11-25Auto merge of #90580 - cjgillot:no-ee-upvar, r=Aaron1011bors-1/+0
Remove eval_always from upvars. Split off https://github.com/rust-lang/rust/pull/86056 r? `@ghost`
2021-11-25Rollup merge of #91162 - RalfJung:miri-shift-truncation, r=oli-obkMatthias Krüger-0/+8
explain why CTFE/Miri perform truncation on shift offset Closes https://github.com/rust-lang/miri/issues/1920
2021-11-25Rollup merge of #91096 - compiler-errors:elaborate_opaque_trait, r=estebankMatthias Krüger-75/+280
Print associated types on opaque `impl Trait` types This PR generalizes #91021, printing associated types for all opaque `impl Trait` types instead of just special-casing for future. before: ``` error[E0271]: type mismatch resolving `<impl Iterator as Iterator>::Item == u32` ``` after: ``` error[E0271]: type mismatch resolving `<impl Iterator<Item = usize> as Iterator>::Item == u32` ``` --- Questions: 1. I'm kinda lost in binders hell with this one. Is all of the `rebind`ing necessary? 2. Is there a map collection type that will give me a stable iteration order? Doesn't seem like TraitRef is Ord, so I can't just sort later.. 3. I removed the logic that suppresses printing generator projection types. It creates outputs like this [gist](https://gist.github.com/compiler-errors/d6f12fb30079feb1ad1d5f1ab39a3a8d). Should I put that back? 4. I also added spaces between traits, `impl A+B` -> `impl A + B`. I quite like this change, but is there a good reason to keep it like that? r? ````@estebank````
2021-11-24Auto merge of #90579 - cjgillot:no-ee-ii, r=Aaron1011bors-5/+1
Remove eval_always for inherent_impls. Split off https://github.com/rust-lang/rust/pull/86056 r? `@ghost`
2021-11-23document BinOp behavior quirks in the corresponding enumRalf Jung-0/+8
2021-11-23Update CoverageMappingFormat Support to Version6Arpad Borsos-3/+3
Version 5 adds Branch Regions which are a prerequisite for branch coverage. Version 6 can use the zeroth filename as prefix for other relative files.
2021-11-23Fix printing unit return ty, don't elaborate FnOnce unless we see itMichael Goulet-7/+16
2021-11-23Suppress noisy generator associated typeMichael Goulet-4/+14
2021-11-23Elaborate trait generics and associated typesMichael Goulet-74/+210
2021-11-23Add supertraits method to rustc_middleMichael Goulet-0/+50
2021-11-23Derive Ord and PartialOrd for TraitRefMichael Goulet-1/+1
2021-11-23Rollup merge of #91148 - jhpratt:use-default-enum, r=petrochenkovMatthias Krüger-7/+3
Use `derive_default_enum` in the compiler Let's get this feature some real-world love. ``@rustbot`` label: +C-cleanup +S-waiting-on-review
2021-11-23Rollup merge of #90856 - ↵Matthias Krüger-8/+53
ken-matsui:suggestion-to-wrap-vec-allocator-api-in-tuple, r=davidtwco Suggestion to wrap inner types using 'allocator_api' in tuple This PR provides a suggestion to wrap the inner types in tuple when being along with 'allocator_api'. Closes https://github.com/rust-lang/rust/issues/83250 ```rust fn main() { let _vec: Vec<u8, _> = vec![]; //~ ERROR use of unstable library feature 'allocator_api' } ``` ```diff error[E0658]: use of unstable library feature 'allocator_api' --> $DIR/suggest-vec-allocator-api.rs:2:23 | LL | let _vec: Vec<u8, _> = vec![]; - | ^ + | ----^ + | | + | help: consider wrapping the inner types in tuple: `(u8, _)` | = note: see issue #32838 <https://github.com/rust-lang/rust/issues/32838> for more information = help: add `#![feature(allocator_api)]` to the crate attributes to enable ```
2021-11-24Suggestion to wrap inner types using `allocator_api` in tupleKen Matsui-8/+53
2021-11-22Use `derive_default_enum` in the compilerJacob Pratt-7/+3
2021-11-21Simplify for loop desugarCameron Steffen-1/+1
2021-11-20Add space in opaque `impl Trait`Michael Goulet-3/+3
2021-11-20Rollup merge of #91021 - compiler-errors:print_future_output, r=estebankMatthias Krüger-11/+55
Elaborate `Future::Output` when printing opaque `impl Future` type I would love to see the `Output =` type when printing type errors involving opaque `impl Future`. [Test code](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=a800b481edd31575fbcaf5771a9c3678) Before (cut relevant part of output): ``` note: while checking the return type of the `async fn` --> /home/michael/test.rs:5:19 | 5 | async fn bar() -> usize { | ^^^^^ checked the `Output` of this `async fn`, found opaque type = note: expected type `usize` found opaque type `impl Future` ``` After: ``` note: while checking the return type of the `async fn` --> /home/michael/test.rs:5:19 | 5 | async fn bar() -> usize { | ^^^^^ checked the `Output` of this `async fn`, found opaque type = note: expected type `usize` found opaque type `impl Future<Output = usize>` ``` Note the "found opaque type `impl Future<Output = usize>`" in the new output. ---- Questions: 1. We skip printing the output type when it's a projection, since I have been seeing some types like `impl Future<Output = <[static generator@/home/michael/test.rs:2:11: 2:21] as Generator<ResumeTy>>::Return>` which are not particularly helpful and leak implementation detail. * Am I able to normalize this type within `rustc_middle::ty::print::pretty`? Alternatively, can we normalize it when creating the diagnostic? Otherwise, I'm fine with skipping it and falling back to the old output. * Should I suppress any other types? I didn't encounter anything other than this generator projection type. 2. Not sure what the formatting of this should be. Do I include spaces in `Output = `?
2021-11-20Rollup merge of #90999 - RalfJung:miri_simd, r=oli-obkMatthias Krüger-0/+5
fix CTFE/Miri simd_insert/extract on array-style repr(simd) types The changed test would previously fail since `place_index` would just return the only field of `f32x4`, i.e., the array -- rather than *indexing into* the array which is what we have to do. The new helper methods will also be needed for https://github.com/rust-lang/miri/issues/1912. r? ``````@oli-obk``````
2021-11-19Auto merge of #90996 - the8472:obligation-hashes2, r=matthewjasperbors-1/+10
Optimize `impl Hash for ObligationCauseData` by not hashing `ObligationCauseCode` variant fields Split out from #90913 since it's a [clear performance win](https://perf.rust-lang.org/compare.html?start=ad442399756573dccacb314b6bf8079964bcc72a&end=223f5e877fe93b5f437c2d703f883797913cd2b7) and should be easier to review. It speeds up hashing for `Obligation` [deduplication](https://github.com/rust-lang/rust/blob/c9c4b5d7276297679387189d96a952f2b760e7ad/compiler/rustc_trait_selection/src/traits/select/mod.rs#L2355-L2356) by only hashing the discriminant of the `ObligationCauseCode` enum instead of its contents. That shouldn't affect hash quality much since there are several other fields in `Obligation` which should be unique enough, especially the predicate itself which is hashed as an interned pointer.
2021-11-19Rollup merge of #90990 - nnethercote:arenas-cleanup, r=oli-obkYuki Okushi-24/+24
Arenas cleanup I was looking closely at the arenas code and here are some small improvement to readability.
2021-11-18Print output ty for opaque future tyMichael Goulet-11/+55
2021-11-19Add some comments.Nicholas Nethercote-1/+1
Also use `Default::default()` in one `TypedArena::default()`, for consistency with `DroplessArena::default()`.
2021-11-18fix CTFE/Miri simd_insert/extract on array-style repr(simd) typesRalf Jung-0/+5
2021-11-18rustc: Remove `#[rustc_synthetic]`Vadim Petrochenkov-18/+3
This function parameter attribute was introduced in https://github.com/rust-lang/rust/pull/44866 as an intermediate step in implementing `impl Trait`, it's not necessary or used anywhere by itself.
2021-11-17Remove unnecessary lifetime argument from arena macros.Nicholas Nethercote-23/+23
Because it's always `'tcx`. In fact, some of them use a mixture of passed-in `$tcx` and hard-coded `'tcx`, so no other lifetime would even work. This makes the code easier to read.
2021-11-16Auto merge of #90919 - nnethercote:rm-DropArena, r=Mark-Simulacrumbors-10/+5
Remove `DropArena`. Most arena-allocate types that impl `Drop` get their own `TypedArena`, but a few infrequently used ones share a `DropArena`. This sharing adds complexity but doesn't help performance or memory usage. Perhaps it was more effective in the past prior to some other improvements to arenas. This commit removes `DropArena` and the sharing of arenas via the `few` attribute of the `arena_types` macro. This change removes over 100 lines of code and nine uses of `unsafe` (one of which affects the parallel compiler) and makes the remaining code easier to read.
2021-11-16Rollup merge of #90910 - RalfJung:const-discriminant-empty-enum, r=petrochenkovYuki Okushi-1/+3
fix getting the discriminant of a zero-variant enum Fixes https://github.com/rust-lang/rust/issues/89765
2021-11-15Remove `DropArena`.Nicholas Nethercote-10/+5
Most arena-allocate types that impl `Drop` get their own `TypedArena`, but a few infrequently used ones share a `DropArena`. This sharing adds complexity but doesn't help performance or memory usage. Perhaps it was more effective in the past prior to some other improvements to arenas. This commit removes `DropArena` and the sharing of arenas via the `few` attribute of the `arena_types` macro. This change removes over 100 lines of code and nine uses of `unsafe` (one of which affects the parallel compiler) and makes the remaining code easier to read.
2021-11-14Simplify ObligationCauseData hash to skip ObligationCauseCodeThe8472-1/+10
selection deduplicates obligations through a hashset at some point, computing the hashes for ObligationCauseCode appears to dominate the hashing cost. bodyid + span + discriminant hash hopefully will sufficiently unique unique enough.
2021-11-14fix getting the discriminant of a zero-variant enumRalf Jung-1/+3
2021-11-13Type can be unsized and uninhabitedSeo Sanghyeon-1/+1
2021-11-11Use `associated_item_def_ids` moreMatthew Jasper-6/+6
2021-11-11Auto merge of #90648 - matthewjasper:assoc-item-cleanup, r=cjgillotbors-2/+0
Assoc item cleanup This removes some fields from ObligationCauseCode Split out of #90639
2021-11-11Auto merge of #89550 - lcnr:coherence-specialization, r=nikomatsakisbors-5/+8
do not emit overlap errors for impls failing the orphan check this should finally allow us to merge #86986, see https://github.com/rust-lang/rust/pull/86986#discussion_r716059345 for more details. r? `@nikomatsakis` cc `@eddyb`
2021-11-10Rollup merge of #90742 - est31:add_assign, r=davidtwcoMatthias Krüger-1/+1
Use AddAssign impl
2021-11-10no overlap errors after failing the orphan checklcnr-5/+8
2021-11-09Add `ty::Visibility::is_public()`inquisitivecrystal-1/+5
2021-11-09Use AddAssign implest31-1/+1