<ins> error[E0637]: `&` without an explicit lifetime name cannot be used here --> $DIR/issue-109071.rs:8:17 | LL |     type Item = &[T]; |                 ^ explicit lifetime name needed here error[E0107]: missing generics for struct `Windows` --> $DIR/issue-109071.rs:7:9 | LL | impl<T> Windows { |         ^^^^^^^ expected 1 generic argument | note: struct defined here, with 1 generic parameter: `T` --> $DIR/issue-109071.rs:5:8 | LL | struct Windows<T> {} |        ^^^^^^^ - help: add missing generic argument | LL | impl<T> Windows<T> { |                +++ error: aborting due to 2 previous errors Some errors have detailed explanations: E0107, E0637. For more information about an error, try `rustc --explain E0107`. </ins>


} pub fn stat(path: &Path) -> io::Result<FileAttr> { <del> metadata(path, ReparsePoint::Follow) </del> <ins> match metadata(path, ReparsePoint::Follow) { Err(err) if err.raw_os_error() == Some(c::ERROR_CANT_ACCESS_FILE as i32) => { if let Ok(attrs) = lstat(path) { if !attrs.file_type().is_symlink() { return Ok(attrs); } } Err(err) } result => result, } </ins> } pub fn lstat(path: &Path) -> io::Result<FileAttr> {


} else { resolution.binding = Some(nonglob_binding); } <del> resolution.shadowed_glob = Some(glob_binding); </del> <ins> if let Some(old_binding) = resolution.shadowed_glob { assert!(old_binding.is_glob_import()); if glob_binding.res() != old_binding.res() { resolution.shadowed_glob = Some(this.ambiguity( AmbiguityKind::GlobVsGlob, old_binding, glob_binding, )); } else if !old_binding.vis.is_at_least(binding.vis, this.tcx) { resolution.shadowed_glob = Some(glob_binding); } } else { resolution.shadowed_glob = Some(glob_binding); } </ins> } (false, false) => { return Err(old_binding);


LL | use V; |     ^ ambiguous name | <del> = note: ambiguous because of multiple potential import sources </del> <ins> = note: ambiguous because of multiple glob imports of a name in the same module </ins> note: `V` could refer to the variant imported here --> $DIR/issue-105069.rs:1:5 | LL | use self::A::*; |     ^^^^^^^^^^ <ins> = help: consider adding an explicit import of `V` to disambiguate </ins> note: `V` could also refer to the variant imported here --> $DIR/issue-105069.rs:3:5 | LL | use self::B::*; |     ^^^^^^^^^^ <ins> = help: consider adding an explicit import of `V` to disambiguate </ins> error: aborting due to previous error


<ins> use foo::*; mod foo { pub mod bar { pub mod bar { pub mod bar {} } } } use bar::bar; //~ ERROR `bar` is ambiguous use bar::*; fn main() { } </ins>


<ins> error[E0659]: `bar` is ambiguous --> $DIR/issue-109153.rs:11:5 | LL | use bar::bar; |     ^^^ ambiguous name | = note: ambiguous because of multiple glob imports of a name in the same module note: `bar` could refer to the module imported here --> $DIR/issue-109153.rs:1:5 | LL | use foo::*; |     ^^^^^^ = help: consider adding an explicit import of `bar` to disambiguate note: `bar` could also refer to the module imported here --> $DIR/issue-109153.rs:12:5 | LL | use bar::*; |     ^^^^^^ = help: consider adding an explicit import of `bar` to disambiguate error: aborting due to previous error For more information about this error, try `rustc --explain E0659`. </ins>


ct_op: |ct| ct, ty_op: |ty| match *ty.kind() { ty::Alias(ty::Opaque, ty::AliasTy { def_id, .. }) <del> if replace_opaque_type(def_id) => </del> <ins> if replace_opaque_type(def_id) && !ty.has_escaping_bound_vars() => </ins> { let def_span = self.tcx.def_span(def_id); let span = if span.contains(def_span) { def_span } else { span };


//! This test checks that opaque type collection doesn't try to normalize the projection //! without respecting its binders (which would ICE). //! Unfortunately we don't even reach opaque type collection, as we ICE in typeck before that. <del> // known-bug: #109281 // failure-status: 101 // error-pattern:internal compiler error // normalize-stderr-test "internal compiler error.*" -> "" // normalize-stderr-test "DefId([^)]*)" -> "..." // normalize-stderr-test "nerror: internal compiler error.*nn" -> "" // normalize-stderr-test "note:.*unexpectedly panicked.*nn" -> "" // normalize-stderr-test "note: we would appreciate a bug report.*nn" -> "" // normalize-stderr-test "note: compiler flags.*nn" -> "" // normalize-stderr-test "note: rustc.*running on.*nn" -> "" // normalize-stderr-test "thread.*panicked.*:n.*n" -> "" // normalize-stderr-test "stack backtrace:n" -> "" // normalize-stderr-test "sd{1,}: .*n" -> "" // normalize-stderr-test "s at .*n" -> "" // normalize-stderr-test ".*note: Some details.*n" -> "" // normalize-stderr-test "nn[ ]*n" -> "" // normalize-stderr-test "compiler/.*: projection" -> "projection" // normalize-stderr-test ".*omitted d{1,} frame.*n" -> "" // normalize-stderr-test "error: [sn]*query stack" -> "error: query stack" // normalize-stderr-test "[ns]*nquery stack during panic:" -> "query stack during panic:" </del> <ins> //! See #109281 for the original report. </ins> // edition:2018 <ins> // error-pattern: expected generic lifetime parameter, found `'a` </ins> #![feature(type_alias_impl_trait)] #![allow(incomplete_features)]


<del> error: --> $DIR/issue-90014-tait2.rs:44:27 | LL |     fn make_fut(&self) -> Box<dyn for<'a> Trait<'a, Thing = Fut<'a>>> { |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^query stack during panic: #0 [typeck] type-checking `<impl at $DIR/issue-90014-tait2.rs:43:1: 43:13>::make_fut` #1 [type_of] computing type of `Fut::{opaque#0}` #2 [check_mod_item_types] checking item types in top-level module #3 [analysis] running analysis passes on this crate end of query stack </del> <ins> error[E0792]: expected generic lifetime parameter, found `'a` </ins> error: aborting due to previous error <ins> For more information about this error, try `rustc --explain E0792`. </ins>


<ins> #![feature(type_alias_impl_trait)] type Opaque<'a> = impl Sized + 'a; fn test(f: fn(u8)) -> fn(Opaque<'_>) { f //~ ERROR E0792 } fn main() {} </ins>


<ins> error[E0792]: expected generic lifetime parameter, found `'_` --> $DIR/under-binder.rs:6:5 | LL | type Opaque<'a> = impl Sized + 'a; |             -- this generic parameter must be used with a generic lifetime parameter ... LL |     f |     ^ error: aborting due to previous error For more information about this error, try `rustc --explain E0792`. </ins>


for (i, proj) in place.projections.iter().enumerate() { match proj.kind { <del> ProjectionKind::Index => { // Arrays are completely captured, so we drop Index projections </del> <ins> ProjectionKind::Index | ProjectionKind::Subslice => { // Arrays are completely captured, so we drop Index and Subslice projections </ins> truncate_place_to_len_and_update_capture_kind(&mut place, &mut curr_mode, i); return (place, curr_mode); } ProjectionKind::Deref => {} ProjectionKind::Field(..) => {} // ignore <del> ProjectionKind::Subslice => {}  // We never capture this </del> } }


<ins> // regression test for #109298 // edition: 2021 pub fn subslice_array(x: [u8; 3]) { let f = || { let [_x @ ..] = x; let [ref y, ref mut z @ ..] = x; //~ ERROR cannot borrow `x[..]` as mutable }; f(); //~ ERROR cannot borrow `f` as mutable } fn main() {} </ins>


<ins> error[E0596]: cannot borrow `x[..]` as mutable, as `x` is not declared as mutable --> $DIR/array_subslice.rs:7:21 | LL | pub fn subslice_array(x: [u8; 3]) { |                       - help: consider changing this to be mutable: `mut x` ... LL |         let [ref y, ref mut z @ ..] = x; |                     ^^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable --> $DIR/array_subslice.rs:10:5 | LL |         let [ref y, ref mut z @ ..] = x; |                                       - calling `f` requires mutable binding due to mutable borrow of `x` ... LL |     f(); |     ^ cannot borrow as mutable | help: consider changing this to be mutable | LL |     let mut f = || { |         +++ error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0596`. </ins>


<ins> //@ assembly-output: emit-asm //@ compile-flags:-Copt-level=3 //@ only-x86_64 #![crate_type = "lib"] #[no_mangle] type T = u8; type T1 = (T, T, T, T, T, T, T, T); type T2 = [T; 8]; #[no_mangle] // CHECK-LABEL: foo1a // CHECK: cmp // CHECK-NEXT: set // CHECK-NEXT: ret pub fn foo1a(a: T1, b: T1) -> bool { a == b } #[no_mangle] // CHECK-LABEL: foo1b // CHECK: mov // CHECK-NEXT: cmp // CHECK-NEXT: set // CHECK-NEXT: ret pub fn foo1b(a: &T1, b: &T1) -> bool { a == b } </ins>


<ins> //@ compile-flags: -O //@ min-llvm-version: 17 #![crate_type = "lib"] #[no_mangle] // CHECK-LABEL: @foo // CHECK: getelementptr inbounds // CHECK-NEXT: load i64 // CHECK-NEXT: icmp eq i64 // CHECK-NEXT: br i1 #[no_mangle] pub fn foo(input: &mut &[u64]) -> Option<u64> { let (first, rest) = input.split_first()?; *input = rest; Some(*first) } </ins>


<ins> //@ compile-flags: -O // XXX: The x86-64 assembly get optimized correclty. But llvm-ir output is not until llvm 18? //@ min-llvm-version: 18 #![crate_type = "lib"] pub enum K{ A(Box<[i32]>), B(Box<[u8]>), C(Box<[String]>), D(Box<[u16]>), } #[no_mangle] // CHECK-LABEL: @get_len // CHECK: getelementptr inbounds // CHECK-NEXT: load // CHECK-NEXT: ret i64 // CHECK-NOT: switch pub fn get_len(arg: &K)->usize{ match arg { K::A(ref lst)=>lst.len(), K::B(ref lst)=>lst.len(), K::C(ref lst)=>lst.len(), K::D(ref lst)=>lst.len(), } } </ins>


<ins> //@ compile-flags: -O // This regress since Rust version 1.72. //@ min-llvm-version: 18.1.4 #![crate_type = "lib"] use std::convert::TryInto; const N: usize = 24; #[no_mangle] // CHECK-LABEL: @example // CHECK-NOT: unwrap_failed pub fn example(a: Vec<u8>) -> u8 { if a.len() != 32 { return 0; } let a: [u8; 32] = a.try_into().unwrap(); a[15] + a[N] } </ins>


<ins> //@ compile-flags: -O //@ min-llvm-version: 17 #![crate_type = "lib"] // CHECK-LABEL: @write_u8_variant_a // CHECK: getelementptr // CHECK-NEXT: icmp ugt #[no_mangle] pub fn write_u8_variant_a( bytes: &mut [u8], buf: u8, offset: usize, ) -> Option<&mut [u8]> { let buf = buf.to_le_bytes(); bytes .get_mut(offset..).and_then(|bytes| bytes.get_mut(..buf.len())) } </ins>


<ins> // in Rust 1.73, -O and opt-level=3 optimizes differently //@ compile-flags: -C opt-level=3 //@ min-llvm-version: 17 #![crate_type = "lib"] use std::cmp::max; #[no_mangle] // CHECK-LABEL: @foo // CHECK-NOT: slice_start_index_len_fail // CHECK-NOT: unreachable pub fn foo(v: &mut Vec<u8>, size: usize)-> Option<&mut [u8]> { if v.len() > max(1, size) { let start = v.len() - size; Some(&mut v[start..]) } else { None } } </ins>


<ins> //@ compile-flags: -O //@ min-llvm-version: 18 #![crate_type = "lib"] // CHECK-LABEL: @div2 // CHECK: ashr i32 %a, 1 // CHECK-NEXT: ret i32 #[no_mangle] pub fn div2(a: i32) -> i32 { a.div_euclid(2) } </ins>


<ins> //@ compile-flags: -O #![crate_type = "lib"] const N: usize = 3; pub type T = u8; #[no_mangle] // CHECK-LABEL: @split_mutiple // CHECK-NOT: unreachable pub fn split_mutiple(slice: &[T]) -> (&[T], &[T]) { let len = slice.len() / N; slice.split_at(len * N) } </ins>


<ins> //@ compile-flags: -O //@ min-llvm-version: 17 #![crate_type = "lib"] #[no_mangle] // CHECK-LABEL: @foo // CHECK: {{.*}}: // CHECK: ret // CHECK-NOT: unreachable pub fn foo(arr: &mut [u32]) { for i in 0..arr.len() { for j in 0..i { assert!(j < arr.len()); } } } </ins>


<ins> //@ compile-flags: -O //@ min-llvm-version: 18 #![crate_type = "lib"] use std::ptr::NonNull; // CHECK-LABEL: @slice_ptr_len_1 // CHECK: {{.*}}: // CHECK-NEXT: ret i64 %ptr.1 #[no_mangle] pub fn slice_ptr_len_1(ptr: *const [u8]) -> usize { let ptr = ptr.cast_mut(); if let Some(ptr) = NonNull::new(ptr) { ptr.len() } else { // We know ptr is null, so we know ptr.wrapping_byte_add(1) is not null. NonNull::new(ptr.wrapping_byte_add(1)).unwrap().len() } } </ins>


resolve_module_only = visibility must resolve to a module <ins> resolve_macro_expected_found = expected {$expected}, found {$found} `{$macro_path}` resolve_remove_surrounding_derive = remove from the surrounding `derive()` resolve_add_as_non_derive = add as non-Derive macro `#[{$macro_path}]` </ins>


#[derive(Diagnostic)] #[diag(resolve_module_only)] pub(crate) struct ModuleOnly(#[primary_span] pub(crate) Span); <ins> #[derive(Diagnostic, Default)] #[diag(resolve_macro_expected_found)] pub(crate) struct MacroExpectedFound<'a> { #[primary_span] pub(crate) span: Span, pub(crate) found: &'a str, pub(crate) expected: &'a str, pub(crate) macro_path: &'a str, #[subdiagnostic] pub(crate) remove_surrounding_derive: Option<RemoveSurroundingDerive>, #[subdiagnostic] pub(crate) add_as_non_derive: Option<AddAsNonDerive<'a>>, } #[derive(Subdiagnostic)] #[help(resolve_remove_surrounding_derive)] pub(crate) struct RemoveSurroundingDerive { #[primary_span] pub(crate) span: Span, } #[derive(Subdiagnostic)] #[help(resolve_add_as_non_derive)] pub(crate) struct AddAsNonDerive<'a> { pub(crate) macro_path: &'a str, } </ins>


//! A bunch of methods and structures more or less related to resolving macros and //! interface provided by `Resolver` to macro expander. <ins> use crate::errors::{AddAsNonDerive, MacroExpectedFound, RemoveSurroundingDerive}; </ins> use crate::Namespace::*; use crate::{BuiltinMacroState, Determinacy}; use crate::{DeriveData, Finalize, ParentScope, ResolutionError, Resolver, ScopeSet};


}; if let Some((article, expected)) = unexpected_res { let path_str = pprust::path_to_string(path); <del> let msg = format!("expected {}, found {} `{}`", expected, res.descr(), path_str); self.tcx .sess .struct_span_err(path.span, &msg) .span_label(path.span, format!("not {} {}", article, expected)) .emit(); </del> <ins> let mut err = MacroExpectedFound { span: path.span, expected, found: res.descr(), macro_path: &path_str, ..Default::default() // Subdiagnostics default to None }; // Suggest moving the macro out of the derive() if the macro isn't Derive if !path.span.from_expansion() && kind == MacroKind::Derive && ext.macro_kind() != MacroKind::Derive { err.remove_surrounding_derive = Some(RemoveSurroundingDerive { span: path.span }); err.add_as_non_derive = Some(AddAsNonDerive { macro_path: &path_str }); } let mut err = self.tcx.sess.create_err(err); err.span_label(path.span, format!("not {} {}", article, expected)); err.emit(); </ins> return Ok((self.dummy_ext(kind), Res::Err)); }


| LL | #[derive(inline)] |          ^^^^^^ not a derive macro <ins> | help: remove from the surrounding `derive()` --> $DIR/macro-path-prelude-fail-4.rs:1:10 | LL | #[derive(inline)] |          ^^^^^^ = help: add as non-Derive macro `#[inline]` </ins> error: aborting due to previous error


<ins> #[derive(Clone, Debug)] // OK struct S; #[derive(Debug, inline)] //~ ERROR expected derive macro, found built-in attribute `inline` struct T; #[derive(inline, Debug)] //~ ERROR expected derive macro, found built-in attribute `inline` struct U; fn main() {} </ins>


<ins> error: expected derive macro, found built-in attribute `inline` --> $DIR/macro-path-prelude-fail-5.rs:4:17 | LL | #[derive(Debug, inline)] |                 ^^^^^^ not a derive macro | help: remove from the surrounding `derive()` --> $DIR/macro-path-prelude-fail-5.rs:4:17 | LL | #[derive(Debug, inline)] |                 ^^^^^^ = help: add as non-Derive macro `#[inline]` error: expected derive macro, found built-in attribute `inline` --> $DIR/macro-path-prelude-fail-5.rs:7:10 | LL | #[derive(inline, Debug)] |          ^^^^^^ not a derive macro | help: remove from the surrounding `derive()` --> $DIR/macro-path-prelude-fail-5.rs:7:10 | LL | #[derive(inline, Debug)] |          ^^^^^^ = help: add as non-Derive macro `#[inline]` error: aborting due to 2 previous errors </ins>


| LL | #[derive(my_macro_attr)] |          ^^^^^^^^^^^^^ not a derive macro <ins> | help: remove from the surrounding `derive()` --> $DIR/macro-namespace-reserved-2.rs:53:10 | LL | #[derive(my_macro_attr)] |          ^^^^^^^^^^^^^ = help: add as non-Derive macro `#[my_macro_attr]` </ins> error: can't use a procedural macro from the same crate that defines it --> $DIR/macro-namespace-reserved-2.rs:56:10


| LL | #[derive(crate::my_macro)] |          ^^^^^^^^^^^^^^^ not a derive macro <ins> | help: remove from the surrounding `derive()` --> $DIR/macro-namespace-reserved-2.rs:50:10 | LL | #[derive(crate::my_macro)] |          ^^^^^^^^^^^^^^^ = help: add as non-Derive macro `#[crate::my_macro]` </ins> error: cannot find macro `my_macro_attr` in this scope --> $DIR/macro-namespace-reserved-2.rs:28:5


| LL | #[derive(rustfmt::skip)] |          ^^^^^^^^^^^^^ not a derive macro <ins> | help: remove from the surrounding `derive()` --> $DIR/tool-attributes-misplaced-2.rs:1:10 | LL | #[derive(rustfmt::skip)] |          ^^^^^^^^^^^^^ = help: add as non-Derive macro `#[rustfmt::skip]` </ins> error: expected macro, found tool attribute `rustfmt::skip` --> $DIR/tool-attributes-misplaced-2.rs:5:5


#[macro_use] mod print; mod session_diagnostics; <ins> #[cfg(all(unix, any(target_env = "gnu", target_os = "macos")))] mod signal_handler; #[cfg(not(all(unix, any(target_env = "gnu", target_os = "macos"))))] mod signal_handler { /// On platforms which don't support our signal handler's requirements, /// simply use the default signal handler provided by std. pub(super) fn install() {} } </ins> use crate::session_diagnostics::{ RLinkEmptyVersionNumber, RLinkEncodingVersionMismatch, RLinkRustcVersionMismatch,


} } <del> #[cfg(all(unix, any(target_env = "gnu", target_os = "macos")))] mod signal_handler { extern "C" { fn backtrace_symbols_fd( buffer: *const *mut libc::c_void, size: libc::c_int, fd: libc::c_int, ); } extern "C" fn print_stack_trace(_: libc::c_int) { const MAX_FRAMES: usize = 256; static mut STACK_TRACE: [*mut libc::c_void; MAX_FRAMES] = [std::ptr::null_mut(); MAX_FRAMES]; unsafe { let depth = libc::backtrace(STACK_TRACE.as_mut_ptr(), MAX_FRAMES as i32); if depth == 0 { return; } backtrace_symbols_fd(STACK_TRACE.as_ptr(), depth, 2); } } /// When an error signal (such as SIGABRT or SIGSEGV) is delivered to the /// process, print a stack trace and then exit. pub(super) fn install() { use std::alloc::{alloc, Layout}; unsafe { let alt_stack_size: usize = min_sigstack_size() + 64 * 1024; let mut alt_stack: libc::stack_t = std::mem::zeroed(); alt_stack.ss_sp = alloc(Layout::from_size_align(alt_stack_size, 1).unwrap()).cast(); alt_stack.ss_size = alt_stack_size; libc::sigaltstack(&alt_stack, std::ptr::null_mut()); let mut sa: libc::sigaction = std::mem::zeroed(); sa.sa_sigaction = print_stack_trace as libc::sighandler_t; sa.sa_flags = libc::SA_NODEFER | libc::SA_RESETHAND | libc::SA_ONSTACK; libc::sigemptyset(&mut sa.sa_mask); libc::sigaction(libc::SIGSEGV, &sa, std::ptr::null_mut()); } } /// Modern kernels on modern hardware can have dynamic signal stack sizes. #[cfg(any(target_os = "linux", target_os = "android"))] fn min_sigstack_size() -> usize { const AT_MINSIGSTKSZ: core::ffi::c_ulong = 51; let dynamic_sigstksz = unsafe { libc::getauxval(AT_MINSIGSTKSZ) }; // If getauxval couldn't find the entry, it returns 0, // so take the higher of the "constant" and auxval. // This transparently supports older kernels which don't provide AT_MINSIGSTKSZ libc::MINSIGSTKSZ.max(dynamic_sigstksz as _) } /// Not all OS support hardware where this is needed. #[cfg(not(any(target_os = "linux", target_os = "android")))] fn min_sigstack_size() -> usize { libc::MINSIGSTKSZ } } #[cfg(not(all(unix, any(target_env = "gnu", target_os = "macos"))))] mod signal_handler { pub(super) fn install() {} } </del> pub fn main() -> ! { let start_time = Instant::now(); let start_rss = get_resident_set_size();


<ins> //! Signal handler for rustc //! Primarily used to extract a backtrace from stack overflow use std::alloc::{alloc, Layout}; use std::{fmt, mem, ptr}; extern "C" { fn backtrace_symbols_fd(buffer: *const *mut libc::c_void, size: libc::c_int, fd: libc::c_int); } fn backtrace_stderr(buffer: &[*mut libc::c_void]) { let size = buffer.len().try_into().unwrap_or_default(); unsafe { backtrace_symbols_fd(buffer.as_ptr(), size, libc::STDERR_FILENO) }; } /// Unbuffered, unsynchronized writer to stderr. /// /// Only acceptable because everything will end soon anyways. struct RawStderr(()); impl fmt::Write for RawStderr { fn write_str(&mut self, s: &str) -> Result<(), fmt::Error> { let ret = unsafe { libc::write(libc::STDERR_FILENO, s.as_ptr().cast(), s.len()) }; if ret == -1 { Err(fmt::Error) } else { Ok(()) } } } /// We don't really care how many bytes we actually get out. SIGSEGV comes for our head. /// Splash stderr with letters of our own blood to warn our friends about the monster. macro raw_errln($tokens:tt) { let _ = ::core::fmt::Write::write_fmt(&mut RawStderr(()), format_args!($tokens)); let _ = ::core::fmt::Write::write_char(&mut RawStderr(()), 'n'); } /// Signal handler installed for SIGSEGV extern "C" fn print_stack_trace(_: libc::c_int) { const MAX_FRAMES: usize = 256; // Reserve data segment so we don't have to malloc in a signal handler, which might fail // in incredibly undesirable and unexpected ways due to e.g. the allocator deadlocking static mut STACK_TRACE: [*mut libc::c_void; MAX_FRAMES] = [ptr::null_mut(); MAX_FRAMES]; let stack = unsafe { // Collect return addresses let depth = libc::backtrace(STACK_TRACE.as_mut_ptr(), MAX_FRAMES as i32); if depth == 0 { return; } &STACK_TRACE.as_slice()[0..(depth as _)] }; // Just a stack trace is cryptic. Explain what we're doing. raw_errln!("error: rustc interrupted by SIGSEGV, printing backtracen"); let mut written = 1; let mut consumed = 0; // Begin elaborating return addrs into symbols and writing them directly to stderr // Most backtraces are stack overflow, most stack overflows are from recursion // Check for cycles before writing 250 lines of the same ~5 symbols let cycled = |(runner, walker)| runner == walker; let mut cyclic = false; if let Some(period) = stack.iter().skip(1).step_by(2).zip(stack).position(cycled) { let period = period.saturating_add(1); // avoid "what if wrapped?" branches let Some(offset) = stack.iter().skip(period).zip(stack).position(cycled) else { // impossible. return; }; // Count matching trace slices, else we could miscount "biphasic cycles" // with the same period + loop entry but a different inner loop let next_cycle = stack[offset..].chunks_exact(period).skip(1); let cycles = 1 + next_cycle .zip(stack[offset..].chunks_exact(period)) .filter(|(next, prev)| next == prev) .count(); backtrace_stderr(&stack[..offset]); written += offset; consumed += offset; if cycles > 1 { raw_errln!("n### cycle encountered after {offset} frames with period {period}"); backtrace_stderr(&stack[consumed..consumed + period]); raw_errln!("### recursed {cycles} timesn"); written += period + 4; consumed += period * cycles; cyclic = true; }; } let rem = &stack[consumed..]; backtrace_stderr(rem); raw_errln!(""); written += rem.len() + 1; let random_depth = || 8 * 16; // chosen by random diceroll (2d20) if cyclic || stack.len() > random_depth() { // technically speculation, but assert it with confidence anyway. // rustc only arrived in this signal handler because bad things happened // and this message is for explaining it's not the programmer's fault raw_errln!("note: rustc unexpectedly overflowed its stack! this is a bug"); written += 1; } if stack.len() == MAX_FRAMES { raw_errln!("note: maximum backtrace depth reached, frames may have been lost"); written += 1; } raw_errln!("note: we would appreciate a report at https://github.com/rust-lang/rust"); written += 1; if written > 24 { // We probably just scrolled the earlier "we got SIGSEGV" message off the terminal raw_errln!("note: backtrace dumped due to SIGSEGV! resuming signal"); }; } /// When SIGSEGV is delivered to the process, print a stack trace and then exit. pub(super) fn install() { unsafe { let alt_stack_size: usize = min_sigstack_size() + 64 * 1024; let mut alt_stack: libc::stack_t = mem::zeroed(); alt_stack.ss_sp = alloc(Layout::from_size_align(alt_stack_size, 1).unwrap()).cast(); alt_stack.ss_size = alt_stack_size; libc::sigaltstack(&alt_stack, ptr::null_mut()); let mut sa: libc::sigaction = mem::zeroed(); sa.sa_sigaction = print_stack_trace as libc::sighandler_t; sa.sa_flags = libc::SA_NODEFER | libc::SA_RESETHAND | libc::SA_ONSTACK; libc::sigemptyset(&mut sa.sa_mask); libc::sigaction(libc::SIGSEGV, &sa, ptr::null_mut()); } } /// Modern kernels on modern hardware can have dynamic signal stack sizes. #[cfg(any(target_os = "linux", target_os = "android"))] fn min_sigstack_size() -> usize { const AT_MINSIGSTKSZ: core::ffi::c_ulong = 51; let dynamic_sigstksz = unsafe { libc::getauxval(AT_MINSIGSTKSZ) }; // If getauxval couldn't find the entry, it returns 0, // so take the higher of the "constant" and auxval. // This transparently supports older kernels which don't provide AT_MINSIGSTKSZ libc::MINSIGSTKSZ.max(dynamic_sigstksz as _) } /// Not all OS support hardware where this is needed. #[cfg(not(any(target_os = "linux", target_os = "android")))] fn min_sigstack_size() -> usize { libc::MINSIGSTKSZ } </ins>


[[package]] name = "gccjit" version = "1.0.0" <del> source = "git+https://github.com/antoyo/gccjit.rs#eefb8c662d61477f34b7c32d26bcda5f1ef08432" </del> <ins> source = "git+https://github.com/antoyo/gccjit.rs#fe242b7eb26980e6c78859d51c8d4cc1e43381a3" </ins> dependencies = [ "gccjit_sys", ]


[[package]] name = "gccjit_sys" version = "0.0.1" <del> source = "git+https://github.com/antoyo/gccjit.rs#eefb8c662d61477f34b7c32d26bcda5f1ef08432" </del> <ins> source = "git+https://github.com/antoyo/gccjit.rs#fe242b7eb26980e6c78859d51c8d4cc1e43381a3" </ins> dependencies = [ <del> "libc 0.1.12", </del> <ins> "libc", </ins> ] [[package]]


checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" dependencies = [ "cfg-if", <del> "libc 0.2.112", </del> <ins> "libc", </ins> "wasi", ]


source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ <del> "libc 0.2.112", </del> <ins> "libc", </ins> ] [[package]]


dependencies = [ "fm", "getopts", <del> "libc 0.2.112", </del> <ins> "libc", </ins> "num_cpus", "termcolor", "threadpool",


[[package]] name = "libc" <del> version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e32a70cf75e5846d53a673923498228bbec6a8624708a9ea5645f075d6276122" [[package]] name = "libc" </del> version = "0.2.112" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125"


checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" dependencies = [ "hermit-abi", <del> "libc 0.2.112", </del> <ins> "libc", </ins> ] [[package]]


source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" dependencies = [ <del> "libc 0.2.112", </del> <ins> "libc", </ins> "rand_chacha", "rand_core", "rand_hc",


checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ "cfg-if", <del> "libc 0.2.112", </del> <ins> "libc", </ins> "rand", "redox_syscall", "remove_dir_all",


source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" dependencies = [ <del> "libc 0.2.112", </del> <ins> "libc", </ins> ] [[package]]


// index position where it *should have been*, which is *after* the previous one. if let Some(provided_idx) = provided_idx { prev = provided_idx.index() as i64; <ins> continue; </ins> } let idx = ProvidedIdx::from_usize((prev + 1) as usize); <del> if let None = provided_idx && let Some((_, arg_span)) = provided_arg_tys.get(idx) { </del> <ins> if let Some((_, arg_span)) = provided_arg_tys.get(idx) { prev += 1; </ins> // There is a type that was *not* found anywhere, so it isn't a move, but a // replacement and we look at what type it should have been. This will allow us // To suggest a multipart suggestion when encountering `foo(1, "")` where the def


<ins> struct A; struct B; fn f(b1: B, b2: B, a2: C) {} //~ ERROR E0412 fn main() { f(A, A, B, C); //~ ERROR E0425 //~^ ERROR E0061 } </ins>


<ins> error[E0412]: cannot find type `C` in this scope --> $DIR/issue-109831.rs:4:24 | LL | struct A; | --------- similarly named struct `A` defined here ... LL | fn f(b1: B, b2: B, a2: C) {} |                        ^ | help: a struct with a similar name exists | LL | fn f(b1: B, b2: B, a2: A) {} |                        ~ help: you might be missing a type parameter | LL | fn f<C>(b1: B, b2: B, a2: C) {} |     +++ error[E0425]: cannot find value `C` in this scope --> $DIR/issue-109831.rs:7:16 | LL | struct A; | --------- similarly named unit struct `A` defined here ... LL |     f(A, A, B, C); |                ^ help: a unit struct with a similar name exists: `A` error[E0061]: this function takes 3 arguments but 4 arguments were supplied --> $DIR/issue-109831.rs:7:5 | LL |     f(A, A, B, C); |     ^ -  -     - unexpected argument |       |  | |       |  expected `B`, found `A` |       expected `B`, found `A` | note: function defined here --> $DIR/issue-109831.rs:4:4 | LL | fn f(b1: B, b2: B, a2: C) {} |    ^ -----  -----  ----- help: remove the extra argument | LL -     f(A, A, B, C); LL +     f(/* B */, /* B */, B); | error: aborting due to 3 previous errors Some errors have detailed explanations: E0061, E0412, E0425. For more information about an error, try `rustc --explain E0061`. </ins>


let tcx = self.tcx; let def_id = instance.def_id(); <del> let containing_scope = get_containing_scope(self, instance); </del> <ins> let (containing_scope, is_method) = get_containing_scope(self, instance); </ins> let span = tcx.def_span(def_id); let loc = self.lookup_debug_loc(span.lo()); let file_metadata = file_metadata(self, &loc.file);


} } <del> unsafe { return llvm::LLVMRustDIBuilderCreateFunction( </del> <ins> // When we're adding a method to a type DIE, we only want a DW_AT_declaration there, because // LLVM LTO can't unify type definitions when a child DIE is a full subprogram definition. // When we use this `decl` below, the subprogram definition gets created at the CU level // with a DW_AT_specification pointing back to the type's declaration. let decl = is_method.then(|| unsafe { llvm::LLVMRustDIBuilderCreateMethod( DIB(self), containing_scope, name.as_ptr().cast(), name.len(), linkage_name.as_ptr().cast(), linkage_name.len(), file_metadata, loc.line, function_type_metadata, flags, spflags & !DISPFlags::SPFlagDefinition, template_parameters, ) }); return unsafe { llvm::LLVMRustDIBuilderCreateFunction( </ins> DIB(self), containing_scope, name.as_ptr().cast(),


spflags, maybe_definition_llfn, template_parameters, <del> None, ); } </del> <ins> decl, ) }; </ins> fn get_function_signature<'ll, 'tcx>( cx: &CodegenCx<'ll, 'tcx>,


names } <ins> /// Returns a scope, plus `true` if that's a type scope for "class" methods, /// otherwise `false` for plain namespace scopes. </ins> fn get_containing_scope<'ll, 'tcx>( cx: &CodegenCx<'ll, 'tcx>, instance: Instance<'tcx>, <del> ) -> &'ll DIScope { </del> <ins> ) -> (&'ll DIScope, bool) { </ins> // First, let's see if this is a method within an inherent impl. Because // if yes, we want to make the result subroutine DIE a child of the // subroutine's self-type. <del> let self_type = cx.tcx.impl_of_method(instance.def_id()).and_then(|impl_def_id| { </del> <ins> if let Some(impl_def_id) = cx.tcx.impl_of_method(instance.def_id()) { </ins> // If the method does *not* belong to a trait, proceed if cx.tcx.trait_id_of_impl(impl_def_id).is_none() { let impl_self_ty = cx.tcx.subst_and_normalize_erasing_regions(


// Only "class" methods are generally understood by LLVM, // so avoid methods on other types (e.g., `<*mut T>::null`). <del> match impl_self_ty.kind() { ty::Adt(def, ..) if !def.is_box() => { // Again, only create type information if full debuginfo is enabled if cx.sess().opts.debuginfo == DebugInfo::Full && !impl_self_ty.has_param() { Some(type_di_node(cx, impl_self_ty)) } else { Some(namespace::item_namespace(cx, def.did())) } </del> <ins> if let ty::Adt(def, ..) = impl_self_ty.kind() && !def.is_box() { // Again, only create type information if full debuginfo is enabled if cx.sess().opts.debuginfo == DebugInfo::Full && !impl_self_ty.has_param() { return (type_di_node(cx, impl_self_ty), true); } else { return (namespace::item_namespace(cx, def.did()), false); </ins> } <del> _ => None, </del> } } else { // For trait method impls we still use the "parallel namespace" // strategy <del> None </del> } <del> }); </del> <ins> } </ins> <del> self_type.unwrap_or_else(|| { namespace::item_namespace( cx, DefId { krate: instance.def_id().krate, index: cx .tcx .def_key(instance.def_id()) .parent .expect("get_containing_scope: missing parent?"), }, ) }) </del> <ins> let scope = namespace::item_namespace( cx, DefId { krate: instance.def_id().krate, index: cx .tcx .def_key(instance.def_id()) .parent .expect("get_containing_scope: missing parent?"), }, ); (scope, false) </ins> } }


Decl: Option<&'a DIDescriptor>, ) -> &'a DISubprogram; <ins> pub fn LLVMRustDIBuilderCreateMethod<'a>( Builder: &DIBuilder<'a>, Scope: &'a DIDescriptor, Name: *const c_char, NameLen: size_t, LinkageName: *const c_char, LinkageNameLen: size_t, File: &'a DIFile, LineNo: c_uint, Ty: &'a DIType, Flags: DIFlags, SPFlags: DISPFlags, TParam: &'a DIArray, ) -> &'a DISubprogram; </ins> pub fn LLVMRustDIBuilderCreateBasicType<'a>( Builder: &DIBuilder<'a>, Name: *const c_char,


return wrap(Sub); } <ins> extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateMethod( LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, size_t NameLen, const char *LinkageName, size_t LinkageNameLen, LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty, LLVMRustDIFlags Flags, LLVMRustDISPFlags SPFlags, LLVMMetadataRef TParam) { DITemplateParameterArray TParams = DITemplateParameterArray(unwrap<MDTuple>(TParam)); DISubprogram::DISPFlags llvmSPFlags = fromRust(SPFlags); DINode::DIFlags llvmFlags = fromRust(Flags); DISubprogram *Sub = Builder->createMethod( unwrapDI<DIScope>(Scope), StringRef(Name, NameLen), StringRef(LinkageName, LinkageNameLen), unwrapDI<DIFile>(File), LineNo, unwrapDI<DISubroutineType>(Ty), 0, 0, nullptr, // VTable params aren't used llvmFlags, llvmSPFlags, TParams); return wrap(Sub); } </ins> extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateBasicType( LLVMRustDIBuilderRef Builder, const char *Name, size_t NameLen, uint64_t SizeInBits, unsigned Encoding) {


<ins> # ignore-cross-compile include ../tools.mk # With the upgrade to LLVM 16, this was getting: # #   error: Cannot represent a difference across sections # # The error stemmed from DI function definitions under type scopes, fixed by # only declaring in type scope and defining the subprogram elsewhere. all: $(RUSTC) lib.rs --test -C lto=fat -C debuginfo=2 -C incremental=$(TMPDIR)/inc-fat </ins>


<ins> extern crate alloc; #[cfg(test)] mod tests { #[test] fn something_alloc() { assert_eq!(Vec::<u32>::new(), Vec::<u32>::new()); } } </ins>


/// use std::sync::Arc; /// use std::task::{Context, Poll, Wake}; /// use std::thread::{self, Thread}; <ins> /// use core::pin::pin; </ins> /// /// /// A waker that wakes up the current thread when called. /// struct ThreadWaker(Thread);


/// /// Run a future to completion on the current thread. /// fn block_on<T>(fut: impl Future<Output = T>) -> T { ///     // Pin the future so it can be polled. <del> ///     let mut fut = Box::pin(fut); </del> <ins> ///     let mut fut = pin!(fut); </ins> /// ///     // Create a new context to be passed to the future. ///     let t = thread::current();


eprint('ERROR: vendoring required, but vendor directory does not exist.') eprint('       Run `cargo vendor {}` to initialize the ' 'vendor directory.'.format(sync_dirs)) <del> eprint('Alternatively, use the pre-vendored `rustc-src` dist component.') </del> <ins> eprint('       Alternatively, use the pre-vendored `rustc-src` dist component.') eprint('       To get a stable/beta/nightly version, download it from: ') eprint('       ' 'https://forge.rust-lang.org/infra/other-installation-methods.html#source-code') eprint('       To get a specific commit version, download it using the below URL,') eprint('       replacing <commit> with a specific commit checksum: ') eprint('       ' 'https://ci-artifacts.rust-lang.org/rustc-builds/<commit>/rustc-nightly-src.tar.xz') eprint('       Once you have the source downloaded, place the vendor directory') eprint('       from the archive in the root of the rust project.') </ins> raise Exception("{} not found".format(vendor_dir)) if not os.path.exists(cargo_dir):


Change this file to make users of the `download-ci-llvm` configuration download a new version of LLVM from CI, even if the LLVM submodule hasn’t changed. <del> Last change is for: https://github.com/rust-lang/rust/pull/109373 </del> <ins> Last change is for: https://github.com/rust-lang/rust/pull/96971 </ins>


<ins> // run-fail // check-run-results // exec-env:RUST_BACKTRACE=0 // Test that we format the panic message only once. // Regression test for https://github.com/rust-lang/rust/issues/110717 use std::fmt; struct PrintOnFmt; impl fmt::Display for PrintOnFmt { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { eprintln!("fmt"); f.write_str("PrintOnFmt") } } fn main() { panic!("{}", PrintOnFmt) } </ins>


<ins> fmt thread 'main' panicked at 'PrintOnFmt', $DIR/fmt-only-once.rs:20:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace </ins>


if self.target.contains("windows") { build_cred( "cargo-credential-wincred", <del> "src/tools/cargo/crates/credential/cargo-credential-wincred", </del> <ins> "src/tools/cargo/credential/cargo-credential-wincred", </ins> ); } if self.target.contains("apple-darwin") { build_cred( "cargo-credential-macos-keychain", <del> "src/tools/cargo/crates/credential/cargo-credential-macos-keychain", </del> <ins> "src/tools/cargo/credential/cargo-credential-macos-keychain", </ins> ); } build_cred( "cargo-credential-1password", <del> "src/tools/cargo/crates/credential/cargo-credential-1password", </del> <ins> "src/tools/cargo/credential/cargo-credential-1password", </ins> ); cargo_bin_path }


<ins> // check-pass #![feature(inline_const)] fn main() { let _my_usize = const { let a = 10_usize; let b: &'_ usize = &a; *b }; } </ins>


} } <del> impl Visitor<'_> for CanConstProp { </del> <ins> impl<'tcx> Visitor<'tcx> for CanConstProp { fn visit_place(&mut self, place: &Place<'tcx>, mut context: PlaceContext, loc: Location) { use rustc_middle::mir::visit::PlaceContext::*; // Dereferencing just read the addess of `place.local`. if place.projection.first() == Some(&PlaceElem::Deref) { context = NonMutatingUse(NonMutatingUseContext::Copy); } self.visit_local(place.local, context, loc); self.visit_projection(place.as_ref(), context, loc); } </ins> fn visit_local(&mut self, local: Local, context: PlaceContext, _: Location) { use rustc_middle::mir::visit::PlaceContext::*; match context { <del> // Projections are fine, because `&mut foo.x` will be caught by // `MutatingUseContext::Borrow` elsewhere. MutatingUse(MutatingUseContext::Projection) </del> // These are just stores, where the storing is not propagatable, but there may be later // mutations of the same local via `Store` | MutatingUse(MutatingUseContext::Call)


NonMutatingUse(NonMutatingUseContext::Copy) | NonMutatingUse(NonMutatingUseContext::Move) | NonMutatingUse(NonMutatingUseContext::Inspect) <del> | NonMutatingUse(NonMutatingUseContext::Projection) </del> | NonMutatingUse(NonMutatingUseContext::PlaceMention) | NonUse(_) => {}


trace!("local {:?} can't be propagated because it's used: {:?}", local, context); self.can_const_prop[local] = ConstPropMode::NoPropagation; } <ins> MutatingUse(MutatingUseContext::Projection) | NonMutatingUse(NonMutatingUseContext::Projection) => bug!("visit_place should not pass {context:?} for {local:?}"), </ins> } } }


