Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
175d963
Constify fold, reduce and last for iterator
Randl Jan 31, 2026
7f53271
Suggest similar keyword when visibility is not followed by an item
FranciscoTGouveia Mar 29, 2026
b994a05
Fix pattern assignment suggestions for uninitialized bindings
chenyukang Apr 1, 2026
e70561b
Move some thin local LTO handling to start_executing_work
bjorn3 Feb 12, 2026
cee57cc
Handle lto_import_only_modules for fat LTO earlier
bjorn3 Feb 15, 2026
ed16e62
Introduce ThinLtoInput
bjorn3 Feb 13, 2026
f08aa80
Inline Linker type
bjorn3 Feb 24, 2026
3303a26
Slightly improve comment in produce_final_output_artifacts
bjorn3 Mar 3, 2026
3569377
Fix ICE in unsafe binder discriminant queries
cijiugechu Apr 2, 2026
65b88ea
fix(lints): Improve ill_formed_attribute_input with better help message
JayanAXHF Apr 5, 2026
c88ef81
Promote `char::is_case_ignorable` from perma-unstable to unstable
Jules-Bertholet Apr 1, 2026
c3709ee
ast_validation: scalable vectors okay for rustdoc
davidtwco Apr 3, 2026
e84576a
`#[cfg]`: add test for "`target_` value is used for another `target_`"
scrabsha Apr 2, 2026
1d79216
`#[cfg]`: suggest alternative `target_` name when the value does not …
scrabsha Apr 2, 2026
5f8b828
Rollup merge of #153440 - bjorn3:lto_refactors13, r=TaKO8Ki
JonathanBrouwer Apr 6, 2026
e6ea1ae
Rollup merge of #151899 - Randl:const-iter-fold, r=oli-obk
JonathanBrouwer Apr 6, 2026
77a5cb0
Rollup merge of #154561 - FranciscoTGouveia:typo-detection-after-visi…
JonathanBrouwer Apr 6, 2026
0a46f82
Rollup merge of #154657 - chenyukang:yukang-fix-145564-pattern-assign…
JonathanBrouwer Apr 6, 2026
a89a5aa
Rollup merge of #154717 - cijiugechu:fix/unsafe-binder-discriminant, …
JonathanBrouwer Apr 6, 2026
9a9ea5d
Rollup merge of #154722 - JayanAXHF:fix/update-ignore-error-message, …
JonathanBrouwer Apr 6, 2026
cbe9c4d
Rollup merge of #154777 - scrabsha:push-nunzyzrqlwqw, r=jdonszelmann
JonathanBrouwer Apr 6, 2026
6bf2ce0
Rollup merge of #154849 - Jules-Bertholet:case-ignorable, r=Mark-Simu…
JonathanBrouwer Apr 6, 2026
ec78f91
Rollup merge of #154850 - davidtwco:scalable-vectors-rustdoc, r=Jonat…
JonathanBrouwer Apr 6, 2026
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
4 changes: 3 additions & 1 deletion compiler/rustc_ast_passes/src/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1379,7 +1379,9 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
this.dcx()
.emit_err(errors::ScalableVectorNotTupleStruct { span: item.span });
}
if !self.sess.target.arch.supports_scalable_vectors() {
if !self.sess.target.arch.supports_scalable_vectors()
&& !self.sess.opts.actually_rustdoc
{
this.dcx().emit_err(errors::ScalableVectorBadArch { span: attr.span });
}
}
Expand Down
6 changes: 5 additions & 1 deletion compiler/rustc_attr_parsing/src/attributes/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,11 @@ impl DocParser {
let span = cx.attr_span;
cx.emit_lint(
rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES,
AttributeLintKind::IllFormedAttributeInput { suggestions, docs: None },
AttributeLintKind::IllFormedAttributeInput {
suggestions,
docs: None,
help: None,
},
span,
);
}
Expand Down
11 changes: 9 additions & 2 deletions compiler/rustc_attr_parsing/src/attributes/test_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,15 @@ impl<S: Stage> SingleAttributeParser<S> for IgnoreParser {
};
Some(str_value)
}
ArgParser::List(_) => {
cx.adcx().warn_ill_formed_attribute_input(ILL_FORMED_ATTRIBUTE_INPUT);
ArgParser::List(list) => {
let help = list.single().and_then(|item| item.meta_item()).and_then(|item| {
item.args().no_args().ok()?;
Some(item.path().to_string())
});
cx.adcx().warn_ill_formed_attribute_input_with_help(
ILL_FORMED_ATTRIBUTE_INPUT,
help,
);
return None;
}
},
Expand Down
9 changes: 8 additions & 1 deletion compiler/rustc_attr_parsing/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -830,11 +830,18 @@ where
}

