about summary refs log tree commit diff
path: root/src/librustc/ty/layout.rs
AgeCommit message (Collapse)AuthorLines
2020-03-30rustc -> rustc_middle part 1Mazdak Farrokhzad-2722/+0
2020-03-27Rename TyLayout to TyAndLayout.Ana-Maria Mihalache-33/+43
2020-03-26Rollup merge of #70411 - ogoffart:fix-62691, r=eddybMazdak Farrokhzad-13/+14
Fix for #62691: use the largest niche across all fields fixes #62691 (The second commit is a small optimization but it makes the code less pretty and i don't know if it is worth it.)
2020-03-26Reorganize a bit the code and add a commentOlivier Goffart-4/+10
2020-03-26Revert previous commit and make the optimisation in a nicer wayOlivier Goffart-19/+6
2020-03-25Optimize slightly by avoiding to call Niche::reserve when not neededOlivier Goffart-7/+18
2020-03-25Fix for #62691: use the largest niche across all fieldsOlivier Goffart-14/+11
fixes #62691
2020-03-25Rename LayoutDetails to just Layout.Ana-Maria Mihalache-48/+41
2020-03-23Rollup merge of #69968 - eddyb:tupled-closure-captures, r=nikomatsakisMazdak Farrokhzad-11/+9
rustc: keep upvars tupled in {Closure,Generator}Substs. Previously, each closure/generator capture's (aka "upvar") type was tracked as one "synthetic" type parameter in the closure/generator substs, and figuring out where the parent `fn`'s generics end and the synthetics start involved slicing at `tcx.generics_of(def_id).parent_count`. Needing to query `generics_of` limited @davidtwco (who wants to compute some `TypeFlags` differently for parent generics vs upvars, and `TyCtxt` is not available there), which is how I got started on this, but it's also possible that the `generics_of` queries are slowing down `{Closure,Generator}Substs` methods. To give an example, for a `foo::<T, U>::{closure#0}` with captures `x: X` and `y: Y`, substs are: * before this PR: `[T, U, /*kind*/, /*signature*/, X, Y]` * after this PR: `[T, U, /*kind*/, /*signature*/, (X, Y)]` You can see that, with this PR, no matter how many captures, the last 3 entries in the substs (or 5 for a generator) are always the "synthetic" ones, with the last one being the tuple of capture types. r? @nikomatsakis cc @Zoxc
2020-03-21make some let-if-bindings more idiomatic (clippy::useless_let_if_seq)Matthias Krüger-29/+25
2020-03-21rustc: keep upvars tupled in {Closure,Generator}Substs.Eduard-Mihai Burtescu-11/+9
2020-03-20Rollup merge of #69768 - oli-obk:union_field_ice, r=eddyb,RalfJungYuki Okushi-3/+11
Compute the correct layout for variants of uninhabited enums r? @eddyb cc @RalfJung fixes #69191 cc #69763
2020-03-18Rollup merge of #69920 - Centril:hir-cleanup, r=ZoxcMazdak Farrokhzad-20/+14
Remove some imports to the rustc crate - When we have `NestedVisitorMap::None`, we use `type Map = dyn intravisit::Map<'v>;` instead of the actual map. This doesn't actually result in dynamic dispatch (in the future we may want to use an associated type default to simplify the code). - Use `rustc_session::` imports instead of `rustc::{session, lint}`. r? @Zoxc
2020-03-16use direct imports for `rustc::{lint, session}`.Mazdak Farrokhzad-20/+14
2020-03-14Use smaller discriminants for generatorsJonas Schievink-6/+9
2020-03-11Compute the correct layout for variants of uninhabited enums and readd a ↵Oliver Scherer-3/+11
long lost assertion This reverts part of commit 9712fa405944cb8d5416556ac4b1f26365a10658.
2020-03-11Rollup merge of #66059 - RalfJung:panic-on-non-zero, r=eddybMazdak Farrokhzad-30/+0
mem::zeroed/uninit: panic on types that do not permit zero-initialization r? @eddyb @oli-obk Cc https://github.com/rust-lang/rust/issues/62825 Also see [this summary comment](https://github.com/rust-lang/rust/pull/66059#issuecomment-586734747)
2020-03-06fix various typosMatthias Krüger-1/+1
2020-03-04cover some more nearby casesRalf Jung-3/+2
2020-03-03Rollup merge of #69619 - matthiaskrgr:misc, r=eddybYuki Okushi-4/+2
more cleanups * use starts_with() instead of chars().next() == Some(x) * use subsec_micros() instead of subsec_nanos() / 1000 * use for (idx, item) in iter.enumerate() instead of manually counting loop iterations with variables * use values() or keys() respectively when iterating only over keys or values of maps.
2020-03-01Fix use of `has_infer_types`Matthew Jasper-2/+2
* Add a new method `has_infer_types_or_consts` that's used instead most of the time, since there's generally no reason to only consider types. * Remove use of `has_closure_types`, because closures are no longer implicitly linked to the `InferCtxt`.
2020-03-01use for (idx, item) in iter.enumerate() instead of manually counting loop ↵Matthias Krüger-4/+2
iterations by variables
2020-03-01Auto merge of #69592 - petrochenkov:nosyntax, r=Centrilbors-1/+1
Rename `libsyntax` to `librustc_ast` This was the last rustc crate that wasn't following the `rustc_*` naming convention. Follow-up to https://github.com/rust-lang/rust/pull/67763.
2020-02-29Rename `syntax` to `rustc_ast` in source codeVadim Petrochenkov-1/+1
2020-02-29Auto merge of #69263 - anyska:blacklist-powerpc-zst, r=nagisabors-7/+15
Blacklist powerpc-unknown-linux-{gnu,musl} as having non-ignored GNU C ZSTs. Ref #64259 (this is a simpler alternative to that). See also https://github.com/rust-lang/rust/pull/64259#issuecomment-585815831.
2020-02-29mem::zeroed/uninit: panic on types that do not permit zero-initializationRalf Jung-30/+0
2020-02-28use is_empty() instead of len() == x to determine if structs are empty.Matthias Krüger-1/+1
2020-02-24Also blacklist powerpc-unknown-linux-musl.Ana-Maria-9/+12
2020-02-18Blacklist powerpc-unknown-linux-gnu as having non-ignored GNU C ZSTs.Ana-Maria-3/+8
2020-02-10Add `#[repr(no_niche)]`.Felix S. Klock II-7/+18
This repr-hint makes a struct/enum hide any niche within from its surrounding type-construction context. It is meant (at least initially) as an implementation detail for resolving issue 68303. We will not stabilize the repr-hint unless someone finds motivation for doing so. (So, declaration of `no_niche` feature lives in section of file where other internal implementation details are grouped, and deliberately leaves out the tracking issue number.) incorporated review feedback, and fixed post-rebase.
2020-02-08Auto merge of #68452 - msizanoen1:riscv-abi, r=nagisa,eddybbors-0/+1
Implement proper C ABI lowering for RISC-V This is necessary for full RISC-V psABI compliance when passing argument across C FFI boundary. cc @lenary
2020-02-04Implement proper C ABI lowering for RISC-Vmsizanoen1-0/+1
2020-02-02Use real resume type as second argumentJonas Schievink-1/+2
2020-02-02Add a resume type parameter to `Generator`Jonas Schievink-2/+2
2020-02-01Move builtin attribute logic to new rustc_attr crate.Mazdak Farrokhzad-1/+1
For now, this is all the crate contains, but more attribute logic & types will be moved there over time.
2020-01-08Display more informative ICEYuki Okushi-5/+9
2020-01-06Auto merge of #67886 - Centril:rustc_hir_canon_imports, r=nagisabors-1/+1
Nix `rustc_hir` reexports in rustc::hir r? @Zoxc cc @Mark-Simulacrum
2020-01-05Rename Instance.ty to Instance.monomorphic_tyAaron Hill-1/+1
2020-01-05Remove rustc_hir reexports in rustc::hir.Mazdak Farrokhzad-1/+1
2020-01-01Rename `syntax_pos` to `rustc_span` in source codeVadim Petrochenkov-1/+1
2019-12-22Format the worldMark Rousskov-573/+519
2019-12-201. ast::Mutability::{Mutable -> Mut, Immutable -> Not}.Mazdak Farrokhzad-2/+2
2. mir::Mutability -> ast::Mutability.
2019-12-08Rollup merge of #66325 - BartMassey:master, r=joshtriplettMazdak Farrokhzad-1/+1
Change unused_labels from allow to warn Fixes #66324, making the unused_labels lint warn instead of allow by default. I'm told @rust-lang/lang will need to review this, and perhaps will want to do a crater run.
2019-12-05Add caller_location paramter to FnAbi::new_internal.Adam Perry-2/+11
We pass it in `of_instance` when the instance requires caller location.
2019-12-03rustc: add docs to FnAbi::{of_fn_ptr,of_instance} and InstanceDef::Virtual.Eduard-Mihai Burtescu-0/+11
2019-12-03rustc: move Instance::fn_sig to ty::layout and privatize it.Eduard-Mihai Burtescu-1/+71
2019-12-03rustc_target: add abi::call::Conv::Rust distinct from Conv::C.Eduard-Mihai Burtescu-1/+1
2019-12-03rustc: take a PolyFnSig instead of an FnSig in FnAbi::of_fn_ptr.Eduard-Mihai Burtescu-7/+8
2019-12-03rustc: rename FnAbi::new to FnAbi::of_fn_ptr.Eduard-Mihai Burtescu-2/+2
2019-12-03rustc: compute FnAbi's for virtual calls through FnAbi::of_instance.Eduard-Mihai Burtescu-12/+8