Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
13ee69d
Update bundled musl to 1.2.5
est31 May 29, 2024
a014a9b
update all other references to musl 1.2.3 to 1.2.5
Gankra Jun 18, 2025
52513ab
bump powerpc64le-unknown-linux-musl's musl to 1.2.5
Gankra Oct 2, 2025
303a828
pin all musl deconfigs to 1.2.5
Gankra Oct 7, 2025
22e6656
remove references to upstreamed patches
Gankra Oct 7, 2025
b64cdd0
bump musl-cross-make commit to get fixes
Gankra Oct 7, 2025
010b690
fmt
Gankra Oct 7, 2025
60a7cab
Use fstatat() in DirEntry::metadata on Apple platforms
jesseschalken Oct 22, 2025
fe4c2a2
typo
jesseschalken Oct 22, 2025
63bb238
implement VecDeque extend_from_within and prepend_from_within, add tests
antonilol Oct 23, 2025
73b734b
Pass `debuginfo_compression` through FFI as an enum
Zalathar Oct 23, 2025
26f35ae
Implement pattern matching for `&pin mut|const T`
frank-king Apr 13, 2025
9fc1d8a
require `T: !Unpin` for `&pin mut T` to be projected to `&pin mut T.U…
frank-king Jul 19, 2025
7070709
Remove `!Unpin` related bounds
frank-king Aug 3, 2025
cb369ab
Fix `pin_ergonomics` tests
frank-king Aug 3, 2025
b36f15e
Add `#[pin_project]` attribute for structurally pinning
frank-king Sep 27, 2025
ace8345
Rename `#[pin_project]` to `#[pin_v2]` to avoid naming conflicts
frank-king Oct 24, 2025
7319811
[rustdoc search] Include extern crates when filtering on `import`
GuillaumeGomez Oct 30, 2025
d5839f9
Enable regression labeling aliases
apiraino Oct 21, 2025
e614ed4
Restrict `#[pin_v2]` test on `global_asm!` to stablized archs only
frank-king Oct 31, 2025
d8ace32
Remove the `#[pin_v2]` test since it produces different errors on dif…
frank-king Oct 31, 2025
c5b30c3
docs: Fix argument names for `carrying_mul_add`
sorairolake Oct 31, 2025
761ae9a
add tier 3 HelenOS compiler targets
mvolfik Jun 5, 2025
3d9c69b
enable flock for illumos
pietroalbini Oct 31, 2025
06a2e72
Implement VecDeque::extract_if
tisonkun Oct 16, 2025
bf7b05c
refactor: move runtime functions to core
Kmeakin Oct 11, 2025
c8ab427
refactor: format `unicode_data`
Kmeakin Oct 11, 2025
6d75cd2
refactor: remove check that `first_code_point` is non-ascii
Kmeakin Oct 11, 2025
9a80731
refactor: make string formatting more readable
Kmeakin Oct 11, 2025
0e6131c
refactor: make `unicode_data` tests normal tests
Kmeakin Oct 19, 2025
23edbb6
Don't require dlltool with the dummy backend on MinGW
bjorn3 Oct 31, 2025
04a10f7
Simplify code to generate line numbers in highlight
GuillaumeGomez Oct 27, 2025
e1e8913
bootstrap: Use cargo's `build.warnings=deny` rather than -Dwarnings
jyn514 Oct 31, 2025
5fabd2d
Improve code
GuillaumeGomez Oct 31, 2025
efb9a41
cleanup: upstream dropped amx-transpose functionality
durin42 Oct 31, 2025
af5b798
Add Ord::clamp_min and clamp_max
Kyuuhachi Oct 16, 2025
7069400
revert combined nonpoison/poison tests for condvar
connortsui20 Oct 31, 2025
3d5a408
update `nonpoison::Condvar` to take guards by reference
connortsui20 Oct 31, 2025
c1153b0
move condvar test from mutex to condvar test file
connortsui20 Oct 31, 2025
2e01acc
Add tests for some cases mentioned in #135589
estebank Jan 16, 2025
8ba2950
Detect case of missing lifetime in assoc type
estebank Jan 16, 2025
1e9e1f2
On unconstrained lifetime on `impl` block, suggest using it if there'…
estebank Jan 16, 2025
75bb675
Do not suggest introducing lifetime in impl assoc type
estebank Jan 16, 2025
8d51667
fix typo
estebank Oct 31, 2025
2a1595e
Add regression test for including extern crates in import filtering
GuillaumeGomez Oct 30, 2025
ebc7fc5
Rollup merge of #135602 - estebank:issue-135589, r=Nadrieril
Zalathar Nov 1, 2025
6475290
Rollup merge of #139310 - mvolfik:helenos-compiler, r=wesleywiser
Zalathar Nov 1, 2025
f9fee1a
Rollup merge of #139751 - frank-king:feature/pin-project, r=Nadrieril…
Zalathar Nov 1, 2025
8d52fb5
Rollup merge of #142682 - Gankra:update_musl_1.2.5, r=wesleywiser
Zalathar Nov 1, 2025
d7f9192
Rollup merge of #147161 - antonilol:vec-deque-extend-from-within, r=j…
Zalathar Nov 1, 2025
5314d71
Rollup merge of #147622 - Kmeakin:km/unicode-data/refactors, r=joboet
Zalathar Nov 1, 2025
f6f731c
Rollup merge of #147780 - tisonkun:vec-deque-extract-if, r=joboet
Zalathar Nov 1, 2025
f284588
Rollup merge of #147786 - Kyuuhachi:clamp-min-max, r=joboet
Zalathar Nov 1, 2025
50dcc44
Rollup merge of #147942 - apiraino:enable-label-aliases, r=Urgau
Zalathar Nov 1, 2025
1201a7c
Rollup merge of #147986 - jesseschalken:use-fstatat-macos, r=joboet
Zalathar Nov 1, 2025
841549f
Rollup merge of #148103 - Zalathar:compression, r=wesleywiser
Zalathar Nov 1, 2025
9227c00
Rollup merge of #148171 - GuillaumeGomez:line-number-highlight, r=yot…
Zalathar Nov 1, 2025
707c075
Rollup merge of #148301 - GuillaumeGomez:import-filter, r=notriddle
Zalathar Nov 1, 2025
b9465fb
Rollup merge of #148319 - sorairolake:fix-carrying_mul_add-docs, r=Am…
Zalathar Nov 1, 2025
a65a3b9
Rollup merge of #148322 - oxidecomputer:ea-flock-illumos, r=ChrisDenton
Zalathar Nov 1, 2025
79d0fe6
Rollup merge of #148330 - bjorn3:dummy_backend_no_dlltool, r=mati865
Zalathar Nov 1, 2025
3e2b23d
Rollup merge of #148332 - jyn514:cargo-deny-warnings, r=Kobzol
Zalathar Nov 1, 2025
33dc838
Rollup merge of #148338 - durin42:llvm-22-amx-transpose, r=workingjub…
Zalathar Nov 1, 2025
895a501
Rollup merge of #148343 - connortsui20:guard-ref-condvar, r=Amanieu
Zalathar Nov 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -789,14 +789,14 @@ pub struct PatField {
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[derive(Encodable, Decodable, HashStable_Generic, Walkable)]
pub enum ByRef {
Yes(Mutability),
Yes(Pinnedness, Mutability),
No,
}

impl ByRef {
#[must_use]
pub fn cap_ref_mutability(mut self, mutbl: Mutability) -> Self {
if let ByRef::Yes(old_mutbl) = &mut self {
if let ByRef::Yes(_, old_mutbl) = &mut self {
*old_mutbl = cmp::min(*old_mutbl, mutbl);
}
self
Expand All @@ -814,20 +814,33 @@ pub struct BindingMode(pub ByRef, pub Mutability);

impl BindingMode {
pub const NONE: Self = Self(ByRef::No, Mutability::Not);
pub const REF: Self = Self(ByRef::Yes(Mutability::Not), Mutability::Not);
pub const REF: Self = Self(ByRef::Yes(Pinnedness::Not, Mutability::Not), Mutability::Not);
pub const REF_PIN: Self =
Self(ByRef::Yes(Pinnedness::Pinned, Mutability::Not), Mutability::Not);
pub const MUT: Self = Self(ByRef::No, Mutability::Mut);
pub const REF_MUT: Self = Self(ByRef::Yes(Mutability::Mut), Mutability::Not);
pub const MUT_REF: Self = Self(ByRef::Yes(Mutability::Not), Mutability::Mut);
pub const MUT_REF_MUT: Self = Self(ByRef::Yes(Mutability::Mut), Mutability::Mut);
pub const REF_MUT: Self = Self(ByRef::Yes(Pinnedness::Not, Mutability::Mut), Mutability::Not);
pub const REF_PIN_MUT: Self =
Self(ByRef::Yes(Pinnedness::Pinned, Mutability::Mut), Mutability::Not);
pub const MUT_REF: Self = Self(ByRef::Yes(Pinnedness::Not, Mutability::Not), Mutability::Mut);
pub const MUT_REF_PIN: Self =
Self(ByRef::Yes(Pinnedness::Pinned, Mutability::Not), Mutability::Mut);
pub const MUT_REF_MUT: Self =
Self(ByRef::Yes(Pinnedness::Not, Mutability::Mut), Mutability::Mut);
pub const MUT_REF_PIN_MUT: Self =
Self(ByRef::Yes(Pinnedness::Pinned, Mutability::Mut), Mutability::Mut);

pub fn prefix_str(self) -> &'static str {
match self {
Self::NONE => "",
Self::REF => "ref ",
Self::REF_PIN => "ref pin const ",
Self::MUT => "mut ",
Self::REF_MUT => "ref mut ",
Self::REF_PIN_MUT => "ref pin mut ",
Self::MUT_REF => "mut ref ",
Self::MUT_REF_PIN => "mut ref pin ",
Self::MUT_REF_MUT => "mut ref mut ",
Self::MUT_REF_PIN_MUT => "mut ref pin mut ",
}
}
}
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_ast/src/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ macro_rules! common_visitor_and_walkers {
crate::tokenstream::TokenStream,
Movability,
Mutability,
Pinnedness,
Result<(), rustc_span::ErrorGuaranteed>,
rustc_data_structures::fx::FxHashMap<Symbol, usize>,
rustc_span::ErrorGuaranteed,
Expand Down
7 changes: 7 additions & 0 deletions compiler/rustc_ast_ir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,3 +311,10 @@ pub enum Pinnedness {
Not,
Pinned,
}

impl Pinnedness {
/// Return `true` if self is pinned
pub fn is_pinned(self) -> bool {
matches!(self, Self::Pinned)
}
}
7 changes: 6 additions & 1 deletion compiler/rustc_ast_pretty/src/pprust/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1712,10 +1712,15 @@ impl<'a> State<'a> {
if mutbl.is_mut() {
self.word_nbsp("mut");
}
if let ByRef::Yes(rmutbl) = by_ref {
if let ByRef::Yes(pinnedness, rmutbl) = by_ref {
self.word_nbsp("ref");
if pinnedness.is_pinned() {
self.word_nbsp("pin");
}
if rmutbl.is_mut() {
self.word_nbsp("mut");
} else if pinnedness.is_pinned() {
self.word_nbsp("const");
}
}
self.print_ident(*ident);
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_attr_parsing/src/attributes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub(crate) mod must_use;
pub(crate) mod no_implicit_prelude;
pub(crate) mod non_exhaustive;
pub(crate) mod path;
pub(crate) mod pin_v2;
pub(crate) mod proc_macro_attrs;
pub(crate) mod prototype;
pub(crate) mod repr;
Expand Down
21 changes: 21 additions & 0 deletions compiler/rustc_attr_parsing/src/attributes/pin_v2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use rustc_hir::Target;
use rustc_hir::attrs::AttributeKind;
use rustc_span::{Span, Symbol, sym};

use crate::attributes::{NoArgsAttributeParser, OnDuplicate};
use crate::context::Stage;
use crate::target_checking::AllowedTargets;
use crate::target_checking::Policy::Allow;

pub(crate) struct PinV2Parser;

impl<S: Stage> NoArgsAttributeParser<S> for PinV2Parser {
const PATH: &[Symbol] = &[sym::pin_v2];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
Allow(Target::Enum),
Allow(Target::Struct),
Allow(Target::Union),
]);
const CREATE: fn(Span) -> AttributeKind = AttributeKind::PinV2;
}
2 changes: 2 additions & 0 deletions compiler/rustc_attr_parsing/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ use crate::attributes::must_use::MustUseParser;
use crate::attributes::no_implicit_prelude::NoImplicitPreludeParser;
use crate::attributes::non_exhaustive::NonExhaustiveParser;
use crate::attributes::path::PathParser as PathAttributeParser;
use crate::attributes::pin_v2::PinV2Parser;
use crate::attributes::proc_macro_attrs::{
ProcMacroAttributeParser, ProcMacroDeriveParser, ProcMacroParser, RustcBuiltinMacroParser,
};
Expand Down Expand Up @@ -233,6 +234,7 @@ attribute_parsers!(
Single<WithoutArgs<NonExhaustiveParser>>,
Single<WithoutArgs<ParenSugarParser>>,
Single<WithoutArgs<PassByValueParser>>,
Single<WithoutArgs<PinV2Parser>>,
Single<WithoutArgs<PointeeParser>>,
Single<WithoutArgs<ProcMacroAttributeParser>>,
Single<WithoutArgs<ProcMacroParser>>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
}

LocalInfo::User(mir::BindingForm::Var(mir::VarBindingForm {
binding_mode: BindingMode(ByRef::Yes(_), _),
binding_mode: BindingMode(ByRef::Yes(..), _),
..
})) => {
let pattern_span: Span = local_decl.source_info.span;
Expand Down
10 changes: 10 additions & 0 deletions compiler/rustc_borrowck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2582,6 +2582,16 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
_ => bug!("Deref of unexpected type: {:?}", base_ty),
}
}
// Check as the inner reference type if it is a field projection
// from the `&pin` pattern
ProjectionElem::Field(FieldIdx::ZERO, _)
if let Some(adt) =
place_base.ty(self.body(), self.infcx.tcx).ty.ty_adt_def()
&& adt.is_pin()
&& self.infcx.tcx.features().pin_ergonomics() =>
{
self.is_mutable(place_base, is_local_mutation_allowed)
}
// All other projections are owned by their base path, so mutable if
// base path is mutable
ProjectionElem::Field(..)
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_llvm/src/back/owned_target_machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl OwnedTargetMachine {
use_init_array: bool,
split_dwarf_file: &CStr,
output_obj_file: &CStr,
debug_info_compression: &CStr,
debug_info_compression: llvm::CompressionKind,
use_emulated_tls: bool,
use_wasm_eh: bool,
) -> Result<Self, LlvmError<'static>> {
Expand All @@ -62,7 +62,7 @@ impl OwnedTargetMachine {
use_init_array,
split_dwarf_file.as_ptr(),
output_obj_file.as_ptr(),
debug_info_compression.as_ptr(),
debug_info_compression,
use_emulated_tls,
use_wasm_eh,
)
Expand Down
25 changes: 13 additions & 12 deletions compiler/rustc_codegen_llvm/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ use std::sync::Arc;
use std::{fs, slice, str};

use libc::{c_char, c_int, c_void, size_t};
use llvm::{
LLVMRustLLVMHasZlibCompressionForDebugSymbols, LLVMRustLLVMHasZstdCompressionForDebugSymbols,
};
use rustc_codegen_ssa::back::link::ensure_removed;
use rustc_codegen_ssa::back::versioned_llvm_target;
use rustc_codegen_ssa::back::write::{
Expand Down Expand Up @@ -252,21 +249,25 @@ pub(crate) fn target_machine_factory(

let use_emulated_tls = matches!(sess.tls_model(), TlsModel::Emulated);

let debuginfo_compression = sess.opts.debuginfo_compression.to_string();
match sess.opts.debuginfo_compression {
rustc_session::config::DebugInfoCompression::Zlib => {
if !unsafe { LLVMRustLLVMHasZlibCompressionForDebugSymbols() } {
let debuginfo_compression = match sess.opts.debuginfo_compression {
config::DebugInfoCompression::None => llvm::CompressionKind::None,
config::DebugInfoCompression::Zlib => {
if llvm::LLVMRustLLVMHasZlibCompression() {
llvm::CompressionKind::Zlib
} else {
sess.dcx().emit_warn(UnknownCompression { algorithm: "zlib" });
llvm::CompressionKind::None
}
}
rustc_session::config::DebugInfoCompression::Zstd => {
if !unsafe { LLVMRustLLVMHasZstdCompressionForDebugSymbols() } {
config::DebugInfoCompression::Zstd => {
if llvm::LLVMRustLLVMHasZstdCompression() {
llvm::CompressionKind::Zstd
} else {
sess.dcx().emit_warn(UnknownCompression { algorithm: "zstd" });
llvm::CompressionKind::None
}
}
rustc_session::config::DebugInfoCompression::None => {}
};
let debuginfo_compression = SmallCStr::new(&debuginfo_compression);

let file_name_display_preference =
sess.filename_display_preference(RemapPathScopeComponents::DEBUGINFO);
Expand Down Expand Up @@ -310,7 +311,7 @@ pub(crate) fn target_machine_factory(
use_init_array,
&split_dwarf_file,
&output_obj_file,
&debuginfo_compression,
debuginfo_compression,
use_emulated_tls,
use_wasm_eh,
)
Expand Down
16 changes: 12 additions & 4 deletions compiler/rustc_codegen_llvm/src/llvm/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,15 @@ pub(crate) enum Opcode {
CatchSwitch = 65,
}

/// Must match the layout of `LLVMRustCompressionKind`.
#[derive(Copy, Clone)]
#[repr(C)]
pub(crate) enum CompressionKind {
None = 0,
Zlib = 1,
Zstd = 2,
}

unsafe extern "C" {
type Opaque;
}
Expand Down Expand Up @@ -2329,7 +2338,7 @@ unsafe extern "C" {
UseInitArray: bool,
SplitDwarfFile: *const c_char,
OutputObjFile: *const c_char,
DebugInfoCompression: *const c_char,
DebugInfoCompression: CompressionKind,
UseEmulatedTls: bool,
UseWasmEH: bool,
) -> *mut TargetMachine;
Expand Down Expand Up @@ -2517,9 +2526,8 @@ unsafe extern "C" {

pub(crate) fn LLVMRustGetElementTypeArgIndex(CallSite: &Value) -> i32;

pub(crate) fn LLVMRustLLVMHasZlibCompressionForDebugSymbols() -> bool;

pub(crate) fn LLVMRustLLVMHasZstdCompressionForDebugSymbols() -> bool;
pub(crate) safe fn LLVMRustLLVMHasZlibCompression() -> bool;
pub(crate) safe fn LLVMRustLLVMHasZstdCompression() -> bool;

pub(crate) fn LLVMRustGetSymbols(
buf_ptr: *const u8,
Expand Down
9 changes: 9 additions & 0 deletions compiler/rustc_feature/src/builtin_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,15 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
EncodeCrossCrate::No, loop_match, experimental!(loop_match)
),

// The `#[pin_v2]` attribute is part of the `pin_ergonomics` experiment
// that allows structurally pinning, tracked in:
//
// - https://github.com/rust-lang/rust/issues/130494
gated!(
pin_v2, Normal, template!(Word), ErrorFollowing,
EncodeCrossCrate::Yes, pin_ergonomics, experimental!(pin_v2),
),

// ==========================================================================
// Internal attributes: Stability, deprecation, and unsafe:
// ==========================================================================
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_hir/src/attrs/data_structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,9 @@ pub enum AttributeKind {
/// Represents `#[pattern_complexity_limit]`
PatternComplexityLimit { attr_span: Span, limit_span: Span, limit: Limit },

/// Represents `#[pin_v2]`
PinV2(Span),

/// Represents `#[pointee]`
Pointee(Span),

Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_hir/src/attrs/encode_cross_crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ impl AttributeKind {
PassByValue(..) => Yes,
Path(..) => No,
PatternComplexityLimit { .. } => No,
PinV2(..) => Yes,
Pointee(..) => No,
ProcMacro(..) => No,
ProcMacroAttribute(..) => No,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir/src/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use rustc_ast::{
pub use rustc_ast::{
AssignOp, AssignOpKind, AttrId, AttrStyle, BinOp, BinOpKind, BindingMode, BorrowKind,
BoundConstness, BoundPolarity, ByRef, CaptureBy, DelimArgs, ImplPolarity, IsAuto,
MetaItemInner, MetaItemLit, Movability, Mutability, UnOp,
MetaItemInner, MetaItemLit, Movability, Mutability, Pinnedness, UnOp,
};
use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::sorted_map::SortedMap;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/check/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ fn resolve_local<'tcx>(
// & expression, and its lifetime would be extended to the end of the block (due
// to a different rule, not the below code).
match pat.kind {
PatKind::Binding(hir::BindingMode(hir::ByRef::Yes(_), _), ..) => true,
PatKind::Binding(hir::BindingMode(hir::ByRef::Yes(..), _), ..) => true,

PatKind::Struct(_, field_pats, _) => field_pats.iter().any(|fp| is_binding_pat(fp.pat)),

Expand Down
24 changes: 23 additions & 1 deletion compiler/rustc_hir_analysis/src/impl_wf_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ use std::assert_matches::debug_assert_matches;

use min_specialization::check_min_specialization;
use rustc_data_structures::fx::FxHashSet;
use rustc_errors::Applicability;
use rustc_errors::codes::*;
use rustc_hir::def::DefKind;
use rustc_hir::def_id::LocalDefId;
use rustc_middle::ty::{self, TyCtxt, TypeVisitableExt};
use rustc_span::ErrorGuaranteed;
use rustc_span::{ErrorGuaranteed, kw};

use crate::constrained_generic_params as cgp;
use crate::errors::UnconstrainedGenericParameter;
Expand Down Expand Up @@ -150,6 +151,27 @@ pub(crate) fn enforce_impl_lifetime_params_are_constrained(
const_param_note2: false,
});
diag.code(E0207);
for p in &impl_generics.own_params {
if p.name == kw::UnderscoreLifetime {
let span = tcx.def_span(p.def_id);
let Ok(snippet) = tcx.sess.source_map().span_to_snippet(span) else {
continue;
};

let (span, sugg) = if &snippet == "'_" {
(span, param.name.to_string())
} else {
(span.shrink_to_hi(), format!("{} ", param.name))
};
diag.span_suggestion_verbose(
span,
"consider using the named lifetime here instead of an implicit \
lifetime",
sugg,
Applicability::MaybeIncorrect,
);
}
}
res = Err(diag.emit());
}
}
Expand Down
7 changes: 6 additions & 1 deletion compiler/rustc_hir_pretty/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1925,10 +1925,15 @@ impl<'a> State<'a> {
if mutbl.is_mut() {
self.word_nbsp("mut");
}
if let ByRef::Yes(rmutbl) = by_ref {
if let ByRef::Yes(pinnedness, rmutbl) = by_ref {
self.word_nbsp("ref");
if pinnedness.is_pinned() {
self.word_nbsp("pin");
}
if rmutbl.is_mut() {
self.word_nbsp("mut");
} else if pinnedness.is_pinned() {
self.word_nbsp("const");
}
}
self.print_ident(ident);
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_hir_typeck/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ hir_typeck_pass_to_variadic_function = can't pass `{$ty}` to variadic function
.suggestion = cast the value to `{$cast_ty}`
.teach_help = certain types, like `{$ty}`, must be cast before passing them to a variadic function to match the implicit cast that a C compiler would perform as part of C's numeric promotion rules

hir_typeck_project_on_non_pin_project_type = cannot project on type that is not `#[pin_v2]`
.note = type defined here
.suggestion = add `#[pin_v2]` here

hir_typeck_ptr_cast_add_auto_to_object = cannot add {$traits_len ->
[1] auto trait {$traits}
*[other] auto traits {$traits}
Expand Down
Loading
Loading