about summary refs log tree commit diff
path: root/src/librustc_middle
AgeCommit message (Collapse)AuthorLines
2020-06-11Explain move errors that occur due to method calls involving `self`Aaron Hill-1/+3
2020-06-11Make `fn_arg_names` return `Ident` instead of symbolAaron Hill-6/+25
Also, implement this query for the local crate, not just foreign crates.
2020-06-11Rollup merge of #73182 - Aaron1011:feature/call-fn-span, r=matthewjasperDylan DPC-1/+6
Track span of function in method calls, and use this in #[track_caller] Fixes #69977 When we parse a chain of method calls like `foo.a().b().c()`, each `MethodCallExpr` gets assigned a span that starts at the beginning of the call chain (`foo`). While this is useful for diagnostics, it means that `Location::caller` will return the same location for every call in a call chain. This PR makes us separately record the span of the function name and arguments for a method call (e.g. `b()` in `foo.a().b().c()`). This `Span` is passed through HIR lowering and MIR building to `TerminatorKind::Call`, where it is used in preference to `Terminator.source_info.span` when determining `Location::caller`. This new span is also useful for diagnostics where we want to emphasize a particular method call - for an example, see https://github.com/rust-lang/rust/pull/72389#discussion_r436035990
2020-06-11Rollup merge of #73012 - Aaron1011:feature/span-debug-ctxt, r=matthewjasperDylan DPC-4/+7
Show `SyntaxContext` in formatted `Span` debug output This is only really useful in debug messages, so I've switched to calling `span_to_string` in any place that causes a `Span` to end up in user-visible output.
2020-06-11Remove associated opaque typesMatthew Jasper-40/+5
They're unused now.
2020-06-11Stop special casing top level TAITMatthew Jasper-5/+3
2020-06-11Rollup merge of #72380 - lcnr:const_context, r=estebankDylan DPC-12/+12
Fix `is_const_context`, update `check_for_cast` A better version of #71477 Adds `fn enclosing_body_owner` and uses it in `is_const_context`. `is_const_context` now uses the same mechanism as `mir_const_qualif` as it was previously incorrect. Renames `is_const_context` to `is_inside_const_context`. I also updated `check_for_cast` in the second commit, so r? @estebank (I removed one lvl of indentation, so it might be easier to review by hiding whitespace changes)
2020-06-11Auto merge of #71896 - spastorino:existential-assoc-types-variance, ↵bors-2/+2
r=nikomatsakis Relate existential associated types with variance Invariant Fixes #71550 #72315 r? @nikomatsakis The test case reported in that issue now errors with the following message ... ``` error[E0495]: cannot infer an appropriate lifetime for lifetime parameter 'a in function call due to conflicting requirements --> /tmp/test.rs:25:5 | 25 | bad(&Bar(PhantomData), x) | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 24:11... --> /tmp/test.rs:24:11 | 24 | fn extend<'a, T>(x: &'a T) -> &'static T { | ^^ note: ...so that reference does not outlive borrowed content --> /tmp/test.rs:25:28 | 25 | bad(&Bar(PhantomData), x) | ^ = note: but, the lifetime must be valid for the static lifetime... note: ...so that the types are compatible --> /tmp/test.rs:25:9 | 25 | bad(&Bar(PhantomData), x) | ^^^^^^^^^^^^^^^^^ = note: expected `&'static T` found `&T` error: aborting due to previous error For more information about this error, try `rustc --explain E0495`. ``` I could also add that test case if we want to have a weaponized one too.
2020-06-10Allow inference regions when relating constsTyler Mandry-10/+1
Fixes #73050
2020-06-10Add doc commentsAaron Hill-0/+2
2020-06-10Track span of function in method calls, and use this in #[track_caller]Aaron Hill-1/+4
Fixes #69977 When we parse a chain of method calls like `foo.a().b().c()`, each `MethodCallExpr` gets assigned a span that starts at the beginning of the call chain (`foo`). While this is useful for diagnostics, it means that `Location::caller` will return the same location for every call in a call chain. This PR makes us separately record the span of the function name and arguments for a method call (e.g. `b()` in `foo.a().b().c()`). This `Span` is passed through HIR lowering and MIR building to `TerminatorKind::Call`, where it is used in preference to `Terminator.source_info.span` when determining `Location::caller`. This new span is also useful for diagnostics where we want to emphasize a particular method call - for an example, see https://github.com/rust-lang/rust/pull/72389#discussion_r436035990
2020-06-10On recursive ADT, provide indirection structured suggestionEsteban Küber-1/+9
2020-06-10Rollup merge of #72890 - ↵Dylan DPC-0/+28
davidtwco:issue-66202-normalize-and-transparent-improper-ctypes, r=varkor improper ctypes: normalize return types and transparent structs Fixes #66202. See each commit individually (except the first which adds a test) for more detailed explanations on the changes made. In summary, this PR ensures that return types are normalized before being checked for FFI-safety, and that transparent newtype wrappers are FFI-safe if the type being wrapped is FFI-safe (often true previously, but not if, after substitution, all types in a transparent newtype were zero sized).
2020-06-10Use min_specialization in the remaining rustc cratesMatthew Jasper-152/+255
2020-06-09Relate existential associated types with variance InvariantSantiago Pastorino-2/+2
2020-06-09lint: transitive FFI-safety for transparent typesDavid Wood-0/+28
This commit ensures that if a `repr(transparent)` newtype's only non-zero-sized field is FFI-safe then the newtype is also FFI-safe. Previously, ZSTs were ignored for the purposes of linting FFI-safety in transparent structs - thus, only the single non-ZST would be checked for FFI-safety. However, if the non-zero-sized field is a generic parameter, and is substituted for a ZST, then the type would be considered FFI-unsafe (as when every field is thought to be zero-sized, the type is considered to be "composed only of `PhantomData`" which is FFI-unsafe). In this commit, for transparent structs, the non-zero-sized field is identified (before any substitutions are applied, necessarily) and then that field's type (now with substitutions) is checked for FFI-safety (where previously it would have been skipped for being zero-sized in this case). To handle the case where the non-zero-sized field is a generic parameter, which is substituted for `()` (a ZST), and is being used as a return type - the `FfiUnsafe` result (previously `FfiPhantom`) is caught and silenced. Signed-off-by: David Wood <david@davidtw.co>
2020-06-09Auto merge of #72114 - anyska:vtable-rename, r=nikomatsakisbors-136/+137
Rename traits::Vtable to ImplSource. Originally suggested by @eddyb. r? @nikomatsakis
2020-06-09[AVR] Add AVR platform supportJake Goulding-0/+2
2020-06-08Show `SyntaxContext` in formatted `Span` debug outputAaron Hill-4/+7
This is only really useful in debug messages, so I've switched to calling `span_to_string` in any place that causes a `Span` to end up in user-visible output.
2020-06-08Rollup merge of #73090 - marmeladema:resolver-outputs-local-def-id, ↵Dylan DPC-7/+8
r=petrochenkov Use `LocalDefId` directly in `Resolver::export_map` This is to avoid the final conversion from `NodeId` to `HirId` during call to `(clone|into)_outputs` This brings down the post-lowering uses of `NodeId` down to 2 calls to convert the `trait_map`. cc #50928 r? @petrochenkov
2020-06-07Use `LocalDefId` directly in `Resolver::export_map` and `module_exports` querymarmeladema-7/+8
This is to avoid the final conversion from `NodeId` to `HirId` during call to `Resolver::(clone|into)_outputs`.
2020-06-07rename FalseEdges -> FalseEdgeRalf Jung-11/+11
2020-06-07Rollup merge of #73059 - lcnr:outdated-comment, r=matthewjasperDylan DPC-4/+0
remove outdated comment r? @matthewjasper
2020-06-07use enum to represent ObligationCause::dummy without allocatingBastian Kauschke-10/+9
2020-06-07store `ObligationCause` on the heapBastian Kauschke-10/+48
2020-06-06Fix #[thread_local] statics as asm! sym operandsAmanieu d'Antras-6/+8
2020-06-06Rollup merge of #72508 - ecstatic-morse:poly-self-ty, r=nikomatsakisRalf Jung-2/+2
Make `PolyTraitRef::self_ty` return `Binder<Ty>` This came up during review of #71618. The current implementation is the same as a call to `skip_binder` but harder to audit. Make it preserve binding levels and add a call to `skip_binder` at all use sites so they can be audited as part of #72507.
2020-06-06remove outdated commentBastian Kauschke-4/+0
2020-06-06Auto merge of #72927 - petrochenkov:rustc, r=Mark-Simulacrumbors-3/+3
Rename all remaining compiler crates to use the `rustc_foo` pattern libarena -> librustc_arena libfmt_macros -> librustc_parse_format libgraphviz -> librustc_graphviz libserialize -> librustc_serialize Closes https://github.com/rust-lang/rust/issues/71177 in particular.
2020-06-05Rename traits::ImplSourceImpl to ImplSourceUserDefined.Ana-Maria Mihalache-18/+20
2020-06-05Rename traits::Vtable to ImplSource.Ana-Maria Mihalache-134/+133
2020-06-04Remove unsused `NodeId` related APIs in hir mapmarmeladema-35/+2
2020-06-04Rollup merge of #72950 - lcnr:fix_doc, r=davidtwcoDylan DPC-1/+1
fix `AdtDef` docs
2020-06-03Auto merge of #72754 - lcnr:predicate-fold, r=nikomatsakisbors-1/+2
remove trivial `mk_predicate`s r? @nikomatsakis
2020-06-03fix `AdtDef` docsBastian Kauschke-1/+1
2020-06-03Auto merge of #70107 - lcnr:issue68977, r=eddybbors-4/+4
WF-check all ty::Const's, not just array lengths. fixes #68977 This PR removes the special case for array length in `wf::compute` and checks the well formedness of all consts. Changes `PredicateKind::WellFormed` to take a `GenericArg` and updates `wf::obligations`.
2020-06-02Rename the crates in source codeVadim Petrochenkov-2/+2
2020-06-02Make things build againVadim Petrochenkov-2/+2
2020-06-02change WellFormed predicate to GenericArgBastian Kauschke-21/+6
2020-06-02add WellFormedConst predicateBastian Kauschke-2/+17
2020-06-02Rollup merge of #72893 - RalfJung:unleash-tls, r=ecstatic-morseYuki Okushi-2/+2
test miri-unleash TLS accesses Finally gets rid of `IS_SUPPORTED_IN_MIRI`. :-) I also added a test for the new `asm!` while I am at it. r? @ecstatic-morse Cc @rust-lang/wg-const-eval
2020-06-02Rollup merge of #72822 - lcnr:intern-me, r=estebankYuki Okushi-1/+5
remove trivial calls to mk_const similar to #72754
2020-06-01`PolyTraitRef::self_ty` returns `Binder<Ty>`Dylan MacKenzie-2/+2
2020-06-01test miri-unleash TLS accessesRalf Jung-2/+2
2020-06-01Auto merge of #71192 - oli-obk:eager_alloc_id_canonicalization, r=wesleywiserbors-1/+28
Make TLS accesses explicit in MIR r? @rust-lang/wg-mir-opt cc @RalfJung @vakaras for miri thread locals cc @bjorn3 for cranelift fixes #70685
2020-06-01Rollup merge of #72823 - matthewjasper:describe-queries, r=eddybDylan DPC-66/+168
Add descriptions for all queries This also removes the default description for queries with DefId keys and makes the macro validate that a description is provided. cc #72730 r? @eddyb
2020-05-31Add descriptions for all queriesMatthew Jasper-66/+168
2020-05-31remove trivial calls to mk_constBastian Kauschke-1/+5
2020-05-31Rollup merge of #72745 - lcnr:interned-cleanup, r=petrochenkovRalf Jung-48/+2
generalize Borrow<[T]> for Interned<'tcx, List<T>>
2020-05-31Rollup merge of #72715 - estebank:trailing-comma-where, r=petrochenkovRalf Jung-15/+1
Account for trailing comma when suggesting `where` clauses Fix #72693.