about summary refs log tree commit diff
path: root/src/librustc_middle
AgeCommit message (Collapse)AuthorLines
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
2020-04-10librustc_middle: return LocalDefId instead of DefId in local_def_id_from_node_idmarmeladema-12/+9
2020-04-10librustc_middle: return LocalDefId instead of DefId in body_owner_def_idmarmeladema-6/+5
2020-04-10librustc_middle: return LocalDefId instead of DefId in opt_local_def_idmarmeladema-10/+12
2020-04-10librustc_middle: return LocalDefId instead of DefId in ↵marmeladema-11/+13
opt_local_def_id_from_node_id
2020-04-10Rollup merge of #70913 - eddyb:rc-arc-diagnostic-items, r=matthewjasperMazdak Farrokhzad-40/+7
Replace "rc"/"arc" lang items with Rc/Arc diagnostic items. `Rc`/`Arc` should have no special semantics, so it seems appropriate for them to not be lang items. r? @matthewjasper
2020-04-09Auto merge of #70909 - marmeladema:issue70853/librustc_hir-local-def-id, r=eddybbors-3/+3
librustc_hir: return LocalDefId instead of DefId in local_def_id Its a first try to remove a few calls to `expect_local` and use `LocalDefId` instead of `DefId` where possible for #70853 This adds some calls to `.to_def_id()` to get a `DefId` back when needed. I don't know if I should push `LocalDefId` even further and change, for example, `Res::Def` to accept a `LocalDefId` instead of a `DefId` as second argument. cc @ecstatic-morse
2020-04-09Auto merge of #70860 - lcnr:has_local_value, r=nikomatsakisbors-28/+14
remove `KEEP_IN_LOCAL_TCX` flag closes #70285 I did not rename `needs_infer` here as this complex enough as is. Will probably open a followup for that. r? @eddyb
2020-04-08replace `has_local_value` with `needs_infer`Bastian Kauschke-30/+14
2020-04-08Rollup merge of #70870 - mark-i-m:de-abuse-err, r=eddybDylan DPC-4/+4
Fix abuses of tykind::err r? @eddyb cc https://github.com/rust-lang/rust/issues/70866
2020-04-08don't set `HAS_INFER` for fresh typesBastian Kauschke-3/+5
2020-04-08Rollup merge of #70915 - tsandstr:remove-nominal-flags, r=eddybDylan DPC-24/+1
Remove unnecessary TypeFlags::NOMINAL_FLAGS This was a relic from when we had "nominal flags" and "cached properties." The latter no longer exists, so nominal flags are no longer necessary. In fact, every flag is considered a nominal flag. I went ahead and removed all references to NOMINAL_FLAGS. Fixes rust-lang#70836
2020-04-08Rollup merge of #70876 - nnethercote:smallvec-predecessors, r=estebankDylan DPC-5/+11
Use a `SmallVec` for `Cache::predecessors`. This is a very small win.
2020-04-08Replace "rc"/"arc" lang items with Rc/Arc diagnostic items.Eduard-Mihai Burtescu-40/+7
2020-04-07fix abuses of tykind::errmark-4/+4
2020-04-07Remove unnecessary TypeFlags::NOMINAL_FLAGSTheo Sandstrom-24/+1
This was a relic from when we had "nominal flags" and "cached properties." The latter no longer exists, so nominal flags are no longer necessary. In fact, every flag is considered a nominal flag. I went ahead and removed all references to NOMINAL_FLAGS. Fixes rust-lang#70836
2020-04-08librustc_hir: return LocalDefId instead of DefId in local_def_idmarmeladema-3/+3
2020-04-07Use a `SmallVec` for `Cache::predecessors`.Nicholas Nethercote-5/+11
This is a very small win.
2020-04-06ty: remove `{Existential,}Trait{Ref,Predicate}::input_types`.Eduard-Mihai Burtescu-20/+0
2020-04-06ty: remove unnecessary `Predicate::walk_tys` and `collect_regions`.Eduard-Mihai Burtescu-84/+0
2020-04-06ty: switch `Ty::walk` from `Ty` to `GenericArg`.Eduard-Mihai Burtescu-50/+38
2020-04-06ty/walk: switch `walk_shallow` from `Ty` to `GenericArg`.Eduard-Mihai Burtescu-62/+34
2020-04-06ty/walk: keep track of `GenericArg`s on the stack, instead of `Ty`s.Eduard-Mihai Burtescu-85/+107
2020-04-05Rollup merge of #70777 - faern:use-assoc-int-consts2, r=dtolnayDylan DPC-1/+1
Don't import integer and float modules, use assoc consts Stop importing the standard library integer and float modules to reach the `MIN`, `MAX` and other constants. They are available directly on the primitive types now. This PR is a follow up of #69860 which made sure we use the new constants in documentation. This type of change touches a lot of files, and previously all my assoc int consts PRs had collisions and were accepted only after a long delay. So I'd prefer to do it in smaller steps now. Just removing these imports seem like a good next step. r? @dtolnay
2020-04-05Rollup merge of #67797 - Aaron1011:feature/instance-query, r=nikomatsakisDylan DPC-21/+18
Query-ify Instance::resolve Split off from #65989 Instance::resolve is now a wrapper for a new `resolve_instance` query. This greatly improves performance on several benchmarks
2020-04-05Stop importing int/float modules in librustc_*Linus Färnstrand-1/+1
2020-04-05Query-ify Instance::resolveAaron Hill-21/+18
2020-04-05Rollup merge of #70748 - ogoffart:enum-layout-optim2, r=eddybDylan DPC-5/+3
Do not disable field reordering on enums with big discriminant The field are always re-ordered to minimize padding, regardless of the alignment of the discriminant (spinoff from #70477)
2020-04-04Auto merge of #70272 - eddyb:type-of-impl-trait, r=nikomatsakisbors-27/+21
typeck/type_of: let wfcheck handle generics in opaque types' substs. I was working on #70164, and `type_of`'s handling of opaque types seemed to be, by far, the trickiest use of `Ty::walk`, but I believe it wasn't doing anything (see https://github.com/rust-lang/rust/pull/57896#discussion_r396064431 - I suspect, based on glancing at the PR discussion, that an early attempt was kept in, despite becoming just an overcomplicated way to do exactly the same as the previous simple type equality check). I would've loved to remove `ResolvedOpaqueTy` (keep the `Ty` and lose the `Substs`), but it looks like the MIR borrowck part of the process needs that now, so it would've been added anyway since #57896, even if that PR hadn't happened. <hr/> In the process, I've moved the remaining substitution validation to `wfcheck`, which was already handling lifetimes, and kept only `delay_span_bug`s in `type_of`, as an insurance policy. I've added tests for lifetime and const cases, they seem to be checked correctly now. (and more uniform than they were in https://github.com/rust-lang/rust/issues/63063#issuecomment-602162804) However, the quality of the errors is maybe a bit worse, and they don't trigger when there are other errors (not sure if this is due to compilation stop points or something more specific to one opaque type). r? @nikomatsakis cc @matthewjasper @oli-obk @Aaron1011
2020-04-04typeck/type_of: simplify checking of opaque types with multipler defining uses.Eduard-Mihai Burtescu-27/+21
2020-04-03Do not disable field reordering on enums with big discriminantOlivier Goffart-5/+3
The field are always re-ordered to minimize padding, regardless of the alignment of the discriminant
2020-04-02Add hash of source files in debug infoArlo Siemsen-1/+1
* Adds either an MD5 or SHA1 hash to the debug info. * Adds new unstable option `-Z src-hash-algorithm` to control the hashing algorithm.
2020-04-02Rollup merge of #70658 - davidtwco:issue-70285-still-further-specializable, ↵Mazdak Farrokhzad-55/+80
r=eddyb add `STILL_FURTHER_SPECIALIZABLE` flag Contributes to #70285. This PR adds a `STILL_FURTHER_SPECIALIZABLE` flag to `TypeFlags` which replaces `needs_infer` and `needs_subst` in `Instance::resolve` and `assemble_candidates_from_impls`. r? @eddyb
2020-04-02nix CachingSourceMapView reexportMazdak Farrokhzad-1/+0
2020-04-02direct imports for langitem stuffMazdak Farrokhzad-12/+8
2020-04-02use direct import for ErrorReportedMazdak Farrokhzad-5/+3
2020-04-02nix rustc_target::abi::* reexport in ty::layoutMazdak Farrokhzad-35/+30
2020-04-02add `STILL_FURTHER_SPECIALIZABLE` flagDavid Wood-55/+80
This commit adds a STILL_FURTHER_SPECIALIZABLE flag to `TypeFlags` which replaces `needs_infer` and `needs_subst` in `Instance::resolve` and `assemble_candidates_from_impls.` Signed-off-by: David Wood <david@davidtw.co>
2020-04-01Rollup merge of #70616 - anyska:fieldplacement-rename, r=oli-obkDylan DPC-23/+23
rustc_target::abi: rename FieldPlacement to FieldsShape. Originally suggested by @eddyb.
2020-04-01Rollup merge of #70590 - RalfJung:miri-backtrace, r=oli-obkDylan DPC-13/+9
Miri: make backtrace function names and spans match up Currently, Miri backtraces are a bit confusing: ``` error: Undefined Behavior: entering unreachable code --> tests/compile-fail/never_transmute_void.rs:10:11 | 10 | match v {} //~ ERROR entering unreachable code | ^ entering unreachable code | = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information note: inside call to `f` at tests/compile-fail/never_transmute_void.rs:17:5 --> tests/compile-fail/never_transmute_void.rs:17:5 | 17 | f(v); //~ inside call to `f` | ^^^^ = note: inside call to `main` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:67:34 = note: inside call to closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:52:73 = note: inside call to closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/sys_common/backtrace.rs:130:5 ``` When reading this like a normal backtrace, one would expect that e.g. the backrace involves the "main" function at "libstd/rt.rs:67:34". But that is not actually where we are in the main function, that is *where the main function is called*. This is not how backtraces are usually rendered (including e.g. with `RUST_BACKTRACE=1`). Usually we print next to each function name where inside that function the frame is currently executing, not where the *parent* frame is executing. With this PR and the Miri side at https://github.com/rust-lang/miri/pull/1283, the backtrace now looks as follows: ``` error: Undefined Behavior: entering unreachable code --> tests/compile-fail/never_transmute_void.rs:10:11 | 10 | match v {} //~ ERROR entering unreachable code | ^ entering unreachable code | = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = note: inside `f` at tests/compile-fail/never_transmute_void.rs:10:11 note: inside `main` at tests/compile-fail/never_transmute_void.rs:17:5 --> tests/compile-fail/never_transmute_void.rs:17:5 | 17 | f(v); //~ inside `main` | ^^^^ = note: inside closure at /home/r/src/rust/rustc/src/libstd/rt.rs:67:34 = note: inside closure at /home/r/src/rust/rustc/src/libstd/rt.rs:52:73 = note: inside `std::sys_common::backtrace::__rust_begin_short_backtrace::<[closure@DefId(1:6034 ~ std[87db]::rt[0]::lang_start_internal[0]::{{closure}}[0]::{{closure}}[0]) 0:&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/r/src/rust/rustc/src/libstd/sys_common/backtrace.rs:130:5 ``` Now function name and printed line numbers match up in the notes. This code is partially shared with const-eval, so the change also affects const-eval: instead of printing what is being called at some span, we print which function/constant this span is inside. With this, we can also remove the `span` field from Miri's stack frames (which used to track the *caller span* of that frame, quite confusing), and then get of a whole lot of `span` arguments that ultimately just served to fill that field (and as a fallback for `caller_location`, which however was never actually used). r? @oli-obk
2020-04-01Rollup merge of #70535 - jonas-schievink:graph-refactor, r=nikomatsakisDylan DPC-11/+59
Track the finalizing node in the specialization graph Fixes https://github.com/rust-lang/rust/issues/70419 Fixes https://github.com/rust-lang/rust/issues/70442 r? @eddyb
2020-04-01Rollup merge of #70627 - spastorino:use-place-directly-its-copy, r=oli-obkMazdak Farrokhzad-2/+2
Use place directly its copy r? @oli-obk
2020-03-31Use Place directly on Operand::place and friends, it's CopySantiago Pastorino-2/+2
2020-03-31const backtrace: do not skip first frameRalf Jung-4/+5
2020-03-31rustc_target::abi: rename FieldPlacement to FieldsShape.Ana-Maria Mihalache-23/+23
2020-03-30Add `can_unwind` field to `FnAbi`Wesley Wiser-3/+57
This is a pure refactoring with no behavior changes.
2020-03-30Miri stacktrace: record span inside frame, not call-site spanRalf Jung-13/+8
2020-03-30Use query instead of `impl_is_default` fnJonas Schievink-19/+1
2020-03-30spec. graph: track defining and finalizing implsJonas Schievink-5/+75