about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2023-10-09Rollup merge of #115882 - aliemjay:diag-name-region-1, r=compiler-errorsMatthias Krüger-10/+15
improve the suggestion of `generic_bound_failure` - Fixes #115375 - suggest the bound in the correct scope: trait or impl header vs assoc item. See `tests/ui/suggestions/lifetimes/type-param-bound-scope.rs` - don't suggest a lifetime name that conflicts with the other late-bound regions of the function: ```rust type Inv<'a> = *mut &'a (); fn check_bound<'a, T: 'a>(_: T, _: Inv<'a>) {} fn test<'a, T>(_: &'a str, t: T, lt: Inv<'_>) { // suggests a new name `'a` check_bound(t, lt); //~ ERROR } ```
2023-10-09Extend impl's def_span to include where clausesMichael Goulet-4/+7
2023-10-08rustdoc: remove rust logo from non-Rust cratesMichael Howell-0/+2
2023-10-08Auto merge of #116454 - tmiasko:small-dominators, r=cjgillotbors-0/+17
Generalize small dominators optimization * Use small dominators optimization from 640ede7b0a1840415cb6ec881c2210302bfeba18 more generally. * Merge `DefLocation` and `LocationExtended` since they serve the same purpose.
2023-10-08improve the suggestion of generic_bound_failureAli MJ Al-Nasrawy-10/+15
2023-10-07Auto merge of #116437 - nnethercote:rustc_features, r=Nilstriebbors-3/+3
Clean up `rustc_features` Plenty more to be done, but this is a decent start. r? `@Nilstrieb`
2023-10-07Auto merge of #116330 - RalfJung:dont-key-on-allocid, r=oli-obkbors-33/+0
remove Key impls for types that involve an AllocId I don't understand how but somehow that leads to issues like https://github.com/rust-lang/rust/issues/83085? Anyway removing unused impls doesn't seem like a bad idea. The concerning part is that of course nothing will stop us from having such impls again in the future, alongside re-introducing bugs like #83085. r? `@oli-obk`
2023-10-07Auto merge of #116457 - RalfJung:try_eval_scalar_int, r=cjgillotbors-15/+15
fix fast-path for try_eval_scalar_int Cc https://github.com/rust-lang/rust/pull/116281 `@Nadrieril`
2023-10-06Rollup merge of #116277 - RalfJung:post-mono, r=oli-obkJubilee-44/+3
dont call mir.post_mono_checks in codegen It seems like all tests are still passing when I remove this... let's see what CI says.
2023-10-06Rollup merge of #116297 - RalfJung:hooks, r=oli-obkMatthias Krüger-0/+5
add some docs to hooks/mod.rs r? `@oli-obk`
2023-10-06add some comments explaining how the required_consts stuff fits togetherRalf Jung-0/+2
2023-10-06Rollup merge of #116329 - RalfJung:swap-comments, r=scottmcmGuillaume Gomez-1/+1
update some comments around swap() Based on ``@eddyb's`` comment [here](https://github.com/rust-lang/unsafe-code-guidelines/issues/461#issuecomment-1742156410). And then I noticed the wrong capitalization for Miri and fixed it in some other places as well.
2023-10-06Auto merge of #116269 - Veykril:rustc-abi, r=WaffleLapkinbors-3/+3
Bring back generic parameters for indices in rustc_abi and make it compile on stable This effectively reverses https://github.com/rust-lang/rust/pull/107163, allowing rust-analyzer to depend on this crate again, It also moves some glob imports / expands them in the first commit because they made it more difficult for me to reason about things.
2023-10-05Move DefLocation from rustc_codegen_ssa to rustc_middleTomasz Miąsko-0/+17
2023-10-05fix fast-path for try_eval_scalar_intRalf Jung-15/+15
2023-10-05Auto merge of #116417 - ouz-a:trait_type_detective, r=compiler-errorsbors-23/+2
Remove is global hack In attempt to fix https://github.com/rust-lang/rust/issues/114057 we found several issues with how compiler computes layouts, this change removes `is_global` from `and` to stop impl from being shadowed. In depth conversation can be read here https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/Getting.20different.20types.20from.20almost.20same.20inputs This is a fix candidate opened for performance run. r? `@lcnr`
2023-10-05remove is global hackOğuz Ağcayazı-23/+2
2023-10-05Auto merge of #116427 - cjgillot:no-internal, r=oli-obkbors-35/+3
Remove mir::LocalDecl::internal. It does not serve any purpose, as we don't have typeck-based generator witnesses any more.
2023-10-05Rename `Features::active_features`.Nicholas Nethercote-3/+3
The word "active" is currently used in two different and confusing ways: - `ACTIVE_FEATURES` actually means "available unstable features" - `Features::active_features` actually means "features declared in the crate's code", which can include feature within `ACTIVE_FEATURES` but also others. (This is also distinct from "enabled" features which includes declared features but also some edition-specific features automatically enabled depending on the edition in use.) This commit changes the `Features::active_features` to `Features::declared_features` which actually matches its meaning. Likewise, `Features::active` becomes `Features::declared`.
2023-10-04Auto merge of #116370 - nnethercote:more-arena-stuff, r=cjgillotbors-6/+8
Remove the `TypedArena::alloc_from_iter` specialization. It was added in #78569. It's complicated and doesn't actually help performance. r? `@cjgillot`
2023-10-04Remove mir::LocalDecl::internal.Camille GILLOT-35/+3
2023-10-04Make it clear that args default to being related invariantlyMichael Goulet-10/+10
2023-10-04Remove unnecessary relate implMichael Goulet-13/+0
2023-10-04Relate AliasTy considering varianceMichael Goulet-19/+15
2023-10-03Use consisntent style of `size_of` in query type erasureMaybe Waffle-4/+4
All other impls replace type generics with `()` (or a type implementing the necessery traits) and lifetimes with `'static`, do the same for those impls.
2023-10-03Use `transmute_unchecked` and make the types explicit in query type erasureMaybe Waffle-3/+4
This doesn't really change anything, but makes the code a bit more explicit/readable.
2023-10-03Auto merge of #115301 - Zalathar:regions-vec, r=davidtwcobors-15/+8
coverage: Allow each coverage statement to have multiple code regions The original implementation of coverage instrumentation was built around the assumption that a coverage counter/expression would be associated with *up to one* code region. When it was discovered that *multiple* regions would sometimes need to share a counter, a workaround was found: for the remaining regions, the instrumentor would create a fresh expression that adds zero to the existing counter/expression. That got the job done, but resulted in some awkward code, and produces unnecessarily complicated coverage maps in the final binary. --- This PR removes that tension by changing `StatementKind::Coverage`'s code region field from `Option<CodeRegion>` to `Vec<CodeRegion>`. The changes on the codegen side are fairly straightforward. As long as each `CoverageKind::Counter` only injects one `llvm.instrprof.increment`, the rest of coverage codegen is happy to handle multiple regions mapped to the same counter/expression, with only minor option-to-vec adjustments. On the instrumentor/mir-transform side, we can get rid of the code that creates extra (x + 0) expressions. Instead we gather all of the code regions associated with a single BCB, and inject them all into one coverage statement. --- There are several patches here but they can be divided in to three phases: - Preparatory work - Actually switching over to multiple regions per coverage statement - Cleaning up So viewing the patches individually may be easier.
2023-10-03Rollup merge of #116261 - lcnr:wf-only-clause, r=davidtwcoMatthias Krüger-9/+18
a small wf and clause cleanup - remove `Clause::from_projection_clause`, instead use `ToPredicate` - change `predicate_obligations` to directly take a `Clause` - remove some unnecessary `&` - use clause in `min_specialization` checks where easily applicable
2023-10-03Auto merge of #116376 - matthiaskrgr:rollup-b3d14gq, r=matthiaskrgrbors-6/+6
Rollup of 5 pull requests Successful merges: - #115863 (Add check_unused_messages in tidy) - #116210 (Ensure that `~const` trait bounds on associated functions are in const traits or impls) - #116358 (Rename both of the `Match` relations) - #116371 (Remove unused features from `rustc_llvm`.) - #116374 (Print normalized ty) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-03Auto merge of #115025 - ouz-a:ouz_testing, r=lcnrbors-3/+34
Make subtyping explicit in MIR This adds new mir-opt that pushes new `ProjectionElem` called `ProjectionElem::Subtype(T)` to `Rvalue` of a subtyped assignment so we can unsoundness issues like https://github.com/rust-lang/rust/issues/107205 Addresses https://github.com/rust-lang/rust/issues/112651 r? `@lcnr`
2023-10-03Optimize some `alloc_from_iter` call sites.Nicholas Nethercote-6/+8
There's no need to collect an iterator into a `Vec`, or to call `into_iter` at the call sites.
2023-10-03coverage: Remove `next_id` methods from counter/expression IDsZalathar-10/+0
When these methods were originally written, I wasn't aware that `newtype_index!` already supports addition with ordinary numbers, without needing to unwrap and re-wrap.
2023-10-03coverage: Let each coverage statement hold a vector of code regionsZalathar-5/+8
This makes it possible for a `StatementKind::Coverage` to hold more than one code region, but that capability is not yet used.
2023-10-02Rename both of the Match relationsMichael Goulet-6/+6
2023-10-02have better explanation for `relate_types`ouz-a-5/+12
2023-10-02Add docs, remove code, change subtyper codeouz-a-1/+19
2023-10-02subtyping_projectionsouz-a-1/+7
2023-10-02Implement Deref<LayoutS> for LayoutLukas Wirth-3/+3
2023-10-02`skip_binder` to `instantiate_identity`lcnr-2/+7
2023-10-02remove another unused Key implRalf Jung-9/+0
2023-10-02remove Key impls for types that involve an AllocIdRalf Jung-24/+0
2023-10-02MIRI -> MiriRalf Jung-1/+1
2023-10-01Auto merge of #116281 - Nadrieril:eager-const-eval, r=cjgillotbors-1/+10
Cleanup number handling in match exhaustiveness Doing a little bit of cleanup; handling number constants was somewhat messy. In particular, this: - evals float consts once instead of repetitively - reduces `Constructor` from 88 bytes to 56 (`mir::Const` is big!) The `fast_try_eval_bits` function was mostly constructed from inlining existing code but I don't fully understand it; I don't follow how consts work and are evaluated very well.
2023-10-01Move `eval_bits` optimization upstreamNadrieril-1/+10
2023-09-30add some docs to hooks/mod.rsRalf Jung-0/+5
2023-09-30Auto merge of #116254 - WaffleLapkin:nicen-traversal, r=cjgillotbors-72/+45
Assorted improvements for `rustc_middle::mir::traversal` r? `@cjgillot` I'm not _entirely_ sure about all changes, although I do like all of them. If you'd like I can drop some commits. Best reviewed on a commit-by-commit basis, I think, since they are fairly isolated.
2023-09-30dont call mir.post_mono_checks in codegenRalf Jung-44/+1
2023-09-29Remove deleted docs + better link together MIR traversing docsMaybe Waffle-2/+37
2023-09-29a small wf and clause cleanuplcnr-9/+18
2023-09-28Use `and_then` instead of while let chain to clarify `iter` scopeMaybe Waffle-1/+1