summary refs log tree commit diff
path: root/src/librustc
AgeCommit message (Collapse)AuthorLines
2019-06-28Use Set1<Region> instead of Option<Region>Taiki Endo-5/+6
2019-06-28Make is_self_ty a method on SelfVisitorTaiki Endo-32/+35
2019-06-28Remove query for `.pin_type()`Taiki Endo-34/+32
2019-06-28Allow lifetime elision in `Pin<&(mut) Self>`Taiki Endo-1/+28
2019-06-26Beta backport of: Auto merge of #61754 - nikomatsakis:trait-caching-perf-3, ↵Niko Matsakis-82/+406
r=pnkfelix create a "provisional cache" to restore performance in the case of cycles Introduce a "provisional cache" that caches the results of auto trait resolutions but keeps them from entering the *main* cache until everything is ready. This turned out a bit more complex than I hoped, but I don't see another short term fix -- happy to take suggestions! In the meantime, it's very clear we need to rework the trait solver. This resolves the extreme performance slowdown experienced in #60846 -- I plan to add a perf.rust-lang.org regression test to track this. Caveat: I've not run `x.py test` in full yet. r? @pnkfelix cc @arielb1 Fixes #60846
2019-06-26Delay ICE in early_free_scope so feature gate has chance to stop compilation ↵Felix S. Klock II-6/+9
cleanly.
2019-06-26Delay ICE in fold_region so feature gate has chance to stop compilation cleanly.Felix S. Klock II-4/+5
2019-06-06Fix missing overflowing literal lint in for loopvarkor-15/+16
2019-05-20Rollup merge of #60959 - petrochenkov:sassert, r=estebankMazdak Farrokhzad-16/+15
rustc: Improve type size assertions Now they - Tell what the new size is, when it changes - Do not require passing an identifier ``` ::: src\libsyntax\parse\token.rs:223:1 | 223 | static_assert_size!(Token, 123); | -------------------------------- in this macro invocation | = note: expected type `[(); 123]` found type `[(); 16]` ```
2019-05-20Auto merge of #60815 - nnethercote:use-Symbol-more-2, r=petrochenkovbors-36/+30
Use `Symbol` even more These patches simplify the code a bit (fewer conversions) and also speed things up a bit (fewer `with_interner` calls). r? @petrochenkov
2019-05-20Introduce `LocalInternedString::intern`.Nicholas Nethercote-4/+5
`LocalInternedString::intern(x)` is preferable to `Symbol::intern(x).as_str()`, because the former involves one call to `with_interner` while the latter involves two.
2019-05-20Introduce `InternedString::intern`.Nicholas Nethercote-25/+18
`InternedString::intern(x)` is preferable to `Symbol::intern(x).as_interned_str()`, because the former involves one call to `with_interner` while the latter involves two. The case within InternedString::decode() is particularly hot, and this change reduces the number of `with_interner` calls by up to 13%.
2019-05-20Avoid `as_str()` in `ParamTy::is_self`.Nicholas Nethercote-7/+7
It's a hot function, and a direct `Symbol` comparison is faster. The patch also converts some `&InternedString`s to `InternedString`.
2019-05-20Rollup merge of #60960 - matthewjasper:remove-lowering-gensym, r=petrochenkovMazdak Farrokhzad-22/+15
Stop using gensyms in HIR lowering These names aren't ever handled by resolve, so there's no reason to make them gensyms. Diagnostics wanting to behave differently for these variables should inspect either the `MatchSource`/`LocalSource` or the `Span`. All current diagnostics appear to do this. r? @petrochenkov
2019-05-20Rollup merge of #60908 - GuillaumeGomez:errors, r=oli-obkMazdak Farrokhzad-0/+3
Fix lints handling in rustdoc Part of #60664: now lints are handled just like any other lints you would setup in rustc. Still remains to handle `missing code examples` and `missing_docs` as part of the same group. r? @oli-obk
2019-05-19Stop using gensyms in HIR loweringMatthew Jasper-22/+15
These names aren't ever handled by resolve, so there's no reason to make them gensyms.
2019-05-19Improve type size assertionsVadim Petrochenkov-16/+15
Now they - Tell what the new size is, when it changes - Do not require passing an identifier
2019-05-19Rollup merge of #60934 - fabric-and-ink:defindex_with_newtype_macro, ↵Mazdak Farrokhzad-49/+27
r=petrochenkov Declare DefIndex with the newtype_index macro See #60666
2019-05-19Rollup merge of #60924 - estebank:try-msg, r=petrochenkovMazdak Farrokhzad-3/+6
Explain that ? converts the error type using From Fix #60917.
2019-05-18Declare DefIndex with the newtype_index macroFabian Drinck-49/+27
2019-05-18Fix lints handling in rustdocGuillaume Gomez-0/+3
2019-05-18Auto merge of #60910 - nnethercote:avoid-some-unnecessary-interning, ↵bors-14/+15
r=petrochenkov Avoid some unnecessary interning r? @petrochenkov
2019-05-17Auto merge of #49799 - hdhoang:46205_deny_incoherent_fundamental_impls, ↵bors-26/+24
r=nikomatsakis lint: convert incoherent_fundamental_impls into hard error *Summary for affected authors:* If your crate depends on one of the following crates, please upgrade to a newer version: - gtk-rs: upgrade to at least 0.4 - rusqlite: upgrade to at least 0.14 - nalgebra: upgrade to at least 0.15, or the last patch version of 0.14 - spade: upgrade or refresh the Cargo.lock file to use version 1.7 - imageproc: upgrade to at least 0.16 (newer versions no longer use nalgebra) implement #46205 r? @nikomatsakis
2019-05-17Explain that ? converts the error type using FromEsteban Küber-3/+6
2019-05-17Avoid unnecessary interning in `DefPathData::as_interned_str()`.Nicholas Nethercote-9/+9
2019-05-17Avoid unnecessary interning in `Ident::from_str()` calls.Nicholas Nethercote-1/+1
A lot of these static symbols are pre-interned.
2019-05-17Change `rustc::util::common::FN_OUTPUT_NAME` to a `Symbol`.Nicholas Nethercote-4/+5
2019-05-16Point at enclosing fn/closure when it's not asyncEsteban Küber-9/+7
2019-05-16Parse alternative incorrect uses of await and recoverEsteban Küber-2/+17
2019-05-16Auto merge of #60877 - Centril:rollup-j0o5mo5, r=Centrilbors-2/+1
Rollup of 6 pull requests Successful merges: - #59825 (string: implement From<&String> for String) - #59923 (Fix convert module's documentation links) - #60691 (Include expression to wait for to the span of Await) - #60769 (Update rustc book CLI docs.) - #60816 (README.md: Mention MSVC 2017+, not 2013(!)) - #60851 (Move `box` from the stable keyword to unstable keywords list) Failed merges: r? @ghost
2019-05-16Rollup merge of #60769 - ehuss:rustc-cli-docs, r=steveklabnikMazdak Farrokhzad-2/+1
Update rustc book CLI docs. This adds a little detail (and missing flags) to the rustc book. There is still a lot of information missing, but this seemed like a good step to expanding it.
2019-05-16Auto merge of #60811 - wesleywiser:bump_measureme, r=varkorbors-1/+1
Bump measureme dependency to 0.3 measureme@0.3 adds a version header to the binary file format which will help reduce tool breakage in the future.
2019-05-16Auto merge of #60693 - saleemjaffer:refactor_fntype_stuff, r=eddybbors-0/+383
refactor some `FnType` stuff to `rustc::ty::layout` Does work in the direction of #56166.
2019-05-14Rollup merge of #60444 - nikomatsakis:issue-60010-cycle-error-investigation, ↵Mazdak Farrokhzad-2/+53
r=pnkfelix forego caching for all participants in cycles, apart from root node This is a targeted fix for #60010, which uncovered a pretty bad failure of our caching strategy in the face of coinductive cycles. The problem is explained in the comment in the PR on the new field, `in_cycle`, but I'll reproduce it here: > Starts out as false -- if, during evaluation, we encounter a > cycle, then we will set this flag to true for all participants > in the cycle (apart from the "head" node). These participants > will then forego caching their results. This is not the most > efficient solution, but it addresses #60010. The problem we > are trying to prevent: > > - If you have `A: AutoTrait` requires `B: AutoTrait` and `C: NonAutoTrait` > - `B: AutoTrait` requires `A: AutoTrait` (coinductive cycle, ok) > - `C: NonAutoTrait` requires `A: AutoTrait` (non-coinductive cycle, not ok) > > you don't want to cache that `B: AutoTrait` or `A: AutoTrait` > is `EvaluatedToOk`; this is because they were only considered > ok on the premise that if `A: AutoTrait` held, but we indeed > encountered a problem (later on) with `A: AutoTrait. So we > currently set a flag on the stack node for `B: AutoTrait` (as > well as the second instance of `A: AutoTrait`) to supress > caching. > > This is a simple, targeted fix. The correct fix requires > deeper changes, but would permit more caching: we could > basically defer caching until we have fully evaluated the > tree, and then cache the entire tree at once. I'm not sure what the impact of this fix will be in terms of existing crates or performance: we were accepting incorrect code before, so there will perhaps be some regressions, and we are now caching less. As the comment above notes, we could do a lot better than this fix, but that would involve more invasive rewrites. I thought it best to start with something simple. r? @pnkfelix -- but let's do crater/perf run cc @arielb1
2019-05-14some more refactor of FnType. Things build nowSaleem Jaffer-76/+110
2019-05-13Bump measureme dependency to 0.3Wesley Wiser-1/+1
measureme@0.3 adds a version header to the binary file format which will help reduce tool breakage in the future.
2019-05-13modify commentFelix S Klock II-2/+7
modify the comment on `in_cycle` to reflect changes requested by ariel and myself.
2019-05-13Auto merge of #60765 - matthewjasper:fix-more-escaping-rescopes, r=oli-obkbors-10/+46
Fix more escaping ReScopes Closes #58840
2019-05-13Auto merge of #60630 - nnethercote:use-Symbol-more, r=petrochenkovbors-140/+165
Use `Symbol` more A `Symbol` can be equated with a string (e.g. `&str`). This involves a TLS lookup to get the chars (and a Mutex lock in a parallel compiler) and then a char-by-char comparison. This functionality is convenient but avoids one of the main benefits of `Symbol`s, which is fast equality comparisons. This PR removes the `Symbol`/string equality operations, forcing a lot of existing string occurrences to become `Symbol`s. Fortunately, these are almost all static strings (many are attribute names) and we can add static `Symbol`s as necessary, and very little extra interning occurs. The benefits are (a) a slight speedup (possibly greater in a parallel compiler), and (b) the code is a lot more principled about `Symbol` use. The main downside is verbosity, particularly with more `use syntax::symbol::symbols` items. r? @Zoxc
2019-05-13Return a `Symbol` from `name_or_empty` functions.Nicholas Nethercote-16/+27
2019-05-13Remove the equality operation between `Symbol` and strings.Nicholas Nethercote-47/+50
And also the equality between `Path` and strings, because `Path` is made up of `Symbol`s.
2019-05-13Pass a `Symbol` to `check_name`, `emit_feature_err`, and related functions.Nicholas Nethercote-75/+86
2019-05-13Rename `syntax::symbol::symbols` as `syntax::symbol::sym`.Nicholas Nethercote-2/+2
Because it's going to be used a lot.
2019-05-12Update rustc book CLI docs.Eric Huss-2/+1
2019-05-12Auto merge of #60767 - Centril:rollup-4cbsb73, r=Centrilbors-3/+2
Rollup of 4 pull requests Successful merges: - #60694 (Fix HIR printing of existential type #60662) - #60750 (syntax: Remove some legacy nonterminal tokens) - #60751 (Assorted cleanup in parser & AST validation) - #60752 (Fix minor typos for ItemLocalId) Failed merges: r? @ghost
2019-05-12Rollup merge of #60752 - shiatsumat:minor-typos-hir, r=wesleywiserMazdak Farrokhzad-2/+2
Fix minor typos for ItemLocalId * added comma after 'that is' * "can be implement" -> "can be implemented"
2019-05-12Rollup merge of #60694 - Pulkit07:issue60662, r=alexregMazdak Farrokhzad-1/+0
Fix HIR printing of existential type #60662 This fixes https://github.com/rust-lang/rust/issues/60662
2019-05-12Don't allow any ReScope in impl trait typesMatthew Jasper-4/+1
This shouldn't be possible any more, but if it does happen, emit an error rather than maybe panicking later when NLL finds a the ReScope. Impl trait in bindings is sufficiently broken that I don't think this breaks anything that works for it.
2019-05-12Auto merge of #60679 - petrochenkov:lit2, r=matkladbors-55/+43
Keep original literal tokens in AST The original literal tokens (`token::Lit`) are kept in AST until lowering to HIR. The tokens are kept together with their lowered "semantic" representation (`ast::LitKind`), so the size of `ast::Lit` is increased (this also increases the size of meta-item structs used for processing built-in attributes). However, the size of `ast::Expr` stays the same. The intent is to remove the "semantic" representation from AST eventually and keep literals as tokens until lowering to HIR (at least), and I'm going to work on that, but it would be good to land this sooner to unblock progress on the [lexer refactoring](https://github.com/rust-lang/rust/pull/59706). Fixes a part of https://github.com/rust-lang/rust/issues/43081 (literal tokens that are passed to proc macros are always precise, including hexadecimal numbers, strings with their original escaping, etc) Fixes a part of https://github.com/rust-lang/rust/issues/60495 (everything except for proc macro API doesn't need escaping anymore) This also allows to eliminate a certain hack from the lexer (https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/pretty-printing.20comments/near/165005357). cc @matklad
2019-05-12Treat generators the same as closure for escaping lifetimesMatthew Jasper-0/+17