summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/context.rs
AgeCommit message (Collapse)AuthorLines
2020-12-10Fix exhaustiveness in case a byte string literal is used at slice typeoli-0/+9
2020-11-05Fix even more URLsGuillaume Gomez-1/+1
2020-11-04Replace `Scalar::zst` with a `Scalar::ZST` constantoli-1/+1
2020-10-24Don't generate multiple impl blocksDániel Buga-4/+4
2020-10-21Auto merge of #78027 - lcnr:lift-by-value, r=varkorbors-8/+8
Lift: take self by value seems small enough to not warrant an MCP :shrug:
2020-10-21Lift: take self by valueBastian Kauschke-8/+8
2020-10-21Auto merge of #78077 - petrochenkov:qvis, r=davidtwcobors-1/+5
Calculate visibilities once in resolve Then use them through a query based on resolver outputs. Item visibilities were previously calculated in three places - initially in `rustc_resolve`, then in `rustc_privacy` during type privacy checkin, and then in `rustc_metadata` during metadata encoding. The visibility logic is not entirely trivial, especially for things like constructors or enum variants, and all of it was duplicated. This PR deduplicates all the visibility calculations, visibilities are determined once during early name resolution and then stored in `ResolverOutputs` and are later available through `tcx` as a query `tcx.visibility(def_id)`. (This query existed previously, but only worked for other crates.) Some special cases (e.g. visibilities for closure types, which are needed for type privacy checking) are not processed in resolve, but deferred and performed directly in the query instead.
2020-10-20Auto merge of #76893 - lcnr:existential-proj, r=estebankbors-1/+1
Improve `skip_binder` usage during FlagComputation It looks like there was previously a bug around `ExistentialPredicate::Projection` here, don't know how to best trigger that one to add a regression test though.
2020-10-19Calculate visibilities once in resolveVadim Petrochenkov-1/+5
Then use them through a query based on resolver outputs
2020-10-15Replace target.target with target and target.ptr_width with target.pointer_widthest31-2/+2
Preparation for a subsequent change that replaces rustc_target::config::Config with its wrapped Target. On its own, this commit breaks the build. I don't like making build-breaking commits, but in this instance I believe that it makes review easier, as the "real" changes of this PR can be seen much more easily. Result of running: find compiler/ -type f -exec sed -i -e 's/target\.target\([)\.,; ]\)/target\1/g' {} \; find compiler/ -type f -exec sed -i -e 's/target\.target$/target/g' {} \; find compiler/ -type f -exec sed -i -e 's/target.ptr_width/target.pointer_width/g' {} \; ./x.py fmt
2020-10-14Remove unused code from rustc_middleest31-4/+0
2020-10-06Rollup merge of #76995 - LingMan:middle_matches, r=varkorYuki Okushi-4/+1
Reduce boilerplate with the matches! macro Replaces simple bool `match`es of the form match $expr { $pattern => true _ => false } and their inverse with invocations of the matches! macro. Limited to rustc_middle for now to get my feet wet.
2020-09-25Address review commentmarmeladema-1/+1
2020-09-21Rollup merge of #76914 - lcnr:path-no-more, r=ecstatic-morseecstatic-morse-1/+1
extend `Ty` and `TyCtxt` lints to self types blocked on #76891 r? @ecstatic-morse cc @Aaron1011
2020-09-21Reduce boilerplate with the matches! macroLingMan-4/+1
Replaces simple bool `match`es of the form match $expr { $pattern => true _ => false } and their inverse with invocations of the matches! macro.
2020-09-20Rollup merge of #76891 - lcnr:less-ref, r=ecstatic-morseRalf Jung-9/+9
don't take `TyCtxt` by reference small cleanup
2020-09-20use `array_windows` instead of `windows` in the compilerBastian Kauschke-1/+1
2020-09-19take `TyCtxt` by valueBastian Kauschke-1/+1
2020-09-19don't take `TyCtxt` by referenceBastian Kauschke-9/+9
2020-09-18guard against `skip_binder` errors during FlagComputationBastian Kauschke-1/+1
2020-09-18don't take `TyCtxt` by referenceBastian Kauschke-9/+9
2020-09-14Use intra-doc links for `DelaySpanBugEmitted`Camelid-2/+2
Also improve the docs for it a bit.
2020-09-09Remove def_id field from ParamEnvBram van den Heuvel-25/+1
2020-09-04ty.flags -> ty.flags()LeSeulArtichaut-3/+3
2020-09-04Change ty.kind to a methodLeSeulArtichaut-8/+8
2020-09-03Auto merge of #73996 - da-x:short-unique-paths, r=petrochenkovbors-1/+1
diagnostics: shorten paths of unique symbols This is a step towards implementing a fix for #50310, and continuation of the discussion in [Pre-RFC: Nicer Types In Diagnostics - compiler - Rust Internals](https://internals.rust-lang.org/t/pre-rfc-nicer-types-in-diagnostics/11139). Impressed upon me from previous discussion in #21934 that an RFC for this is not needed, and I should just come up with code. The recent improvements to `use` suggestions that I've contributed have given rise to this implementation. Contrary to previous suggestions, it's rather simple logic, and I believe it only reduces the amount of cognitive load that a developer would need when reading type errors. ----- If a symbol name can only be imported from one place, and as long as it was not glob-imported anywhere in the current crate, we can trim its printed path to the last component. This has wide implications on error messages with types, for example, shortening `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable from anywhere.
2020-09-02pretty: trim paths of unique symbolsDan Aloni-1/+1
If a symbol name can only be imported from one place for a type, and as long as it was not glob-imported anywhere in the current crate, we can trim its printed path and print only the name. This has wide implications on error messages with types, for example, shortening `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable anywhere. This adds a new '-Z trim-diagnostic-paths=false' option to control this feature. On the good path, with no diagnosis printed, we should try to avoid issuing this query, so we need to prevent trimmed_def_paths query on several cases. This change also relies on a previous commit that differentiates between `Debug` and `Display` on various rustc types, where the latter is trimmed and presented to the user and the former is not.
2020-09-01Avoid rehashing Fingerprint as a map keyJosh Stone-2/+3
This introduces a no-op `Unhasher` for map keys that are already hash- like, for example `Fingerprint` and its wrapper `DefPathHash`. For these we can directly produce the `u64` hash for maps. The first use of this is `def_path_hash_to_def_id: Option<UnhashMap<DefPathHash, DefId>>`.
2020-08-30mv compiler to compiler/mark-0/+2764