pub(crate) fn warn_ill_formed_attribute_input(&mut self, lint: &'static Lint) {
self.warn_ill_formed_attribute_input_with_help(lint, None)
}
pub(crate) fn warn_ill_formed_attribute_input_with_help(
&mut self,
lint: &'static Lint,
help: Option<String>,
) {
let suggestions = self.suggestions();
let span = self.attr_span;
self.emit_lint(
lint,
AttributeLintKind::IllFormedAttributeInput { suggestions, docs: None },
AttributeLintKind::IllFormedAttributeInput { suggestions, docs: None, help },
span,
);
}
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_attr_parsing/src/validate_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ fn emit_malformed_attribute(
BuiltinLintDiag::AttributeLint(AttributeLintKind::IllFormedAttributeInput {
suggestions: suggestions.clone(),
docs: template.docs,
help: None,
}),
);
} else {
Expand Down
24 changes: 16 additions & 8 deletions compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -914,32 +914,36 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
if show_assign_sugg {
struct LetVisitor {
decl_span: Span,
sugg_span: Option<Span>,
sugg: Option<(Span, bool)>,
}

impl<'v> Visitor<'v> for LetVisitor {
fn visit_stmt(&mut self, ex: &'v hir::Stmt<'v>) {
if self.sugg_span.is_some() {
if self.sugg.is_some() {
return;
}

// FIXME: We make sure that this is a normal top-level binding,
// but we could suggest `todo!()` for all uninitialized bindings in the pattern
if let hir::StmtKind::Let(hir::LetStmt { span, ty, init: None, pat, .. }) =
&ex.kind
&& let hir::PatKind::Binding(..) = pat.kind
&& let hir::PatKind::Binding(binding_mode, ..) = pat.kind
&& span.contains(self.decl_span)
{
self.sugg_span = ty.map_or(Some(self.decl_span), |ty| Some(ty.span));
// Insert after the whole binding pattern so suggestions stay valid for
// bindings with `@` subpatterns like `ref mut x @ v`.
let strip_ref = matches!(binding_mode.0, hir::ByRef::Yes(..));
self.sugg =
ty.map_or(Some((pat.span, strip_ref)), |ty| Some((ty.span, strip_ref)));
}
hir::intravisit::walk_stmt(self, ex);
}
}

let mut visitor = LetVisitor { decl_span, sugg_span: None };
let mut visitor = LetVisitor { decl_span, sugg: None };
visitor.visit_body(&body);
if let Some(span) = visitor.sugg_span {
self.suggest_assign_value(&mut err, moved_place, span);
if let Some((span, strip_ref)) = visitor.sugg {
self.suggest_assign_value(&mut err, moved_place, span, strip_ref);
}
}
err
Expand All @@ -950,8 +954,12 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
err: &mut Diag<'_>,
moved_place: PlaceRef<'tcx>,
sugg_span: Span,
strip_ref: bool,
) {
let ty = moved_place.ty(self.body, self.infcx.tcx).ty;
let mut ty = moved_place.ty(self.body, self.infcx.tcx).ty;
if strip_ref && let ty::Ref(_, inner, _) = ty.kind() {
ty = *inner;
}
debug!("ty: {:?}, kind: {:?}", ty, ty.kind());

let Some(assign_value) = self.infcx.err_ctxt().ty_kind_suggestion(self.infcx.param_env, ty)
Expand Down
59 changes: 26 additions & 33 deletions compiler/rustc_codegen_gcc/src/back/lto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ use rustc_data_structures::memmap::Mmap;
use rustc_data_structures::profiling::SelfProfilerRef;
use rustc_errors::{DiagCtxt, DiagCtxtHandle};
use rustc_log::tracing::info;
use rustc_session::config::Lto;
use tempfile::{TempDir, tempdir};

use crate::back::write::{codegen, save_temp_bitcode};
Expand All @@ -45,11 +44,7 @@ struct LtoData {
tmp_path: TempDir,
}

fn prepare_lto(
cgcx: &CodegenContext,
each_linked_rlib_for_lto: &[PathBuf],
dcx: DiagCtxtHandle<'_>,
) -> LtoData {
fn prepare_lto(each_linked_rlib_for_lto: &[PathBuf], dcx: DiagCtxtHandle<'_>) -> LtoData {
let tmp_path = match tempdir() {
Ok(tmp_path) => tmp_path,
Err(error) => {
Expand All @@ -64,32 +59,30 @@ fn prepare_lto(
// We save off all the bytecode and GCC module file path for later processing
// with either fat or thin LTO
let mut upstream_modules = Vec::new();
if cgcx.lto != Lto::ThinLocal {
for path in each_linked_rlib_for_lto {
let archive_data = unsafe {
Mmap::map(File::open(path).expect("couldn't open rlib")).expect("couldn't map rlib")
};
let archive = ArchiveFile::parse(&*archive_data).expect("wanted an rlib");
let obj_files = archive
.members()
.filter_map(|child| {
child.ok().and_then(|c| {
std::str::from_utf8(c.name()).ok().map(|name| (name.trim(), c))
})
})
.filter(|&(name, _)| looks_like_rust_object_file(name));
for (name, child) in obj_files {
info!("adding bitcode from {}", name);
let path = tmp_path.path().join(name);
match save_as_file(child.data(&*archive_data).expect("corrupt rlib"), &path) {
Ok(()) => {
let buffer = ModuleBuffer::new(path);
let module = SerializedModule::Local(buffer);
upstream_modules.push((module, CString::new(name).unwrap()));
}
Err(e) => {
dcx.emit_fatal(e);
}
for path in each_linked_rlib_for_lto {
let archive_data = unsafe {
Mmap::map(File::open(path).expect("couldn't open rlib")).expect("couldn't map rlib")
};
let archive = ArchiveFile::parse(&*archive_data).expect("wanted an rlib");
let obj_files = archive
.members()
.filter_map(|child| {
child
.ok()
.and_then(|c| std::str::from_utf8(c.name()).ok().map(|name| (name.trim(), c)))
})
.filter(|&(name, _)| looks_like_rust_object_file(name));
for (name, child) in obj_files {
info!("adding bitcode from {}", name);
let path = tmp_path.path().join(name);
match save_as_file(child.data(&*archive_data).expect("corrupt rlib"), &path) {
Ok(()) => {
let buffer = ModuleBuffer::new(path);
let module = SerializedModule::Local(buffer);
upstream_modules.push((module, CString::new(name).unwrap()));
}
Err(e) => {
dcx.emit_fatal(e);
}
}
}
Expand All @@ -115,7 +108,7 @@ pub(crate) fn run_fat(
) -> CompiledModule {
let dcx = DiagCtxt::new(Box::new(shared_emitter.clone()));
let dcx = dcx.handle();
let lto_data = prepare_lto(cgcx, each_linked_rlib_for_lto, dcx);
let lto_data = prepare_lto(each_linked_rlib_for_lto, dcx);
/*let symbols_below_threshold =
lto_data.symbols_below_threshold.iter().map(|c| c.as_ptr()).collect::<Vec<_>>();*/
fat_lto(
Expand Down
7 changes: 3 additions & 4 deletions compiler/rustc_codegen_gcc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ use gccjit::{CType, Context, OptimizationLevel};
#[cfg(feature = "master")]
use gccjit::{TargetInfo, Version};
use rustc_ast::expand::allocator::AllocatorMethod;
use rustc_codegen_ssa::back::lto::{SerializedModule, ThinModule};
use rustc_codegen_ssa::back::lto::ThinModule;
use rustc_codegen_ssa::back::write::{
CodegenContext, FatLtoInput, ModuleConfig, SharedEmitter, TargetMachineFactoryFn,
CodegenContext, FatLtoInput, ModuleConfig, SharedEmitter, TargetMachineFactoryFn, ThinLtoInput,
};
use rustc_codegen_ssa::base::codegen_crate;
use rustc_codegen_ssa::target_features::cfg_target_feature;
Expand Down Expand Up @@ -449,8 +449,7 @@ impl WriteBackendMethods for GccCodegenBackend {
// FIXME(bjorn3): Limit LTO exports to these symbols
_exported_symbols_for_lto: &[String],
_each_linked_rlib_for_lto: &[PathBuf],
_modules: Vec<(String, Self::ModuleBuffer)>,
_cached_modules: Vec<(SerializedModule<Self::ModuleBuffer>, WorkProduct)>,
_modules: Vec<ThinLtoInput<Self>>,
) -> (Vec<ThinModule<Self>>, Vec<WorkProduct>) {
unreachable!()
}
Expand Down
Loading
Loading