<ins> - // MIR for `fn0` before ConstProp + // MIR for `fn0` after ConstProp fn fn0() -> bool { let mut _0: bool;                    // return place in scope 0 at $DIR/address_of_pair.rs:+0:17: +0:21 let mut _1: !;                       // in scope 0 at $DIR/address_of_pair.rs:+0:22: +9:2 let mut _2: (i32, bool);             // in scope 0 at $DIR/address_of_pair.rs:+1:9: +1:17 let _4: ();                          // in scope 0 at $DIR/address_of_pair.rs:+4:5: +6:6 let mut _6: bool;                    // in scope 0 at $DIR/address_of_pair.rs:+7:16: +7:22 scope 1 { debug pair => _2;                // in scope 1 at $DIR/address_of_pair.rs:+1:9: +1:17 let _3: *mut bool;               // in scope 1 at $DIR/address_of_pair.rs:+2:9: +2:12 scope 2 { debug ptr => _3;             // in scope 2 at $DIR/address_of_pair.rs:+2:9: +2:12 let _5: bool;                // in scope 2 at $DIR/address_of_pair.rs:+7:9: +7:12 scope 3 { } scope 4 { debug ret => _5;         // in scope 4 at $DIR/address_of_pair.rs:+7:9: +7:12 } } } bb0: { StorageLive(_2);                 // scope 0 at $DIR/address_of_pair.rs:+1:9: +1:17 _2 = (const 1_i32, const false); // scope 0 at $DIR/address_of_pair.rs:+1:20: +1:30 StorageLive(_3);                 // scope 1 at $DIR/address_of_pair.rs:+2:9: +2:12 _3 = &raw mut (_2.1: bool);      // scope 1 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL _2 = (const 1_i32, const false); // scope 2 at $DIR/address_of_pair.rs:+3:5: +3:22 StorageLive(_4);                 // scope 2 at $DIR/address_of_pair.rs:+4:5: +6:6 (*_3) = const true;              // scope 3 at $DIR/address_of_pair.rs:+5:9: +5:20 _4 = const ();                   // scope 3 at $DIR/address_of_pair.rs:+4:5: +6:6 StorageDead(_4);                 // scope 2 at $DIR/address_of_pair.rs:+6:5: +6:6 StorageLive(_5);                 // scope 2 at $DIR/address_of_pair.rs:+7:9: +7:12 StorageLive(_6);                 // scope 2 at $DIR/address_of_pair.rs:+7:16: +7:22 _6 = (_2.1: bool);               // scope 2 at $DIR/address_of_pair.rs:+7:16: +7:22 _5 = Not(move _6);               // scope 2 at $DIR/address_of_pair.rs:+7:15: +7:22 StorageDead(_6);                 // scope 2 at $DIR/address_of_pair.rs:+7:21: +7:22 _0 = _5;                         // scope 4 at $DIR/address_of_pair.rs:+8:12: +8:15 StorageDead(_5);                 // scope 2 at $DIR/address_of_pair.rs:+9:1: +9:2 StorageDead(_3);                 // scope 1 at $DIR/address_of_pair.rs:+9:1: +9:2 StorageDead(_2);                 // scope 0 at $DIR/address_of_pair.rs:+9:1: +9:2 return;                          // scope 0 at $DIR/address_of_pair.rs:+9:2: +9:2 } } </ins>


