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 8 pull requests #98532

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
fd76552
std: use an event flag based thread parker on SOLID
joboet May 18, 2022
3b6ae15
std: fix deadlock in `Parker`
joboet May 19, 2022
b9660de
std: solve priority issue for Parker
joboet Jun 4, 2022
5823d7b
Partial stabilization of "nonzero_unchecked_ops".
iago-lito May 30, 2022
69e8e7e
Stabilize NonZero* checked operations constness.
iago-lito Jun 9, 2022
caff723
std: relax memory orderings in `Parker`
joboet Jun 7, 2022
2d02416
Rename/restructure memory ordering intrinsics.
m-ou-se Jun 22, 2022
cc4f804
Move help popup into a pocket menu as well
GuillaumeGomez Jun 20, 2022
3eb9e1a
Add/update GUI tests for help pocket menu
GuillaumeGomez Jun 20, 2022
e4b2b41
Merge all popover hide functions into one
GuillaumeGomez Jun 22, 2022
99bc979
macros: use typed identifiers in diag derive
davidtwco Jun 23, 2022
abd3467
macros: use typed identifiers in subdiag derive
davidtwco Jun 23, 2022
dc90d1d
errors: remove diagnostic message ctors
davidtwco Jun 23, 2022
7475867
[rustc_parse] Forbid lets in certain places
c410-f3r Jun 25, 2022
dc2cc10
make const_err show up in future breakage reports
RalfJung Jun 4, 2022
af58692
bless remaining tests
RalfJung Jun 4, 2022
24b66da
Support setting file accessed/modified timestamps
joshtriplett Jun 19, 2022
e2b5729
Add alias `File::set_modified` as shorthand
joshtriplett Jun 20, 2022
3899914
bless after rebase
RalfJung Jun 25, 2022
1d32fed
Return an error if trying to set a file timestamp to 0 on Windows
joshtriplett Jun 25, 2022
2339bb2
Update `since` to 1.64 (since we're after 1.63)
scottmcm Jun 26, 2022
44d5c47
Rollup merge of #97140 - joboet:solid_parker, r=m-ou-se
Dylan-DPC Jun 26, 2022
e9b2d93
Rollup merge of #97295 - c410-f3r:yet-another-let-chain, r=compiler-e…
Dylan-DPC Jun 26, 2022
04ef53f
Rollup merge of #97423 - m-ou-se:memory-ordering-intrinsics, r=tmiasko
Dylan-DPC Jun 26, 2022
d917e33
Rollup merge of #97743 - RalfJung:const-err-future-breakage, r=estebank
Dylan-DPC Jun 26, 2022
ce5ea90
Rollup merge of #97908 - iago-lito:stabilize_nonzero_checked_ops_cons…
Dylan-DPC Jun 26, 2022
5f25c96
Rollup merge of #98246 - joshtriplett:times, r=m-ou-se
Dylan-DPC Jun 26, 2022
6144c43
Rollup merge of #98297 - GuillaumeGomez:help-pocket-menu, r=notriddle
Dylan-DPC Jun 26, 2022
d50d461
Rollup merge of #98428 - davidtwco:translation-derive-typed-identifie…
Dylan-DPC Jun 26, 2022
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: 2 additions & 2 deletions compiler/rustc_builtin_macros/src/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ pub fn expand_cfg(
}

#[derive(SessionDiagnostic)]
#[error(slug = "builtin-macros-requires-cfg-pattern")]
#[error(builtin_macros::requires_cfg_pattern)]
struct RequiresCfgPattern {
#[primary_span]
#[label]
span: Span,
}

#[derive(SessionDiagnostic)]
#[error(slug = "builtin-macros-expected-one-cfg-pattern")]
#[error(builtin_macros::expected_one_cfg_pattern)]
struct OneCfgPattern {
#[primary_span]
span: Span,
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_codegen_ssa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#![feature(associated_type_bounds)]
#![feature(strict_provenance)]
#![feature(int_roundings)]
#![feature(if_let_guard)]
#![recursion_limit = "256"]
#![allow(rustc::potential_query_instability)]

Expand Down
58 changes: 26 additions & 32 deletions compiler/rustc_codegen_ssa/src/mir/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,32 +376,23 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
}

// This requires that atomic intrinsics follow a specific naming pattern:
// "atomic_<operation>[_<ordering>]", and no ordering means SeqCst
name if name_str.starts_with("atomic_") => {
// "atomic_<operation>[_<ordering>]"
name if let Some(atomic) = name_str.strip_prefix("atomic_") => {
use crate::common::AtomicOrdering::*;
use crate::common::{AtomicRmwBinOp, SynchronizationScope};

let split: Vec<_> = name_str.split('_').collect();

let is_cxchg = split[1] == "cxchg" || split[1] == "cxchgweak";
let (order, failorder) = match split.len() {
2 => (SequentiallyConsistent, SequentiallyConsistent),
3 => match split[2] {
"unordered" => (Unordered, Unordered),
"relaxed" => (Relaxed, Relaxed),
"acq" => (Acquire, Acquire),
"rel" => (Release, Relaxed),
"acqrel" => (AcquireRelease, Acquire),
"failrelaxed" if is_cxchg => (SequentiallyConsistent, Relaxed),
"failacq" if is_cxchg => (SequentiallyConsistent, Acquire),
_ => bx.sess().fatal("unknown ordering in atomic intrinsic"),
},
4 => match (split[2], split[3]) {
("acq", "failrelaxed") if is_cxchg => (Acquire, Relaxed),
("acqrel", "failrelaxed") if is_cxchg => (AcquireRelease, Relaxed),
_ => bx.sess().fatal("unknown ordering in atomic intrinsic"),
},
_ => bx.sess().fatal("Atomic intrinsic not in correct format"),
let Some((instruction, ordering)) = atomic.split_once('_') else {
bx.sess().fatal("Atomic intrinsic missing memory ordering");
};

let parse_ordering = |bx: &Bx, s| match s {
"unordered" => Unordered,
"relaxed" => Relaxed,
"acquire" => Acquire,
"release" => Release,
"acqrel" => AcquireRelease,
"seqcst" => SequentiallyConsistent,
_ => bx.sess().fatal("unknown ordering in atomic intrinsic"),
};

let invalid_monomorphization = |ty| {
Expand All @@ -416,11 +407,14 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
);
};

match split[1] {
match instruction {
"cxchg" | "cxchgweak" => {
let Some((success, failure)) = ordering.split_once('_') else {
bx.sess().fatal("Atomic compare-exchange intrinsic missing failure memory ordering");
};
let ty = substs.type_at(0);
if int_type_width_signed(ty, bx.tcx()).is_some() || ty.is_unsafe_ptr() {
let weak = split[1] == "cxchgweak";
let weak = instruction == "cxchgweak";
let mut dst = args[0].immediate();
let mut cmp = args[1].immediate();
let mut src = args[2].immediate();
Expand All @@ -432,7 +426,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
cmp = bx.ptrtoint(cmp, bx.type_isize());
src = bx.ptrtoint(src, bx.type_isize());
}
let pair = bx.atomic_cmpxchg(dst, cmp, src, order, failorder, weak);
let pair = bx.atomic_cmpxchg(dst, cmp, src, parse_ordering(bx, success), parse_ordering(bx, failure), weak);
let val = bx.extract_value(pair, 0);
let success = bx.extract_value(pair, 1);
let val = bx.from_immediate(val);
Expand Down Expand Up @@ -460,11 +454,11 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
let llty = bx.type_isize();
let ptr_llty = bx.type_ptr_to(llty);
source = bx.pointercast(source, ptr_llty);
let result = bx.atomic_load(llty, source, order, size);
let result = bx.atomic_load(llty, source, parse_ordering(bx, ordering), size);
// ... and then cast the result back to a pointer
bx.inttoptr(result, bx.backend_type(layout))
} else {
bx.atomic_load(bx.backend_type(layout), source, order, size)
bx.atomic_load(bx.backend_type(layout), source, parse_ordering(bx, ordering), size)
}
} else {
return invalid_monomorphization(ty);
Expand All @@ -484,20 +478,20 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
ptr = bx.pointercast(ptr, ptr_llty);
val = bx.ptrtoint(val, bx.type_isize());
}
bx.atomic_store(val, ptr, order, size);
bx.atomic_store(val, ptr, parse_ordering(bx, ordering), size);
return;
} else {
return invalid_monomorphization(ty);
}
}

"fence" => {
bx.atomic_fence(order, SynchronizationScope::CrossThread);
bx.atomic_fence(parse_ordering(bx, ordering), SynchronizationScope::CrossThread);
return;
}

"singlethreadfence" => {
bx.atomic_fence(order, SynchronizationScope::SingleThread);
bx.atomic_fence(parse_ordering(bx, ordering), SynchronizationScope::SingleThread);
return;
}

Expand Down Expand Up @@ -531,7 +525,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
ptr = bx.pointercast(ptr, ptr_llty);
val = bx.ptrtoint(val, bx.type_isize());
}
bx.atomic_rmw(atom_op, ptr, val, order)
bx.atomic_rmw(atom_op, ptr, val, parse_ordering(bx, ordering))
} else {
return invalid_monomorphization(ty);
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_error_codes/src/error_codes/E0093.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ functions are defined in `compiler/rustc_codegen_llvm/src/intrinsic.rs` and in
#![feature(intrinsics)]

extern "rust-intrinsic" {
fn atomic_fence(); // ok!
fn atomic_fence_seqcst(); // ok!
}

fn main() {
unsafe {
atomic_fence();
atomic_fence_seqcst();
}
}
```
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
builtin-macros-requires-cfg-pattern =
builtin_macros-requires-cfg-pattern =
macro requires a cfg-pattern as an argument
.label = cfg-pattern required

builtin-macros-expected-one-cfg-pattern = expected 1 cfg-pattern
builtin_macros-expected-one-cfg-pattern = expected 1 cfg-pattern
38 changes: 21 additions & 17 deletions compiler/rustc_error_messages/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,18 +258,6 @@ pub enum SubdiagnosticMessage {
FluentAttr(FluentId),
}

impl SubdiagnosticMessage {
/// Create a `SubdiagnosticMessage` for the provided Fluent attribute.
pub fn attr(id: impl Into<FluentId>) -> Self {
SubdiagnosticMessage::FluentAttr(id.into())
}

/// Create a `SubdiagnosticMessage` for the provided Fluent identifier.
pub fn message(id: impl Into<FluentId>) -> Self {
SubdiagnosticMessage::FluentIdentifier(id.into())
}
}

/// `From` impl that enables existing diagnostic calls to functions which now take
/// `impl Into<SubdiagnosticMessage>` to continue to work as before.
impl<S: Into<String>> From<S> for SubdiagnosticMessage {
Expand Down Expand Up @@ -332,11 +320,6 @@ impl DiagnosticMessage {
_ => panic!("expected non-translatable diagnostic message"),
}
}

/// Create a `DiagnosticMessage` for the provided Fluent identifier.
pub fn new(id: impl Into<FluentId>) -> Self {
DiagnosticMessage::FluentIdentifier(id.into(), None)
}
}

/// `From` impl that enables existing diagnostic calls to functions which now take
Expand All @@ -347,6 +330,27 @@ impl<S: Into<String>> From<S> for DiagnosticMessage {
}
}

/// Translating *into* a subdiagnostic message from a diagnostic message is a little strange - but
/// the subdiagnostic functions (e.g. `span_label`) take a `SubdiagnosticMessage` and the
/// subdiagnostic derive refers to typed identifiers that are `DiagnosticMessage`s, so need to be
/// able to convert between these, as much as they'll be converted back into `DiagnosticMessage`
/// using `with_subdiagnostic_message` eventually. Don't use this other than for the derive.
impl Into<SubdiagnosticMessage> for DiagnosticMessage {
fn into(self) -> SubdiagnosticMessage {
match self {
DiagnosticMessage::Str(s) => SubdiagnosticMessage::Str(s),
DiagnosticMessage::FluentIdentifier(id, None) => {
SubdiagnosticMessage::FluentIdentifier(id)
}
// There isn't really a sensible behaviour for this because it loses information but
// this is the most sensible of the behaviours.
DiagnosticMessage::FluentIdentifier(_, Some(attr)) => {
SubdiagnosticMessage::FluentAttr(attr)
}
}
}
}

/// A span together with some additional data.
#[derive(Clone, Debug)]
pub struct SpanLabel {
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ declare_lint! {
"constant evaluation encountered erroneous expression",
@future_incompatible = FutureIncompatibleInfo {
reference: "issue #71800 <https://github.com/rust-lang/rust/issues/71800>",
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
};
report_in_external_macro
}
Expand Down
Loading