<ins> // check-pass // only-x86_64 // Checks that the compiler does not actually try to allocate 4 TB during compilation and OOM crash. fn foo() -> [u8; 4 * 1024 * 1024 * 1024 * 1024] { unimplemented!() } fn main() { foo(); } </ins>


<ins> // check-pass // only-x86_64 // Checks that the compiler does not actually try to allocate 4 TB during compilation and OOM crash. fn main() { [0; 4 * 1024 * 1024 * 1024 * 1024]; } </ins>


fallback_has_occurred: bool, mutate_fullfillment_errors: impl Fn(&mut Vec<traits::FulfillmentError<'tcx>>), ) { <del> if let Err(mut errors) = self.fulfillment_cx.borrow_mut().select_where_possible(self) { </del> <ins> let result = self.fulfillment_cx.borrow_mut().select_where_possible(self); if let Err(mut errors) = result { </ins> mutate_fullfillment_errors(&mut errors); self.report_fulfillment_errors(&errors, self.inh.body_id, fallback_has_occurred); }


<ins> // #66353: ICE when trying to recover from incorrect associated type trait _Func<T> { fn func(_: Self); } trait _A { type AssocT; } fn main() { _Func::< <() as _A>::AssocT >::func(()); //~^ ERROR the trait bound `(): _A` is not satisfied //~| ERROR the trait bound `(): _Func<_>` is not satisfied } </ins>


<ins> error[E0277]: the trait bound `(): _A` is not satisfied --> $DIR/issue-66353.rs:12:14 | LL |     _Func::< <() as _A>::AssocT >::func(()); |              ^^^^^^^^^^^^^^^^^^ the trait `_A` is not implemented for `()` error[E0277]: the trait bound `(): _Func<_>` is not satisfied --> $DIR/issue-66353.rs:12:41 | LL |     fn func(_: Self); |     ----------------- required by `_Func::func` ... LL |     _Func::< <() as _A>::AssocT >::func(()); |                                         ^^ the trait `_Func<_>` is not implemented for `()` error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. </ins>


} fn check_pat(&mut self, cx: &LateContext<'_, '_>, p: &hir::Pat<'_>) { <del> if let &PatKind::Binding(_, _, ident, _) = &p.kind { </del> <ins> if let &PatKind::Binding(_, hid, ident, _) = &p.kind { if let hir::Node::Pat(parent_pat) = cx.tcx.hir().get(cx.tcx.hir().get_parent_node(hid)) { if let PatKind::Struct(_, field_pats, _) = &parent_pat.kind { for field in field_pats.iter() { if field.ident != ident { // Only check if a new name has been introduced, to avoid warning // on both the struct definition and this pattern. self.check_snake_case(cx, "variable", &ident); } } return; } } </ins> self.check_snake_case(cx, "variable", &ident); } }


<ins> #![deny(non_snake_case)] #![allow(unused_variables)] #![allow(dead_code)] enum Foo { Bad { lowerCamelCaseName: bool, //~^ ERROR structure field `lowerCamelCaseName` should have a snake case name }, Good { snake_case_name: bool, }, } fn main() { let b = Foo::Bad { lowerCamelCaseName: true }; match b { Foo::Bad { lowerCamelCaseName } => {} Foo::Good { snake_case_name: lowerCamelCaseBinding } => { } //~^ ERROR variable `lowerCamelCaseBinding` should have a snake case name } if let Foo::Good { snake_case_name: anotherLowerCamelCaseBinding } = b { } //~^ ERROR variable `anotherLowerCamelCaseBinding` should have a snake case name if let Foo::Bad { lowerCamelCaseName: yetAnotherLowerCamelCaseBinding } = b { } //~^ ERROR variable `yetAnotherLowerCamelCaseBinding` should have a snake case name } </ins>


<ins> error: structure field `lowerCamelCaseName` should have a snake case name --> $DIR/issue-66362-no-snake-case-warning-for-field-puns.rs:7:9 | LL |         lowerCamelCaseName: bool, |         ^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `lower_camel_case_name` | note: lint level defined here --> $DIR/issue-66362-no-snake-case-warning-for-field-puns.rs:1:9 | LL | #![deny(non_snake_case)] |         ^^^^^^^^^^^^^^ error: variable `lowerCamelCaseBinding` should have a snake case name --> $DIR/issue-66362-no-snake-case-warning-for-field-puns.rs:20:38 | LL |         Foo::Good { snake_case_name: lowerCamelCaseBinding } => { } |                                      ^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `lower_camel_case_binding` error: variable `anotherLowerCamelCaseBinding` should have a snake case name --> $DIR/issue-66362-no-snake-case-warning-for-field-puns.rs:24:41 | LL |     if let Foo::Good { snake_case_name: anotherLowerCamelCaseBinding } = b { } |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `another_lower_camel_case_binding` error: variable `yetAnotherLowerCamelCaseBinding` should have a snake case name --> $DIR/issue-66362-no-snake-case-warning-for-field-puns.rs:27:43 | LL |     if let Foo::Bad { lowerCamelCaseName: yetAnotherLowerCamelCaseBinding } = b { } |                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `yet_another_lower_camel_case_binding` error: aborting due to 4 previous errors </ins>


// are contravariant while return-position lifetimes are // covariant). _marker: PhantomData<fn(&'a ()) -> &'a ()>, <ins> // Ensure `Context` is `!Send` and `!Sync` in order to allow // for future `!Send` and / or `!Sync` fields. _marker2: PhantomData<*mut ()>, </ins> } impl<'a> Context<'a> {


#[must_use] #[inline] pub const fn from_waker(waker: &'a Waker) -> Self { <del> Context { waker, _marker: PhantomData } </del> <ins> Context { waker, _marker: PhantomData, _marker2: PhantomData } </ins> } /// Returns a reference to the [`Waker`] for the current task.


<del> use core::task::{Context, Poll, RawWaker, RawWakerVTable, Waker}; </del> <ins> use core::task::{Poll, RawWaker, RawWakerVTable, Waker}; </ins> #[test] fn poll_const() {


static WAKER: Waker = unsafe { Waker::from_raw(VOID_WAKER) }; <del> static CONTEXT: Context<'static> = Context::from_waker(&WAKER); static WAKER_REF: &'static Waker = CONTEXT.waker(); WAKER_REF.wake_by_ref(); </del> <ins> WAKER.wake_by_ref(); </ins> }


<ins> // check-pass #![feature(const_if_match)] enum E { A, B, C } const fn f(e: E) -> usize { match e { _ => 0 } } fn main() { const X: usize = f(E::C); assert_eq!(X, 0); assert_eq!(f(E::A), 0); } </ins>


