Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
97f3b66
Add regression test for parenthesized raw borrow suggestions
chenyukang Aug 28, 2026
ec711b9
Preserve parentheses in raw borrow suggestions
chenyukang Aug 28, 2026
a757a13
Avoid suggesting closures when captures cross associated item boundaries
kulinsky Sep 15, 2026
f330047
Add COFF support to -Zstaticlib-rename-internal-symbols
cezarbbb Aug 7, 2026
c654d4d
label the path segment that is not an associated item of the trait
Albab-Hasan Sep 20, 2026
65dd911
Use span context for enclosing item(s) of unmet bound
estebank Sep 20, 2026
13c1957
Move some rustdoc-html tests into the right folder
GuillaumeGomez Sep 20, 2026
132e321
Point at `impl` start
estebank Sep 20, 2026
22dee8f
Fix test
estebank Sep 20, 2026
23ba1fa
Convert `create_err(e).emit()` occurrences to `emit_err(e)`
nnethercote Sep 20, 2026
30b8dfc
Remove `G` generic param from `Diag<'_, G>`
nnethercote Sep 10, 2026
df1b5c9
`f16b` Implementation and documentation
Jamesbarford Sep 21, 2026
cdde2f0
Add `F16B` to `Float` enum & wireup trivial matches
Jamesbarford Sep 21, 2026
c56a991
Wire up f16b in backends
Jamesbarford Sep 21, 2026
bec4db6
Update Tidy rules to allow for `//@ revision`
Jamesbarford Sep 21, 2026
e130380
Update and write tests
Jamesbarford Sep 21, 2026
fe048b6
Only AArch64 `has_reliable_f16b` presently due to an LLVM codegen iss…
Jamesbarford Sep 21, 2026
5abfe0f
Add a README in `tests/rustdoc-html` to explain what each folder cont…
GuillaumeGomez Sep 20, 2026
93bcb0f
Add tidy check for `rustdoc-html/README.md`
GuillaumeGomez Sep 21, 2026
45490f8
Implement Allocator for Pin unstably
maxdexh Sep 21, 2026
32e1cf8
remove old solver use of `SolverRelating`
lcnr Sep 21, 2026
a7be294
Rollup merge of #163083 - nnethercote:rm-Diag-G, r=oli-obk
JonathanBrouwer Sep 21, 2026
2b1343d
Rollup merge of #160679 - cezarbbb:staticlib-rename-coff, r=bjorn3
JonathanBrouwer Sep 21, 2026
e1b8be2
Rollup merge of #160859 - Jamesbarford:feat/fb16-pt1, r=folkertdev,tg…
JonathanBrouwer Sep 21, 2026
8085033
Rollup merge of #162007 - chenyukang:yukang-fix-161693-raw-borrow-rus…
JonathanBrouwer Sep 21, 2026
0c365b0
Rollup merge of #162821 - kulinsky:fix-153363-closure-suggestion, r=m…
JonathanBrouwer Sep 21, 2026
8c5a762
Rollup merge of #163057 - estebank:required-bound-context, r=oli-obk
JonathanBrouwer Sep 21, 2026
c588cdb
Rollup merge of #163070 - Albab-Hasan:label-unresolved-trait-assoc-it…
JonathanBrouwer Sep 21, 2026
924c479
Rollup merge of #163078 - GuillaumeGomez:rustdoc-html-readme, r=Urgau
JonathanBrouwer Sep 21, 2026
6b46e51
Rollup merge of #163107 - maxdexh:pin-allocator, r=clarfonthey
JonathanBrouwer Sep 21, 2026
2ecfd69
Rollup merge of #163108 - lcnr:solver-relating-only-next, r=oli-obk
JonathanBrouwer Sep 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion compiler/rustc_abi/src/layout/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ impl<'a, Ty> TyAndLayout<'a, Ty> {
Primitive::Float(float @ (Float::F16 | Float::F32 | Float::F64 | Float::F128)) => {
Some(Numeric::Float(float))
}
Primitive::Pointer(..) => None,
Primitive::Pointer(..) | Primitive::Float(Float::F16B) => None,
}
}