<ins> // unit-test: ConstProp // EMIT_MIR address_of_pair.fn0.ConstProp.diff pub fn fn0() -> bool { let mut pair = (1, false); let ptr = core::ptr::addr_of_mut!(pair.1); pair = (1, false); unsafe { *ptr = true; } let ret = !pair.1; return ret; } pub fn main() { println!("{}", fn0()); } </ins>


bb0: { StorageLive(_1);                 // scope 0 at $DIR/const_prop_miscompile.rs:+1:9: +1:14 <del> -         _1 = (const 1_i32,);             // scope 0 at $DIR/const_prop_miscompile.rs:+1:17: +1:21 +         _1 = const (1_i32,);             // scope 0 at $DIR/const_prop_miscompile.rs:+1:17: +1:21 </del> <ins> _1 = (const 1_i32,);             // scope 0 at $DIR/const_prop_miscompile.rs:+1:17: +1:21 </ins> StorageLive(_2);                 // scope 1 at $DIR/const_prop_miscompile.rs:+2:5: +4:6 StorageLive(_3);                 // scope 2 at $DIR/const_prop_miscompile.rs:+3:10: +3:22 _3 = &raw mut (_1.0: i32);       // scope 2 at $DIR/const_prop_miscompile.rs:+3:10: +3:22


bb0: { StorageLive(_1);                 // scope 0 at $DIR/const_prop_miscompile.rs:+1:9: +1:14 <del> -         _1 = (const 1_i32,);             // scope 0 at $DIR/const_prop_miscompile.rs:+1:17: +1:21 +         _1 = const (1_i32,);             // scope 0 at $DIR/const_prop_miscompile.rs:+1:17: +1:21 </del> <ins> _1 = (const 1_i32,);             // scope 0 at $DIR/const_prop_miscompile.rs:+1:17: +1:21 </ins> StorageLive(_2);                 // scope 1 at $DIR/const_prop_miscompile.rs:+2:6: +2:14 _2 = &mut (_1.0: i32);           // scope 1 at $DIR/const_prop_miscompile.rs:+2:6: +2:14 (*_2) = const 5_i32;             // scope 1 at $DIR/const_prop_miscompile.rs:+2:5: +2:18


assert_eq!(self.metas.len(), self.stable_crate_ids.len()); let num = CrateNum::new(self.stable_crate_ids.len()); if let Some(&existing) = self.stable_crate_ids.get(&root.stable_crate_id()) { <del> let crate_name0 = root.name(); if let Some(crate_name1) = self.metas[existing].as_ref().map(|data| data.name()) { </del> <ins> // Check for (potential) conflicts with the local crate if existing == LOCAL_CRATE { Err(CrateError::SymbolConflictsCurrent(root.name())) } else if let Some(crate_name1) = self.metas[existing].as_ref().map(|data| data.name()) { let crate_name0 = root.name(); </ins> Err(CrateError::StableCrateIdCollision(crate_name0, crate_name1)) } else { <del> Err(CrateError::SymbolConflictsCurrent(crate_name0)) </del> <ins> Err(CrateError::NotFound(root.name())) </ins> } } else { self.metas.push(None);


DlSym(String), LocatorCombined(Box<CombinedLocatorError>), NonDylibPlugin(Symbol), <ins> NotFound(Symbol), </ins> } enum MetadataError<'a> {


CrateError::NonDylibPlugin(crate_name) => { sess.emit_err(errors::NoDylibPlugin { span, crate_name }); } <ins> CrateError::NotFound(crate_name) => { sess.emit_err(errors::CannotFindCrate { span, crate_name, add_info: String::new(), missing_core, current_crate: sess.opts.crate_name.clone().unwrap_or("<unknown>".to_string()), is_nightly_build: sess.is_nightly_build(), profiler_runtime: Symbol::intern(&sess.opts.unstable_opts.profiler_runtime), locator_triple: sess.opts.target_triple.clone(), }); } </ins> } } }


