<del> error: `std::prelude::v1::Some` is not yet stable as a const fn --> $DIR/feature-gate-const_constructor.rs:9:37 | LL | const EXTERNAL_CONST: Option<i32> = {Some}(1); |                                     ^^^^^^^^^ | = help: add `#![feature(const_constructor)]` to the crate attributes to enable error: `E::V` is not yet stable as a const fn --> $DIR/feature-gate-const_constructor.rs:12:24 | LL | const LOCAL_CONST: E = {E::V}(1); |                        ^^^^^^^^^ | = help: add `#![feature(const_constructor)]` to the crate attributes to enable error: `std::prelude::v1::Some` is not yet stable as a const fn --> $DIR/feature-gate-const_constructor.rs:17:13 | LL |     let _ = {Some}(1); |             ^^^^^^^^^ | = help: add `#![feature(const_constructor)]` to the crate attributes to enable error: `E::V` is not yet stable as a const fn --> $DIR/feature-gate-const_constructor.rs:23:13 | LL |     let _ = {E::V}(1); |             ^^^^^^^^^ | = help: add `#![feature(const_constructor)]` to the crate attributes to enable error: aborting due to 4 previous errors </del>


edition = "2018" [dependencies] <del> cortex-m = "0.5.4" cortex-m-rt = "=0.5.4" </del> <ins> cortex-m = "0.6.2" cortex-m-rt = "0.6.11" </ins> panic-halt = "0.2.0" cortex-m-semihosting = "0.3.1"


| = note: see issue #65991 <https://github.com/rust-lang/rust/issues/65991> for more information = help: add `#![feature(trait_upcasting)]` to the crate attributes to enable <ins> = note: required when coercing `&dyn Bar` into `&dyn Foo` </ins> error: aborting due to previous error


) } <ins> /// Returns `true` if the token is the integer literal. pub fn is_integer_lit(&self) -> bool { matches!(self.kind, Literal(Lit { kind: LitKind::Integer, .. })) } </ins> /// Returns `true` if the token is a non-raw identifier for which `pred` holds. pub fn is_non_raw_ident_where(&self, pred: impl FnOnce(Ident) -> bool) -> bool { match self.ident() {


(`Foo`) of the impl. In this case, we can fix the error by moving the type parameter from the `impl` to the method `get`: ``` struct Foo;


<ins> #![feature(generic_const_exprs)] //~^ WARN the feature `generic_const_exprs` is incomplete struct DataWrapper<'static> { //~^ ERROR invalid lifetime parameter name: `'static` data: &'a [u8; Self::SIZE], //~^ ERROR use of undeclared lifetime name `'a` //~^^ ERROR lifetime may not live long enough } impl DataWrapper<'a> { //~^ ERROR undeclared lifetime const SIZE: usize = 14; } fn main(){} </ins>


