about summary refs log tree commit diff
path: root/src/librustc/ty
AgeCommit message (Collapse)AuthorLines
2019-10-31Point at where clauses where the associated item was restrictedEsteban Küber-12/+89
2019-10-31Implement dual proc macro hashingmsizanoen-0/+4
This changes the mechanism of `-Z dual-proc-macro` to record the host proc macro hash in the transistive dependency information and use it during dependency resolution instead of resolving only by name.
2019-10-29Rollup merge of #65809 - roblabla:eficall-abi, r=nagisaMazdak Farrokhzad-0/+1
Add new EFIAPI ABI Fixes #54527 Adds a new ABI, "efiapi", which reflects the calling convention as specified by [the current spec UEFI spec](https://uefi.org/sites/default/files/resources/UEFI%20Spec%202_7_A%20Sept%206.pdf#G6.999903). When compiling for x86_64, we should select the `win64` ABI, while on all other architectures (Itanium, x86, ARM and ARM64 and RISC-V), we should select the `C` ABI. Currently, this is done by just turning it into the C ABI everywhere except on x86_64, where it's turned into the win64 ABI. Should we prevent this ABI from being used on unsupported architectures, and if so, how would this be done?
2019-10-28Rollup merge of #65891 - michaelwoerister:sp-crate-metadata, r=wesleywiserMazdak Farrokhzad-0/+1
self-profiling: Record something more useful for crate metadata generation event. Before this commit, we had an event that would only track the compression step for proc-macros and Rust dylibs. After the commit we measure the time for acutally generating the crate metadata bytes. r? @wesleywiser
2019-10-28Rollup merge of #65643 - varkor:remove-free-regions-from-const-placeholder, ↵Mazdak Farrokhzad-7/+9
r=eddyb Correct handling of type flags with `ConstValue::Placeholder` This fixes a mistake, but not https://github.com/rust-lang/rust/issues/65623. r? @eddyb
2019-10-28self-profiling: Record something more useful for crate metadata generation ↵Michael Woerister-0/+1
event. Before this commit, we had an event that would only track the compression step for proc-macros and Rust dylibs. After the commit we measure the time for acutally generating the crate metadata bytes.
2019-10-28Auto merge of #65188 - matthewjasper:stabilize-const-constructor, r=Centrilbors-8/+3
Stabilize `const_constructor` # Stabilization proposal I propose that we stabilize `#![feature(const_constructor)]`. Tracking issue: https://github.com/rust-lang/rust/issues/61456 Version target: 1.40 (2019-11-05 => beta, 2019-12-19 => stable). ## What is stabilized ### User guide Tuple struct and tuple variant constructors are now considered to be constant functions. As such a call expression where the callee has a tuple struct or variant constructor "function item" type can be called: ```rust const fn make_options() { // These already work because they are special cased: Some(0); (Option::Some)(1); // These also work now: let f = Option::Some; f(2); {Option::Some}(3); <Option<_>>::Some(5); } ``` ### Motivation Consistency with other `const fn`. Consistency between syntactic path forms. This should also ensure that constructors implement `const Fn` traits and can be coerced to `const fn` function pointers, if they are introduced. ## Tests * [ui/consts/const_constructor/const-construct-call.rs](https://github.com/rust-lang/rust/blob/0d75ab2293a106eb674ac01860910cfc1580837e/src/test/ui/consts/const_constructor/const-construct-call.rs) - Tests various syntactic forms, use in both `const fn` and `const` items, and constructors in both the current and extern crates. * [ui/consts/const_constructor/const_constructor_qpath.rs](https://github.com/rust-lang/rust/blob/1850dfcdabf8258a1f023f26c2c59e96b869dd95/src/test/ui/consts/const_constructor/const_constructor_qpath.rs) - Tests that type qualified paths to enum variants are also considered to be `const fn`.(#64247) r? @oli-obk Closes #61456 Closes #64247
2019-10-28Rollup merge of #65792 - Centril:split-syntax-2, r=petrochenkovMazdak Farrokhzad-2/+2
rustc, rustc_passes: reduce deps on rustc_expand Part of #65324. r? @petrochenkov
2019-10-28Rollup merge of #65664 - anp:panic-location, r=eddybMazdak Farrokhzad-0/+10
`std::panic::Location` is a lang_item, add `core::intrinsics::caller_location` (RFC 2091 3/N) [Tracking issue](https://github.com/rust-lang/rust/issues/47809) [RFC text](https://github.com/rust-lang/rfcs/blob/master/text/2091-inline-semantic.md) @eddyb suggested doing this intrinsic implementation ahead of actually implementing the `#[track_caller]` attribute so that there's an easily tested intermediate step between adding the shim and wiring up the attribute.
2019-10-27Stabilize `const_constructor`Matthew Jasper-8/+3
2019-10-27Always use consteval to codegen caller_location.Adam Perry-0/+10
2019-10-27rustc, rustc_passes: don't depend on syntax_expand.Mazdak Farrokhzad-2/+2
This is done by moving some data definitions to syntax::expand.
2019-10-27Auto merge of #65541 - eddyb:spanned-inferred-outlives, r=nikomatsakisbors-1/+1
rustc: add `Span`s to `inferred_outlives_of` predicates. This would simplify #59789, and I suspect it has some potential in diagnostics (although we don't seem to use the predicate `Span`s much atm).
2019-10-27Auto merge of #65519 - pnkfelix:issue-63438-trait-based-structural-match, ↵bors-125/+215
r=matthewjasper trait-based structural match implementation Moves from using a `#[structural_match]` attribute to using a marker trait (or pair of such traits, really) instead. Fix #63438. (This however does not remove the hacks that I believe were put into place to support the previous approach of injecting the attribute based on the presence of both derives... I have left that for follow-on work.)
2019-10-27Auto merge of #65288 - estebank:point-at-assoc-type, r=nikomatsakisbors-19/+154
Point at associated type for some obligations Partially address #57663.
2019-10-25Correct handling of type flags with `ConstValue::Placeholder`varkor-7/+9
2019-10-25Don't cast directly from `&[T; N]` to `*const T`Matthew Jasper-0/+3
Instead coerce to `*const [T; N]` and then cast.
2019-10-26Rollup merge of #65800 - michaelwoerister:measureme-0.4.0, r=wesleywiserYuki Okushi-2/+12
self-profiling: Update measureme to 0.4.0 and remove non-RAII methods from profiler. This PR removes all non-RAII based profiling methods from `SelfProfilerRef` :tada: It also delegates the `TimingGuard` implementation to `measureme`, now that that is available there. r? @wesleywiser
2019-10-25Take out an insurance policy in case `iter.size_hint()`Mazdak Farrokhzad-1/+5
lies, underreporting the number of elements.
2019-10-25Add new EFIAPI ABIroblabla-0/+1
Adds a new ABI for the EFIAPI calls. This ABI should reflect the latest version of the UEFI specification at the time of commit (UEFI spec 2.8, URL below). The specification says that for x86_64, we should follow the win64 ABI, while on all other supported platforms (ia32, itanium, arm, arm64 and risc-v), we should follow the C ABI. To simplify the implementation, we will simply follow the C ABI on all platforms except x86_64, even those technically unsupported by the UEFI specification. https://uefi.org/sites/default/files/resources/UEFI_Spec_2_8_final.pdf
2019-10-25Review feedback: elaborated comments.Felix S. Klock II-5/+21
2019-10-25Migrate from `#[structural_match]` attribute a lang-item trait.Felix S. Klock II-77/+141
(Or more precisely, a pair of such traits: one for `derive(PartialEq)` and one for `derive(Eq)`.) ((The addition of the second marker trait, `StructuralEq`, is largely a hack to work-around `fn (&T)` not implementing `PartialEq` and `Eq`; see also issue rust-lang/rust#46989; otherwise I would just check if `Eq` is implemented.)) Note: this does not use trait fulfillment error-reporting machinery; it just uses the trait system to determine if the ADT was tagged or not. (Nonetheless, I have kept an `on_unimplemented` message on the new trait for structural_match check, even though it is currently not used.) Note also: this does *not* resolve the ICE from rust-lang/rust#65466, as noted in a comment added in this commit. Further work is necessary to resolve that and other problems with the structural match checking, especially to do so without breaking stable code (adapted from test fn-ptr-is-structurally-matchable.rs): ```rust fn r_sm_to(_: &SM) {} fn main() { const CFN6: Wrap<fn(&SM)> = Wrap(r_sm_to); let input: Wrap<fn(&SM)> = Wrap(r_sm_to); match Wrap(input) { Wrap(CFN6) => {} Wrap(_) => {} }; } ``` where we would hit a problem with the strategy of unconditionally checking for `PartialEq` because the type `for <'a> fn(&'a SM)` does not currently even *implement* `PartialEq`. ---- added review feedback: * use an or-pattern * eschew `return` when tail position will do. * don't need fresh_expansion; just add `structural_match` to appropriate `allow_internal_unstable` attributes. also fixed example in doc comment so that it actually compiles.
2019-10-25Rollup merge of #65315 - spastorino:intern-place-projection, r=oli-obkMazdak Farrokhzad-4/+91
Intern place projection This should sit on top of https://github.com/rust-lang/rust/pull/65197. After that one merged, I'm gonna rebase on top of it. The important commits are the last three and there's a bunch of code repetition that I'm going to remove but for that I need to refactor some things that probably need to be added before this PR. Anyway this work helps as is because we can run perf tests :). r? @oli-obk /cc @nikomatsakis
2019-10-25refactor: move structural_match analysis into its own module.Felix S. Klock II-125/+135
2019-10-25self-profiling: Switch query-blocking measurements to RAII-style API.Michael Woerister-2/+12
2019-10-24Rollup merge of #65627 - varkor:const-generics-forbid-non-structural_match, ↵Mazdak Farrokhzad-6/+128
r=petrochenkov Forbid non-`structural_match` types in const generics Fixes https://github.com/rust-lang/rust/issues/60286.
2019-10-24rustc_metadata: Minimize use of `Lrc` in crate storeVadim Petrochenkov-15/+8
Crate metadatas are still stored as `Lrc<CrateMetadata>` in `CStore` because crate store has to be cloneable due to `Resolver::clone_outputs`.
2019-10-24Turn crate store into a resolver outputVadim Petrochenkov-3/+5
2019-10-24rustc: Combine resolver outputs into a single structVadim Petrochenkov-3/+3
2019-10-24rustc: add `Span`s to `inferred_outlives_of` predicates.Eduard-Mihai Burtescu-1/+1
2019-10-23Rollup merge of #65657 - nnethercote:rm-InternedString-properly, r=eddybMazdak Farrokhzad-44/+56
Remove `InternedString` This PR removes `InternedString` by converting all occurrences to `Symbol`. There are a handful of places that need to use the symbol chars instead of the symbol index, e.g. for stable sorting; local conversions `LocalInternedString` is used in those places. r? @eddyb
2019-10-23Rollup merge of #65193 - Mark-Simulacrum:lockless-lintstore, r=nikomatsakisMazdak Farrokhzad-0/+4
Lockless LintStore This removes mutability from the lint store after registration. Each commit stands alone, for the most part, though they don't make sense out of sequence. The intent here is to move LintStore to a more parallel-friendly architecture, although also just a cleaner one from an implementation perspective. Specifically, this has the following changes: * We no longer implicitly register lints when registering lint passes * For the most part this means that registration calls now likely want to call something like: `lint_store.register_lints(&Pass::get_lints())` as well as `register_*_pass`. * In theory this is a simplification as it's much easier for folks to just register lints and then have passes that implement whichever lint however they want, rather than necessarily tying passes to lints. * Lint passes still have a list of associated lints, but a followup PR could plausibly change that * This list must be known for a given pass type, not instance, i.e., `fn get_lints()` is the signature instead of `fn get_lints(&self)` as before. * We do not store pass objects, instead storing constructor functions. This means we always get new passes when running lints (this happens approximately once though for a given compiler session, so no behavior change is expected). * Registration API is _much_ simpler: generally all functions are just taking `Fn() -> PassObject` rather than several different `bool`s.
2019-10-23Add commentsEsteban Küber-0/+73
2019-10-23Auto merge of #57545 - bovinebuddha:object_safe_for_dispatch, r=nikomatsakisbors-11/+19
Object safe for dispatch cc #43561
2019-10-22review comments: move code, fix indentation and change spanEsteban Küber-39/+51
2019-10-22Handle projection obligation errorsEsteban Küber-10/+33
2019-10-22Point at associated type for some obligationsEsteban Küber-19/+46
2019-10-22RFC 2027: "first draft" of implementationMathias Blikstad-11/+19
These are a squashed series of commits.
2019-10-22Add ignore-tidy-filelength on ty/contextSantiago Pastorino-0/+1
This is so we avoid a massive break of other people's code. Gonna run rustfmt and split the file on a different PR.
2019-10-22Move Place::elem methods and friends to TyCtxtSantiago Pastorino-1/+43
2019-10-22Intern place projectionSantiago Pastorino-2/+28
2019-10-22Add intern table for `List<PlaceElem<'tcx>>`Santiago Pastorino-2/+20
2019-10-22Remove FIXMEvarkor-4/+3
2019-10-22Search for generic parameters when finding non-`structural_match` typesvarkor-11/+21
2019-10-22Move `search_for_adt_without_structural_match` to `ty/mod`varkor-2/+115
2019-10-21Rollup merge of #65660 - varkor:canonical-const-to-bound-const, r=eddybMazdak Farrokhzad-29/+20
Rename `ConstValue::Infer(InferConst::Canonical(..))` to `ConstValue::Bound(..)` It already has the right form, so this is just a renaming. Fixes https://github.com/rust-lang/rust/issues/65655. r? @eddyb
2019-10-21Rollup merge of #65647 - nnethercote:rm-unnecessary-traits, r=CentrilMazdak Farrokhzad-27/+18
Remove unnecessary trait bounds and derivations This PR removes unnecessary trait bounds and derivations from many types. r? @nikomatsakis
2019-10-21Rollup merge of #62330 - SimonSapin:no-drop-in-union-fields, r=RalfJungMazdak Farrokhzad-0/+2
Change untagged_unions to not allow union fields with drop This is a rebase of #56440, massaged to solve merge conflicts and make the test suite pass. Change untagged_unions to not allow union fields with drop Union fields may now never have a type with attached destructor. This for example allows unions to use arbitrary field types only by wrapping them in `ManuallyDrop` (or similar). The stable rule remains, that union fields must be `Copy`. We use the new rule for the `untagged_union` feature. Tracking issue: https://github.com/rust-lang/rust/issues/55149
2019-10-21Rename `ConstValue::Infer(InferConst::Canonical(..))` to `ConstValue::Bound(..)`varkor-29/+20
2019-10-21Remove many unnecessary trait derivations.Nicholas Nethercote-16/+12