about summary refs log tree commit diff
path: root/src/librustc/middle
AgeCommit message (Collapse)AuthorLines
2018-10-26Auto merge of #54929 - csmoe:cfg_lint, r=petrochenkovbors-3/+3
Suggest to remove prefix `b` in cfg attribute lint string Closes #54926 r? @estebank
2018-10-22[review comments] modify test and clean up codeOliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer-1/+1
Co-Authored-By: estebank <esteban@kuber.com.ar>
2018-10-22review commentsEsteban Küber-57/+42
2018-10-22Suggest appropriate syntax on missing lifetime specifier in return typeEsteban Küber-7/+48
Suggest using `'static` when a lifetime is missing in the return type with a structured suggestion instead of a note.
2018-10-20Auto merge of #55114 - oli-obk:fx#map, r=nikomatsakisbors-31/+27
Deprecate the `FxHashMap()` and `FxHashSet()` constructor function hack
2018-10-20handle errors based on parse_sesscsmoe-3/+3
2018-10-19Auto merge of #55162 - nikomatsakis:issue-54902-underscore-bound, r=tmandrybors-312/+395
handle underscore bounds in unexpected places Per the discussion on #54902, I made it a hard error to use lifetime bounds in various places where they used to be permitted: - `where Foo: Bar<'_>` for example I also moved error reporting to HIR lowering and added `Error` variants to let us suppress downstream errors that result. I (imo) improved the error message wording to be clearer, as well. In the process, I fixed the ICE in #52098. Fixes #54902 Fixes #52098
2018-10-19Remove unused boxOliver Scherer-5/+4
2018-10-19Prefer `Default::default` over `FxHash*::default` in struct constructorsOliver Scherer-18/+15
2018-10-19Deprecate the `FxHashMap()` and `FxHashSet()` constructor function hackOliver Scherer-24/+24
2018-10-18resolve_lifetime.rs: rustfmtNiko Matsakis-295/+369
2018-10-17move E0637 to lowering and improve output, add more testsNiko Matsakis-24/+33
2018-10-17AST-borrowck: add separate mem category for thread-locals, as they are not ↵Felix S. Klock II-8/+21
quite rvalues (and of course they are not quite statics either). Namely, they *do* have a restricted region (like rvalues), but they also cannot be moved out of (like statics).
2018-10-13Auto merge of #54997 - davidtwco:issue-54896, r=nagisabors-140/+164
The #[panic_handler] attribute can be applied to non-functions Fixes #54896. This commit extends the existing lang items functionality to assert that the `#[lang_item]` attribute is only found on the appropriate item for any given lang item. That is, language items representing traits must only ever have their corresponding attribute placed on a trait, for example. r? @nagisa
2018-10-13Auto merge of #54945 - estebank:asm-span, r=petrochenkovbors-9/+14
Point to variable in `asm!` macro when failing borrowck Fix #34940.
2018-10-11Extend lang items to assert correct target.David Wood-140/+164
This commit extends the existing lang items functionality to assert that the `#[lang_item]` attribute is only found on the appropriate item for any given lang item. That is, language items representing traits must only ever have their corresponding attribute placed on a trait, for example.
2018-10-10add a macro for static assertionsRalf Jung-2/+1
2018-10-09Point to variable in `asm!` macro when failing borrowckEsteban Küber-9/+14
2018-10-07in which rightward drift is opposedZack M. Davis-44/+33
Thanks to reviewers Tyler Mandry (for pointing out that this is ridiculous and we need a helper function), Niko Matsakis (for pointing out that the span-calculation code only has a couple free variables), and Esteban Küber (for pointing out `get_generics`).
2018-10-07structured suggestions for unused-lifetimes lintZack M. Davis-4/+53
2018-10-07Auto merge of #54810 - 1aim:unused-impl-trait, r=oli-obkbors-1/+7
Fix dead code lint for functions using impl Trait Fixes https://github.com/rust-lang/rust/issues/54754 This is a minimal fix that doesn't add any new queries or touches unnecessary code. Please nominate for beta backport if wanted.
2018-10-07Auto merge of #54451 - alexcrichton:no-mangle-extern-linkage, r=michaelwoeristerbors-6/+11
rustc: Allow `#[no_mangle]` anywhere in a crate This commit updates the compiler to allow the `#[no_mangle]` (and `#[export_name]` attributes) to be located anywhere within a crate. These attributes are unconditionally processed, causing the compiler to always generate an exported symbol with the appropriate name. After some discussion on #54135 it was found that not a great reason this hasn't been allowed already, and it seems to match the behavior that many expect! Previously the compiler would only export a `#[no_mangle]` symbol if it were *publicly reachable*, meaning that it itself is `pub` and it's otherwise publicly reachable from the root of the crate. This new definition is that `#[no_mangle]` *is always reachable*, no matter where it is in a crate or whether it has `pub` or not. This should make it much easier to declare an exported symbol with a known and unique name, even when it's an internal implementation detail of the crate itself. Note that these symbols will persist beyond LTO as well, always making their way to the linker. Along the way this commit removes the `private_no_mangle_functions` lint (also for statics) as there's no longer any need to lint these situations. Furthermore a good number of tests were updated now that symbol visibility has been changed. Closes #54135
2018-10-06rustc: Allow `#[no_mangle]` anywhere in a crateAlex Crichton-6/+11
This commit updates the compiler to allow the `#[no_mangle]` (and `#[export_name]` attributes) to be located anywhere within a crate. These attributes are unconditionally processed, causing the compiler to always generate an exported symbol with the appropriate name. After some discussion on #54135 it was found that not a great reason this hasn't been allowed already, and it seems to match the behavior that many expect! Previously the compiler would only export a `#[no_mangle]` symbol if it were *publicly reachable*, meaning that it itself is `pub` and it's otherwise publicly reachable from the root of the crate. This new definition is that `#[no_mangle]` *is always reachable*, no matter where it is in a crate or whether it has `pub` or not. This should make it much easier to declare an exported symbol with a known and unique name, even when it's an internal implementation detail of the crate itself. Note that these symbols will persist beyond LTO as well, always making their way to the linker. Along the way this commit removes the `private_no_mangle_functions` lint (also for statics) as there's no longer any need to lint these situations. Furthermore a good number of tests were updated now that symbol visibility has been changed. Closes #54135
2018-10-06rustc/middle: whitespace & formatting fixesljedrz-572/+534
2018-10-06rustc/middle: improve allocationsljedrz-4/+8
2018-10-06rustc/middle: use Cow<'static, str> where applicableljedrz-24/+26
2018-10-06rustc/middle: improve some patternsljedrz-95/+56
2018-10-05Auto merge of #54741 - oli-obk:impl_trait_hierarchy, r=cramertjbors-108/+103
Nest the `impl Trait` existential item inside the return type fixes #54045 r? @cramertj
2018-10-05Auto merge of #54703 - davidtwco:issue-52086, r=nikomatsakisbors-0/+3
error message when trying to move from an Rc or Arc is ungreat Fixes #52086. r? @nikomatsakis
2018-10-04Fix dead code lint for functions using impl TraitJonas Schievink-1/+7
2018-10-03Only promote calls to `#[rustc_promotable]` const fnsOliver Schneider-0/+1
2018-10-02Rollup merge of #54458 - scottmcm:bug-54456, r=nikomatsakisPietro Albini-10/+10
Allow both explicit and elided lifetimes in the same impl header While still prohibiting explicit and in-band in the same header. Fixes #54456 As usual, I don't know the broader context of the code I'm changing, so please let me know whatever I can do better. Pre-existing test that mixing explicit and in-band remains an error: https://github.com/rust-lang/rust/blob/master/src/test/ui/in-band-lifetimes/E0688.rs
2018-10-02Nest the `impl Trait` existential item inside the return typeOliver Schneider-108/+103
2018-10-01Introduce language items for `Arc` and `Rc`.David Wood-0/+3
This commit introduces language items for `Arc` and `Rc` so that types can later be checked to be `Arc` or `Rc` in the NLL borrow checker. The `lang` attribute is currently limited to `stage1` as it requires a compiler built with knowledge of the expected language items.
2018-09-29don't elide lifetimes in paths in librustc/Zack M. Davis-37/+39
This seemed like a good way to kick the tires on the elided-lifetimes-in-paths lint (#52069)—seems to work! This was also pretty tedious—it sure would be nice if `cargo fix` worked on this codebase (#53896)!
2018-09-27Bump to 1.31.0 and bootstrap from 1.30 betaJosh Stone-2/+0
2018-09-22Allow both explicit and elided lifetimes in the same impl headerScott McMurray-10/+10
(While still prohibiting explicit and in-band in the same header.)
2018-09-21Compress `Liveness` data some more.Nicholas Nethercote-58/+149
Profiling shows that the `(reader, writer, used)` triples used by liveness analysis almost always have invalid `reader` and `writer` fields. We can take advantage of this knowledge to use a compressed representation for them, falling back to a secondary table for the uncommon cases. This change reduces instruction counts on numerous benchmarks, the best by 16%. It also reduces max-rss on numerous benchmarks, the best by 38%. The patch also renames these triples from `Users` to `RWU`, because it's confusing having a type whose name is plural and then used within vectors whose names are also plural.
2018-09-20Auto merge of #54211 - nnethercote:keccak-Liveness-memory, r=nikomatsakisbors-39/+35
Split `Liveness::users` into three. This reduces memory usage on some benchmarks because no space is wasted for padding. For a `check-clean` build of `keccak` it reduces `max-rss` by 20%. r? @nikomatsakis, but I want to do a perf run. Locally, I had these results: - instructions: slight regression - max-rss: big win on "Clean" builds - faults: big win on "Clean" and "Nll" builds - wall-time: small win on "Clean" and "Nll" builds So I want to see how a different machine compares.
2018-09-15Make rustc::middle::region::Scope's fields publicMarshall Bowers-62/+33
2018-09-14Auto merge of #54032 - oli-obk:layout_scalar_ranges, r=eddybbors-75/+55
Add forever unstable attribute to allow specifying arbitrary scalar ranges r? @eddyb for the first commit and @nikomatsakis for the second one
2018-09-14Split `Liveness::users` into three.Nicholas Nethercote-39/+35
This reduces memory usage on some benchmarks because no space is wasted for padding. For a `check-clean` build of `keccak` it reduces `max-rss` by 20%.
2018-09-13introduce SelfCtorF001-3/+3
2018-09-11Change debug printing to print in the old concise styleOliver Schneider-3/+21
2018-09-11Use assertion-like static assertionsOliver Schneider-1/+1
2018-09-11Rebase falloutOliver Schneider-1/+1
2018-09-11Simplify Scope/ScopeData to have less chance of introducing UB or size increasesOliver Schneider-70/+36
2018-09-11Use the same way to specifiy the `SCOPE_DATA_*` constants as used for the MAXOliver Schneider-4/+4
2018-09-11Forbid the upper indices of `IndexVec` indices to allow for niche optimizationsOliver Schneider-4/+2
2018-09-11Get rid of the `non_zero` lang item in favour of arbitrary range specificationsOliver Schneider-2/+0