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 11 pull requests #117735

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c6f7aa0
Make File::create work on Windows hidden files
ChrisDenton Oct 5, 2023
dcaee27
add track_caller for arith ops
bvanjoi Oct 6, 2023
545cc83
allow configuring the parent GitHub repository
pietroalbini Oct 24, 2023
5a562d9
pass the correct args to compiletest
pietroalbini Oct 24, 2023
4a08735
update suggest-tests
pietroalbini Oct 24, 2023
333aab4
Avoid silencing relevant follow-up errors
oli-obk Oct 31, 2023
cd56d91
reinstate track_caller removal comment
oli-obk Nov 2, 2023
4a8c5cb
Use the LLVM option NoTrapAfterNoreturn
majaha Apr 18, 2023
580fa0c
rename github_repository to git_repository
pietroalbini Nov 6, 2023
c17d33f
Extend builtin/auto trait args with error when they have >1 argument
compiler-errors Nov 6, 2023
1023845
Document how rust atomics work wrt mixed-sized and non-atomic accesses
WaffleLapkin Oct 15, 2023
769ad29
triagebot.toml: use inclusive language
tshepang Nov 8, 2023
03435e6
accept review suggestion
tshepang Nov 8, 2023
de0458a
speed up `x clean`
onur-ozkan Nov 8, 2023
622be2d
Restore rustc shim error message
Kobzol Nov 8, 2023
341c856
Move `BorrowedBuf` and `BorrowedCursor` from `std:io` to `core::io`
jmillikin Nov 8, 2023
4764942
Rollup merge of #110494 - majaha:noTrapAfterNoreturn, r=nikic
TaKO8Ki Nov 9, 2023
e923f69
Rollup merge of #114841 - bvanjoi:fix-114814, r=scottmcm
TaKO8Ki Nov 9, 2023
847460d
Rollup merge of #116438 - ChrisDenton:truncate, r=thomcc
TaKO8Ki Nov 9, 2023
6cb4971
Rollup merge of #116762 - WaffleLapkin:fixup_fromptr_docs, r=RalfJung
TaKO8Ki Nov 9, 2023
3c540cc
Rollup merge of #117122 - ferrocene:pa-configure-git-diff, r=albertla…
TaKO8Ki Nov 9, 2023
fe95f46
Rollup merge of #117449 - oli-obk:query_merge_immobile_game, r=matthe…
TaKO8Ki Nov 9, 2023
191e48e
Rollup merge of #117645 - compiler-errors:auto-trait-subst, r=petroch…
TaKO8Ki Nov 9, 2023
58aa686
Rollup merge of #117694 - jmillikin:core-io-borrowed-buf, r=m-ou-se
TaKO8Ki Nov 9, 2023
a2ea76e
Rollup merge of #117705 - tshepang:patch-2, r=Nilstrieb
TaKO8Ki Nov 9, 2023
27b0fcc
Rollup merge of #117723 - onur-ozkan:keep-bootstrap-on-x-clean, r=alb…
TaKO8Ki Nov 9, 2023
d9c3d83
Rollup merge of #117724 - Kobzol:shim-error-message, r=onur-ozkan
TaKO8Ki Nov 9, 2023
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
10 changes: 4 additions & 6 deletions compiler/rustc_hir_analysis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,17 +163,15 @@ pub fn provide(providers: &mut Providers) {
hir_wf_check::provide(providers);
}

