about summary refs log tree commit diff
path: root/src/librustc_middle
AgeCommit message (Collapse)AuthorLines
2020-06-18Rollup merge of #70551 - mark-i-m:ty-err-2, r=varkorManish Goregaokar-41/+68
Make all uses of ty::Error delay a span bug r? @eddyb A second attempt at https://github.com/rust-lang/rust/pull/70245 resolves https://github.com/rust-lang/rust/issues/70866
2020-06-18Perform obligation deduplication to avoid buggy `ExistentialMismatch`Esteban Küber-3/+13
Fix #59326.
2020-06-18Add helper method for reusing an existing interned regionMatthew Jasper-0/+7
2020-06-18Use alloc::Layout in DroplessArena APITomasz Miąsko-12/+5
2020-06-17Unify region variables when projecting associated typesmatthewjasper-0/+3
This is required to avoid cycles when evaluating auto trait predicates.
2020-06-16format derivesWho? Me?!-13/+2
Co-authored-by: lzutao <taolzu@gmail.com>
2020-06-16Rollup merge of #73373 - lzutao:bug-trackcaller, r=AmanieuDylan DPC-21/+21
Use track caller for bug! macro
2020-06-16Rollup merge of #73237 - tmiasko:arena, r=nnethercoteDylan DPC-1/+1
Check for overflow in DroplessArena and align returned memory * Check for overflow when calculating the slice start & end position. * Align the pointer obtained from the allocator, ensuring that it satisfies user requested alignment (the allocator is only asked for layout compatible with u8 slice). * Remove an incorrect assertion from DroplessArena::align. * Avoid forming references to an uninitialized memory in DroplessArena. Helps with #73007, #72624.
2020-06-16fmt; make visit_terminator arg names consistent with the restRalf Jung-19/+19
2020-06-16rename location field of Drop terminators to placeRalf Jung-16/+16
2020-06-16remove visit_terminator_kind from MIR visitorRalf Jung-13/+1
2020-06-16Auto merge of #72962 - lcnr:ObligationCause-lrc, r=ecstatic-morsebors-10/+47
store `ObligationCause` on the heap Stores `ObligationCause` on the heap using an `Rc`. This PR trades off some transient memory allocations to reduce the size of–and thus the number of instructions required to memcpy–a few widely used data structures in trait solving.
2020-06-15added test, Operand::const_from_scalar, require_lang_item, & commentsRich Kadel-0/+28
Addresses feedback from @oli-obk (Thanks!)
2020-06-15Add case for count_code_region() extern lang_itemRich Kadel-17/+3
As suggested in PR feedback: https://github.com/rust-lang/rust/pull/73011#discussion_r435728923 This allows count_code_region() to be handled like a normal intrinsic so the InstanceDef::InjectedCode variant is no longer needed.
2020-06-15[WIP] injects llvm intrinsic instrprof.increment for coverage reportsRich Kadel-3/+17
This initial version only injects counters at the top of each function. Rust Coverage will require injecting additional counters at each conditional code branch.
2020-06-15track caller for delay_span_bugmark-22/+4
2020-06-15make all uses of ty::Error or ConstKind::Error delay a span bugmark-41/+97
2020-06-15typeck: Use `LocalDefId`s for the unused trait import setVadim Petrochenkov-3/+4
2020-06-15Use `LocalDefId` for import IDs in trait mapVadim Petrochenkov-7/+6
2020-06-15Remove use of specialization from librustc_arenaMatthew Jasper-1/+0
2020-06-15When `'static` is explicit, suggest constraining argument with itEsteban Küber-1/+4
2020-06-15Suggest substituting `'static` lifetime in impl/dyn `Trait + 'static` return ↵Esteban Küber-8/+13
types
2020-06-15Use track caller for bug! macroLzu Tao-19/+20
2020-06-15Join mutiple lines if it is more readableLzu Tao-2/+1
2020-06-15Auto merge of #73369 - RalfJung:rollup-hl8g9zf, r=RalfJungbors-153/+265
Rollup of 10 pull requests Successful merges: - #72707 (Use min_specialization in the remaining rustc crates) - #72740 (On recursive ADT, provide indirection structured suggestion) - #72879 (Miri: avoid tracking current location three times) - #72938 (Stabilize Option::zip) - #73086 (Rename "cyclone" to "apple-a7" per changes in upstream LLVM) - #73104 (Example about explicit mutex dropping) - #73139 (Add methods to go from a nul-terminated Vec<u8> to a CString) - #73296 (Remove vestigial CI job msvc-aux.) - #73304 (Revert heterogeneous SocketAddr PartialEq impls) - #73331 (extend network support for HermitCore) Failed merges: r? @ghost
2020-06-15Rollup merge of #72879 - RalfJung:miri-tctx-at, r=oli-obkRalf Jung-0/+1
Miri: avoid tracking current location three times Miri tracks the current instruction to execute in the call stack, but it also additionally has two `TyCtxtAt` that carry a `Span` that also tracks the current instruction. That is quite silly, so this PR uses `TyCtxt` instead, and then uses a method for computing the current span when a `TyCtxtAt` is needed. Having less redundant (semi-)global state seems like a good improvement to me. :D To keep the ConstProp errors the same, I had to add the option to `error_to_const_error` to overwrite the span. Also for some reason this changes cycle errors a bit -- not sure if we are now better or worse as giving those queries the right span. (It is unfortunately quite easy to accidentally use `DUMMY_SP` by calling the query on a `TyCtxt` instead of a `TyCtxtAt`.) r? @oli-obk @eddyb
2020-06-15Rollup merge of #72740 - estebank:recursive-indirection, r=matthewjasperRalf Jung-1/+9
On recursive ADT, provide indirection structured suggestion
2020-06-15Rollup merge of #72707 - matthewjasper:rustc_min_spec, r=oli-obkRalf Jung-152/+255
Use min_specialization in the remaining rustc crates This adds a lot of `transmute` calls to replace the unsound uses of specialization. It's ugly, but at least it's honest about what's going on. cc #71420, @RalfJung
2020-06-15Fix whitespaceNathan Corbyn-1/+1
2020-06-15Fix exports with `#[inline(always)]`Nathan Corbyn-10/+5
2020-06-15Export all fns with extern indicatorNathan Corbyn-8/+8
2020-06-15Export `#[inline] #[no_mangle]` fns in cdylibs and staticlibsNathan Corbyn-0/+5
2020-06-15Auto merge of #73367 - RalfJung:rollup-4ewvk9b, r=RalfJungbors-9/+45
Rollup of 10 pull requests Successful merges: - #71824 (Check for live drops in constants after drop elaboration) - #72389 (Explain move errors that occur due to method calls involving `self`) - #72556 (Fix trait alias inherent impl resolution) - #72584 (Stabilize vec::Drain::as_slice) - #72598 (Display information about captured variable in `FnMut` error) - #73336 (Group `Pattern::strip_*` method together) - #73341 (_match.rs: fix module doc comment) - #73342 (Fix iterator copied() documentation example code) - #73351 (Update E0446.md) - #73353 (structural_match: non-structural-match ty closures) Failed merges: r? @ghost
2020-06-15Avoid forming references to an uninitialized memory in DroplessArenaTomasz Miąsko-1/+1
Return a pointer from `alloc_raw` instead of a slice. There is no practical use for slice as a return type and changing it to a pointer avoids forming references to an uninitialized memory.
2020-06-15Rollup merge of #72598 - Aaron1011:feature/fnmut-capture-span, r=nikomatsakisRalf Jung-1/+9
Display information about captured variable in `FnMut` error Fixes #69446 When we encounter a region error involving an `FnMut` closure, we display a specialized error message. However, we currently do not tell the user which upvar was captured. This makes it difficult to determine the cause of the error, especially when the closure is large. This commit records marks constraints involving closure upvars with `ConstraintCategory::ClosureUpvar`. When we decide to 'blame' a `ConstraintCategory::Return`, we additionall store the captured upvar if we found a `ConstraintCategory::ClosureUpvar` in the path. When generating an error message, we point to relevant spans if we have closure upvar information available. We further customize the message if an `async` closure is being returned, to make it clear that the captured variable is being returned indirectly.
2020-06-15Rollup merge of #72389 - Aaron1011:feature/move-fn-self-msg, r=nikomatsakisRalf Jung-7/+28
Explain move errors that occur due to method calls involving `self` When calling a method that takes `self` (e.g. `vec.into_iter()`), the method receiver is moved out of. If the method receiver is used again, a move error will be emitted:: ```rust fn main() { let a = vec![true]; a.into_iter(); a; } ``` emits ``` error[E0382]: use of moved value: `a` --> src/main.rs:4:5 | 2 | let a = vec![true]; | - move occurs because `a` has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait 3 | a.into_iter(); | - value moved here 4 | a; | ^ value used here after move ``` However, the error message doesn't make it clear that the move is caused by the call to `into_iter`. This PR adds additional messages to move errors when the move is caused by using a value as the receiver of a `self` method:: ``` error[E0382]: use of moved value: `a` --> vec.rs:4:5 | 2 | let a = vec![true]; | - move occurs because `a` has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait 3 | a.into_iter(); | ------------- value moved due to this method call 4 | a; | ^ value used here after move | note: this function takes `self`, which moves the receiver --> /home/aaron/repos/rust/src/libcore/iter/traits/collect.rs:239:5 | 239 | fn into_iter(self) -> Self::IntoIter; ``` TODO: - [x] Add special handling for `FnOnce/FnMut/Fn` - we probably don't want to point at the unstable trait methods - [x] Consider adding additional context for operations (e.g. `Shr::shr`) when the call was generated using the operator syntax (e.g. `a >> b`) - [x] Consider pointing to the method parent (impl or trait block) in addition to the method itself.
2020-06-15Rollup merge of #71824 - ecstatic-morse:const-check-post-drop-elab, r=oli-obkRalf Jung-1/+8
Check for live drops in constants after drop elaboration Resolves #66753. This PR splits the MIR "optimization" pass series in two and introduces a query–`mir_drops_elaborated_and_const_checked`–that holds the result of the `post_borrowck_cleanup` analyses and checks for live drops. This query is invoked in `rustc_interface` for all items requiring const-checking, which means we now do `post_borrowck_cleanup` for items even if they are unused in the crate. As a result, we are now more precise about when drops are live. This is because drop elaboration can e.g. eliminate drops of a local when all its fields are moved from. This does not mean we are doing value-based analysis on move paths, however; Storing a `Some(CustomDropImpl)` into a field of a local will still set the qualifs for that entire local. r? @oli-obk
2020-06-15Auto merge of #72080 - matthewjasper:uniform-impl-trait, r=nikomatsakisbors-45/+8
Clean up type alias impl trait implementation - Removes special case for top-level impl trait - Removes associated opaque types - Forbid lifetime elision in let position impl trait. This is consistent with the behavior for inferred types. - Handle lifetimes in type alias impl trait more uniformly with other parameters cc #69323 cc #63063 Closes #57188 Closes #62988 Closes #69136 Closes #73061
2020-06-14Improve `Instance` docsJonas Schievink-11/+41
2020-06-14Diagnose use of incompatible sanitizersTomasz Miąsko-10/+7
Emit an error when incompatible sanitizer are configured through command line options. Previously the last one configured prevailed and others were silently ignored. Additionally use a set to represent configured sanitizers, making it possible to enable multiple sanitizers at once. At least in principle, since currently all of them are considered to be incompatible with others.
2020-06-13Add MIR phase and query for drop elaborationDylan MacKenzie-1/+8
2020-06-13Rollup merge of #73194 - lzutao:INT-patterns, r=dtolnayDylan DPC-3/+3
Prefer the associated constants for pattern matching error Resolved this comment: https://github.com/rust-lang/rust/issues/68490#issuecomment-641614383
2020-06-13Rollup merge of #73066 - ecstatic-morse:query-structural-eq2, r=pnkfelixDylan DPC-0/+62
Querify whether a type has structural equality (Take 2) Alternative to #72177. Unlike in #72177, this helper method works for all types, falling back to a query for `TyKind::Adt`s that determines whether the `{Partial,}StructuralEq` traits are implemented. This is my preferred interface for this method. I think this is better than just documenting that the helper only works for ADTs. If others disagree, we can just merge #72177 with the fixes applied. This has already taken far too long.
2020-06-13Prefer the associated consts for pattern matching errorLzu Tao-3/+3
2020-06-12Use "reflexive equality" in docsDylan MacKenzie-2/+2
2020-06-12Helper method for whether type has structural equalityDylan MacKenzie-0/+62
This helper method works for all types, falling back to a query for `TyKind::Adt`s to determine whether the implement the `{Partial,}StructuralEq` traits.
2020-06-12Rollup merge of #73225 - tmandry:issue-73050, r=oli-obkDylan DPC-10/+1
Allow inference regions when relating consts As first noticed by @eddyb, `super_relate_consts` doesn't need to check for inference vars since `eval` does it already (and handles lifetimes correctly by erasing them). Fixes #73050 r? @oli-obk
2020-06-12make miri InterpCx TyCtxtAt a TyCtxt, and separately remember the root span ↵Ralf Jung-0/+1
of the evaluation
2020-06-12Auto merge of #69478 - avr-rust:avr-support-upstream, r=jonas-schievinkbors-0/+2
Enable AVR as a Tier 3 target upstream Tracking issue: #44052. Things intentionally left out of the initial upstream: * The `target_cpu` flag I have made the cleanup suggestions by @jplatte and @jplatte in https://github.com/avr-rust/rust/commit/043550d9db0582add42e5837f636f61acb26b915. Anybody feel free to give the branch a test and see how it fares, or make suggestions on the code patch itself.
2020-06-12Rollup merge of #73033 - Amanieu:asm-tls, r=oli-obkDylan DPC-6/+8
Fix #[thread_local] statics as asm! sym operands The `asm!` RFC specifies that `#[thread_local]` statics may be used as `sym` operands for inline assembly. This also fixes a regression in the handling of `#[thread_local]` during monomorphization which caused link-time errors with multiple codegen units, most likely introduced by #71192. r? @oli-obk