about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2024-10-05Auto merge of #129244 - cjgillot:opaque-hir, r=compiler-errorsbors-1072/+1016
Make opaque types regular HIR nodes Having opaque types as HIR owner introduces all sorts of complications. This PR proposes to make them regular HIR nodes instead. I haven't gone through all the test changes yet, so there may be a few surprises. Many thanks to `@camelid` for the first draft. Fixes https://github.com/rust-lang/rust/issues/129023 Fixes #129099 Fixes #125843 Fixes #119716 Fixes #121422
2024-10-05Auto merge of #131275 - workingjubilee:rollup-4yxqio3, r=workingjubileebors-94/+559
Rollup of 9 pull requests Successful merges: - #129517 (Compute array length from type for unconditional panic lint. ) - #130367 (Check elaborated projections from dyn don't mention unconstrained late bound lifetimes) - #130403 (Stabilize `const_slice_from_raw_parts_mut`) - #130633 (Add support for reborrowing pinned method receivers) - #131105 (update `Literal`'s intro) - #131194 (Fix needless_lifetimes in stable_mir) - #131260 (rustdoc: cleaner errors on disambiguator/namespace mismatches) - #131267 (Stabilize `BufRead::skip_until`) - #131273 (Account for `impl Trait {` when `impl Trait for Type {` was intended) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-04Rollup merge of #131273 - estebank:issue-131051, r=compiler-errorsJubilee-8/+158
Account for `impl Trait {` when `impl Trait for Type {` was intended On editions where bare traits are never allowed, detect if the user has written `impl Trait` with no type, silence any dyn-compatibility errors, and provide a structured suggestion for the potentially missing type: ``` error[E0782]: trait objects must include the `dyn` keyword --> $DIR/missing-for-type-in-impl.rs:8:6 | LL | impl Foo<i64> { | ^^^^^^^^ | help: add `dyn` keyword before this trait | LL | impl dyn Foo<i64> { | +++ help: you might have intended to implement this trait for a given type | LL | impl Foo<i64> for /* Type */ { | ++++++++++++++ ``` CC #131051.
2024-10-04Rollup merge of #131267 - okaneco:bufread_skip_until, r=tgross35Jubilee-3/+1
Stabilize `BufRead::skip_until` FCP completed https://github.com/rust-lang/rust/issues/111735#issuecomment-2393893069 Closes #111735
2024-10-04Rollup merge of #131260 - notriddle:notriddle/disambiguator-error, ↵Jubilee-23/+34
r=GuillaumeGomez rustdoc: cleaner errors on disambiguator/namespace mismatches Resolves https://github.com/rust-lang/rust/pull/131224#pullrequestreview-2348407077 r? `@jyn514`
2024-10-04Rollup merge of #131194 - practicalrs:fix_needless_lifetimes, r=celinvalJubilee-2/+2
Fix needless_lifetimes in stable_mir Hi, This PR fixes the following clippy warning in stable_mir ``` warning: the following explicit lifetimes could be elided: 'a --> compiler/stable_mir/src/mir/visit.rs:79:30 | 79 | fn visit_projection_elem<'a>( | ^^ 80 | &mut self, 81 | place_ref: PlaceRef<'a>, | ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes = note: `#[warn(clippy::needless_lifetimes)]` on by default help: elide the lifetimes | 79 ~ fn visit_projection_elem( 80 | &mut self, 81 ~ place_ref: PlaceRef<'_>, | ``` Best regards, Michal
2024-10-04Rollup merge of #131105 - slanterns:literal_c_str, r=petrochenkovJubilee-1/+1
update `Literal`'s intro Just something missd when adding c_str to it.
2024-10-04Rollup merge of #130633 - eholk:pin-reborrow-self, r=compiler-errorsJubilee-22/+171
Add support for reborrowing pinned method receivers This builds on #130526 to add pinned reborrowing for method receivers. This enables the folllowing examples to work: ```rust #![feature(pin_ergonomics)] #![allow(incomplete_features)] use std::pin::Pin; pub struct Foo; impl Foo { fn foo(self: Pin<&mut Self>) { } fn baz(self: Pin<&Self>) { } } pub fn bar(x: Pin<&mut Foo>) { x.foo(); x.foo(); x.baz(); // Pin<&mut Foo> is downgraded to Pin<&Foo> } pub fn baaz(x: Pin<&Foo>) { x.baz(); x.baz(); } ``` This PR includes the original one, which is currently in the commit queue, but the only code changes are in the latest commit (d3c53aaa5c6fcb1018c58d229bc5d92202fa6880). #130494 r? `@compiler-errors`
2024-10-04Rollup merge of #130403 - ↵Jubilee-5/+7
eduardosm:stabilize-const_slice_from_raw_parts_mut, r=workingjubilee Stabilize `const_slice_from_raw_parts_mut` Stabilizes https://github.com/rust-lang/rust/issues/67456, since https://github.com/rust-lang/rust/issues/57349 has been stabilized. Stabilized const API: ```rust // core::ptr pub const fn slice_from_raw_parts_mut<T>(data: *mut T, len: usize) -> *mut [T]; // core::slice pub const unsafe fn from_raw_parts_mut<'a, T>(data: *mut T, len: usize) -> &'a mut [T]; // core::ptr::NonNull pub const fn slice_from_raw_parts(data: NonNull<T>, len: usize) -> Self ``` Closes https://github.com/rust-lang/rust/issues/67456. r? libs-api
2024-10-04Rollup merge of #130367 - compiler-errors:super-unconstrained, r=spastorinoJubilee-18/+149
Check elaborated projections from dyn don't mention unconstrained late bound lifetimes Check that the projections that are *not* explicitly written but which we deduce from elaborating the principal of a `dyn` *also* do not reference unconstrained late-bound lifetimes, just like the ones that the user writes by hand. That is to say, given: ``` trait Foo<T>: Bar<Assoc = T> {} trait Bar { type Assoc; } ``` The type `dyn for<'a> Foo<&'a T>` (basically) elaborates to `dyn for<'a> Foo<&'a T> + for<'a> Bar<Assoc = &'a T>`[^1]. However, the `Bar` projection predicate is not well-formed, since `'a` must show up in the trait's arguments to be referenced in the term of a projection. We must error in this situation[^well], or else `dyn for<'a> Foo<&'a T>` is unsound. We already detect this for user-written projections during HIR->rustc_middle conversion, so this largely replicates that logic using the helper functions that were already conveniently defined. --- I'm cratering this first to see the fallout; if it's minimal or zero, then let's land it as-is. If not, the way that this is implemented is very conducive to an FCW. --- Fixes #130347 [^1]: We don't actually elaborate it like that in rustc; we only keep the principal trait ref `Foo<&'a T>` and the projection part of `Bar<Assoc = ...>`, but it's useful to be a bit verbose here for the purpose of explaining the issue. [^well]: Well, we could also make `dyn for<'a> Foo<&'a T>` *not* implement `for<'a> Bar<Assoc = &'a T>`, but this is inconsistent with the case where the user writes `Assoc = ...` in the type itself, and it overly complicates the implementation of trait objects' built-in impls.
2024-10-04Rollup merge of #129517 - cjgillot:known-panic-array, r=pnkfelixJubilee-12/+36
Compute array length from type for unconditional panic lint. Fixes https://github.com/rust-lang/rust/issues/98444 The cases that involve slicing are harder, so https://github.com/rust-lang/rust/issues/38035 remains open.
2024-10-05Auto merge of #131124 - weihanglo:update-cargo, r=weihanglobors-0/+0
Update cargo 17 commits in 80d82ca22abbee5fb7b51fa1abeb1ae34e99e88a..ad074abe3a18ce8444c06f962ceecfd056acfc73 2024-09-27 17:56:01 +0000 to 2024-10-04 18:18:15 +0000 - test: Remove the last of our custom json assertions (rust-lang/cargo#14576) - docs(ref): Expand on MSRV (rust-lang/cargo#14636) - docs: Minor re-grouping of pages (rust-lang/cargo#14620) - docs(ref): Highleft whats left for msrv-policy (rust-lang/cargo#14638) - Fix `cargo:version_number` - has only one `:` (rust-lang/cargo#14637) - docs: Declare support level for each crate in our Charter / docs (rust-lang/cargo#14600) - chore(deps): update tar to 0.4.42 (rust-lang/cargo#14632) - docs(charter): Declare new Intentional Artifacts as 'small' changes (rust-lang/cargo#14599) - fix: Remove implicit feature removal (rust-lang/cargo#14630) - docs(config): make `--config &lt;PATH&gt;` more prominent (rust-lang/cargo#14631) - chore(deps): update rust crate unicode-width to 0.2.0 (rust-lang/cargo#14624) - chore(deps): update embarkstudios/cargo-deny-action action to v2 (rust-lang/cargo#14628) - docs(ref): Clean up language for `package.rust-version` (rust-lang/cargo#14619) - docs: clarify `target.'cfg(...)'` doesnt respect cfg from build script (rust-lang/cargo#14312) - test: relax compiler panic assertions (rust-lang/cargo#14618) - refactor(compiler): zero-copy deserialization when possible (rust-lang/cargo#14608) - test: add support for features in the sat resolver (rust-lang/cargo#14583)
2024-10-05Bless clippy.Camille GILLOT-5/+9
2024-10-05Compute array length from type for unconditional panic.Camille GILLOT-7/+27
2024-10-04Adapt clippy.Camille GILLOT-38/+13
2024-10-04Bless incremental tests.Camille GILLOT-2/+2
2024-10-04Promote crash tests to ui.Camille GILLOT-35/+124
2024-10-04Simplify bound var resolution.Camille GILLOT-44/+39
2024-10-04Remove stray fixmes.Camille GILLOT-3/+0
2024-10-04Bless ui tests.Camille GILLOT-519/+454
2024-10-04Visit opaques for visibilities.Camille GILLOT-51/+47
2024-10-04WfCheck opaques.Camille GILLOT-13/+32
2024-10-04rm `ItemKind::OpaqueTy`Noah Lev-369/+307
This introduce an additional collection of opaques on HIR, as they can no longer be listed using the free item list.
2024-10-04Make naming more consistent.Camille GILLOT-10/+10
2024-10-04Make query backtrace more useful.Camille GILLOT-8/+8
2024-10-04Account for `impl Trait {` when `impl Trait for Type {` was intendedEsteban Küber-8/+158
On editions where bare traits are never allowed, detect if the user has written `impl Trait` with no type, silence any dyn-compatibility errors, and provide a structured suggestion for the potentially missing type: ``` error[E0782]: trait objects must include the `dyn` keyword --> $DIR/missing-for-type-in-impl.rs:8:6 | LL | impl Foo<i64> { | ^^^^^^^^ | help: add `dyn` keyword before this trait | LL | impl dyn Foo<i64> { | +++ help: you might have intended to implement this trait for a given type | LL | impl Foo<i64> for /* Type */ { | ++++++++++++++ ```
2024-10-04Auto merge of #131269 - workingjubilee:rollup-bf7fzhf, r=workingjubileebors-105/+159
Rollup of 10 pull requests Successful merges: - #130453 (Add x86_64-unknown-trusty as tier 3 target) - #130518 (Stabilize the `map`/`value` methods on `ControlFlow`) - #131116 (Increase Stack Size for AIX) - #131171 (Fix `target_env` in `avr-unknown-gnu-atmega328`) - #131174 (Fix `target_abi` in `sparc-unknown-none-elf`) - #131177 ( Stabilize 5 `const_mut_refs`-dependent API) - #131238 (Remove mw from triagebot.toml) - #131240 (Fix typo in csky-unknown-linux-gnuabiv2.md) - #131257 ([rustdoc] Fix list margins) - #131264 (Fix some `pub(crate)` that were undetected bc of `#[instrument]`) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-04Elaborate supertrait span correctly to label the error betterMichael Goulet-5/+64
2024-10-04Check elaborated projections from dyn don't mention unconstrained late bound ↵Michael Goulet-14/+86
lifetimes
2024-10-04Rollup merge of #131264 - compiler-errors:fix-pub-crate, r=jieyouxuJubilee-29/+31
Fix some `pub(crate)` that were undetected bc of `#[instrument]` Self-explanatory, minor clean up.
2024-10-04Rollup merge of #131257 - GuillaumeGomez:fix-list-margins, r=notriddleJubilee-3/+41
[rustdoc] Fix list margins Fixes https://github.com/rust-lang/rust/issues/131106. Fixes #131223. Follow-up of #130933. This PR changes the display as follow: the margin between list items is reduced by half to ensure that they visually still seem part of the same list, while also being bigger than previously which improves display for list items with more than one paragragh. Paragraphs also get they bottom margin reduced to a little bit less than the list items bottom margin for two reasons: 1. The list items keep having the biggest bottom margin which makes it better for coherency. 2. The paragraphs are still visually separated but they don't "overcome" the list. | before | after | |-|-| | ![Screenshot from 2024-10-04 17-58-51](https://github.com/user-attachments/assets/3fdc1472-781e-435d-a0d7-012f43aa8fb8) | ![image](https://github.com/user-attachments/assets/0366313d-416f-4f04-b905-bb16c54f4528) | Can be tested [here](https://rustdoc.crud.net/imperio/fix-list-margins/doc/test_docs/long_list/index.html). r? ``@notriddle``
2024-10-04Rollup merge of #131240 - taiki-e:typo, r=jieyouxuJubilee-1/+1
Fix typo in csky-unknown-linux-gnuabiv2.md
2024-10-04Rollup merge of #131238 - michaelwoerister:triagebot, r=michaelwoeristerJubilee-3/+0
Remove mw from triagebot.toml cc https://github.com/rust-lang/team/pull/1565
2024-10-04Rollup merge of #131177 - workingjubilee:stabilize-const-mut-referees, ↵Jubilee-14/+21
r=tgross35 Stabilize 5 `const_mut_refs`-dependent API Since `const_mut_refs` and `const_refs_to_cell` have been stabilized, we now may create mutable references inside our library API. Thus we now stabilize the `const fn` version of these public library APIs which required such in their implementation: - const `NonNull::as_mut` https://github.com/rust-lang/rust/issues/91822#issuecomment-2338930442 - const `slice::{first,last}_mut`: https://github.com/rust-lang/rust/issues/83570#issuecomment-2334847112 - const `str::as_{mut_ptr,bytes_mut}`: https://github.com/rust-lang/rust/issues/130086#issuecomment-2336408562 - const `str::from_utf8_unchecked_mut`: https://github.com/rust-lang/rust/issues/91005#issuecomment-2359820672 - const `UnsafeCell::get_mut`: https://github.com/rust-lang/rust/issues/88836#issuecomment-2359817772
2024-10-04Rollup merge of #131174 - madsmtm:target-info-sparc-abi, r=pnkfelixJubilee-2/+1
Fix `target_abi` in `sparc-unknown-none-elf` This was previously set to `target_abi = "elf"`, but `elf` is not used elsewhere as a target ABI (even though there's many targets that have it in their name), so I've removed it. CC target maintainer ``@jonathanpallant,`` what do you think about this? ``@rustbot`` label O-SPARC
2024-10-04Rollup merge of #131171 - madsmtm:target-info-avr-env, r=petrochenkovJubilee-0/+2
Fix `target_env` in `avr-unknown-gnu-atmega328` The target name itself contains GNU, we should probably reflect that as `target_env = "gnu"` as well? Or from my reading of https://github.com/rust-lang/rust/pull/74941#issuecomment-712219034, perhaps not, but then that should probably be documented somewhere? There's no listed target maintainer, but the target was introduced in https://github.com/rust-lang/rust/pull/74941, so I'll ping the author of that: `@dylanmckay` Relatedly, I wonder _why_ the recommendation is to [create separate target triples for each AVR](https://github.com/Rahix/avr-hal/tree/main/avr-specs), when `-Ctarget-cpu=...` would suffice, perhaps you could also elaborate on that? Was it just because `-Ctarget-cpu=...` didn't exist back then? If so, now that it does, should we now change the target back to e.g. `avr-unknown-none-gnu`, and require the user to set `-Ctarget-cpu=...` instead?
2024-10-04Rollup merge of #131116 - mustartt:aix-stack-size, r=petrochenkovJubilee-0/+4
Increase Stack Size for AIX On AIX, there are limited support for tail call optimizations, so we need to set a larger stack size value. Fixes the following tests on AIX: ``` [ui] tests/ui/associated-consts/issue-93775.rs [ui] tests/ui/closures/deeply-nested_closures.rs [ui] tests/ui/issues/issue-74564-if-expr-stack-overflow.rs [ui] tests/ui/parser/survive-peano-lesson-queue.rs ```
2024-10-04Rollup merge of #130518 - scottmcm:stabilize-controlflow-extra, r=dtolnayJubilee-53/+15
Stabilize the `map`/`value` methods on `ControlFlow` And fix the stability attribute on the `pub use` in `core::ops`. libs-api in https://github.com/rust-lang/rust/issues/75744#issuecomment-2231214910 seemed reasonably happy with naming for these, so let's try for an FCP. Summary: ```rust impl<B, C> ControlFlow<B, C> { pub fn break_value(self) -> Option<B>; pub fn map_break<T>(self, f: impl FnOnce(B) -> T) -> ControlFlow<T, C>; pub fn continue_value(self) -> Option<C>; pub fn map_continue<T>(self, f: impl FnOnce(C) -> T) -> ControlFlow<B, T>; } ``` Resolves #75744 ``@rustbot`` label +needs-fcp +t-libs-api -t-libs --- Aside, in case it keeps someone else from going down the same dead end: I looked at the `{break,continue}_value` methods and tried to make them `const` as part of this, but that's disallowed because of not having `const Drop`, so put it back to not even unstably-const.
2024-10-04Rollup merge of #130453 - randomPoison:trusty-x86, r=pnkfelixJubilee-0/+43
Add x86_64-unknown-trusty as tier 3 target This PR adds a third target for the Trusty platform, `x86_64-unknown-trusty`. Please let me know if an MCP is required. https://github.com/rust-lang/compiler-team/issues/582 was made when adding the first two targets, I can make another one for the new target as well if needed. # Target Tier Policy Acknowledgements > A tier 3 target must have a designated developer or developers (the "target maintainers") on record to be CCed when issues arise regarding the target. (The mechanism to track and CC such developers may evolve over time.) - Nicole LeGare (```@randomPoison)``` - Andrei Homescu (```@ahomescu)``` - Chris Wailes (chriswailes@google.com) - As a fallback trusty-dev-team@google.com can be contacted Note that this does not reflect the maintainers currently listed in [`trusty.md`](https://github.com/rust-lang/rust/blob/c52c23b6f44cd19718721a5e3b2eeb169e9c96ff/src/doc/rustc/src/platform-support/trusty.md). #130452 is currently open to update the list of maintainers in the documentation. > Targets must use naming consistent with any existing targets; for instance, a target for the same CPU or OS as an existing Rust target should use the same name for that CPU or OS. Targets should normally use the same names and naming conventions as used elsewhere in the broader ecosystem beyond Rust (such as in other toolchains), unless they have a very good reason to diverge. Changing the name of a target can be highly disruptive, especially once the target reaches a higher tier, so getting the name right is important even for a tier 3 target. The new target `x86_64-unknown-trusty` follows the existing naming convention for similar targets. > Target names should not introduce undue confusion or ambiguity unless absolutely necessary to maintain ecosystem compatibility. For example, if the name of the target makes people extremely likely to form incorrect beliefs about what it targets, the name should be changed or augmented to disambiguate it. 👍 > Tier 3 targets may have unusual requirements to build or use, but must not create legal issues or impose onerous legal terms for the Rust project or for Rust developers or users. There are no known legal issues or license incompatibilities. > Neither this policy nor any decisions made regarding targets shall create any binding agreement or estoppel by any party. If any member of an approving Rust team serves as one of the maintainers of a target, or has any legal or employment requirement (explicit or implicit) that might affect their decisions regarding a target, they must recuse themselves from any approval decisions regarding the target's tier status, though they may otherwise participate in discussions. 👍 > Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate (core for most targets, alloc for targets that can support dynamic memory allocation, std for targets with an operating system or equivalent layer of system-provided functionality), but may leave some code unimplemented (either unavailable or stubbed out as appropriate), whether because the target makes it impossible to implement or challenging to implement. The authors of pull requests are not obligated to avoid calling any portions of the standard library on the basis of a tier 3 target not implementing those portions. This PR only adds the target. `std` support is being worked on and will be added in a future PR. > The target must provide documentation for the Rust community explaining how to build for the target, using cross-compilation if possible. If the target supports running binaries, or running tests (even if they do not pass), the documentation must explain how to run such binaries or tests for the target, using emulation if possible or dedicated hardware if necessary. 👍 > Tier 3 targets must not impose burden on the authors of pull requests, or other developers in the community, to maintain the target. In particular, do not post comments (automated or manual) on a PR that derail or suggest a block on the PR based on a tier 3 target. Do not send automated messages or notifications (via any medium, including via ```@)``` to a PR author or others involved with a PR regarding a tier 3 target, unless they have opted into such messages. 👍 > Patches adding or updating tier 3 targets must not break any existing tier 2 or tier 1 target, and must not knowingly break another tier 3 target without approval of either the compiler team or the maintainers of the other tier 3 target. 👍 > Tier 3 targets must be able to produce assembly using at least one of rustc's supported backends from any host target. (Having support in a fork of the backend is not sufficient, it must be upstream.) 👍
2024-10-04Update cargoWeihang Lo-0/+0
2024-10-04Stabilize `BufRead::skip_until`okaneco-3/+1
2024-10-04Fix target_abi in sparc-unknown-none-elfMads Marquart-2/+1
This was previously set to `target_abi = "elf"`, but `elf` is not used elsewhere as a target ABI (even though there's many targets that have it in their name).
2024-10-04Auto merge of #130157 - eduardosm:stabilize-const_float_classify, r=RalfJungbors-47/+43
Stabilize `const_float_classify` Tracking issue: https://github.com/rust-lang/rust/issues/72505 Also reverts https://github.com/rust-lang/rust/pull/114486 Closes https://github.com/rust-lang/rust/issues/72505 Stabilized const API: ```rust impl f32 { pub const fn is_nan(self) -> bool; pub const fn is_infinite(self) -> bool; pub const fn is_finite(self) -> bool; pub const fn is_subnormal(self) -> bool; pub const fn is_normal(self) -> bool; pub const fn classify(self) -> FpCategory; pub const fn is_sign_positive(self) -> bool; pub const fn is_sign_negative(self) -> bool; } impl f64 { pub const fn is_nan(self) -> bool; pub const fn is_infinite(self) -> bool; pub const fn is_finite(self) -> bool; pub const fn is_subnormal(self) -> bool; pub const fn is_normal(self) -> bool; pub const fn classify(self) -> FpCategory; pub const fn is_sign_positive(self) -> bool; pub const fn is_sign_negative(self) -> bool; } ``` cc `@rust-lang/wg-const-eval` `@rust-lang/libs-api`
2024-10-04Fix some pub(crate) that were undetected bc of instrumentMichael Goulet-29/+31
2024-10-04rustdoc: cleaner errors on disambiguator/namespace mismatchesMichael Howell-23/+34
2024-10-04Add GUI regression test for #130622 and for #131223Guillaume Gomez-0/+35
2024-10-04Fix list marginsGuillaume Gomez-3/+6
2024-10-04Auto merge of #131237 - GuillaumeGomez:rollup-il2i7z7, r=GuillaumeGomezbors-211/+407
Rollup of 4 pull requests Successful merges: - #131034 (Implement RFC3695 Allow boolean literals as cfg predicates) - #131202 (Use wide pointers consistenly across the compiler) - #131230 (Enable `--no-sandbox` option by default for rustdoc GUI tests) - #131232 (Week off of reviews to focus on docs) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-04Fix typo in csky-unknown-linux-gnuabiv2.mdTaiki Endo-1/+1
2024-10-04Remove mw from triagebot.tomlMichael Woerister-3/+0
cc https://github.com/rust-lang/team/pull/1565