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 7 pull requests #119760

Merged
merged 40 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
ab716d0
Use assert_unsafe_precondition for char::from_u32_unchecked
ChrisDenton Dec 15, 2023
12784c3
Add -Zuse-sync-unwind
quininer Nov 9, 2023
4c4c6a6
Preparing for merge from rustc
Jan 5, 2024
d11a2bd
Merge from rustc
Jan 5, 2024
39c714b
Auto merge of #3252 - rust-lang:rustup-2024-01-05, r=RalfJung
bors Jan 5, 2024
a10b3cd
Fix broken build for ESP IDF due to #119026
ivmarkov Jan 5, 2024
80ee0c0
remove redundant clone
matthiaskrgr Jan 5, 2024
d334a4b
Auto merge of #3253 - matthiaskrgr:noclone, r=RalfJung
bors Jan 5, 2024
7e4e9ad
Preparing for merge from rustc
Jan 6, 2024
078f228
Merge from rustc
Jan 6, 2024
46f53c8
fmt
Jan 6, 2024
1c98b78
implement the rounding intrinsics using apfloat rounding
RalfJung Jan 6, 2024
58c80a0
merge intrinsics-math into float tests
RalfJung Jan 6, 2024
ac4526d
these should be exact
RalfJung Jan 6, 2024
0814a56
Auto merge of #3254 - rust-lang:rustup-2024-01-06, r=saethlin
bors Jan 6, 2024
643e7f0
./miri build: also build tests, to avoid rebuilds later
RalfJung Jan 6, 2024
66b15ae
cargo update
RalfJung Jan 6, 2024
b8209e2
use jemalloc as global allocator
RalfJung Jan 7, 2024
c4a11ea
only use jemalloc on Unix
RalfJung Jan 7, 2024
d93ca6e
Auto merge of #3259 - RalfJung:jemalloc, r=RalfJung
bors Jan 7, 2024
8675aa1
Auto merge of #3256 - RalfJung:rounding, r=RalfJung
bors Jan 7, 2024
6f017d2
Auto merge of #3257 - RalfJung:build-tests, r=RalfJung
bors Jan 7, 2024
5b30586
Adding alignment to the list of cases to test for specific error mess…
madsravn Jan 7, 2024
7d5de70
Check if tier 2 targets build in the nightly cron job
saethlin Jan 7, 2024
d475e62
Auto merge of #3260 - saethlin:build-all-tier-2, r=RalfJung
bors Jan 7, 2024
56ff1b8
only use jemalloc on Linux and macOS
RalfJung Jan 8, 2024
8d4a5c7
Auto merge of #3261 - RalfJung:jemalloc, r=RalfJung
bors Jan 8, 2024
0ddccf9
update lockfile
RalfJung Jan 8, 2024
8aa7dd0
enable RUSTC_BOOTSTRAP on panic=abort mir-opt test
onur-ozkan Jan 5, 2024
26c71cb
detect user-specified custom targets in compiletest
onur-ozkan Jan 5, 2024
b888e2f
fix the incorrect target on stage1 ui-fulldeps tests
onur-ozkan Jan 7, 2024
8abf133
Make inductive cycles in coherence ambiguous always
compiler-errors Dec 5, 2023
506c066
Removing redudant note from parse error
madsravn Jan 8, 2024
9e4843e
Rollup merge of #117744 - quininer:add-z-sync-uw, r=bjorn3
matthiaskrgr Jan 9, 2024
1974f5c
Rollup merge of #118649 - compiler-errors:coherence-ambig, r=lcnr
matthiaskrgr Jan 9, 2024
b0c492c
Rollup merge of #118979 - ChrisDenton:unwrap-const, r=Nilstrieb,dtolnay
matthiaskrgr Jan 9, 2024
985b2ce
Rollup merge of #119619 - onur-ozkan:panic-abort-mir-opt, r=oli-obk
matthiaskrgr Jan 9, 2024
50982bd
Rollup merge of #119632 - ivmarkov:master, r=Nilstrieb,dtolnay
matthiaskrgr Jan 9, 2024
deb504b
Rollup merge of #119712 - madsravn:parsing-errors, r=estebank
matthiaskrgr Jan 9, 2024
91fcc17
Rollup merge of #119734 - RalfJung:miri, r=RalfJung
matthiaskrgr Jan 9, 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 @@ -2465,6 +2465,7 @@ dependencies = [
"ctrlc",
"env_logger",
"getrandom",
"jemalloc-sys",
"lazy_static",
"libc",
"libffi",
Expand All @@ -2474,7 +2475,6 @@ dependencies = [
"rand",
"regex",
"rustc_version",
"serde",
"smallvec",
"ui_test",
]
Expand Down Expand Up @@ -3280,9 +3280,9 @@ dependencies = [

[[package]]
name = "rustc-build-sysroot"
version = "0.4.2"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ed2a90dfa5232ed5ff21d53d4df655f315ab316ea06fc508f1c74bcedb1ce6c"
checksum = "39dcf8d82b1f79a179bdb284dc44db440a9666eefa5a6df5ef282d6db930d544"
dependencies = [
"anyhow",
"rustc_version",
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_codegen_llvm/src/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ fn create_wrapper_function(
llvm::LLVMRustSetVisibility(llfn, llvm::Visibility::Hidden);
}
if tcx.sess.must_emit_unwind_tables() {
let uwtable = attributes::uwtable_attr(llcx);
let uwtable =
attributes::uwtable_attr(llcx, tcx.sess.opts.unstable_opts.use_sync_unwind);
attributes::apply_to_llfn(llfn, llvm::AttributePlace::Function, &[uwtable]);
}

Expand Down
7 changes: 4 additions & 3 deletions compiler/rustc_codegen_llvm/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,12 @@ pub fn sanitize_attrs<'ll>(

/// Tell LLVM to emit or not emit the information necessary to unwind the stack for the function.
#[inline]
pub fn uwtable_attr(llcx: &llvm::Context) -> &Attribute {
pub fn uwtable_attr(llcx: &llvm::Context, use_sync_unwind: Option<bool>) -> &Attribute {
// NOTE: We should determine if we even need async unwind tables, as they
// take have more overhead and if we can use sync unwind tables we
// probably should.
llvm::CreateUWTableAttr(llcx, true)
let async_unwind = !use_sync_unwind.unwrap_or(false);
llvm::CreateUWTableAttr(llcx, async_unwind)
}

pub fn frame_pointer_type_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribute> {
Expand Down Expand Up @@ -333,7 +334,7 @@ pub fn from_fn_attrs<'ll, 'tcx>(
// You can also find more info on why Windows always requires uwtables here:
// https://bugzilla.mozilla.org/show_bug.cgi?id=1302078
if cx.sess().must_emit_unwind_tables() {
to_add.push(uwtable_attr(cx.llcx));
to_add.push(uwtable_attr(cx.llcx, cx.sess().opts.unstable_opts.use_sync_unwind));
}

if cx.sess().opts.unstable_opts.profile_sample_use.is_some() {
Expand Down
5 changes: 5 additions & 0 deletions compiler/rustc_lint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,11 @@ fn register_builtins(store: &mut LintStore) {
"converted into hard error, see PR #117984 \
<https://github.com/rust-lang/rust/pull/117984> for more information",
);
store.register_removed(
"coinductive_overlap_in_coherence",
"converted into hard error, see PR #118649 \
<https://github.com/rust-lang/rust/pull/118649> for more information",
);
}

fn register_internals(store: &mut LintStore) {
Expand Down
40 changes: 0 additions & 40 deletions compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ declare_lint_pass! {
BYTE_SLICE_IN_PACKED_STRUCT_WITH_DERIVE,
CENUM_IMPL_DROP_CAST,
COHERENCE_LEAK_CHECK,
COINDUCTIVE_OVERLAP_IN_COHERENCE,
CONFLICTING_REPR_HINTS,
CONST_EVALUATABLE_UNCHECKED,
CONST_ITEM_MUTATION,
Expand Down Expand Up @@ -4367,45 +4366,6 @@ declare_lint! {
@feature_gate = sym::type_privacy_lints;
}

declare_lint! {
/// The `coinductive_overlap_in_coherence` lint detects impls which are currently
/// considered not overlapping, but may be considered to overlap if support for
/// coinduction is added to the trait solver.
///
/// ### Example
///
/// ```rust,compile_fail
/// #![deny(coinductive_overlap_in_coherence)]
///
/// trait CyclicTrait {}
/// impl<T: CyclicTrait> CyclicTrait for T {}
///
/// trait Trait {}
/// impl<T: CyclicTrait> Trait for T {}
/// // conflicting impl with the above
/// impl Trait for u8 {}
/// ```
///
/// {{produces}}
///
/// ### Explanation
///
/// We have two choices for impl which satisfy `u8: Trait`: the blanket impl
/// for generic `T`, and the direct impl for `u8`. These two impls nominally
/// overlap, since we can infer `T = u8` in the former impl, but since the where
/// clause `u8: CyclicTrait` would end up resulting in a cycle (since it depends
/// on itself), the blanket impl is not considered to hold for `u8`. This will
/// change in a future release.
pub COINDUCTIVE_OVERLAP_IN_COHERENCE,
Deny,
"impls that are not considered to overlap may be considered to \
overlap in the future",
@future_incompatible = FutureIncompatibleInfo {
reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
reference: "issue #114040 <https://github.com/rust-lang/rust/issues/114040>",
};
}

declare_lint! {
/// The `unknown_or_malformed_diagnostic_attributes` lint detects unrecognized or otherwise malformed
/// diagnostic attributes.
Expand Down
28 changes: 22 additions & 6 deletions compiler/rustc_parse_format/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,10 @@ impl<'a> Iterator for Parser<'a> {
}
} else {
if let Some(&(_, maybe)) = self.cur.peek() {
if maybe == '?' {
self.suggest_format();
} else {
self.suggest_positional_arg_instead_of_captured_arg(arg);
match maybe {
'?' => self.suggest_format_debug(),
'<' | '^' | '>' => self.suggest_format_align(maybe),
_ => self.suggest_positional_arg_instead_of_captured_arg(arg),
}
}
}
Expand Down Expand Up @@ -868,10 +868,9 @@ impl<'a> Parser<'a> {
found.then_some(cur)
}

fn suggest_format(&mut self) {
fn suggest_format_debug(&mut self) {
if let (Some(pos), Some(_)) = (self.consume_pos('?'), self.consume_pos(':')) {
let word = self.word();
let _end = self.current_pos();
let pos = self.to_span_index(pos);
self.errors.insert(
0,
Expand All @@ -887,6 +886,23 @@ impl<'a> Parser<'a> {
}
}

fn suggest_format_align(&mut self, alignment: char) {
if let Some(pos) = self.consume_pos(alignment) {
let pos = self.to_span_index(pos);
self.errors.insert(
0,
ParseError {
description: "expected format parameter to occur after `:`".to_owned(),
note: None,
label: format!("expected `{}` to occur after `:`", alignment).to_owned(),
span: pos.to(pos),
secondary_label: None,
suggestion: Suggestion::None,
},
);
}
}

fn suggest_positional_arg_instead_of_captured_arg(&mut self, arg: Argument<'a>) {
if let Some(end) = self.consume_pos('.') {
let byte_pos = self.to_span_index(end);
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_session/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1960,6 +1960,8 @@ written to standard error output)"),
"adds unstable command line options to rustc interface (default: no)"),
use_ctors_section: Option<bool> = (None, parse_opt_bool, [TRACKED],
"use legacy .ctors section for initializers rather than .init_array"),
use_sync_unwind: Option<bool> = (None, parse_opt_bool, [TRACKED],
"Generate sync unwind tables instead of async unwind tables (default: no)"),
validate_mir: bool = (false, parse_bool, [UNTRACKED],
"validate MIR after each transformation"),
#[rustc_lint_opt_deny_field_access("use `Session::verbose_internals` instead of this field")]
Expand Down
64 changes: 6 additions & 58 deletions compiler/rustc_trait_selection/src/traits/coherence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::solve::inspect::{InspectGoal, ProofTreeInferCtxtExt, ProofTreeVisitor
use crate::solve::{deeply_normalize_for_diagnostics, inspect};
use crate::traits::engine::TraitEngineExt;
use crate::traits::query::evaluate_obligation::InferCtxtExt;
use crate::traits::select::{IntercrateAmbiguityCause, TreatInductiveCycleAs};
use crate::traits::select::IntercrateAmbiguityCause;
use crate::traits::structural_normalize::StructurallyNormalizeExt;
use crate::traits::NormalizeExt;
use crate::traits::SkipLeakCheck;
Expand All @@ -31,7 +31,6 @@ use rustc_middle::traits::DefiningAnchor;
use rustc_middle::ty::fast_reject::{DeepRejectCtxt, TreatParams};
use rustc_middle::ty::visit::{TypeVisitable, TypeVisitableExt};
use rustc_middle::ty::{self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitor};
use rustc_session::lint::builtin::COINDUCTIVE_OVERLAP_IN_COHERENCE;
use rustc_span::symbol::sym;
use rustc_span::DUMMY_SP;
use std::fmt::Debug;
Expand Down Expand Up @@ -197,7 +196,7 @@ fn overlap<'tcx>(
.intercrate(true)
.with_next_trait_solver(tcx.next_trait_solver_in_coherence())
.build();
let selcx = &mut SelectionContext::new(&infcx);
let selcx = &mut SelectionContext::with_treat_inductive_cycle_as_ambig(&infcx);
if track_ambiguity_causes.is_yes() {
selcx.enable_tracking_intercrate_ambiguity_causes();
}
Expand All @@ -224,61 +223,10 @@ fn overlap<'tcx>(
);

if overlap_mode.use_implicit_negative() {
for mode in [TreatInductiveCycleAs::Ambig, TreatInductiveCycleAs::Recur] {
if let Some(failing_obligation) = selcx.with_treat_inductive_cycle_as(mode, |selcx| {
impl_intersection_has_impossible_obligation(selcx, &obligations)
}) {
if matches!(mode, TreatInductiveCycleAs::Recur) {
let first_local_impl = impl1_header
.impl_def_id
.as_local()
.or(impl2_header.impl_def_id.as_local())
.expect("expected one of the impls to be local");
infcx.tcx.struct_span_lint_hir(
COINDUCTIVE_OVERLAP_IN_COHERENCE,
infcx.tcx.local_def_id_to_hir_id(first_local_impl),
infcx.tcx.def_span(first_local_impl),
format!(
"implementations {} will conflict in the future",
match impl1_header.trait_ref {
Some(trait_ref) => {
let trait_ref = infcx.resolve_vars_if_possible(trait_ref);
format!(
"of `{}` for `{}`",
trait_ref.print_trait_sugared(),
trait_ref.self_ty()
)
}
None => format!(
"for `{}`",
infcx.resolve_vars_if_possible(impl1_header.self_ty)
),
},
),
|lint| {
lint.note(
"impls that are not considered to overlap may be considered to \
overlap in the future",
)
.span_label(
infcx.tcx.def_span(impl1_header.impl_def_id),
"the first impl is here",
)
.span_label(
infcx.tcx.def_span(impl2_header.impl_def_id),
"the second impl is here",
);
lint.note(format!(
"`{}` may be considered to hold in future releases, \
causing the impls to overlap",
infcx.resolve_vars_if_possible(failing_obligation.predicate)
));
},
);
}

return None;
}
if let Some(_failing_obligation) =
impl_intersection_has_impossible_obligation(selcx, &obligations)
{
return None;
}
}

Expand Down
20 changes: 8 additions & 12 deletions compiler/rustc_trait_selection/src/traits/select/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,20 +239,16 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
}
}

// Sets the `TreatInductiveCycleAs` mode temporarily in the selection context
pub fn with_treat_inductive_cycle_as<T>(
&mut self,
treat_inductive_cycle: TreatInductiveCycleAs,
f: impl FnOnce(&mut Self) -> T,
) -> T {
pub fn with_treat_inductive_cycle_as_ambig(
infcx: &'cx InferCtxt<'tcx>,
) -> SelectionContext<'cx, 'tcx> {
// Should be executed in a context where caching is disabled,
// otherwise the cache is poisoned with the temporary result.
assert!(self.is_intercrate());
let treat_inductive_cycle =
std::mem::replace(&mut self.treat_inductive_cycle, treat_inductive_cycle);
let value = f(self);
self.treat_inductive_cycle = treat_inductive_cycle;
value
assert!(infcx.intercrate);
SelectionContext {
treat_inductive_cycle: TreatInductiveCycleAs::Ambig,
..SelectionContext::new(infcx)
}
}

pub fn with_query_mode(
Expand Down
9 changes: 8 additions & 1 deletion library/core/src/char/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use crate::char::TryFromCharError;
use crate::convert::TryFrom;
use crate::error::Error;
use crate::fmt;
use crate::intrinsics::assert_unsafe_precondition;
use crate::mem::transmute;
use crate::str::FromStr;

Expand All @@ -23,7 +24,13 @@ pub(super) const fn from_u32(i: u32) -> Option<char> {
#[must_use]
pub(super) const unsafe fn from_u32_unchecked(i: u32) -> char {
// SAFETY: the caller must guarantee that `i` is a valid char value.
if cfg!(debug_assertions) { char::from_u32(i).unwrap() } else { unsafe { transmute(i) } }
unsafe {
assert_unsafe_precondition!(
"invalid value for `char`",
(i: u32) => char_try_from_u32(i).is_ok()
);
transmute(i)
}
}

#[stable(feature = "char_convert", since = "1.13.0")]
Expand Down
5 changes: 3 additions & 2 deletions library/std/src/os/unix/net/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl UnixListener {
unsafe {
let inner = Socket::new_raw(libc::AF_UNIX, libc::SOCK_STREAM)?;
let (addr, len) = sockaddr_un(path.as_ref())?;
#[cfg(any(target_os = "windows", target_os = "redox"))]
#[cfg(any(target_os = "windows", target_os = "redox", target_os = "espidf"))]
const backlog: libc::c_int = 128;
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
const backlog: libc::c_int = -1;
Expand All @@ -82,7 +82,8 @@ impl UnixListener {
target_os = "redox",
target_os = "linux",
target_os = "freebsd",
target_os = "openbsd"
target_os = "openbsd",
target_os = "espidf"
)))]
const backlog: libc::c_int = libc::SOMAXCONN;

Expand Down
5 changes: 5 additions & 0 deletions src/bootstrap/src/core/build_steps/synthetic_targets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ fn create_synthetic_target(
let mut cmd = Command::new(builder.rustc(compiler));
cmd.arg("--target").arg(base.rustc_target_arg());
cmd.args(["-Zunstable-options", "--print", "target-spec-json"]);

// If `rust.channel` is set to either beta or stable, rustc will complain that
// we cannot use nightly features. So `RUSTC_BOOTSTRAP` is needed here.
cmd.env("RUSTC_BOOTSTRAP", "1");

cmd.stdout(Stdio::piped());

let output = cmd.spawn().unwrap().wait_with_output().unwrap();
Expand Down
9 changes: 7 additions & 2 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1596,8 +1596,13 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
// NOTE: Only stage 1 is special cased because we need the rustc_private artifacts to match the
// running compiler in stage 2 when plugins run.
let stage_id = if suite == "ui-fulldeps" && compiler.stage == 1 {
compiler = builder.compiler(compiler.stage - 1, target);
format!("stage{}-{}", compiler.stage + 1, target)
// At stage 0 (stage - 1) we are using the beta compiler. Using `self.target` can lead finding
// an incorrect compiler path on cross-targets, as the stage 0 beta compiler is always equal
// to `build.build` in the configuration.
let build = builder.build.build;

compiler = builder.compiler(compiler.stage - 1, build);
format!("stage{}-{}", compiler.stage + 1, build)
} else {
format!("stage{}-{}", compiler.stage, target)
};
Expand Down
Loading
Loading