Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4a5a715
Avoid building `Canonicalizer` unnecessarily in `canonicalize_response`
nnethercote Nov 6, 2026
79195a2
Inline and remove `canonicalize_param_env`
nnethercote Nov 6, 2026
ca1554c
Early return in `canonicalize_input`
nnethercote Nov 6, 2026
942135b
Remove bool arg from `do_env_and_make_rest`
nnethercote Nov 6, 2026
d7064be
Factor out repetitive code
nnethercote Nov 6, 2026
e6d76cd
Remove unnecessary mut from HirIdValidator::check_nested_id
yassa-tamer Nov 10, 2026
5f413f0
std: map more errno values to ErrorKind on Hermit
stlankes Nov 10, 2026
e982cc3
std Miri testing: use skip_unsupported_miri_tests to control when tes…
RalfJung Oct 29, 2026
2b46ddd
make improper_ctypes accept x87_f80
folkertdev Nov 10, 2026
c22a287
Wrap proc-macro `EscapeError` enum into a struct
GuillaumeGomez Nov 10, 2026
bd7688c
Fix incorrect span to point at private item that should be marked `pub`
estebank Oct 12, 2026
43c52bd
Provide more context for private re-exported items
estebank Oct 12, 2026
bef8da0
Tweak wording when encountering private variants
estebank Nov 9, 2026
745d7cc
Normalize "beta release channel" in `const-supertrait-unstable` test
cuviper Nov 9, 2026
886a3f1
In irrefutable patterns, the FieldPat is skipped, which means the nam…
AlexCeleste Nov 11, 2026
332e93b
Rollup merge of #165117 - RalfJung:skip_missing_miri_shims, r=maxdexh
Zalathar Nov 11, 2026
5847dea
Rollup merge of #165727 - cuviper:const-supertrait-unstable-beta, r=K…
Zalathar Nov 11, 2026
b220058
Rollup merge of #165750 - GuillaumeGomez:escape-error-struct, r=progr…
Zalathar Nov 11, 2026
28e8e1b
Rollup merge of #164218 - estebank:priv-span-fix, r=tiif
Zalathar Nov 11, 2026
e6d6a84
Rollup merge of #165021 - AlexCeleste:thir-missing-fieldpat-names, r=…
Zalathar Nov 11, 2026
e599087
Rollup merge of #165537 - nnethercote:canonicalization-micro-opts, r=…
Zalathar Nov 11, 2026
348d71f
Rollup merge of #165772 - yassa-tamer:remove-unnecessary-mut, r=Jonat…
Zalathar Nov 11, 2026
49c016e
Rollup merge of #165779 - folkertdev:x87_f80-improper-ctypes, r=beetrees
Zalathar Nov 11, 2026
979a911
Rollup merge of #165780 - stlankes:error, r=maxdexh
Zalathar Nov 11, 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_lint/src/types/improper_ctypes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,9 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
}
match def.adt_kind() {
AdtKind::Struct | AdtKind::Union => {
if tcx.is_lang_item(def.did(), LangItem::PpcF128) {
if tcx.is_lang_item(def.did(), LangItem::PpcF128)
|| tcx.is_lang_item(def.did(), LangItem::X87F80)
{
return FfiResult::FfiSafe;
}
if let Some(sym::cstring_type | sym::cstr_type) =
Expand Down
12 changes: 10 additions & 2 deletions compiler/rustc_mir_build/src/thir/print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,14 @@ impl<'a, 'tcx> ThirPrinter<'a, 'tcx> {
print_indented!(self, "}", depth_lvl);
}

fn print_field_pat(&mut self, field_pat: &FieldPat<'tcx>, depth_lvl: usize) {
print_indented!(self, "FieldPat {", depth_lvl);
print_indented!(self, format!("field: {}", field_pat.field.as_u32()), depth_lvl + 1);
print_indented!(self, "pattern:", depth_lvl + 1);
self.print_pat(&field_pat.pattern, depth_lvl + 2);
print_indented!(self, "}", depth_lvl);
}

fn print_pat_kind(&mut self, pat_kind: &PatKind<'tcx>, depth_lvl: usize) {
print_indented!(self, "kind: PatKind {", depth_lvl);

Expand Down Expand Up @@ -760,7 +768,7 @@ impl<'a, 'tcx> ThirPrinter<'a, 'tcx> {
if subpatterns.len() > 0 {
print_indented!(self, "subpatterns: [", depth_lvl + 2);
for field_pat in subpatterns.iter() {
self.print_pat(&field_pat.pattern, depth_lvl + 3);
self.print_field_pat(field_pat, depth_lvl + 3);
}
print_indented!(self, "]", depth_lvl + 2);
} else {
Expand All @@ -773,7 +781,7 @@ impl<'a, 'tcx> ThirPrinter<'a, 'tcx> {
print_indented!(self, "Leaf { ", depth_lvl + 1);
print_indented!(self, "subpatterns: [", depth_lvl + 2);
for field_pat in subpatterns.iter() {
self.print_pat(&field_pat.pattern, depth_lvl + 3);
self.print_field_pat(field_pat, depth_lvl + 3);
}
print_indented!(self, "]", depth_lvl + 2);
print_indented!(self, "}", depth_lvl + 1);
Expand Down
199 changes: 92 additions & 107 deletions compiler/rustc_next_trait_solver/src/canonical/canonicalizer.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion compiler/rustc_passes/src/hir_id_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl<'a, 'hir> HirIdValidator<'a, 'hir> {
}
}

fn check_nested_id(&mut self, id: LocalDefId) {
fn check_nested_id(&self, id: LocalDefId) {
let Some(owner) = self.owner else { return };
let def_parent = self.tcx.local_parent(id);
let def_parent_hir_id = self.tcx.local_def_id_to_hir_id(def_parent);
Expand Down
13 changes: 9 additions & 4 deletions compiler/rustc_resolve/src/diagnostics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -831,22 +831,26 @@ pub(crate) struct CannotBeReexportedCratePublic {

#[derive(Diagnostic)]
#[diag("`{$ident}` is private, and cannot be re-exported", code = E0365)]
#[note("consider declaring type or module `{$ident}` with `pub`")]
pub(crate) struct CannotBeReexportedPrivateNS {
#[primary_span]
#[label("re-export of private `{$ident}`")]
pub(crate) span: Span,
pub(crate) ident: Ident,
#[note("consider declaring {$descr} `{$ident}` with `pub`")]
pub(crate) parent: Span,
pub(crate) descr: &'static str,
}

#[derive(Diagnostic)]
#[diag("`{$ident}` is only public within the crate, and cannot be re-exported outside", code = E0365)]
#[note("consider declaring type or module `{$ident}` with `pub`")]
pub(crate) struct CannotBeReexportedCratePublicNS {
#[primary_span]
#[label("re-export of crate public `{$ident}`")]
pub(crate) span: Span,
pub(crate) ident: Ident,
#[note("consider declaring {$descr} `{$ident}` with `pub`")]
pub(crate) parent: Span,
pub(crate) descr: &'static str,
}

#[derive(Diagnostic)]
Expand Down Expand Up @@ -881,11 +885,12 @@ pub(crate) struct ConsiderMarkingAsPubCrate {
}

#[derive(Subdiagnostic)]
#[note("consider marking `{$ident}` as `pub` in the imported module")]
#[note("consider marking `{$ident}` as `pub` in the imported {$descr}")]
pub(crate) struct ConsiderMarkingAsPub {
#[primary_span]
pub(crate) span: Span,
pub(crate) span: MultiSpan,
pub(crate) ident: Ident,
pub(crate) descr: &'static str,
}

#[derive(Diagnostic)]
Expand Down
49 changes: 43 additions & 6 deletions compiler/rustc_resolve/src/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ use std::mem;
use rustc_ast::NodeId;
use rustc_data_structures::fx::{FxHashSet, FxIndexSet};
use rustc_data_structures::intern::Interned;
use rustc_errors::{Applicability, BufferedEarlyLint, Diagnostic};
use rustc_errors::{Applicability, BufferedEarlyLint, Diagnostic, MultiSpan};
use rustc_expand::base::SyntaxExtensionKind;
use rustc_hir::def::{self, DefKind};
use rustc_hir::def_id::{DefId, LocalDefId, LocalDefIdMap};
use rustc_hir::def_id::{CRATE_DEF_ID, DefId, LocalDefId, LocalDefIdMap};
use rustc_lint_defs::LintId;
use rustc_lint_defs::builtin::{
AMBIGUOUS_GLOB_REEXPORTS, EXPORTED_PRIVATE_DEPENDENCIES, HIDDEN_GLOB_REEXPORTS,
Expand All @@ -20,7 +20,7 @@ use rustc_middle::ty::Visibility;
use rustc_session::diagnostics::feature_err;
use rustc_span::edit_distance::find_best_match_for_name;
use rustc_span::hygiene::LocalExpnId;
use rustc_span::{Ident, OrdSpan, Span, Symbol, kw, span_bug, sym};
use rustc_span::{DUMMY_SP, Ident, OrdSpan, Span, Symbol, kw, span_bug, sym};
use tracing::debug;

use crate::Namespace::{self, *};
Expand Down Expand Up @@ -1685,10 +1685,24 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
diagnostic: diagnostic.into(),
});
} else if ns == TypeNS {
let def_id = decl.res().def_id();
let parent = if !def_id.is_crate_root() { self.def_span(def_id) } else { DUMMY_SP };
let descr = self.tcx().def_descr(def_id);

if crate_private_reexport {
self.dcx().emit_err(CannotBeReexportedCratePublicNS { span: import.span, ident });
self.dcx().emit_err(CannotBeReexportedCratePublicNS {
span: import.span,
ident,
parent,
descr,
});
} else {
self.dcx().emit_err(CannotBeReexportedPrivateNS { span: import.span, ident });
self.dcx().emit_err(CannotBeReexportedPrivateNS {
span: import.span,
ident,
parent,
descr,
});
}
} else {
let mut err = if crate_private_reexport {
Expand All @@ -1708,7 +1722,30 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
err.subdiagnostic(ConsiderMarkingAsPubCrate { vis_span: import.vis_span });
}
_ => {
err.subdiagnostic(ConsiderMarkingAsPub { span: import.span, ident });
let mut span: MultiSpan = decl.span.into();
let descr = if decl.is_import() {
"re-export"
} else if let Some(def_id) = decl.res().opt_def_id() {
let parent = self.tcx().parent(def_id);

if let DefKind::Variant = self.tcx().def_kind(parent) {
// We had the DefId for the variant's constructor, but we want to point at the enum.
span.push_span_context(
self.def_span(self.tcx().parent(parent)).shrink_to_lo(),
);
self.tcx().def_descr(self.tcx().parent(parent))
} else if CRATE_DEF_ID.to_def_id() != parent {
span.push_span_context(self.def_span(parent).shrink_to_lo());
self.tcx().def_descr(parent)
} else {
self.tcx().def_descr(parent)
}
} else {
// unreachable, but provide fallback just in case
debug_assert!(false, "we have a DefId in {decl:?} with no parent?");
"module"
};
err.subdiagnostic(ConsiderMarkingAsPub { span, ident, descr });
}
}
err.emit();
Expand Down
93 changes: 54 additions & 39 deletions library/proc_macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,61 @@ use crate::bridge::client::Methods as BridgeMethods;
use crate::escape::{EscapeOptions, escape_bytes};

/// Mostly relating to malformed escape sequences, but also a few other problems.
#[derive(Debug, PartialEq, Eq)]
#[unstable(feature = "proc_macro_value", issue = "136652")]
pub struct EscapeError {
kind: EscapeErrorKind,
}

#[unstable(feature = "proc_macro_value", issue = "136652")]
impl error::Error for EscapeError {}

#[unstable(feature = "proc_macro_value", issue = "136652")]
impl fmt::Display for EscapeError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(&self.kind, f)
}
}

#[unstable(feature = "proc_macro_value", issue = "136652")]
#[doc(hidden)]
impl From<rustc_literal_escaper::EscapeError> for EscapeError {
fn from(value: rustc_literal_escaper::EscapeError) -> Self {
use rustc_literal_escaper::EscapeError as EE;

let kind = match value {
EE::ZeroChars => EscapeErrorKind::ZeroChars,
EE::MoreThanOneChar => EscapeErrorKind::MoreThanOneChar,
EE::LoneSlash => EscapeErrorKind::LoneSlash,
EE::InvalidEscape => EscapeErrorKind::InvalidEscape,
EE::BareCarriageReturn => EscapeErrorKind::BareCarriageReturn,
EE::BareCarriageReturnInRawString => EscapeErrorKind::BareCarriageReturnInRawString,
EE::EscapeOnlyChar => EscapeErrorKind::EscapeOnlyChar,
EE::TooShortHexEscape => EscapeErrorKind::TooShortHexEscape,
EE::InvalidCharInHexEscape => EscapeErrorKind::InvalidCharInHexEscape,
EE::OutOfRangeHexEscape => EscapeErrorKind::OutOfRangeHexEscape,
EE::NoBraceInUnicodeEscape => EscapeErrorKind::NoBraceInUnicodeEscape,
EE::InvalidCharInUnicodeEscape => EscapeErrorKind::InvalidCharInUnicodeEscape,
EE::EmptyUnicodeEscape => EscapeErrorKind::EmptyUnicodeEscape,
EE::UnclosedUnicodeEscape => EscapeErrorKind::UnclosedUnicodeEscape,
EE::LeadingUnderscoreUnicodeEscape => EscapeErrorKind::LeadingUnderscoreUnicodeEscape,
EE::OverlongUnicodeEscape => EscapeErrorKind::OverlongUnicodeEscape,
EE::LoneSurrogateUnicodeEscape => EscapeErrorKind::LoneSurrogateUnicodeEscape,
EE::OutOfRangeUnicodeEscape => EscapeErrorKind::OutOfRangeUnicodeEscape,
EE::UnicodeEscapeInByte => EscapeErrorKind::UnicodeEscapeInByte,
EE::NonAsciiCharInByte => EscapeErrorKind::NonAsciiCharInByte,
EE::NulInCStr => EscapeErrorKind::NulInCStr,
EE::UnskippedWhitespaceWarning => EscapeErrorKind::UnskippedWhitespaceWarning,
EE::MultipleSkippedLinesWarning => EscapeErrorKind::MultipleSkippedLinesWarning,
};
Self { kind }
}
}

/// Mostly relating to malformed escape sequences, but also a few other problems.
#[derive(Debug, PartialEq, Eq)]
#[non_exhaustive]
pub enum EscapeError {
enum EscapeErrorKind {
/// Expected 1 char, but 0 were found.
ZeroChars,
/// Expected 1 char, but more than 1 were found.
Expand Down Expand Up @@ -125,45 +176,9 @@ pub enum EscapeError {
MultipleSkippedLinesWarning,
}

#[unstable(feature = "proc_macro_value", issue = "136652")]
#[doc(hidden)]
impl From<rustc_literal_escaper::EscapeError> for EscapeError {
fn from(value: rustc_literal_escaper::EscapeError) -> Self {
use rustc_literal_escaper::EscapeError as EE;

match value {
EE::ZeroChars => Self::ZeroChars,
EE::MoreThanOneChar => Self::MoreThanOneChar,
EE::LoneSlash => Self::LoneSlash,
EE::InvalidEscape => Self::InvalidEscape,
EE::BareCarriageReturn => Self::BareCarriageReturn,
EE::BareCarriageReturnInRawString => Self::BareCarriageReturnInRawString,
EE::EscapeOnlyChar => Self::EscapeOnlyChar,
EE::TooShortHexEscape => Self::TooShortHexEscape,
EE::InvalidCharInHexEscape => Self::InvalidCharInHexEscape,
EE::OutOfRangeHexEscape => Self::OutOfRangeHexEscape,
EE::NoBraceInUnicodeEscape => Self::NoBraceInUnicodeEscape,
EE::InvalidCharInUnicodeEscape => Self::InvalidCharInUnicodeEscape,
EE::EmptyUnicodeEscape => Self::EmptyUnicodeEscape,
EE::UnclosedUnicodeEscape => Self::UnclosedUnicodeEscape,
EE::LeadingUnderscoreUnicodeEscape => Self::LeadingUnderscoreUnicodeEscape,
EE::OverlongUnicodeEscape => Self::OverlongUnicodeEscape,
EE::LoneSurrogateUnicodeEscape => Self::LoneSurrogateUnicodeEscape,
EE::OutOfRangeUnicodeEscape => Self::OutOfRangeUnicodeEscape,
EE::UnicodeEscapeInByte => Self::UnicodeEscapeInByte,
EE::NonAsciiCharInByte => Self::NonAsciiCharInByte,
EE::NulInCStr => Self::NulInCStr,
EE::UnskippedWhitespaceWarning => Self::UnskippedWhitespaceWarning,
EE::MultipleSkippedLinesWarning => Self::MultipleSkippedLinesWarning,
}
}
}

#[unstable(feature = "proc_macro_value", issue = "136652")]
impl error::Error for EscapeError {}
impl error::Error for EscapeErrorKind {}

#[unstable(feature = "proc_macro_value", issue = "136652")]
impl fmt::Display for EscapeError {
impl fmt::Display for EscapeErrorKind {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(match self {
Self::ZeroChars => "zero chars",
Expand Down
2 changes: 2 additions & 0 deletions library/std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ check-cfg = [
'cfg(target_has_reliable_f16_math)',
'cfg(target_has_reliable_f128)',
'cfg(target_has_reliable_f128_math)',
# Controlling which tests we run in Miri.
'cfg(skip_unsupported_miri_tests)',
]

[lints.cargo]
Expand Down
3 changes: 2 additions & 1 deletion library/std/src/fs/tests.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg(not(skip_unsupported_miri_tests))] // fs API support in Miri is quite spotty

use rand::RngCore;

use super::Dir;
Expand Down Expand Up @@ -2567,7 +2569,6 @@ fn test_eq_windows_file_type() {
/// Regression test for https://github.com/rust-lang/rust/issues/50619.
#[test]
#[cfg(target_os = "linux")]
#[cfg_attr(miri, ignore)] // Cannot spawn processes on Miri
fn test_read_dir_infinite_loop() {
use crate::io::ErrorKind;
use crate::process::Command;
Expand Down
2 changes: 2 additions & 0 deletions library/std/src/net/socket_addr/tests.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg(not(all(windows, skip_unsupported_miri_tests)))] // Miri has no net support on Windows

use crate::net::tests::{sa4, sa6, tsa};
use crate::net::*;

Expand Down
4 changes: 4 additions & 0 deletions library/std/src/net/tcp/tests.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg(not(all(windows, skip_unsupported_miri_tests)))] // Miri has no net support on Windows

use rand::Rng;

use crate::io::prelude::*;
Expand Down Expand Up @@ -898,6 +900,7 @@ fn ttl() {
#[test]
#[cfg_attr(target_env = "sgx", ignore)]
#[cfg(any(target_family = "unix", target_os = "windows"))]
#[cfg(not(skip_unsupported_miri_tests))] // socket flag not supported by Miri
fn hop_limit() {
let hlim = 100;

Expand Down Expand Up @@ -979,6 +982,7 @@ fn connect_timeout_valid() {
// macOS with `EINVAL`; `write_all` should now transfer it via short sends.
#[test]
#[cfg(all(target_pointer_width = "64", unix))]
#[cfg(not(skip_unsupported_miri_tests))] // read-only mmap not supported by Miri
fn write_buffer_larger_than_c_int_max() {
const LEN: usize = crate::ffi::c_int::MAX as usize + 1;

Expand Down
1 change: 1 addition & 0 deletions library/std/src/net/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ impl Drop for ZeroedMmap {
}

#[test]
#[cfg(not(all(windows, skip_unsupported_miri_tests)))] // Miri has no net support on Windows
fn hostname_smoketest() {
// Just a smoke test to ensure it can be called.
let name = crate::net::hostname();
Expand Down
2 changes: 2 additions & 0 deletions library/std/src/net/udp/tests.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg(not(skip_unsupported_miri_tests))] // UDP sockets are not supported in Miri

use crate::io::ErrorKind;
use crate::net::tests::{LOCALHOST_IP4, LOCALHOST_IP6, compare_ignore_zoneid};
use crate::net::*;
Expand Down
1 change: 1 addition & 0 deletions library/std/src/os/darwin/fs/dirs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ mod sys {

#[cfg(test)]
#[cfg(target_vendor = "apple")]
#[cfg(not(skip_unsupported_miri_tests))] // macOS sysdir APIs are not supported in Miri
mod tests {
use super::*;

Expand Down
2 changes: 1 addition & 1 deletion library/std/src/os/fd/owned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl BorrowedFd<'_> {

/// Converts a `BorrowedFd` into a reference to a file-like type.
///
#[cfg_attr(all(unix, not(miri)), doc = "```")]
#[cfg_attr(unix, doc = "```")]
#[cfg_attr(not(unix), doc = "```ignore (needs unix)")]
/// # #![feature(fd_view)]
/// # use std::fs::File;
Expand Down
2 changes: 2 additions & 0 deletions library/std/src/os/net/linux_ext/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#[test]
#[cfg(not(skip_unsupported_miri_tests))] // socket flag not supported by Miri
fn quickack() {
use crate::net::tests::LOCALHOST_IP4;
use crate::net::{TcpListener, TcpStream};
Expand Down Expand Up @@ -28,6 +29,7 @@ fn quickack() {

#[test]
#[cfg(target_os = "linux")]
#[cfg(not(skip_unsupported_miri_tests))] // socket flag not supported by Miri
fn deferaccept() {
use crate::net::tests::LOCALHOST_IP4;
use crate::net::{TcpListener, TcpStream};
Expand Down
2 changes: 2 additions & 0 deletions library/std/src/os/unix/fs/tests.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg(not(skip_unsupported_miri_tests))] // fs API support in Miri is quite spotty

use super::*;

#[test]
Expand Down
2 changes: 2 additions & 0 deletions library/std/src/os/unix/net/tests.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg(not(skip_unsupported_miri_tests))] // Unix domain sockets are not supported in Miri

use super::*;
use crate::io::prelude::*;
use crate::io::{self, ErrorKind, IoSlice, IoSliceMut};
Expand Down
Loading
Loading