about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2024-10-22Auto merge of #129935 - RalfJung:unsupported_calling_conventions, ↵bors-83/+24
r=compiler-errors make unsupported_calling_conventions a hard error This has been a future-compat lint (not shown in dependencies) since Rust 1.55, released 3 years ago. Hopefully that was enough time so this can be made a hard error now. Given that long timeframe, I think it's justified to skip the "show in dependencies" stage. There were [not many crates hitting this](https://github.com/rust-lang/rust/pull/86231#issuecomment-866300943) even when the lint was originally added. This should get cratered, and I assume then it needs a t-compiler FCP. (t-compiler because this looks entirely like an implementation oversight -- for the vast majority of ABIs, we already have a hard error, but some were initially missed, and we are finally fixing that.) Fixes https://github.com/rust-lang/rust/pull/87678
2024-10-21Auto merge of #131840 - compiler-errors:impossible-maybe, r=lcnrbors-12/+14
Dont consider predicates that may hold as impossible in `is_impossible_associated_item` Use infer vars to account for ambiguities when considering if methods are impossible to instantiate for a given self type. Also while we're at it, let's use the new trait solver instead of `evaluate` since this is used in rustdoc. r? lcnr Fixes #131839
2024-10-21Rollup merge of #132001 - lcnr:stabilize-coherence-again, r=compiler-errorsMatthias Krüger-7/+19
fix coherence error for very large tuples™ see https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/diesel.20error for an in-depth explanation of this issue. We once again specialize `NormalizesTo` goals to avoid the impact of erasing their expected term. fixes #131969 r? `@compiler-errors`
2024-10-21Rollup merge of #131997 - Veykril:veykril/push-upvqkyxmvkzw, r=jieyouxuMatthias Krüger-15/+23
Make `rustc_abi` compile on stable again https://github.com/rust-lang/rust/pull/131473 accidentally broke this
2024-10-21Rollup merge of #130350 - RalfJung:strict-provenance, r=dtolnayMatthias Krüger-12/+9
stabilize Strict Provenance and Exposed Provenance APIs Given that [RFC 3559](https://rust-lang.github.io/rfcs/3559-rust-has-provenance.html) has been accepted, t-lang has approved the concept of provenance to exist in the language. So I think it's time that we stabilize the strict provenance and exposed provenance APIs, and discuss provenance explicitly in the docs: ```rust // core::ptr pub const fn without_provenance<T>(addr: usize) -> *const T; pub const fn dangling<T>() -> *const T; pub const fn without_provenance_mut<T>(addr: usize) -> *mut T; pub const fn dangling_mut<T>() -> *mut T; pub fn with_exposed_provenance<T>(addr: usize) -> *const T; pub fn with_exposed_provenance_mut<T>(addr: usize) -> *mut T; impl<T: ?Sized> *const T { pub fn addr(self) -> usize; pub fn expose_provenance(self) -> usize; pub fn with_addr(self, addr: usize) -> Self; pub fn map_addr(self, f: impl FnOnce(usize) -> usize) -> Self; } impl<T: ?Sized> *mut T { pub fn addr(self) -> usize; pub fn expose_provenance(self) -> usize; pub fn with_addr(self, addr: usize) -> Self; pub fn map_addr(self, f: impl FnOnce(usize) -> usize) -> Self; } impl<T: ?Sized> NonNull<T> { pub fn addr(self) -> NonZero<usize>; pub fn with_addr(self, addr: NonZero<usize>) -> Self; pub fn map_addr(self, f: impl FnOnce(NonZero<usize>) -> NonZero<usize>) -> Self; } ``` I also did a pass over the docs to adjust them, because this is no longer an "experiment". The `ptr` docs now discuss the concept of provenance in general, and then they go into the two families of APIs for dealing with provenance: Strict Provenance and Exposed Provenance. I removed the discussion of how pointers also have an associated "address space" -- that is not actually tracked in the pointer value, it is tracked in the type, so IMO it just distracts from the core point of provenance. I also adjusted the docs for `with_exposed_provenance` to make it clear that we cannot guarantee much about this function, it's all best-effort. There are two unstable lints associated with the strict_provenance feature gate; I moved them to a new [strict_provenance_lints](https://github.com/rust-lang/rust/issues/130351) feature since I didn't want this PR to have an even bigger FCP. ;) `@rust-lang/opsem` Would be great to get some feedback on the docs here. :) Nominating for `@rust-lang/libs-api.` Part of https://github.com/rust-lang/rust/issues/95228. [FCP comment](https://github.com/rust-lang/rust/pull/130350#issuecomment-2395114536)
2024-10-21don't bail when encountering many placeholderslcnr-1/+2
2024-10-21normalizes-to disable infer var checklcnr-7/+18
2024-10-21move strict provenance lints to new feature gate, remove old feature gatesRalf Jung-11/+4
2024-10-21stabilize Strict Provenance and Exposed ProvenanceRalf Jung-1/+5
This comes with a big docs rewrite.
2024-10-21Make rustc_abi compile on stable againLukas Wirth-15/+23
2024-10-21Auto merge of #130628 - workingjubilee:clean-up-result-ffi-guarantees, ↵bors-8/+3
r=RalfJung Finish stabilization of `result_ffi_guarantees` The internal linting has been changed, so all that is left is making sure we stabilize what we want to stabilize.
2024-10-21Auto merge of #131988 - matthiaskrgr:rollup-tx173wn, r=matthiaskrgrbors-514/+104
Rollup of 4 pull requests Successful merges: - #126588 (Added more scenarios where comma to be removed in the function arg) - #131728 (bootstrap: extract builder cargo to its own module) - #131968 (Rip out old effects var handling code from traits) - #131981 (Remove the `BoundConstness::NotConst` variant) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-21Rollup merge of #131981 - compiler-errors:bound-constness, r=cjgillotMatthias Krüger-41/+46
Remove the `BoundConstness::NotConst` variant I find it easier to represent `BoundConstness::NotConst` as just `None` for some refactorings I'm doing.
2024-10-21Rollup merge of #131968 - compiler-errors:old-effect-handling, r=fee1-deadMatthias Krüger-468/+33
Rip out old effects var handling code from traits Traits no longer have an effect parameter, so this removes logic associated with it. It also removes logic surrounding confirming `~const Destruct` bounds, which I added a looooong time ago, and which I don't feel like we need anymore -- if it needs to be added back, it should be rewritten :D cc `@fee1-dead`
2024-10-21Rollup merge of #126588 - linyihai:trim-extra-comma, r=petrochenkovMatthias Krüger-5/+25
Added more scenarios where comma to be removed in the function arg This is an attempt to address the problem methion in https://github.com/rust-lang/rust/issues/106304#issuecomment-1837273666. Copy the annotation to explain the fix If the next Error::Extra ("next") doesn't next to current ("current") ``` fn foo(_: (), _: u32) {} - foo("current", (), 1u32, "next") + foo((), 1u32) ``` If the previous error is not a `Error::Extra`, then do not trim the next comma ``` - foo((), "current", 42u32, "next") + foo((), 42u32) ``` Frankly, this is a fix from a test case and may not cover all scenarios
2024-10-21Auto merge of #130950 - compiler-errors:yeet-eval, r=BoxyUwUbors-303/+324
Continue to get rid of `ty::Const::{try_}eval*` This PR mostly does: * Removes all of the `try_eval_*` and `eval_*` helpers from `ty::Const`, and replace their usages with `try_to_*`. * Remove `ty::Const::eval`. * Rename `ty::Const::normalize` to `ty::Const::normalize_internal`. This function is still used in the normalization code itself. * Fix some weirdness around the `TransmuteFrom` goal. I'm happy to split it out further; for example, I could probably land the first part which removes the helpers, or the changes to codegen which are more obvious than the changes to tools. r? BoxyUwU Part of https://github.com/rust-lang/rust/issues/130704
2024-10-20Auto merge of #131980 - matthiaskrgr:rollup-iy5nw71, r=matthiaskrgrbors-65/+45
Rollup of 5 pull requests Successful merges: - #131814 (`optimize` attribute applied to things other than methods/functions/c…) - #131927 (Check for filecheck directives in files marked `skip-filecheck`) - #131967 (Remove `lower_mono_bounds`) - #131973 (fix(rustdoc-json-types): document rustc-hash feature) - #131976 (feat(rustdoc-json-types): mark simple enums as copy) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-20Rollup merge of #131967 - compiler-errors:lower-mono, r=fmeaseMatthias Krüger-42/+20
Remove `lower_mono_bounds` I'm not convinced about the usefulness of `lower_mono_bounds`, especially since we have *so* many lower-bound-like fns in HIR lowering, so I've just inlined it into its callers.
2024-10-20Rollup merge of #131814 - Borgerr:misapplied-optimize-attribute, r=jieyouxuMatthias Krüger-23/+25
`optimize` attribute applied to things other than methods/functions/c… …losures gives an error (#128488) Duplicate of #128943, which I had accidentally closed when rebasing. cc. `@jieyouxu` `@compiler-errors` `@nikomatsakis` `@traviscross` `@pnkfelix.`
2024-10-20Auto merge of #131949 - Noratrieb:fxhashup-thanks-alona, r=WaffleLapkinbors-17/+32
Update rustc-hash to version 2 but again it's like #129533 but not closed by bors and rebased r? WaffleLapkin meow
2024-10-20Remove the BoundConstness::NotConst variantMichael Goulet-41/+46
2024-10-20Rollup merge of #131965 - ChrisDenton:outdated-comment, r=jieyouxuMatthias Krüger-3/+0
remove outdated comment https://github.com/rust-lang/rust/issues/44234 was closed, apparently solved by https://github.com/rust-lang/rust/pull/45353
2024-10-20Rollup merge of #131962 - Zalathar:llvm-set-section, r=Swatinem,workingjubileeMatthias Krüger-13/+14
Make `llvm::set_section` take a `&CStr` There's no reason to convert the section name to an intermediate `String`, when the LLVM-C API wants a C string anyway. Follow-up to #131876.
2024-10-20Rollup merge of #131843 - workingjubilee:thaw-impossible-reprs, r=lukas-codeMatthias Krüger-4/+18
compiler: Error on layout of enums with invalid reprs Surprising no one, the ICEs with the same message have the same root cause. Invalid reprs can reach layout computation for various reasons. For instance, the compiler may want to use its layout computations to discern if a combination of layout-affecting attributes results in a valid type to begin with by e.g. computing its size. When the input is bad, return an error reflecting that the answer to the question is not a useful one.
2024-10-20Rollup merge of #121560 - Noratrieb:stop-lint-macro-nonsense, r=jieyouxuMatthias Krüger-2/+5
Allow `#[deny]` inside `#[forbid]` as a no-op Forbid cannot be overriden. When someome tries to do this anyways, it results in a hard error. That makes sense. Except it doesn't, because macros. Macros may reasonably use `#[deny]` (or `#[warn]` for an allow-by-default lint) in their expansion to assert that their expanded code follows the lint. This is doesn't work when the output gets expanded into a `forbid()` context. This is pretty silly, since both the macros and the code agree on the lint! By making it a warning instead, we remove the problem with the macro, which is now nothing as warnings are suppressed in macro expanded code, while still telling users that something is up. fixes #121483
2024-10-20misapplied optimize attribute throws a compilation error (#128488)ash-23/+25
2024-10-20Inline lower_mono_bounds into lower_poly_boundsMichael Goulet-39/+17
2024-10-20Rip out old effects var handling code from traitsMichael Goulet-468/+33
2024-10-20Make LowerPolyBounds take an IntoIteratorMichael Goulet-5/+5
2024-10-20make unsupported_calling_conventions a hard errorRalf Jung-83/+24
2024-10-20Added more scenarios where commas need to be removedLin Yihai-5/+25
2024-10-20compiler: Reject impossible reprs during enum layoutJubilee Young-0/+14
2024-10-20compiler: pre-move code for fixing enum layout ICEsJubilee Young-4/+4
2024-10-20Remove outdated commentChris Denton-3/+0
#44234 is resolved
2024-10-20Stop relying on hashmap iteration for unused macro rules armsNoratrieb-14/+27
2024-10-20Stop relying on hashmap iteration for hir stat printingNoratrieb-1/+3
Just because the code says it's OK does not mean that it actually is OK. Nodes with the same total size were not sorted, their order relied on hashmap iteration.
2024-10-20Update rustc-hash to version 2Noratrieb-2/+2
This brings in the new algorithm.
2024-10-20Make `llvm::set_section` take a `&CStr`Zalathar-13/+14
2024-10-20Auto merge of #131958 - Zalathar:rollup-gkuk3n1, r=Zalatharbors-28/+66
Rollup of 4 pull requests Successful merges: - #131876 (compiler: Use LLVM's Comdat support) - #131941 (compiletest: disambiguate html-tidy from rust tidy tool) - #131942 (compiler: Adopt rust-analyzer impls for `LayoutCalculatorError`) - #131945 (rustdoc: Clean up footnote handling) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-20Rollup merge of #131942 - workingjubilee:reduce-haruspicy, r=lukas-code,lnicolaStuart Cook-1/+26
compiler: Adopt rust-analyzer impls for `LayoutCalculatorError` We're about to massively churn the internals of `rustc_abi`. To minimize the immediate and future impact on rust-analyzer, as a subtree that depends on this crate, grow some API on `LayoutCalculatorError` that reflects their uses of it. This way we can nest the type in theirs, and they can just call functions on it without having to inspect and flatten-out its innards.
2024-10-20Rollup merge of #131876 - workingjubilee:llvm-c-c-c-comdat, r=ZalatharStuart Cook-27/+40
compiler: Use LLVM's Comdat support Acting on these long-ago issues: - https://github.com/rust-lang/rust/issues/46437 - https://github.com/rust-lang/rust/issues/68955
2024-10-20Auto merge of #131911 - lcnr:probe-no-more-leak-2, r=compiler-errorsbors-124/+175
refactor fudge_inference, handle effect vars this makes it easier to use fudging outside of `fudge_inference_if_ok`, which is likely necessary to handle inference variable leaks on rollback. We now also uses exhaustive matches where possible and improve the code to handle effect vars. r? `@compiler-errors` `@BoxyUwU`
2024-10-19compiler: Remove outdated commentJubilee Young-1/+0
2024-10-19`result_ffi_guarantees` stabilizes in `$CURRENT_RUSTC_VERSION`Jubilee-1/+1
Co-authored-by: Josh Stone <cuviper@gmail.com>
2024-10-19compiler: Fully stabilize `result_ffi_guarantees`Jubilee Young-7/+3
2024-10-19Rollup merge of #131939 - compiler-errors:predicate-filter, r=fmeaseMatthias Krüger-95/+61
Get rid of `OnlySelfBounds` We turn `PredicateFilter` into a newtyped bool called `OnlySelfBounds`. There's no reason to lose the information of the `PredicateFilter`, so let's just pass it all the way through.
2024-10-19Rollup merge of #131932 - usamoi:tracked-path, r=NadrierilMatthias Krüger-2/+3
use tracked_path in rustc_fluent_macro According to comments in https://github.com/rust-lang/rust/issues/99515#issuecomment-2135003881, the trick used in `rustc_fluent_macro` may be broken by caching decl macros. So use `proc_macro::tracked_path::path` to ensure it works.
2024-10-19Rollup merge of #131931 - compiler-errors:constness-valid, r=fmeaseMatthias Krüger-45/+16
Remove unnecessary constness from `lower_generic_args_of_path` We pass `NotConst` to all callsites of `lower_generic_args_of_path` except for `lower_poly_trait_ref`, so let's not do that.
2024-10-19Rollup merge of #131795 - compiler-errors:expectation, r=NadrierilMatthias Krüger-21/+4
Stop inverting expectation in normalization errors We have some funky special case logic to invert the expectation and actual type for normalization errors depending on their cause code. IMO most of the error messages get better, except for `try {}` blocks' type expectations. I think that these need to be special cased in some other way, rather than via this hack. Fixes #131763
2024-10-19Rollup merge of #131789 - compiler-errors:capture-more, r=fmeaseMatthias Krüger-69/+65
Make sure that outer opaques capture inner opaques's lifetimes even with precise capturing syntax When lowering an opaque, we must capture and duplicate all of the lifetimes in the opaque's bounds to correctly lower the opaque's bounds. We do this *even if* the lifetime is not captured according to the `+ use<>` precise capturing bound; in that case, we will later reject that captured lifetime. For example, Given an opaque like `impl Sized + 'a + use<>`, we will still duplicate `'a` but later error that it is not mentioned in the `use<>` bound. The current heuristic was not properly handling cases like: ``` //@ edition: 2024 fn foo<'a>() -> impl Trait<Assoc = impl Trait2> + use<> {} ``` Which forces the outer `impl Trait` to capture `'a` since `impl Trait2` *implicitly* captures `'a` due to the new lifetime capture rules for edition 2024. We were only capturing lifetimes syntactically mentioned in the bounds. (Note that this still is an error; we just need to capture `'a` so it is handled later in the compiler correctly -- hence the ICE in #131769 where a late-bound lifetime was being referenced outside of its binder). This PR reworks the way we collect lifetimes to capture and duplicate in AST lowering to fix this. Fixes #131769