--crate-type=rlib  --edition=2018  c.rs 2>&1 | tee $(TMPDIR)/output.txt || exit 0 <del> $(CGREP) E0519 < $(TMPDIR)/output.txt </del> <ins> $(CGREP) E0463 < $(TMPDIR)/output.txt </ins> $(CGREP) -v "internal compiler error" < $(TMPDIR)/output.txt


} if tcx.sess.opts.unstable_opts.drop_tracking_mir && let DefKind::Generator = tcx.def_kind(closure_def_id) <ins> && let Some(generator_layout) = tcx.mir_generator_witnesses(closure_def_id) </ins> { <del> let generator_layout = tcx.mir_generator_witnesses(closure_def_id); </del> for interior_ty in &generator_layout.field_tys { label_match(interior_ty.ty, interior_ty.source_info.span); }


if encode_opt { record!(self.tables.optimized_mir[def_id.to_def_id()] <- tcx.optimized_mir(def_id)); <del> if tcx.sess.opts.unstable_opts.drop_tracking_mir && let DefKind::Generator = self.tcx.def_kind(def_id) { record!(self.tables.mir_generator_witnesses[def_id.to_def_id()] <- tcx.mir_generator_witnesses(def_id)); </del> <ins> if tcx.sess.opts.unstable_opts.drop_tracking_mir && let DefKind::Generator = self.tcx.def_kind(def_id) && let Some(witnesses) = tcx.mir_generator_witnesses(def_id) { record!(self.tables.mir_generator_witnesses[def_id.to_def_id()] <- witnesses); </ins> } } if encode_const {


} } <del> query mir_generator_witnesses(key: DefId) -> &'tcx mir::GeneratorLayout<'tcx> { </del> <ins> query mir_generator_witnesses(key: DefId) -> &'tcx Option<mir::GeneratorLayout<'tcx>> { </ins> arena_cache desc { |tcx| "generator witness types for `{}`", tcx.def_path_str(key) } cache_on_disk_if { key.is_local() }


self, def_id: DefId, ) -> impl Iterator<Item = ty::EarlyBinder<Ty<'tcx>>> { <del> let generator_layout = &self.mir_generator_witnesses(def_id); </del> <ins> let generator_layout = self.mir_generator_witnesses(def_id); </ins> generator_layout <del> .field_tys .iter() </del> <ins> .as_ref() .map_or_else(|| [].iter(), |l| l.field_tys.iter()) </ins> .filter(|decl| !decl.ignore_for_traits) .map(|decl| ty::EarlyBinder(decl.ty)) }


pub(crate) fn mir_generator_witnesses<'tcx>( tcx: TyCtxt<'tcx>, def_id: LocalDefId, <del> ) -> GeneratorLayout<'tcx> { </del> <ins> ) -> Option<GeneratorLayout<'tcx>> { </ins> assert!(tcx.sess.opts.unstable_opts.drop_tracking_mir); let (body, _) = tcx.mir_promoted(def_id);


// Get the interior types and substs which typeck computed let movable = match *gen_ty.kind() { ty::Generator(_, _, movability) => movability == hir::Movability::Movable, <ins> ty::Error(_) => return None, </ins> _ => span_bug!(body.span, "unexpected generator type {}", gen_ty), };


check_suspend_tys(tcx, &generator_layout, &body); <del> generator_layout </del> <ins> Some(generator_layout) </ins> } impl<'tcx> MirPass<'tcx> for StateTransform {


&& generator_did.is_local() // Try to avoid cycles. && !generator_within_in_progress_typeck <ins> && let Some(generator_info) = self.tcx.mir_generator_witnesses(generator_did) </ins> { <del> let generator_info = &self.tcx.mir_generator_witnesses(generator_did); </del> debug!(?generator_info); 'find_source: for (variant, source_info) in generator_info.variant_fields.iter().zip(&generator_info.variant_source_info) {


<ins> // compile-flags: -Zdrop-tracking-mir --edition=2021 #![feature(generators)] pub async fn async_bad_body() { match true {} //~ ERROR non-exhaustive patterns: type `bool` is non-empty } pub fn generator_bad_body() { || { // 'non-exhaustive pattern' only seems to be reported once, so this annotation doesn't work // keep the function around so we can make sure it doesn't ICE match true {}; // ERROR non-exhaustive patterns: type `bool` is non-empty yield (); }; } fn main() {} </ins>


<ins> error[E0004]: non-exhaustive patterns: type `bool` is non-empty --> $DIR/drop-tracking-error-body.rs:6:11 | LL |     match true {} |           ^^^^ | = note: the matched value is of type `bool` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~     match true { LL +         _ => todo!(), LL ~     } | error: aborting due to previous error For more information about this error, try `rustc --explain E0004`. </ins>


[submodule "src/llvm-project"] path = src/llvm-project url = https://github.com/rust-lang/llvm-project.git <del> branch = rustc/16.0-2023-04-05 </del> <ins> branch = rustc/16.0-2023-06-05 </ins> [submodule "src/doc/embedded-book"] path = src/doc/embedded-book url = https://github.com/rust-embedded/book.git


<del> Subproject commit 533d3f338b804d54e5d0ac4fba6276af23002d9c </del> <ins> Subproject commit 22897bce7bfedc9cd3953a33419b346936263500 </ins>


let scope = Scope::TraitRefBoundary { s: self.scope }; self.with(scope, |this| { walk_list!(this, visit_generic_param, generics.params); <del> for param in generics.params { match param.kind { GenericParamKind::Lifetime { .. } => {} GenericParamKind::Type { default, .. } => { if let Some(ty) = default { this.visit_ty(ty); } } GenericParamKind::Const { ty, default } => { this.visit_ty(ty); if let Some(default) = default { this.visit_body(this.tcx.hir().body(default.body)); } } } } </del> walk_list!(this, visit_where_predicate, generics.predicates); }) }


// like implicit `?Sized` or const-param-has-ty predicates. } } <ins> match p.kind { GenericParamKind::Lifetime { .. } => {} GenericParamKind::Type { default, .. } => { if let Some(ty) = default { self.visit_ty(ty); } } GenericParamKind::Const { ty, default } => { self.visit_ty(ty); if let Some(default) = default { self.visit_body(self.tcx.hir().body(default.body)); } } } </ins> } }


<ins> #![feature(non_lifetime_binders)] //~^ WARNING the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes pub fn bar() where for<const N: usize = { (||1usize)() }> V: IntoIterator //~^ ERROR cannot find type `V` in this scope [E0412] { } fn main() { bar(); } </ins>


<ins> error[E0412]: cannot find type `V` in this scope --> $DIR/issue-112547.rs:8:4 | LL | }> V: IntoIterator |    ^ not found in this scope | help: you might be missing a type parameter | LL | pub fn bar<V>() |           +++ warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/issue-112547.rs:1:12 | LL | #![feature(non_lifetime_binders)] |            ^^^^^^^^^^^^^^^^^^^^ | = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information = note: `#[warn(incomplete_features)]` on by default error: aborting due to previous error; 1 warning emitted For more information about this error, try `rustc --explain E0412`. </ins>