Expand Down
12 changes: 9 additions & 3 deletions compiler/rustc_abi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,8 @@ pub enum TargetDataLayoutError<'a> {
}

#[cfg(feature = "nightly")]
impl<G> Diagnostic<'_, G> for TargetDataLayoutError<'_> {
fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
impl Diagnostic<'_> for TargetDataLayoutError<'_> {
fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_> {
match self {
TargetDataLayoutError::InvalidAddressSpace { addr_space, err, cause } => {
Diag::new(dcx, level, msg!("invalid address space `{$addr_space}` for `{$cause}` in \"data-layout\": {$err}"))
Expand Down Expand Up @@ -1420,6 +1420,10 @@ impl Integer {
#[cfg_attr(feature = "nightly", derive(StableHash))]
pub enum Float {
F16,
/// `f16b`. This is not a builtin type in Rust (it is exposed as a lang item),
/// but it is a builtin type in LLVM so needs to be explicitly represented
/// in the backend.
F16B,
F32,
F64,
F128,
Expand All @@ -1431,6 +1435,7 @@ impl Float {

match self {
F16 => Size::from_bits(16),
F16B => Size::from_bits(16),
F32 => Size::from_bits(32),
F64 => Size::from_bits(64),
F128 => Size::from_bits(128),
Expand All @@ -1442,7 +1447,7 @@ impl Float {
let dl = cx.data_layout();

AbiAlign::new(match self {
F16 => dl.f16_align,
F16 | F16B => dl.f16_align,
F32 => dl.f32_align,
F64 => dl.f64_align,
F128 => dl.f128_align,
Expand All @@ -1454,6 +1459,7 @@ impl Float {

match self {
F16 => "f16",
F16B => "f16b",
F32 => "f32",
F64 => "f64",
F128 => "f128",
Expand Down
10 changes: 4 additions & 6 deletions compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1759,12 +1759,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
if !self.tcx.is_descendant_of(parent_module, did) {
// If the restriction path is not an ancestor of the item,
// emit an error and recover by lowering the restriction to `Unrestricted`.
self.dcx()
.create_err(RestrictionAncestorOnly {
span: path.span,
kind: resolving_kind,
})
.emit();
self.dcx().emit_err(RestrictionAncestorOnly {
span: path.span,
kind: resolving_kind,
});
hir::RestrictionKind::Unrestricted
} else {
hir::RestrictionKind::Restricted(self.arena.alloc(hir::Path {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1751,7 +1751,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
},
feature,
)
.emit();
.emit_err();
hir::TyKind::Err(guar)
}
ImplTraitContext::Disallowed(position) => {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_passes/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ pub(crate) struct EmptyLabelManySpans(pub Vec<Span>);

// The derive for `Vec<Span>` does multiple calls to `span_label`, adding commas between each
impl Subdiagnostic for EmptyLabelManySpans {
fn add_to_diag<G>(self, diag: &mut Diag<'_, G>) {
fn add_to_diag(self, diag: &mut Diag<'_>) {
diag.span_labels(self.0, "");
}
}
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_attr_ir/src/lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ language_item_table! {
PartialEq, sym::eq, eq_trait, Target::Trait, GenericRequirement::Exact(1);
PartialOrd, sym::partial_ord, partial_ord_trait, Target::Trait, GenericRequirement::Exact(1);
CVoid, sym::c_void, c_void, Target::Enum, GenericRequirement::None;
F16B, sym::f16b, f16b, Target::Struct, GenericRequirement::Exact(0);

Type, sym::type_info, type_struct, Target::Struct, GenericRequirement::None;
TypeGeneric, sym::type_info_generic, type_generic, Target::Enum, GenericRequirement::None;
Expand Down
12 changes: 6 additions & 6 deletions compiler/rustc_attr_parsing/src/attributes/cfg_select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ pub fn parse_cfg_select(
let mut branches = CfgSelectBranches::default();

while p.token != token::Eof {
p.recover_from_outer_attributes("`cfg_select` branches").map_err(|e| e.emit())?;
p.recover_from_outer_attributes("`cfg_select` branches").map_err(|e| e.emit_err())?;

if p.eat_keyword(exp!(Underscore)) {
let underscore = p.prev_token;
p.expect(exp!(FatArrow)).map_err(|e| e.emit())?;
p.expect(exp!(FatArrow)).map_err(|e| e.emit_err())?;

let tts = p.parse_cfg_select_branch_rhs().map_err(|e| e.emit())?;
let tts = p.parse_cfg_select_branch_rhs().map_err(|e| e.emit_err())?;
let span = underscore.span.to(p.token.span);

match branches.wildcard {
Expand All @@ -110,7 +110,7 @@ pub fn parse_cfg_select(
ShouldEmit::ErrorsAndLints { recovery: Recovery::Allowed },
AllowExprMetavar::Yes,
)
.map_err(|diag| diag.emit())?;
.map_err(|diag| diag.emit_err())?;
let cfg_span = meta.span();
let cfg = AttributeParser::parse_single_args(
sess,
Expand All @@ -132,9 +132,9 @@ pub fn parse_cfg_select(
&AttributeTemplate::default(),
)?;

p.expect(exp!(FatArrow)).map_err(|e| e.emit())?;
p.expect(exp!(FatArrow)).map_err(|e| e.emit_err())?;

let tts = p.parse_cfg_select_branch_rhs().map_err(|e| e.emit())?;
let tts = p.parse_cfg_select_branch_rhs().map_err(|e| e.emit_err())?;
let span = cfg_span.to(p.token.span);

match branches.wildcard {
Expand Down
10 changes: 5 additions & 5 deletions compiler/rustc_attr_parsing/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ impl<'f, 'sess: 'f> SharedContext<'f, 'sess> {
pub(crate) fn emit_lint(
&mut self,
lint: &'static Lint,
diagnostic: impl for<'x> Diagnostic<'x, ()> + DynSend + DynSync + 'static,
diagnostic: impl for<'x> Diagnostic<'x> + DynSend + DynSync + 'static,
span: impl Into<MultiSpan>,
) {
self.emit_lint_inner(
Expand All @@ -429,7 +429,7 @@ impl<'f, 'sess: 'f> SharedContext<'f, 'sess> {
}

pub(crate) fn emit_lint_with_sess<
F: for<'a> FnOnce(DiagCtxtHandle<'a>, Level, &Session) -> Diag<'a, ()>
F: for<'a> FnOnce(DiagCtxtHandle<'a>, Level, &Session) -> Diag<'a>
+ DynSend
+ DynSync
+ 'static,
Expand Down Expand Up @@ -895,9 +895,9 @@ pub enum ShouldEmit {
impl ShouldEmit {
pub(crate) fn emit_err(self, diag: Diag<'_>) -> ErrorGuaranteed {
match self {
ShouldEmit::EarlyFatal { .. } if diag.level() == Level::DelayedBug => diag.emit(),
ShouldEmit::EarlyFatal { .. } => diag.upgrade_to_fatal().emit(),
ShouldEmit::ErrorsAndLints { .. } => diag.emit(),
ShouldEmit::EarlyFatal { .. } if diag.level() == Level::DelayedBug => diag.emit_err(),
ShouldEmit::EarlyFatal { .. } => diag.upgrade_to_fatal().emit_fatal(),
ShouldEmit::ErrorsAndLints { .. } => diag.emit_err(),
ShouldEmit::Nothing => diag.delay_as_bug(),
}
}
Expand Down
14 changes: 7 additions & 7 deletions compiler/rustc_attr_parsing/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1476,9 +1476,9 @@ pub(crate) enum AttributeParseErrorSuggestions {
}

impl<'a> AttributeParseError<'a> {
fn render_expected_specific_argument<G>(
fn render_expected_specific_argument(
&self,
diag: &mut Diag<'_, G>,
diag: &mut Diag<'_>,
possibilities: &[Symbol],
strings: bool,
) {
Expand Down Expand Up @@ -1509,9 +1509,9 @@ impl<'a> AttributeParseError<'a> {
}
}

fn render_expected_specific_argument_list<G>(
fn render_expected_specific_argument_list(
&self,
diag: &mut Diag<'_, G>,
diag: &mut Diag<'_>,
possibilities: &[Symbol],
strings: bool,
) {
Expand Down Expand Up @@ -1543,7 +1543,7 @@ impl<'a> AttributeParseError<'a> {
}
}

fn render_suggestions<G>(&self, diag: &mut Diag<'_, G>) {
fn render_suggestions(&self, diag: &mut Diag<'_>) {
let description = self.description();

match &self.suggestions {
Expand Down Expand Up @@ -1592,8 +1592,8 @@ impl AttributeParseErrorSuggestions {
}
}

impl<'a, G> Diagnostic<'a, G> for AttributeParseError<'_> {
fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> {
impl<'a> Diagnostic<'a> for AttributeParseError<'_> {
fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a> {
let name = self.path.to_string();

let description = self.description();
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_attr_parsing/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use crate::{AttributeTemplate, ShouldEmit};

pub struct EmitAttribute(
pub Box<
dyn for<'a> FnOnce(DiagCtxtHandle<'a>, Level, &Session) -> Diag<'a, ()>
dyn for<'a> FnOnce(DiagCtxtHandle<'a>, Level, &Session) -> Diag<'a>
+ DynSend
+ DynSync
+ 'static,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_attr_parsing/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ fn expr_to_lit<'sess>(
let lit = MetaItemLit {
symbol: token_lit.symbol,
suffix: token_lit.suffix,
kind: LitKind::Err(err.emit()),
kind: LitKind::Err(err.emit_err()),
span: expr.span,
};
Ok(Some(lit))
Expand Down
16 changes: 8 additions & 8 deletions compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ impl<'tcx> BorrowExplanation<'tcx> {
pub(crate) fn is_explained(&self) -> bool {
!matches!(self, BorrowExplanation::Unexplained)
}
pub(crate) fn add_explanation_to_diagnostic<G>(
pub(crate) fn add_explanation_to_diagnostic(
&self,
cx: &MirBorrowckCtxt<'_, '_, 'tcx>,
err: &mut Diag<'_, G>,
err: &mut Diag<'_>,
borrow_desc: &str,
borrow_span: Option<Span>,
multiple_borrow_span: Option<(Span, Span)>,
Expand Down Expand Up @@ -437,10 +437,10 @@ impl<'tcx> BorrowExplanation<'tcx> {
}
}

fn add_object_lifetime_default_note<G>(
fn add_object_lifetime_default_note(
&self,
tcx: TyCtxt<'tcx>,
err: &mut Diag<'_, G>,
err: &mut Diag<'_>,
unsize_ty: Ty<'tcx>,
) {
if let ty::Adt(def, args) = unsize_ty.kind() {
Expand Down Expand Up @@ -494,9 +494,9 @@ impl<'tcx> BorrowExplanation<'tcx> {
}
}

fn add_lifetime_bound_suggestion_to_diagnostic<G>(
fn add_lifetime_bound_suggestion_to_diagnostic(
&self,
err: &mut Diag<'_, G>,
err: &mut Diag<'_>,
category: &ConstraintCategory<'tcx>,
span: Span,
region_name: &RegionName,
Expand All @@ -523,14 +523,14 @@ impl<'tcx> BorrowExplanation<'tcx> {
}
}

fn suggest_rewrite_if_let<G>(
fn suggest_rewrite_if_let(
tcx: TyCtxt<'_>,
expr: &hir::Expr<'_>,
pat: &str,
init: &hir::Expr<'_>,
conseq: &hir::Expr<'_>,
alt: Option<&hir::Expr<'_>>,
err: &mut Diag<'_, G>,
err: &mut Diag<'_>,
) {
let source_map = tcx.sess.source_map();
err.span_note(
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_borrowck/src/diagnostics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -642,9 +642,9 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
///
/// This is very similar to `fn suggest_static_lifetime_for_gat_from_hrtb` which handles this
/// note for failed type tests instead of outlives errors.
fn add_placeholder_from_predicate_note<G>(
fn add_placeholder_from_predicate_note(
&self,
diag: &mut Diag<'_, G>,
diag: &mut Diag<'_>,
path: &[OutlivesConstraint<'tcx>],
) {
let tcx = self.infcx.tcx;
Expand Down Expand Up @@ -704,9 +704,9 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {

/// Add a label to region errors and borrow explanations when outlives constraints arise from
/// proving a type implements `Sized` or `Copy`.
fn add_sized_or_copy_bound_info<G>(
fn add_sized_or_copy_bound_info(
&self,
err: &mut Diag<'_, G>,
err: &mut Diag<'_>,
blamed_category: ConstraintCategory<'tcx>,
path: &[OutlivesConstraint<'tcx>],
) {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/diagnostics/opaque_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl<'diag, 'tcx> MirBorrowckCtxt<'_, 'diag, 'tcx> {
{
last_unexpected_hidden_region =
Some((hidden_type.span, named_ty, named_key));
diag.emit()
diag.emit_err()
} else {
diag.delay_as_bug()
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/diagnostics/region_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl RegionName {
}
}

pub(crate) fn highlight_region_name<G>(&self, diag: &mut Diag<'_, G>) {
pub(crate) fn highlight_region_name(&self, diag: &mut Diag<'_>) {
match &self.source {
RegionNameSource::NamedLateParamRegion(span)
| RegionNameSource::NamedEarlyParamRegion(span) => {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/region_infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
}

/// Adds annotations for `#[rustc_regions]`; see `UniversalRegions::annotate`.
pub(crate) fn annotate(&self, tcx: TyCtxt<'tcx>, err: &mut Diag<'_, ()>) {
pub(crate) fn annotate(&self, tcx: TyCtxt<'tcx>, err: &mut Diag<'_>) {
self.universal_regions().annotate(tcx, err)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ fn add_hidden_type<'tcx>(
prev.span = prev.span.substitute_dummy(hidden_ty.span);
} else {
let (Ok(guar) | Err(guar)) =
prev.build_mismatch_error(&hidden_ty, tcx).map(|d| d.emit());
prev.build_mismatch_error(&hidden_ty, tcx).map(|d| d.emit_err());
*prev = ty::DefinitionSiteHiddenType::new_error(tcx, guar);
}
} else {
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_borrowck/src/session_diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -659,13 +659,13 @@ pub(crate) struct SimdIntrinsicArgConst {
pub intrinsic: String,
}

pub(crate) struct TailExprDropOrder<F: FnOnce(&mut Diag<'_, ()>)> {
pub(crate) struct TailExprDropOrder<F: FnOnce(&mut Diag<'_>)> {
pub borrowed: Span,
pub callback: F,
}

impl<'a, F: FnOnce(&mut Diag<'_, ()>)> Diagnostic<'a, ()> for TailExprDropOrder<F> {
fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> {
impl<'a, F: FnOnce(&mut Diag<'_>)> Diagnostic<'a> for TailExprDropOrder<F> {
fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a> {
let Self { borrowed, callback } = self;
let mut diag = Diag::new(dcx, level, "relative drop order changing in Rust 2024")
.with_span_label(
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/universal_regions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ impl<'tcx> UniversalRegions<'tcx> {
/// that this region imposes on others. The methods in this file
/// handle the part about dumping the inference context internal
/// state.
pub(crate) fn annotate(&self, tcx: TyCtxt<'tcx>, err: &mut Diag<'_, ()>) {
pub(crate) fn annotate(&self, tcx: TyCtxt<'tcx>, err: &mut Diag<'_>) {
match self.defining_ty {
DefiningTy::Closure(def_id, args) => {
let v = with_no_trimmed_paths!(
Expand Down
Loading
Loading