about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2021-06-16Auto merge of #86291 - crlf0710:trait_vtbl_refactor, r=bjorn3bors-3/+19
Refactor vtable codegen This refactor the codegen of vtables of miri interpreter, llvm, cranelift codegen backends. This is preparation for the implementation of trait upcasting feature. cc #65991 Note that aside from code reorganization, there's an internal behavior change here that now InstanceDef::Virtual's index now include the three metadata slots, and now the first method is with index 3. cc `@RalfJung` `@bjorn3`
2021-06-15better codehi-rustin-3/+3
2021-06-15shrinking the deprecated method spanhi-rustin-3/+4
2021-06-15Refactor to make interpreter and codegen backend neutral to vtable internal ↵Charles Lew-3/+19
representation.
2021-06-14Improve documentation on `UndefinedBehaviorInfo::ValidationFailure`Rémy Rakic-0/+2
2021-06-14stabilize `int_error_matching`Ethan Brierley-1/+0
2021-06-13Improve CTFE validation error messageRémy Rakic-4/+10
2021-06-13Box `ExprKind::Adt`LeSeulArtichaut-13/+16
2021-06-13Auto merge of #86245 - lqd:const-ub-align, r=RalfJungbors-2/+10
Fix ICEs on invalid vtable size/alignment const UB errors The invalid vtable size/alignment errors from `InterpCx::read_size_and_align_from_vtable` were "freeform const UB errors", causing ICEs when reaching validation. This PR turns them into const UB hard errors to catch them during validation and avoid that. Fixes #86193 r? `@RalfJung` (It seemed cleaner to have 2 variants but they can be merged into one variant with a message payload if you prefer that ?)
2021-06-13Turn incorrect vtable size/alignment errors into hard const-UB errorsRémy Rakic-2/+10
They were "freeform const UB" error message, but could reach validation and trigger ICEs there. We now catch them during validation to avoid that.
2021-06-12Pretty print generator witness only in `-Zverbose` modeTomasz Miąsko-3/+3
In release build of deeply-nested-async benchmark the size of `no-opt.bc` file is reduced from 46MB to 62kB.
2021-06-12Auto merge of #86130 - BoxyUwU:abstract_const_as_cast, r=oli-obkbors-2/+3
const_eval_checked: Support as casts in abstract consts
2021-06-12Auto merge of #86180 - cjgillot:defmv, r=petrochenkovbors-51/+2
Hash DefId in rustc_span. This is mostly just moving code around. Changes are simplifications of unneeded callbacks from rustc_span to rustc_middle. r? `@petrochenkov`
2021-06-12Rollup merge of #86189 - JohnTitor:relate-fn-pub, r=Aaron1011Yuki Okushi-1/+1
Make `relate_type_and_mut` public #85343 improved diagnostics around `Relate` impls but made `relate_type_and_mut` private, which was accessible as `relate` previously. This makes it public so that we can use it on rust-semverver. r? ```@Aaron1011```
2021-06-12Rollup merge of #85800 - BoxyUwU:const-param-default-diagnostics, r=oli-obkYuki Okushi-1/+1
Fix some diagnostic issues with const_generics_defaults feature gate This PR makes a few changes: - print out const param defaults in "lifetime ordering" errors rather than discarding them - update `is_simple_text` to account for const params when checking if a type has no generics, this was causing a note to be failed to add to an error message - fixes some diagnostic wording that incorrectly said there was ordering restrictions between type/const params despite the `const_generics_defaults` feature gate is active
2021-06-11Hash DefId in rustc_span.Camille GILLOT-51/+2
2021-06-09Fix ICE when `main` is declared in an `extern` blockasquared31415-1/+1
2021-06-10Make `relate_type_and_mut` publicYuki Okushi-1/+1
2021-06-10Auto merge of #85910 - cjgillot:no-meta-version, r=Aaron1011bors-5/+0
Drop metadata_encoding_version. Part of #85153 r? `@Aaron1011`
2021-06-09Access stable_crate_id directly.Camille GILLOT-2/+7
2021-06-09Do not store crate in latest_foreign_def_path_hashes.Camille GILLOT-7/+0
2021-06-09Encode CrateNum using the StableCrateId for incr. comp.Camille GILLOT-67/+38
2021-06-09Auto merge of #86150 - cjgillot:notable, r=michaelwoeristerbors-21/+3
Do not require the DefPathTable to construct the on-disk cache. r? `@michaelwoerister`
2021-06-09Auto merge of #86118 - spastorino:tait-soundness-bug, r=nikomatsakisbors-15/+13
Create different inference variables for different defining uses of TAITs Fixes #73481 r? `@nikomatsakis` cc `@oli-obk`
2021-06-08Do not require the DefPathTable to construct the on-disk cache.Camille GILLOT-21/+3
2021-06-08use non_erasable_genericsEllen-1/+1
2021-06-08Support as casts in abstract constsEllen-2/+3
2021-06-07Remove ResolvedOpaqueTy and just use Ty, SubstsRef is already thereSantiago Pastorino-14/+3
2021-06-07Make OpaqueTypeKey the key of opaque types mapSantiago Pastorino-2/+10
2021-06-07Change concrete opaque type to be a `VecMap`Santiago Pastorino-3/+4
2021-06-07Auto merge of #85891 - bjorn3:revert_merge_crate_disambiguator, ↵bors-35/+40
r=Mark-Simulacrum Revert "Merge CrateDisambiguator into StableCrateId" This reverts https://github.com/rust-lang/rust/pull/85804
2021-06-07Revert "Merge CrateDisambiguator into StableCrateId"bjorn3-35/+40
This reverts commit d0ec85d3fb6d322496cb8f4bc1c21e19f23284ad.
2021-06-07Rollup merge of #84262 - camelid:sized-ice, r=estebankYuki Okushi-1/+8
Fix ICE during type layout when there's a `[type error]` Fixes #84108. Based on estebank's [comment], except I used `delay_span_bug` because it should work in more cases, and I think it expresses its intent more clearly. r? `@estebank` [comment]: https://github.com/rust-lang/rust/issues/84108#issuecomment-818916848
2021-06-06Remove some last remants of {push,pop}_unsafe!Smitty-4/+0
These macros have already been removed, but there was still some code handling these macros. That code is now removed.
2021-06-06Add variance-related information to lifetime error messagesAaron Hill-29/+111
2021-06-06Auto merge of #84171 - ricobbe:raw-dylib-via-llvm, r=petrochenkovbors-0/+7
Partial support for raw-dylib linkage First cut of functionality for issue #58713: add support for `#[link(kind = "raw-dylib")]` on `extern` blocks in lib crates compiled to .rlib files. Does not yet support `#[link_name]` attributes on functions, or the `#[link_ordinal]` attribute, or `#[link(kind = "raw-dylib")]` on `extern` blocks in bin crates; I intend to publish subsequent PRs to fill those gaps. It's also not yet clear whether this works for functions in `extern "stdcall"` blocks; I also intend to investigate that shortly and make any necessary changes as a follow-on PR. This implementation calls out to an LLVM function to construct the actual `.idata` sections as temporary `.lib` files on disk and then links those into the generated .rlib.
2021-06-05Auto merge of #86002 - cjgillot:expn_that_defined, r=petrochenkovbors-15/+8
Always go through the expn_that_defined query.
2021-06-05Update compiler/rustc_middle/src/query/mod.rsCamille Gillot-1/+0
2021-06-05Auto merge of #85919 - workingjubilee:simd-ptrs-are-valid, r=petrochenkovbors-5/+0
Allow raw pointers in SIMD types Closes #85915 by loosening the strictness in typechecking and adding a test to guarantee it passes. This still might be too strict, as references currently do pass monomorphization, but my understanding is that they are not guaranteed to be "scalar" in the same way.
2021-06-04Add first cut of functionality for #58713: support for #[link(kind = ↵Richard Cobbe-0/+7
"raw-dylib")]. This does not yet support #[link_name] attributes on functions, the #[link_ordinal] attribute, #[link(kind = "raw-dylib")] on extern blocks in bin crates, or stdcall functions on 32-bit x86.
2021-06-04Always go through the expn_that_defined query.Camille GILLOT-14/+8
2021-06-04Fix rebase falloutAaron Hill-1/+1
2021-06-04Support forwarding caller location through trait object method callAaron Hill-4/+52
Since PR #69251, the `#[track_caller]` attribute has been supported on traits. However, it only has an effect on direct (monomorphized) method calls. Calling a `#[track_caller]` method on a trait object will *not* propagate caller location information - instead, `Location::caller()` will return the location of the method definition. This PR forwards caller location information when `#[track_caller]` is present on the method definition in the trait. This is possible because `#[track_caller]` in this position is 'inherited' by any impls of that trait, so all implementations will have the same ABI. This PR does *not* change the behavior in the case where `#[track_caller]` is present only on the impl of a trait. While all implementations of the method might have an explicit `#[track_caller]`, we cannot know this at codegen time, since other crates may have impls of the trait. Therefore, we keep the current behavior of not forwarding the caller location, ensuring that all implementations of the trait will have the correct ABI. See the modified test for examples of how this works
2021-06-04Auto merge of #85788 - rylev:force-warns, r=nikomatsakisbors-4/+26
Support for force-warns Implements https://github.com/rust-lang/rust/issues/85512. This PR adds a new command line option `force-warns` which will force the provided lints to warn even if they are allowed by some other mechanism such as `#![allow(warnings)]`. Some remaining issues: * https://github.com/rust-lang/rust/issues/85512 mentions that `force-warns` should also be capable of taking lint groups instead of individual lints. This is not implemented. * If a lint has a higher warning level than `warn`, this will cause that lint to warn instead. We probably want to allow the lint to error if it is set to a higher lint and is not allowed somewhere else. * One test is currently ignored because it's not working - when a deny-by-default lint is allowed, it does not currently warn under `force-warns`. I'm not sure why, but I wanted to get this in before the weekend. r? `@nikomatsakis`
2021-06-04Rollup merge of #85850 - bjorn3:less_feature_gates, r=jyn514Yuki Okushi-2/+0
Remove unused feature gates The first commit removes a usage of a feature gate, but I don't expect it to be controversial as the feature gate was only used to workaround a limitation of rust in the past. (closures never being `Clone`) The second commit uses `#[allow_internal_unstable]` to avoid leaking the `trusted_step` feature gate usage from inside the index newtype macro. It didn't work for the `min_specialization` feature gate though. The third commit removes (almost) all feature gates from the compiler that weren't used anyway.
2021-06-03Rollup merge of #85934 - tmiasko:is-union, r=jackh726Yuki Okushi-4/+6
Add `Ty::is_union` predicate
2021-06-03Rollup merge of #85911 - cjgillot:one-output, r=Aaron1011Yuki Okushi-2/+2
Avoid a clone of output_filenames. Part of #85153
2021-06-02Inline is_machine into check_simdJubilee Young-8/+0
2021-06-02Restrict access to crate_name.Camille GILLOT-9/+5
Also remove original_crate_name, which had the exact same implementation
2021-06-02Add a page on force-warns in unstable bookRyan Levick-1/+1