summary refs log tree commit diff
path: root/src/librustc
AgeCommit message (Collapse)AuthorLines
2018-11-25resolve: Implement edition hygiene for imports and absolute pathsVadim Petrochenkov-11/+3
Use per-span hygiene in a few other places in resolve Prefer `rust_2015`/`rust_2018` helpers to comparing editions
2018-11-22explain how this worksNiko Matsakis-1/+23
2018-11-22only reset non-restricted visibilitiesNiko Matsakis-6/+27
2018-11-22pass vis by shared referenceNiko Matsakis-6/+6
We are not mutating it now.
2018-11-22preserve the original visibility for the "list stem" nodeNiko Matsakis-4/+0
Without this, the `vis` does not wind up in the tree anywhere, and then we get ICEs because the node-ids it refers to are not present. The motivation seemed to be documentation, but `ListStem` HIR nodes are ignored in rustdoc, from what I can tell.
2018-11-22renumber segment ids for visibilities whenever we clone themNiko Matsakis-7/+17
2018-11-22add some `debug!` into loweringNiko Matsakis-0/+8
2018-11-22track the span for each id so that we can give a nice ICENiko Matsakis-29/+39
2018-11-20Fix Rustdoc ICE when checking blanket implsAaron Hill-1/+47
Fixes #55001, #54744 Previously, SelectionContext would unconditionally cache the selection result for an obligation. This worked fine for most users of SelectionContext, but it caused an issue when used by Rustdoc's blanket impl finder. The issue occured when SelectionContext chose a ParamCandidate which contained inference variables. Since inference variables can change between calls to select(), it's not safe to cache the selection result - the chosen candidate might not be applicable for future results, leading to an ICE when we try to run confirmation. This commit prevents SelectionContext from caching any ParamCandidate that contains inference variables. This should always be completely safe, as trait selection should never depend on a particular result being cached. I've also added some extra debug!() statements, which I found helpful in tracking down this bug.
2018-11-20save-analysis: make sure we save the def for the last segment of a pathNick Cameron-7/+4
2018-11-20Adjust Ids of path segments in visibility modifiersNick Cameron-2/+8
Fixes #55376
2018-11-20squashed form of #54145Nick Cameron-47/+169
Give each PathSegment a NodeId Store a resolved def on hir::PathSegment save-analysis: remove hacky, unnecessary code now that we have spans for every ident dump data for prefix path segments dump refs for path segments in save-analysis Requires adding path segments to the hir map Fix tests and rustdoc save-analysis: handle missing field names FIxes https://github.com/rust-lang-nursery/rls/issues/1031 rebasing and reviewer changes Primarily refactoring `(Ident, Option<NodeId>)` to `Segment` Fix tests and assertions; add some comments more reviewer changes
2018-11-19Rewrite `...` as `..=` as a MachineApplicable 2018 idiom lintvarkor-3/+6
2018-11-19improve debug output related to bound calculationNiko Matsakis-1/+6
2018-11-19remove "approx env bounds" if we already know from traitNiko Matsakis-7/+23
2018-11-19Refactor and add `PlaceContext::AscribeUserTy`.David Wood-99/+191
This commit refactors `PlaceContext` to split it into four different smaller enums based on if the context represents a mutating use, non-mutating use, maybe-mutating use or a non-use (this is based on the recommendation from @oli-obk on Zulip[1]). This commit then introduces a `PlaceContext::AscribeUserTy` variant. `StatementKind::AscribeUserTy` is now correctly mapped to `PlaceContext::AscribeUserTy` instead of `PlaceContext::Validate`. `PlaceContext::AscribeUserTy` can also now be correctly categorized as a non-use which fixes an issue with constant promotion in statics after a cast introduces a `AscribeUserTy` statement. [1]: https://rust-lang.zulipchat.com/#narrow/stream/122657-wg-nll/subject/.2355288.20cast.20fails.20to.20promote.20to.20'static/near/136536949
2018-11-17Fix ICEs from imports of items not defined in modulesVadim Petrochenkov-9/+13
2018-11-17resolve: Check resolution consistency for import paths and multi-segment ↵Vadim Petrochenkov-2/+3
macro paths
2018-11-17resolve: Improve diagnostics for resolution ambiguitiesVadim Petrochenkov-8/+8
2018-11-15resolve: Filter away macro prelude in modules with `#[no_implicit_prelude]` ↵Vadim Petrochenkov-0/+4
on 2018 edition
2018-11-15Simplify logicEsteban Küber-8/+2
2018-11-15Sidestep ICE in `type_of_def_id()` when called from `return_type_impl_trait`Esteban Küber-1/+21
2018-11-10If we encounter `_` ascribed to structural pattern like `(a, b)`, just skip ↵Felix S. Klock II-8/+11
relate_types.
2018-11-10Bubble up an overflow error so that rustdoc can ignore itOliver Scherer-1/+1
2018-10-29fix errors caused by cherry pickingPietro Albini-1/+1
2018-10-29back out bogus `Ok`-wrapping suggestion on `?` arm type mismatchZack M. Davis-11/+1
This suggestion was introduced in #51938 / 6cc78bf8d7 (while introducing different language for type errors coming from `?` rather than a `match`), but it has a lot of false-positives (as repeatedly reported in Issues #52537, #52598, #54578, #55336), and incorrect suggestions carry more badness than marginal good suggestions do goodness. Just get rid of it (unless and until someone figures out how to do it correctly). Resolves #52537, resolves #54578.
2018-10-29resolve: Desugar empty import groups into synthetic dummy importsVadim Petrochenkov-1/+2
so that they are correctly resolved on 2018 edition
2018-10-29add user_ty.projs support to `AscribeUserType`.Felix S. Klock II-4/+7
2018-10-29Further foundational stuff on `ProjectionKind` before I add it to ↵Felix S. Klock II-0/+30
`AscribeUserType`.
2018-10-29Add intern table for `List<ProjectionElem<'tcx, (), ()>>`.Felix S. Klock II-2/+28
Also added alias `ProjectionKind<'tcx>` for `ProjectionElem<'tcx, (), ()>`.
2018-10-29Add the actual chain of projections to `UserTypeProjection`.Felix S. Klock II-9/+120
Update the existing NLL `patterns.rs` test accordingly. includes changes addressing review feedback: * Added example to docs for `UserTypeProjections` illustrating how we build up multiple projections when descending into a pattern with type ascriptions. * Adapted niko's suggested docs for `UserTypeProjection`. * Factored out `projection_ty` from more general `projection_ty_core` (as a drive-by, made its callback an `FnMut`, as I discovered later that I need that). * Add note to docs that `PlaceTy.field_ty(..)` does not normalize its result. * Normalize as we project out `field_ty`.
2018-10-29Checkpoint: Added abstraction over collection of projections into user type.Felix S. Klock II-4/+41
I did not think I would need this in the MIR, but in general local decls are going to need to support this. (That, or we need to be able define a least-upper-bound for a collection of types encountered via the pattern compilation.)
2018-10-29Added `mir::UserTypeProjection`, a stub for a structure that projects *into* ↵Felix S. Klock II-6/+36
a given UserTypeAnnotation. (That is, it will pull out some component type held or referenced by the type annotation.) Note: this still needs to actually do projection itself. That comes in a later commit
2018-10-29Remove `PlaceContext` from API of `mir::Visitor::visit_projection_elem`.Felix S. Klock II-4/+2
It is unused, and would not make sense to maintain in the commits later in this PR.
2018-10-29Shrink `Statement`.Nicholas Nethercote-1/+5
This commit reduces the size of `Statement` from 80 bytes to 56 bytes on 64-bit platforms, by boxing the `AscribeUserType` variant of `StatementKind`. This change reduces instruction counts on most benchmarks by 1--3%.
2018-10-29Remove redundant cloneShotaro Yamada-7/+7
2018-10-25Auto merge of #54490 - wesleywiser:rewrite_it_in_mir, r=oli-obkbors-0/+7
Rewrite the `UnconditionalRecursion` lint to use MIR Part of #51002 r? @eddyb
2018-10-25Auto merge of #55347 - pietroalbini:rollup, r=pietroalbinibors-40/+57
Rollup of 22 pull requests Successful merges: - #53507 (Add doc for impl From for Waker) - #53931 (Gradually expanding libstd's keyword documentation) - #54965 (update tcp stream documentation) - #54977 (Accept `Option<Box<$t:ty>>` in macro argument) - #55138 (in which unused-parens suggestions heed what the user actually wrote) - #55173 (Suggest appropriate syntax on missing lifetime specifier in return type) - #55200 (Documents `From` implementations for `Stdio`) - #55245 (submodules: update clippy from 5afdf8b7 to b1d03437) - #55247 (Clarified code example in char primitive doc) - #55251 (Fix a typo in the documentation of RangeInclusive) - #55253 (only issue "variant of the expected type" suggestion for enums) - #55254 (Correct trailing ellipsis in name_from_pat) - #55269 (fix typos in various places) - #55282 (Remove redundant clone) - #55285 (Do some copy editing on the release notes) - #55291 (Update stdsimd submodule) - #55296 (Set RUST_BACKTRACE=0 for rustdoc-ui/failed-doctest-output.rs) - #55306 (Regression test for #54478.) - #55328 (Fix doc for new copysign functions) - #55340 (Operands no longer appear in places) - #55345 (Remove is_null) - #55348 (Update RELEASES.md after destabilization of non_modrs_mods) Failed merges: r? @ghost
2018-10-25Rollup merge of #55345 - RalfJung:no-null, r=oli-obkPietro Albini-9/+1
Remove is_null It was confusingly named (`is_zero` would have been better, as someone pointed out somewhere but I forgot who or where), and it didn't even reliably test for "is this value 0 at run-time" because out-of-bounds pointers *can* be 0. It's not used in rustc, and miri only really needs `is_null_ptr` and `to_bytes() == 0`, so let's just kill this method. r? @oli-obk
2018-10-25Rollup merge of #55340 - RalfJung:operand-docs, r=oli-obkPietro Albini-3/+2
Operands no longer appear in places Fix an outdated comment.
2018-10-25Rollup merge of #55282 - sinkuu:redundant_clone, r=estebankPietro Albini-4/+4
Remove redundant clone
2018-10-25Rollup merge of #55269 - matthiaskrgr:typos_oct, r=zackmdavisPietro Albini-5/+5
fix typos in various places
2018-10-25Rollup merge of #55173 - estebank:suggest-static, r=oli-obkPietro Albini-19/+45
Suggest appropriate syntax on missing lifetime specifier in return type Suggest using `'static` when a lifetime is missing in the return type with a structured suggestion instead of a note. Fix #55170.
2018-10-25Auto merge of #55323 - nikomatsakis:nll-ICE-55219-and-55241, r=pnkfelixbors-8/+143
introduce type-op for user-type ascription in NLL Handle user-type ascription in a type operator, which gives us a lot more flexibility around the order in which we resolve things. r? @pnkfelix Fixes #55219 Fixes #55241
2018-10-25Remove is_nullRalf Jung-9/+1
It was confusingly named (`is_zero` would have been better), and it didn't even reliably test for "is this value 0 at run-time" because out-of-bounds pointers *can* be 0.
2018-10-25Operands no longer appear in placesRalf Jung-3/+2
2018-10-24port the relate-types code from NLL type-check into a type-opNiko Matsakis-7/+32
Add regression tests for #55219 and #55241 Also another test where a duplicate-like error appears to have been suppressed; I'm not 100% sure why this output changes, though I could imagine that some duplicate suppression is enabled by this PR.
2018-10-24introduce (but do not use) `ascribe_user_type` goalNiko Matsakis-8/+118
Lots of annoying boilerplate.
2018-10-24Minor doc improvementsVadim Petrochenkov-2/+6
2018-10-24Add `extern crate` items to extern preludeVadim Petrochenkov-4/+4