about summary refs log tree commit diff
path: root/src/librustc_middle
AgeCommit message (Collapse)AuthorLines
2020-05-05Rebase and use ena 0.14Markus Westerlind-18/+16
2020-05-05perf: Reduce snapshot/rollback overheadMarkus Westerlind-5/+12
By merging the undo_log of all structures part of the snapshot the cost of creating a snapshot becomes much cheaper. Since snapshots with no or few changes are so frequent this ends up mattering more than the slight overhead of dispatching on the variants that map to each field.
2020-05-05Allow `hir().find` to return `None`John Kåre Alsaker-16/+18
2020-05-05Rollup merge of #71883 - Dante-Broggi:patch-1, r=Dylan-DPCDylan DPC-1/+1
add a missing "at" in a comment
2020-05-04add a missing wordDante Broggi-1/+1
2020-05-04Auto merge of #71754 - alexcrichton:no-bitcode-in-cache, r=nnethercotebors-1/+1
Don't copy bytecode files into the incr. comp. cache. It's no longer necessary now that bitcode is embedded into object files. This change meant that `WorkProductFileKind::Bytecode` is no longer necessary, which means that type is no longer necessary, which allowed several places in the code to become simpler. This commit was written by @nnethercote in https://github.com/rust-lang/rust/pull/70458 but that didn't land. In the meantime though we managed to land it in https://github.com/rust-lang/rust/pull/71528 and that doesn't seem to be causing too many fires, so I'm re-sending this patch!
2020-05-04Auto merge of #71108 - estebank:suggest-proj-type-mismatch-constraint, r=oli-obkbors-38/+395
On type mismatch involving associated type, suggest constraint When an associated type is found when a specific type was expected, if possible provide a structured suggestion constraining the associated type in a bound. ``` error[E0271]: type mismatch resolving `<T as Foo>::Y == i32` --> $DIR/associated-types-multiple-types-one-trait.rs:13:5 | LL | want_y(t); | ^^^^^^ expected `i32`, found associated type ... LL | fn want_y<T:Foo<Y=i32>>(t: &T) { } | ----- required by this bound in `want_y` | = note: expected type `i32` found associated type `<T as Foo>::Y` help: consider constraining the associated type `<T as Foo>::Y` to `i32` | LL | fn have_x_want_y<T:Foo<X=u32, Y = i32>>(t: &T) | ^^^^^^^^^ ``` ``` error[E0308]: mismatched types --> $DIR/trait-with-missing-associated-type-restriction.rs:12:9 | LL | qux(x.func()) | ^^^^^^^^ expected `usize`, found associated type | = note: expected type `usize` found associated type `<impl Trait as Trait>::A` help: consider constraining the associated type `<impl Trait as Trait>::A` to `usize` | LL | fn foo(x: impl Trait<A = usize>) { | ^^^^^^^^^^ ``` Fix #71035. Related to #70908.
2020-05-03review comment: use early returnEsteban Küber-10/+19
2020-05-03review comments: move logic to their own methodsEsteban Küber-137/+139
2020-05-03fix rebaseEsteban Küber-1/+3
2020-05-03Add `MutatingUseContext::Yield`Dylan MacKenzie-1/+3
...emulating `MutatingUseContext::Call`
2020-05-03Auto merge of #70825 - eddyb:enum-discr-correct-generics-parent, r=nikomatsakisbors-15/+8
typeck: always expose explicit enum discriminant `AnonConst`s' parent in `generics_of`. This is similar to #70452 but for explicit `enum` discriminant constant expressions. However, unlike #70452, this PR should have no effect on stable code, as while it alleviates #43408 errors, there is no way to actually compile an `enum` with generic parameters *and* explicit discriminants, without `#![feature(arbitrary_enum_discriminant)]`, as explicit discriminant expression don't count as uses of parameters (if they did, they would count as invariant uses). <hr/> There's also 2 other commits here, both related to #70453: * "ty: use `delay_span_bug` in `ty::AdtDef::eval_explicit_discr`." - hides the ICEs demonstrated on #70453, when there are other errors (which the next commit adds) * "typeck/wfcheck: require that explicit enum discriminants const-evaluate succesfully." - closes #70453 by picking alternative "2", i.e. erroring when a discriminant doesn't fully const-evaluate from the perspective of the `enum` definition In the future, it might be possible to allow `enum` discriminants to actually depend on parameters, but that will likely require #68436 + some way to restrict the values so no two variants can end up with overlapping discriminants. As this PR would close #70453, it shouldn't be merged until a decision is reached there. r? @nikomatsakis
2020-05-02Add docsEsteban Küber-0/+18
2020-05-02Suggest constraint on `impl Trait` in return typeEsteban Küber-21/+47
Fix #71035.
2020-05-02fix rebaseEsteban Küber-1/+1
2020-05-02Point at associated types when they have a default typeEsteban Küber-6/+68
Associated types with a default type in a trait can't be relied upon to remain of that default type when in use, so literals of that type can't be used in the trait's items. Point at the associated type and state that information. Reduce verbosity for associated consts of the wrong type.
2020-05-02review comment: use or patternsEsteban Küber-4/+2
2020-05-02When a projection is expected, suggest constraining or calling methodEsteban Küber-41/+157
2020-05-02On type mismatch involving associated type, suggest constraintEsteban Küber-10/+134
When an associated type is found when a specific type was expected, if possible provide a structured suggestion constraining the associated type in a bound. ``` error[E0271]: type mismatch resolving `<T as Foo>::Y == i32` --> $DIR/associated-types-multiple-types-one-trait.rs:13:5 | LL | want_y(t); | ^^^^^^ expected `i32`, found associated type ... LL | fn want_y<T:Foo<Y=i32>>(t: &T) { } | ----- required by this bound in `want_y` | = note: expected type `i32` found associated type `<T as Foo>::Y` help: consider constraining the associated type `<T as Foo>::Y` to `i32` | LL | fn have_x_want_y<T:Foo<X=u32, Y = i32>>(t: &T) | ^^^^^^^^^ ``` ``` error[E0308]: mismatched types --> $DIR/trait-with-missing-associated-type-restriction.rs:12:9 | LL | qux(x.func()) | ^^^^^^^^ expected `usize`, found associated type | = note: expected type `usize` found associated type `<impl Trait as Trait>::A` help: consider constraining the associated type `<impl Trait as Trait>::A` to `usize` | LL | fn foo(x: impl Trait<A = usize>) { | ^^^^^^^^^^ ```
2020-05-02Auto merge of #69274 - LeSeulArtichaut:target-feature-11, r=hanna-kruppebors-1/+23
Implement RFC 2396: `#[target_feature]` 1.1 Tracking issue: #69098 r? @nikomatsakis cc @gnzlbg @joshtriplett
2020-05-02Rollup merge of #71787 - tshepang:rustdoc-warnings, r=varkorDylan DPC-8/+8
fix rustdoc warnings
2020-05-02Rollup merge of #71777 - petrochenkov:crtype, r=Mark-SimulacrumDylan DPC-4/+3
cleanup: `config::CrateType` -> `CrateType`
2020-05-02Rollup merge of #71772 - cjgillot:ensure, r=petrochenkovDylan DPC-0/+1
Mark query function as must_use. And use the `ensure()` version when the result is not needed.
2020-05-02Rollup merge of #69274 - LeSeulArtichaut:target-feature-11, r=hanna-kruppeDylan DPC-1/+23
Implement RFC 2396: `#[target_feature]` 1.1 Tracking issue: #69098 r? @nikomatsakis cc @gnzlbg @joshtriplett
2020-05-02ty: use `delay_span_bug` in `ty::AdtDef::eval_explicit_discr`.Eduard-Mihai Burtescu-15/+8
2020-05-02Rollup merge of #71738 - RalfJung:pointer-no-alloc-id, r=oli-obkRalf Jung-16/+12
remove AllocId generalization of Pointer This was only needed for the "snapshot" machinery, which is gone. r? @oli-obk
2020-05-02Rollup merge of #71712 - RalfJung:error-backtrace, r=oli-obkRalf Jung-12/+10
Miri: port error backtraces to std::backtrace No need to pull in an external dependency if libstd already includes this feature (using the same dependency internally, but... still). r? @oli-obk
2020-05-02cleanup: `config::CrateType` -> `CrateType`Vadim Petrochenkov-4/+3
2020-05-02fix rustdoc warningsTshepang Lekhonkhobe-8/+8
2020-05-02Auto merge of #71776 - Dylan-DPC:rollup-k1iuuow, r=Dylan-DPCbors-848/+37
Rollup of 5 pull requests Successful merges: - #71018 (handle ConstValue::ByRef in relate) - #71758 (Remove leftover chalk types) - #71760 (Document unsafety for `*const T` and `*mut T`) - #71761 (doc: reference does not exist, probably a typo) - #71762 (doc: this resulted in a link pointing to a non-existent target) Failed merges: - #71726 (Suggest deref when coercing `ty::Ref` to `ty::RawPtr` with arbitrary mutability) r? @ghost
2020-05-01Rollup merge of #71758 - jackh726:chalk-remove, r=jackh726Dylan DPC-846/+3
Remove leftover chalk types Split out from #69406 Since the other PR is having memory problems with `parallel-compiler = true`, figured I should split this out. Surprisingly, this actually changes some errors, and I'm not quite sure why. r? @nikomatsakis
2020-05-01Rollup merge of #71018 - lcnr:custom-const-param, r=eddybDylan DPC-2/+34
handle ConstValue::ByRef in relate fixes #68615 r? @eddyb
2020-05-01Auto merge of #69808 - cjgillot:vtbl, r=pnkfelixbors-31/+8
Avoid duplicating code for each query There are at the moment roughly 170 queries in librustc. The way `ty::query` is structured, a lot of code is duplicated for each query. I suspect this to be responsible for a part of librustc'c compile time. The first part of this PR reduces the amount of code generic on the query, replacing it by code generic on the key-value types. I can split it out if needed. In a second part, the non-inlined methods in the `QueryAccessors` and `QueryDescription` traits are made into a virtual dispatch table. This allows to reduce even more the number of generated functions. This allows to save 1.5s on check build, and 10% on the size of the librustc.rlib. (Attributed roughly half and half). My computer is not good enough to measure properly compiling time. I have no idea of the effect on performance. A perf run may be required. cc #65031
2020-05-01Remove leftover chalk typesJack Huey-846/+3
2020-05-01Mark query function as must_use.Camille GILLOT-0/+1
2020-05-01Don't copy bytecode files into the incr. comp. cache.Nicholas Nethercote-1/+1
It's no longer necessary now that bitcode is embedded into object files. This change meant that `WorkProductFileKind::Bytecode` is no longer necessary, which means that type is no longer necessary, which allowed several places in the code to become simpler.
2020-05-01Prevent functions with `#[target_feature]` to be coerced to safe function ↵LeSeulArtichaut-1/+23
pointers
2020-05-01Move the DepNode construction to librustc_query_system.Camille GILLOT-30/+7
2020-05-01fix Miri error message paddingRalf Jung-2/+2
2020-05-01Monomorphise load_from_disk_and_cache_in_memory.Camille GILLOT-1/+1
2020-05-01remove AllocId generalization of PointerRalf Jung-16/+12
2020-05-01use hex for invalid bool and char (consistently with validation)Ralf Jung-2/+6
2020-05-01rename InvalidIntPtrUsageRalf Jung-40/+44
2020-05-01InterpError printing really is more Display than DebugRalf Jung-30/+27
also tweak InvalidDiscriminant message
2020-05-01tweak InvalidIntPointerUsage messageRalf Jung-2/+2
2020-05-01Auto merge of #70674 - cjgillot:query-arena-all, r=matthewjasperbors-132/+99
Have the per-query caches store the results on arenas This PR leverages the cache for each query to serve as storage area for the query results. It introduces a new cache `ArenaCache`, which moves the result to an arena, and only stores the reference in the hash map. This allows to remove a sizeable part of the usage of the global `TyCtxt` arena. I only migrated queries that already used arenas before.
2020-04-30Rollup merge of #71590 - RalfJung:mir-dump-pointers, r=oli-obkTyler Mandry-10/+34
MIR dump: print pointers consistently with Miri output This makes MIR allocation dump pointer printing consistent with Miri output: both use hexadecimal offsets with a `0x` prefix. To save some space, MIR dump replaces the `alloc` prefix by `a` when necessary. I also made AllocId/Pointer printing more consistent in their Debug/Display handling, and adjusted Display printing for Scalar a bit to avoid using decimal printing when we do not know the sign with which to interpret the value (IMO using decimal then is misleading).
2020-04-30Rollup merge of #71465 - oli-obk:is_thread_local_cleanup, r=matthewjasperTyler Mandry-4/+10
Add a convenience method on `TyCtxt` for checking for thread locals This PR extracts the cleanup part of #71192 r? @bjorn3
2020-04-30Rollup merge of #71449 - ecstatic-morse:free-region-cleanup, r=Mark-SimulacrumDylan DPC-179/+0
Move `{Free,}RegionRelations` and `FreeRegionMap` to `rustc_infer` ...and out of `rustc_middle`. This is to further #65031, albeit in a very minor way r? @Mark-Simulacrum
2020-04-30Miri: port error backtraces to std::backtraceRalf Jung-12/+10