UserTypeProjections { contents: projs.collect() } } <del> pub fn projections_and_spans(&self) -> impl Iterator<Item = &(UserTypeProjection, Span)> { </del> <ins> pub fn projections_and_spans(&self) -> impl Iterator<Item = &(UserTypeProjection, Span)> + ExactSizeIterator { </ins> self.contents.iter() } <del> pub fn projections(&self) -> impl Iterator<Item = &UserTypeProjection> { </del> <ins> pub fn projections(&self) -> impl Iterator<Item = &UserTypeProjection> + ExactSizeIterator { </ins> self.contents.iter().map(|&(ref user_type, _span)| user_type) }


COPY host-x86_64/dist-x86_64-linux/build-gcc.sh /tmp/ RUN ./build-gcc.sh && apt-get remove -y gcc g++ <del> # Debian 6 has Python 2.6 by default, but LLVM >= 12 needs Python 3 </del> <ins> # Debian 6 has Python 2.6 by default, but LLVM needs 2.7+ </ins> COPY host-x86_64/dist-x86_64-linux/build-python.sh /tmp/ RUN ./build-python.sh <del> # LLVM needs cmake 3.13.4 or higher </del> <ins> # LLVM needs cmake 3.4.3 or higher, and is planning to raise to 3.13.4. </ins> COPY host-x86_64/dist-x86_64-linux/build-cmake.sh /tmp/ RUN ./build-cmake.sh


hir::Path { segments: [segment], .. }, )) | hir::ExprKind::Path(QPath::TypeRelative(ty, segment)) => { <del> let self_ty = self.astconv().ast_ty_to_ty(ty); if let Ok(pick) = self.probe_for_name( Mode::Path, Ident::new(capitalized_name, segment.ident.span), Some(expected_ty), IsSuggestion(true), self_ty, expr.hir_id, ProbeScope::TraitsInScope, ) { </del> <ins> if let Some(self_ty) = self.typeck_results.borrow().node_type_opt(ty.hir_id) && let Ok(pick) = self.probe_for_name( Mode::Path, Ident::new(capitalized_name, segment.ident.span), Some(expected_ty), IsSuggestion(true), self_ty, expr.hir_id, ProbeScope::TraitsInScope, ) { </ins> (pick.item, segment) } else { return false;


prog = time(sess.time_passes(), "running linker", || { exec_linker(sess, &mut cmd, tmpdir) }); <del> if !retry_on_segfault || i > 3 { break } </del> let output = match prog { Ok(ref output) => output, Err(_) => break,


<ins> error: unused `std::result::Result` in tuple element 0 that must be used --> $DIR/must_use-tuple.rs:8:6 | LL |     (Ok::<(), ()>(()),); |      ^^^^^^^^^^^^^^^^ | note: lint level defined here --> $DIR/must_use-tuple.rs:1:9 | LL | #![deny(unused_must_use)] |         ^^^^^^^^^^^^^^^ = note: this `Result` may be an `Err` variant, which should be handled error: unused `std::result::Result` in tuple element 0 that must be used --> $DIR/must_use-tuple.rs:10:6 | LL |     (Ok::<(), ()>(()), 0, Ok::<(), ()>(()), 5); |      ^^^^^^^^^^^^^^^^ | = note: this `Result` may be an `Err` variant, which should be handled error: unused `std::result::Result` in tuple element 2 that must be used --> $DIR/must_use-tuple.rs:10:27 | LL |     (Ok::<(), ()>(()), 0, Ok::<(), ()>(()), 5); |                           ^^^^^^^^^^^^^^^^ | = note: this `Result` may be an `Err` variant, which should be handled error: unused `std::result::Result` in tuple element 0 that must be used --> $DIR/must_use-tuple.rs:14:5 | LL |     foo(); |     ^^^^^^ | = note: this `Result` may be an `Err` variant, which should be handled error: unused `std::result::Result` in tuple element 0 that must be used --> $DIR/must_use-tuple.rs:16:6 | LL |     ((Err::<(), ()>(()), ()), ()); |      ^^^^^^^^^^^^^^^^^^^^^^^ | = note: this `Result` may be an `Err` variant, which should be handled error: aborting due to 5 previous errors </ins>


remove_dir_all_recursive(None, p) } } <ins> #[cfg(not(all(target_os = "macos", target_arch = "x86_64")))] pub fn remove_dir_all(p: &Path) -> io::Result<()> { remove_dir_all_modern(p) } #[cfg(all(target_os = "macos", target_arch = "x86_64"))] pub fn remove_dir_all(p: &Path) -> io::Result<()> { if macos_weak::has_openat() { // openat() is available with macOS 10.10+, just like unlinkat() and fdopendir() remove_dir_all_modern(p) } else { // fall back to classic implementation crate::sys_common::fs::remove_dir_all(p) } } </ins> }


// see the extensive comment in projection_must_outlive let recursive_bound = { let mut components = smallvec![]; <del> compute_components_recursive(self.tcx, alias_ty_as_ty.into(), &mut components, visited); </del> <ins> compute_alias_components_recursive( self.tcx, alias_ty_as_ty.into(), &mut components, visited, ); </ins> self.bound_from_components(&components, visited) };


<ins> warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:40:18 | LL |     Pointer::fmt(&zst_ref, f) |                  ^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` | note: the lint level is defined here --> $DIR/function-item-references.rs:3:9 | LL | #![warn(function_item_references)] |         ^^^^^^^^^^^^^^^^^^^^^^^^ warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:77:22 | LL |     println!("{:p}", &foo); |                      ^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:79:20 | LL |     print!("{:p}", &foo); |                    ^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:81:21 | LL |     format!("{:p}", &foo); |                     ^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:84:22 | LL |     println!("{:p}", &foo as *const _); |                      ^^^^^^^^^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:86:22 | LL |     println!("{:p}", zst_ref); |                      ^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:88:22 | LL |     println!("{:p}", cast_zst_ptr); |                      ^^^^^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:90:22 | LL |     println!("{:p}", coerced_zst_ptr); |                      ^^^^^^^^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:93:22 | LL |     println!("{:p}", &fn_item); |                      ^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:95:22 | LL |     println!("{:p}", indirect_ref); |                      ^^^^^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:98:22 | LL |     println!("{:p}", &nop); |                      ^^^^ help: cast `nop` to obtain a function pointer: `nop as fn()` warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:100:22 | LL |     println!("{:p}", &bar); |                      ^^^^ help: cast `bar` to obtain a function pointer: `bar as fn(_) -> _` warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:102:22 | LL |     println!("{:p}", &baz); |                      ^^^^ help: cast `baz` to obtain a function pointer: `baz as fn(_, _) -> _` warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:104:22 | LL |     println!("{:p}", &unsafe_fn); |                      ^^^^^^^^^^ help: cast `unsafe_fn` to obtain a function pointer: `unsafe_fn as unsafe fn()` warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:106:22 | LL |     println!("{:p}", &c_fn); |                      ^^^^^ help: cast `c_fn` to obtain a function pointer: `c_fn as extern "C" fn()` warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:108:22 | LL |     println!("{:p}", &unsafe_c_fn); |                      ^^^^^^^^^^^^ help: cast `unsafe_c_fn` to obtain a function pointer: `unsafe_c_fn as unsafe extern "C" fn()` warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:110:22 | LL |     println!("{:p}", &variadic); |                      ^^^^^^^^^ help: cast `variadic` to obtain a function pointer: `variadic as unsafe extern "C" fn(_, ...)` warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:112:22 | LL |     println!("{:p}", &std::env::var::<String>); |                      ^^^^^^^^^^^^^^^^^^^^^^^^ help: cast `var` to obtain a function pointer: `var as fn(_) -> _` warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:115:32 | LL |     println!("{:p} {:p} {:p}", &nop, &foo, &bar); |                                ^^^^ help: cast `nop` to obtain a function pointer: `nop as fn()` warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:115:38 | LL |     println!("{:p} {:p} {:p}", &nop, &foo, &bar); |                                      ^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:115:44 | LL |     println!("{:p} {:p} {:p}", &nop, &foo, &bar); |                                            ^^^^ help: cast `bar` to obtain a function pointer: `bar as fn(_) -> _` warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:130:41 | LL |         std::mem::transmute::<_, usize>(&foo); |                                         ^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:132:50 | LL |         std::mem::transmute::<_, (usize, usize)>((&foo, &bar)); |                                                  ^^^^^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:132:50 | LL |         std::mem::transmute::<_, (usize, usize)>((&foo, &bar)); |                                                  ^^^^^^^^^^^^ help: cast `bar` to obtain a function pointer: `bar as fn(_) -> _` warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:142:15 | LL |     print_ptr(&bar); |               ^^^^ help: cast `bar` to obtain a function pointer: `bar as fn(_) -> _` warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:144:24 | LL |     bound_by_ptr_trait(&bar); |                        ^^^^ help: cast `bar` to obtain a function pointer: `bar as fn(_) -> _` warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:146:30 | LL |     bound_by_ptr_trait_tuple((&foo, &bar)); |                              ^^^^^^^^^^^^ help: cast `bar` to obtain a function pointer: `bar as fn(_) -> _` warning: taking a reference to a function item does not give a function pointer --> $DIR/function-item-references.rs:146:30 | LL |     bound_by_ptr_trait_tuple((&foo, &bar)); |                              ^^^^^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` warning: 28 warnings emitted </ins>


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


<ins> // Checks that there is a suggestion for simple tuple index access expression (used where an // identifier is expected in a format arg) to use positional arg instead. // Issue: <https://github.com/rust-lang/rust/issues/122535>. //@ run-rustfix fn main() { let x = (1,); println!("{x.0}"); //~^ ERROR invalid format string } </ins>


|     ^^^^^^^^ error[E0603]: enum `Bar` is private <del> --> $DIR/struct-variant-privacy.rs:9:14 </del> <ins> --> $DIR/struct-variant-privacy.rs:10:14 </ins> | LL |         foo::Bar::Baz { a: _a } => {} |              ^^^ private enum


<ins> // build-pass #![allow(incomplete_features)] #![feature(const_generics)] struct Bug<const S: &'static str>; fn main() { let b: Bug::<{ unsafe { // FIXME(const_generics): Decide on how to deal with invalid values as const params. std::mem::transmute::<&[u8], &str>(&[0xC0, 0xC1, 0xF5]) } }>; } </ins>


<del> error[E0658]: trait upcasting coercion is experimental </del> <ins> error[E0658]: cannot cast `dyn Bar` to `dyn Foo`, trait upcasting coercion is experimental </ins> --> $DIR/feature-gate-trait_upcasting.rs:11:25 | LL |     let foo: &dyn Foo = bar;


driver_rlink_rustc_version_mismatch = .rlink file was produced by rustc version `{$rustc_version}`, but the current version is `{$current_version}` driver_rlink_no_a_file = rlink must be a file <ins> driver_unpretty_dump_fail = pretty-print failed to write `{$path}` due to error `{$err}` </ins>


#![feature(const_slice_split_at_mut)] #![feature(const_str_from_utf8_unchecked_mut)] #![feature(const_swap)] <del> #![feature(const_transmute_copy)] </del> #![feature(const_try)] #![feature(const_type_id)] #![feature(const_type_name)]


false } <del> fn let_binding_suggestion(&self, err: &mut Diagnostic, ident_span: Span) -> bool { // try to give a suggestion for this pattern: `name = 1`, which is common in other languages let mut added_suggestion = false; if let Some(Expr { kind: ExprKind::Assign(lhs, _rhs, _), .. }) = self.diagnostic_metadata.in_assignment && </del> <ins> // try to give a suggestion for this pattern: `name = blah`, which is common in other languages // suggest `let name = blah` to introduce a new binding fn let_binding_suggestion(&mut self, err: &mut Diagnostic, ident_span: Span) -> bool { if let Some(Expr { kind: ExprKind::Assign(lhs, .. ), .. }) = self.diagnostic_metadata.in_assignment && </ins> let ast::ExprKind::Path(None, _) = lhs.kind { <del> let sm = self.r.session.source_map(); let line_span = sm.span_extend_to_line(ident_span); let ident_name = sm.span_to_snippet(ident_span).unwrap(); // HACK(chenyukang): make sure ident_name is at the starting of the line to protect against macros if sm .span_to_snippet(line_span) .map_or(false, |s| s.trim().starts_with(&ident_name)) { </del> <ins> if !ident_span.from_expansion() { </ins> err.span_suggestion_verbose( ident_span.shrink_to_lo(), "you might have meant to introduce a new binding", "let ".to_string(), Applicability::MaybeIncorrect, ); <del> added_suggestion = true; </del> <ins> return true; </ins> } } <del> added_suggestion </del> <ins> false </ins> } fn find_module(&mut self, def_id: DefId) -> Option<(Module<'a>, ImportSuggestion)> {


pub fn cargo_clippy_cmd(&self, run_compiler: Compiler) -> BootstrapCommand { if run_compiler.stage == 0 { <del> // `ensure(Clippy { stage: 0 })` *builds* clippy with stage0, it doesn't use the beta clippy. let cargo_clippy = self.build.config.download_clippy(); </del> <ins> let cargo_clippy = self .config .initial_cargo_clippy .clone() .unwrap_or_else(|| self.build.config.download_clippy()); </ins> let mut cmd = command(cargo_clippy); cmd.env("CARGO", &self.initial_cargo); return cmd;


<ins> error: `_x @` is not allowed in a tuple struct --> $DIR/issue-72574-2.rs:6:20 | LL |         Binder(_a, _x @ ..) => {} |                    ^^^^^^^ this is only allowed in slice patterns | = help: remove this and bind each tuple field independently help: if you don't need to use the contents of _x, discard the tuple's remaining fields | LL |         Binder(_a, ..) => {} |                    ^^ error: aborting due to previous error </ins>


<ins> // Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // error-pattern:panic evaluated #[allow(unused_variables)] fn main() { let x = [panic!("panic evaluated"); 0]; } </ins>


#[proc_macro_attribute] pub fn expect_print_expr(attr: TokenStream, item: TokenStream) -> TokenStream { assert!(attr.to_string().is_empty()); <del> assert_eq!(item.to_string(), "println!("{}" , string)"); </del> <ins> assert_eq!(item.to_string(), "println!("{}", string)"); </ins> item }


<ins> // Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. fn identity(a: &u32) -> &u32 { a } fn print_foo(f: &fn(&u32) -> &u32, x: &u32) { print!("{}", (*f)(x)); } fn main() { let x = &4; let f: fn(&u32) -> &u32 = identity; // Didn't print 4 on optimized builds print_foo(&f, x); } </ins>


} #[stable(feature = "rust1", since = "1.0.0")] <del> impl Clone for CString { fn clone(&self) -> Self { CString { inner: self.inner.to_owned().into_boxed_slice() } } } #[stable(feature = "rust1", since = "1.0.0")] </del> impl Deref for CString { type Target = CStr;


<ins> error[E0277]: the size for values of type `[u8]` cannot be known at compilation time --> $DIR/suggest-borrow.rs:2:9 | LL |     let x: [u8] = vec!(1, 2, 3)[..]; |         ^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature help: consider borrowing here | LL |     let x: &[u8] = vec!(1, 2, 3)[..]; |            + error[E0308]: mismatched types --> $DIR/suggest-borrow.rs:3:20 | LL |     let x: &[u8] = vec!(1, 2, 3)[..]; |            -----   ^^^^^^^^^^^^^^^^^ |            |       | |            |       expected `&[u8]`, found slice `[{integer}]` |            |       help: consider borrowing here: `&vec!(1, 2, 3)[..]` |            expected due to this error[E0308]: mismatched types --> $DIR/suggest-borrow.rs:4:19 | LL |     let x: [u8] = &vec!(1, 2, 3)[..]; |            ----   ^^^^^^^^^^^^^^^^^^ expected slice `[u8]`, found `&[{integer}]` |            | |            expected due to this | help: consider removing the borrow | LL -     let x: [u8] = &vec!(1, 2, 3)[..]; LL +     let x: [u8] = vec!(1, 2, 3)[..]; | help: alternatively, consider changing the type annotation | LL |     let x: &[u8] = &vec!(1, 2, 3)[..]; |            + error[E0277]: the size for values of type `[u8]` cannot be known at compilation time --> $DIR/suggest-borrow.rs:4:9 | LL |     let x: [u8] = &vec!(1, 2, 3)[..]; |         ^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature help: consider borrowing here | LL |     let x: &[u8] = &vec!(1, 2, 3)[..]; |            + error: aborting due to 4 previous errors Some errors have detailed explanations: E0277, E0308. For more information about an error, try `rustc --explain E0277`. </ins>


#![crate_name = "compiletest"] #![feature(test)] <del> #![feature(vec_remove_item)] </del> #![deny(warnings)] extern crate test;


<ins> fn main() { x = x = x; //~^ ERROR cannot find value `x` in this scope //~| ERROR cannot find value `x` in this scope //~| ERROR cannot find value `x` in this scope x = y = y = y; //~^ ERROR cannot find value `y` in this scope //~| ERROR cannot find value `y` in this scope //~| ERROR cannot find value `y` in this scope //~| ERROR cannot find value `x` in this scope x = y = y; //~^ ERROR cannot find value `x` in this scope //~| ERROR cannot find value `y` in this scope //~| ERROR cannot find value `y` in this scope x = x = y; //~^ ERROR cannot find value `x` in this scope //~| ERROR cannot find value `x` in this scope //~| ERROR cannot find value `y` in this scope x = x; // will suggest add `let` //~^ ERROR cannot find value `x` in this scope //~| ERROR cannot find value `x` in this scope x = y // will suggest add `let` //~^ ERROR cannot find value `x` in this scope //~| ERROR cannot find value `y` in this scope } </ins>


<ins> // Checks that we do not ICE when comparing `Self` to `Pin` // edition:2021 struct S; impl S { fn foo(_: Box<Option<S>>) {} fn bar() { Self::foo(None) //~ ERROR mismatched types } } fn main() {} </ins>


match x { box 1 => (), //~^ box pattern syntax is experimental <del> //~| add #![feature(box_patterns)] to the crate attributes to enable </del> _     => () }; }


(src, src_name) } <del> fn write_or_print(out: &str, ofile: Option<&Path>) { </del> <ins> fn write_or_print(out: &str, ofile: Option<&Path>, sess: &Session) { </ins> match ofile { None => print!("{}", out), Some(p) => { if let Err(e) = std::fs::write(p, out) { <del> panic!("print-print failed to write {} due to {}", p.display(), e); </del> <ins> sess.emit_fatal(UnprettyDumpFail { path: p.display().to_string(), err: e.to_string(), }); </ins> } } }


//! Free functions to create `&[T]` and `&mut [T]`. use crate::array; <del> use crate::intrinsics::is_aligned_and_not_null; use crate::mem; </del> use crate::ptr; /// Forms a slice from a pointer and a length.


<ins> // Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // This used to generate invalid IR in that even if we took the // `false` branch we'd still try to free the Box from the other // arm. This was due to treating `*Box::new(9)` as an rvalue datum // instead of as an lvalue. fn test(foo: bool) -> u8 { match foo { true => *Box::new(9), false => 0 } } fn main() { assert_eq!(9, test(true)); } </ins>


ast::AssocItemKind::Fn(..) => AssocSuggestion::AssocFn { called }, ast::AssocItemKind::Type(..) => AssocSuggestion::AssocType, ast::AssocItemKind::Delegation(..) <del> if self.r.delegation_fn_sigs[&self.r.local_def_id(assoc_item.id)] .has_self => </del> <ins> if self .r .delegation_fn_sigs .get(&self.r.local_def_id(assoc_item.id)) .map_or(false, |sig| sig.has_self) => </ins> { AssocSuggestion::MethodWithSelf { called } }


} } <ins> crate fn name_from_pat(p: &hir::Pat<'_>) -> Symbol { use rustc_hir::*; debug!("trying to get a name from pattern: {:?}", p); Symbol::intern(&match p.kind { PatKind::Wild => return kw::Underscore, PatKind::Binding(_, _, ident, _) => return ident.name, PatKind::TupleStruct(ref p, ..) | PatKind::Path(ref p) => qpath_to_string(p), PatKind::Struct(ref name, ref fields, etc) => format!( "{} {{ {}{} }}", qpath_to_string(name), fields .iter() .map(|fp| format!("{}: {}", fp.ident, name_from_pat(&fp.pat))) .collect::<Vec<String>>() .join(", "), if etc { ", .." } else { "" } ), PatKind::Or(ref pats) => pats .iter() .map(|p| name_from_pat(&**p).to_string()) .collect::<Vec<String>>() .join(" | "), PatKind::Tuple(ref elts, _) => format!( "({})", elts.iter() .map(|p| name_from_pat(&**p).to_string()) .collect::<Vec<String>>() .join(", ") ), PatKind::Box(ref p) => return name_from_pat(&**p), PatKind::Ref(ref p, _) => return name_from_pat(&**p), PatKind::Lit(..) => { warn!( "tried to get argument name from PatKind::Lit, which is silly in function arguments" ); return Symbol::intern("()"); } PatKind::Range(..) => return kw::Underscore, PatKind::Slice(ref begin, ref mid, ref end) => { let begin = begin.iter().map(|p| name_from_pat(&**p).to_string()); let mid = mid.as_ref().map(|p| format!("..{}", name_from_pat(&**p))).into_iter(); let end = end.iter().map(|p| name_from_pat(&**p).to_string()); format!("[{}]", begin.chain(mid).chain(end).collect::<Vec<_>>().join(", ")) } }) } </ins> crate fn print_const(cx: &DocContext<'_>, n: &'tcx ty::Const<'_>) -> String { match n.val { ty::ConstKind::Unevaluated(def, _, promoted) => {


} fn check_version(config: &Config) -> Option<String> { <del> const VERSION: usize = 2; </del> let mut msg = String::new(); let suggestion = if let Some(seen) = config.changelog_seen {


fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { (**self).read(buf) } <ins> fn read_buf(&mut self, cursor: BorrowedCursor<'_>) -> io::Result<()> { (**self).read_buf(cursor) } </ins> } impl AsInner<OwnedFd> for FileDesc {


use rustc_ast::ast::*; use rustc_ast::ptr::P; use rustc_data_structures::stack::ensure_sufficient_stack; <ins> use rustc_errors::Applicability; </ins> use rustc_hir as hir; use rustc_hir::def::Res; use rustc_span::symbol::Ident;


use rustc::hir::def::Namespace::*; use rustc::hir::def_id::{CRATE_DEF_INDEX, LOCAL_CRATE, DefId}; use rustc::hir::{Freevar, FreevarMap, TraitCandidate, TraitMap, GlobMap}; <del> use rustc::ty; </del> <ins> use rustc::ty::{self, DefIdTree}; </ins> use rustc::util::nodemap::{NodeMap, NodeSet, FxHashMap, FxHashSet, DefIdMap}; use rustc::{bug, span_bug};


<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>


foo.method_locked_text(); foo.trait_locked_text(); let _ = DeprecatedStruct { i: 0 }; //~ ERROR use of deprecated item let _ = ExperimentalStruct { i: 0 }; //~ ERROR use of experimental item let _ = UnstableStruct { i: 0 }; //~ ERROR use of unstable item


/// the two vectors, `regions` and `types` (depending on their kind). For each /// parameter `Pi` also track the index `i`. struct GATSubstCollector<'tcx> { <ins> tcx: TyCtxt<'tcx>, </ins> gat: DefId, // Which region appears and which parameter index its subsituted for regions: FxHashSet<(ty::Region<'tcx>, usize)>,


impl PartialOrd for bool { #[inline] fn partial_cmp(&self, other: &bool) -> Option<Ordering> { <del> (*self as u8).partial_cmp(&(*other as u8)) </del> <ins> Some(self.cmp(other)) </ins> } }


<ins> // Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. struct S; impl Iterator for S { type Item = i32; fn next(&mut self) -> Result<i32, i32> { Ok(7) } //~^ ERROR method `next` has an incompatible type for trait //~| expected enum `core::option::Option` //~|    found enum `core::result::Result` [E0053] } fn main() {} </ins>


margin-bottom: .625em; } <del> p { </del> <ins> p, .docblock > .warning { </ins> /* Paragraph spacing at least 1.5 times line spacing per Web Content Accessibility Guidelines. Line-height is 1.5rem, so line spacing is .5rem; .75em is 1.5 times that. https://www.w3.org/WAI/WCAG21/Understanding/visual-presentation.html */


if bcx.expr_is_lval(a) { let datum = unpack_datum!(bcx, trans_to_datum(bcx, a)); return match dest { <del> Ignore => datum.drop_val(bcx), </del> <ins> Ignore => drop_and_cancel_clean(datum, bcx), </ins> SaveIn(addr) => datum.move_to(bcx, INIT, addr) }; } else {


<ins> //! To determine all the types that need to be private when looking at `Struct`, we //! used to invoke `predicates_of` to also look at types in `where` bounds. //! Unfortunately this also computes the inferred outlives bounds, which means for //! every field we check that if it is of type `&'a T` then `T: 'a` and if it is of //! struct type, we check that the struct satisfies its lifetime parameters by looking //! at its inferred outlives bounds. This means we end up with a `<Foo as Trait>::Assoc: 'a` //! in the outlives bounds of `Struct`. While this is trivially provable, privacy //! only sees `Foo` and `Trait` and determines that `Foo` is private and then errors. //! So now we invoke `explicit_predicates_of` to make sure we only care about user-written //! predicates. //@ check-pass mod baz { struct Foo; pub trait Trait { type Assoc; } impl Trait for Foo { type Assoc = (); } pub struct Bar<'a, T: Trait> { source: &'a T::Assoc, } pub struct Baz<'a> { mode: Bar<'a, Foo>, } } pub struct Struct<'a> { lexer: baz::Baz<'a>, } fn main() {} </ins>


Path { global: path.global, res: path.res, segments } } <ins> crate fn qpath_to_string(p: &hir::QPath<'_>) -> String { let segments = match *p { hir::QPath::Resolved(_, ref path) => &path.segments, hir::QPath::TypeRelative(_, ref segment) => return segment.ident.to_string(), hir::QPath::LangItem(lang_item, ..) => return lang_item.name().to_string(), }; let mut s = String::new(); for (i, seg) in segments.iter().enumerate() { if i > 0 { s.push_str("::"); } if seg.ident.name != kw::PathRoot { s.push_str(&seg.ident.as_str()); } } s } </ins> crate fn build_deref_target_impls(cx: &DocContext<'_>, items: &[Item], ret: &mut Vec<Item>) { let tcx = cx.tcx;


<ins> // run-pass #![feature(unsized_locals)] #![allow(dead_code)] #[repr(align(256))] struct A { v: u8, } impl A { fn f(&self) -> *const A { self } } fn f2(v: u8) -> Box<dyn FnOnce() -> *const A> { let a = A { v }; Box::new(move || a.f()) } fn main() { let addr = f2(0)(); assert_eq!(addr as usize % 256, 0, "addr: {:?}", addr); } </ins>


/// ``` /// /// ``` <del> /// #![feature(maybe_uninit_write_slice, vec_spare_capacity)] </del> <ins> /// #![feature(maybe_uninit_write_slice)] </ins> /// use std::mem::MaybeUninit; /// /// let mut vec = Vec::with_capacity(32);


.find(|p| link.starts_with(**p)) { kind = Some(ValueNS); <ins> disambiguator = Some(&prefix[..prefix.len() - 1]); </ins> link.trim_start_matches(prefix) } else if link.ends_with("()") { kind = Some(ValueNS); <ins> disambiguator = Some("fn"); </ins> link.trim_end_matches("()") } else if link.starts_with("macro@") { kind = Some(MacroNS); <ins> disambiguator = Some("macro"); </ins> link.trim_start_matches("macro@") } else if link.starts_with("derive@") { kind = Some(MacroNS); <ins> disambiguator = Some("derive"); </ins> link.trim_start_matches("derive@") } else if link.ends_with('!') { kind = Some(MacroNS); <ins> disambiguator = Some("macro"); </ins> link.trim_end_matches('!') } else { &link[..]


use crate::any::Any; use crate::fmt; use crate::marker::PhantomData; <ins> use crate::panic::AssertUnwindSafe; </ins> use crate::ptr; /// A `RawWaker` allows the implementor of a task executor to create a [`Waker`]


a: ty::Region<'tcx>, b: ty::Region<'tcx>, ) { <ins> if let ty::ReEmpty = a { return; } </ins> let b = self.to_region_vid(b); let a = self.to_region_vid(a); self.add_outlives(b, a);


(cfg, _) => cfg.as_deref().cloned(), };  debug!("Portability {:?} - {:?} = {:?}", item.cfg, parent.and_then(|p| p.cfg.as_ref()), cfg);   debug!( "Portability {:?} {:?} (parent: {:?}) - {:?} = {:?}", item.name, item.cfg, parent, parent.and_then(|p| p.cfg.as_ref()), cfg );  Some(format!("
{}
", cfg?.render_long_html())) }


msg: &str) -> DiagnosticBuilder<'a> { <del> let (level, src) = self.sets.get_lint_level(lint, self.cur); </del> <ins> let (level, src) = self.sets.get_lint_level(lint, self.cur, None); </ins> lint::struct_lint_level(self.sess, lint, level, src, span, msg) }


<ins> // assembly-output: emit-asm // # zen3 previously exhibited odd vectorization // compile-flags: --crate-type=lib -Ctarget-cpu=znver3 -O // only-x86_64 // ignore-sgx use std::iter; // previously this produced a long chain of // 56:  vpextrb $6, %xmm0, %ecx // 57:  orb %cl, 22(%rsi) // 58:  vpextrb $7, %xmm0, %ecx // 59:  orb %cl, 23(%rsi) // [...] // CHECK-LABEL: zip_arrays: #[no_mangle] pub fn zip_arrays(mut a: [u8; 32], b: [u8; 32]) -> [u8; 32] { // CHECK-NOT: vpextrb // CHECK-NOT: orb %cl // CHECK: vorps iter::zip(&mut a, b).for_each(|(a, b)| *a |= b); // CHECK: retq a } </ins>


) -> DefId { let body = tcx.mir_built(coroutine_def_id).borrow(); <ins> // If the typeck results are tainted, no need to make a by-ref body. if body.tainted_by_errors.is_some() { return coroutine_def_id.to_def_id(); } </ins> let Some(hir::CoroutineKind::Desugared(_, hir::CoroutineSource::Closure)) = tcx.coroutine_kind(coroutine_def_id) else {


<del> error: lifetime may not live long enough --> $DIR/issue-16922.rs:4:5 | LL | fn foo<T: Any>(value: &T) -> Box<dyn Any> { |                       - let's call the lifetime of this reference `'1` LL |     Box::new(value) as Box<dyn Any> |     ^^^^^^^^^^^^^^^ cast requires that `'1` must outlive `'static` | help: to declare that the trait object captures data from argument `value`, you can add an explicit `'_` lifetime bound | LL | fn foo<T: Any>(value: &T) -> Box<dyn Any + '_> { |                                          ++++ error: aborting due to previous error </del>


run_pass_manager(cgcx, tm, llmod, config, true); cgcx.save_temp_bitcode(&mtrans, "thin-lto-after-pm"); timeline.record("thin-done"); <ins> // FIXME: this is a hack around a bug in LLVM right now. Discovered in // #46910 it was found out that on 32-bit MSVC LLVM will hit a codegen // error if there's an available_externally function in the LLVM module. // Typically we don't actually use these functions but ThinLTO makes // heavy use of them when inlining across modules. // // Tracked upstream at https://bugs.llvm.org/show_bug.cgi?id=35736 this // function call (and its definition on the C++ side of things) // shouldn't be necessary eventually and we can safetly delete these few // lines. llvm::LLVMRustThinLTORemoveAvailableExternally(llmod); cgcx.save_temp_bitcode(&mtrans, "thin-lto-after-rm-ae"); timeline.record("no-ae"); </ins> Ok(mtrans) } }


self_ty: Ty<'tcx>, sig: ty::PolyGenSig<'tcx>, ) -> ty::Binder<'tcx, (ty::TraitRef<'tcx>, Ty<'tcx>, Ty<'tcx>)> { <del> debug_assert!(!self_ty.has_escaping_bound_vars()); </del> <ins> assert!(!self_ty.has_escaping_bound_vars()); </ins> let trait_ref = tcx.mk_trait_ref(fn_trait_def_id, [self_ty, sig.skip_binder().resume_ty]); sig.map_bound(|sig| (trait_ref, sig.yield_ty, sig.return_ty)) }


linker_flavor: LinkerFlavor::Ld, linker: Some("arm-none-eabi-ld".into()), asm_args: cvs!["-mthumb-interwork", "-march=armv4t", "-mlittle-endian",], <del> features: "+soft-float,+strict-align".into(), </del> <ins> // Force-enable 32-bit atomics, which allows the use of atomic load/store only. // The resulting atomics are ABI incompatible with atomics backed by libatomic. features: "+soft-float,+strict-align,+atomics-32".into(), </ins> main_needs_argc_argv: false, atomic_cas: false, has_thumb_interworking: true,


<ins> // check-pass #![feature(generic_const_exprs)] #![allow(incomplete_features)] #![deny(const_evaluatable_unchecked)] pub struct If<const CONDITION: bool>; pub trait True {} impl True for If<true> {} pub struct FixedI8<const FRAC: u32> { pub bits: i8, } impl<const FRAC_LHS: u32, const FRAC_RHS: u32> PartialEq<FixedI8<FRAC_RHS>> for FixedI8<FRAC_LHS> where If<{ FRAC_RHS <= 8 }>: True, { fn eq(&self, _rhs: &FixedI8<FRAC_RHS>) -> bool { unimplemented!() } } impl<const FRAC: u32> PartialEq<i8> for FixedI8<FRAC> { fn eq(&self, rhs: &i8) -> bool { let rhs_as_fixed = FixedI8::<0> { bits: *rhs }; PartialEq::eq(self, &rhs_as_fixed) } } fn main() {} </ins>


#[stable(feature = "array_value_iter_impls", since = "1.40.0")] unsafe impl<T, const N: usize> TrustedLen for IntoIter<T, N> {} <ins> #[doc(hidden)] #[unstable(issue = "none", feature = "std_internals")] #[rustc_unsafe_specialization_marker] pub trait NonDrop {} // T: Copy as approximation for !Drop since get_unchecked does not advance self.alive // and thus we can't implement drop-handling #[unstable(issue = "none", feature = "std_internals")] impl<T: Copy> NonDrop for T {} #[doc(hidden)] #[unstable(issue = "none", feature = "std_internals")] unsafe impl<T, const N: usize> TrustedRandomAccessNoCoerce for IntoIter<T, N> where T: NonDrop, { const MAY_HAVE_SIDE_EFFECT: bool = false; } </ins> #[stable(feature = "array_value_iter_impls", since = "1.40.0")] impl<T: Clone, const N: usize> Clone for IntoIter<T, N> { fn clone(&self) -> Self {


let r = match datum.ty.sty { ty::ty_uniq(content_ty) => { <ins> // Make sure we have an lvalue datum here to get the // proper cleanups scheduled let datum = unpack_datum!( bcx, datum.to_lvalue_datum(bcx, "deref", expr.id)); </ins> if type_is_sized(bcx.tcx(), content_ty) { <del> deref_owned_pointer(bcx, expr, datum, content_ty) </del> <ins> let ptr = load_ty(bcx, datum.val, datum.ty); DatumBlock::new(bcx, Datum::new(ptr, content_ty, LvalueExpr)) </ins> } else { // A fat pointer and a DST lvalue have the same representation // just different types. Since there is no temporary for `*e` // here (because it is unsized), we cannot emulate the sized // object code path for running drop glue and free. Instead, // we schedule cleanup for `e`, turning it into an lvalue. <del> let datum = unpack_datum!( bcx, datum.to_lvalue_datum(bcx, "deref", expr.id)); </del> let datum = Datum::new(datum.val, content_ty, LvalueExpr); DatumBlock::new(bcx, datum)


/// # Examples /// /// ``` <del> /// format!("test"); /// format!("hello {}", "world!"); /// format!("x = {}, y = {y}", 10, y = 30); </del> <ins> /// format!("test");                             // => "test" /// format!("hello {}", "world!");               // => "hello world!" /// format!("x = {}, y = {val}", 10, val = 30);  // => "x = 10, y = 30" </ins> /// let (x, y) = (1, 2); <del> /// format!("{x} + {y} = 3"); </del> <ins> /// format!("{x} + {y} = 3");                    // => "1 + 2 = 3" </ins> /// ``` #[macro_export] #[stable(feature = "rust1", since = "1.0.0")]


_ => unreachable!(), }; <del> write_or_print(&out, ofile); </del> <ins> write_or_print(&out, ofile, sess); </ins> } pub fn print_after_hir_lowering<'tcx>(


<ins> // Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // RFC 736 (and Issue 21407): functional struct update should respect privacy. // The `foo` module attempts to maintains an invariant that each `S` // has a unique `u64` id. use self::foo::S; mod foo { use std::cell::{UnsafeCell}; static mut count : UnsafeCell<u64> = UnsafeCell { value: 1 }; pub struct S { pub a: u8, pub b: String, secret_uid: u64 } pub fn make_secrets(a: u8, b: String) -> S { let val = unsafe { let p = count.get(); let val = *p; *p = val + 1; val }; println!("creating {}, uid {}", b, val); S { a: a, b: b, secret_uid: val } } impl Drop for S { fn drop(&mut self) { println!("dropping {}, uid {}", self.b, self.secret_uid); } } } fn main() { let s_1 = foo::make_secrets(3, format!("ess one")); let s_2 = foo::S { b: format!("ess two"), ..s_1 }; // FRU ... //~^ ERROR field `secret_uid` of struct `foo::S` is private println!("main forged an S named: {}", s_2.b); // at end of scope, ... both s_1 *and* s_2 get dropped.  Boom! } </ins>


/// # Examples /// /// ```no_run <del> /// #![feature(buffered_io_capacity)] </del> /// use std::io::BufWriter; /// use std::net::TcpStream; ///


<ins> error: unused pinned `MustUsePtr` that must be used --> $DIR/must_use-pin.rs:42:5 | LL |     pin_must_use_ptr(); |     ^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/must_use-pin.rs:1:9 | LL | #![deny(unused_must_use)] |         ^^^^^^^^^^^^^^^ error: unused pinned boxed `MustUse` that must be used --> $DIR/must_use-pin.rs:44:5 | LL |     pin_box_must_use(); |     ^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors </ins>


without modifying the original"] #[inline] #[track_caller] <del> #[rustc_inherit_overflow_checks] #[allow(arithmetic_overflow)] </del> pub const fn ilog10(self) -> u32 { <del> match self.checked_ilog10() { Some(n) => n, None => { // In debug builds, trigger a panic on None. // This should optimize completely out in release builds. let _ = Self::MAX + 1; 0 }, } </del> <ins> self.checked_ilog10().expect("argument of integer logarithm must be positive") </ins> } /// Returns the logarithm of the number with respect to an arbitrary base,


<ins> // https://github.com/rust-lang/rust/issues/69228 // Used to give bogus suggestion about T not being Sized. use std::mem::size_of; fn foo<T>() { let _arr: [u8; size_of::<T>()]; //~^ ERROR generic parameters may not be used in const operations //~| NOTE cannot perform const operation //~| NOTE type parameters may not be used in const expressions } fn main() {} </ins>


<ins> // run-pass #![feature(const_mut_refs)] static mut TEST: i32 = { // We must not promote this, as CTFE needs to be able to mutate it later. let x = &mut [1,2,3]; x[0] += 1; x[0] }; // This still works -- it's not done via promotion. #[allow(unused)] static mut TEST2: &'static mut [i32] = &mut [0,1,2]; fn main() { assert_eq!(unsafe { TEST }, 2); } </ins>


pub const EXPLAIN_DERIVE_UNDERSCORE: &'static str = "attributes of the form `#[derive_*]` are reserved for the compiler"; <del> pub const EXPLAIN_LITERAL_MATCHER: &'static str = ":literal fragment specifier is experimental and subject to change"; </del> pub const EXPLAIN_UNSIZED_TUPLE_COERCION: &'static str = "unsized tuple coercion is not stable enough for use and is subject to change";


exit_success_if_unwind::bar(do_panic); } } <del> let s = Command::new(env::args_os().next().unwrap()).arg("foo").status(); </del> <ins> let mut cmd = Command::new(env::args_os().next().unwrap()); cmd.arg("foo"); // ARMv6 hanges while printing the backtrace, see #41004 if cfg!(target_arch = "arm") && cfg!(target_env = "gnu") { cmd.env("RUST_BACKTRACE", "0"); } let s = cmd.status(); </ins> assert!(s.unwrap().code() != Some(0)); }


<ins> // This tests the parser recovery in `recover_intersection_pat` // and serves as a regression test for the diagnostics issue #65400. // // The general idea is that for `$pat_lhs @ $pat_rhs` where // `$pat_lhs` is not generated by `ref? mut? $ident` we want // to suggest either switching the order or note that intersection // patterns are not allowed. fn main() { let s: Option<u8> = None; match s { Some(x) @ y => {} //~^ ERROR pattern on wrong side of `@` //~| pattern on the left, should be on the right //~| binding on the right, should be on the left //~| HELP switch the order //~| SUGGESTION y @ Some(x) _ => {} } match s { Some(x) @ Some(y) => {} //~^ ERROR left-hand side of `@` must be a binding //~| interpreted as a pattern, not a binding //~| also a pattern //~| NOTE bindings are `x`, `mut x`, `ref x`, and `ref mut x` _ => {} } match 2 { 1 ..= 5 @ e => {} //~^ ERROR pattern on wrong side of `@` //~| pattern on the left, should be on the right //~| binding on the right, should be on the left //~| HELP switch the order //~| SUGGESTION e @ 1 ..=5 _ => {} } } </ins>


/// [`NonNull::dangling()`]: ptr::NonNull::dangling #[inline] #[stable(feature = "rust1", since = "1.0.0")] <del> pub unsafe fn from_raw_parts_mut<'a, T>(data: *mut T, len: usize) -> &'a mut [T] { debug_assert!(is_aligned_and_not_null(data), "attempt to create unaligned or null slice"); debug_assert!( mem::size_of::<T>().saturating_mul(len) <= isize::MAX as usize, "attempt to create slice covering at least half the address space" ); </del> <ins> #[rustc_const_unstable(feature = "const_slice_from_raw_parts", issue = "67456")] pub const unsafe fn from_raw_parts_mut<'a, T>(data: *mut T, len: usize) -> &'a mut [T] { debug_check_data_len(data as _, len); </ins> // SAFETY: the caller must uphold the safety contract for `from_raw_parts_mut`. unsafe { &mut *ptr::slice_from_raw_parts_mut(data, len) } } <ins> // In debug builds checks that `data` pointer is aligned and non-null and that slice with given `len` would cover less than half the address space #[cfg(all(not(bootstrap), debug_assertions))] #[unstable(feature = "const_slice_from_raw_parts", issue = "67456")] #[rustc_const_unstable(feature = "const_slice_from_raw_parts", issue = "67456")] const fn debug_check_data_len<T>(data: *const T, len: usize) { fn rt_check<T>(data: *const T) { use crate::intrinsics::is_aligned_and_not_null; assert!(is_aligned_and_not_null(data), "attempt to create unaligned or null slice"); } const fn noop<T>(_: *const T) {} // SAFETY: // // `rt_check` is just a debug assert to hint users that they are causing UB, // it is not required for safety (the safety must be guatanteed by // the `from_raw_parts[_mut]` caller). // // Since the checks are not required, we ignore them in CTFE as they can't // be done there (alignment does not make much sense there). unsafe { crate::intrinsics::const_eval_select((data,), noop, rt_check); } assert!( crate::mem::size_of::<T>().saturating_mul(len) <= isize::MAX as usize, "attempt to create slice covering at least half the address space" ); } #[cfg(not(all(not(bootstrap), debug_assertions)))] const fn debug_check_data_len<T>(_data: *const T, _len: usize) {} </ins> /// Converts a reference to T into a slice of length 1 (without copying). #[stable(feature = "from_ref", since = "1.28.0")] #[rustc_const_unstable(feature = "const_slice_from_ref", issue = "90206")]


/// N.B., while `f` is running, the thread-local state /// is `BridgeState::InUse`. fn with<R>(f: impl FnOnce(&mut BridgeState<'_>) -> R) -> R { <del> BRIDGE_STATE.with(|state| { state.replace(BridgeState::InUse, |mut state| { // FIXME(#52812) pass `f` directly to `replace` when `RefMutL` is gone f(&mut *state) }) }) </del> <ins> BRIDGE_STATE.with(|state| state.replace(BridgeState::InUse, f)) </ins> } }


let tcx = self.tcx(); let mut pred = cache_fresh_trait_pred.skip_binder(); <del> param_env = param_env.with_constness(pred.constness.and(param_env.constness())); </del> <ins> pred.remap_constness(tcx, &mut param_env); </ins> if !self.can_cache_candidate(&candidate) { debug!(?pred, ?candidate, "insert_candidate_cache - candidate is not cacheable");


// one: if self.emitted_diagnostics.borrow_mut().insert(diagnostic_hash) { self.emitter.borrow_mut().emit(db); <ins> if db.is_error() { self.bump_err_count(); } </ins> } } }


<del> //@ known-bug: #121574 #![feature(generic_const_exprs)] impl<const Z: usize> X<Z> { pub fn y<'a, U: 'a>(&'a self) -> impl Iterator<Item = impl Iterator<Item = [u8; Z]> + '_> {} } </del>


<ins> #[derive(Clone)] pub struct Struct; pub mod dep_mod1 { pub struct Fields { /// [crate::Struct::clone] pub field: u8, } } pub mod dep_mod2 { pub enum Fields { V { /// [crate::Struct::clone] field: u8, }, } } </ins>


have happily compiled. If we forget in the `match`, it will not. Rust helps us make sure to cover all of our bases. <ins> `match` expressions also allow us to get the values contained in an `enum` (also known as destructuring) as follows: ```{rust} enum OptionalInt { Value(int), Missing, } fn main() { let x = Value(5); let y = Missing; match x { Value(n) => println!("x is {}", n), Missing  => println!("x is missing!"), } match y { Value(n) => println!("y is {}", n), Missing  => println!("y is missing!"), } } ``` That is how you can get and use the values contained in `enum`s. It can also allow us to treat errors or unexpected computations, for example, a function that is not guaranteed to be able to compute a result (an `int` here), could return an `OptionalInt`, and we would handle that value with a `match`. As you can see, `enum` and `match` used together are quite useful! </ins> `match` is also an expression, which means we can use it on the right hand side of a `let` binding or directly where an expression is used. We could also implement the previous line like this:


// Functions cannot both be `const async` or `const gen` if let Some(&FnHeader { <del> constness: Const::Yes(cspan), </del> <ins> constness: Const::Yes(const_span), </ins> coroutine_kind: Some(coroutine_kind), .. }) = fk.header() { <del> let aspan = match coroutine_kind { CoroutineKind::Async { span: aspan, .. } | CoroutineKind::Gen { span: aspan, .. } | CoroutineKind::AsyncGen { span: aspan, .. } => aspan, }; // FIXME(gen_blocks): Report a different error for `const gen` self.dcx().emit_err(errors::ConstAndAsync { spans: vec![cspan, aspan], cspan, aspan, </del> <ins> self.dcx().emit_err(errors::ConstAndCoroutine { spans: vec![coroutine_kind.span(), const_span], const_span, coroutine_span: coroutine_kind.span(), coroutine_kind: coroutine_kind.as_str(), </ins> span, }); }


<ins> // test for https://github.com/rust-lang/rust/issues/86940 // run-rustfix // edition:2018 // check-pass #![warn(rust_2021_prelude_collisions)] #![allow(dead_code)] #![allow(unused_imports)] struct Generic<T, U>(T, U); trait MyFromIter { fn from_iter(_: i32) -> Self; } impl MyFromIter for Generic<i32, i32> { fn from_iter(x: i32) -> Self { Self(x, x) } } impl std::iter::FromIterator<i32> for Generic<i32, i32> { fn from_iter<T: IntoIterator<Item = i32>>(_: T) -> Self { todo!() } } fn main() { Generic::from_iter(1); //~^ WARNING trait-associated function `from_iter` will become ambiguous in Rust 2021 //~| this is accepted in the current edition (Rust 2018) Generic::<i32, i32>::from_iter(1); //~^ WARNING trait-associated function `from_iter` will become ambiguous in Rust 2021 //~| this is accepted in the current edition (Rust 2018) Generic::<_, _>::from_iter(1); //~^ WARNING trait-associated function `from_iter` will become ambiguous in Rust 2021 //~| this is accepted in the current edition (Rust 2018) } </ins>


use rustc_infer::infer; use rustc_infer::traits::{self, StatementAsExpression}; use rustc_middle::lint::in_external_macro; <del> use rustc_middle::ty::{self, Binder, DefIdTree, IsSuggestable, Ty}; </del> <ins> use rustc_middle::ty::{ self, suggest_constraining_type_params, Binder, DefIdTree, IsSuggestable, ToPredicate, Ty, }; </ins> use rustc_session::errors::ExprParenthesesNeeded; use rustc_span::symbol::sym; use rustc_span::Span;


} _ => intravisit::walk_expr(self, expr), }, <del> ExprKind::Path(qpath) => { let res = self.fcx.tables.borrow().qpath_res(qpath, expr.hir_id); if let Res::Def(DefKind::Static, def_id) = res { // Statics are lowered to temporary references or // pointers in MIR, so record that type. let ptr_ty = self.fcx.tcx.static_ptr_ty(def_id); self.record(ptr_ty, scope, Some(expr), expr.span); } } </del> _ => intravisit::walk_expr(self, expr), } self.expr_count += 1; <ins> let scope = self.region_scope_tree.temporary_scope(expr.hir_id.local_id); </ins> // If there are adjustments, then record the final type -- // this is the actual value that is being produced. if let Some(adjusted_ty) = self.fcx.tables.borrow().expr_ty_adjusted_opt(expr) {


<ins> error[E0310]: the parameter type `T` may not live long enough --> $DIR/issue_74400.rs:12:5 | LL |     f(data, identity) |     ^^^^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `T: 'static`... error[E0308]: mismatched types --> $DIR/issue_74400.rs:12:5 | LL |     f(data, identity) |     ^^^^^^^^^^^^^^^^^ one type is more general than the other | = note: expected type `for<'r> Fn<(&'r T,)>` found type `Fn<(&T,)>` error: implementation of `FnOnce` is not general enough --> $DIR/issue_74400.rs:12:5 | LL |     f(data, identity) |     ^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough | = note: `fn(&'2 T) -> &'2 T {identity::<&'2 T>}` must implement `FnOnce<(&'1 T,)>`, for any lifetime `'1`... = note: ...but it actually implements `FnOnce<(&'2 T,)>`, for some specific lifetime `'2` error: aborting due to 3 previous errors Some errors have detailed explanations: E0308, E0310. For more information about an error, try `rustc --explain E0308`. </ins>


return false; }; <del> // FIXME(with_negative_coherence): the infcx has region contraints from equating // the impl headers as requirements. Given that the only region constraints we // get are involving inference regions in the root, it shouldn't matter, but // still sus. // // We probably should just throw away the region obligations registered up until // now, or ideally use them as assumptions when proving the region obligations // that we get from proving the negative predicate below. </del> let ref infcx = root_infcx.fork(); let ocx = ObligationCtxt::new(infcx);


# Only commits merged by bors will have CI artifacts. merge_base = [ "git", "rev-list", "--author=bors@rust-lang.org", "-n1", <del> "--merges", "--first-parent", "HEAD" </del> <ins> "--first-parent", "HEAD" </ins> ] commit = subprocess.check_output(merge_base, universal_newlines=True).strip() <ins> if not commit: print("error: could not find commit hash for downloading rustc") print("help: maybe your repository history is too shallow?") print("help: consider disabling `download-rustc`") print("help: or fetch enough history to include one upstream commit") exit(1) </ins> # Warn if there were changes to the compiler or standard library since the ancestor commit. status = subprocess.call(["git", "diff-index", "--quiet", commit, "--", compiler, library])


<ins> error[E0609]: no field `f` on type `Foo` --> $DIR/non-existent-field-present-in-subfield-recursion-limit.rs:41:22 | LL |     let test = fooer.f; |                      ^ unknown field | = note: available fields are: `first`, `second`, `third` error: aborting due to previous error For more information about this error, try `rustc --explain E0609`. </ins>


<ins> // build-fail fn main() { let xs: [i32; 5] = [1, 2, 3, 4, 5]; let _ = &xs; let _ = xs[7]; //~ ERROR: this operation will panic at runtime [unconditional_panic] } </ins>


impl Mumbo for usize { // Cannot have a larger effect than the trait: unsafe fn jumbo(&self, x: &usize) { *self + *x; } <del> //~^ ERROR expected normal fn, found unsafe fn </del> <ins> //~^ ERROR method `jumbo` has an incompatible type for trait //~| expected normal fn, //~| found unsafe fn </ins> } fn main() {}


/// This function does not perform any I/O, it simply informs this object /// that some amount of its buffer, returned from `fill_buf`, has been /// consumed and should no longer be returned. <ins> /// /// This function is used to tell the buffer how many bytes you've consumed /// from the return value of `fill_buf`, and so may do odd things if /// `fill_buf` isn't called before calling this. /// /// The `amt` must be `<=` the number of bytes in the buffer returned by `fill_buf`. </ins> #[stable(feature = "rust1", since = "1.0.0")] fn consume(&mut self, amt: usize);


//      } fn mk_decls( cx: &mut ExtCtxt<'_>, <del> custom_derives: &[ProcMacroDerive], custom_attrs: &[ProcMacroDef], custom_macros: &[ProcMacroDef], </del> <ins> macros: &[ProcMacro], </ins> ) -> P<ast::Item> { let expn_id = cx.resolver.expansion_for_ast_pass( DUMMY_SP,


generic_ty: Ty<'tcx>, min: ty::Region<'tcx>, ) -> bool { <ins> if let ty::ReError(_) = *min { return true; } </ins> match bound { VerifyBound::IfEq(verify_if_eq_b) => { let verify_if_eq_b = var_values.normalize(self.region_rels.tcx, *verify_if_eq_b);


<ins> error: lifetime may not live long enough --> $DIR/suggest-using-tick-underscore-lifetime-in-return-trait-object.rs:5:5 | LL | fn foo<T: Any>(value: &T) -> Box<dyn Any> { |                       - let's call the lifetime of this reference `'1` LL |     Box::new(value) as Box<dyn Any> |     ^^^^^^^^^^^^^^^ cast requires that `'1` must outlive `'static` | help: to declare that the trait object captures data from argument `value`, you can add an explicit `'_` lifetime bound | LL | fn foo<T: Any>(value: &T) -> Box<dyn Any + '_> { |                                          ++++ error: aborting due to previous error </ins>


// Equate the headers to find their intersection (the general type, with infer vars, // that may apply both impls). <del> let Some(_equate_obligations) = </del> <ins> let Some(equate_obligations) = </ins> equate_impl_headers(infcx, param_env, &impl1_header, &impl2_header) else { return false;


lazy_state: LazyState::NoNode, type_shorthands: Default::default(), predicate_shorthands: Default::default(), <del> } .encode_crate_root(); </del> <ins> }; // Encode the rustc version string in a predictable location. rustc_version().encode(&mut ecx).unwrap(); // Encode all the entries and extra information in the crate, // culminating in the `CrateRoot` which points to all of it. ecx.encode_crate_root() }; </ins> let mut result = cursor.into_inner(); // Encode the root position.


/// /// assert_eq!("GRüßE, JüRGEN ❤", s); /// ``` <del> #[unstable(feature = "osstring_ascii", issue = "70516")] </del> <ins> #[stable(feature = "osstring_ascii", since = "1.53.0")] </ins> #[inline] pub fn make_ascii_uppercase(&mut self) { self.inner.make_ascii_uppercase()


<ins> # `wasm32-unknown-unknown` **Tier: 2** The `wasm32-unknown-unknown` target is a WebAssembly compilation target which does not import any functions from the host for the standard library. This is the "minimal" WebAssembly in the sense of making the fewest assumptions about the host environment. This target is often used when compiling to the web or JavaScript environments as there is no standard for what functions can be imported on the web. This target can also be useful for creating minimal or bare-bones WebAssembly binaries. The `wasm32-unknown-unknown` target has support for the Rust standard library but many parts of the standard library do not work and return errors. For example `println!` does nothing, `std::fs` always return errors, and `std::thread::spawn` will panic. There is no means by which this can be overridden. For a WebAssembly target that more fully supports the standard library see the [`wasm32-wasip1`](./wasm32-wasip1.md) or [`wasm32-wasip2`](./wasm32-wasip2.md) targets. The `wasm32-unknown-unknown` target has full support for the `core` and `alloc` crates. It additionally supports the `HashMap` type in the `std` crate, although hash maps are not randomized like they are on other platforms. One existing user of this target (please feel free to edit and expand this list too) is the [`wasm-bindgen` project](https://github.com/rustwasm/wasm-bindgen) which facilitates Rust code interoperating with JavaScript code. Note, though, that not all uses of `wasm32-unknown-unknown` are using JavaScript and the web. ## Target maintainers When this target was added to the compiler platform-specific documentation here was not maintained at that time. This means that the list below is not exhaustive and there are more interested parties in this target. That being said since when this document was last updated those interested in maintaining this target are: - Alex Crichton, https://github.com/alexcrichton ## Requirements This target is cross-compiled. The target includes support for `std` itself, but as mentioned above many pieces of functionality that require an operating system do not work and will return errors. This target currently has no equivalent in C/C++. There is no C/C++ toolchain for this target. While interop is theoretically possible it's recommended to instead use one of: * `wasm32-unknown-emscripten` - for web-based use cases the Emscripten toolchain is typically chosen for running C/C++. * [`wasm32-wasip1`](./wasm32-wasip1.md) - the wasi-sdk toolchain is used to compile C/C++ on this target and can interop with Rust code. WASI works on the web so far as there's no blocker, but an implementation of WASI APIs must be either chosen or reimplemented. This target has no build requirements beyond what's in-tree in the Rust repository. Linking binaries requires LLD to be enabled for the `wasm-ld` driver. This target uses the `dlmalloc` crate as the default global allocator. ## Building the target Building this target can be done by: * Configure the `wasm32-unknown-unknown` target to get built. * Configure LLD to be built. * Ensure the `WebAssembly` target backend is not disabled in LLVM. These are all controlled through `config.toml` options. It should be possible to build this target on any platform. ## Building Rust programs Rust programs can be compiled by adding this target via rustup: ```sh $ rustup target add wasm32-unknown-unknown ``` and then compiling with the target: ```sh $ rustc foo.rs --target wasm32-unknown-unknown $ file foo.wasm ``` ## Cross-compilation This target can be cross-compiled from any host. ## Testing This target is not tested in CI for the rust-lang/rust repository. Many tests must be disabled to run on this target and failures are non-obvious because `println!` doesn't work in the standard library. It's recommended to test the `wasm32-wasip1` target instead for WebAssembly compatibility. ## Conditionally compiling code It's recommended to conditionally compile code for this target with: ```text #[cfg(all(target_family = "wasm", target_os = "unknown"))] ``` Note that there is no way to tell via `#[cfg]` whether code will be running on the web or not. ## Enabled WebAssembly features WebAssembly is an evolving standard which adds new features such as new instructions over time. This target's default set of supported WebAssembly features will additionally change over time. The `wasm32-unknown-unknown` target inherits the default settings of LLVM which typically matches the default settings of Emscripten as well. Changes to WebAssembly go through a [proposals process][proposals] but reaching the final stage (stage 5) does not automatically mean that the feature will be enabled in LLVM and Rust by default. At this time the general guidance is that features must be present in most engines for a "good chunk of time" before they're enabled in LLVM by default. There is currently no exact number of months or engines that are required to enable features by default. [proposals]: https://github.com/WebAssembly/proposals As of the time of this writing the proposals that are enabled by default (the `generic` CPU in LLVM terminology) are: * `multivalue` * `mutable-globals` * `reference-types` * `sign-ext` If you're compiling WebAssembly code for an engine that does not support a feature in LLVM's default feature set then the feature must be disabled at compile time. Note, though, that enabled features may be used in the standard library or precompiled libraries shipped via rustup. This means that not only does your own code need to be compiled with the correct set of flags but the Rust standard library additionally must be recompiled. Compiling all code for the initial release of WebAssembly looks like: ```sh $ export RUSTFLAGS=-Ctarget-cpu=mvp $ cargo +nightly build -Zbuild-std=panic_abort,std --target wasm32-unknown-unknown ``` Here the `mvp` "cpu" is a placeholder in LLVM for disabling all supported features by default. Cargo's `-Zbuild-std` feature, a Nightly Rust feature, is then used to recompile the standard library in addition to your own code. This will produce a binary that uses only the original WebAssembly features by default and no proposals since its inception. To enable individual features it can be done with `-Ctarget-feature=+foo`. Available features for Rust code itself are documented in the [reference] and can also be found through: ```sh $ rustc -Ctarget-feature=help --target wasm32-unknown-unknown ``` You'll need to consult your WebAssembly engine's documentation to learn more about the supported WebAssembly features the engine has. [reference]: https://doc.rust-lang.org/reference/attributes/codegen.html#wasm32-or-wasm64 Note that it is still possible for Rust crates and libraries to enable WebAssembly features on a per-function level. This means that the build command above may not be sufficient to disable all WebAssembly features. If the final binary still has SIMD instructions, for example, the function in question will need to be found and the crate in question will likely contain something like: ```rust,ignore (not-always-compiled-to-wasm) #[target_feature(enable = "simd128")] fn foo() { // ... } ``` In this situation there is no compiler flag to disable emission of SIMD instructions and the crate must instead be modified to not include this function at compile time either by default or through a Cargo feature. For crate authors it's recommended to avoid `#[target_feature(enable = "...")]` except where necessary and instead use: ```rust,ignore (not-always-compiled-to-wasm) #[cfg(target_feature = "simd128")] fn foo() { // ... } ``` That is to say instead of enabling target features it's recommended to conditionally compile code instead. This is notably different to the way native platforms such as x86_64 work, and this is due to the fact that WebAssembly binaries must only contain code the engine understands. Native binaries work so long as the CPU doesn't execute unknown code dynamically at runtime. </ins>


ascription: thir::Ascription { variance, user_ty, user_ty_span }, } => { // Apply the type ascription to the value at `match_pair.place`, which is the <del> candidate.ascriptions.push(Ascription { span: user_ty_span, user_ty, source: match_pair.place.clone().into_place(self.tcx, self.typeck_results), variance, }); </del> <ins> if let Ok(place_resolved) = match_pair.place.clone().try_upvars_resolved(self.tcx, self.typeck_results) { candidate.ascriptions.push(Ascription { span: user_ty_span, user_ty, source: place_resolved.into_place(self.tcx, self.typeck_results), variance, }); } </ins> candidate.match_pairs.push(MatchPair::new(match_pair.place, subpattern));


/// assert_eq!(*guard, 1); /// ``` #[inline] <del> #[unstable(feature = "mutex_unpoison", issue = "96469")] </del> <ins> #[stable(feature = "mutex_unpoison", since = "CURRENT_RUSTC_VERSION")] </ins> pub fn clear_poison(&self) { self.poison.clear(); }


}; append_arg(&mut cmd, arg, quote)?; } <ins> if is_batch_file { cmd.push(b'"' as u16); } </ins> return Ok(cmd); fn append_arg(cmd: &mut Vec<u16>, arg: &OsStr, quote: Quote) -> io::Result<()> {


<ins> // check-pass #![feature(type_alias_impl_trait)] pub trait Trait { type A; fn f() -> Self::A; } pub trait Tr2<'a, 'b> {} pub struct A<T>(T); pub trait Tr { type B; } impl<'a, 'b, T: Tr<B = dyn Tr2<'a, 'b>>> Trait for A<T> { type A = impl core::fmt::Debug; fn f() -> Self::A {} } fn main() {} </ins>


name: Symbol, ) -> Result<Self, &'static str> { // FIXME: use direct symbol comparison for register names <del> name.with(|name| { Ok(match arch { InlineAsmArch::X86 | InlineAsmArch::X86_64 => { Self::X86(X86InlineAsmReg::parse(arch, has_feature, name)?) } InlineAsmArch::Arm => Self::Arm(ArmInlineAsmReg::parse(arch, has_feature, name)?), InlineAsmArch::AArch64 => { Self::AArch64(AArch64InlineAsmReg::parse(arch, has_feature, name)?) } InlineAsmArch::RiscV32 | InlineAsmArch::RiscV64 => { Self::RiscV(RiscVInlineAsmReg::parse(arch, has_feature, name)?) } }) </del> <ins> // Use `Symbol::as_str` instead of `Symbol::with` here because `has_feature` may access `Symbol`. let name = name.as_str(); Ok(match arch { InlineAsmArch::X86 | InlineAsmArch::X86_64 => { Self::X86(X86InlineAsmReg::parse(arch, has_feature, &name)?) } InlineAsmArch::Arm => Self::Arm(ArmInlineAsmReg::parse(arch, has_feature, &name)?), InlineAsmArch::AArch64 => { Self::AArch64(AArch64InlineAsmReg::parse(arch, has_feature, &name)?) } InlineAsmArch::RiscV32 | InlineAsmArch::RiscV64 => { Self::RiscV(RiscVInlineAsmReg::parse(arch, has_feature, &name)?) } </ins> }) }


} } <ins> // FIXME: This has the same issue as #108544, but since this isn't breaking // existing code, I'm not particularly inclined to do the same hack as above // where we process wf obligations manually. This can be fixed in a forward- // compatible way later. let collected_types = collector.types; for (_, &(ty, _)) in &collected_types { ocx.register_obligation(traits::Obligation::new( tcx, misc_cause.clone(), param_env, ty::ClauseKind::WellFormed(ty.into()), )); } </ins> // Check that all obligations are satisfied by the implementation's // RPITs. let errors = ocx.select_all_or_error();


self.suggest_derive(err, &preds); } <del> fn suggest_derive( </del> <ins> pub fn suggest_derive( </ins> &self, err: &mut Diagnostic, unsatisfied_predicates: &[(


/// let src = [1, 2, 3, 4]; /// let mut dst = [0, 0]; /// <ins> /// // Because the slices have to be the same length, /// // we slice the source slice from four elements /// // to two. It will panic if we don't do this. </ins> /// dst.copy_from_slice(&src[2..]); /// /// assert_eq!(src, [1, 2, 3, 4]);


fn main() { let x = match { 5 } { 1 => 5, 2 => 6, _ => 7, }; <del> assert_eq!(x , 7); </del> <ins> assert_eq!(x, 7); </ins> }


} self.print_ident(ident); if let Some(ref p) = *sub { <del> self.s.word("@"); </del> <ins> self.s.space(); self.s.word_space("@"); </ins> self.print_pat(p); } }


| LL |         FarmAnimal::Chicken(_) => "cluck, cluck!".to_string(), |         ^^^^^^^^^^^^^^^^^^^^^^ not a tuple struct or tuple variant <ins> | help: the struct variant's field is being ignored | LL |         FarmAnimal::Chicken { num_eggs: _ } => "cluck, cluck!".to_string(), |                             ~~~~~~~~~~~~~~~ </ins> error: aborting due to 2 previous errors


/// /// assert_eq!("grÜße, jÜrgen ❤", s); /// ``` <del> #[unstable(feature = "osstring_ascii", issue = "70516")] </del> <ins> #[stable(feature = "osstring_ascii", since = "1.53.0")] </ins> #[inline] pub fn make_ascii_lowercase(&mut self) { self.inner.make_ascii_lowercase()


<ins> //@ compile-flags: -Zthreads=16 // original issue: https://github.com/rust-lang/rust/issues/129112 // Previously, the "next" solver asserted that each successful solution is only obtained once. // This test exhibits a repro that, with next-solver + -Zthreads, triggered that old assert. // In the presence of multithreaded solving, it's possible to concurrently evaluate things twice, // which leads to replacing already-solved solutions in the global solution cache! // We assume this is fine if we check to make sure they are solved the same way each time. // This test only nondeterministically fails but that's okay, as it will be rerun by CI many times, // so it should almost always fail before anything is merged. As other thread tests already exist, // we already face this difficulty, probably. If we need to fix this by reducing the error margin, // we should improve compiletest. #[derive(Clone, Eq)] //~ ERROR [E0277] pub struct Struct<T>(T); impl<T: Clone, U> PartialEq<U> for Struct<T> where U: Into<Struct<T>> + Clone { fn eq(&self, _other: &U) -> bool { todo!() } } fn main() {} </ins>


} } <ins> // for dbg!(x) which may take ownership, suggest dbg!(&x) instead // but here we actually do not check whether the macro name is `dbg!` // so that we may extend the scope a bit larger to cover more cases fn suggest_ref_for_dbg_args( &self, body: &hir::Expr<'_>, place: &Place<'tcx>, move_span: Span, err: &mut Diag<'infcx>, ) { let var_info = self.body.var_debug_info.iter().find(|info| match info.value { VarDebugInfoContents::Place(ref p) => p == place, _ => false, }); let arg_name = if let Some(var_info) = var_info { var_info.name } else { return; }; struct MatchArgFinder { expr_span: Span, match_arg_span: Option<Span>, arg_name: Symbol, } impl Visitor<'_> for MatchArgFinder { fn visit_expr(&mut self, e: &hir::Expr<'_>) { // dbg! is expanded into a match pattern, we need to find the right argument span if let hir::ExprKind::Match(expr, ..) = &e.kind && let hir::ExprKind::Path(hir::QPath::Resolved( _, path @ Path { segments: [seg], .. }, )) = &expr.kind && seg.ident.name == self.arg_name && self.expr_span.source_callsite().contains(expr.span) { self.match_arg_span = Some(path.span); } hir::intravisit::walk_expr(self, e); } } let mut finder = MatchArgFinder { expr_span: move_span, match_arg_span: None, arg_name }; finder.visit_expr(body); if let Some(macro_arg_span) = finder.match_arg_span { err.span_suggestion_verbose( macro_arg_span.shrink_to_lo(), "consider borrowing instead of transferring ownership", "&", Applicability::MachineApplicable, ); } } </ins> fn report_use_of_uninitialized( &self, mpi: MovePathIndex,


/// /// assert_eq!(&v, &[0, 1, 2]); /// ``` <del> #[unstable(feature = "vec_spare_capacity", issue = "75017")] </del> <ins> #[stable(feature = "vec_spare_capacity", since = "1.60.0")] </ins> #[inline] pub fn spare_capacity_mut(&mut self) -> &mut [MaybeUninit<T>] { // Note:


[`thumbv8m.main-none-eabi`](platform-support/thumbv8m.main-none-eabi.md) | * | Bare Armv8-M Mainline [`thumbv8m.main-none-eabihf`](platform-support/thumbv8m.main-none-eabi.md) | * | Bare Armv8-M Mainline, hardfloat `wasm32-unknown-emscripten` | ✓ | WebAssembly via Emscripten <del> `wasm32-unknown-unknown` | ✓ | WebAssembly </del> <ins> [`wasm32-unknown-unknown`](platform-support/wasm32-unknown-unknown.md) | ✓ | WebAssembly </ins> `wasm32-wasi` | ✓ | WebAssembly with WASI (undergoing a [rename to `wasm32-wasip1`][wasi-rename]) [`wasm32-wasip1`](platform-support/wasm32-wasip1.md) | ✓ | WebAssembly with WASI [`wasm32-wasip1-threads`](platform-support/wasm32-wasip1-threads.md) | ✓ | WebAssembly with WASI Preview 1 and threads


use test::{Bencher, black_box}; use super::BTreeMap; <del> use bench::{insert_rand_n, insert_seq_n, find_rand_n, find_seq_n}; #[bench] pub fn insert_rand_100(b: &mut Bencher) { let mut m = BTreeMap::new(); insert_rand_n(100, &mut m, b, |m, i| { m.insert(i, 1); }, |m, i| { m.remove(&i); }); } #[bench] pub fn insert_rand_10_000(b: &mut Bencher) { let mut m = BTreeMap::new(); insert_rand_n(10_000, &mut m, b, |m, i| { m.insert(i, 1); }, |m, i| { m.remove(&i); }); } // Insert seq #[bench] pub fn insert_seq_100(b: &mut Bencher) { let mut m = BTreeMap::new(); insert_seq_n(100, &mut m, b, |m, i| { m.insert(i, 1); }, |m, i| { m.remove(&i); }); } #[bench] pub fn insert_seq_10_000(b: &mut Bencher) { let mut m = BTreeMap::new(); insert_seq_n(10_000, &mut m, b, |m, i| { m.insert(i, 1); }, |m, i| { m.remove(&i); }); } </del> <ins> map_insert_rand_bench!{insert_rand_100,    100,    BTreeMap} map_insert_rand_bench!{insert_rand_10_000, 10_000, BTreeMap} </ins> <del> // Find rand #[bench] pub fn find_rand_100(b: &mut Bencher) { let mut m = BTreeMap::new(); find_rand_n(100, &mut m, b, |m, i| { m.insert(i, 1); }, |m, i| { m.get(&i); }); } #[bench] pub fn find_rand_10_000(b: &mut Bencher) { let mut m = BTreeMap::new(); find_rand_n(10_000, &mut m, b, |m, i| { m.insert(i, 1); }, |m, i| { m.get(&i); }); } </del> <ins> map_insert_seq_bench!{insert_seq_100,    100,    BTreeMap} map_insert_seq_bench!{insert_seq_10_000, 10_000, BTreeMap} </ins> <del> // Find seq #[bench] pub fn find_seq_100(b: &mut Bencher) { let mut m = BTreeMap::new(); find_seq_n(100, &mut m, b, |m, i| { m.insert(i, 1); }, |m, i| { m.get(&i); }); } </del> <ins> map_find_rand_bench!{find_rand_100,    100,    BTreeMap} map_find_rand_bench!{find_rand_10_000, 10_000, BTreeMap} </ins> <del> #[bench] pub fn find_seq_10_000(b: &mut Bencher) { let mut m = BTreeMap::new(); find_seq_n(10_000, &mut m, b, |m, i| { m.insert(i, 1); }, |m, i| { m.get(&i); }); } </del> <ins> map_find_seq_bench!{find_seq_100,    100,    BTreeMap} map_find_seq_bench!{find_seq_10_000, 10_000, BTreeMap} </ins> fn bench_iter(b: &mut Bencher, size: i32) { let mut map = BTreeMap::<i32, i32>::new();


<ins> // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // Ensure assigning an owned or managed variable to itself works. In particular, // that we do not glue_drop before we glue_take (#3290). use std::rc::Rc; pub fn main() { let mut x = ~3; x = x; assert!(*x == 3); let mut x = Rc::new(3); x = x; assert!(*x.borrow() == 3); } </ins>


/// } /// ``` #[stable(feature = "rust1", since = "1.0.0")] <del> #[rustc_deprecated(since = "1.41.0", reason = "use the Display impl or to_string()")] </del> <ins> #[rustc_deprecated(since = "1.42.0", reason = "use the Display impl or to_string()")] </ins> fn description(&self) -> &str { "description() is deprecated; use Display" }


} } <del> #[derive(Clone, PartialEq, Encodable, Decodable)] </del> <ins> #[derive(Copy, Clone, PartialEq, Encodable, Decodable)] </ins> pub enum InlineAttr { None, Hint,


fn vtable_impl( &mut self, impl_def_id: DefId, <del> mut substs: Normalized<'tcx, SubstsRef<'tcx>>, </del> <ins> substs: Normalized<'tcx, SubstsRef<'tcx>>, </ins> cause: ObligationCause<'tcx>, recursion_depth: usize, param_env: ty::ParamEnv<'tcx>,


// `allow(warnings)` in scope then we want to respect that instead. if level == Level::Warn { let (warnings_level, warnings_src) = <del> self.get_lint_id_level(LintId::of(lint::builtin::WARNINGS), idx); </del> <ins> self.get_lint_id_level(LintId::of(lint::builtin::WARNINGS), idx, aux); </ins> if let Some(configured_warning_level) = warnings_level { if configured_warning_level != Level::Warn { level = configured_warning_level;


println!("running {}", test_file_name); let nodejs = build.config.nodejs.as_ref().expect("nodejs not configured"); let mut cmd = Command::new(nodejs); <del> cmd.arg(&test_file_name) .stderr(::std::process::Stdio::inherit()); </del> <ins> cmd.arg(&test_file_name); </ins> if build.config.quiet_tests { cmd.arg("--quiet"); }


/// /// Note that the argument is not passed through a shell, but given /// literally to the program. This means that shell syntax like quotes, <del> /// escaped characters, word splitting, glob patterns, substitution, etc. </del> <ins> /// escaped characters, word splitting, glob patterns, variable substitution, etc. </ins> /// have no effect. /// /// # Examples


/// # Examples /// /// ``` <del> /// #![feature(arc_unwrap_or_clone)] </del> /// # use std::{ptr, sync::Arc}; /// let inner = String::from("test"); /// let ptr = inner.as_ptr();


--codeblock-error-color: rgba(255, 0, 0, .5); --codeblock-ignore-hover-color: rgb(255, 142, 0); --codeblock-ignore-color: rgba(255, 142, 0, .6); <ins> --warning-border-color: rgb(255, 142, 0); </ins> --type-link-color: #ffa0a5; --trait-link-color: #39afd7; --assoc-item-link-color: #39afd7;


<ins> // Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. #![feature(box_syntax)] struct Node<T: ?Sized>(T); fn main() { let x: Box<Node<[isize]>> = box Node([]); } </ins>


/// Whether the original and suggested code are visually similar enough to warrant extra wording. pub fn is_case_difference(sm: &SourceMap, suggested: &str, sp: Span) -> bool { // FIXME: this should probably be extended to also account for `FO0` → `FOO` and unicode. <del> let found = sm.span_to_snippet(sp).unwrap(); </del> <ins> let found = match sm.span_to_snippet(sp) { Ok(snippet) => snippet, Err(e) => { warn!("Invalid span {:?}. Err={:?}", sp, e); return false; } }; </ins> let ascii_confusables = &['c', 'f', 'i', 'k', 'o', 's', 'u', 'v', 'w', 'x', 'y', 'z']; // All the chars that differ in capitalization are confusable (above): let confusable = found


<ins> error[E0262]: invalid lifetime parameter name: `'static` --> $DIR/generic_const_early_param.rs:4:20 | LL | struct DataWrapper<'static> { |                    ^^^^^^^ 'static is a reserved lifetime name error[E0261]: use of undeclared lifetime name `'a` --> $DIR/generic_const_early_param.rs:6:12 | LL | struct DataWrapper<'static> { |                    - help: consider introducing lifetime `'a` here: `'a,` LL | LL |     data: &'a [u8; Self::SIZE], |            ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/generic_const_early_param.rs:11:18 | LL | impl DataWrapper<'a> { |     -            ^^ undeclared lifetime |     | |     help: consider introducing lifetime `'a` here: `<'a>` warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/generic_const_early_param.rs:1:12 | LL | #![feature(generic_const_exprs)] |            ^^^^^^^^^^^^^^^^^^^ | = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information = note: `#[warn(incomplete_features)]` on by default error: lifetime may not live long enough --> $DIR/generic_const_early_param.rs:6:20 | LL |     data: &'a [u8; Self::SIZE], |                    ^^^^^^^^^^ requires that `'_` must outlive `'static` error: aborting due to 4 previous errors; 1 warning emitted Some errors have detailed explanations: E0261, E0262. For more information about an error, try `rustc --explain E0261`. </ins>


<ins> error: expected item, found `;` --> $DIR/fn-no-semicolon-issue-124935-semi-after-item.rs:5:1 | LL | ; | ^ help: remove this semicolon error: aborting due to 1 previous error </ins>


return Some(p); } if let Some(e) = self.expr { <del> if let ast::ExprKind::Lit(_) = e.kind { </del> <ins> if matches!(e.kind, ast::ExprKind::Lit(_) | ast::ExprKind::IncludedBytes(_)) { </ins> return Some(P(ast::Pat { id: ast::DUMMY_NODE_ID, span: e.span,


COPY build-emscripten.sh /tmp/ RUN ./build-emscripten.sh ENV PATH=$PATH:/tmp/emsdk_portable <del> ENV PATH=$PATH:/tmp/emsdk_portable/clang/tag-e1.37.1/build_tag-e1.37.1_32/bin </del> <ins> ENV PATH=$PATH:/tmp/emsdk_portable/clang/tag-e1.37.10/build_tag-e1.37.10_32/bin </ins> ENV PATH=$PATH:/tmp/emsdk_portable/node/4.1.1_32bit/bin <del> ENV PATH=$PATH:/tmp/emsdk_portable/emscripten/tag-1.37.1 ENV EMSCRIPTEN=/tmp/emsdk_portable/emscripten/tag-1.37.1 </del> <ins> ENV PATH=$PATH:/tmp/emsdk_portable/emscripten/tag-1.37.10 ENV EMSCRIPTEN=/tmp/emsdk_portable/emscripten/tag-1.37.10 </ins> ENV RUST_CONFIGURE_ARGS --target=asmjs-unknown-emscripten


rm -rf /tmp/rustc-pgo <del> python3 ../x.py build --target=$PGO_HOST --host=$PGO_HOST  </del> <ins> python2.7 ../x.py build --target=$PGO_HOST --host=$PGO_HOST  </ins> --stage 2 library/std --rust-profile-generate=/tmp/rustc-pgo ./build/$PGO_HOST/stage2/bin/rustc --edition=2018


{ unreachable!("Always specialized"); } <ins> #[inline] default fn fold<Acc, F>(self, init: Acc, f: F) -> Acc where F: FnMut(Acc, Self::Item) -> Acc, { SpecFold::spec_fold(self, init, f) } </ins> } #[doc(hidden)]


let main = P(ast::Item { ident: main_id, <del> attrs: thin_vec![main_attr], </del> <ins> attrs: thin_vec![main_attr, no_coverage_attr], </ins> id: ast::DUMMY_NODE_ID, kind: main, vis: ast::Visibility { span: sp, kind: ast::VisibilityKind::Public, tokens: None },


base.cpu = "x86-64".to_string(); base.max_atomic_width = Some(64); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-mx32".to_string()); <del> // BUG: temporarily workaround #59674 base.stack_probes = false; </del> <ins> base.stack_probes = true; </ins> base.has_elf_tls = false; // BUG(GabrielMajeri): disabling the PLT on x86_64 Linux with x32 ABI // breaks code gen. See LLVM bug 36743


is_unwindsafe(async { //~^ ERROR the type `&mut Context<'_>` may not be safely transferred across an unwind boundary <del> //~| ERROR the type `&mut (dyn Any + 'static)` may not be safely transferred across an unwind boundary </del> use std::ptr::null; use std::task::{Context, RawWaker, RawWakerVTable, Waker}; let waker = unsafe {


} SaveIn(lldest) => { match ty::eval_repeat_count(bcx.tcx(), &**count_expr) { <del> 0 => bcx, </del> <ins> 0 => expr::trans_into(bcx, &**element, Ignore), </ins> 1 => expr::trans_into(bcx, &**element, SaveIn(lldest)), count => { let elem = unpack_datum!(bcx, expr::trans(bcx, &**element));


/// When `is_collectin_in_band_lifetimes` is true, each lifetime is checked /// against this list to see if it is already in-scope, or if a definition /// needs to be created for it. <del> in_scope_lifetimes: Vec<Ident>, </del> <ins> /// /// We always store a `modern()` version of the param-name in this /// vector. in_scope_lifetimes: Vec<ParamName>, </ins> current_module: NodeId,


// However, since this is a variadic function, C integer promotion rules mean that on // the ABI level, this still gets passed as `c_int` (aka `u32` on Unix platforms). let fd = cvt_r(|| unsafe { open64(path.as_ptr(), flags, opts.mode as c_int) })?; <del> let fd = FileDesc::new(fd); // Currently the standard library supports Linux 2.6.18 which did not // have the O_CLOEXEC flag (passed above). If we're running on an older // Linux kernel then the flag is just ignored by the OS. After we open // the first file, we check whether it has CLOEXEC set. If it doesn't, // we will explicitly ask for a CLOEXEC fd for every further file we // open, if it does, we will skip that step. // // The CLOEXEC flag, however, is supported on versions of macOS/BSD/etc // that we support, so we only do this on Linux currently. #[cfg(target_os = "linux")] fn ensure_cloexec(fd: &FileDesc) -> io::Result<()> { use crate::sync::atomic::{AtomicUsize, Ordering}; const OPEN_CLOEXEC_UNKNOWN: usize = 0; const OPEN_CLOEXEC_SUPPORTED: usize = 1; const OPEN_CLOEXEC_NOTSUPPORTED: usize = 2; static OPEN_CLOEXEC: AtomicUsize = AtomicUsize::new(OPEN_CLOEXEC_UNKNOWN); let need_to_set; match OPEN_CLOEXEC.load(Ordering::Relaxed) { OPEN_CLOEXEC_UNKNOWN => { need_to_set = !fd.get_cloexec()?; OPEN_CLOEXEC.store( if need_to_set { OPEN_CLOEXEC_NOTSUPPORTED } else { OPEN_CLOEXEC_SUPPORTED }, Ordering::Relaxed, ); } OPEN_CLOEXEC_SUPPORTED => need_to_set = false, OPEN_CLOEXEC_NOTSUPPORTED => need_to_set = true, _ => unreachable!(), } if need_to_set { fd.set_cloexec()?; } Ok(()) } #[cfg(not(target_os = "linux"))] fn ensure_cloexec(_: &FileDesc) -> io::Result<()> { Ok(()) } ensure_cloexec(&fd)?; Ok(File(fd)) </del> <ins> Ok(File(FileDesc::new(fd))) </ins> } pub fn file_attr(&self) -> io::Result<FileAttr> {


<ins> error: constant evaluation is taking a long time --> $DIR/do-not-ice-on-field-access-of-err-type.rs:5:24 | LL |     let array = [(); { loop {} }]; |                        ^^^^^^^ | = note: this lint makes sure the compiler doesn't get stuck due to infinite loops in const eval. If your compilation actually takes a long time, you can safely allow the lint. help: the constant being evaluated --> $DIR/do-not-ice-on-field-access-of-err-type.rs:5:22 | LL |     let array = [(); { loop {} }]; |                      ^^^^^^^^^^^ = note: `#[deny(long_running_const_eval)]` on by default error: aborting due to 1 previous error </ins>


if self.not_enough_args_provided() { self.suggest_adding_args(err); } else if self.too_many_args_provided() { <ins> self.suggest_moving_args_from_assoc_fn_to_trait(err); </ins> self.suggest_removing_args_or_generics(err); } else { unreachable!();


Some(Node::Item(it)) => item_scope_tag(&it), Some(Node::TraitItem(it)) => trait_item_scope_tag(&it), Some(Node::ImplItem(it)) => impl_item_scope_tag(&it), <ins> Some(Node::ForeignItem(it)) => foreign_item_scope_tag(&it), </ins> _ => unreachable!(), }; let (prefix, span) = match *region {


] [[package]] <ins> name = "compiletest_rs" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f737835bfbbe29ed1ff82d5137520338d7ed5bf1a1d4b9c1c7c58bb45b8fa29" dependencies = [ "diff", "filetime", "getopts", "libc", "log", "miow 0.3.3", "regex", "rustfix 0.5.0", "serde", "serde_derive", "serde_json", "tempfile", "tester", "winapi 0.3.8", ] [[package]] </ins> name = "constant_time_eq" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index"


<ins> error[E0382]: use of moved value: `x` --> $DIR/missing-clone-for-suggestion.rs:17:7 | LL | fn f(x: *mut u8) { |      - move occurs because `x` has type `*mut u8`, which does not implement the `Copy` trait LL |     g(x); |       - value moved here LL |     g(x); |       ^ value used here after move | note: consider changing this parameter type in function `g` to borrow instead if owning the value isn't necessary --> $DIR/missing-clone-for-suggestion.rs:13:12 | LL | fn g<T>(x: T) {} |    -       ^ this parameter takes ownership of the value |    | |    in this function error: aborting due to previous error For more information about this error, try `rustc --explain E0382`. </ins>


// to them. We run some optimizations before that, because they may be harder to do on the state // machine than on MIR with async primitives. let optimizations_with_generators: &[&dyn MirPass<'tcx>] = &[ <ins> &reveal_all::RevealAll, // has to be done before inlining, since inlined code is in RevealAll mode. </ins> &lower_slice_len::LowerSliceLenCalls, // has to be done before inlining, otherwise actual call will be almost always inlined. Also simple, so can just do first &normalize_array_len::NormalizeArrayLen, // has to run after `slice::len` lowering &unreachable_prop::UnreachablePropagation,


<ins> #[derive(Clone)] pub struct Struct<A>(A); impl<A> Struct<A> { pub fn new() -> Self { todo!() } } </ins>


arg.cast_to(Reg { kind: RegKind::Integer, size }); } }; <del> fixup(&mut self.ret); </del> <ins> fixup(&mut self.ret, true); </ins> for arg in &mut self.args { <del> fixup(arg); </del> <ins> fixup(arg, false); </ins> } if let PassMode::Indirect(ref mut attrs, _) = self.ret.mode { attrs.set(ArgAttribute::StructRet);


<ins> error[E0283]: type annotations needed: cannot satisfy `&(): Marker` --> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:6:6 | LL | impl Marker for &'_ () {} |      ^^^^^^ | note: multiple `impl`s satisfying `&(): Marker` found --> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:6:1 | LL | impl Marker for &'_ () {} | ^^^^^^^^^^^^^^^^^^^^^^ LL | impl Marker for &'_ () {} | ^^^^^^^^^^^^^^^^^^^^^^ error[E0283]: type annotations needed: cannot satisfy `&(): Marker` --> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:7:6 | LL | impl Marker for &'_ () {} |      ^^^^^^ | note: multiple `impl`s satisfying `&(): Marker` found --> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:6:1 | LL | impl Marker for &'_ () {} | ^^^^^^^^^^^^^^^^^^^^^^ LL | impl Marker for &'_ () {} | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0283`. </ins>


<ins> error[E0596]: cannot borrow field of immutable binding as mutable --> $DIR/issue-52240.rs:9:27 | LL |     if let (Some(Foo::Bar(ref mut val)), _) = (&arr.get(0), 0) { |                           ^^^^^^^^^^^ cannot mutably borrow field of immutable binding error: aborting due to previous error For more information about this error, try `rustc --explain E0596`. </ins>


/// Whether the `def_id` is an unstable const fn and what feature gate is necessary to enable it pub fn is_unstable_const_fn(self, def_id: DefId) -> Option<Symbol> { <del> if self.is_constructor(def_id) { Some(sym::const_constructor) } else if self.is_const_fn_raw(def_id) { </del> <ins> if self.is_const_fn_raw(def_id) { </ins> self.lookup_stability(def_id)?.const_stability } else { None


<del> Subproject commit 56444a4545bd71430d64b86b8a71714cfdbe9f5d </del> <ins> Subproject commit 8bed48a751562c1c396b361bb6940c677268e997 </ins>


use std::str; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::{Arc, OnceLock}; <del> use std::time::{Instant, SystemTime}; </del> <ins> use std::time::{Duration, Instant, SystemTime}; </ins> use time::OffsetDateTime; use tracing::trace;


<ins> error[E0277]: the trait bound `Bar<T>: Foo` is not satisfied --> $DIR/issue-64855.rs:5:19 | LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ; |                   ^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `Bar<T>` error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. </ins>


let tcx = self.infcx.tcx; // Try to find predicates on *generic params* that would allow copying `ty` let infcx = tcx.infer_ctxt().build(); <del> if infcx .type_implements_trait( tcx.lang_items().clone_trait().unwrap(), [tcx.erase_regions(ty)], self.param_env, ) .must_apply_modulo_regions() </del> <ins> if let Some(clone_trait_def) = tcx.lang_items().clone_trait() && infcx .type_implements_trait( clone_trait_def, [tcx.erase_regions(ty)], self.param_env, ) .must_apply_modulo_regions() </ins> { err.span_suggestion_verbose( span.shrink_to_hi(),


} } <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(),