// FIXME(matthewjasper) We shouldn't need to use `track_errors` in this function.
pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> {
let _prof_timer = tcx.sess.timer("type_check_crate");

// this ensures that later parts of type checking can assume that items
// have valid types and not error
// FIXME(matthewjasper) We shouldn't need to use `track_errors`.
tcx.sess.track_errors(|| {
tcx.sess.time("type_collecting", || {
tcx.hir().for_each_module(|module| tcx.ensure().collect_mod_item_types(module))
});
})?;
tcx.sess.time("type_collecting", || {
tcx.hir().for_each_module(|module| tcx.ensure().collect_mod_item_types(module))
});

if tcx.features().rustc_attrs {
tcx.sess.track_errors(|| {
Expand Down
14 changes: 6 additions & 8 deletions compiler/rustc_hir_analysis/src/outlives/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ pub fn test_inferred_outlives(tcx: TyCtxt<'_>) {
// attribute and report an error with various results if found.
if tcx.has_attr(id.owner_id, sym::rustc_outlives) {
let inferred_outlives_of = tcx.inferred_outlives_of(id.owner_id);
struct_span_err!(
tcx.sess,
tcx.def_span(id.owner_id),
E0640,
"{:?}",
inferred_outlives_of
)
.emit();
let mut err =
struct_span_err!(tcx.sess, tcx.def_span(id.owner_id), E0640, "rustc_outlives");
for &(clause, span) in inferred_outlives_of {
err.span_note(span, format!("{clause}"));
}
err.emit();
}
}
}
8 changes: 8 additions & 0 deletions compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,14 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
// it prevents control flow from "falling through" into whatever code
// happens to be laid out next in memory.
Options.TrapUnreachable = true;
// But don't emit traps after other traps or no-returns unnecessarily.
// ...except for when targeting WebAssembly, because the NoTrapAfterNoreturn
// option causes bugs in the LLVM WebAssembly backend. You should be able to
// remove this check when Rust's minimum supported LLVM version is >= 18
// https://github.com/llvm/llvm-project/pull/65876
if (!Trip.isWasm()) {
Options.NoTrapAfterNoreturn = true;
}
}

if (Singlethread) {
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_span/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![feature(array_windows)]
#![feature(cfg_match)]
#![feature(core_io_borrowed_buf)]
#![feature(if_let_guard)]
#![feature(let_chains)]
#![feature(min_specialization)]
Expand Down
6 changes: 6 additions & 0 deletions compiler/rustc_trait_selection/src/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,12 @@ pub fn normalize_param_env_or_error<'tcx>(
}

fn fold_const(&mut self, c: ty::Const<'tcx>) -> ty::Const<'tcx> {
// FIXME(return_type_notation): track binders in this normalizer, as
// `ty::Const::normalize` can only work with properly preserved binders.

if c.has_escaping_bound_vars() {
return ty::Const::new_misc_error(self.0, c.ty());
}
// While it is pretty sus to be evaluating things with an empty param env, it
// should actually be okay since without `feature(generic_const_exprs)` the only
// const arguments that have a non-empty param env are array repeat counts. These
Expand Down
21 changes: 15 additions & 6 deletions compiler/rustc_trait_selection/src/traits/select/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2389,12 +2389,21 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
)
});

let obligation = Obligation::new(
self.tcx(),
cause.clone(),
param_env,
ty::TraitRef::new(self.tcx(), trait_def_id, [normalized_ty]),
);
let tcx = self.tcx();
let trait_ref = if tcx.generics_of(trait_def_id).params.len() == 1 {
ty::TraitRef::new(tcx, trait_def_id, [normalized_ty])
} else {
// If this is an ill-formed auto/built-in trait, then synthesize
// new error args for the missing generics.
let err_args = ty::GenericArgs::extend_with_error(
tcx,
trait_def_id,
&[normalized_ty.into()],
);
ty::TraitRef::new(tcx, trait_def_id, err_args)
};

let obligation = Obligation::new(self.tcx(), cause.clone(), param_env, trait_ref);
obligations.push(obligation);
obligations
})
Expand Down
4 changes: 4 additions & 0 deletions library/core/src/internal_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ macro_rules! forward_ref_binop {
type Output = <$t as $imp<$u>>::Output;

#[inline]
#[track_caller]
fn $method(self, other: $u) -> <$t as $imp<$u>>::Output {
$imp::$method(*self, other)
}
Expand All @@ -41,6 +42,7 @@ macro_rules! forward_ref_binop {
type Output = <$t as $imp<$u>>::Output;

#[inline]
#[track_caller]
fn $method(self, other: &$u) -> <$t as $imp<$u>>::Output {
$imp::$method(self, *other)
}
Expand All @@ -51,6 +53,7 @@ macro_rules! forward_ref_binop {
type Output = <$t as $imp<$u>>::Output;

#[inline]
#[track_caller]
fn $method(self, other: &$u) -> <$t as $imp<$u>>::Output {
$imp::$method(*self, *other)
}
Expand All @@ -69,6 +72,7 @@ macro_rules! forward_ref_op_assign {
#[$attr]
impl $imp<&$u> for $t {
#[inline]
#[track_caller]
fn $method(&mut self, other: &$u) {
$imp::$method(self, *other);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#![unstable(feature = "read_buf", issue = "78485")]

#[cfg(test)]
mod tests;
#![unstable(feature = "core_io_borrowed_buf", issue = "117693")]

use crate::fmt::{self, Debug, Formatter};
use crate::io::{Result, Write};
use crate::mem::{self, MaybeUninit};
use crate::{cmp, ptr};

Expand Down Expand Up @@ -303,16 +299,3 @@ impl<'a> BorrowedCursor<'a> {
self.buf.filled += buf.len();
}
}

impl<'a> Write for BorrowedCursor<'a> {
fn write(&mut self, buf: &[u8]) -> Result<usize> {
let amt = cmp::min(buf.len(), self.capacity());
self.append(&buf[..amt]);
Ok(amt)
}

#[inline]
fn flush(&mut self) -> Result<()> {
Ok(())
}
}
6 changes: 6 additions & 0 deletions library/core/src/io/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//! Traits, helpers, and type definitions for core I/O functionality.

mod borrowed_buf;

#[unstable(feature = "core_io_borrowed_buf", issue = "117693")]
pub use self::borrowed_buf::{BorrowedBuf, BorrowedCursor};
2 changes: 2 additions & 0 deletions library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,8 @@ pub mod async_iter;
pub mod cell;
pub mod char;
pub mod ffi;
#[unstable(feature = "core_io_borrowed_buf", issue = "117693")]
pub mod io;
pub mod iter;
pub mod net;
pub mod option;
Expand Down
10 changes: 10 additions & 0 deletions library/core/src/ops/arith.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ macro_rules! add_impl {
type Output = $t;

#[inline]
#[track_caller]
#[rustc_inherit_overflow_checks]
fn add(self, other: $t) -> $t { self + other }
}
Expand Down Expand Up @@ -206,6 +207,7 @@ macro_rules! sub_impl {
type Output = $t;

#[inline]
#[track_caller]
#[rustc_inherit_overflow_checks]
fn sub(self, other: $t) -> $t { self - other }
}
Expand Down Expand Up @@ -335,6 +337,7 @@ macro_rules! mul_impl {
type Output = $t;

#[inline]
#[track_caller]
#[rustc_inherit_overflow_checks]
fn mul(self, other: $t) -> $t { self * other }
}
Expand Down Expand Up @@ -474,6 +477,7 @@ macro_rules! div_impl_integer {
type Output = $t;

#[inline]
#[track_caller]
fn div(self, other: $t) -> $t { self / other }
}

Expand Down Expand Up @@ -575,6 +579,7 @@ macro_rules! rem_impl_integer {
type Output = $t;

#[inline]
#[track_caller]
fn rem(self, other: $t) -> $t { self % other }
}

Expand Down Expand Up @@ -749,6 +754,7 @@ macro_rules! add_assign_impl {
#[stable(feature = "op_assign_traits", since = "1.8.0")]
impl AddAssign for $t {
#[inline]
#[track_caller]
#[rustc_inherit_overflow_checks]
fn add_assign(&mut self, other: $t) { *self += other }
}
Expand Down Expand Up @@ -815,6 +821,7 @@ macro_rules! sub_assign_impl {
#[stable(feature = "op_assign_traits", since = "1.8.0")]
impl SubAssign for $t {
#[inline]
#[track_caller]
#[rustc_inherit_overflow_checks]
fn sub_assign(&mut self, other: $t) { *self -= other }
}
Expand Down Expand Up @@ -872,6 +879,7 @@ macro_rules! mul_assign_impl {
#[stable(feature = "op_assign_traits", since = "1.8.0")]
impl MulAssign for $t {
#[inline]
#[track_caller]
#[rustc_inherit_overflow_checks]
fn mul_assign(&mut self, other: $t) { *self *= other }
}
Expand Down Expand Up @@ -929,6 +937,7 @@ macro_rules! div_assign_impl {
#[stable(feature = "op_assign_traits", since = "1.8.0")]
impl DivAssign for $t {
#[inline]
#[track_caller]
fn div_assign(&mut self, other: $t) { *self /= other }
}

Expand Down Expand Up @@ -989,6 +998,7 @@ macro_rules! rem_assign_impl {
#[stable(feature = "op_assign_traits", since = "1.8.0")]
impl RemAssign for $t {
#[inline]
#[track_caller]
fn rem_assign(&mut self, other: $t) { *self %= other }
}

Expand Down
Loading