about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2023-10-25Directly intern values instead of copying them.Camille GILLOT-4/+53
2023-10-25Do not intern GVN temps.Camille GILLOT-22/+16
2023-10-25Transform large arrays into Repeat expressions when possible.Camille GILLOT-0/+14
2023-10-25Extract simplify_aggregate.Camille GILLOT-27/+56
2023-10-25Do not compute actual aggregate type.Camille GILLOT-11/+47
2023-10-25Simplify repeat expressions.Camille GILLOT-0/+6
2023-10-25Simplify aggregate projections.Camille GILLOT-1/+40
2023-10-25Simplify projections in GVN.Camille GILLOT-50/+106
2023-10-25Do not transmute immediates to non-immediates.Camille GILLOT-0/+10
2023-10-25Do not intern too large aggregates.Camille GILLOT-18/+24
2023-10-25Evaluate computed values to constants.Camille GILLOT-27/+314
2023-10-25Do not visit rvalues twice.Camille GILLOT-8/+11
2023-10-25Do not remove unused definitions inside GVN.Camille GILLOT-12/+3
2023-10-25Auto merge of #116993 - compiler-errors:clause-kind, r=jackh726bors-217/+735
Uplift `ClauseKind` and `PredicateKind` into `rustc_type_ir` Uplift `ClauseKind` and `PredicateKind` into `rustc_type_ir`. Blocked on #116951 r? `@ghost`
2023-10-25Do not suggest 'Trait<Assoc=arg>' when in trait implGurinder Singh-14/+58
because that would be illegal syntax
2023-10-25Fix unwrap suggestion for async fnMichael Goulet-12/+10
2023-10-25Auto merge of #117139 - compiler-errors:vid-lifetimes, r=BoxyUwUbors-130/+150
Get rid of `'tcx` lifetime on `ConstVid`, `EffectVid` These are simply newtyped numbers, so don't really have a reason (per se) to have a lifetime -- `TyVid` and `RegionVid` do not, for example. The only consequence of this is that we need to use a new key type for `UnifyKey` that mentions `'tcx`. This is already done for `RegionVid`, with `RegionVidKey<'tcx>`, but this `UnifyKey` trait implementation may have been the original reason to give `ConstVid` a lifetime. See the changes to `compiler/rustc_middle/src/infer/unify_key.rs` specifically. I consider the code cleaner this way, though -- we removed quite a few unnecessary `'tcx` in the process. This also makes it easier to uplift these two ids to `rustc_type_ir`, which I plan on doing in a follow-up PR. r? `@BoxyUwU`
2023-10-24Expose a non-Symbol way to access current rustc version stringDavid Tolnay-2/+4
2023-10-24CFG_RELEASE is mandatory, no need for option_envDavid Tolnay-2/+1
The same file already contains another env!("CFG_RELEASE") on line 632, so it's impossible for this crate to compile without CFG_RELEASE set.
2023-10-25Remove support for alias `-Z instrument-coverage`Zalathar-33/+17
This flag was stabilized in rustc 1.60.0 as `-C instrument-coverage`, but the old unstable flag was kept around as an alias to ease migration.
2023-10-24Handle structured stable attribute 'since' version in rustdocDavid Tolnay-0/+7
2023-10-25Auto merge of #116482 - matthewjasper:thir-unsafeck-inline-constants, r=b-naberbors-39/+110
Fix inline const pattern unsafety checking in THIR Fix THIR unsafety checking of inline constants. - Steal THIR in THIR unsafety checking (if enabled) instead of MIR lowering. - Represent inline constants in THIR patterns.
2023-10-24Keep track of #[stable] attribute even if version cannot be parsedDavid Tolnay-7/+15
2023-10-24Store 'since' attribute as parsed VersionDavid Tolnay-53/+50
2023-10-24Use IndexMap for handling stable TyCelina G. Val-29/+23
2023-10-24Remove fold code and add Const::internal()Celina G. Val-370/+132
We are not planning to support user generated constant in the foreseeable future, so we are removing the Fold logic for now in favor of the Instance::resolve logic. The Instance::resolve was however incomplete, since we weren't handling internalizing constants yet. Thus, I added that. I decided to keep the Const fields private in case we decide to translate them lazily.
2023-10-24Auto merge of #115796 - cjgillot:const-prop-rvalue, r=oli-obkbors-18/+172
Generate aggregate constants in DataflowConstProp.
2023-10-24Require target features to match exactly during inliningTomasz Miąsko-4/+2
In general it is not correct to inline a callee with a target features that are subset of the callee. Require target features to match exactly during inlining. The exact match could be potentially relaxed, but this would require identifying specific feature that are allowed to differ, those that need to match, and those that can be present in caller but not in callee. This resolves MIR part of #116573. For other concerns with respect to the previous implementation also see areInlineCompatible in LLVM.
2023-10-24Mark .rmeta files as /SAFESEH on x86 Windows.Daniel Cheng-25/+31
Chrome links .rlibs with /WHOLEARCHIVE or -Wl,--whole-archive to prevent the linker from discarding static initializers. This works well, except on Windows x86, where lld complains: error: /safeseh: lib.rmeta is not compatible with SEH The fix is simply to mark the .rmeta as SAFESEH aware. This is trivially true, since the metadata file does not contain any executable code.
2023-10-24Get rid of 'tcx on ConstVid, EffectVidMichael Goulet-130/+150
2023-10-24Auto merge of #117135 - matthiaskrgr:rollup-zdh18i6, r=matthiaskrgrbors-292/+658
Rollup of 8 pull requests Successful merges: - #116094 (Introduce `-C instrument-coverage=branch` to gate branch coverage) - #116396 (Migrate diagnostics in `rustc_hir_analysis/src/coherence/orphan.rs`) - #116714 (Derive `Ord`, `PartialOrd` and `Hash` for `SocketAddr*`) - #116792 (Avoid unnecessary renumbering during borrowck) - #116841 (Suggest unwrap/expect for let binding type mismatch) - #116943 (Add target features for LoongArch) - #117010 (Add method to convert internal to stable constructs) - #117127 (Remove `#[allow(incomplete_features)]` from RPITIT/AFIT tests) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-24Intern LocalDefId list from opaque queryMichael Goulet-3/+16
2023-10-24Rollup merge of #117010 - celinval:smir-internal, r=oli-obkMatthias Krüger-126/+198
Add method to convert internal to stable constructs This is an alternative implementation to https://github.com/rust-lang/rust/pull/116999. I believe we can still improve the logic a bit here, but I wanted to see which direction we should go first. In this implementation, the API is simpler and we keep Tables somewhat private. The definition is still public though, since we have to expose the Stable trait. However, there's a cost of keeping another thread-local and using `Rc`, but I'm hoping it will be a small cost. r? ``@oli-obk`` r? ``@spastorino``
2023-10-24Rollup merge of #116943 - heiher:target-features, r=wesleywiserMatthias Krüger-0/+18
Add target features for LoongArch
2023-10-24Rollup merge of #116841 - chenyukang:yukang-suggest-unwrap-expect, r=b-naberMatthias Krüger-1/+82
Suggest unwrap/expect for let binding type mismatch Found it when investigating https://github.com/rust-lang/rust/issues/116738 I'm not sure whether it's a good style to suggest `unwrap`, seems it's may helpful for newcomers. #116738 needs another fix to improve it.
2023-10-24Rollup merge of #116792 - JonasAlaif:renumber-fix, r=b-naberMatthias Krüger-0/+4
Avoid unnecessary renumbering during borrowck Currently, after renumbering there are always unused `RegionVid`s if the return type contains any regions, this is due to `visit_ty` being called twice on the same `Ty`: once with `TyContext::ReturnTy` and once with `TyContext::LocalDecl { local: _0 }`. This PR skips renumbering the first time around.
2023-10-24Rollup merge of #116396 - obeis:hir-analysis-migrate-diagnostics-7, r=oli-obkMatthias Krüger-163/+341
Migrate diagnostics in `rustc_hir_analysis/src/coherence/orphan.rs` r? ``@compiler-errors``
2023-10-24Rollup merge of #116094 - Swatinem:coverage-branch-gate, r=wesleywiserMatthias Krüger-2/+15
Introduce `-C instrument-coverage=branch` to gate branch coverage This was extracted from https://github.com/rust-lang/rust/pull/115061 and can land independently from other coverage related work. The flag is unused for now, but is added in advance of adding branch coverage support. It is an unstable, nightly only flag that needs to be used in combination with `-Zunstable-options`, like so: `-Zunstable-options -C instrument-coverage=branch`. The goal is to develop branch coverage as an unstable opt-in feature first, before it matures and can be turned on by default.
2023-10-24Auto merge of #117126 - matthiaskrgr:rollup-8huie8f, r=matthiaskrgrbors-90/+101
Rollup of 5 pull requests Successful merges: - #117081 (fix typos in comments) - #117091 (`OptWithInfcx` naming nits, trait bound simplifications) - #117092 (Add regression test for #117058) - #117093 (Update books) - #117105 (remove change-id assertion in bootstrap test) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-24Merge impl_wf_inference into coherence checkingMichael Goulet-6/+3
2023-10-25suggest unwrap/expect for let binding type mismatchyukang-1/+82
2023-10-24Update documentation.Camille GILLOT-3/+3
2023-10-24Use `PlaceMention` for match scrutinees.Camille GILLOT-26/+36
2023-10-24Rollup merge of #117091 - compiler-errors:debug, r=lcnrMatthias Krüger-89/+100
`OptWithInfcx` naming nits, trait bound simplifications * Use an associated type `Interner` on `InferCtxtLike` to remove a redundant interner parameter (`I: Interner, Infcx: InferCtxtLike<I>` -> `Infcx: InferCtxtLike`). * Remove double-`Option` between `infcx: Option<Infcx>` and `fn universe_of_ty(&self, ty: ty::InferTy) -> Option<ty::UniverseIndex>`. We don't need the infcx to be optional if we can provide a "noop" (`NoInfcx`) implementation that just always returns `None` for universe index. * Also removes the `core::convert::Infallible` implementation which I found a bit weird... * Some naming nits with params. * I found `InferCtxt` + `InfCtx` and `Infcx` to be a lot of different ways to spell "inference context", so I got rid of the `InfCtx` type parameter name in favor of `Infcx` which is a more standard name. * I found `OptWithInfcx` to be a bit redundant -> `WithInfcx`. I'm making these changes because I intend to reuse the `InferCtxtLike` trait for uplifting the canonicalizer into a new trait -- conveniently, the information I need for uplifting the canonicalizer also is just the universe information of a type var, so it's super convenient 😸 r? `@BoxyUwU` or `@lcnr`
2023-10-24Rollup merge of #117081 - GoodDaisy:master, r=wesleywiserMatthias Krüger-1/+1
fix typos in comments
2023-10-24Auto merge of #116773 - dtolnay:validatestable, r=compiler-errorsbors-28/+46
Validate `feature` and `since` values inside `#[stable(…)]` Previously the string passed to `#[unstable(feature = "...")]` would be validated as an identifier, but not `#[stable(feature = "...")]`. In the standard library there were `stable` attributes containing the empty string, and kebab-case string, neither of which should be allowed. Pre-existing validation of `unstable`: ```rust // src/lib.rs #![allow(internal_features)] #![feature(staged_api)] #![unstable(feature = "kebab-case", issue = "none")] #[unstable(feature = "kebab-case", issue = "none")] pub struct Struct; ``` ```console error[E0546]: 'feature' is not an identifier --> src/lib.rs:5:1 | 5 | #![unstable(feature = "kebab-case", issue = "none")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` For an `unstable` attribute, the need for an identifier is obvious because the downstream code needs to write a `#![feature(...)]` attribute containing that identifier. `#![feature(kebab-case)]` is not valid syntax and `#![feature(kebab_case)]` would not work if that is not the name of the feature. Having a valid identifier even in `stable` is less essential but still useful because it allows for informative diagnostic about the stabilization of a feature. Compare: ```rust // src/lib.rs #![allow(internal_features)] #![feature(staged_api)] #![stable(feature = "kebab-case", since = "1.0.0")] #[stable(feature = "kebab-case", since = "1.0.0")] pub struct Struct; ``` ```rust // src/main.rs #![feature(kebab_case)] use repro::Struct; fn main() {} ``` ```console error[E0635]: unknown feature `kebab_case` --> src/main.rs:3:12 | 3 | #![feature(kebab_case)] | ^^^^^^^^^^ ``` vs the situation if we correctly use `feature = "snake_case"` and `#![feature(snake_case)]`, as enforced by this PR: ```console warning: the feature `snake_case` has been stable since 1.0.0 and no longer requires an attribute to enable --> src/main.rs:3:12 | 3 | #![feature(snake_case)] | ^^^^^^^^^^ | = note: `#[warn(stable_features)]` on by default ```
2023-10-24Merge commit '93a5433f17ab5ed48cc88f1e69b0713b16183373' into ↵bjorn3-138/+260
sync_cg_clif-2023-10-24
2023-10-24Migrate diagnostics in `rustc_hir_analysis/src/coherence/orphan.rs`Obei Sideg-163/+341
2023-10-24Auto merge of #116435 - compiler-errors:re-erased, r=lcnrbors-9/+49
Handle `ReErased` in responses in new solver There are legitimate cases in the compiler where we return `ReErased` for lifetimes that are uncaptured in the hidden type of an opaque. For example, in the test committed below, we ignore ignore the bivariant lifetimes of an opaque when it's inferred as the hidden type of another opaque. This may result in a `type_of(Opaque)` call returning a type that references `ReErased`. Let's handle this gracefully in the new solver. Also added a `rustc_hidden_type_of_opaques` attr to print hidden types. This seems useful for opaques. r? lcnr
2023-10-24Introduce `-C instrument-coverage=branch` to gate branch coverageArpad Borsos-2/+15
This flag has to be used in combination with `-Zunstable-options`, and is added in advance of adding branch coverage instrumentation.