<ins> #![feature(const_trait_impl, effects)] const fn test() -> impl ~const Fn() { //~ ERROR ~const can only be applied to `#[const_trait]` traits const move || { //~ ERROR const closures are experimental let sl: &[u8] = b"foo"; match sl { [first, remainder @ ..] => { assert_eq!(first, &b'f'); } [] => panic!(), } } } fn main() {} </ins>


<ins> error[E0658]: const closures are experimental --> $DIR/ice-112822-expected-type-for-param.rs:4:5 | LL |     const move || { |     ^^^^^ | = note: see issue #106003 <https://github.com/rust-lang/rust/issues/106003> for more information = help: add `#![feature(const_closures)]` to the crate attributes to enable error: ~const can only be applied to `#[const_trait]` traits --> $DIR/ice-112822-expected-type-for-param.rs:3:32 | LL | const fn test() -> impl ~const Fn() { |                                ^^^^ error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0658`. </ins>


"rustc_hir", "rustc_middle", "rustc_span", <ins> "scoped-tls", </ins> "tracing", ]


rustc_middle = { path = "../rustc_middle", optional = true } rustc_span = { path = "../rustc_span", optional = true } tracing = "0.1" <ins> scoped-tls = "1.0" </ins> [features] default = [


// Make this module private for now since external users should not call these directly. mod rustc_smir; <ins> #[macro_use] extern crate scoped_tls; </ins>


fn rustc_tables(&mut self, f: &mut dyn FnMut(&mut Tables<'_>)); } <del> thread_local! { /// A thread local variable that stores a pointer to the tables mapping between TyCtxt /// datastructures and stable MIR datastructures. static TLV: Cell<*mut ()> = const { Cell::new(std::ptr::null_mut()) }; } </del> <ins> // A thread local variable that stores a pointer to the tables mapping between TyCtxt // datastructures and stable MIR datastructures scoped_thread_local! (static TLV: Cell<*mut ()>); </ins> pub fn run(mut context: impl Context, f: impl FnOnce()) { <del> assert!(TLV.get().is_null()); </del> <ins> assert!(!TLV.is_set()); </ins> fn g<'a>(mut context: &mut (dyn Context + 'a), f: impl FnOnce()) { <del> TLV.set(&mut context as *mut &mut _ as _); f(); TLV.replace(std::ptr::null_mut()); </del> <ins> let ptr: *mut () = &mut context as *mut &mut _ as _; TLV.set(&Cell::new(ptr), || { f(); }); </ins> } g(&mut context, f); }


/// Loads the current context and calls a function with it. /// Do not nest these, as that will ICE. pub(crate) fn with<R>(f: impl FnOnce(&mut dyn Context) -> R) -> R { <del> let ptr = TLV.replace(std::ptr::null_mut()) as *mut &mut dyn Context; assert!(!ptr.is_null()); let ret = f(unsafe { *ptr }); TLV.set(ptr as _); ret </del> <ins> assert!(TLV.is_set()); TLV.with(|tlv| { let ptr = tlv.get(); assert!(!ptr.is_null()); f(unsafe { *(ptr as *mut &mut dyn Context) }) }) </ins> }


use rustc_hir::{HirId, Pat, PatKind}; use rustc_infer::infer; use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; <ins> use rustc_middle::mir::interpret::ErrorHandled; </ins> use rustc_middle::ty::{self, Adt, BindingMode, Ty, TypeVisitableExt}; use rustc_session::lint::builtin::NON_EXHAUSTIVE_OMITTED_PATTERNS; use rustc_span::edit_distance::find_best_match_for_name;


len: ty::Const<'tcx>, min_len: u64, ) -> (Option<Ty<'tcx>>, Ty<'tcx>) { <del> let guar = if let Some(len) = len.try_eval_target_usize(self.tcx, self.param_env) { </del> <ins> let len = match len.eval(self.tcx, self.param_env, None) { Ok(val) => val .try_to_scalar() .and_then(|scalar| scalar.try_to_int().ok()) .and_then(|int| int.try_to_target_usize(self.tcx).ok()), Err(ErrorHandled::Reported(..)) => { let guar = self.error_scrutinee_unfixed_length(span); return (Some(Ty::new_error(self.tcx, guar)), arr_ty); } Err(ErrorHandled::TooGeneric(..)) => None, }; let guar = if let Some(len) = len { </ins> // Now we know the length... if slice.is_none() { // ...and since there is no variable-length pattern,


<ins> #![allow(incomplete_features)] #![feature(generic_const_exprs)] fn something(path: [usize; N]) -> impl Clone { //~^ ERROR cannot find value `N` in this scope match path { [] => 0, //~ ERROR cannot pattern-match on an array without a fixed length _ => 1, }; } fn main() {} </ins>


<ins> error[E0425]: cannot find value `N` in this scope --> $DIR/issue-116186.rs:4:28 | LL | fn something(path: [usize; N]) -> impl Clone { |                            ^ not found in this scope | help: you might be missing a const parameter | LL | fn something<const N: /* Type */>(path: [usize; N]) -> impl Clone { |             +++++++++++++++++++++ error[E0730]: cannot pattern-match on an array without a fixed length --> $DIR/issue-116186.rs:7:9 | LL |         [] => 0, |         ^^ error: aborting due to 2 previous errors Some errors have detailed explanations: E0425, E0730. For more information about an error, try `rustc --explain E0425`. </ins>


<ins> // test for #113326 #![feature(type_alias_impl_trait)] pub type Diff = impl Fn(usize) -> usize; pub fn lift() -> Diff { |_: usize |loop {} } pub fn add( n: Diff, m: Diff, ) -> Diff { move |x: usize| m(n(x)) //~ ERROR: concrete type differs } fn main() {} </ins>


<ins> error: concrete type differs from previous defining opaque type use --> $DIR/recursive-fn-tait.rs:14:5 | LL |     move |x: usize| m(n(x)) |     ^^^^^^^^^^^^^^^^^^^^^^^ expected `{closure@$DIR/recursive-fn-tait.rs:7:5: 7:16}`, got `{closure@$DIR/recursive-fn-tait.rs:14:5: 14:20}` | note: previous use here --> $DIR/recursive-fn-tait.rs:7:5 | LL |     |_: usize |loop {} |     ^^^^^^^^^^^^^^^^^^ error: aborting due to previous error </ins>


use std::path::{Path, PathBuf}; use std::process::Command; <del> use build_helper::ci::CiEnv; </del> use tracing::*; use crate::common::{Config, Debugger, FailMode, Mode, PassMode};


/// `//[foo]`), then the property is ignored unless `cfg` is /// `Some("foo")`. fn load_from(&mut self, testfile: &Path, cfg: Option<&str>, config: &Config) { <del> // In CI, we've sometimes encountered non-determinism related to truncating very long paths. // Set a consistent (short) prefix to avoid issues, but only in CI to avoid regressing the // contributor experience. if CiEnv::is_ci() { self.remap_src_base = config.mode == Mode::Ui && !config.suite.contains("rustdoc"); } </del> let mut has_edition = false; if !testfile.is_dir() { let file = File::open(testfile).unwrap();


use rustc_middle::ty::{ self, fold::BottomUpFolder, print::TraitPredPrintModifiersAndPath, Ty, TypeFoldable, }; <del> use rustc_span::Span; </del> <ins> use rustc_span::{symbol::kw, Span}; </ins> use rustc_trait_selection::traits; use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt;


continue; } <ins> // HACK: `async fn() -> Self` in traits is "ok"... // This is not really that great, but it's similar to why the `-> Self` // return type is well-formed in traits even when `Self` isn't sized. if let ty::Param(param_ty) = *proj_term.kind() && param_ty.name == kw::SelfUpper && matches!(opaque.origin, hir::OpaqueTyOrigin::AsyncFn(_)) && opaque.in_trait { continue; } </ins> let proj_ty = Ty::new_projection(cx.tcx, proj.projection_ty.def_id, proj.projection_ty.args); // For every instance of the projection type in the bounds,


<ins> // check-pass // edition:2021 #![deny(opaque_hidden_inferred_bound)] trait Repository /* : ?Sized */ { async fn new() -> Self; } struct MyRepository {} impl Repository for MyRepository { async fn new() -> Self { todo!() } } fn main() {} </ins>


let mut tool = tool::ErrorIndex::command(builder); tool.arg("markdown").arg(&output); <del> let _guard = </del> <ins> let guard = </ins> builder.msg(Kind::Test, compiler.stage, "error-index", compiler.host, compiler.host); let _time = util::timeit(&builder); builder.run_quiet(&mut tool); <ins> drop(guard); </ins> // The tests themselves need to link to std, so make sure it is // available. builder.ensure(compile::Std::new(compiler, compiler.host));


}; debug!("make_shim({:?}) = untransformed {:?}", instance, result); <del> pm::run_passes( </del> <ins> // We don't validate MIR here because the shims may generate code that's // only valid in a reveal-all param-env. However, since we do initial // validation with the MirBuilt phase, which uses a user-facing param-env. // This causes validation errors when TAITs are involved. pm::run_passes_no_validate( </ins> tcx, &mut result, &[


<ins> // crate foo #![feature(type_alias_impl_trait)] type Tait = impl Sized; fn _constrain() -> Tait {} struct WrapperWithDrop<T>(T); impl<T> Drop for WrapperWithDrop<T> { fn drop(&mut self) {} } pub struct Foo(WrapperWithDrop<Tait>); trait Id { type Id: ?Sized; } impl<T: ?Sized> Id for T { type Id = T; } pub struct Bar(WrapperWithDrop<<Tait as Id>::Id>); </ins>


<ins> // aux-build:drop-shim-relates-opaque-aux.rs // compile-flags: -Zvalidate-mir --crate-type=lib // build-pass extern crate drop_shim_relates_opaque_aux; pub fn drop_foo(_: drop_shim_relates_opaque_aux::Foo) {} pub fn drop_bar(_: drop_shim_relates_opaque_aux::Bar) {} fn main() {} </ins>


use super::ResolverAstLoweringExt; use rustc_ast::visit::{self, BoundKind, LifetimeCtxt, Visitor}; use rustc_ast::{GenericBounds, Lifetime, NodeId, PathSegment, PolyTraitRef, Ty, TyKind}; <del> use rustc_hir::def::LifetimeRes; </del> <ins> use rustc_hir::def::{DefKind, LifetimeRes, Res}; </ins> use rustc_middle::span_bug; use rustc_middle::ty::ResolverAstLowering; use rustc_span::symbol::{kw, Ident};


} fn visit_ty(&mut self, t: &'ast Ty) { <del> match t.kind { </del> <ins> match &t.kind { TyKind::Path(None, _) => { // We can sometimes encounter bare trait objects // which are represented in AST as paths. if let Some(partial_res) = self.resolver.get_partial_res(t.id) && let Some(Res::Def(DefKind::Trait | DefKind::TraitAlias, _)) = partial_res.full_res() { self.current_binders.push(t.id); visit::walk_ty(self, t); self.current_binders.pop(); } else { visit::walk_ty(self, t); } } </ins> TyKind::BareFn(_) => { self.current_binders.push(t.id); visit::walk_ty(self, t);


<ins> // edition:2015 // check-pass // issue: 114664 fn ice() -> impl AsRef<Fn(&())> { //~^ WARN trait objects without an explicit `dyn` are deprecated //~| WARN trait objects without an explicit `dyn` are deprecated //~| WARN trait objects without an explicit `dyn` are deprecated //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! Foo } struct Foo; impl AsRef<dyn Fn(&())> for Foo { fn as_ref(&self) -> &(dyn for<'a> Fn(&'a ()) + 'static) { todo!() } } pub fn main() {} </ins>


<ins> warning: trait objects without an explicit `dyn` are deprecated --> $DIR/fresh-lifetime-from-bare-trait-obj-114664.rs:5:24 | LL | fn ice() -> impl AsRef<Fn(&())> { |                        ^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: `#[warn(bare_trait_objects)]` on by default help: use `dyn` | LL | fn ice() -> impl AsRef<dyn Fn(&())> { |                        +++ warning: trait objects without an explicit `dyn` are deprecated --> $DIR/fresh-lifetime-from-bare-trait-obj-114664.rs:5:24 | LL | fn ice() -> impl AsRef<Fn(&())> { |                        ^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> help: use `dyn` | LL | fn ice() -> impl AsRef<dyn Fn(&())> { |                        +++ warning: trait objects without an explicit `dyn` are deprecated --> $DIR/fresh-lifetime-from-bare-trait-obj-114664.rs:5:24 | LL | fn ice() -> impl AsRef<Fn(&())> { |                        ^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> help: use `dyn` | LL | fn ice() -> impl AsRef<dyn Fn(&())> { |                        +++ warning: 3 warnings emitted </ins>


return; } }; <del> let (sig, map) = tcx.instantiate_bound_regions(sig, |br| { </del> <ins> let (unnormalized_sig, map) = tcx.instantiate_bound_regions(sig, |br| { </ins> use crate::renumber::RegionCtxt; let region_ctxt_fn = || {


region_ctxt_fn, ) }); <del> debug!(?sig); </del> <ins> debug!(?unnormalized_sig); </ins> // IMPORTANT: We have to prove well formed for the function signature before // we normalize it, as otherwise types like `<&'a &'b () as Trait>::Assoc` // get normalized away, causing us to ignore the `'b: 'a` bound used by the function.


// // See #91068 for an example. self.prove_predicates( <del> sig.inputs_and_output.iter().map(|ty| { </del> <ins> unnormalized_sig.inputs_and_output.iter().map(|ty| { </ins> ty::Binder::dummy(ty::PredicateKind::Clause(ty::ClauseKind::WellFormed( ty.into(), )))


term_location.to_locations(), ConstraintCategory::Boring, ); <del> let sig = self.normalize(sig, term_location); </del> <ins> let sig = self.normalize(unnormalized_sig, term_location); // HACK(#114936): `WF(sig)` does not imply `WF(normalized(sig))` // with built-in `Fn` implementations, since the impl may not be // well-formed itself. if sig != unnormalized_sig { self.prove_predicates( sig.inputs_and_output.iter().map(|ty| { ty::Binder::dummy(ty::PredicateKind::Clause( ty::ClauseKind::WellFormed(ty.into()), )) }), term_location.to_locations(), ConstraintCategory::Boring, ); } </ins> self.check_call_dest(body, term, &sig, *destination, *target, term_location); // The ordinary liveness rules will ensure that all


<ins> // <https://github.com/rust-lang/rust/issues/114936> fn whoops( s: String, f: impl for<'s> FnOnce(&'s str) -> (&'static str, [&'static &'s (); 0]), ) -> &'static str { f(&s).0 //~^ ERROR `s` does not live long enough } // <https://github.com/rust-lang/rust/issues/118876> fn extend<T>(input: &T) -> &'static T { struct Bounded<'a, 'b: 'static, T>(&'a T, [&'b (); 0]); let n: Box<dyn FnOnce(&T) -> Bounded<'static, '_, T>> = Box::new(|x| Bounded(x, [])); n(input).0 //~^ ERROR borrowed data escapes outside of function } // <https://github.com/rust-lang/rust/issues/118876> fn extend_mut<'a, T>(input: &'a mut T) -> &'static mut T { struct Bounded<'a, 'b: 'static, T>(&'a mut T, [&'b (); 0]); let mut n: Box<dyn FnMut(&mut T) -> Bounded<'static, '_, T>> = Box::new(|x| Bounded(x, [])); n(input).0 //~^ ERROR borrowed data escapes outside of function } fn main() {} </ins>


<ins> error[E0597]: `s` does not live long enough --> $DIR/check-normalized-sig-for-wf.rs:7:7 | LL |     s: String, |     - binding `s` declared here ... LL |     f(&s).0 |     --^^- |     | | |     | borrowed value does not live long enough |     argument requires that `s` is borrowed for `'static` LL | LL | } | - `s` dropped here while still borrowed error[E0521]: borrowed data escapes outside of function --> $DIR/check-normalized-sig-for-wf.rs:15:5 | LL | fn extend<T>(input: &T) -> &'static T { |              -----  - let's call the lifetime of this reference `'1` |              | |              `input` is a reference that is only valid in the function body ... LL |     n(input).0 |     ^^^^^^^^ |     | |     `input` escapes the function body here |     argument requires that `'1` must outlive `'static` error[E0521]: borrowed data escapes outside of function --> $DIR/check-normalized-sig-for-wf.rs:23:5 | LL | fn extend_mut<'a, T>(input: &'a mut T) -> &'static mut T { |               --     ----- `input` is a reference that is only valid in the function body |               | |               lifetime `'a` defined here ... LL |     n(input).0 |     ^^^^^^^^ |     | |     `input` escapes the function body here |     argument requires that `'a` must outlive `'static` error: aborting due to 3 previous errors Some errors have detailed explanations: E0521, E0597. For more information about an error, try `rustc --explain E0521`. </ins>


// Vectors, even for non-power-of-two sizes, have the same layout as // arrays but don't count as aggregate types <ins> // While LLVM theoretically supports non-power-of-two sizes, and they // often work fine, sometimes x86-isel deals with them horribly // (see #115212) so for now only use power-of-two ones. </ins> if let FieldsShape::Array { count, .. } = self.layout.fields() <ins> && count.is_power_of_two() </ins> && let element = self.field(cx, 0) && element.ty.is_integral() {


} #[no_mangle] <del> // CHECK-LABEL: @replace_short_array( pub fn replace_short_array(r: &mut [u32; 3], v: [u32; 3]) -> [u32; 3] { </del> <ins> // CHECK-LABEL: @replace_short_array_3( pub fn replace_short_array_3(r: &mut [u32; 3], v: [u32; 3]) -> [u32; 3] { </ins> // CHECK-NOT: alloca <del> // CHECK: %[[R:.+]] = load <3 x i32>, ptr %r, align 4 // CHECK: store <3 x i32> %[[R]], ptr %result // CHECK: %[[V:.+]] = load <3 x i32>, ptr %v, align 4 // CHECK: store <3 x i32> %[[V]], ptr %r </del> <ins> // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %result, ptr align 4 %r, i64 12, i1 false) // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %r, ptr align 4 %v, i64 12, i1 false) std::mem::replace(r, v) } #[no_mangle] // CHECK-LABEL: @replace_short_array_4( pub fn replace_short_array_4(r: &mut [u32; 4], v: [u32; 4]) -> [u32; 4] { // CHECK-NOT: alloca // CHECK: %[[R:.+]] = load <4 x i32>, ptr %r, align 4 // CHECK: store <4 x i32> %[[R]], ptr %result // CHECK: %[[V:.+]] = load <4 x i32>, ptr %v, align 4 // CHECK: store <4 x i32> %[[V]], ptr %r </ins> std::mem::replace(r, v) }


// CHECK-LABEL: @swap_rgb48_manually( #[no_mangle] pub fn swap_rgb48_manually(x: &mut RGB48, y: &mut RGB48) { <del> // CHECK-NOT: alloca // CHECK: %[[TEMP0:.+]] = load <3 x i16>, ptr %x, align 2 // CHECK: %[[TEMP1:.+]] = load <3 x i16>, ptr %y, align 2 // CHECK: store <3 x i16> %[[TEMP1]], ptr %x, align 2 // CHECK: store <3 x i16> %[[TEMP0]], ptr %y, align 2 </del> <ins> // FIXME: See #115212 for why this has an alloca again // CHECK: alloca [3 x i16], align 2 // CHECK: call void @llvm.memcpy.p0.p0.i64({{.+}}, i64 6, i1 false) // CHECK: call void @llvm.memcpy.p0.p0.i64({{.+}}, i64 6, i1 false) // CHECK: call void @llvm.memcpy.p0.p0.i64({{.+}}, i64 6, i1 false) </ins> let temp = *x; *x = *y;


// CHECK-LABEL: @swap_rgb48 #[no_mangle] pub fn swap_rgb48(x: &mut RGB48, y: &mut RGB48) { <ins> // FIXME: See #115212 for why this has an alloca again // CHECK: alloca [3 x i16], align 2 // CHECK: call void @llvm.memcpy.p0.p0.i64({{.+}}, i64 6, i1 false) // CHECK: call void @llvm.memcpy.p0.p0.i64({{.+}}, i64 6, i1 false) // CHECK: call void @llvm.memcpy.p0.p0.i64({{.+}}, i64 6, i1 false) swap(x, y) } type RGBA64 = [u16; 4]; // CHECK-LABEL: @swap_rgba64 #[no_mangle] pub fn swap_rgba64(x: &mut RGBA64, y: &mut RGBA64) { </ins> // CHECK-NOT: alloca <del> // CHECK: load <3 x i16> // CHECK: load <3 x i16> // CHECK: store <3 x i16> // CHECK: store <3 x i16> </del> <ins> // CHECK-DAG: %[[XVAL:.+]] = load <4 x i16>, ptr %x, align 2 // CHECK-DAG: %[[YVAL:.+]] = load <4 x i16>, ptr %y, align 2 // CHECK-DAG: store <4 x i16> %[[YVAL]], ptr %x, align 2 // CHECK-DAG: store <4 x i16> %[[XVAL]], ptr %y, align 2 </ins> swap(x, y) }


// needs drop. let adt_has_dtor = |adt_def: ty::AdtDef<'tcx>| adt_def.destructor(tcx).map(|_| DtorType::Significant); <del> let res = drop_tys_helper(tcx, query.value, query.param_env, adt_has_dtor, false).next().is_some(); </del> <ins> let res = drop_tys_helper(tcx, query.value, query.param_env, adt_has_dtor, false) .filter(filter_array_elements(tcx, query.param_env)) .next() .is_some(); </ins> debug!("needs_drop_raw({:?}) = {:?}", query, res); res } <ins> /// HACK: in order to not mistakenly assume that `[PhantomData<T>; N]` requires drop glue /// we check the element type for drop glue. The correct fix would be looking at the /// entirety of the code around `needs_drop_components` and this file and come up with /// logic that is easier to follow while not repeating any checks that may thus diverge. fn filter_array_elements<'tcx>( tcx: TyCtxt<'tcx>, param_env: ty::ParamEnv<'tcx>, ) -> impl Fn(&Result<Ty<'tcx>, AlwaysRequiresDrop>) -> bool { move |ty| match ty { Ok(ty) => match *ty.kind() { ty::Array(elem, _) => tcx.needs_drop_raw(param_env.and(elem)), _ => true, }, Err(AlwaysRequiresDrop) => true, } } </ins> fn has_significant_drop_raw<'tcx>( tcx: TyCtxt<'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>,


adt_consider_insignificant_dtor(tcx), true, ) <ins> .filter(filter_array_elements(tcx, query.param_env)) </ins> .next() .is_some(); debug!("has_significant_drop_raw({:?}) = {:?}", query, res);


<ins> // build-pass pub const fn f<T, const N: usize>(_: [std::mem::MaybeUninit<T>; N]) {} pub struct Blubb<T>(*const T); pub const fn g<T, const N: usize>(_: [Blubb<T>; N]) {} pub struct Blorb<const N: usize>([String; N]); pub const fn h(_: Blorb<0>) {} pub struct Wrap(Blorb<0>); pub const fn i(_: Wrap) {} fn main() {} </ins>


}; let vis = self.tcx.local_visibility(local_def_id); <del> let hir_id = self.tcx.hir().local_def_id_to_hir_id(local_def_id); </del> let span = self.tcx.def_span(self.item_def_id.to_def_id()); let vis_span = self.tcx.def_span(def_id); if self.in_assoc_ty && !vis.is_at_least(self.required_visibility, self.tcx) { let vis_descr = match vis { ty::Visibility::Public => "public", ty::Visibility::Restricted(vis_def_id) => { <del> if vis_def_id == self.tcx.parent_module(hir_id).to_local_def_id() { </del> <ins> if vis_def_id == self.tcx.parent_module_from_def_id(local_def_id).to_local_def_id() { </ins> "private" } else if vis_def_id.is_top_level_module() { "crate-private"


}; self.tcx.emit_spanned_lint( lint, <del> hir_id, </del> <ins> self.tcx.hir().local_def_id_to_hir_id(self.item_def_id), </ins> span, PrivateInterfacesOrBoundsLint { item_span: span,


<ins> // check-pass // compile-flags: --crate-type=lib #[allow(private_bounds)] pub trait Foo: FooImpl {} trait FooImpl {} </ins>


<ins> // Test for issues/115517 which is fixed by pull/115486 // This should not ice trait Test<const C: usize> {} trait Elide<T> { fn call(); } pub fn test() where (): Test<{ 1 + (<() as Elide(&())>::call) }>, //~^ ERROR cannot capture late-bound lifetime in constant { } fn main() {} </ins>


<ins> error: cannot capture late-bound lifetime in constant --> $DIR/escaping_bound_vars.rs:11:35 | LL |     (): Test<{ 1 + (<() as Elide(&())>::call) }>, |                                  -^ |                                  | |                                  lifetime defined here error: aborting due to previous error </ins>


<del> Subproject commit 42263494d29febc26d3c1ebdaa7b63677573ec47 </del> <ins> Subproject commit d404cba4e39df595710869988ded7cbe1104b52f </ins>


/// The difference between `unimplemented!` and [`todo!`] is that while `todo!` /// conveys an intent of implementing the functionality later and the message is "not yet /// implemented", `unimplemented!` makes no such claims. Its message is "not implemented". <del> /// Also some IDEs will mark `todo!`s. </del> <ins> /// /// Also, some IDEs will mark `todo!`s. </ins> /// /// # Panics ///


/// The difference between [`unimplemented!`] and `todo!` is that while `todo!` conveys /// an intent of implementing the functionality later and the message is "not yet /// implemented", `unimplemented!` makes no such claims. Its message is "not implemented". <del> /// Also some IDEs will mark `todo!`s. </del> <ins> /// /// Also, some IDEs will mark `todo!`s. </ins> /// /// # Panics /// <del> /// This will always [`panic!`]. </del> <ins> /// This will always [`panic!`] because `todo!` is just a shorthand for `panic!` with a /// fixed, specific message. /// /// Like `panic!`, this macro has a second form for displaying custom values. </ins> /// /// # Examples ///


/// /// ``` /// trait Foo { <del> ///     fn bar(&self); </del> <ins> ///     fn bar(&self) -> u8; </ins> ///     fn baz(&self); <ins> ///     fn qux(&self) -> Result<u64, ()>; </ins> /// } /// ``` /// /// We want to implement `Foo` on one of our types, but we also want to work on /// just `bar()` first. In order for our code to compile, we need to implement <del> /// `baz()`, so we can use `todo!`: </del> <ins> /// `baz()` and `qux()`, so we can use `todo!`: </ins> /// /// ``` /// # trait Foo { <del> /// #     fn bar(&self); </del> <ins> /// #     fn bar(&self) -> u8; </ins> /// #     fn baz(&self); <ins> /// #     fn qux(&self) -> Result<u64, ()>; </ins> /// # } /// struct MyStruct; /// /// impl Foo for MyStruct { <del> ///     fn bar(&self) { ///         // implementation goes here </del> <ins> ///     fn bar(&self) -> u8 { ///         1 + 1 </ins> ///     } /// ///     fn baz(&self) { <del> ///         // let's not worry about implementing baz() for now </del> <ins> ///         // Let's not worry about implementing baz() for now </ins> ///         todo!(); ///     } <ins> /// ///     fn qux(&self) -> Result<u64, ()> { ///         // We can add a message to todo! to display our omission. ///         // This will display: ///         // "thread 'main' panicked at 'not yet implemented: MyStruct is not yet quxable'". ///         todo!("MyStruct is not yet quxable"); ///     } </ins> /// } /// /// fn main() { ///     let s = MyStruct; ///     s.bar(); /// <del> ///     // we aren't even using baz(), so this is fine. </del> <ins> ///     // We aren't even using baz() or qux(), so this is fine. </ins> /// } /// ``` #[macro_export]


cargo.arg("--all-targets"); } <del> // Enable internal lints for clippy and rustdoc // NOTE: this doesn't enable lints for any other tools unless they explicitly add `#![warn(rustc::internal)]` // See https://github.com/rust-lang/rust/pull/80573#issuecomment-754010776 cargo.rustflag("-Zunstable-options"); </del> let _guard = builder.msg_check(&concat!(stringify!($name), " artifacts").to_lowercase(), target); run_cargo( builder,


if !features.is_empty() { cargo.arg("--features").arg(&features.join(", ")); } <ins> // Enable internal lints for clippy and rustdoc // NOTE: this doesn't enable lints for any other tools unless they explicitly add `#![warn(rustc::internal)]` // See https://github.com/rust-lang/rust/pull/80573#issuecomment-754010776 // // NOTE: We unconditionally set this here to avoid recompiling tools between `x check $tool` // and `x test $tool` executions. // See https://github.com/rust-lang/rust/issues/116538 cargo.rustflag("-Zunstable-options"); </ins> cargo }


loan_issued_at: Location, ) { let sccs = self.regioncx.constraint_sccs(); <ins> let universal_regions = self.regioncx.universal_regions(); </ins> let issuing_region_scc = sccs.scc(issuing_region); // We first handle the cases where the loan doesn't go out of scope, depending on the issuing // region's successors. for scc in sccs.depth_first_search(issuing_region_scc) { <del> // 1. Via member constraints </del> <ins> // 1. Via applied member constraints </ins> // // The issuing region can flow into the choice regions, and they are either: // - placeholders or free regions themselves, // - or also transitively outlive a free region. // <del> // That is to say, if there are member constraints here, the loan escapes the function // and cannot go out of scope. We can early return. if self.regioncx.scc_has_member_constraints(scc) { return; </del> <ins> // That is to say, if there are applied member constraints here, the loan escapes the // function and cannot go out of scope. We could early return here. // // For additional insurance via fuzzing and crater, we verify that the constraint's min // choice indeed escapes the function. In the future, we could e.g. turn this check into // a debug assert and early return as an optimization. for constraint in self.regioncx.applied_member_constraints(scc) { if universal_regions.is_universal_region(constraint.min_choice) { return; } </ins> } // 2. Via regions that are live at all points: placeholders and free regions.


let mut polonius_prec = PoloniusOutOfScopePrecomputer::new(body, regioncx); for (loan_idx, loan_data) in borrow_set.iter_enumerated() { let issuing_region = loan_data.region; <del> let issued_location = loan_data.reserve_location; </del> <ins> let loan_issued_at = loan_data.reserve_location; </ins> polonius_prec.precompute_loans_out_of_scope( loan_idx, issuing_region, <del> issued_location, </del> <ins> loan_issued_at, </ins> ); }


self.scc_universes[scc] } <del> /// Once region solving has completed, this function will return /// the member constraints that were applied to the value of a given /// region `r`. See `AppliedMemberConstraint`. pub(crate) fn applied_member_constraints(&self, r: RegionVid) -> &[AppliedMemberConstraint] { let scc = self.constraint_sccs.scc(r); </del> <ins> /// Once region solving has completed, this function will return the member constraints that /// were applied to the value of a given SCC `scc`. See `AppliedMemberConstraint`. pub(crate) fn applied_member_constraints( &self, scc: ConstraintSccIndex, ) -> &[AppliedMemberConstraint] { </ins> binary_search_util::binary_search_slice( &self.member_constraints_applied, |applied| applied.member_region_scc,


// Member constraints can also give rise to `'r: 'x` edges that // were not part of the graph initially, so watch out for those. // (But they are extremely rare; this loop is very cold.) <del> for constraint in self.applied_member_constraints(r) { </del> <ins> for constraint in self.applied_member_constraints(self.constraint_sccs.scc(r)) { </ins> let p_c = &self.member_constraints[constraint.member_constraint_index]; let constraint = OutlivesConstraint { sup: r,


self.constraint_sccs.as_ref() } <del> /// Returns whether the given SCC has any member constraints. pub(crate) fn scc_has_member_constraints(&self, scc: ConstraintSccIndex) -> bool { self.member_constraints.indices(scc).next().is_some() } </del> /// Returns whether the given SCC is live at all points: whether the representative is a /// placeholder or a free region. pub(crate) fn scc_is_live_at_all_points(&self, scc: ConstraintSccIndex) -> bool {


/// `-Zpolonius` values, enabling the borrow checker polonius analysis, and which version: legacy, /// or future prototype. <del> #[derive(Clone, Copy, PartialEq, Hash, Debug)] </del> <ins> #[derive(Clone, Copy, PartialEq, Hash, Debug, Default)] </ins> pub enum Polonius { /// The default value: disabled. <ins> #[default] </ins> Off, /// Legacy version, using datalog and the `polonius-engine` crate. Historical value for `-Zpolonius`.


Next, } <del> impl Default for Polonius { fn default() -> Self { Polonius::Off } } </del> impl Polonius { /// Returns whether the legacy version of polonius is enabled pub fn is_legacy_enabled(&self) -> bool {


<ins> error[E0046]: not all trait items implemented, missing: `call` --> $DIR/location-insensitive-scopes-issue-116657.rs:18:1 | LL |     fn call(x: Self) -> Self::Output; |     --------------------------------- `call` from trait ... LL | impl<T: PlusOne> Callable for T { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `call` in implementation error: unconstrained opaque type --> $DIR/location-insensitive-scopes-issue-116657.rs:22:19 | LL |     type Output = impl PlusOne; |                   ^^^^^^^^^^^^ | = note: `Output` must be used in combination with a concrete type within the same impl error[E0700]: hidden type for `impl PlusOne` captures lifetime that does not appear in bounds --> $DIR/location-insensitive-scopes-issue-116657.rs:28:5 | LL | fn test<'a>(y: &'a mut i32) -> impl PlusOne { |         --                     ------------ opaque type defined here |         | |         hidden type `<&'a mut i32 as Callable>::Output` captures the lifetime `'a` as defined here LL |     <&mut i32 as Callable>::call(y) |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: to declare that `impl PlusOne` captures `'a`, you can add an explicit `'a` lifetime bound | LL | fn test<'a>(y: &'a mut i32) -> impl PlusOne + 'a { |                                             ++++ error: aborting due to 3 previous errors Some errors have detailed explanations: E0046, E0700. For more information about an error, try `rustc --explain E0046`. </ins>


<ins> // This is a non-regression test for issue #116657, where NLL and `-Zpolonius=next` computed // different loan scopes when a member constraint was not ultimately applied. // revisions: nll polonius // [polonius] compile-flags: -Zpolonius=next #![feature(impl_trait_in_assoc_type)] trait Callable { type Output; fn call(x: Self) -> Self::Output; } trait PlusOne {} impl<'a> PlusOne for &'a mut i32 {} impl<T: PlusOne> Callable for T { //[nll]~^ ERROR not all trait items implemented //[polonius]~^^ ERROR not all trait items implemented type Output = impl PlusOne; //[nll]~^ ERROR unconstrained opaque type //[polonius]~^^ ERROR unconstrained opaque type } fn test<'a>(y: &'a mut i32) -> impl PlusOne { <&mut i32 as Callable>::call(y) //[nll]~^ ERROR hidden type for `impl PlusOne` captures lifetime //[polonius]~^^ ERROR hidden type for `impl PlusOne` captures lifetime } fn main() {} </ins>


// Parse the arguments, starting out with `self` being allowed... let (mut params, _) = self.parse_paren_comma_seq(|p| { p.recover_diff_marker(); <ins> let snapshot = p.create_snapshot_for_diagnostic(); </ins> let param = p.parse_param_general(req_name, first_param).or_else(|mut e| { e.emit(); let lo = p.prev_token.span; <ins> p.restore_snapshot(snapshot); </ins> // Skip every token until next possible arg or end. p.eat_to_tokens(&[&token::Comma, &token::CloseDelim(Delimiter::Parenthesis)]); // Create a placeholder argument for proper arg count (issue #34264).


<ins> #[derive(Debug)] struct Foo { #[cfg(all())] field: fn(($),), //~ ERROR expected pattern, found `$` //~^ ERROR expected pattern, found `$` } fn main() {} </ins>


<ins> error: expected pattern, found `$` --> $DIR/issue-116781.rs:4:16 | LL |     field: fn(($),), |                ^ expected pattern error: expected pattern, found `$` --> $DIR/issue-116781.rs:4:16 | LL |     field: fn(($),), |                ^ expected pattern | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 2 previous errors </ins>


<del> Subproject commit febc39711a7c91560eb0f0980916ae23c343b99d </del> <ins> Subproject commit fef3d7b14ede45d051dc688aae0bb8c8b02a0566 </ins>


let specialized = pat.specialize(pcx, &ctor); for (subpat, column) in specialized.iter().zip(&mut specialized_columns) { if subpat.is_or_pat() { <del> column.patterns.extend(subpat.iter_fields()) </del> <ins> column.patterns.extend(subpat.flatten_or_pat()) </ins> } else { column.patterns.push(subpat) }


((0, 0) | (1, 0),) => {} _ => {} } <ins> // This one caused ICE https://github.com/rust-lang/rust/issues/117378 match (0u8, 0) { (x @ 0 | x @ (1 | 2), _) => {} (3.., _) => {} } </ins> }


self.error_on_extra_if(&cond)?; // Parse block, which will always fail, but we can add a nice note to the error self.parse_block().map_err(|mut err| { <del> err.span_note( cond_span, "the `if` expression is missing a block after this condition", ); </del> <ins> if self.prev_token == token::Semi && self.token == token::AndAnd && let maybe_let = self.look_ahead(1, |t| t.clone()) && maybe_let.is_keyword(kw::Let) { err.span_suggestion( self.prev_token.span, "consider removing this semicolon to parse the `let` as part of the same chain", "", Applicability::MachineApplicable, ).span_note( self.token.span.to(maybe_let.span), "you likely meant to continue parsing the let-chain starting here", ); } else { err.span_note( cond_span, "the `if` expression is missing a block after this condition", ); } </ins> err })? }


<ins> // Issue #117720 #![feature(let_chains)] fn main() { if let () = () && let () = (); //~ERROR && let () = () { } } fn foo() { if let () = () && () == (); //~ERROR && 1 < 0 { } } fn bar() { if let () = () && () == (); //~ERROR && let () = () { } } </ins>


<ins> error: expected `{`, found `;` --> $DIR/semi-in-let-chain.rs:7:23 | LL |         && let () = (); |                       ^ expected `{` | note: you likely meant to continue parsing the let-chain starting here --> $DIR/semi-in-let-chain.rs:8:9 | LL |         && let () = () |         ^^^^^^ help: consider removing this semicolon to parse the `let` as part of the same chain | LL -         && let () = (); LL +         && let () = () | error: expected `{`, found `;` --> $DIR/semi-in-let-chain.rs:15:20 | LL |         && () == (); |                    ^ expected `{` | note: the `if` expression is missing a block after this condition --> $DIR/semi-in-let-chain.rs:14:8 | LL |       if let () = () |  ________^ LL | |         && () == (); | |___________________^ error: expected `{`, found `;` --> $DIR/semi-in-let-chain.rs:23:20 | LL |         && () == (); |                    ^ expected `{` | note: you likely meant to continue parsing the let-chain starting here --> $DIR/semi-in-let-chain.rs:24:9 | LL |         && let () = () |         ^^^^^^ help: consider removing this semicolon to parse the `let` as part of the same chain | LL -         && () == (); LL +         && () == () | error: aborting due to 3 previous errors </ins>


/// Check whether peekable iterator is empty or not. #[inline] pub fn is_empty(&mut self) -> bool { <del> self.peek().is_some() </del> <ins> self.peek().is_none() </ins> } }


assert_eq!(ys, [5, 4, 3, 2, 1]); } <ins> #[test] </ins> fn test_peekable_is_empty() { let a = [1]; let mut it = a.iter().peekable();


[[package]] name = "compiler_builtins" <del> version = "0.1.103" </del> <ins> version = "0.1.104" </ins> source = "registry+https://github.com/rust-lang/crates.io-index" <del> checksum = "a3b73c3443a5fd2438d7ba4853c64e4c8efc2404a9e28a9234cc2d5eebc6c242" </del> <ins> checksum = "99c3f9035afc33f4358773239573f7d121099856753e1bbd2a6a5207098fc741" </ins> dependencies = [ "cc", "rustc-std-workspace-core",


panic_abort = { path = "../panic_abort" } core = { path = "../core", public = true } libc = { version = "0.2.150", default-features = false, features = ['rustc-dep-of-std'], public = true } <del> compiler_builtins = { version = "0.1.103" } </del> <ins> compiler_builtins = { version = "0.1.104" } </ins> profiler_builtins = { path = "../profiler_builtins", optional = true } unwind = { path = "../unwind" } hashbrown = { version = "0.14", default-features = false, features = ['rustc-dep-of-std'] }


wasi = { version = "0.11.0", features = ['rustc-dep-of-std'], default-features = false } [target.'cfg(target_os = "uefi")'.dependencies] <del> r-efi = { version = "4.2.0", features = ['rustc-dep-of-std']} r-efi-alloc = { version = "1.0.0", features = ['rustc-dep-of-std']} </del> <ins> r-efi = { version = "4.2.0", features = ['rustc-dep-of-std'] } r-efi-alloc = { version = "1.0.0", features = ['rustc-dep-of-std'] } </ins> [features] backtrace = [


let debugger_visualizers = stat!("debugger-visualizers", || self.encode_debugger_visualizers()); <del> // Encode exported symbols info. This is prefetched in `encode_metadata` so we encode // this as late as possible to give the prefetching as much time as possible to complete. </del> <ins> // Encode exported symbols info. This is prefetched in `encode_metadata`. </ins> let exported_symbols = stat!("exported-symbols", || { self.encode_exported_symbols(tcx.exported_symbols(LOCAL_CRATE)) });


// there's no need to do dep-graph tracking for any of it. tcx.dep_graph.assert_ignored(); <del> join( || encode_metadata_impl(tcx, path), || { if tcx.sess.threads() == 1 { return; } // Prefetch some queries used by metadata encoding. // This is not necessary for correctness, but is only done for performance reasons. // It can be removed if it turns out to cause trouble or be detrimental to performance. join(|| prefetch_mir(tcx), || tcx.exported_symbols(LOCAL_CRATE)); }, ); } </del> <ins> if tcx.sess.threads() != 1 { // Prefetch some queries used by metadata encoding. // This is not necessary for correctness, but is only done for performance reasons. // It can be removed if it turns out to cause trouble or be detrimental to performance. join(|| prefetch_mir(tcx), || tcx.exported_symbols(LOCAL_CRATE)); } </ins> <del> fn encode_metadata_impl(tcx: TyCtxt<'_>, path: &Path) { </del> let mut encoder = opaque::FileEncoder::new(path) .unwrap_or_else(|err| tcx.sess.emit_fatal(FailCreateFileEncoder { err })); encoder.emit_raw_bytes(METADATA_HEADER);


// Simple cases, which don't need DST adjustment: //   * no metadata available - just log the case //   * known alignment - sized types, `[T]`, `str` or a foreign type <del> //   * packed struct - there is no alignment padding </del> <ins> // Note that looking at `field.align` is incorrect since that is not necessarily equal // to the dynamic alignment of the type. </ins> match field.ty.kind() { _ if self.llextra.is_none() => { debug!(


} _ if field.is_sized() => return simple(), ty::Slice(..) | ty::Str | ty::Foreign(..) => return simple(), <del> ty::Adt(def, _) => { if def.repr().packed() { // FIXME(eddyb) generalize the adjustment when we // start supporting packing to larger alignments. assert_eq!(self.layout.align.abi.bytes(), 1); return simple(); } } </del> _ => {} }


let unaligned_offset = bx.cx().const_usize(offset.bytes()); // Get the alignment of the field <del> let (_, unsized_align) = glue::size_and_align_of_dst(bx, field.ty, meta); </del> <ins> let (_, mut unsized_align) = glue::size_and_align_of_dst(bx, field.ty, meta); // For packed types, we need to cap alignment. if let ty::Adt(def, _) = self.layout.ty.kind() && let Some(packed) = def.repr().pack { let packed = bx.const_usize(packed.bytes()); let cmp = bx.icmp(IntPredicate::IntULT, unsized_align, packed); unsized_align = bx.select(cmp, unsized_align, packed) } </ins> // Bump the unaligned offset up to the appropriate alignment let offset = round_up_const_value_to_alignment(bx, unaligned_offset, unsized_align);


// With custom DSTS, this *will* execute user-defined code, but the same // happens at run-time so that's okay. match self.size_and_align_of(&base_meta, &field_layout)? { <del> Some((_, align)) => (base_meta, offset.align_to(align)), </del> <ins> Some((_, align)) => { // For packed types, we need to cap alignment. let align = if let ty::Adt(def, _) = base.layout().ty.kind() && let Some(packed) = def.repr().pack { align.min(packed) } else { align }; (base_meta, offset.align_to(align)) } </ins> None => { // For unsized types with an extern type tail we perform no adjustments. // NOTE: keep this in sync with `PlaceRef::project_field` in the codegen backend.


<ins> #![feature(layout_for_ptr)] use std::mem; #[repr(packed, C)] struct PackedSized { f: u8, d: [u32; 4], } #[repr(packed, C)] struct PackedUnsized { f: u8, d: [u32], } impl PackedSized { fn unsize(&self) -> &PackedUnsized { // We can't unsize via a generic type since then we get the error // that packed structs with unsized tail don't work if the tail // might need dropping. let len = 4usize; unsafe { mem::transmute((self, len)) } } } fn main() { unsafe { let p = PackedSized { f: 0, d: [1, 2, 3, 4] }; let p = p.unsize() as *const PackedUnsized; // Make sure the size computation does *not* think there is // any padding in front of the `d` field. assert_eq!(mem::size_of_val_raw(p), 1 + 4*4); // And likewise for the offset computation. let d = std::ptr::addr_of!((*p).d); assert_eq!(d.cast::<u32>().read_unaligned(), 1); } } </ins>


<ins> #![feature(layout_for_ptr)] use std::mem; #[repr(packed(4))] struct Slice([u32]); #[repr(packed(2), C)] struct PackedSized { f: u8, d: [u32; 4], } #[repr(packed(2), C)] struct PackedUnsized { f: u8, d: Slice, } impl PackedSized { fn unsize(&self) -> &PackedUnsized { // We can't unsize via a generic type since then we get the error // that packed structs with unsized tail don't work if the tail // might need dropping. let len = 4usize; unsafe { mem::transmute((self, len)) } } } fn main() { unsafe { let p = PackedSized { f: 0, d: [1, 2, 3, 4] }; let p = p.unsize() as *const PackedUnsized; // Make sure the size computation correctly adds exact 1 byte of padding // in front of the `d` field. assert_eq!(mem::size_of_val_raw(p), 1 + 1 + 4*4); // And likewise for the offset computation. let d = std::ptr::addr_of!((*p).d); assert_eq!(d.cast::<u32>().read_unaligned(), 1); } } </ins>


<ins> // run-pass #![feature(layout_for_ptr)] use std::mem; #[repr(packed(4))] struct Slice([u32]); #[repr(packed(2), C)] struct PackedSized { f: u8, d: [u32; 4], } #[repr(packed(2), C)] struct PackedUnsized { f: u8, d: Slice, } impl PackedSized { fn unsize(&self) -> &PackedUnsized { // We can't unsize via a generic type since then we get the error // that packed structs with unsized tail don't work if the tail // might need dropping. let len = 4usize; unsafe { mem::transmute((self, len)) } } } fn main() { unsafe { let p = PackedSized { f: 0, d: [1, 2, 3, 4] }; let p = p.unsize() as *const PackedUnsized; // Make sure the size computation correctly adds exact 1 byte of padding // in front of the `d` field. assert_eq!(mem::size_of_val_raw(p), 1 + 1 + 4*4); // And likewise for the offset computation. let d = std::ptr::addr_of!((*p).d); assert_eq!(d.cast::<u32>().read_unaligned(), 1); } } </ins>


<ins> // run-pass #![feature(layout_for_ptr)] use std::mem; #[repr(packed, C)] struct PackedSized { f: u8, d: [u32; 4], } #[repr(packed, C)] struct PackedUnsized { f: u8, d: [u32], } impl PackedSized { fn unsize(&self) -> &PackedUnsized { // We can't unsize via a generic type since then we get the error // that packed structs with unsized tail don't work if the tail // might need dropping. let len = 4usize; unsafe { mem::transmute((self, len)) } } } fn main() { unsafe { let p = PackedSized { f: 0, d: [1, 2, 3, 4] }; let p = p.unsize() as *const PackedUnsized; // Make sure the size computation does *not* think there is // any padding in front of the `d` field. assert_eq!(mem::size_of_val_raw(p), 1 + 4*4); // And likewise for the offset computation. let d = std::ptr::addr_of!((*p).d); assert_eq!(d.cast::<u32>().read_unaligned(), 1); } } </ins>


| Range(_, Some(e), _) | Ret(Some(e)) | Unary(_, e) <del> | Yield(Some(e)) => { </del> <ins> | Yield(Some(e)) | Yeet(Some(e)) | Become(e) => { </ins> expr = e; } Closure(closure) => { expr = &closure.body; } Gen(..) | Block(..) | ForLoop(..) | If(..) | Loop(..) | Match(..) | Struct(..) <del> | TryBlock(..) | While(..) => break Some(expr), _ => break None, </del> <ins> | TryBlock(..) | While(..) | ConstBlock(_) => break Some(expr), // FIXME: These can end in `}`, but changing these would break stable code. InlineAsm(_) | OffsetOf(_, _) | MacCall(_) | IncludedBytes(_) | FormatArgs(_) => { break None; } Break(_, None) | Range(_, None, _) | Ret(None) | Yield(None) | Array(_) | Call(_, _) | MethodCall(_) | Tup(_) | Lit(_) | Cast(_, _) | Type(_, _) | Await(_, _) | Field(_, _) | Index(_, _, _) | Underscore | Path(_, _) | Continue(_) | Repeat(_, _) | Paren(_) | Try(_) | Yeet(None) | Err => break None, </ins> } } }