summary refs log tree commit diff
path: root/src/librustc_middle
AgeCommit message (Collapse)AuthorLines
2020-05-10Use more `Iterator`s instead of `Vec`sEsteban Küber-7/+5
2020-04-20Auto merge of #70729 - nnethercote:a-big-options-clean-up, r=petrochenkovbors-3/+1
A big options clean-up Lots of improvements here. r? @Centril
2020-04-20Auto merge of #71232 - eddyb:print-const-adts, r=oli-obkbors-68/+93
ty/print: pretty-print constant aggregates (arrays, tuples and ADTs). Oddly enough, we don't have any UI tests showing this off in types, only `mir-opt` tests. However, the pretty form should show up in the test output diff of #71018, if this PR is merged first. <hr/> Examples of before/after: |`Option<bool>`| |:-:| |`{transmute(0x01): std::option::Option<bool>}`| | :sparkles: ↓↓↓ :sparkles: | |`std::option::Option::<bool>::Some(true)`| | `RawVec<u32>` | |:-:| | `ByRef { alloc: Allocation { bytes: [4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [65535], len: Size { raw: 16 } }, size: Size { raw: 16 }, align: Align { pow2: 3 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }: alloc::raw_vec::RawVec::<u32>`| | :sparkles: ↓↓↓ :sparkles: | |`alloc::raw_vec::RawVec::<u32> { ptr: std::ptr::Unique::<u32> { pointer: {0x4 as *const u32}, _marker: std::marker::PhantomData::<u32> }, cap: 0usize, alloc: std::alloc::Global }`| <hr/> This PR is a prerequisite for #61486, *sort of*, in that we need to be able to pretty-print values in order to even consider how we might mangle them. We still don't have pretty-printing for constants of reference types, @oli-obk has the necessary support logic in a PR but I didn't want to interfere with that. <hr/> Each commit should be reviewed separately, as I've fixed a couple deficiencies along the way. r? @oli-obk cc @rust-lang/wg-mir-opt @varkor @yodaldevoid
2020-04-19Auto merge of #71331 - Dylan-DPC:rollup-5rn1isc, r=Dylan-DPCbors-6/+2
Rollup of 4 pull requests Successful merges: - #71026 (Fix false "never constructed" warnings for `Self::` variant paths) - #71310 (Do not show DefId in diagnostics) - #71317 (miri-unleash test for llvm_asm) - #71324 (Fix some tests failing in `--pass check` mode) Failed merges: r? @ghost
2020-04-19Rollup merge of #71310 - JohnTitor:dont-did, r=estebankDylan DPC-6/+2
Do not show DefId in diagnostics Fixes #71222 r? @estebank cc @eddyb
2020-04-19Dogfood more or_patterns in the compilerJosh Stone-58/+61
2020-04-19Auto merge of #70015 - jonas-schievink:gen-needs-drop, r=matthewjasperbors-5/+3
Make `needs_drop` less pessimistic on generators Generators only have non-trivial drop logic when they may store (in upvars or across yields) a type that does. This prevents generation of some unnecessary MIR in simple generators. There might be some impact on compile times, but this is probably limited in real-world applications. ~~This builds off of https://github.com/rust-lang/rust/pull/69814 since that contains some fixes that are made relevant by *this* PR (see https://github.com/rust-lang/rust/pull/69814#issuecomment-599147269).~~ (this has been merged)
2020-04-19Replace uses of `parse_opt_*` with `parse_*` where possible.Nicholas Nethercote-3/+1
This lets us specify the default at the options declaration point, instead of using `.unwrap(default)` or `None | Some(default)` at some use point far away. It also makes the code more concise.
2020-04-19Do not show DefId in diagnosticsYuki Okushi-6/+2
2020-04-18Do not emit note for projected derived obligationsEsteban Küber-1/+7
2020-04-18Remove `AssocTypeBound` and propagate bound `Span`sEsteban Küber-10/+0
2020-04-18Auto merge of #71218 - eddyb:a-lifetime-stranded-in-fn-def, r=nikomatsakisbors-6/+26
outlives: ignore lifetimes shallowly found in `ty::FnDef`s. Fixes #70917 by restoring the pre-#70164 behavior for now. r? @nikomatsakis
2020-04-17Make `needs_drop` less pessimistic on generatorsJonas Schievink-5/+3
2020-04-17Minor fix and addition to doc commentsJOE1994-3/+3
1. Fixed doc comment of struct 'rustc_middle::mir::Location' Currently, the general explanation of the struct appears at the field explanation section. I moved and changed the doc comments slightly, so that the general explanation would appear in the proper location in docs. 2. Added doc comment explaining 'rustc_mir::util::pretty::write_mir_fn' Unlike other counterparts, brief explanation for this function was missing, so I added one. Thank you for reviewing this PR :)
2020-04-17Auto merge of #71049 - eddyb:const-err, r=oli-obkbors-59/+72
Add `ConstKind::Error` and convert `ErrorHandled::Reported` to it. By replicating the `ty::Error` approach to encoding "an error has occurred", all of the mechanisms that skip redundant/downstream errors are engaged and help out (see the reduction in test output). This PR also adds `ErrorHandled::Linted` for the lint case because using `ErrorHandled::Reported` *without* having emitted an error that is *guaranteed* to stop compilation, is incorrect now. r? @oli-obk cc @rust-lang/wg-const-eval @varkor @yodaldevoid
2020-04-17Auto merge of #70629 - anyska:fields-variant, r=oli-obkbors-4/+11
rustc_target::abi: add Primitive variant to FieldsShape. Originally suggested by @eddyb.
2020-04-17ty/print: pretty-print constant aggregates (arrays, tuples and ADTs).Eduard-Mihai Burtescu-17/+64
2020-04-17mir: pretty-print `Rvalue::Aggregate` correctly.Eduard-Mihai Burtescu-15/+17
2020-04-17Rollup merge of #71206 - RalfJung:dont-try, r=oli-obkDylan DPC-4/+4
Miri error messages: avoid try terminology r? @oli-obk
2020-04-17ty/print/pretty: use `comma_sep` instead of replicating it.Eduard-Mihai Burtescu-36/+12
2020-04-16outlives: ignore lifetimes shallowly found in `ty::FnDef`s.Eduard-Mihai Burtescu-6/+26
2020-04-16bikeshedRalf Jung-2/+2
2020-04-16ty: convert `ErrorHandled::Reported` to `ConstKind::Error`.Eduard-Mihai Burtescu-2/+7
2020-04-16mir/interpret: only use `ErrorHandled::Reported` for `ErrorReported`.Eduard-Mihai Burtescu-36/+30
2020-04-16ty: add `ty::ConstKind::Error` to replace `tcx.consts.err`.Eduard-Mihai Burtescu-21/+35
2020-04-16Miri error messages: avoid try terminologyRalf Jung-4/+4
2020-04-16rustc_target::abi: add Primitive variant to FieldsShape.Ana-Maria Mihalache-4/+11
2020-04-15Do not ICE in the face of invalid enum discriminantEsteban Küber-1/+5
2020-04-15Rollup merge of #71116 - marmeladema:dummy-hir-id-removal, r=eddybMazdak Farrokhzad-29/+23
Entirely remove `DUMMY_HIR_ID` Some helpers functions have been introduced to deal with (buggy) cases where either a `NodeId` or a `DefId` do not have a corresponding `HirId`. Those cases are tracked in issue #71104.
2020-04-14ty: erase lifetimes early in `ty::Const::eval`.Eduard-Mihai Burtescu-30/+28
2020-04-14Remove `DUMMY_HIR_ID`marmeladema-22/+3
2020-04-14Do not use `DUMMY_HIR_ID` as placeholder value in node_id_to_hir_id tablemarmeladema-7/+20
Some helpers functions have been introduced to deal with (buggy) cases where either a `NodeId` or a `DefId` do not have a corresponding `HirId`. Those cases are tracked in issue #71104.
2020-04-14Rename AssocKind::Method to AssocKind::FnRustin-Liu-26/+16
Rename fn_has_self_argument to fn_has_self_parameter Rename AssocItemKind::Method to AssocItemKind::Fn Refine has_no_input_arg Refine has_no_input_arg Revert has_no_input_arg Refine suggestion_descr Move as_def_kind into AssocKind Signed-off-by: Rustin-Liu <rustin.liu@gmail.com> Fix tidy check issue Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
2020-04-13Auto merge of #70961 - ecstatic-morse:into-def-id, r=eddybbors-13/+46
Take `impl Into<DefId>` for query methods on `TyCtxt` Alternative implementation of #70956. cc #70853.
2020-04-12Rollup merge of #71069 - marmeladema:dummy-hir-id-obligation-clause, r=eddybDylan DPC-9/+8
Remove some usage of `DUMMY_HIR_ID` Use `ObligationClause::dummy()` when appropriate or replace `hir::DUMMY_HIR_ID`by `hir::CRATE_HIR_ID`, as used in `ObligationClause::dummy()`.
2020-04-12Rollup merge of #71013 - jonas-schievink:visit-projection, r=eddybDylan DPC-26/+33
Pass the `PlaceElem::Index` local to `visit_local` Fixes https://github.com/rust-lang/rust/issues/71008 cc @rust-lang/wg-mir-opt r? @spastorino
2020-04-12Remove usage of `DUMMY_HIR_ID` in `Scope::hir_id`marmeladema-9/+8
2020-04-11Add `#[inline(always)]` to `into_query_param`Dylan MacKenzie-0/+2
2020-04-11Apply suggestions from reviewDylan MacKenzie-14/+20
2020-04-11Use custom trait instead of `Into`Dylan MacKenzie-3/+23
2020-04-11Simplify macroDylan MacKenzie-57/+19
2020-04-11Fix inference falloutDylan MacKenzie-1/+1
2020-04-11Make query helpers on `TyCtxt` take `impl Into<DefId>`Dylan MacKenzie-23/+66
2020-04-11Auto merge of #71031 - Dylan-DPC:rollup-zr8hh86, r=Dylan-DPCbors-1/+18
Rollup of 5 pull requests Successful merges: - #70644 (Clean up `ModuleConfig` initialization) - #70937 (Fix staticlib name for *-pc-windows-gnu targets) - #70996 (Add or_insert_with_key to Entry of HashMap/BTreeMap) - #71020 (Store UNICODE_VERSION as a tuple) - #71021 (Use write!-style syntax for MIR assert terminator) Failed merges: r? @ghost
2020-04-11Rollup merge of #71021 - robojumper:71000-mir-assert-syntax, r=jonas-schievinkDylan DPC-1/+18
Use write!-style syntax for MIR assert terminator Fixes #71000. r? @jonas-schievink
2020-04-11Auto merge of #70161 - cjgillot:query-arena, r=nikomatsakisbors-28/+18
Allocate some query results on an arena This avoids a cloning few `Lrc` and `Vec`s in the queries.
2020-04-11Use write!-style syntax for MIR assert terminatorrobojumper-1/+18
2020-04-11Pass the `PlaceElem::Index` local to `visit_local`Jonas Schievink-26/+33
2020-04-10Auto merge of #70986 - marmeladema:issue70853/librustc_middle-local-def-id, ↵bors-22/+21
r=eddyb rustc_middle: return `LocalDefId` where possible in hir::map module This changes the return type of the following functions to return a `LocalDefId` instead of a `DefId`: * opt_local_def_id_from_node_id * opt_local_def_id * body_owner_def_id * local_def_id_from_node_id * get_parent_id This is another step in the right direction for #70853 This pull request will be followed by another (substantial one) which changes the return type of `local_def_id` function but this change being more invasive, we might want to wait for #70956 or #70961 (or some other form it) to land first.
2020-04-10librustc_middle: return LocalDefId instead of DefId in get_parent_didmarmeladema-3/+2