Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 18 pull requests #120491

Merged
merged 47 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
4369a78
Add triagebot mentions entry for simd intrinsics
bjorn3 Dec 19, 2023
adb6e1b
Update triagebot.toml
bjorn3 Dec 26, 2023
bdf7404
Update codegen test for LLVM 18
nikic Jan 26, 2024
bdfb917
interpret/memory: fix safety comment for large array memset optimization
RalfJung Jan 26, 2024
3691ab8
Use only one label for multiple unsatisfied bounds on type (astconv)
estebank Jan 26, 2024
757b726
Use only one label for multiple unsatisfied bounds on type (typeck)
estebank Jan 26, 2024
7df4a09
Use single label for method not found due to unmet bound
estebank Jan 26, 2024
cda898b
Remove unnecessary unit returns in query declarations
DaniPopes Jan 27, 2024
2251e9a
Reject infinitely-sized reads from io::Repeat
kornelski Jan 15, 2024
5d8c178
Make the coroutine def id of an async closure the child of the closur…
compiler-errors Jan 27, 2024
7668953
add more unit tests
onur-ozkan Jan 20, 2024
d6a974d
bootstrap: update test modules
onur-ozkan Jan 21, 2024
b85b2a7
std: Update documentation of seek_write on Windows
alexcrichton Jan 28, 2024
5bda589
Tweak comment and naming for `recover_unclosed_char`.
nnethercote Jan 28, 2024
306612e
Be more careful about interpreting a label/lifetime as a mistyped cha…
nnethercote Jan 28, 2024
3cde0e8
Add instructions of how to use pre-vendored 'rustc-src'
seqre Jan 27, 2024
b4e1c56
raw pointer metadata API: data address -> data pointer
RalfJung Jan 27, 2024
1b17d8e
Add matthewjasper to some review groups
matthewjasper Jan 29, 2024
1bdeeef
Update pulldown-cmark version to 0.9.5
GuillaumeGomez Jan 28, 2024
1e60cc9
Add regression test for #100638
GuillaumeGomez Jan 28, 2024
503342f
Update books
rustbot Jan 29, 2024
32a0afe
rustdoc: Prevent JS injection from localStorage
Jan 22, 2024
ed55629
Move multiple UI issue tests to subdirectories
seqre Jan 28, 2024
fc964fb
review comments
estebank Jan 29, 2024
5350edb
Remove the lifetime from `DiagnosticArgValue`.
nnethercote Jan 30, 2024
45dc197
Remove lifetimes from some diagnostics.
nnethercote Jan 30, 2024
06aa381
Remove `DiagnosticArgName` from `rustc_codegen_ssa`.
nnethercote Jan 30, 2024
f0426b7
Remove the lifetime from `DiagnosticArgName`.
nnethercote Jan 30, 2024
514a5d8
Remove the second lifetime from `DiagnosticArg`.
nnethercote Jan 30, 2024
2baa994
Rollup merge of #119123 - bjorn3:simd_intrinsics_mentions, r=Nilstrieb
GuillaumeGomez Jan 30, 2024
5db5853
Rollup merge of #119991 - kornelski:endless-read, r=the8472
GuillaumeGomez Jan 30, 2024
d3d621b
Rollup merge of #120172 - onur-ozkan:add-more-tests, r=Mark-Simulacrum
GuillaumeGomez Jan 30, 2024
b60707e
Rollup merge of #120250 - chadnorvell:rustdoc-xss, r=notriddle
GuillaumeGomez Jan 30, 2024
bc84452
Rollup merge of #120376 - nikic:update-codegen-test, r=cuviper
GuillaumeGomez Jan 30, 2024
e0e96a1
Rollup merge of #120387 - RalfJung:large-array-followup, r=oli-obk
GuillaumeGomez Jan 30, 2024
f7043a4
Rollup merge of #120400 - estebank:bound-error-cleanup, r=oli-obk
GuillaumeGomez Jan 30, 2024
a44b134
Rollup merge of #120402 - compiler-errors:async-closure-def-tree, r=c…
GuillaumeGomez Jan 30, 2024
8ab372d
Rollup merge of #120403 - seqre-contrib:pre-vendored-message, r=onur-…
GuillaumeGomez Jan 30, 2024
6e046fe
Rollup merge of #120424 - RalfJung:raw-ptr-meta, r=Nilstrieb
GuillaumeGomez Jan 30, 2024
8c2571c
Rollup merge of #120425 - DaniPopes:query-default-return, r=Nilstrieb
GuillaumeGomez Jan 30, 2024
3524d8a
Rollup merge of #120439 - seqre-contrib:moving-ui-tests, r=nnethercote
GuillaumeGomez Jan 30, 2024
f35504d
Rollup merge of #120443 - GuillaumeGomez:footnote-def-improvement, r=…
GuillaumeGomez Jan 30, 2024
d5e8d85
Rollup merge of #120452 - alexcrichton:update-windows-seek-write-docs…
GuillaumeGomez Jan 30, 2024
c00192a
Rollup merge of #120460 - nnethercote:fix-120397, r=compiler-errors
GuillaumeGomez Jan 30, 2024
a62ab8e
Rollup merge of #120464 - matthewjasper:matthew-reviews, r=davidtwco
GuillaumeGomez Jan 30, 2024
63a8885
Rollup merge of #120467 - rustbot:docs-update, r=ehuss
GuillaumeGomez Jan 30, 2024
f99b510
Rollup merge of #120488 - nnethercote:diag-lifetimes, r=oli-obk
GuillaumeGomez Jan 30, 2024
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
6 changes: 3 additions & 3 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3003,11 +3003,11 @@ dependencies = [

[[package]]
name = "pulldown-cmark"
version = "0.9.3"
version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77a1a2f1f0a7ecff9c31abbe177637be0e97a0aef46cf8738ece09327985d998"
checksum = "57206b407293d2bcd3af849ce869d52068623f19e1b5ff8e8778e3309439682b"
dependencies = [
"bitflags 1.3.2",
"bitflags 2.4.1",
"memchr",
"unicase",
]
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 @@ -188,7 +188,7 @@ impl Display for RegionName {
}

impl rustc_errors::IntoDiagnosticArg for RegionName {
fn into_diagnostic_arg(self) -> rustc_errors::DiagnosticArgValue<'static> {
fn into_diagnostic_arg(self) -> rustc_errors::DiagnosticArgValue {
self.to_string().into_diagnostic_arg()
}
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub(crate) enum PossibleFeature<'a> {
struct ExitCode(Option<i32>);

impl IntoDiagnosticArg for ExitCode {
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
fn into_diagnostic_arg(self) -> DiagnosticArgValue {
let ExitCode(exit_code) = self;
match exit_code {
Some(t) => t.into_diagnostic_arg(),
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/assert_module_sources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ impl fmt::Display for CguReuse {
}

impl IntoDiagnosticArg for CguReuse {
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
fn into_diagnostic_arg(self) -> DiagnosticArgValue {
DiagnosticArgValue::Str(Cow::Owned(self.to_string()))
}
}
Expand Down
17 changes: 9 additions & 8 deletions compiler/rustc_codegen_ssa/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ use rustc_data_structures::memmap::Mmap;
use rustc_data_structures::profiling::{SelfProfilerRef, VerboseTimingGuard};
use rustc_data_structures::sync::Lrc;
use rustc_errors::emitter::Emitter;
use rustc_errors::{translation::Translate, DiagCtxt, FatalError, Level};
use rustc_errors::{DiagnosticBuilder, DiagnosticMessage, ErrCode, Style};
use rustc_errors::translation::Translate;
use rustc_errors::{
DiagCtxt, DiagnosticArgName, DiagnosticArgValue, DiagnosticBuilder, DiagnosticMessage, ErrCode,
FatalError, FluentBundle, Level, Style,
};
use rustc_fs_util::link_or_copy;
use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
use rustc_incremental::{
Expand Down Expand Up @@ -995,11 +998,9 @@ pub(crate) enum Message<B: WriteBackendMethods> {
/// process another codegen unit.
pub struct CguMessage;

type DiagnosticArgName<'source> = Cow<'source, str>;

struct Diagnostic {
msgs: Vec<(DiagnosticMessage, Style)>,
args: FxHashMap<DiagnosticArgName<'static>, rustc_errors::DiagnosticArgValue<'static>>,
args: FxHashMap<DiagnosticArgName, DiagnosticArgValue>,
code: Option<ErrCode>,
lvl: Level,
}
Expand Down Expand Up @@ -1800,18 +1801,18 @@ impl SharedEmitter {
}

impl Translate for SharedEmitter {
fn fluent_bundle(&self) -> Option<&Lrc<rustc_errors::FluentBundle>> {
fn fluent_bundle(&self) -> Option<&Lrc<FluentBundle>> {
None
}

fn fallback_fluent_bundle(&self) -> &rustc_errors::FluentBundle {
fn fallback_fluent_bundle(&self) -> &FluentBundle {
panic!("shared emitter attempted to translate a diagnostic");
}
}

impl Emitter for SharedEmitter {
fn emit_diagnostic(&mut self, diag: &rustc_errors::Diagnostic) {
let args: FxHashMap<Cow<'_, str>, rustc_errors::DiagnosticArgValue<'_>> =
let args: FxHashMap<Cow<'_, str>, DiagnosticArgValue> =
diag.args().map(|(name, arg)| (name.clone(), arg.clone())).collect();
drop(self.sender.send(SharedEmitterMessage::Diagnostic(Diagnostic {
msgs: diag.messages.clone(),
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_ssa/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ impl<'a> CopyPath<'a> {
struct DebugArgPath<'a>(pub &'a Path);

impl IntoDiagnosticArg for DebugArgPath<'_> {
fn into_diagnostic_arg(self) -> rustc_errors::DiagnosticArgValue<'static> {
fn into_diagnostic_arg(self) -> rustc_errors::DiagnosticArgValue {
DiagnosticArgValue::Str(Cow::Owned(format!("{:?}", self.0)))
}
}
Expand Down Expand Up @@ -974,7 +974,7 @@ pub enum ExpectedPointerMutability {
}

impl IntoDiagnosticArg for ExpectedPointerMutability {
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
fn into_diagnostic_arg(self) -> DiagnosticArgValue {
match self {
ExpectedPointerMutability::Mut => DiagnosticArgValue::Str(Cow::Borrowed("*mut")),
ExpectedPointerMutability::Not => DiagnosticArgValue::Str(Cow::Borrowed("*_")),
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_const_eval/src/const_eval/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl MachineStopType for ConstEvalErrKind {
}
fn add_args(
self: Box<Self>,
adder: &mut dyn FnMut(std::borrow::Cow<'static, str>, DiagnosticArgValue<'static>),
adder: &mut dyn FnMut(std::borrow::Cow<'static, str>, DiagnosticArgValue),
) {
use ConstEvalErrKind::*;
match *self {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_const_eval/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ impl ReportErrorExt for ResourceExhaustionInfo {
}

impl rustc_errors::IntoDiagnosticArg for InternKind {
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
fn into_diagnostic_arg(self) -> DiagnosticArgValue {
DiagnosticArgValue::Str(Cow::Borrowed(match self {
InternKind::Static(Mutability::Not) => "static",
InternKind::Static(Mutability::Mut) => "static_mut",
Expand Down
9 changes: 4 additions & 5 deletions compiler/rustc_const_eval/src/interpret/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
/// to the allocation it points to. Supports both shared and mutable references, as the actual
/// checking is offloaded to a helper closure.
///
/// If this returns `None`, the size is 0; it can however return `Some` even for size 0.
/// Returns `None` if and only if the size is 0.
fn check_and_deref_ptr<T>(
&self,
ptr: Pointer<Option<M::Provenance>>,
Expand Down Expand Up @@ -1214,10 +1214,9 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
let size_in_bytes = size.bytes_usize();
// For particularly large arrays (where this is perf-sensitive) it's common that
// we're writing a single byte repeatedly. So, optimize that case to a memset.
if size_in_bytes == 1 && num_copies >= 1 {
// SAFETY: `src_bytes` would be read from anyway by copies below (num_copies >= 1).
// Since size_in_bytes = 1, then the `init.no_bytes_init()` check above guarantees
// that this read at type `u8` is OK -- it must be an initialized byte.
if size_in_bytes == 1 {
debug_assert!(num_copies >= 1); // we already handled the zero-sized cases above.
// SAFETY: `src_bytes` would be read from anyway by `copy` below (num_copies >= 1).
let value = *src_bytes;
dest_bytes.write_bytes(value, (size * num_copies).bytes_usize());
} else if src_alloc_id == dest_alloc_id {
Expand Down
40 changes: 15 additions & 25 deletions compiler/rustc_errors/src/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,43 +23,36 @@ pub struct SuggestionsDisabled;
/// Simplified version of `FluentArg` that can implement `Encodable` and `Decodable`. Collection of
/// `DiagnosticArg` are converted to `FluentArgs` (consuming the collection) at the start of
/// diagnostic emission.
pub type DiagnosticArg<'iter, 'source> =
(&'iter DiagnosticArgName<'source>, &'iter DiagnosticArgValue<'source>);
pub type DiagnosticArg<'iter> = (&'iter DiagnosticArgName, &'iter DiagnosticArgValue);

/// Name of a diagnostic argument.
pub type DiagnosticArgName<'source> = Cow<'source, str>;
pub type DiagnosticArgName = Cow<'static, str>;

/// Simplified version of `FluentValue` that can implement `Encodable` and `Decodable`. Converted
/// to a `FluentValue` by the emitter to be used in diagnostic translation.
#[derive(Clone, Debug, PartialEq, Eq, Hash, Encodable, Decodable)]
pub enum DiagnosticArgValue<'source> {
Str(Cow<'source, str>),
pub enum DiagnosticArgValue {
Str(Cow<'static, str>),
Number(i128),
StrListSepByAnd(Vec<Cow<'source, str>>),
StrListSepByAnd(Vec<Cow<'static, str>>),
}

/// Converts a value of a type into a `DiagnosticArg` (typically a field of an `IntoDiagnostic`
/// struct). Implemented as a custom trait rather than `From` so that it is implemented on the type
/// being converted rather than on `DiagnosticArgValue`, which enables types from other `rustc_*`
/// crates to implement this.
pub trait IntoDiagnosticArg {
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static>;
fn into_diagnostic_arg(self) -> DiagnosticArgValue;
}

impl<'source> IntoDiagnosticArg for DiagnosticArgValue<'source> {
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
match self {
DiagnosticArgValue::Str(s) => DiagnosticArgValue::Str(Cow::Owned(s.into_owned())),
DiagnosticArgValue::Number(n) => DiagnosticArgValue::Number(n),
DiagnosticArgValue::StrListSepByAnd(l) => DiagnosticArgValue::StrListSepByAnd(
l.into_iter().map(|s| Cow::Owned(s.into_owned())).collect(),
),
}
impl IntoDiagnosticArg for DiagnosticArgValue {
fn into_diagnostic_arg(self) -> DiagnosticArgValue {
self
}
}

impl<'source> Into<FluentValue<'source>> for DiagnosticArgValue<'source> {
fn into(self) -> FluentValue<'source> {
impl Into<FluentValue<'static>> for DiagnosticArgValue {
fn into(self) -> FluentValue<'static> {
match self {
DiagnosticArgValue::Str(s) => From::from(s),
DiagnosticArgValue::Number(n) => From::from(n),
Expand Down Expand Up @@ -109,7 +102,7 @@ pub struct Diagnostic {
pub span: MultiSpan,
pub children: Vec<SubDiagnostic>,
pub suggestions: Result<Vec<CodeSuggestion>, SuggestionsDisabled>,
args: FxHashMap<DiagnosticArgName<'static>, DiagnosticArgValue<'static>>,
args: FxHashMap<DiagnosticArgName, DiagnosticArgValue>,

/// This is not used for highlighting or rendering any error message. Rather, it can be used
/// as a sort key to sort a buffer of diagnostics. By default, it is the primary span of
Expand Down Expand Up @@ -916,7 +909,7 @@ impl Diagnostic {
// Exact iteration order of diagnostic arguments shouldn't make a difference to output because
// they're only used in interpolation.
#[allow(rustc::potential_query_instability)]
pub fn args(&self) -> impl Iterator<Item = DiagnosticArg<'_, 'static>> {
pub fn args(&self) -> impl Iterator<Item = DiagnosticArg<'_>> {
self.args.iter()
}

Expand All @@ -929,10 +922,7 @@ impl Diagnostic {
self
}

pub fn replace_args(
&mut self,
args: FxHashMap<DiagnosticArgName<'static>, DiagnosticArgValue<'static>>,
) {
pub fn replace_args(&mut self, args: FxHashMap<DiagnosticArgName, DiagnosticArgValue>) {
self.args = args;
}

Expand Down Expand Up @@ -990,7 +980,7 @@ impl Diagnostic {
) -> (
&Level,
&[(DiagnosticMessage, Style)],
Vec<(&Cow<'static, str>, &DiagnosticArgValue<'static>)>,
Vec<(&Cow<'static, str>, &DiagnosticArgValue)>,
&Option<ErrCode>,
&Option<IsLint>,
&MultiSpan,
Expand Down
Loading
Loading