about summary refs log tree commit diff
path: root/src/librustc/middle
AgeCommit message (Collapse)AuthorLines
2018-12-20Stabilize `Rc`, `Arc` and `Pin` as method receiversMichael Hewson-0/+1
This lets you write methods using `self: Rc<Self>`, `self: Arc<Self>`, `self: Pin<&mut Self>`, `self: Pin<Box<Self>`, and other combinations involving `Pin` and another stdlib receiver type, without needing the `arbitrary_self_types`. Other user-created receiver types can be used, but they still require the feature flag to use. This is implemented by introducing a new trait, `Receiver`, which the method receiver's type must implement if the `arbitrary_self_types` feature is not enabled. To keep composed receiver types such as `&Arc<Self>` unstable, the receiver type is also required to implement `Deref<Target=Self>` when the feature flag is not enabled. This lets you use `self: Rc<Self>` and `self: Arc<Self>` in stable Rust, which was not allowed previously. It was agreed that they would be stabilized in #55786. `self: Pin<&Self>` and other pinned receiver types do not require the `arbitrary_self_types` feature, but they cannot be used on stable because `Pin` still requires the `pin` feature.
2018-12-18Mark tuple structs as live if their constructors are usedOliver Scherer-42/+38
2018-12-16Rollup merge of #56439 - JohnGinger:master, r=nikomatsakisMazdak Farrokhzad-4/+8
Clearer error message for dead assign I'm not that this is the right place for this (if it needs an RFC or not). I had the problem where I misunderstood the compiler lint message https://github.com/rust-lang/rust/issues/56436 and other people seem to have had the same problem https://www.reddit.com/r/rust/comments/8cy9p4/value_assigned_to_is_never_read/. I think this new wording might be slightly clearer (and help out beginners like me). I'm very new though, so there might be some nuance I'm missing that would make this more confusing or a bad idea for other reasons. I thought I would create a PR to make it easy to change the code if the consensus was that it would make sense to make a change. If this is the wrong place for this sort of thing I'll happily delete/move it.
2018-12-11Update testsvarkor-2/+2
2018-12-11Make liveness analysis respect privacyvarkor-2/+4
2018-12-11Make uninhabitedness checking more intelligentvarkor-2/+2
2018-12-11Check for uninhabitedness instead of nevervarkor-4/+2
2018-12-11Add lint for stlibaheart-2/+11
2018-12-09Add lint for items deprecated in futureaheart-15/+46
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-47/+45
2018-12-07Change to give a help messageJohn Ginger-6/+8
2018-12-06Use a function to access the Hir map to be able to turn it into a query laterJohn Kåre Alsaker-154/+154
2018-12-06Rollup merge of #56426 - petrochenkov:syntweak, r=nikomatsakisPietro Albini-1/+1
libsyntax_pos: A few tweaks
2018-12-05Rollup merge of #56456 - oli-obk:private_impl_trait, r=cramertjPietro Albini-0/+1
Handle existential types in dead code analysis fixes #55124 r? @cramertj
2018-12-05Rollup merge of #56119 - frewsxcv:frewsxcv-option-carrier, r=TimNNPietro Albini-4/+1
Utilize `?` instead of `return None`. None
2018-12-04Utilize `?` instead of `return None`.Corey Farwell-4/+1
2018-12-04syntax: Rename some keywordsVadim Petrochenkov-1/+1
`CrateRoot` -> `PathRoot`, `::` doesn't necessarily mean crate root now `SelfValue` -> `SelfLower`, `SelfType` -> `SelfUpper`, both `self` and `Self` can be used in type and value namespaces now
2018-12-03Handle existential types in dead code analysisOliver Scherer-0/+1
2018-12-02Fix line lengthJohn Ginger-2/+4
2018-12-02Clearer error message for dead assignJohn Ginger-2/+2
2018-12-01Rollup merge of #56365 - alexreg:stabilise-self_struct_ctor, r=Centrilkennytm-2/+3
Stabilize self_struct_ctor feature. [**Tracking Issue**](https://github.com/rust-lang/rust/issues/51994)
2018-12-01Rollup merge of #55821 - ljedrz:cached_key_sorts, r=michaelwoeristerkennytm-1/+1
Use sort_by_cached_key when the key function is not trivial/free I'm not 100% sure about `def_path_hash` (everything it does is inlined) but it seems like a good idea at least for the rest, as they are cloning.
2018-11-30Statically link proc_macro into proc macros.Eduard-Mihai Burtescu-3/+2
2018-11-30Use opt_def_id instead of having special branchEsteban Küber-3/+3
2018-11-30Fix ICE with feature self_struct_ctorEsteban Küber-0/+1
2018-11-29Auto merge of #49878 - dlrobertson:va_list_pt0, r=eddybbors-0/+1
libcore: Add VaList and variadic arg handling intrinsics ## Summary - Add intrinsics for `va_start`, `va_end`, `va_copy`, and `va_arg`. - Add `core::va_list::VaList` to `libcore`. Part 1 of (at least) 3 for #44930 Comments and critiques are very much welcomed 😄
2018-11-27Use sort_by_cached_key when key the function is not trivial/freeljedrz-1/+1
2018-11-26libcore: Add va_list lang item and intrinsicsDan Robertson-0/+1
- Add the llvm intrinsics used to manipulate a va_list. - Add the va_list lang item in order to allow implementing VaList in libcore.
2018-11-26rustc-guide has movedMark Mansi-1/+1
2018-11-21rustc: implement and use Default on more types.Eduard-Mihai Burtescu-7/+10
2018-11-21rustc: remove {FxHash,Node,DefId,HirId,ItemLocal}{Map,Set} "constructor" fns.Eduard-Mihai Burtescu-13/+13
2018-11-19Auto merge of #56051 - pietroalbini:rollup, r=pietroalbinibors-2/+2
Rollup of 25 pull requests Successful merges: - #55562 (Add powerpc- and powerpc64-unknown-linux-musl targets) - #55564 (test/linkage-visibility: Ignore on musl targets) - #55827 (A few tweaks to iterations/collecting) - #55834 (Forward the ABI of the non-zero sized fields of an union if they have the same ABI) - #55857 (remove unused dependency) - #55862 (in which the E0618 "expected function" diagnostic gets a makeover) - #55867 (do not panic just because cargo failed) - #55894 (miri enum discriminant handling: Fix treatment of pointers, better error when it is undef) - #55916 (Make miri value visitor useful for mutation) - #55919 (core/tests/num: Simplify `test_int_from_str_overflow()` test code) - #55923 (reword #[test] attribute error on fn items) - #55949 (ty: return impl Iterator from Predicate::walk_tys) - #55952 (Update to Clang 7 on CI.) - #55953 (#53488 Refactoring UpvarId) - #55962 (rustdoc: properly calculate spans for intra-doc link resolution errors) - #55963 (Stress test for MPSC) - #55968 (Clean up some non-mod-rs stuff.) - #55970 (Miri backtrace improvements) - #56007 (CTFE: dynamically make sure we do not call non-const-fn) - #56011 (Replace data.clone() by Arc::clone(&data) in mutex doc.) - #56012 (avoid shared ref in UnsafeCell::get) - #56016 (Add VecDeque::resize_with) - #56027 (docs: Add missing backtick in object_safety.rs docs) - #56043 (remove "approx env bounds" if we already know from trait) - #56059 (Increase `Duration` approximate equal threshold to 1us)
2018-11-18Fix ICEs from imports of items not defined in modulesVadim Petrochenkov-5/+3
2018-11-14capture_disjoint_fields(rust-lang#53488)Blitzerr-2/+2
Refactoring out the HirId of the UpvarId in another struct.
2018-11-12Use IndexVec instead of `usize` in librustcOliver Scherer-6/+12
2018-11-11rustc: Clean up allocator injection logicAlex Crichton-15/+0
This commit cleans up allocator injection logic found in the compiler around selecting the global allocator. It turns out that now that jemalloc is gone the compiler never actually injects anything! This means that basically everything around loading crates here and there can be easily pruned. This also removes the `exe_allocation_crate` option from custom target specs as it's no longer used by the compiler anywhere.
2018-11-07Rollup merge of #55734 - teresy:shorthand-fields, r=davidtwcokennytm-1/+1
refactor: use shorthand fields refactor: use shorthand for single fields everywhere (excluding tests).
2018-11-06refactor: use shorthand fieldsteresy-1/+1
2018-11-06Rollup merge of #55601 - petrochenkov:featissue, r=pnkfelixkennytm-7/+3
Fix tracking issue numbers for some unstable features And also remove deprecated unstable `#[panic_implementation]` attribute that was superseded by stable `#[panic_handler]` and doesn't have an open tracking issue.
2018-11-04rustc_target: pass contexts by reference, not value.Eduard-Mihai Burtescu-1/+1
2018-11-04Auto merge of #55432 - zackmdavis:single_life, r=nikomatsakisbors-17/+107
single life * structured ~~autofixable~~ (well, pending #53934 and rust-lang-nursery/rustfix#141) suggestions for the single-use-lifetimes lint in the case of function and method reference args * don't consider the anonymous lifetime `'_` as "single-use" (it's intended for exactly this sort of thing) ![single_life](https://user-images.githubusercontent.com/1076988/47613227-3b2b6400-da48-11e8-8efd-cb975ddf537d.png) r? @nikomatsakis
2018-11-03Auto merge of #55101 - alexreg:trait-aliases, r=nikomatsakisbors-4/+15
Implement trait aliases (RFC 1733) Extends groundwork done in https://github.com/rust-lang/rust/pull/45047, and fully implements https://github.com/rust-lang/rfcs/pull/1733. CC @durka @nikomatsakis
2018-11-03Fixed bug with Self type param coming before lifetimes.Alexander Regueiro-4/+15
2018-11-02Remove deprecated unstable `#[panic_implementation]`Vadim Petrochenkov-7/+3
It was superseded by `#[panic_handler]`
2018-11-01Replace CoerceSized trait with DispatchFromDynMichael Hewson-1/+1
Rename `CoerceSized` to `DispatchFromDyn`, and reverse the direction so that, for example, you write ``` impl<T: Unsize<U>, U> DispatchFromDyn<*const U> for *const T {} ``` instead of ``` impl<T: Unsize<U>, U> DispatchFromDyn<*const T> for *const U {} ``` this way the trait is really just a subset of `CoerceUnsized`. The checks in object_safety.rs are updated for the new trait, and some documentation and method names in there are updated for the new trait name — e.g. `receiver_is_coercible` is now called `receiver_is_dispatchable`. Since the trait now works in the opposite direction, some code had to updated here for that too. I did not update the error messages for invalid `CoerceSized` (now `DispatchFromDyn`) implementations, except to find/replace `CoerceSized` with `DispatchFromDyn`. Will ask for suggestions in the PR thread.
2018-11-01Add CoerceSized trait and lang itemMichael Hewson-0/+1
This trait is more-or-less the reverse of CoerceUnsized, and will be used for object-safety checks. Receiver types like `Rc` will have to implement `CoerceSized` so that methods that use `Rc<Self>` as the receiver will be considered object-safe.
2018-10-29Improve a few cases of collecting to an FxHash(Map/Set)ljedrz-4/+3
2018-10-28single-use-lifetime lint: don't false-positive on the anonymous lifetimeZack M. Davis-0/+5
2018-10-28structured suggestions for single-use lifetime lint on fns and methodsZack M. Davis-17/+102
It would be nice to demonstrate the shining correctness here with more run-rustfix tests than this, but unfortunately, that doesn't work with multipart suggestions yet (#53934). While we're here, reword the zero-use lifetime suggestion to "elide the unused lifetime" instead of "remove it". (It's classier.)
2018-10-27Auto merge of #55150 - ↵bors-8/+21
pnkfelix:issues-47215-54797-fix-ice-from-moving-out-of-thread-local-under-ast-borrowck, r=nikomatsakis Do not allow moving out of thread local under ast borrowck AST borrowck failed to prevent moving out of a thread-local static. This was broken. And it also (sometimes?) caused an ICE during drop elaboration. Fix #47215 Fix #54797