summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2021-02-05Rollup merge of #79554 - b-naber:generic-associated-types-in-trait-paths, ↵Mara Bos-1/+9
r=jackh726 Generic associated types in trait paths This is the second part of https://github.com/rust-lang/rust/pull/78978 This should fix: Fixes #67510 Fixes #68648 Fixes #68649 Fixes #68650 Fixes #68652 Fixes #74684 Fixes #76535 Fixes #79422 Fixes #80433 and implement the remaining functionality needed for https://github.com/rust-lang/rust/issues/44265 r? ``@matthewjasper``
2021-02-04use generic arguments of associated item in trait_ref methodb-naber-1/+9
2021-02-04Rollup merge of #81645 - m-ou-se:panic-lint, r=estebank,flip1995Mara Bos-2/+2
Add lint for `panic!(123)` which is not accepted in Rust 2021. This extends the `panic_fmt` lint to warn for all cases where the first argument cannot be interpreted as a format string, as will happen in Rust 2021. It suggests to add `"{}",` to format the message as a string. In the case of `std::panic!()`, it also suggests the recently stabilized `std::panic::panic_any()` function as an alternative. It renames the lint to `non_fmt_panic` to match the lint naming guidelines. ![image](https://user-images.githubusercontent.com/783247/106520928-675ea680-64d5-11eb-81f7-d8fa48b93a0b.png) This is part of #80162. r? ```@estebank```
2021-02-04Rollup merge of #81556 - nikomatsakis:forbidden-lint-groups-lint, r=pnkfelixMara Bos-2/+10
introduce future-compatibility warning for forbidden lint groups We used to ignore `forbid(group)` scenarios completely. This changed in #78864, but that led to a number of regressions (#80988, #81218). This PR introduces a future compatibility warning for the case where a group is forbidden but then an individual lint within that group is allowed. We now issue a FCW when we see the "allow", but permit it to take effect. r? ``@Mark-Simulacrum``
2021-02-03Make panic/assert calls in rustc compatible with Rust 2021.Mara Bos-2/+2
2021-02-03Auto merge of #81346 - hug-dev:nonsecure-call-abi, r=jonas-schievinkbors-0/+1
Add a new ABI to support cmse_nonsecure_call This adds support for the `cmse_nonsecure_call` feature to be able to perform non-secure function call. See the discussion on Zulip [here](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Support.20for.20callsite.20attributes/near/223054928). This is a followup to #75810 which added `cmse_nonsecure_entry`. As for that PR, I assume that the changes are small enough to not have to go through a RFC but I don't mind doing one if needed 😃 I did not yet create a tracking issue, but if most of it is fine, I can create one and update the various files accordingly (they refer to the other tracking issue now). On the Zulip chat, I believe `@jonas-schievink` volunteered to be a reviewer 💯
2021-02-02introduce future-compatibility warning for forbidden lint groupsNiko Matsakis-2/+10
We used to ignore `forbid(group)` scenarios completely. This changed in #78864, but that led to a number of regressions (#80988, #81218). This PR introduces a future compatibility warning for the case where a group is forbidden but then an individual lint within that group is allowed. We now issue a FCW when we see the "allow", but permit it to take effect.
2021-02-02Rollup merge of #81665 - jacob-hughes:mir_doc_fix, r=estebankJack Huey-1/+1
Fix out of date `Scalar` documentation Scalars can represent integers up to `u128`, but the docs state otherwise.
2021-02-02Rollup merge of #80593 - jackh726:chalk-upgrade, r=nikomatsakisJack Huey-4/+36
Upgrade Chalk ~~Blocked on rust-lang/chalk#670~~ ~~Now blocked on rust-lang/chalk#680 and release~~ In addition to the straight upgrade, I also tried to fix some tests by properly returning variables and max universes in the solution. Unfortunately, this actually triggers the same perf problem that rustc traits code runs into in `canonicalizer`. Not sure what the root cause of this problem is, or why it's supposed to be solved in chalk. r? ```@nikomatsakis```
2021-02-02Update ChalkJack Huey-4/+21
2021-02-02Fix out of date `Scalar` documentationJake Hughes-1/+1
Scalars can represent integers up to u128, but the docs state otherwise.
2021-02-02Auto merge of #80843 - Mark-Simulacrum:fmt-bump, r=petrochenkovbors-20/+31
Bump rustfmt version
2021-02-02Bump rustfmt versionMark Rousskov-20/+31
Also switches on formatting of the mir build module
2021-02-02Add a new ABI to support cmse_nonsecure_callHugues de Valon-0/+1
This commit adds a new ABI to be selected via `extern "C-cmse-nonsecure-call"` on function pointers in order for the compiler to apply the corresponding cmse_nonsecure_call callsite attribute. For Armv8-M targets supporting TrustZone-M, this will perform a non-secure function call by saving, clearing and calling a non-secure function pointer using the BLXNS instruction. See the page on the unstable book for details. Signed-off-by: Hugues de Valon <hugues.devalon@arm.com>
2021-02-02Rollup merge of #81609 - Julian-Wollersberger:no-query-categories, r=davidtwcoJonas Schievink-1433/+1340
Remove the remains of query categories Back in October 2020 in #77830 ``@cjgillot`` removed the query categories information from the profiler, but the actual definitions which query was in which category remained, although unused. Here I clean that up, to simplify the query definitions even further. It's unfortunate that this loses all the context for `git blame`, ~~but I'm working on moving those query definitions into `rustc_query_system`, which will lose that context anyway.~~ EDIT: Might not work out. The functional changes are in the first commit. The second one only changes the indentation.
2021-02-01Upgrade ChalkJack Huey-0/+15
2021-02-01Fixed #[inline] to be warned in fields, arms, macro defsDanuel-0/+18
Add visitors for checking #[inline] Add visitors for checking #[inline] with struct field Fix test for #[inline] Add visitors for checking #[inline] with #[macro_export] macro Add visitors for checking #[inline] without #[macro_export] macro Add use alias with Visitor Fix lint error Reduce unnecessary variable Co-authored-by: LingMan <LingMan@users.noreply.github.com> Change error to warning Add warning for checking field, arm with #[allow_internal_unstable] Add name resolver Formatting Formatting Fix error fixture Add checking field, arm, macro def
2021-01-31Indent the code correctly again after removing the query categories.Julian Wollersberger-1399/+1399
2021-01-31Remove the remains of the query categories.Julian Wollersberger-106/+13
2021-01-31Rollup merge of #80404 - JulianKnodt:arr_ref, r=oli-obkJonas Schievink-2/+1
Remove const_in_array_repeat Fixes #80371. Fixes #81315. Fixes #80767. Fixes #75682. I thought there might be some issue with `Repeats(_, 0)`, but if you increase the items in the array it still ICEs. I'm not sure if this is the best fix but it does fix the given issue.
2021-01-31Rollup merge of #80092 - sexxi-goose:restrict_precision, r=nikomatsakisJonas Schievink-1/+18
2229: Fix issues with move closures and mutability This PR fixes two issues when feature `capture_disjoint_fields` is used. 1. Can't mutate using a mutable reference 2. Move closures try to move value out through a reference. To do so, we 1. Compute the mutability of the capture and store it as part of the `CapturedPlace` that is written in TypeckResults 2. Restrict capture precision. Note this is temporary for now, to allow the feature to be used with move closures and ByValue captures and might change depending on discussions with the lang team. - No Derefs are captured for ByValue captures, since that will result in value behind a reference getting moved. - No projections are applied to raw pointers since these require unsafe blocks. We capture them completely. r? `````@nikomatsakis`````
2021-01-30Remove const_in_array_rep_exprkadmin-2/+1
2021-01-30Rollup merge of #80959 - jhpratt:unsigned_abs-stabilization, r=m-ou-seYuki Okushi-11/+2
Stabilize `unsigned_abs` Resolves #74913. This PR stabilizes the `i*::unsigned_abs()` method, which returns the absolute value of an integer _as its unsigned equivalent_. This has the advantage that it does not overflow on `i*::MIN`. I have gone ahead and used this in a couple locations throughout the repository.
2021-01-29Fix typosAman Arora-0/+2
2021-01-29Fix incorrect use mut diagnosticsAman Arora-0/+9
2021-01-29Compute mutability of closure capturesAman Arora-1/+7
When `capture_disjoint_fields` is not enabled, checking if the root variable binding is mutable would suffice. However with the feature enabled, the captured place might be mutable because it dereferences a mutable reference. This PR computes the mutability of each capture after capture analysis in rustc_typeck. We store this in `ty::CapturedPlace` and then use `ty::CapturedPlace::mutability` in mir_build and borrow_check.
2021-01-28Auto merge of #81388 - bjorn3:wasm_bindgen_fix, r=nikomatsakisbors-4/+3
Fix abi for wasm-bindgen Hopefully fixes https://github.com/rust-lang/rust/issues/81386. `@alexcrichton` can you confirm this fixes wasm-bindgen? r? `@alexcrichton`
2021-01-28Rollup merge of #81062 - sexxi-goose:precise_capture_diagnostics, r=nikomatsakisYuki Okushi-2/+19
Improve diagnostics for Precise Capture This is just the capture analysis part and borrow checker logging will updated as part of rust-lang/project-rfc-2229#8 Closes rust-lang/project-rfc-2229#22
2021-01-28Rollup merge of #79951 - LeSeulArtichaut:ty-ir, r=nikomatsakisYuki Okushi-339/+161
Refractor a few more types to `rustc_type_ir` In the continuation of #79169, ~~blocked on that PR~~. This PR: - moves `IntVarValue`, `FloatVarValue`, `InferTy` (and friends) and `Variance` - creates the `IntTy`, `UintTy` and `FloatTy` enums in `rustc_type_ir`, based on their `ast` and `chalk_ir` equilavents, and uses them for types in the rest of the compiler. ~~I will split up that commit to make this easier to review and to have a better commit history.~~ EDIT: done, I split the PR in commits of 200-ish lines each r? `````@nikomatsakis````` cc `````@jackh726`````
2021-01-27Rollup merge of #81325 - osa1:issue81293, r=estebankYuki Okushi-0/+11
typeck: Don't suggest converting LHS exprs Converting LHS of an assignment does not work, so avoid suggesting that. Fixes #81293
2021-01-26Use PassMode::Direct for Abi::Aggregate by defaultbjorn3-4/+3
2021-01-26Revert "Wasm-bindgen abi compat using cast_to"bjorn3-1/+1
This reverts commit 903c553f4a2fc8344edac0da565e6c1a7fad4b39.
2021-01-26Wasm-bindgen abi compat using cast_tobjorn3-1/+1
2021-01-26Revert "Fix abi for wasm-bindgen"bjorn3-8/+0
This reverts commit 4d2766e3524129f0d7ec6ad34c4045150ad4f978.
2021-01-26Revert "Share wasm-bindgen compat abi selection code"bjorn3-1/+1
This reverts commit e7a056fe20f7ec5a475923ff2f4eda8ca9e1a74b.
2021-01-26typeck: Don't suggest converting LHS exprsÖmer Sinan Ağacan-0/+11
Converting LHS of an assignment does not work, so avoid suggesting that. Fixes #81293
2021-01-26Auto merge of #80692 - Aaron1011:feature/query-result-debug, r=estebankbors-21/+29
Enforce that query results implement Debug Currently, we require that query keys implement `Debug`, but we do not do the same for query values. This can make incremental compilation bugs difficult to debug - there isn't a good place to print out the result loaded from disk. This PR adds `Debug` bounds to several query-related functions, allowing us to debug-print the query value when an 'unstable fingerprint' error occurs. This required adding `#[derive(Debug)]` to a fairly large number of types - hopefully, this doesn't have much of an impact on compiler bootstrapping times.
2021-01-25Share wasm-bindgen compat abi selection codebjorn3-1/+1
2021-01-25Auto merge of #68828 - oli-obk:inline_cycle, r=wesleywiserbors-0/+32
Prevent query cycles in the MIR inliner r? `@eddyb` `@wesleywiser` cc `@rust-lang/wg-mir-opt` The general design is that we have a new query that is run on the `validated_mir` instead of on the `optimized_mir`. That query is forced before going into the optimization pipeline, so as to not try to read from a stolen MIR. The query should not be cached cross crate, as you should never call it for items from other crates. By its very design calls into other crates can never cause query cycles. This is a pessimistic approach to inlining, since we strictly have more calls in the `validated_mir` than we have in `optimized_mir`, but that's not a problem imo.
2021-01-25Fix abi for wasm-bindgenbjorn3-0/+8
2021-01-24Auto merge of #80919 - cjgillot:defkey-span, r=oli-obkbors-48/+74
Generate metadata by iterating on DefId instead of traversing the HIR tree 1/N Sample from #80347.
2021-01-24Auto merge of #80594 - bjorn3:abi_refactor3, r=petrochenkovbors-82/+81
Various ABI refactorings This includes changes to the rust abi and various refactorings that will hopefully make it easier to use the abi handling infrastructure of rustc in cg_clif. There are several refactorings that I haven't done. I am opening this draft PR to check that I haven't broken any non x86_64 architectures. r? `@ghost`
2021-01-24Auto merge of #79811 - Aaron1011:expn-data-disambig, r=petrochenkovbors-0/+8
Add disambiugator to ExpnData I still need to write a bunch of comments. Opening to see how bad the perf impact is. cc https://github.com/rust-lang/rust/issues/79560
2021-01-23Add disambiugator to ExpnDataAaron Hill-0/+8
Due to macro expansion, its possible to end up with two distinct `ExpnId`s that have the same `ExpnData` contents. This violates the contract of `HashStable`, since two unequal `ExpnId`s will end up with equal `Fingerprint`s. This commit adds a `disambiguator` field to `ExpnData`, which is used to force two otherwise-equivalent `ExpnData`s to be distinct.
2021-01-23Rollup merge of #81243 - osa1:fix_80742_2, r=RalfJungJonas Schievink-0/+3
mir: Improve size_of handling when arg is unsized As discussed on Zulip with `@RalfJung.`
2021-01-23Rollup merge of #81130 - pierwill:edit-depnode, r=jyn514Jonas Schievink-7/+10
Edit rustc_middle::dep_graph module documentation This is similar to work approved and then closed in https://github.com/rust-lang/rust/pull/80325 due to a bad rebase.
2021-01-23Fix review commentsbjorn3-7/+6
2021-01-23Prevent query cycles during inliningoli-0/+32
2021-01-23Allow to query the HIR crate node.Camille GILLOT-5/+3
2021-01-23Iterate to encode def_kind.Camille GILLOT-12/+29