summary refs log tree commit diff
path: root/src/librustc/middle
AgeCommit message (Collapse)AuthorLines
2018-07-30Auto merge of #52805 - ljedrz:format_str_literal, r=petrochenkovbors-6/+6
Don't format!() string literals Prefer `to_string()` to `format!()` take 2, this time targetting string literals. In some cases (`&format!("...")` -> `"..."`) also removes allocations. Occurences of `format!("")` are changed to `String::new()`.
2018-07-29Replace push loops with collect() and extend() where possibleljedrz-6/+2
2018-07-28Don't format!() string literalsljedrz-6/+6
2018-07-28Auto merge of #52711 - eddyb:unsized-manuallydrop, r=nikomatsakisbors-0/+2
Change ManuallyDrop<T> to a lang item. This PR implements the approach @RalfJung proposes in https://internals.rust-lang.org/t/pre-rfc-unions-drop-types-and-manuallydrop/8025 (lang item `struct` instead of `union`). A followup PR can easily solve #47034 as well, by just adding a few `?Sized` to `libcore/mem.rs`. r? @nikomatsakis
2018-07-26Add flag indicating whether AST `borrowck` query signalled any error.Felix S. Klock II-0/+8
2018-07-25Change ManuallyDrop from an union to a struct and make it a lang item.Eduard-Mihai Burtescu-0/+2
2018-07-23Change single char str patterns to charsljedrz-1/+1
2018-07-22in which the elided-lifetimes-in-paths lint undergoes a revolutionZack M. Davis-16/+4
The existing elided-lifetimes-in-paths lint (introduced in Nov. 2017's accd997b5 / #46254) lacked stuctured suggestions and—much more alarmingly—produced false positives on associated functions (like `Ref::clone`) and on anonymous '_ lifetimes (!!—yes, the very anonymous lifetimes that we meant to suggest "instead"). That this went apparently unnoticed for so long maybe tells you something about how many people actually bother to flip on allow-by-default lints. After many hours of good old-fashioned American elbow grease—and a little help from expert reviewers—it turns out that getting the right answer is a lot easier if we fire the lint while lowering the Higher Intermediate Representation. The lint is promoted to the idioms-2018 group. Also, in the matter of test filenames, "elided" only has one 'l' (see, e.g., https://en.wiktionary.org/wiki/elide). Resolves #52041.
2018-07-21Auto merge of #52438 - ljedrz:rustc_vec_capacity, r=eddybbors-10/+6
Calculate Vec capacities in librustc Calculate the required capacity of a few vectors in rustc based on the number of elements they are populated with.
2018-07-20Refactor a few push loops to iterators in librustcljedrz-10/+6
2018-07-20Auto merge of #52445 - alexcrichton:wasm-import-module, r=eddybbors-1/+2
rustc: Stabilize #[wasm_import_module] as #[link(...)] This commit stabilizes the `#[wasm_import_module]` attribute as `#[link(wasm_import_module = "...")]`. Tracked by #52090 this new directive in the `#[link]` attribute is used to configured the module name that the imports are listed with. The WebAssembly specification indicates two utf-8 names are associated with all imported items, one for the module the item comes from and one for the item itself. The item itself is configurable in Rust via its identifier or `#[link_name = "..."]`, but the module name was previously not configurable and defaulted to `"env"`. This commit ensures that this is also configurable. Closes #52090
2018-07-19Auto merge of #52024 - oli-obk:existential_parse, r=nikomatsakisbors-17/+57
Implement existential types (not for associated types yet) r? @nikomatsakis cc @Centril @varkor @alexreg
2018-07-18rustc: Stabilize #[wasm_import_module] as #[link(...)]Alex Crichton-1/+2
This commit stabilizes the `#[wasm_import_module]` attribute as `#[link(wasm_import_module = "...")]`. Tracked by #52090 this new directive in the `#[link]` attribute is used to configured the module name that the imports are listed with. The WebAssembly specification indicates two utf-8 names are associated with all imported items, one for the module the item comes from and one for the item itself. The item itself is configurable in Rust via its identifier or `#[link_name = "..."]`, but the module name was previously not configurable and defaulted to `"env"`. This commit ensures that this is also configurable. Closes #52090
2018-07-18Implement existential typesOliver Schneider-17/+57
2018-07-16rustc: Use link_section, not wasm_custom_sectionAlex Crichton-5/+0
This commit transitions definitions of custom sections on the wasm target from the unstable `#[wasm_custom_section]` attribute to the already-stable-for-other-targets `#[link_section]` attribute. Mostly the same restrictions apply as before, except that this now applies only to statics. Closes #51088
2018-07-16Fix tidycsmoe-17/+44
2018-07-16ItemKindcsmoe-79/+79
2018-07-16ForeignItemKindcsmoe-3/+3
2018-07-16TyKindcsmoe-14/+14
2018-07-16ExprKindcsmoe-136/+136
2018-07-16VariantKindcsmoe-1/+1
2018-07-16DeclKindcsmoe-4/+4
2018-07-16StmtKindcsmoe-7/+7
2018-07-16BinOpKindcsmoe-2/+2
2018-07-15Auto merge of #52381 - oli-obk:ty_to_def_id, r=eddybbors-5/+1
Remove `ty_to_def_id` fixes https://github.com/rust-lang/rust/issues/52341 The uses were mostly convenience and generally "too powerful" (would also have worked for types that weren't interesting at the use site) r? @eddyb
2018-07-14Remove `ty_to_def_id`Oliver Schneider-5/+1
2018-07-14Remove most of `Hash` impls from AST and HIR structuresVadim Petrochenkov-1/+1
2018-07-13Auto merge of #51987 - nikomatsakis:nll-region-infer-scc, r=pnkfelixbors-1/+1
nll experiment: compute SCCs instead of iterative region solving This is an attempt to speed up region solving by replacing the current iterative dataflow with a SCC computation. The idea is to detect cycles (SCCs) amongst region constraints and then compute just one value per cycle. The graph with all cycles removed is of course a DAG, so we can then solve constraints "bottom up" once the liveness values are known. I kinda ran out of time this morning so the last commit is a bit sloppy but I wanted to get this posted, let travis run on it, and maybe do a perf run, before I clean it up.
2018-07-12rename `control_flow_graph` to `graph`Niko Matsakis-1/+1
2018-07-12rename `graph` to `control_flow_graph::implementation`Niko Matsakis-1/+1
2018-07-11Rollup merge of #52247 - ljedrz:dyn_librustc, r=oli-obkMark Rousskov-1/+1
Deny bare trait objects in in src/librustc Enforce `#![deny(bare_trait_objects)]` in `src/librustc`.
2018-07-11Deny bare trait objects in in src/librustcljedrz-1/+1
2018-07-11Auto merge of #52232 - arielb1:ill-adjusted-tuples, r=pnkfelixbors-1/+1
use the adjusted type for cat_pattern in tuple patterns This looks like a typo introduced in #51686. Fixes #52213. r? @pnkfelix beta + stable nominating because regression + unsoundness.
2018-07-11use the adjusted type for cat_pattern in tuple patternsAriel Ben-Yehuda-1/+1
This looks like a typo introduced in #51686. Fixes #52213.
2018-07-09Implement #[alloc_error_handler]Simon Sapin-1/+17
This to-be-stable attribute is equivalent to `#[lang = "oom"]`. It is required when using the alloc crate without the std crate. It is called by `handle_alloc_error`, which is in turned called by "infallible" allocations APIs such as `Vec::push`.
2018-07-05Auto merge of #51967 - varkor:const-body-break-continue, r=estebankbors-25/+28
Fix various issues with control-flow statements inside anonymous constants Fixes #51761. Fixes #51963 (and the host of other reported issues there). (Might be easiest to review per commit, as they should be standalone.) r? @estebank
2018-07-03Rollup merge of #51979 - oli-obk:lowering_cleanups4, r=nikomatsakisPietro Albini-91/+100
Get rid of `TyImplTraitExistential` cc @eddyb r? @nikomatsakis
2018-07-02Add more safeguards to "missing binding mode" errorsvarkor-25/+28
2018-07-02Get rid of `TyImplTraitExistential`Oliver Schneider-91/+100
2018-07-01add FIXMEs pleading for post-@ edit of commentary on mem_categorizationZack M. Davis-8/+14
(The present author fears not being knowledgeable enough to rewrite the comments unilaterally; merely calling it out is a lazy half-measure, but at least doesn't actively make things worse the way an ill-informed rewrite would.)
2018-07-01use HirId in middle::mem_categorization::cmt_, and consequences of thatZack M. Davis-54/+53
For the HirIdification initiative #50928.
2018-07-02Auto merge of #51866 - zackmdavis:hir_making_each_day_of_the_year, ↵bors-2/+2
r=petrochenkov add modifier keyword spans to hir::Visibility; improve unreachable-pub, private-no-mangle lint suggestions #50455 pointed out that the unreachable-pub suggestion for brace-grouped `use`s was bogus; #50476 partially ameliorated this by marking the suggestion as `Applicability::MaybeIncorrect`, but this is the actual fix. Meanwhile, another application of having spans available in `hir::Visibility` is found in the private-no-mangle lints, where we can now issue a suggestion to use `pub` if the item has a more restricted visibility marker (this seems much less likely to come up in practice than not having any visibility keyword at all, but thoroughness is a virtue). While we're there, we can also add a helpful note if the item does have a `pub` (but triggered the lint presumably because enclosing modules were private). ![hir_vis](https://user-images.githubusercontent.com/1076988/42018064-ca830290-7a65-11e8-9c4c-48bc846f861f.png) r? @nrc cc @Manishearth
2018-07-01Rollup merge of #51921 - japaric:panic-impl-error, r=nagisaPietro Albini-3/+7
improve the error message when `#[panic_implementation]` is missing closes #51341 r? @nagisa cc @phil-opp
2018-07-01Auto merge of #51882 - varkor:check-type_dependent_defs, r=estebankbors-2/+6
Always check type_dependent_defs Directly indexing into `type_dependent_defs` has caused multiple ICEs in the past (https://github.com/rust-lang/rust/issues/46771, https://github.com/rust-lang/rust/issues/49241, etc.) and is almost certainly responsible for #51798 too. This PR ensures we always check `type_dependent_defs` first, which should prevent any more of these (or at least make them easier to track down).
2018-06-30in which hir::Visibility recalls whence it came (i.e., becomes Spanned)Zack M. Davis-2/+2
There are at least a couple (and plausibly even three) diagnostics that could use the spans of visibility modifiers in order to be reliably correct (rather than hacking and munging surrounding spans to try to infer where the visibility keyword must have been). We follow the naming convention established by the other `Spanned` HIR nodes: the "outer" type alias gets the "prime" node-type name, the "inner" enum gets the name suffixed with an underscore, and the variant names are prefixed with the prime name and `pub use` exported from here (from HIR). Thanks to veteran reviewer Vadim Petrochenkov for suggesting this uniform approach. (A previous draft, based on the reasoning that `Visibility::Inherited` should not have a span, tried to hack in a named `span` field on `Visibility::Restricted` and a positional field on `Public` and `Crate`. This was ... not so uniform.)
2018-06-30Fortify dummy span checkingVadim Petrochenkov-3/+3
2018-06-29improve the error message when `#[panic_implementation]` is missingJorge Aparicio-3/+7
closes #51341
2018-06-28Rollup merge of #51636 - oli-obk:const_diagnostics, r=eddybMark Rousskov-178/+0
Refactor error reporting of constants cc @eddyb This PR should not change any behaviour. It solely simplifies the internal handling of the errors
2018-06-28Always check type_dependent_defsvarkor-2/+6
2018-06-28Auto merge of #51687 - japaric:gh51671, r=alexcrichtonbors-0/+10
translate / export weak lang items see #51671 for details fixes #51671 fixes #51342 r? @michaelwoerister or @alexcrichton