Skip to content

Commit 6ac86bb

Browse files
committed
Auto merge of rust-lang#2991 - rust-lang:rustup-2023-07-26, r=RalfJung
Automatic sync from rustc
2 parents cba1df1 + 38665a1 commit 6ac86bb

File tree

351 files changed

+9259
-3364
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

351 files changed

+9259
-3364
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,9 +641,9 @@ dependencies = [
641641

642642
[[package]]
643643
name = "compiler_builtins"
644-
version = "0.1.95"
644+
version = "0.1.98"
645645
source = "registry+https://github.com/rust-lang/crates.io-index"
646-
checksum = "6866e0f3638013234db3c89ead7a14d278354338e7237257407500009012b23f"
646+
checksum = "dfbefa16407456e5cad1ad066c84dfcb980afe4437103a0007d1c2f136130210"
647647
dependencies = [
648648
"cc",
649649
"rustc-std-workspace-core",

compiler/rustc_abi/src/layout.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,9 @@ pub trait LayoutCalculator {
763763
let mut size = Size::ZERO;
764764
let only_variant = &variants[FIRST_VARIANT];
765765
for field in only_variant {
766-
assert!(field.0.is_sized());
766+
if field.0.is_unsized() {
767+
self.delay_bug("unsized field in union".to_string());
768+
}
767769

768770
align = align.max(field.align());
769771
max_repr_align = max_repr_align.max(field.max_repr_align());

compiler/rustc_abi/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,7 +1189,7 @@ impl FieldsShape {
11891189
}
11901190
FieldsShape::Array { stride, count } => {
11911191
let i = u64::try_from(i).unwrap();
1192-
assert!(i < count);
1192+
assert!(i < count, "tried to access field {} of array with {} fields", i, count);
11931193
stride * i
11941194
}
11951195
FieldsShape::Arbitrary { ref offsets, .. } => offsets[FieldIdx::from_usize(i)],
@@ -1345,7 +1345,6 @@ impl Abi {
13451345

13461346
/// Discard validity range information and allow undef.
13471347
pub fn to_union(&self) -> Self {
1348-
assert!(self.is_sized());
13491348
match *self {
13501349
Abi::Scalar(s) => Abi::Scalar(s.to_union()),
13511350
Abi::ScalarPair(s1, s2) => Abi::ScalarPair(s1.to_union(), s2.to_union()),

compiler/rustc_ast/src/util/comments.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pub fn beautify_doc_string(data: Symbol, kind: CommentKind) -> Symbol {
6262
CommentKind::Block => {
6363
// Whatever happens, we skip the first line.
6464
let mut i = lines
65-
.get(0)
65+
.first()
6666
.map(|l| if l.trim_start().starts_with('*') { 0 } else { 1 })
6767
.unwrap_or(0);
6868
let mut j = lines.len();

compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
286286
ExprKind::OffsetOf(container, fields) => hir::ExprKind::OffsetOf(
287287
self.lower_ty(
288288
container,
289-
&mut ImplTraitContext::Disallowed(ImplTraitPosition::OffsetOf),
289+
&ImplTraitContext::Disallowed(ImplTraitPosition::OffsetOf),
290290
),
291291
self.arena.alloc_from_iter(fields.iter().map(|&ident| self.lower_ident(ident))),
292292
),

compiler/rustc_ast_pretty/src/pprust/state/expr.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -697,15 +697,15 @@ pub fn reconstruct_format_args_template_string(pieces: &[FormatArgsPiece]) -> St
697697
write!(template, "{n}").unwrap();
698698
if p.format_options != Default::default() || p.format_trait != FormatTrait::Display
699699
{
700-
template.push_str(":");
700+
template.push(':');
701701
}
702702
if let Some(fill) = p.format_options.fill {
703703
template.push(fill);
704704
}
705705
match p.format_options.alignment {
706-
Some(FormatAlignment::Left) => template.push_str("<"),
707-
Some(FormatAlignment::Right) => template.push_str(">"),
708-
Some(FormatAlignment::Center) => template.push_str("^"),
706+
Some(FormatAlignment::Left) => template.push('<'),
707+
Some(FormatAlignment::Right) => template.push('>'),
708+
Some(FormatAlignment::Center) => template.push('^'),
709709
None => {}
710710
}
711711
match p.format_options.sign {

compiler/rustc_borrowck/src/lib.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2306,11 +2306,10 @@ mod error {
23062306

23072307
pub fn buffer_error(&mut self, t: DiagnosticBuilder<'_, ErrorGuaranteed>) {
23082308
if let None = self.tainted_by_errors {
2309-
self.tainted_by_errors = Some(
2310-
self.tcx
2311-
.sess
2312-
.delay_span_bug(t.span.clone(), "diagnostic buffered but not emitted"),
2313-
)
2309+
self.tainted_by_errors = Some(self.tcx.sess.delay_span_bug(
2310+
t.span.clone_ignoring_labels(),
2311+
"diagnostic buffered but not emitted",
2312+
))
23142313
}
23152314
t.buffer(&mut self.buffered);
23162315
}

compiler/rustc_borrowck/src/region_infer/opaque_types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,8 @@ fn check_opaque_type_well_formed<'tcx>(
339339
// version.
340340
let errors = ocx.select_all_or_error();
341341

342-
// This is still required for many(half of the tests in ui/type-alias-impl-trait)
343-
// tests to pass
342+
// This is fishy, but we check it again in `check_opaque_meets_bounds`.
343+
// Remove once we can prepopulate with known hidden types.
344344
let _ = infcx.take_opaque_types();
345345

346346
if errors.is_empty() {

compiler/rustc_builtin_macros/messages.ftl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ builtin_macros_derive_path_args_value = traits in `#[derive(...)]` don't accept
109109
.suggestion = remove the value
110110
111111
builtin_macros_env_not_defined = environment variable `{$var}` not defined at compile time
112-
.cargo = Cargo sets build script variables at run time. Use `std::env::var("{$var}")` instead
113-
.other = use `std::env::var("{$var}")` to read the variable at run time
112+
.cargo = Cargo sets build script variables at run time. Use `std::env::var({$var_expr})` instead
113+
.custom = use `std::env::var({$var_expr})` to read the variable at run time
114114
115115
builtin_macros_env_takes_args = `env!()` takes 1 or 2 arguments
116116

compiler/rustc_builtin_macros/src/asm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ fn parse_clobber_abi<'a>(p: &mut Parser<'a>, args: &mut AsmArgs) -> PResult<'a,
401401
// should have errored above during parsing
402402
[] => unreachable!(),
403403
[(abi, _span)] => args.clobber_abis.push((*abi, full_span)),
404-
[abis @ ..] => {
404+
abis => {
405405
for (abi, span) in abis {
406406
args.clobber_abis.push((*abi, *span));
407407
}

0 commit comments

Comments
 (0)