variant_index: VariantIdx, dest: PlaceTy<'tcx, M::PointerTag>, ) -> InterpResult<'tcx> { <del> let variant_scalar = Scalar::from_u32(variant_index.as_u32()).into(); </del> <ins> // Layout computation excludes uninhabited variants from consideration // therefore there's no way to represent those variants in the given layout. if dest.layout.for_variant(self, variant_index).abi.is_uninhabited() { throw_ub!(Unreachable); } </ins> match dest.layout.variants { layout::Variants::Single { index } => { <del> if index != variant_index { throw_ub!(InvalidDiscriminant(variant_scalar)); } </del> <ins> assert_eq!(index, variant_index); </ins> } layout::Variants::Multiple { discr_kind: layout::DiscriminantKind::Tag,


discr_index, .. } => { <del> if !dest.layout.ty.variant_range(*self.tcx).unwrap().contains(&variant_index) { throw_ub!(InvalidDiscriminant(variant_scalar)); } </del> <ins> // No need to validate that the discriminant here because the // `TyLayout::for_variant()` call earlier already checks the variant is valid. </ins> let discr_val = dest.layout.ty.discriminant_for_variant(*self.tcx, variant_index).unwrap().val;


discr_index, .. } => { <del> if !variant_index.as_usize() < dest.layout.ty.ty_adt_def().unwrap().variants.len() { throw_ub!(InvalidDiscriminant(variant_scalar)); } </del> <ins> // No need to validate that the discriminant here because the // `TyLayout::for_variant()` call earlier already checks the variant is valid. </ins> if variant_index != dataful_variant { let variants_start = niche_variants.start().as_u32(); let variant_index_relative = variant_index.as_u32()


<ins> // build-pass // compile-flags: --crate-type lib // Regression test for ICE which occurred when const propagating an enum with three variants // one of which is uninhabited. pub enum ApiError {} #[allow(dead_code)] pub struct TokioError { b: bool, } pub enum Error { Api { source: ApiError, }, Ethereum, Tokio { source: TokioError, }, } struct Api; impl IntoError<Error> for Api { type Source = ApiError; fn into_error(self, error: Self::Source) -> Error { Error::Api { source: (|v| v)(error), } } } pub trait IntoError<E> { /// The underlying error type Source; /// Combine the information to produce the error fn into_error(self, source: Self::Source) -> E; } </ins>


<ins> // check-pass // ignore-emscripten no llvm_asm! support #![feature(llvm_asm)] pub fn boot(addr: Option<u32>) { unsafe { llvm_asm!("mov sp, $0"::"r" (addr)); } } fn main() {} </ins>


<ins> // edition:2018 use std::sync::{Arc, Mutex}; pub async fn f(_: ()) {} pub async fn run() { let x: Arc<Mutex<()>> = unimplemented!(); f(*x.lock().unwrap()).await; } </ins>


<ins> // aux-build: issue_67893.rs // edition:2018 // dont-check-compiler-stderr // FIXME(#71222): Add above flag because of the difference of stderrs on some env. extern crate issue_67893; fn g(_: impl Send) {} fn main() { g(issue_67893::run()) //~^ ERROR: `std::sync::MutexGuard<'_, ()>` cannot be sent between threads safely } </ins>


<ins> #![feature(intrinsics)] extern "C" { pub static FOO: extern "rust-intrinsic" fn(); } fn main() { FOO() //~ ERROR: use of extern static is unsafe } </ins>


<ins> error[E0133]: use of extern static is unsafe and requires unsafe function or block --> $DIR/issue-28575.rs:8:5 | LL |     FOO() |     ^^^ use of extern static | = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior error: aborting due to previous error For more information about this error, try `rustc --explain E0133`. </ins>


<ins> pub static TEST_STR: &'static str = "Hello world"; </ins>


<ins> // aux-build: issue_24843.rs // check-pass extern crate issue_24843; static _TEST_STR_2: &'static str = &issue_24843::TEST_STR; fn main() {} </ins>


/// Typically doesn’t need to be used directly. #[unstable(feature = "convert_float_to_int", issue = "67057")] pub trait FloatToInt<Int>: private::Sealed + Sized { <del> #[unstable(feature = "float_approx_unchecked_to", issue = "67058")] </del> <ins> #[unstable(feature = "convert_float_to_int", issue = "67057")] </ins> #[doc(hidden)] <del> unsafe fn approx_unchecked(self) -> Int; </del> <ins> unsafe fn to_int_unchecked(self) -> Int; </ins> } macro_rules! impl_float_to_int {


impl FloatToInt<$Int> for $Float { #[doc(hidden)] #[inline] <del> unsafe fn approx_unchecked(self) -> $Int { crate::intrinsics::float_to_int_approx_unchecked(self) </del> <ins> unsafe fn to_int_unchecked(self) -> $Int { #[cfg(bootstrap)] { crate::intrinsics::float_to_int_approx_unchecked(self) } #[cfg(not(bootstrap))] { crate::intrinsics::float_to_int_unchecked(self) } </ins> } } )+


/// Convert with LLVM’s fptoui/fptosi, which may return undef for values out of range /// (<https://github.com/rust-lang/rust/issues/10184>) /// This is under stabilization at <https://github.com/rust-lang/rust/issues/67058> <ins> #[cfg(bootstrap)] </ins> pub fn float_to_int_approx_unchecked<Float: Copy, Int: Copy>(value: Float) -> Int; <ins> /// Convert with LLVM’s fptoui/fptosi, which may return undef for values out of range /// (<https://github.com/rust-lang/rust/issues/10184>) /// /// Stabilized as `f32::to_int_unchecked` and `f64::to_int_unchecked`. #[cfg(not(bootstrap))] pub fn float_to_int_unchecked<Float: Copy, Int: Copy>(value: Float) -> Int; </ins> /// Returns the number of bits set in an integer type `T` /// /// The stabilized versions of this intrinsic are available on the integer


/// * Not be `NaN` /// * Not be infinite /// * Be representable in the return type `Int`, after truncating off its fractional part <del> #[unstable(feature = "float_approx_unchecked_to", issue = "67058")] </del> <ins> #[stable(feature = "float_approx_unchecked_to", since = "1.44.0")] </ins> #[inline] <del> pub unsafe fn approx_unchecked_to<Int>(self) -> Int </del> <ins> pub unsafe fn to_int_unchecked<Int>(self) -> Int </ins> where Self: FloatToInt<Int>, { <del> FloatToInt::<Int>::approx_unchecked(self) </del> <ins> FloatToInt::<Int>::to_int_unchecked(self) </ins> } /// Raw transmutation to `u32`.


/// assuming that the value is finite and fits in that type. /// /// ``` <del> /// #![feature(float_approx_unchecked_to)] /// </del> /// let value = 4.6_f32; <del> /// let rounded = unsafe { value.approx_unchecked_to::<u16>() }; </del> <ins> /// let rounded = unsafe { value.to_int_unchecked::<u16>() }; </ins> /// assert_eq!(rounded, 4); /// /// let value = -128.9_f32; <del> /// let rounded = unsafe { value.approx_unchecked_to::<i8>() }; </del> <ins> /// let rounded = unsafe { value.to_int_unchecked::<i8>() }; </ins> /// assert_eq!(rounded, std::i8::MIN); /// ``` ///


/// * Not be `NaN` /// * Not be infinite /// * Be representable in the return type `Int`, after truncating off its fractional part <del> #[unstable(feature = "float_approx_unchecked_to", issue = "67058")] </del> <ins> #[stable(feature = "float_approx_unchecked_to", since = "1.44.0")] </ins> #[inline] <del> pub unsafe fn approx_unchecked_to<Int>(self) -> Int </del> <ins> pub unsafe fn to_int_unchecked<Int>(self) -> Int </ins> where Self: FloatToInt<Int>, { <del> FloatToInt::<Int>::approx_unchecked(self) </del> <ins> FloatToInt::<Int>::to_int_unchecked(self) </ins> } /// Raw transmutation to `u64`.


} } <del> "float_to_int_approx_unchecked" => { </del> <ins> "float_to_int_unchecked" => { </ins> if float_type_width(arg_tys[0]).is_none() { span_invalid_monomorphization_error( tcx.sess, span, &format!( <del> "invalid monomorphization of `float_to_int_approx_unchecked`  </del> <ins> "invalid monomorphization of `float_to_int_unchecked`  </ins> intrinsic: expected basic float type,  found `{}`", arg_tys[0]


tcx.sess, span, &format!( <del> "invalid monomorphization of `float_to_int_approx_unchecked`  </del> <ins> "invalid monomorphization of `float_to_int_unchecked`  </ins> intrinsic:  expected basic integer type,  found `{}`", ret_ty


"fadd_fast" | "fsub_fast" | "fmul_fast" | "fdiv_fast" | "frem_fast" => { (1, vec![param(0), param(0)], param(0)) } <del> "float_to_int_approx_unchecked" => (2, vec![param(0)], param(1)), </del> <ins> "float_to_int_unchecked" => (2, vec![param(0)], param(1)), </ins> "assume" => (0, vec![tcx.types.bool], tcx.mk_unit()), "likely" => (0, vec![tcx.types.bool], tcx.types.bool),


"rand 0.7.0", "rustc-workspace-hack", "rustc_version", <ins> "serde", </ins> "shell-escape", "vergen", ]


<del> Subproject commit a0ba079b6af0f8c07c33dd8af72a51c997e58967 </del> <ins> Subproject commit 048af409232fc2d7f8fbe5469080dc8bb702c498 </ins>


None => return Ok(()), }; <ins> // Render the replacements for each suggestion let suggestions = suggestion.splice_lines(&**sm); if suggestions.is_empty() { // Suggestions coming from macros can have malformed spans. This is a heavy handed // approach to avoid ICEs by ignoring the suggestion outright. return Ok(()); } </ins> let mut buffer = StyledBuffer::new(); // Render the suggestion message


Some(Style::HeaderMsg), ); <del> // Render the replacements for each suggestion let suggestions = suggestion.splice_lines(&**sm); </del> let mut row_num = 2; let mut notice_capitalization = false; for (complete, parts, only_capitalization) in suggestions.iter().take(MAX_SUGGESTIONS) {


let show_underline = !(parts.len() == 1 && parts[0].snippet.trim() == complete.trim()) && complete.lines().count() == 1; <del> let lines = sm.span_to_lines(parts[0].span).unwrap(); </del> <ins> let lines = sm .span_to_lines(parts[0].span) .expect("span_to_lines failed when emitting suggestion"); </ins> assert!(!lines.lines.is_empty());


pub use emitter::ColorConfig; <ins> use log::debug; </ins> use Level::*; use emitter::{is_case_difference, Emitter, EmitterWriter};


self.substitutions .iter() <ins> .filter(|subst| { // Suggestions coming from macros can have malformed spans. This is a heavy // handed approach to avoid ICEs by ignoring the suggestion outright. let invalid = subst.parts.iter().any(|item| cm.is_valid_span(item.span).is_err()); if invalid { debug!("splice_lines: suggestion contains an invalid span: {:?}", subst); } !invalid }) </ins> .cloned() .map(|mut substitution| { // Assumption: all spans are in the same file, and all spans


lo.line != hi.line } <del> pub fn span_to_lines(&self, sp: Span) -> FileLinesResult { debug!("span_to_lines(sp={:?})", sp); </del> <ins> pub fn is_valid_span(&self, sp: Span) -> Result<(Loc, Loc), SpanLinesError> { </ins> let lo = self.lookup_char_pos(sp.lo()); debug!("span_to_lines: lo={:?}", lo); let hi = self.lookup_char_pos(sp.hi()); debug!("span_to_lines: hi={:?}", hi); if lo.file.start_pos != hi.file.start_pos { return Err(SpanLinesError::DistinctSources(DistinctSources { begin: (lo.file.name.clone(), lo.file.start_pos), end: (hi.file.name.clone(), hi.file.start_pos), })); } <ins> Ok((lo, hi)) } pub fn span_to_lines(&self, sp: Span) -> FileLinesResult { debug!("span_to_lines(sp={:?})", sp); let (lo, hi) = self.is_valid_span(sp)?; </ins> assert!(hi.line >= lo.line); let mut lines = Vec::with_capacity(hi.line - lo.line + 1);


LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ <del> thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:346:17 </del> <ins> thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:356:17 </ins> note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace error: internal compiler error: unexpected panic


<ins> //xfail-test // Creating a stack closure which references an owned pointer and then // transferring ownership of the owned box before invoking the stack // closure results in a crash. fn twice(x: ~uint) -> uint { *x * 2 } fn invoke(f : &fn() -> uint) { f(); } fn main() { let x  : ~uint         = ~9; let sq : &fn() -> uint = || { *x * *x }; twice(x); invoke(sq); } </ins>  No newline at end of file


if self.regioncx.universal_regions().is_universal_region(r) { Some(r) } else { <del> let upper_bound = self.regioncx.universal_upper_bound(r); </del> <ins> // We just want something nameable, even if it's not // actually an upper bound. let upper_bound = self.regioncx.approx_universal_upper_bound(r); </ins> if self.regioncx.upper_bound_in_region_scc(r, upper_bound) { self.to_error_region_vid(upper_bound)


lub } <ins> /// Like `universal_upper_bound`, but returns an approximation more suitable /// for diagnostics. If `r` contains multiple disjoint universal regions /// (e.g. 'a and 'b in `fn foo<'a, 'b> { ... }`, we pick the lower-numbered region. /// This corresponds to picking named regions over unnamed regions /// (e.g. picking early-bound regions over a closure late-bound region). /// /// This means that the returned value may not be a true upper bound, since /// only 'static is known to outlive disjoint universal regions. /// Therefore, this method should only be used in diagnostic code, /// where displaying *some* named universal region is better than /// falling back to 'static. pub(in crate::borrow_check) fn approx_universal_upper_bound(&self, r: RegionVid) -> RegionVid { debug!("approx_universal_upper_bound(r={:?}={})", r, self.region_value_str(r)); // Find the smallest universal region that contains all other // universal regions within `region`. let mut lub = self.universal_regions.fr_fn_body; let r_scc = self.constraint_sccs.scc(r); let static_r = self.universal_regions.fr_static; for ur in self.scc_values.universal_regions_outlived_by(r_scc) { let new_lub = self.universal_region_relations.postdom_upper_bound(lub, ur); debug!("approx_universal_upper_bound: ur={:?} lub={:?} new_lub={:?}", ur, lub, new_lub); if ur != static_r && lub != static_r && new_lub == static_r { lub = std::cmp::min(ur, lub); } else { lub = new_lub; } } debug!("approx_universal_upper_bound: r={:?} lub={:?}", r, lub); lub } </ins> /// Tests if `test` is true when applied to `lower_bound` at /// `point`. fn eval_verify_bound(


{ tcx.fold_regions(&ty, &mut false, |region, _| match *region { ty::ReVar(vid) => { <del> let upper_bound = self.universal_upper_bound(vid); </del> <ins> // Find something that we can name let upper_bound = self.approx_universal_upper_bound(vid); </ins> self.definitions[upper_bound].external_name.unwrap_or(region) } _ => region,


<ins> // edition:2018 // // Regression test for issue #67765 // Tests that we point at the proper location when giving // a lifetime error. fn main() {} async fn func<'a>() -> Result<(), &'a str> { let s = String::new(); let b = &s[..]; Err(b)?; //~ ERROR cannot return value referencing local variable `s` Ok(()) } </ins>


<ins> error[E0515]: cannot return value referencing local variable `s` --> $DIR/issue-67765-async-diagnostic.rs:13:11 | LL |     let b = &s[..]; |              - `s` is borrowed here LL | LL |     Err(b)?; |           ^ returns a value referencing data owned by the current function error: aborting due to previous error For more information about this error, try `rustc --explain E0515`. </ins>


fn main() { <del> [0].iter().flat_map(|a| [0].iter().map(|_| &a)); //~ ERROR `a` does not live long enough </del> <ins> [0].iter().flat_map(|a| [0].iter().map(|_| &a)); //~ ERROR closure may outlive </ins> }


<del> error[E0597]: `a` does not live long enough --> $DIR/unnamed-closure-doesnt-life-long-enough-issue-67634.rs:2:49 </del> <ins> error[E0373]: closure may outlive the current function, but it borrows `a`, which is owned by the current function --> $DIR/unnamed-closure-doesnt-life-long-enough-issue-67634.rs:2:44 </ins> | LL |     [0].iter().flat_map(|a| [0].iter().map(|_| &a)); <del> |                                             -   ^- ...but `a` will be dropped here, when the enclosing closure returns |                                             |   | |                                             |   `a` would have to be valid for `'_`... |                                             has type `&i32` </del> <ins> |                                            ^^^  - `a` is borrowed here |                                            | |                                            may outlive borrowed value `a` </ins> | <del> = note: functions cannot return a borrow to data owned within the function's scope, functions can only return borrows to data passed as arguments = note: to learn more, visit <https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html#dangling-references> </del> <ins> note: closure is returned here --> $DIR/unnamed-closure-doesnt-life-long-enough-issue-67634.rs:2:29 | LL |     [0].iter().flat_map(|a| [0].iter().map(|_| &a)); |                             ^^^^^^^^^^^^^^^^^^^^^^ help: to force the closure to take ownership of `a` (and any other referenced variables), use the `move` keyword | LL |     [0].iter().flat_map(|a| [0].iter().map(move |_| &a)); |                                            ^^^^^^^^ </ins> error: aborting due to previous error <del> For more information about this error, try `rustc --explain E0597`. </del> <ins> For more information about this error, try `rustc --explain E0373`. </ins>


<ins> // See https://github.com/rust-lang/rust/pull/67911#issuecomment-576023915 fn f<'a, 'b>(x: i32) -> (&'a i32, &'b i32) { let y = &x; (y, y) //~ ERROR cannot return } fn main() {} </ins>


<ins> error[E0515]: cannot return value referencing function parameter `x` --> $DIR/return-disjoint-regions.rs:4:5 | LL |     let y = &x; |             -- `x` is borrowed here LL |     (y, y) |     ^^^^^^ returns a value referencing data owned by the current function error: aborting due to previous error For more information about this error, try `rustc --explain E0515`. </ins>


use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_middle::{ hir::place::PlaceBase, <del> mir::{self, ClearCrossCrate, Local, LocalDecl, LocalInfo, Location}, </del> <ins> mir::{self, ClearCrossCrate, Local, LocalDecl, LocalInfo, LocalKind, Location}, </ins> }; use rustc_span::source_map::DesugaringKind; use rustc_span::symbol::{kw, Symbol};


match label { Some((true, err_help_span, suggested_code)) => { <del> err.span_suggestion( err_help_span, &format!( "consider changing this to be a mutable {}", pointer_desc ), suggested_code, Applicability::MachineApplicable, ); </del> <ins> let (is_trait_sig, local_trait) = self.is_error_in_trait(local); if !is_trait_sig { err.span_suggestion( err_help_span, &format!( "consider changing this to be a mutable {}", pointer_desc ), suggested_code, Applicability::MachineApplicable, ); } else if let Some(x) = local_trait { err.span_suggestion( x, &format!( "consider changing that to be a mutable {}", pointer_desc ), suggested_code, Applicability::MachineApplicable, ); } </ins> } Some((false, err_label_span, message)) => { err.span_label(err_label_span, &message);


err.buffer(&mut self.errors_buffer); } <ins> /// User cannot make signature of a trait mutable without changing the /// trait. So we find if this error belongs to a trait and if so we move /// suggestion to the trait or disable it if it is out of scope of this crate fn is_error_in_trait(&self, local: Local) -> (bool, Option<Span>) { if self.body.local_kind(local) != LocalKind::Arg { return (false, None); } let hir_map = self.infcx.tcx.hir(); let my_def = self.body.source.def_id(); let my_hir = hir_map.local_def_id_to_hir_id(my_def.as_local().unwrap()); let td = if let Some(a) = self.infcx.tcx.impl_of_method(my_def).and_then(|x| self.infcx.tcx.trait_id_of_impl(x)) { a } else { return (false, None); }; ( true, td.as_local().and_then(|tld| { let h = hir_map.local_def_id_to_hir_id(tld); match hir_map.find(h) { Some(Node::Item(hir::Item { kind: hir::ItemKind::Trait(_, _, _, _, items), .. })) => { let mut f_in_trait_opt = None; for hir::TraitItemRef { id: fi, kind: k, .. } in *items { let hi = fi.hir_id(); if !matches!(k, hir::AssocItemKind::Fn { .. }) { continue; } if hir_map.name(hi) != hir_map.name(my_hir) { continue; } f_in_trait_opt = Some(hi); break; } f_in_trait_opt.and_then(|f_in_trait| match hir_map.find(f_in_trait) { Some(Node::TraitItem(hir::TraitItem { kind: hir::TraitItemKind::Fn( hir::FnSig { decl: hir::FnDecl { inputs, .. }, .. }, _, ), .. })) => { let hir::Ty { span, .. } = inputs[local.index() - 1]; Some(span) } _ => None, }) } _ => None, } }), ) } </ins> // point to span of upvar making closure call require mutable borrow fn show_mutating_upvar( &self,


<ins> use std::alloc::{GlobalAlloc, Layout}; struct Test(u32); unsafe impl GlobalAlloc for Test { unsafe fn alloc(&self, _layout: Layout) -> *mut u8 { self.0 += 1; //~ ERROR cannot assign 0 as *mut u8 } unsafe fn dealloc(&self, _ptr: *mut u8, _layout: Layout) { unimplemented!(); } } fn main() { } </ins>


<ins> error[E0594]: cannot assign to `self.0` which is behind a `&` reference --> $DIR/issue-68049-1.rs:7:9 | LL |         self.0 += 1; |         ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be written error: aborting due to previous error For more information about this error, try `rustc --explain E0594`. </ins>


<ins> trait Hello { fn example(&self, input: &i32); // should suggest here } struct Test1(i32); impl Hello for Test1 { fn example(&self, input: &i32) { // should not suggest here *input = self.0; //~ ERROR cannot assign } } struct Test2(i32); impl Hello for Test2 { fn example(&self, input: &i32) { // should not suggest here self.0 += *input; //~ ERROR cannot assign } } fn main() { } </ins>


<ins> error[E0594]: cannot assign to `*input` which is behind a `&` reference --> $DIR/issue-68049-2.rs:9:7 | LL |   fn example(&self, input: &i32); // should suggest here |                            ---- help: consider changing that to be a mutable reference: `&mut i32` ... LL |       *input = self.0; |       ^^^^^^^^^^^^^^^ `input` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `self.0` which is behind a `&` reference --> $DIR/issue-68049-2.rs:17:5 | LL |   fn example(&self, input: &i32); // should suggest here |              ----- help: consider changing that to be a mutable reference: `&mut self` ... LL |     self.0 += *input; |     ^^^^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be written error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0594`. </ins>


self.sess.gated_spans.gate(sym::const_extern_fn, lo.to(self.token.span)); } let ext = self.parse_extern()?; <del> self.bump(); // `fn` </del> <ins> self.expect_keyword(kw::Fn)?; </ins> let header = FnHeader { unsafety,


<ins> fn main() {} #[cfg(FALSE)] fn container() { const unsafe WhereIsFerris Now() {} //~^ ERROR expected one of `extern` or `fn` } </ins>


<ins> error: expected one of `extern` or `fn`, found `WhereIsFerris` --> $DIR/issue-68062-const-extern-fns-dont-need-fn-specifier-2.rs:5:18 | LL |     const unsafe WhereIsFerris Now() {} |                  ^^^^^^^^^^^^^ expected one of `extern` or `fn` error: aborting due to previous error </ins>


<ins> fn main() {} #[cfg(FALSE)] fn container() { const extern "Rust" PUT_ANYTHING_YOU_WANT_HERE bug() -> usize { 1 } //~^ ERROR expected `fn` //~| ERROR `const extern fn` definitions are unstable } </ins>


<ins> error: expected `fn`, found `PUT_ANYTHING_YOU_WANT_HERE` --> $DIR/issue-68062-const-extern-fns-dont-need-fn-specifier.rs:5:25 | LL |     const extern "Rust" PUT_ANYTHING_YOU_WANT_HERE bug() -> usize { 1 } |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `fn` error[E0658]: `const extern fn` definitions are unstable --> $DIR/issue-68062-const-extern-fns-dont-need-fn-specifier.rs:5:5 | LL |     const extern "Rust" PUT_ANYTHING_YOU_WANT_HERE bug() -> usize { 1 } |     ^^^^^^^^^^^^ | = note: for more information, see https://github.com/rust-lang/rust/issues/64926 = help: add `#![feature(const_extern_fn)]` to the crate attributes to enable error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0658`. </ins>


<del> Subproject commit 4e44aa010c4c7d616182a3078cafb39da6f6c0a2 </del> <ins> Subproject commit 6a0f14bef7784e57a57a996cae3f94dbd2490e7a </ins>


[[package]] name = "compiler_builtins" <del> version = "0.1.24" </del> <ins> version = "0.1.25" </ins> source = "registry+https://github.com/rust-lang/crates.io-index" <del> checksum = "b9975aefa63997ef75ca9cf013ff1bb81487aaa0b622c21053afd3b92979a7af" </del> <ins> checksum = "438ac08ddc5efe81452f984a9e33ba425b00b31d1f48e6acd9e2210aa28cc52e" </ins> dependencies = [ "cc", "rustc-std-workspace-core",


let post = format!(", consider renaming `{}` into `{snippet}`", suggestion.candidate); (span, snippet, post) } else { <del> (span, suggestion.candidate.to_string(), String::new()) </del> <ins> (span, suggestion.candidate.to_ident_string(), String::new()) </ins> }; let msg = match suggestion.target { SuggestionTarget::SimilarlyNamed => format!(


<ins> fn r#fn() {} fn main() { let r#final = 1; // Should correctly suggest variable defined using raw identifier. fina; //~ ERROR cannot find value // Should correctly suggest function defined using raw identifier. f(); //~ ERROR cannot find function } </ins>


<ins> error[E0425]: cannot find value `fina` in this scope --> $DIR/suggestion-raw-68962.rs:7:5 | LL |     fina; |     ^^^^ help: a local variable with a similar name exists: `r#final` error[E0425]: cannot find function `f` in this scope --> $DIR/suggestion-raw-68962.rs:10:5 | LL | fn r#fn() {} | --------- similarly named function `r#fn` defined here ... LL |     f(); |     ^ help: a function with a similar name exists: `r#fn` error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0425`. </ins>


# Use LLVM libunwind as the implementation for Rust's unwinder. # Accepted values are 'in-tree' (formerly true), 'system' or 'no' (formerly false). <ins> # This option only applies for Linux and Fuchsia targets. # On Linux target, if crt-static is not enabled, 'no' means dynamic link to # `libgcc_s.so`, 'in-tree' means static link to the in-tree build of llvm libunwind # and 'system' means dynamic link to `libunwind.so`. If crt-static is enabled, # the behavior is depend on the libc. On musl target, 'no' and 'in-tree' both # means static link to the in-tree build of llvm libunwind, and 'system' means # static link to `libunwind.a` provided by system. Due to the limitation of glibc, # it must link to `libgcc_eh.a` to get a working output, and this option have no effect. </ins> #llvm-libunwind = 'no' # Enable Windows Control Flow Guard checks in the standard library.


cc = "1.0.67" [features] <ins> # Only applies for Linux and Fuchsia targets # Static link to the in-tree build of llvm libunwind </ins> llvm-libunwind = [] <ins> # Only applies for Linux and Fuchsia targets # If crt-static is enabled, static link to `libunwind.a` provided by system # If crt-static is disabled, dynamic link to `libunwind.so` provided by system </ins> system-llvm-libunwind = []


println!("cargo:rerun-if-changed=build.rs"); let target = env::var("TARGET").expect("TARGET was not set"); <del> if cfg!(feature = "system-llvm-libunwind") { </del> <ins> if cfg!(target_os = "linux") && cfg!(feature = "system-llvm-libunwind") { // linking for Linux is handled in lib.rs </ins> return; }


pub fn compile() { let target = env::var("TARGET").expect("TARGET was not set"); let target_env = env::var("CARGO_CFG_TARGET_ENV").unwrap(); <del> let target_vendor = env::var("CARGO_CFG_TARGET_VENDOR").unwrap(); let target_endian_little = env::var("CARGO_CFG_TARGET_ENDIAN").unwrap() != "big"; let cfg = &mut cc::Build::new(); cfg.cpp(true); cfg.cpp_set_stdlib(None); cfg.warnings(false); </del> <ins> let mut cc_cfg = cc::Build::new(); let mut cpp_cfg = cc::Build::new(); let root = Path::new("../../src/llvm-project/libunwind"); </ins> <del> // libunwind expects a __LITTLE_ENDIAN__ macro to be set for LE archs, cf. #65765 if target_endian_little { cfg.define("__LITTLE_ENDIAN__", Some("1")); </del> <ins> cpp_cfg.cpp(true); cpp_cfg.cpp_set_stdlib(None); cpp_cfg.flag("-nostdinc++"); cpp_cfg.flag("-fno-exceptions"); cpp_cfg.flag("-fno-rtti"); cpp_cfg.flag_if_supported("-fvisibility-global-new-delete-hidden"); // Don't set this for clang // By default, Clang builds C code in GNU C17 mode. // By default, Clang builds C++ code according to the C++98 standard, // with many C++11 features accepted as extensions. if cpp_cfg.get_compiler().is_like_gnu() { cpp_cfg.flag("-std=c++11"); cc_cfg.flag("-std=c99"); </ins> } <del> if target_env == "msvc" { // Don't pull in extra libraries on MSVC cfg.flag("/Zl"); cfg.flag("/EHsc"); cfg.define("_CRT_SECURE_NO_WARNINGS", None); cfg.define("_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS", None); } else if target.contains("x86_64-fortanix-unknown-sgx") { cfg.cpp(false); cfg.static_flag(true); cfg.opt_level(3); cfg.flag("-nostdinc++"); cfg.flag("-fno-exceptions"); cfg.flag("-fno-rtti"); cfg.flag("-fstrict-aliasing"); cfg.flag("-funwind-tables"); cfg.flag("-fvisibility=hidden"); cfg.flag("-fno-stack-protector"); cfg.flag("-ffreestanding"); cfg.flag("-fexceptions"); // easiest way to undefine since no API available in cc::Build to undefine cfg.flag("-U_FORTIFY_SOURCE"); cfg.define("_FORTIFY_SOURCE", "0"); cfg.flag_if_supported("-fvisibility-global-new-delete-hidden"); </del> <ins> if target.contains("x86_64-fortanix-unknown-sgx") || target_env == "musl" { // use the same GCC C compiler command to compile C++ code so we do not need to setup the // C++ compiler env variables on the builders. // Don't set this for clang++, as clang++ is able to compile this without libc++. if cpp_cfg.get_compiler().is_like_gnu() { cpp_cfg.cpp(false); } } </ins> <del> cfg.define("_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS", None); cfg.define("RUST_SGX", "1"); cfg.define("__NO_STRING_INLINES", None); cfg.define("__NO_MATH_INLINES", None); cfg.define("_LIBUNWIND_IS_BAREMETAL", None); cfg.define("__LIBUNWIND_IS_NATIVE_ONLY", None); cfg.define("NDEBUG", None); } else { cfg.flag("-std=c99"); cfg.flag("-std=c++11"); cfg.flag("-nostdinc++"); cfg.flag("-fno-exceptions"); cfg.flag("-fno-rtti"); </del> <ins> for cfg in [&mut cc_cfg, &mut cpp_cfg].iter_mut() { cfg.warnings(false); </ins> cfg.flag("-fstrict-aliasing"); cfg.flag("-funwind-tables"); cfg.flag("-fvisibility=hidden"); <del> cfg.flag_if_supported("-fvisibility-global-new-delete-hidden"); </del> cfg.define("_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS", None); <ins> cfg.include(root.join("include")); cfg.cargo_metadata(false); if target.contains("x86_64-fortanix-unknown-sgx") { cfg.static_flag(true); cfg.opt_level(3); cfg.flag("-fno-stack-protector"); cfg.flag("-ffreestanding"); cfg.flag("-fexceptions"); // easiest way to undefine since no API available in cc::Build to undefine cfg.flag("-U_FORTIFY_SOURCE"); cfg.define("_FORTIFY_SOURCE", "0"); cfg.define("RUST_SGX", "1"); cfg.define("__NO_STRING_INLINES", None); cfg.define("__NO_MATH_INLINES", None); cfg.define("_LIBUNWIND_IS_BAREMETAL", None); cfg.define("__LIBUNWIND_IS_NATIVE_ONLY", None); cfg.define("NDEBUG", None); } </ins> } <del> let mut unwind_sources = vec![ "Unwind-EHABI.cpp", "Unwind-seh.cpp", </del> <ins> let mut c_sources = vec![ </ins> "Unwind-sjlj.c", "UnwindLevel1-gcc-ext.c", "UnwindLevel1.c", "UnwindRegistersRestore.S", "UnwindRegistersSave.S", <del> "libunwind.cpp", </del> ]; <del> if target_vendor == "apple" { unwind_sources.push("Unwind_AppleExtras.cpp"); } </del> <ins> let cpp_sources = vec!["Unwind-EHABI.cpp", "Unwind-seh.cpp", "libunwind.cpp"]; let cpp_len = cpp_sources.len(); </ins> if target.contains("x86_64-fortanix-unknown-sgx") { <del> unwind_sources.push("UnwindRustSgx.c"); </del> <ins> c_sources.push("UnwindRustSgx.c"); </ins> } <del> let root = Path::new("../../src/llvm-project/libunwind"); cfg.include(root.join("include")); for src in unwind_sources { cfg.file(root.join("src").join(src)); </del> <ins> for src in c_sources { cc_cfg.file(root.join("src").join(src).canonicalize().unwrap()); </ins> } <del> if target_env == "musl" { // use the same C compiler command to compile C++ code so we do not need to setup the // C++ compiler env variables on the builders cfg.cpp(false); // linking for musl is handled in lib.rs cfg.cargo_metadata(false); println!("cargo:rustc-link-search=native={}", env::var("OUT_DIR").unwrap()); </del> <ins> for src in cpp_sources { cpp_cfg.file(root.join("src").join(src).canonicalize().unwrap()); </ins> } <del> cfg.compile("unwind"); </del> <ins> let out_dir = env::var("OUT_DIR").unwrap(); println!("cargo:rustc-link-search=native={}", &out_dir); cpp_cfg.compile("unwind-cpp"); let mut count = 0; for entry in std::fs::read_dir(&out_dir).unwrap() { let obj = entry.unwrap().path().canonicalize().unwrap(); if let Some(ext) = obj.extension() { if ext == "o" { cc_cfg.object(&obj); count += 1; } } } assert_eq!(cpp_len, count, "Can't get object files from {:?}", &out_dir); cc_cfg.compile("unwind"); </ins> } }


} #[cfg(target_env = "musl")] <del> #[link(name = "unwind", kind = "static", cfg(target_feature = "crt-static"))] #[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))] extern "C" {} </del> <ins> cfg_if::cfg_if! { if #[cfg(all(feature = "llvm-libunwind", feature = "system-llvm-libunwind"))] { compile_error!("`llvm-libunwind` and `system-llvm-libunwind` cannot be enabled at the same time"); } else if #[cfg(feature = "llvm-libunwind")] { #[link(name = "unwind", kind = "static")] extern "C" {} } else if #[cfg(feature = "system-llvm-libunwind")] { #[link(name = "unwind", kind = "static-nobundle", cfg(target_feature = "crt-static"))] #[link(name = "unwind", cfg(not(target_feature = "crt-static")))] extern "C" {} } else { #[link(name = "unwind", kind = "static", cfg(target_feature = "crt-static"))] #[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))] extern "C" {} } } </ins> // When building with crt-static, we get `gcc_eh` from the `libc` crate, since // glibc needs it, and needs it listed later on the linker command line. We


extern "C" {} #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] <del> #[link(name = "unwind", kind = "static-nobundle")] </del> <ins> #[link(name = "unwind", kind = "static")] </ins> extern "C" {}


/// // x is no longer available /// ``` /// <ins> /// `move` is also valid before an async block. /// /// ```rust /// let capture = "hello"; /// let block = async move { ///     println!("rust says {} from async block", capture); /// }; /// ``` /// </ins> /// For more information on the `move` keyword, see the [closure]'s section /// of the Rust book or the [threads] section ///


.unwrap_or(false); let (res, self_ctor_substs) = if let Res::SelfCtor(impl_def_id) = res { <del> let ty = self.impl_self_ty(span, impl_def_id).ty; let adt_def = ty.ty_adt_def(); </del> <ins> let ty = self.normalize_ty(span, tcx.at(span).type_of(impl_def_id)); </ins> match ty.kind { ty::Adt(adt_def, substs) if adt_def.has_ctor() => { let variant = adt_def.non_enum_variant();


span, "the `Self` constructor can only be used with tuple or unit structs", ); <del> if let Some(adt_def) = adt_def { </del> <ins> if let Some(adt_def) = ty.ty_adt_def() { </ins> match adt_def.adt_kind() { AdtKind::Enum => { err.help("did you mean to use one of the enum's variants?");


<ins> fn main() {} struct S0<T>(T); impl<T> S0<T> { const C: S0<u8> = Self(0); //~^ ERROR mismatched types //~| ERROR mismatched types fn foo() { Self(0); //~^ ERROR mismatched types } } // Testing normalization. trait Fun { type Out; } impl<T> Fun for S0<T> { type Out = Self; } trait Foo<T> { fn foo(); } impl<T> Foo<T> for <S0<T> as Fun>::Out { fn foo() { Self(0); //~ ERROR mismatched types } } struct S1<T, U>(T, U); impl<T> S1<T, u8> { const C: S1<u8, u8> = Self(0, 1); //~^ ERROR mismatched types //~| ERROR mismatched types } struct S2<T>(T); impl<T> S2<T> { fn map<U>(x: U) -> S2<U> { Self(x) //~^ ERROR mismatched types //~| ERROR mismatched types } } </ins>


<ins> error[E0308]: mismatched types --> $DIR/issue-69306.rs:5:28 | LL | impl<T> S0<T> { |      - this type parameter LL |     const C: S0<u8> = Self(0); |                            ^ expected type parameter `T`, found integer | = note: expected type parameter `T` found type `{integer}` = help: type parameters must be constrained to match other types = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters error[E0308]: mismatched types --> $DIR/issue-69306.rs:5:23 | LL | impl<T> S0<T> { |      - this type parameter LL |     const C: S0<u8> = Self(0); |                       ^^^^^^^ expected `u8`, found type parameter `T` | = note: expected struct `S0<u8>` found struct `S0<T>` = help: type parameters must be constrained to match other types = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters error[E0308]: mismatched types --> $DIR/issue-69306.rs:10:14 | LL | impl<T> S0<T> { |      - this type parameter ... LL |         Self(0); |              ^ expected type parameter `T`, found integer | = note: expected type parameter `T` found type `{integer}` = help: type parameters must be constrained to match other types = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters error[E0308]: mismatched types --> $DIR/issue-69306.rs:27:14 | LL | impl<T> Foo<T> for <S0<T> as Fun>::Out { |      - this type parameter LL |     fn foo() { LL |         Self(0); |              ^ expected type parameter `T`, found integer | = note: expected type parameter `T` found type `{integer}` = help: type parameters must be constrained to match other types = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters error[E0308]: mismatched types --> $DIR/issue-69306.rs:33:32 | LL | impl<T> S1<T, u8> { |      - this type parameter LL |     const C: S1<u8, u8> = Self(0, 1); |                                ^ expected type parameter `T`, found integer | = note: expected type parameter `T` found type `{integer}` = help: type parameters must be constrained to match other types = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters error[E0308]: mismatched types --> $DIR/issue-69306.rs:33:27 | LL | impl<T> S1<T, u8> { |      - this type parameter LL |     const C: S1<u8, u8> = Self(0, 1); |                           ^^^^^^^^^^ expected `u8`, found type parameter `T` | = note: expected struct `S1<u8, _>` found struct `S1<T, _>` = help: type parameters must be constrained to match other types = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters error[E0308]: mismatched types --> $DIR/issue-69306.rs:41:14 | LL | impl<T> S2<T> { |      - expected type parameter LL |     fn map<U>(x: U) -> S2<U> { |            - found type parameter LL |         Self(x) |              ^ expected type parameter `T`, found type parameter `U` | = note: expected type parameter `T` found type parameter `U` = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters error[E0308]: mismatched types --> $DIR/issue-69306.rs:41:9 | LL | impl<T> S2<T> { |      - found type parameter LL |     fn map<U>(x: U) -> S2<U> { |            -           ----- expected `S2<U>` because of return type |            | |            expected type parameter LL |         Self(x) |         ^^^^^^^ expected type parameter `U`, found type parameter `T` | = note: expected struct `S2<U>` found struct `S2<T>` = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters error: aborting due to 8 previous errors For more information about this error, try `rustc --explain E0308`. </ins>


sig::set_bit(&mut r.sig, T::PRECISION - 1); } <del> // gcc forces the Quiet bit on, which means (float)(double)(float_sNan) // does not give you back the same bits. This is dubious, and we // don't currently do it. You're really supposed to get // an invalid operation signal at runtime, but nobody does that. status = Status::OK; </del> <ins> // Convert of sNaN creates qNaN and raises an exception (invalid op). // This also guarantees that a sNaN does not become Inf on a truncation // that loses all payload bits. if self.is_signaling() { // Quiet signaling NaN. sig::set_bit(&mut r.sig, T::QNAN_BIT); status = Status::INVALID_OP; } else { status = Status::OK; } </ins> } else { *loses_info = false; status = Status::OK;


} #[test] <ins> fn issue_69532() { let f = Double::from_bits(0x7FF0_0000_0000_0001u64 as u128); let mut loses_info = false; let sta = f.convert(&mut loses_info); let r: Single = sta.value; assert!(loses_info); assert!(r.is_nan()); assert_eq!(sta.status, Status::INVALID_OP); } #[test] </ins> fn min_num() { let f1 = Double::from_f64(1.0); let f2 = Double::from_f64(2.0);


assert_eq!(4294967295.0, test.to_f64()); assert!(!loses_info); <del> let test = Single::snan(None); let x87_snan = X87DoubleExtended::snan(None); let test: X87DoubleExtended = test.convert(&mut loses_info).value; assert!(test.bitwise_eq(x87_snan)); assert!(!loses_info); </del> let test = Single::qnan(None); let x87_qnan = X87DoubleExtended::qnan(None); let test: X87DoubleExtended = test.convert(&mut loses_info).value; assert!(test.bitwise_eq(x87_qnan)); assert!(!loses_info); <del> let test = X87DoubleExtended::snan(None); let test: X87DoubleExtended = test.convert(&mut loses_info).value; assert!(test.bitwise_eq(x87_snan)); </del> <ins> let test = Single::snan(None); let sta = test.convert(&mut loses_info); let test: X87DoubleExtended = sta.value; assert!(test.is_nan()); assert!(!test.is_signaling()); </ins> assert!(!loses_info); <ins> assert_eq!(sta.status, Status::INVALID_OP); </ins> let test = X87DoubleExtended::qnan(None); let test: X87DoubleExtended = test.convert(&mut loses_info).value; assert!(test.bitwise_eq(x87_qnan)); assert!(!loses_info); <ins> let test = X87DoubleExtended::snan(None); let sta = test.convert(&mut loses_info); let test: X87DoubleExtended = sta.value; assert!(test.is_nan()); assert!(!test.is_signaling()); assert!(!loses_info); assert_eq!(sta.status, Status::INVALID_OP); </ins> } #[test]


<ins> // run-pass #![feature(const_fn_transmute)] const fn make_nans() -> (f64, f64, f32, f32) { let nan1: f64 = unsafe { std::mem::transmute(0x7FF0_0001_0000_0001u64) }; let nan2: f64 = unsafe { std::mem::transmute(0x7FF0_0000_0000_0001u64) }; let nan1_32 = nan1 as f32; let nan2_32 = nan2 as f32; (nan1, nan2, nan1_32, nan2_32) } static NANS: (f64, f64, f32, f32) = make_nans(); fn main() { let (nan1, nan2, nan1_32, nan2_32) = NANS; assert!(nan1.is_nan()); assert!(nan2.is_nan()); assert!(nan1_32.is_nan()); assert!(nan2_32.is_nan()); } </ins>


<del> Subproject commit 23549a8c362a403026432f65a6cb398cb10d44b7 </del> <ins> Subproject commit d8e6e4cfcd83d555bd7717ea24224b777ed75773 </ins>


(' ' | 'n' | 't', _) if eat_ws => { skips.push(pos); } <del> ('', Some((next_pos, 'n' | 't' | '0' | '' | ''' | '"'))) => { </del> <ins> ('', Some((next_pos, 'n' | 't' | 'r' | '0' | '' | ''' | '"'))) => { </ins> skips.push(*next_pos); let _ = s.next(); }


<ins> // Test that multi-byte unicode characters with missing parameters do not ICE. fn main() { println!("r¡{}") //~^ ERROR 1 positional argument in format string } </ins>


<ins> error: 1 positional argument in format string, but no arguments were given --> $DIR/issue-70381.rs:4:16 | LL |   println!("r¡{}") |                ^^ error: aborting due to previous error </ins>


/// Checks whether the non-terminal may contain a single (non-keyword) identifier. fn may_be_ident(nt: &token::Nonterminal) -> bool { match *nt { <del> token::NtItem(_) | token::NtBlock(_) | token::NtVis(_) => false, </del> <ins> token::NtItem(_) | token::NtBlock(_) | token::NtVis(_) | token::NtLifetime(_) => false, </ins> _ => true, } }


<ins> // check-pass macro_rules! foo { ($(: $p:path)? $(: $l:lifetime)? ) => { bar! {$(: $p)? $(: $l)? } }; } macro_rules! bar { ($(: $p:path)? $(: $l:lifetime)? ) => {}; } foo! {: 'a } fn main() {} </ins>


}; let sp = cx.with_def_site_ctxt(sp); <del> let e = match env::var(&var.as_str()) { Err(..) => { </del> <ins> let value = env::var(&var.as_str()).ok().as_deref().map(Symbol::intern); cx.parse_sess.env_depinfo.borrow_mut().insert((Symbol::intern(&var), value)); let e = match value { None => { </ins> let lt = cx.lifetime(sp, Ident::new(kw::StaticLifetime, sp)); cx.expr_path(cx.path_all( sp,


))], )) } <del> Ok(s) => cx.expr_call_global( </del> <ins> Some(value) => cx.expr_call_global( </ins> sp, cx.std_path(&[sym::option, sym::Option, sym::Some]), <del> vec![cx.expr_str(sp, Symbol::intern(&s))], </del> <ins> vec![cx.expr_str(sp, value)], </ins> ), }; MacEager::expr(e)


} let sp = cx.with_def_site_ctxt(sp); <del> let e = match env::var(&*var.as_str()) { Err(_) => { </del> <ins> let value = env::var(&*var.as_str()).ok().as_deref().map(Symbol::intern); cx.parse_sess.env_depinfo.borrow_mut().insert((var, value)); let e = match value { None => { </ins> cx.span_err(sp, &msg.as_str()); return DummyResult::any(sp); } <del> Ok(s) => cx.expr_str(sp, Symbol::intern(&s)), </del> <ins> Some(value) => cx.expr_str(sp, value), </ins> }; MacEager::expr(e) }


#![feature(bool_to_option)] #![feature(crate_visibility_modifier)] #![feature(decl_macro)] <ins> #![feature(inner_deref)] </ins> #![feature(nll)] #![feature(or_patterns)] #![feature(proc_macro_internals)]


filename.to_string().replace(" ", " ") } <ins> // Makefile comments only need escaping newlines and ``. // The result can be unescaped by anything that can unescape `escape_default` and friends. fn escape_dep_env(symbol: Symbol) -> String { let s = symbol.as_str(); let mut escaped = String::with_capacity(s.len()); for c in s.chars() { match c { 'n' => escaped.push_str(r"n"), 'r' => escaped.push_str(r"r"), '' => escaped.push_str(r""), _ => escaped.push(c), } } escaped } </ins> fn write_out_deps( sess: &Session, boxed_resolver: &Steal<Rc<RefCell<BoxedResolver>>>,


for path in files { writeln!(file, "{}:", path)?; } <ins> // Emit special comments with information about accessed environment variables. let env_depinfo = sess.parse_sess.env_depinfo.borrow(); if !env_depinfo.is_empty() { let mut envs: Vec<_> = env_depinfo .iter() .map(|(k, v)| (escape_dep_env(*k), v.map(escape_dep_env))) .collect(); envs.sort_unstable(); writeln!(file)?; for (k, v) in envs { write!(file, "# env-dep:{}", k)?; if let Some(v) = v { write!(file, "={}", v)?; } writeln!(file)?; } } </ins> Ok(()) })();


pub symbol_gallery: SymbolGallery, /// The parser has reached `Eof` due to an unclosed brace. Used to silence unnecessary errors. pub reached_eof: Lock<bool>, <ins> /// Environment variables accessed during the build and their values when they exist. pub env_depinfo: Lock<FxHashSet<(Symbol, Option<Symbol>)>>, </ins> } impl ParseSess {


gated_spans: GatedSpans::default(), symbol_gallery: SymbolGallery::default(), reached_eof: Lock::new(false), <ins> env_depinfo: Default::default(), </ins> } }


<ins> -include ../../run-make-fulldeps/tools.mk all: EXISTING_ENV=1 EXISTING_OPT_ENV=1 $(RUSTC) --emit dep-info main.rs $(CGREP) "# env-dep:EXISTING_ENV=1" < $(TMPDIR)/main.d $(CGREP) "# env-dep:EXISTING_OPT_ENV=1" < $(TMPDIR)/main.d $(CGREP) "# env-dep:NONEXISTENT_OPT_ENV" < $(TMPDIR)/main.d $(CGREP) "# env-dep:ESCAPEnESCAPE" < $(TMPDIR)/main.d </ins>


<ins> fn main() { env!("EXISTING_ENV"); option_env!("EXISTING_OPT_ENV"); option_env!("NONEXISTENT_OPT_ENV"); option_env!("ESCAPEnESCAPE"); } </ins>


_ => bug!(), }; <ins> let param_env = tcx.param_env(source.def_id()); </ins> for (local, decl) in body.local_decls.iter_enumerated() { // Ignore locals which are internal or not live if !live_locals.contains(local) || decl.internal { continue; } <ins> let decl_ty = tcx.normalize_erasing_regions(param_env, decl.ty); </ins> // Sanity check that typeck knows about the type of locals which are // live across a suspension point <del> if !allowed.contains(&decl.ty) && !allowed_upvars.contains(&decl.ty) { </del> <ins> if !allowed.contains(&decl_ty) && !allowed_upvars.contains(&decl_ty) { </ins> span_bug!( body.span, "Broken MIR: generator contains type {} in MIR,


<ins> // check-pass // edition:2018 // compile-flags: --crate-type=lib pub async fn test() { const C: usize = 4; foo(&mut [0u8; C]).await; } async fn foo(_: &mut [u8]) {} </ins>


format!("does not implement `{}`", trait_ref.print_only_trait_path()) }; <del> let mut explain_yield = |interior_span: Span, yield_span: Span, scope_span: Option<Span>| { let mut span = MultiSpan::from_span(yield_span); if let Ok(snippet) = source_map.span_to_snippet(interior_span) { span.push_span_label( yield_span, format!("{} occurs here, with `{}` maybe used later", await_or_yield, snippet), ); // If available, use the scope span to annotate the drop location. if let Some(scope_span) = scope_span { span.push_span_label( source_map.end_point(scope_span), format!("`{}` is later dropped here", snippet), ); </del> <ins> let mut explain_yield = |interior_span: Span, yield_span: Span, scope_span: Option<Span>| { let mut span = MultiSpan::from_span(yield_span); if let Ok(snippet) = source_map.span_to_snippet(interior_span) { // #70935: If snippet contains newlines, display "the value" instead // so that we do not emit complex diagnostics. let snippet = &format!("`{}`", snippet); let snippet = if snippet.contains('n') { "the value" } else { snippet }; // The multispan can be complex here, like: // note: future is not `Send` as this value is used across an await //   --> $DIR/issue-70935-complex-spans.rs:13:9 //    | // LL |            baz(|| async{ //    |  __________^___- //    | | _________| //    | || // LL | ||             foo(tx.clone()); // LL | ||         }).await; //    | ||         -      ^- value is later dropped here //    | ||_________|______| //    | |__________|      await occurs here, with value maybe used later //    |            has type `closure` which is not `Send` // // So, detect it and separate into some notes, like: // // note: future is not `Send` as this value is used across an await //   --> $DIR/issue-70935-complex-spans.rs:13:9 //    | // LL | /         baz(|| async{ // LL | |             foo(tx.clone()); // LL | |         }).await; //    | |________________^ first, await occurs here, with the value maybe used later... // note: the value is later dropped here //   --> $DIR/issue-70935-complex-spans.rs:15:17 //    | // LL |         }).await; //    |                 ^ // // If available, use the scope span to annotate the drop location. if let Some(scope_span) = scope_span { let scope_span = source_map.end_point(scope_span); let is_overlapped = yield_span.overlaps(scope_span) || yield_span.overlaps(interior_span); if is_overlapped { span.push_span_label( yield_span, format!( "first, {} occurs here, with {} maybe used later...", await_or_yield, snippet ), ); err.span_note( span, &format!( "{} {} as this value is used across {}", future_or_generator, trait_explanation, an_await_or_yield ), ); if source_map.is_multiline(interior_span) { err.span_note( scope_span, &format!("{} is later dropped here", snippet), ); err.span_note( interior_span, &format!( "this has type `{}` which {}", target_ty, trait_explanation ), ); } else { let mut span = MultiSpan::from_span(scope_span); span.push_span_label( interior_span, format!("has type `{}` which {}", target_ty, trait_explanation), ); err.span_note(span, &format!("{} is later dropped here", snippet)); } } else { span.push_span_label( yield_span, format!( "{} occurs here, with {} maybe used later", await_or_yield, snippet ), ); span.push_span_label( scope_span, format!("{} is later dropped here", snippet), ); span.push_span_label( interior_span, format!("has type `{}` which {}", target_ty, trait_explanation), ); err.span_note( span, &format!( "{} {} as this value is used across {}", future_or_generator, trait_explanation, an_await_or_yield ), ); } } else { span.push_span_label( yield_span, format!( "{} occurs here, with {} maybe used later", await_or_yield, snippet ), ); span.push_span_label( interior_span, format!("has type `{}` which {}", target_ty, trait_explanation), ); err.span_note( span, &format!( "{} {} as this value is used across {}", future_or_generator, trait_explanation, an_await_or_yield ), ); } </ins> } <del> } span.push_span_label( interior_span, format!("has type `{}` which {}", target_ty, trait_explanation), ); err.span_note( span, &format!( "{} {} as this value is used across {}", future_or_generator, trait_explanation, an_await_or_yield ), ); }; </del> <ins> }; </ins> match interior_or_upvar_span { GeneratorInteriorOrUpvar::Interior(interior_span) => { if let Some((scope_span, yield_span, expr, from_awaited_ty)) = interior_extra_info {


<ins> // edition:2018 // #70935: Check if we do not emit snippet // with newlines which lead complex diagnostics. use std::future::Future; async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> { } fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send { //~^ ERROR: future cannot be sent between threads safely async move { baz(|| async{ foo(tx.clone()); }).await; } } fn bar(_s: impl Future + Send) { } fn main() { let (tx, _rx) = std::sync::mpsc::channel(); bar(foo(tx)); } </ins>


<ins> error: future cannot be sent between threads safely --> $DIR/issue-70935-complex-spans.rs:10:45 | LL | fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send { |                                             ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` | = help: the trait `Sync` is not implemented for `Sender<i32>` note: future is not `Send` as this value is used across an await --> $DIR/issue-70935-complex-spans.rs:13:9 | LL | /         baz(|| async{ LL | |             foo(tx.clone()); LL | |         }).await; | |________________^ first, await occurs here, with the value maybe used later... note: the value is later dropped here --> $DIR/issue-70935-complex-spans.rs:15:17 | LL |         }).await; |                 ^ note: this has type `[closure@$DIR/issue-70935-complex-spans.rs:13:13: 15:10]` which is not `Send` --> $DIR/issue-70935-complex-spans.rs:13:13 | LL |           baz(|| async{ |  _____________^ LL | |             foo(tx.clone()); LL | |         }).await; | |_________^ error: aborting due to previous error </ins>


--> $DIR/issue-65436-raw-ptr-not-send.rs:14:9 | LL |         bar(Foo(std::ptr::null())).await; <del> |         ^^^^^^^^----------------^^^^^^^^- `std::ptr::null()` is later dropped here |         |       | |         |       has type `*const u8` which is not `Send` |         await occurs here, with `std::ptr::null()` maybe used later </del> <ins> |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ first, await occurs here, with `std::ptr::null()` maybe used later... note: `std::ptr::null()` is later dropped here --> $DIR/issue-65436-raw-ptr-not-send.rs:14:41 | LL |         bar(Foo(std::ptr::null())).await; |                 ----------------        ^ |                 | |                 has type `*const u8` which is not `Send` </ins> help: consider moving this into a `let` binding to create a shorter lived borrow --> $DIR/issue-65436-raw-ptr-not-send.rs:14:13 |


} if let Some(non_sm_ty) = structural { <del> let adt_def = match non_sm_ty { traits::NonStructuralMatchTy::Adt(adt_def) => adt_def, </del> <ins> let msg = match non_sm_ty { traits::NonStructuralMatchTy::Adt(adt_def) => { let path = self.tcx().def_path_str(adt_def.did); format!( "to use a constant of type `{}` in a pattern,  `{}` must be annotated with `#[derive(PartialEq, Eq)]`", path, path, ) } traits::NonStructuralMatchTy::Dynamic => { format!("trait objects cannot be used in patterns") } </ins> traits::NonStructuralMatchTy::Param => { bug!("use of constant whose type is a parameter inside a pattern") } }; <del> let path = self.tcx().def_path_str(adt_def.did); let make_msg = || -> String { format!( "to use a constant of type `{}` in a pattern,  `{}` must be annotated with `#[derive(PartialEq, Eq)]`", path, path, ) }; </del> // double-check there even *is* a semantic `PartialEq` to dispatch to. //


if !ty_is_partial_eq { // span_fatal avoids ICE from resolution of non-existent method (rare case). <del> self.tcx().sess.span_fatal(self.span, &make_msg()); </del> <ins> self.tcx().sess.span_fatal(self.span, &msg); </ins> } else if mir_structural_match_violation { self.tcx().struct_span_lint_hir( lint::builtin::INDIRECT_STRUCTURAL_MATCH, self.id, self.span, <del> |lint| lint.build(&make_msg()).emit(), </del> <ins> |lint| lint.build(&msg).emit(), </ins> ); } else { debug!(


pub enum NonStructuralMatchTy<'tcx> { Adt(&'tcx AdtDef), Param, <ins> Dynamic, </ins> } /// This method traverses the structure of `ty`, trying to find an


self.found = Some(NonStructuralMatchTy::Param); return true; // Stop visiting. } <ins> ty::Dynamic(..) => { self.found = Some(NonStructuralMatchTy::Dynamic); return true; // Stop visiting. } </ins> ty::RawPtr(..) => { // structural-match ignores substructure of // `*const _`/`*mut _`, so skip `super_visit_with`.


<ins> #![feature(const_generics)] //~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash trait A {} struct B; impl A for B {} fn test<const T: &'static dyn A>() { //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]` to be used unimplemented!() } fn main() { test::<{ &B }>(); } </ins>


<ins> warning: the feature `const_generics` is incomplete and may cause the compiler to crash --> $DIR/issue-63322-forbid-dyn.rs:1:12 | LL | #![feature(const_generics)] |            ^^^^^^^^^^^^^^ | = note: `#[warn(incomplete_features)]` on by default error[E0741]: `&'static (dyn A + 'static)` must be annotated with `#[derive(PartialEq, Eq)]` to be used as the type of a const parameter --> $DIR/issue-63322-forbid-dyn.rs:8:18 | LL | fn test<const T: &'static dyn A>() { |                  ^^^^^^^^^^^^^^ `&'static (dyn A + 'static)` doesn't derive both `PartialEq` and `Eq` error: aborting due to previous error; 1 warning emitted For more information about this error, try `rustc --explain E0741`. </ins>


<ins> const F: &'static dyn Send = &7u32; fn main() { let a: &dyn Send = &7u32; match a { F => panic!(), //~^ ERROR trait objects cannot be used in patterns _ => {} } } </ins>


<ins> error: trait objects cannot be used in patterns --> $DIR/issue-70972-dyn-trait.rs:6:9 | LL |         F => panic!(), |         ^ error: aborting due to previous error </ins>


See the specification for the [GitHub Tables extension][tables] for more details on the exact syntax supported.  ### Task lists Task lists can be used as a checklist of items that have been completed. Example: ```md - [x] Complete task - [ ] IncComplete task ``` This will render as

<input type="checkbox">

<input type="checkbox" checked>

 See the specification for the [task list extension] for more details.  [`backtrace`]: https://docs.rs/backtrace/0.3.50/backtrace/ [commonmark markdown specification]: https://commonmark.org/ [commonmark quick reference]: https://commonmark.org/help/


[`std::env`]: https://doc.rust-lang.org/stable/std/env/index.html#functions [strikethrough]: https://github.github.com/gfm/#strikethrough-extension- [tables]: https://github.github.com/gfm/#tables-extension- <ins> [task list extension]: https://github.github.com/gfm/#task-list-items-extension- </ins>


/// Options for rendering Markdown in the main body of documentation. pub(crate) fn opts() -> Options { <del> Options::ENABLE_TABLES | Options::ENABLE_FOOTNOTES | Options::ENABLE_STRIKETHROUGH </del> <ins> Options::ENABLE_TABLES | Options::ENABLE_FOOTNOTES | Options::ENABLE_STRIKETHROUGH | Options::ENABLE_TASKLISTS </ins> } /// A subset of [`opts()`] used for rendering summaries.


<ins> // ignore-tidy-linelength // FIXME: this doesn't test as much as I'd like; ideally it would have these query too: // has task_lists/index.html '//li/input[@type="checkbox" and disabled]/following-sibling::text()' 'a' // has task_lists/index.html '//li/input[@type="checkbox"]/following-sibling::text()' 'b' // Unfortunately that requires LXML, because the built-in xml module doesn't support all of xpath. // @has task_lists/index.html '//ul/li/input[@type="checkbox"]' '' // @has task_lists/index.html '//ul/li/input[@disabled]' '' // @has task_lists/index.html '//ul/li' 'a' // @has task_lists/index.html '//ul/li' 'b' //! This tests 'task list' support, a common markdown extension. //! - [ ] a //! - [x] b </ins>


); fn is_expr_delims_necessary(inner: &ast::Expr, followed_by_block: bool) -> bool { <del> followed_by_block && match inner.kind { ExprKind::Ret(_) | ExprKind::Break(..) => true, _ => parser::contains_exterior_struct_lit(&inner), </del> <ins> // Prevent false-positives in cases like `fn x() -> u8 { ({ 0 } + 1) }` let lhs_needs_parens = { let mut innermost = inner; loop { if let ExprKind::Binary(_, lhs, _rhs) = &innermost.kind { innermost = lhs; if !rustc_ast::util::classify::expr_requires_semi_to_be_stmt(innermost) { break true; } } else { break false; } </ins> } <ins> }; lhs_needs_parens || (followed_by_block && match inner.kind { ExprKind::Ret(_) | ExprKind::Break(..) => true, _ => parser::contains_exterior_struct_lit(&inner), }) </ins> } fn emit_unused_delims_expr(


<ins> // check-pass // Make sure unused parens lint doesn't emit a false positive. // See https://github.com/rust-lang/rust/issues/71290 for details. #![deny(unused_parens)] fn x() -> u8 { ({ 0 }) + 1 } fn y() -> u8 { ({ 0 } + 1) } pub fn foo(a: bool, b: bool) -> u8 { (if a { 1 } else { 0 } + if b { 1 } else { 0 }) } pub fn bar() -> u8 { // Make sure nested expressions are handled correctly as well ({ 0 } + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9) } fn main() {} </ins>


return 0; }; <ins> let will_be_emitted = |span: Span| { !span.is_dummy() && { let file = sm.lookup_source_file(span.hi()); sm.ensure_source_file_source_present(file) } }; </ins> let mut max = 0; for primary_span in msp.primary_spans() { <del> if !primary_span.is_dummy() { </del> <ins> if will_be_emitted(*primary_span) { </ins> let hi = sm.lookup_char_pos(primary_span.hi()); max = (hi.line).max(max); } } if !self.short_message { for span_label in msp.span_labels() { <del> if !span_label.span.is_dummy() { </del> <ins> if will_be_emitted(span_label.span) { </ins> let hi = sm.lookup_char_pos(span_label.span.hi()); max = (hi.line).max(max); }


<ins> // compile-flags: -Z simulate-remapped-rust-src-base=/rustc/xyz -Z ui-testing=no // only-x86_64-unknown-linux-gnu //---^ Limiting target as the above unstable flags don't play well on some environment. struct MyError; impl std::error::Error for MyError {} //~^ ERROR: `MyError` doesn't implement `std::fmt::Display` //~| ERROR: `MyError` doesn't implement `Debug` fn main() {} </ins>


<ins> error[E0277]: `MyError` doesn't implement `std::fmt::Display` --> $DIR/issue-71363.rs:6:6 | 6 | impl std::error::Error for MyError {} |      ^^^^^^^^^^^^^^^^^ `MyError` cannot be formatted with the default formatter | = help: the trait `std::fmt::Display` is not implemented for `MyError` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead note: required by a bound in `std::error::Error` error[E0277]: `MyError` doesn't implement `Debug` --> $DIR/issue-71363.rs:6:6 | 6 | impl std::error::Error for MyError {} |      ^^^^^^^^^^^^^^^^^ `MyError` cannot be formatted using `{:?}` | = help: the trait `Debug` is not implemented for `MyError` = note: add `#[derive(Debug)]` to `MyError` or manually `impl Debug for MyError` note: required by a bound in `std::error::Error` help: consider annotating `MyError` with `#[derive(Debug)]` | 5 | #[derive(Debug)] | error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. </ins>


<ins> #![feature(const_generics)] #![allow(incomplete_features)] struct Test(*const usize); type PassArg = (); unsafe extern "C" fn pass(args: PassArg) { println!("Hello, world!"); } impl Test { pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args)>(&self) { //~^ ERROR: using function pointers as const generic parameters is forbidden self.0 = Self::trampiline::<Args, IDX, FN> as _ } unsafe extern "C" fn trampiline< Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args), //~^ ERROR: using function pointers as const generic parameters is forbidden >( args: Args, ) { FN(args) } } fn main() { let x = Test(); x.call_me::<PassArg, 30, pass>() } </ins>


<ins> error: using function pointers as const generic parameters is forbidden --> $DIR/issue-71381.rs:13:61 | LL |     pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args)>(&self) { |                                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: using function pointers as const generic parameters is forbidden --> $DIR/issue-71381.rs:21:19 | LL |         const FN: unsafe extern "C" fn(Args), |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors </ins>


<ins> #![feature(const_generics)] #![allow(incomplete_features)] struct Test(); fn pass() { println!("Hello, world!"); } impl Test { pub fn call_me(&self) { self.test::<pass>(); } fn test<const FN: fn()>(&self) { //~^ ERROR: using function pointers as const generic parameters is forbidden FN(); } } fn main() { let x = Test(); x.call_me() } </ins>


<ins> error: using function pointers as const generic parameters is forbidden --> $DIR/issue-71382.rs:15:23 | LL |     fn test<const FN: fn()>(&self) { |                       ^^^^ error: aborting due to previous error </ins>


<ins> #![feature(const_generics)] #![allow(incomplete_features)] fn func<A, const F: fn(inner: A)>(outer: A) { //~^ ERROR: using function pointers as const generic parameters is forbidden F(outer); } fn main() {} </ins>


<ins> error: using function pointers as const generic parameters is forbidden --> $DIR/issue-71611.rs:4:21 | LL | fn func<A, const F: fn(inner: A)>(outer: A) { |                     ^^^^^^^^^^^^ error: aborting due to previous error </ins>


<ins> #![feature(const_generics)] #![allow(incomplete_features)] use std::ffi::{CStr, CString}; unsafe fn unsafely_do_the_thing<const F: fn(&CStr) -> usize>(ptr: *const i8) -> usize { //~^ ERROR: using function pointers as const generic parameters is forbidden F(CStr::from_ptr(ptr)) } fn safely_do_the_thing(s: &CStr) -> usize { s.to_bytes().len() } fn main() { let baguette = CString::new("baguette").unwrap(); let ptr = baguette.as_ptr(); println!("{}", unsafe { unsafely_do_the_thing::<safely_do_the_thing>(ptr) }); } </ins>


<ins> error: using function pointers as const generic parameters is forbidden --> $DIR/issue-72352.rs:6:42 | LL | unsafe fn unsafely_do_the_thing<const F: fn(&CStr) -> usize>(ptr: *const i8) -> usize { |                                          ^^^^^^^^^^^^^^^^^^ error: aborting due to previous error </ins>


}; } <del> let binding = if let Some(module) = module { self.resolve_ident_in_module( module, ident, ns, parent_scope, record_used, path_span, ) } else if ribs.is_none() || opt_ns.is_none() || opt_ns == Some(MacroNS) { let scopes = ScopeSet::All(ns, opt_ns.is_none()); self.early_resolve_ident_in_lexical_scope( ident, scopes, parent_scope, record_used, record_used, path_span, ) } else { let record_used_id = if record_used { crate_lint.node_id().or(Some(CRATE_NODE_ID)) } else { None }; match self.resolve_ident_in_lexical_scope( ident, ns, parent_scope, record_used_id, path_span, &ribs.unwrap()[ns], ) { // we found a locally-imported or available item/module Some(LexicalScopeBinding::Item(binding)) => Ok(binding), // we found a local variable or type param Some(LexicalScopeBinding::Res(res)) if opt_ns == Some(TypeNS) || opt_ns == Some(ValueNS) => { record_segment_res(self, res); return PathResult::NonModule(PartialRes::with_unresolved_segments( res, path.len() - 1, )); </del> <ins> enum FindBindingResult<'a> { Binding(Result<&'a NameBinding<'a>, Determinacy>), PathResult(PathResult<'a>), } let find_binding_in_ns = |this: &mut Self, ns| { let binding = if let Some(module) = module { this.resolve_ident_in_module( module, ident, ns, parent_scope, record_used, path_span, ) } else if ribs.is_none() || opt_ns.is_none() || opt_ns == Some(MacroNS) { let scopes = ScopeSet::All(ns, opt_ns.is_none()); this.early_resolve_ident_in_lexical_scope( ident, scopes, parent_scope, record_used, record_used, path_span, ) } else { let record_used_id = if record_used { crate_lint.node_id().or(Some(CRATE_NODE_ID)) } else { None }; match this.resolve_ident_in_lexical_scope( ident, ns, parent_scope, record_used_id, path_span, &ribs.unwrap()[ns], ) { // we found a locally-imported or available item/module Some(LexicalScopeBinding::Item(binding)) => Ok(binding), // we found a local variable or type param Some(LexicalScopeBinding::Res(res)) if opt_ns == Some(TypeNS) || opt_ns == Some(ValueNS) => { record_segment_res(this, res); return FindBindingResult::PathResult(PathResult::NonModule( PartialRes::with_unresolved_segments(res, path.len() - 1), )); } _ => Err(Determinacy::determined(record_used)), </ins> } <del> _ => Err(Determinacy::determined(record_used)), } </del> <ins> }; FindBindingResult::Binding(binding) }; let binding = match find_binding_in_ns(self, ns) { FindBindingResult::PathResult(x) => return x, FindBindingResult::Binding(binding) => binding, </ins> }; match binding { Ok(binding) => { if i == 1 {


} else if i == 0 { (format!("use of undeclared type or module `{}`", ident), None) } else { <del> (format!("could not find `{}` in `{}`", ident, path[i - 1].ident), None) </del> <ins> let mut msg = format!("could not find `{}` in `{}`", ident, path[i - 1].ident); if ns == TypeNS || ns == ValueNS { let ns_to_try = if ns == TypeNS { ValueNS } else { TypeNS }; if let FindBindingResult::Binding(Ok(binding)) = find_binding_in_ns(self, ns_to_try) { let mut found = |what| { msg = format!( "expected {}, found {} `{}` in `{}`", ns.descr(), what, ident, path[i - 1].ident ) }; if binding.module().is_some() { found("module") } else { match binding.res() { def::Res::<NodeId>::Def(kind, id) => found(kind.descr(id)), _ => found(ns_to_try.descr()), } } }; } (msg, None) </ins> }; return PathResult::Failed { span: ident.span,


<ins> use std::sync::mpsc; fn main() { let (tx, rx) = mpsc::channel::new(1); //~^ ERROR expected type, found function `channel` in `mpsc` } </ins>


<ins> error[E0433]: failed to resolve: expected type, found function `channel` in `mpsc` --> $DIR/issue-71406.rs:4:26 | LL |     let (tx, rx) = mpsc::channel::new(1); |                          ^^^^^^^ expected type, found function `channel` in `mpsc` error: aborting due to previous error For more information about this error, try `rustc --explain E0433`. </ins>


&b.item_def_id, ))) } else { <del> let ty = relation.relate(&a.ty, &b.ty)?; let substs = relation.relate(&a.substs, &b.substs)?; </del> <ins> let ty = relation.relate_with_variance(ty::Invariant, &a.ty, &b.ty)?; let substs = relation.relate_with_variance(ty::Invariant, &a.substs, &b.substs)?; </ins> Ok(ty::ExistentialProjection { item_def_id: a.item_def_id, substs, ty }) } }


LL |     let _ = Box::new(|x| (x as u8)): Box<dyn Fn(i32) -> _>; |             ^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn std::ops::Fn`, found closure | <del> = note: expected struct `std::boxed::Box<dyn std::ops::Fn(i32) -> _>` </del> <ins> = note: expected struct `std::boxed::Box<dyn std::ops::Fn(i32) -> u8>` </ins> found struct `std::boxed::Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:26:22: 26:35]>` error: aborting due to 14 previous errors


<del> error[E0277]: the size for values of type `dyn std::iter::Iterator<Item = &mut u8>` cannot be known at compilation time </del> <ins> error[E0277]: the size for values of type `dyn std::iter::Iterator<Item = &'a mut u8>` cannot be known at compilation time </ins> --> $DIR/issue-20605.rs:2:17 | LL |     for item in *things { *item = 0 } |                 ^^^^^^^ doesn't have a size known at compile-time | <del> = help: the trait `std::marker::Sized` is not implemented for `dyn std::iter::Iterator<Item = &mut u8>` </del> <ins> = help: the trait `std::marker::Sized` is not implemented for `dyn std::iter::Iterator<Item = &'a mut u8>` </ins> = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait> = note: required by `std::iter::IntoIterator::into_iter`


<ins> error: lifetime may not live long enough --> $DIR/variance-associated-types2.rs:13:12 | LL | fn take<'a>(_: &'a u32) { |         -- lifetime `'a` defined here LL |     let _: Box<dyn Foo<Bar = &'a u32>> = make(); |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` | = help: consider replacing `'a` with `'static` error: aborting due to previous error </ins>


<ins> // Test that dyn Foo<Bar = T> is invariant with respect to T. // Failure to enforce invariance here can be weaponized, see #71550 for details. trait Foo { type Bar; } fn make() -> Box<dyn Foo<Bar = &'static u32>> { panic!() } fn take<'a>(_: &'a u32) { let _: Box<dyn Foo<Bar = &'a u32>> = make(); //~^ ERROR mismatched types [E0308] } fn main() {} </ins>


<ins> error[E0308]: mismatched types --> $DIR/variance-associated-types2.rs:13:42 | LL |     let _: Box<dyn Foo<Bar = &'a u32>> = make(); |                                          ^^^^^^ lifetime mismatch | = note: expected trait object `dyn Foo<Bar = &'a u32>` found trait object `dyn Foo<Bar = &'static u32>` note: the lifetime `'a` as defined on the function body at 12:9... --> $DIR/variance-associated-types2.rs:12:9 | LL | fn take<'a>(_: &'a u32) { |         ^^ = note: ...does not necessarily outlive the static lifetime error: aborting due to previous error For more information about this error, try `rustc --explain E0308`. </ins>


printf("Available features for this target:n"); for (auto &Feature : FeatTable) printf("    %-*s - %s.n", MaxFeatLen, Feature.Key, Feature.Desc); <ins> printf("nRust-specific features:n"); printf("    %-*s - %s.n", MaxFeatLen, "crt-static", "Enables libraries with C Run-time Libraries(CRT) to be statically linked" ); </ins> printf("n"); printf("Use +feature to enable a feature, or -feature to disable it.n"


// We can still be zero-sized in this branch, in which case we have to // return `None`. <del> if size.bytes() == 0 { // We may be reading from a static. // In order to ensure that `static FOO: Type = FOO;` causes a cycle error // instead of magically pulling *any* ZST value from the ether, we need to // actually access the referenced allocation. The caller is likely // to short-circuit on `None`, so we trigger the access here to // make sure it happens. self.get_raw(ptr.alloc_id)?; None } else { Some(ptr) } </del> <ins> if size.bytes() == 0 { None } else { Some(ptr) } </ins> } }) }


{ Some(ptr) => ptr, None => { <ins> if let Scalar::Ptr(ptr) = mplace.ptr { // We may be reading from a static. // In order to ensure that `static FOO: Type = FOO;` causes a cycle error // instead of magically pulling *any* ZST value from the ether, we need to // actually access the referenced allocation. self.memory.get_raw(ptr.alloc_id)?; } </ins> return Ok(Some(ImmTy { // zero-sized type imm: Scalar::zst().into(),


<ins> // check-pass // This is a regression test for ICEs from // https://github.com/rust-lang/rust/issues/71612 // and // https://github.com/rust-lang/rust/issues/71709 #[derive(Copy, Clone)] pub struct Glfw; static mut GLFW: Option<Glfw> = None; pub fn new() -> Glfw { unsafe { if let Some(glfw) = GLFW { return glfw; } else { todo!() } }; } extern "C" { static _dispatch_queue_attr_concurrent: [u8; 0]; } static DISPATCH_QUEUE_CONCURRENT: &'static [u8; 0] = unsafe { &_dispatch_queue_attr_concurrent }; fn main() { *DISPATCH_QUEUE_CONCURRENT; new(); } </ins>


if (!next) { return; } <del> if (next.getElementsByClassName("method").length > 0 && hasClass(e, "impl")) { </del> <ins> if (hasClass(e, "impl") && (next.getElementsByClassName("method").length > 0 || next.getElementsByClassName("associatedconstant").length > 0)) { </ins> insertAfter(toggle.cloneNode(true), e.childNodes[e.childNodes.length - 1]); } };


use crate::middle::cstore::{ExternCrate, ExternCrateSource}; <del> use crate::mir::interpret::{sign_extend, truncate, AllocId, ConstValue, Pointer, Scalar}; </del> <ins> use crate::mir::interpret::{ sign_extend, truncate, AllocId, ConstValue, GlobalAlloc, Pointer, Scalar, }; </ins> use crate::ty::layout::IntegerExt; use crate::ty::subst::{GenericArg, GenericArgKind, Subst}; use crate::ty::{self, DefIdTree, ParamConst, Ty, TyCtxt, TypeFoldable};


}, _, ), <del> ) => { let byte_str = self .tcx() .global_alloc(ptr.alloc_id) .unwrap_memory() .get_bytes(&self.tcx(), ptr, Size::from_bytes(*data)) .unwrap(); p!(pretty_print_byte_str(byte_str)); } </del> <ins> ) => match self.tcx().get_global_alloc(ptr.alloc_id) { Some(GlobalAlloc::Memory(alloc)) => { if let Ok(byte_str) = alloc.get_bytes(&self.tcx(), ptr, Size::from_bytes(*data)) { p!(pretty_print_byte_str(byte_str)) } else { p!(write("<too short allocation>")) } } // FIXME: for statics and functions, we could in principle print more detail. Some(GlobalAlloc::Static(def_id)) => p!(write("<static({:?})>", def_id)), Some(GlobalAlloc::Function(_)) => p!(write("<function>")), None => p!(write("<dangling pointer>")), }, </ins> // Bool (Scalar::Raw { data: 0, .. }, ty::Bool) => p!(write("false")), (Scalar::Raw { data: 1, .. }, ty::Bool) => p!(write("true")),


)?; } (Scalar::Ptr(ptr), ty::FnPtr(_)) => { <ins> // FIXME: this can ICE when the ptr is dangling or points to a non-function. // We should probably have a helper method to share code with the "Byte strings" // printing above (which also has to handle pointers to all sorts of things). </ins> let instance = self.tcx().global_alloc(ptr.alloc_id).unwrap_fn(); self = self.typed_value( |this| this.print_value_path(instance.def_id(), instance.substs),


<del> Subproject commit 77a0125981b293260c9aec6355dff46ec707ab59 </del> <ins> Subproject commit 655a1467c98741e332b87661a9046877077ef4dc </ins>


} debug!("note_type_err(diag={:?})", diag); <ins> enum Mismatch<'a> { Variable(ty::error::ExpectedFound<Ty<'a>>), Fixed(&'static str), } </ins> let (expected_found, exp_found, is_simple_error) = match values { <del> None => (None, None, false), </del> <ins> None => (None, Mismatch::Fixed("type"), false), </ins> Some(values) => { let (is_simple_error, exp_found) = match values { ValuePairs::Types(exp_found) => {


) .report(diag); <del> (is_simple_err, Some(exp_found)) </del> <ins> (is_simple_err, Mismatch::Variable(exp_found)) </ins> } <del> _ => (false, None), </del> <ins> ValuePairs::TraitRefs(_) => (false, Mismatch::Fixed("trait")), _ => (false, Mismatch::Fixed("type")), </ins> }; let vals = match self.values_str(&values) { Some((expected, found)) => Some((expected, found)),


} }; if let Some((expected, found)) = expected_found { <del> let expected_label = exp_found.map_or("type".into(), |ef| ef.expected.prefix_string()); let found_label = exp_found.map_or("type".into(), |ef| ef.found.prefix_string()); </del> <ins> let expected_label = match exp_found { Mismatch::Variable(ef) => ef.expected.prefix_string(), Mismatch::Fixed(s) => s.into(), }; let found_label = match exp_found { Mismatch::Variable(ef) => ef.found.prefix_string(), Mismatch::Fixed(s) => s.into(), }; let exp_found = match exp_found { Mismatch::Variable(exp_found) => Some(exp_found), Mismatch::Fixed(_) => None, }; </ins> match (&terr, expected == found) { (TypeError::Sorts(values), extra) => { let sort_string = |ty: Ty<'tcx>| match (extra, &ty.kind) {


} } } <ins> let exp_found = match exp_found { Mismatch::Variable(exp_found) => Some(exp_found), Mismatch::Fixed(_) => None, }; </ins> if let Some(exp_found) = exp_found { self.suggest_as_ref_where_appropriate(span, &exp_found, diag); }


<ins> trait DynEq {} impl<'a> PartialEq for &'a (dyn DynEq + 'static) { fn eq(&self, _other: &Self) -> bool { true } } impl Eq for &dyn DynEq {} //~ ERROR E0308 fn main() { } </ins>


<ins> error[E0308]: mismatched types --> $DIR/E0308-2.rs:9:6 | LL | impl Eq for &dyn DynEq {} |      ^^ lifetime mismatch | = note: expected trait `std::cmp::PartialEq` found trait `std::cmp::PartialEq` note: the lifetime `'_` as defined on the impl at 9:13... --> $DIR/E0308-2.rs:9:13 | LL | impl Eq for &dyn DynEq {} |             ^ = note: ...does not necessarily outlive the static lifetime error: aborting due to previous error For more information about this error, try `rustc --explain E0308`. </ins>