<ins> - // MIR for `bar` before Inline + // MIR for `bar` after Inline fn bar(_1: P) -> () { debug _baz => _1;                    // in scope 0 at $DIR/issue-78442.rs:9:5: 9:9 let mut _0: ();                      // return place in scope 0 at $DIR/issue-78442.rs:10:3: 10:3 let _2: ();                          // in scope 0 at $DIR/issue-78442.rs:11:5: 11:17 let mut _3: &fn() {foo};             // in scope 0 at $DIR/issue-78442.rs:11:5: 11:15 let _4: fn() {foo};                  // in scope 0 at $DIR/issue-78442.rs:11:5: 11:15 let mut _5: ();                      // in scope 0 at $DIR/issue-78442.rs:11:5: 11:17 +     scope 1 (inlined <fn() {foo} as Fn<()>>::call - shim(fn() {foo})) { // at $DIR/issue-78442.rs:11:5: 11:17 +     } bb0: { StorageLive(_2);                 // scope 0 at $DIR/issue-78442.rs:11:5: 11:17 StorageLive(_3);                 // scope 0 at $DIR/issue-78442.rs:11:5: 11:15 StorageLive(_4);                 // scope 0 at $DIR/issue-78442.rs:11:5: 11:15 -         _4 = hide_foo() -> [return: bb1, unwind: bb4]; // scope 0 at $DIR/issue-78442.rs:11:5: 11:15 +         _4 = hide_foo() -> [return: bb1, unwind: bb3]; // scope 0 at $DIR/issue-78442.rs:11:5: 11:15 // mir::Constant // + span: $DIR/issue-78442.rs:11:5: 11:13 // + literal: Const { ty: fn() -> impl std::ops::Fn<()> {hide_foo}, val: Value(Scalar(<ZST>)) } } bb1: { _3 = &_4;                        // scope 0 at $DIR/issue-78442.rs:11:5: 11:15 StorageLive(_5);                 // scope 0 at $DIR/issue-78442.rs:11:5: 11:17 -         _2 = <impl Fn<()> as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/issue-78442.rs:11:5: 11:17 -                                          // mir::Constant -                                          // + span: $DIR/issue-78442.rs:11:5: 11:15 -                                          // + literal: Const { ty: for<'r> extern "rust-call" fn(&'r impl std::ops::Fn<()>, ()) -> <impl std::ops::Fn<()> as std::ops::FnOnce<()>>::Output {<impl std::ops::Fn<()> as std::ops::Fn<()>>::call}, val: Value(Scalar(<ZST>)) } +         _2 = move (*_3)() -> [return: bb5, unwind: bb3]; // scope 1 at $DIR/issue-78442.rs:11:5: 11:17 } bb2: { -         StorageDead(_5);                 // scope 0 at $DIR/issue-78442.rs:11:16: 11:17 -         StorageDead(_3);                 // scope 0 at $DIR/issue-78442.rs:11:16: 11:17 -         StorageDead(_4);                 // scope 0 at $DIR/issue-78442.rs:11:17: 11:18 -         StorageDead(_2);                 // scope 0 at $DIR/issue-78442.rs:11:17: 11:18 -         _0 = const ();                   // scope 0 at $DIR/issue-78442.rs:10:3: 12:2 -         drop(_1) -> [return: bb3, unwind: bb5]; // scope 0 at $DIR/issue-78442.rs:12:1: 12:2 +         return;                          // scope 0 at $DIR/issue-78442.rs:12:2: 12:2 } -     bb3: { -         return;                          // scope 0 at $DIR/issue-78442.rs:12:2: 12:2 +     bb3 (cleanup): { +         drop(_1) -> bb4;                 // scope 0 at $DIR/issue-78442.rs:12:1: 12:2 } bb4 (cleanup): { -         drop(_1) -> bb5;                 // scope 0 at $DIR/issue-78442.rs:12:1: 12:2 +         resume;                          // scope 0 at $DIR/issue-78442.rs:7:1: 12:2 } -     bb5 (cleanup): { -         resume;                          // scope 0 at $DIR/issue-78442.rs:7:1: 12:2 +     bb5: { +         StorageDead(_5);                 // scope 0 at $DIR/issue-78442.rs:11:16: 11:17 +         StorageDead(_3);                 // scope 0 at $DIR/issue-78442.rs:11:16: 11:17 +         StorageDead(_4);                 // scope 0 at $DIR/issue-78442.rs:11:17: 11:18 +         StorageDead(_2);                 // scope 0 at $DIR/issue-78442.rs:11:17: 11:18 +         _0 = const ();                   // scope 0 at $DIR/issue-78442.rs:10:3: 12:2 +         drop(_1) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/issue-78442.rs:12:1: 12:2 } } </ins>


method_name.name )); <del> let self_ty = self </del> <ins> let self_ty_name = self </ins> .sess() .source_map() .span_to_snippet(self_ty_span) .unwrap_or_else(|_| self_ty.to_string()); <ins> let self_ty_generics_count = match self_ty.kind() { // Get the number of generics the self type has (if an Adt) unless we can determine that // the user has written the self type with generics already which we (naively) do by looking // for a "<" in `self_ty_name`. Adt(def, _) if !self_ty_name.contains("<") => self.tcx.generics_of(def.did).count(), _ => 0, }; let self_ty_generics = if self_ty_generics_count > 0 { format!("<{}>", vec!["_"; self_ty_generics_count].join(", ")) } else { String::new() }; </ins> lint.span_suggestion( span, "disambiguate the associated function", <del> format!("<{} as {}>::{}", self_ty, trait_name, method_name.name,), </del> <ins> format!( "<{}{} as {}>::{}", self_ty_name, self_ty_generics, trait_name, method_name.name, ), </ins> Applicability::MachineApplicable, );


<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. // Regression test for issue #25436: permit token-trees to be followed // by sequences, enabling more general parsing. use self::Join::*; #[derive(Debug)] enum Join<A,B> { Keep(A,B), Skip(A,B), } macro_rules! parse_list { ( < $a:expr; > $($b:tt)* ) => { Keep(parse_item!($a),parse_list!($($b)*)) }; ( $a:tt $($b:tt)* ) => { Skip(parse_item!($a), parse_list!($($b)*)) }; ( ) => { () }; } macro_rules! parse_item { ( $x:expr ) => { $x } } fn main() { let list = parse_list!(<1;> 2 <3;> 4); assert_eq!("Keep(1, Skip(2, Keep(3, Skip(4, ()))))", format!("{:?}", list)); } </ins>


let self_ty = self.resolve_vars_if_possible(&trait_ref.self_ty()); <ins> // Do not check on infer_types to avoid panic in evaluate_obligation. if self_ty.has_infer_types() { return; } let self_ty = self.tcx.erase_regions(&self_ty); </ins> let impls_future = self.tcx.type_implements_trait(( future_trait, self_ty,


use rustc_hir::intravisit::Visitor; use rustc_hir::lang_items::LangItem; use rustc_hir::{ <del> Constness, HirId, ItemKind, ItemLocalId, ItemLocalMap, ItemLocalSet, Node, TraitCandidate, </del> <ins> Constness, ExprKind, HirId, ImplItemKind, ItemKind, ItemLocalId, ItemLocalMap, ItemLocalSet, Node, TraitCandidate, TraitItemKind, </ins> }; use rustc_index::vec::{Idx, IndexVec}; use rustc_macros::HashStable;


CFG_RUSTC_FLAGS += -g else ifdef CFG_ENABLE_DEBUGINFO_LINES $(info cfg: enabling line number debuginfo (CFG_ENABLE_DEBUGINFO_LINES)) <del> CFG_RUSTC_FLAGS += -C debuginfo=1 </del> <ins> CFG_RUSTC_FLAGS += -Cdebuginfo=1 </ins> endif ifdef SAVE_TEMPS


passes: FxHashSet<String>, css_file_extension: Option<PathBuf>, renderinfo: RenderInfo, <del> render_type: RenderType) -> Result<(), Error> { </del> <ins> render_type: RenderType, sort_modules_alphabetically: bool) -> Result<(), Error> { </ins> let src_root = match krate.src { FileName::Real(ref p) => match p.parent() { Some(p) => p.to_path_buf(),


<ins> error[E0382]: use of moved value: `self` --> $DIR/issue-66958-non-copy-infered-type-arg.rs:11:20 | LL |         Self::partial(self.0); |                       ------ value moved here LL |         Self::full(self); |                    ^^^^ value used here after partial move | = note: move occurs because `self.0` has type `S`, which does not implement the `Copy` trait error: aborting due to previous error For more information about this error, try `rustc --explain E0382`. </ins>


{ let old_len = self.in_scope_lifetimes.len(); let lt_def_names = params.iter().filter_map(|param| match param.kind { <del> GenericParamKind::Lifetime { .. } => Some(param.ident.modern()), </del> <ins> GenericParamKind::Lifetime { .. } => Some(ParamName::Plain(param.ident.modern())), </ins> _ => None, }); self.in_scope_lifetimes.extend(lt_def_names);


<ins> // compile-flags: -Cdebuginfo=2 // build-pass // Regression test for #87142 // This test needs the above flags and the "lib" crate type. #![feature(type_alias_impl_trait, generator_trait, generators)] #![crate_type = "lib"] use std::ops::Generator; pub trait GeneratorProviderAlt: Sized { type Gen: Generator<(), Return = (), Yield = ()>; fn start(ctx: Context<Self>) -> Self::Gen; } pub struct Context<G: 'static + GeneratorProviderAlt> { pub link: Box<G::Gen>, } impl GeneratorProviderAlt for () { type Gen = impl Generator<(), Return = (), Yield = ()>; fn start(ctx: Context<Self>) -> Self::Gen { move || { match ctx { _ => (), } yield (); } } } </ins>


/// } /// # } /// ``` <del> #[derive(PartialEq, PartialOrd, Eq, Ord, Hash)] </del> <ins> #[derive(PartialEq, PartialOrd, Eq, Ord, Hash, Clone)] </ins> #[stable(feature = "rust1", since = "1.0.0")] pub struct CString { inner: Box<[u8]>,


print("Creating issue:n{}".format(request)) response = urllib2.urlopen(urllib2.Request( gh_url(), <del> request, </del> <ins> request.encode(), </ins> { 'Authorization': 'token ' + github_token, 'Content-Type': 'application/json',


"lazy_static", "log", "rls-span", <del> "rustc-ap-rustc_ast", "rustc-ap-rustc_ast_pretty", "rustc-ap-rustc_data_structures", "rustc-ap-rustc_errors", "rustc-ap-rustc_parse", "rustc-ap-rustc_session", "rustc-ap-rustc_span", </del> ] [[package]]


enum FieldName { UnnamedField(uint), // index <del> // FIXME #6993: change type (and name) from Ident to Name NamedField(ast::Ident), </del> <ins> // (Name, not Ident, because struct fields are not macro-hygienic) NamedField(ast::Name), </ins> } impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {


// Try to lookup name in more relaxed fashion for better error reporting. let ident = path.last().unwrap().ident; <del> let candidates = self.lookup_import_candidates(ident, ns, is_expected); </del> <ins> let candidates = self.lookup_import_candidates(ident, ns, is_expected) .drain(..) .filter(|ImportSuggestion { did, .. }| { match (did, def.and_then(|def| def.opt_def_id())) { (Some(suggestion_did), Some(actual_did)) => *suggestion_did != actual_did, _ => true, } }) .collect::<Vec<_>>(); </ins> if candidates.is_empty() && is_expected(Def::Enum(DefId::local(CRATE_DEF_INDEX))) { let enum_candidates = self.lookup_import_candidates(ident, ns, is_enum_variant);


pub struct AnonPipe(FileDesc); pub fn anon_pipe() -> io::Result<(AnonPipe, AnonPipe)> { <del> syscall! { fn pipe2(fds: *mut c_int, flags: c_int) -> c_int } static INVALID: AtomicBool = AtomicBool::new(false); </del> let mut fds = [0; 2]; <del> // Unfortunately the only known way right now to create atomically set the // CLOEXEC flag is to use the `pipe2` syscall on Linux. This was added in // 2.6.27, however, and because we support 2.6.18 we must detect this // support dynamically. if cfg!(any( target_os = "dragonfly", target_os = "freebsd", target_os = "linux", target_os = "netbsd", target_os = "openbsd", target_os = "redox" )) && !INVALID.load(Ordering::SeqCst) { // Note that despite calling a glibc function here we may still // get ENOSYS. Glibc has `pipe2` since 2.9 and doesn't try to // emulate on older kernels, so if you happen to be running on // an older kernel you may see `pipe2` as a symbol but still not // see the syscall. match cvt(unsafe { pipe2(fds.as_mut_ptr(), libc::O_CLOEXEC) }) { Ok(_) => { return Ok((AnonPipe(FileDesc::new(fds[0])), AnonPipe(FileDesc::new(fds[1])))); } Err(ref e) if e.raw_os_error() == Some(libc::ENOSYS) => { INVALID.store(true, Ordering::SeqCst); } Err(e) => return Err(e), </del> <ins> // The only known way right now to create atomically set the CLOEXEC flag is // to use the `pipe2` syscall. This was added to Linux in 2.6.27, glibc 2.9 // and musl 0.9.3, and some other targets also have it. cfg_if::cfg_if! { if #[cfg(any( target_os = "dragonfly", target_os = "freebsd", target_os = "linux", target_os = "netbsd", target_os = "openbsd", target_os = "redox" ))] { cvt(unsafe { libc::pipe2(fds.as_mut_ptr(), libc::O_CLOEXEC) })?; Ok((AnonPipe(FileDesc::new(fds[0])), AnonPipe(FileDesc::new(fds[1])))) } else { cvt(unsafe { libc::pipe(fds.as_mut_ptr()) })?; let fd0 = FileDesc::new(fds[0]); let fd1 = FileDesc::new(fds[1]); fd0.set_cloexec()?; fd1.set_cloexec()?; Ok((AnonPipe(fd0), AnonPipe(fd1))) </ins> } } <del> cvt(unsafe { libc::pipe(fds.as_mut_ptr()) })?; let fd0 = FileDesc::new(fds[0]); let fd1 = FileDesc::new(fds[1]); fd0.set_cloexec()?; fd1.set_cloexec()?; Ok((AnonPipe(fd0), AnonPipe(fd1))) </del> } impl AnonPipe {


<ins> error[E0308]: `if` and `else` have incompatible types --> $DIR/issue-82361.rs:10:9 | LL | /     if true { LL | |         a | |         - expected because of this LL | |     } else { LL | |         b | |         ^ | |         | | |         expected `usize`, found `&usize` | |         help: consider dereferencing the borrow: `*b` LL | |     }; | |_____- `if` and `else` have incompatible types error[E0308]: `if` and `else` have incompatible types --> $DIR/issue-82361.rs:16:9 | LL | /     if true { LL | |         1 | |         - expected because of this LL | |     } else { LL | |         &1 | |         -^ | |         | | |         expected integer, found `&{integer}` | |         help: consider removing the `&` LL | |     }; | |_____- `if` and `else` have incompatible types error[E0308]: `if` and `else` have incompatible types --> $DIR/issue-82361.rs:22:9 | LL | /     if true { LL | |         1 | |         - expected because of this LL | |     } else { LL | |         &mut 1 | |         -----^ | |         | | |         expected integer, found `&mut {integer}` | |         help: consider removing the `&mut` LL | |     }; | |_____- `if` and `else` have incompatible types error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0308`. </ins>


// `match ::std::future::IntoFuture::into_future(<expr>) { ... }` let into_future_span = self.mark_span_with_reason( DesugaringKind::Await, <del> await_span, </del> <ins> dot_await_span, </ins> self.allow_into_future.clone(), ); let into_future_expr = self.expr_call_lang_item_fn(


# # Note that we don't literally overwrite the gdb.exe binary because it appears # to just use gdborig.exe, so that's the binary we deal with instead. <del> - script: | powershell -Command "$ProgressPreference = 'SilentlyContinue'; iwr -outf %MINGW_ARCHIVE% %MINGW_URL%/%MINGW_ARCHIVE%" 7z x -y %MINGW_ARCHIVE% > nul powershell -Command "$ProgressPreference = 'SilentlyContinue'; iwr -outf 2017-04-20-%MSYS_BITS%bit-gdborig.exe %MINGW_URL%/2017-04-20-%MSYS_BITS%bit-gdborig.exe" mv 2017-04-20-%MSYS_BITS%bit-gdborig.exe %MINGW_DIR%bingdborig.exe echo ##vso[task.prependpath]%CD%%MINGW_DIR%bin </del> <ins> - bash: | set -e curl -o mingw.7z $MINGW_URL/$MINGW_ARCHIVE 7z x -y mingw.7z > /dev/null curl -o $MINGW_DIR/bin/gdborig.exe $MINGW_URL/2017-04-20-${MSYS_BITS}bit-gdborig.exe echo "##vso[task.prependpath]`pwd`/$MINGW_DIR/bin" </ins> condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'), ne(variables['MINGW_URL'],'')) displayName: Download custom MinGW <del> # Otherwise pull in the MinGW installed on appveyor - script: | echo ##vso[task.prependpath]%MSYS_PATH%mingw%MSYS_BITS%bin </del> <ins> # Otherwise install MinGW through `pacman` - bash: | set -e arch=i686 if [ "$MSYS_BITS" = "64" ]; then arch=x86_64 fi pacman -S --noconfirm --needed mingw-w64-$arch-toolchain mingw-w64-$arch-cmake mingw-w64-$arch-gcc mingw-w64-$arch-python2 echo "##vso[task.prependpath]$(System.Workfolder)/msys2/mingw$MSYS_BITS/bin" </ins> condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['MINGW_URL'],'')) <del> displayName: Add MinGW to path </del> <ins> displayName: Download standard MinGW </ins> # Make sure we use the native python interpreter instead of some msys equivalent # one way or another. The msys interpreters seem to have weird path conversions # baked in which break LLVM's build system one way or another, so let's use the # native version which keeps everything as native as possible. <del> - script: | copy C:Python27amd64python.exe C:Python27amd64python2.7.exe echo ##vso[task.prependpath]C:Python27amd64 </del> <ins> - bash: | set -e cp C:/Python27amd64/python.exe C:/Python27amd64/python2.7.exe echo "##vso[task.prependpath]C:/Python27amd64" </ins> displayName: Prefer the "native" Python as LLVM has trouble building with MSYS sometimes condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) # Note that this is originally from the github releases patch of Ninja <del> - script: | md ninja powershell -Command "$ProgressPreference = 'SilentlyContinue'; iwr -outf 2017-03-15-ninja-win.zip https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc/2017-03-15-ninja-win.zip" 7z x -oninja 2017-03-15-ninja-win.zip del 2017-03-15-ninja-win.zip set RUST_CONFIGURE_ARGS=%RUST_CONFIGURE_ARGS% --enable-ninja echo ##vso[task.setvariable variable=RUST_CONFIGURE_ARGS]%RUST_CONFIGURE_ARGS% echo ##vso[task.prependpath]%CD%ninja </del> <ins> - bash: | set -e mkdir ninja curl -o ninja.zip https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc/2017-03-15-ninja-win.zip 7z x -oninja ninja.zip rm ninja.zip echo "##vso[task.setvariable variable=RUST_CONFIGURE_ARGS]$RUST_CONFIGURE_ARGS --enable-ninja" echo "##vso[task.prependpath]`pwd`/ninja" </ins> displayName: Download and install ninja condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))


fn get_str() -> &str; // ILLEGAL, no inputs fn frob(s: &str, t: &str) -> &str; // ILLEGAL, two inputs <ins> fn frob<'a, 'b>(s: &'a str, t: &'b str) -> &str; // Expanded: Output lifetime is unclear </ins> fn get_mut(&mut self) -> &mut T; // elided fn get_mut<'a>(&'a mut self) -> &'a mut T; // expanded


-> Option<(Level, LintSource)> { self.id_to_set.get(&id).map(|idx| { <del> self.sets.get_lint_level(lint, *idx) </del> <ins> self.sets.get_lint_level(lint, *idx, None) </ins> }) } }


use crate::hir::def_id::DefId; use crate::hir; use crate::ty::TyCtxt; <del> use syntax_pos::symbol::{sym, Symbol}; </del> <ins> use syntax_pos::symbol::Symbol; </ins> use crate::hir::map::blocks::FnLikeNode; use syntax::attr;


fn collect_bang_proc_macro(&mut self, item: &'a ast::Item) { if self.in_root && item.vis.node.is_pub() { <del> self.bang_macros.push(ProcMacroDef { </del> <ins> self.macros.push(ProcMacro::Def(ProcMacroDef { </ins> span: item.span, function_name: item.ident, <del> }); </del> <ins> def_type: ProcMacroDefType::Bang })); </ins> } else { let msg = if !self.in_root { "functions tagged with `#[proc_macro]` must


<ins> // check-pass #![feature(allocator_api)] fn main() { Box::new_in((), &std::alloc::Global); } </ins>


= help: add #![feature(generic_associated_types)] to the crate attributes to enable error[E0658]: generic associated types are unstable (see issue #44265) <del> --> $DIR/feature-gate-generic_associated_types.rs:24:5 </del> <ins> --> $DIR/feature-gate-generic_associated_types.rs:25:5 </ins> | LL |     type Pointer2<u32> = Box<u32>; |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(generic_associated_types)] to the crate attributes to enable <del> error: aborting due to 4 previous errors </del> <ins> error[E0658]: where clauses on associated types are unstable (see issue #44265) --> $DIR/feature-gate-generic_associated_types.rs:30:5 | LL |     type Assoc where Self: Sized; |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(generic_associated_types)] to the crate attributes to enable error: aborting due to 6 previous errors </ins> For more information about this error, try `rustc --explain E0658`.


(cfg, _) => cfg.as_deref().cloned(), }; <del> debug!("Portability {:?} - {:?} = {:?}", item.cfg, parent.cfg, cfg); </del> <ins> debug!("Portability name={:?} {:?} - {:?} = {:?}", item.name, item.cfg, parent.cfg, cfg); </ins> if let Some(ref cfg) = cfg { tags += &tag_html("portability", &cfg.render_long_plain(), &cfg.render_short_html()); }


14 | } | - immutable borrow ends here <del> error: aborting due to 2 previous errors </del> <ins> error: aborting due to previous error </ins>


--> $DIR/privacy-struct-ctor.rs:20:9 | LL |         Z; <del> |         ^ constructor is not visible here due to private fields help: a tuple struct with a similar name exists | LL |         S; </del> |         ^ <del> help: possible better candidate is found in another module, you can import it into scope | LL |     use m::n::Z; | </del> <ins> |         | |         constructor is not visible here due to private fields |         help: a tuple struct with a similar name exists: `S` </ins> error[E0423]: expected value, found struct `S` --> $DIR/privacy-struct-ctor.rs:33:5 | LL |     S; |     ^ constructor is not visible here due to private fields <del> help: possible better candidate is found in another module, you can import it into scope | LL | use m::S; | </del> error[E0423]: expected value, found struct `S2` --> $DIR/privacy-struct-ctor.rs:38:5


<ins> fn main() { // There shall be no suggestions here. In particular not `Ok`. let _ = 读文; //~ ERROR cannot find value `读文` in this scope } </ins>


/// You can also use `dbg!()` without a value to just print the /// file and line whenever it's reached. /// <ins> /// Finally, if you want to `dbg!(..)` multiple values, it will treat them as /// a tuple (and return it, too): /// /// ``` /// assert_eq!(dbg!(1usize, 2u32), (1, 2)); /// ``` /// /// However, a single argument with a trailing comma will still not be treated /// as a tuple, following the convention of ignoring trailing commas in macro /// invocations. You can use a 1-tuple directly if you need one: /// /// ``` /// assert_eq!(1, dbg!(1u32,)); // trailing comma ignored /// assert_eq!((1,), dbg!((1u32,))); // 1-tuple /// ``` /// </ins> /// [stderr]: https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr) /// [`debug!`]: https://docs.rs/log/*/log/macro.debug.html /// [`log`]: https://crates.io/crates/log


--set target.i686-unknown-linux-gnu.linker=clang  --build=i686-unknown-linux-gnu  --set llvm.ninja=false  <del> --set llvm.use-linker=lld  --set rust.use-lld=true  </del> --set rust.jemalloc <del> ENV SCRIPT python3 ../x.py dist --build $HOSTS --host $HOSTS --target $HOSTS </del> <ins> ENV SCRIPT python2.7 ../x.py dist --build $HOSTS --host $HOSTS --target $HOSTS </ins> ENV CARGO_TARGET_I686_UNKNOWN_LINUX_GNU_LINKER=clang # This was added when we switched from gcc to clang. It's not clear why this is


<ins> // edition: 2021 // https://github.com/rust-lang/rust/pull/111761#issuecomment-1557777314 macro_rules! m { () => { extern crate core as std; //~^ ERROR macro-expanded `extern crate` items cannot shadow names passed with `--extern` } } m!(); use std::mem; fn main() {} </ins>


} #[derive(Diagnostic)] <ins> #[diag(passes_lang_item_fn_with_target_feature)] pub struct LangItemWithTargetFeature { #[primary_span] pub attr_span: Span, pub name: Symbol, #[label] pub sig_span: Span, } #[derive(Diagnostic)] </ins> #[diag(passes_lang_item_on_incorrect_target, code = "E0718")] pub struct LangItemOnIncorrectTarget { #[primary_span]


#![feature(exhaustive_patterns)] #![feature(extend_one)] #![feature(external_doc)] <del> #![feature(fmt_as_str)] </del> #![feature(fn_traits)] #![feature(format_args_nl)] #![feature(gen_future)]


mod foo { enum Bar { <del> Baz { a: isize } </del> <ins> Baz { a: isize }, </ins> } } <del> fn f(b: foo::Bar) { //~ ERROR enum `Bar` is private </del> <ins> fn f(b: foo::Bar) { //~^ ERROR enum `Bar` is private </ins> match b { foo::Bar::Baz { a: _a } => {} //~ ERROR enum `Bar` is private }


pub(crate) const PASSES: &[Pass] = &[ CHECK_CUSTOM_CODE_CLASSES, CHECK_DOC_TEST_VISIBILITY, <ins> STRIP_ALIASED_NON_LOCAL, </ins> STRIP_HIDDEN, STRIP_PRIVATE, STRIP_PRIV_IMPORTS,


<ins> error[E0425]: cannot find value `missing` in this scope --> $DIR/tainted-body-2.rs:9:5 | LL |     missing; |     ^^^^^^^ not found in this scope error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0425`. </ins>


pub fn emit_feature_warn(diag: &SpanHandler, feature: &str, span: Span, explain: &str) { diag.span_warn(span, explain); <ins> // #23973: do not suggest `#![feature(...)]` if we are in beta/stable if option_env!("CFG_DISABLE_UNSTABLE_FEATURES").is_some() { return; } </ins> if diag.handler.can_emit_warnings { diag.fileline_help(span, &format!("add #![feature({})] to the  crate attributes to silence this warning",


#[link_args = "aFdEfSeVEEE"] extern {} //~^ ERROR the `link_args` attribute is not portable across platforms <del> //~| HELP add #![feature(link_args)] to the crate attributes to enable </del> fn main() { }


#[derive(SessionDiagnostic)] #[diag(driver::rlink_no_a_file)] pub(crate) struct RlinkNotAFile; <ins> #[derive(SessionDiagnostic)] #[diag(driver::unpretty_dump_fail)] pub(crate) struct UnprettyDumpFail { pub path: String, pub err: String, } </ins>


<ins> // compile-pass // edition:2018 #![feature(arbitrary_self_types, async_await, await_macro)] use std::task::{self, Poll}; use std::future::Future; use std::marker::Unpin; use std::pin::Pin; // This is a regression test for a ICE/unbounded recursion issue relating to async-await. #[derive(Debug)] #[must_use = "futures do nothing unless polled"] pub struct Lazy<F> { f: Option<F> } impl<F> Unpin for Lazy<F> {} pub fn lazy<F, R>(f: F) -> Lazy<F> where F: FnOnce(&mut task::Context) -> R, { Lazy { f: Some(f) } } impl<R, F> Future for Lazy<F> where F: FnOnce(&mut task::Context) -> R, { type Output = R; fn poll(mut self: Pin<&mut Self>, cx: &mut task::Context) -> Poll<R> { Poll::Ready((self.f.take().unwrap())(cx)) } } async fn __receive<WantFn, Fut>(want: WantFn) -> () where Fut: Future<Output = ()>, WantFn: Fn(&Box<Send + 'static>) -> Fut, { await!(lazy(|_| ())); } pub fn basic_spawn_receive() { async { await!(__receive(|_| async { () })) }; } fn main() {} </ins>


{ write!(f, "n{}", Indent(n + 4))?; } <ins> let last_input_index = self.inputs.values.len().checked_sub(1); </ins> for (i, input) in self.inputs.values.iter().enumerate() { <del> if i > 0 { match line_wrapping_indent { None => write!(f, ", ")?, Some(n) => write!(f, ",n{}", Indent(n + 4))?, }; } </del> if let Some(selfty) = input.to_self() { match selfty { clean::SelfValue => {


<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. #![crate_name = "foo"] //! Dox // @has src/foo/foo.rs.html // @has foo/index.html '//a/@href' '../src/foo/foo.rs.html' pub mod qux; // @has foo/bar/index.html '//a/@href' '../../src/foo/foo.rs.html' pub mod bar { /// Dox // @has foo/bar/baz/index.html '//a/@href' '../../../src/foo/foo.rs.html' pub mod baz { /// Dox // @has foo/bar/baz/fn.baz.html '//a/@href' '../../../src/foo/foo.rs.html' pub fn baz() { } } /// Dox // @has foo/bar/trait.Foobar.html '//a/@href' '../../src/foo/foo.rs.html' pub trait Foobar { fn dummy(&self) { } } // @has foo/bar/struct.Foo.html '//a/@href' '../../src/foo/foo.rs.html' pub struct Foo { x: i32, y: u32 } // @has foo/bar/fn.prawns.html '//a/@href' '../../src/foo/foo.rs.html' pub fn prawns((a, b): (i32, u32), Foo { x, y }: Foo) { } } /// Dox // @has foo/fn.modfn.html '//a/@href' '../src/foo/foo.rs.html' pub fn modfn() { } </ins>


<del> //@ known-bug: #118403 #![feature(generic_const_exprs)] pub struct X<const N: usize> {} impl<const Z: usize> X<Z> { pub fn y<'a, U: 'a>(&'a self) -> impl Iterator<Item = impl Iterator<Item = [u8; Z]> + '_> { (0..1).map(move |_| (0..1).map(move |_| loop {})) } } </del>


<ins> use std::error::Error; use std::fmt; use super::InterpCx; use crate::interpret::{ConstEvalErr, InterpErrorInfo, Machine}; #[derive(Clone, Debug)] pub enum ConstEvalError { NeedsRfc(String), ConstAccessesStatic, } impl<'tcx> Into<InterpErrorInfo<'tcx>> for ConstEvalError { fn into(self) -> InterpErrorInfo<'tcx> { err_unsup!(Unsupported(self.to_string())).into() } } impl fmt::Display for ConstEvalError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { use self::ConstEvalError::*; match *self { NeedsRfc(ref msg) => { write!(f, ""{}" needs an rfc before being allowed inside constants", msg) } ConstAccessesStatic => write!(f, "constant accesses static"), } } } impl Error for ConstEvalError {} /// Turn an interpreter error into something to report to the user. /// As a side-effect, if RUSTC_CTFE_BACKTRACE is set, this prints the backtrace. /// Should be called only if the error is actually going to to be reported! pub fn error_to_const_error<'mir, 'tcx, M: Machine<'mir, 'tcx>>( ecx: &InterpCx<'mir, 'tcx, M>, mut error: InterpErrorInfo<'tcx>, ) -> ConstEvalErr<'tcx> { error.print_backtrace(); let stacktrace = ecx.generate_stacktrace(None); ConstEvalErr { error: error.kind, stacktrace, span: ecx.tcx.span } } </ins>


// Recreate the edges in the graph that are still clean. let mut clean_work_products = FxHashSet(); let mut dirty_work_products = FxHashSet(); // incomplete; just used to suppress debug output <ins> let mut extra_edges = vec![]; </ins> for (source, targets) in &edge_map { for target in targets { <del> // If the target is dirty, skip the edge. If this is an edge // that targets a work-product, we can print the blame // information now. if let Some(blame) = dirty_raw_nodes.get(target) { if let DepNode::WorkProduct(ref wp) = *target { if tcx.sess.opts.debugging_opts.incremental_info { if dirty_work_products.insert(wp.clone()) { // It'd be nice to pretty-print these paths better than just // using the `Debug` impls, but wev. println!("incremental: module {:?} is dirty because {:?}  changed or was removed", wp, blame.map_def(|&index| { Some(directory.def_path_string(tcx, index)) }).unwrap()); } } } continue; } // If the source is dirty, the target will be dirty. assert!(!dirty_raw_nodes.contains_key(source)); // Retrace the source -> target edges to def-ids and then // create an edge in the graph. Retracing may yield none if // some of the data happens to have been removed; this ought // to be impossible unless it is dirty, so we can unwrap. let source_node = retraced.map(source).unwrap(); let target_node = retraced.map(target).unwrap(); let _task = tcx.dep_graph.in_task(target_node); tcx.dep_graph.read(source_node); if let DepNode::WorkProduct(ref wp) = *target { clean_work_products.insert(wp.clone()); } </del> <ins> process_edges(tcx, source, target, &edge_map, &directory, &retraced, &dirty_raw_nodes, &mut clean_work_products, &mut dirty_work_products, &mut extra_edges); </ins> } } <ins> // Subtle. Sometimes we have intermediate nodes that we can't recreate in the new graph. // This is pretty unusual but it arises in a scenario like this: // //     Hir(X) -> Foo(Y) -> Bar // // Note that the `Hir(Y)` is not an input to `Foo(Y)` -- this // almost never happens, but can happen in some obscure // scenarios. In that case, if `Y` is removed, then we can't // recreate `Foo(Y)` (the def-id `Y` no longer exists); what we do // then is to push the edge `Hir(X) -> Bar` onto `extra_edges` // (along with any other targets of `Foo(Y)`). We will then add // the edge from `Hir(X)` to `Bar` (or, if `Bar` itself cannot be // recreated, to the targets of `Bar`). while let Some((source, target)) = extra_edges.pop() { process_edges(tcx, source, target, &edge_map, &directory, &retraced, &dirty_raw_nodes, &mut clean_work_products, &mut dirty_work_products, &mut extra_edges); } </ins> // Add in work-products that are still clean, and delete those that are // dirty. reconcile_work_products(tcx, work_products, &clean_work_products);


/// # Examples /// /// ``` <ins> /// #![feature(inner_deref)] </ins> /// let x: Result<String, u32> = Ok("hello".to_string()); /// let y: Result<&str, &u32> = Ok("hello"); /// assert_eq!(x.as_deref(), y);


last = match *token { TtToken(sp, MatchNt(ref name, ref frag_spec, _, _)) => { // ii. If T is a simple NT, look ahead to the next token T' in <del> // M. let next_token = match tokens.peek() { // If T' closes a complex NT, replace T' with F Some(&&TtToken(_, CloseDelim(_))) => follow.clone(), Some(&&TtToken(_, ref tok)) => tok.clone(), Some(&&TtSequence(sp, _)) => { cx.span_err(sp, &format!("`${0}:{1}` is followed by a  sequence repetition, which is not  allowed for `{1}` fragments", name.as_str(), frag_spec.as_str()) </del> <ins> // M. If T' is in the set FOLLOW(NT), continue. Else; reject. if can_be_followed_by_any(frag_spec.as_str()) { continue } else { let next_token = match tokens.peek() { // If T' closes a complex NT, replace T' with F Some(&&TtToken(_, CloseDelim(_))) => follow.clone(), Some(&&TtToken(_, ref tok)) => tok.clone(), Some(&&TtSequence(sp, _)) => { // Be conservative around sequences: to be // more specific, we would need to // consider FIRST sets, but also the // possibility that the sequence occurred // zero times (in which case we need to // look at the token that follows the // sequence, which may itself a sequence, // and so on). cx.span_err(sp, &format!("`${0}:{1}` is followed by a  sequence repetition, which is not  allowed for `{1}` fragments", name.as_str(), frag_spec.as_str()) </ins> ); <del> Eof }, // die next iteration Some(&&TtDelimited(_, ref delim)) => delim.close_token(), // else, we're at the end of the macro or sequence None => follow.clone() }; let tok = if let TtToken(_, ref tok) = *token { tok } else { unreachable!() }; // If T' is in the set FOLLOW(NT), continue. Else, reject. match (&next_token, is_in_follow(cx, &next_token, frag_spec.as_str())) { (_, Err(msg)) => { cx.span_err(sp, &msg); continue </del> <ins> Eof }, // die next iteration Some(&&TtDelimited(_, ref delim)) => delim.close_token(), // else, we're at the end of the macro or sequence None => follow.clone() }; let tok = if let TtToken(_, ref tok) = *token { tok } else { unreachable!() }; // If T' is in the set FOLLOW(NT), continue. Else, reject. match (&next_token, is_in_follow(cx, &next_token, frag_spec.as_str())) { (_, Err(msg)) => { cx.span_err(sp, &msg); continue } (&Eof, _) => return Some((sp, tok.clone())), (_, Ok(true)) => continue, (next, Ok(false)) => { cx.span_err(sp, &format!("`${0}:{1}` is followed by `{2}`, which  is not allowed for `{1}` fragments", name.as_str(), frag_spec.as_str(), token_to_string(next))); continue }, </ins> } <del> (&Eof, _) => return Some((sp, tok.clone())), (_, Ok(true)) => continue, (next, Ok(false)) => { cx.span_err(sp, &format!("`${0}:{1}` is followed by `{2}`, which  is not allowed for `{1}` fragments", name.as_str(), frag_spec.as_str(), token_to_string(next))); continue }, </del> } }, TtSequence(sp, ref seq) => {


// In theory, any zero-sized value could be borrowed // mutably without consequences. However, only &mut [] // is allowed right now, and only in functions. <del> if self.const_kind == Some(hir::ConstContext::Static(hir::Mutability::Mut)) { // Inside a `static mut`, &mut [...] is also allowed. match ty.kind() { ty::Array(..) | ty::Slice(_) => {} _ => return Err(Unpromotable), } } else if let ty::Array(_, len) = ty.kind() { </del> <ins> if let ty::Array(_, len) = ty.kind() { </ins> // FIXME(eddyb): We only return `Unpromotable` for `&mut []` inside a // const context which seems unnecessary given that this is merely a ZST. match len.try_eval_usize(self.tcx, self.param_env) {


unsafe { Self::from_inner(Box::leak(x).into()) } } <del> /// Constructs a new `Arc<T>` using a closure `data_fn` that has access to /// a weak reference to the constructing `Arc<T>`. </del> <ins> /// Constructs a new `Arc<T>` while giving you a `Weak<T>` to the allocation, /// to allow you to construct a `T` which holds a weak pointer to itself. </ins> /// /// Generally, a structure circularly referencing itself, either directly or <del> /// indirectly, should not hold a strong reference to prevent a memory leak. /// In `data_fn`, initialization of `T` can make use of the weak reference /// by cloning and storing it inside `T` for use at a later time. </del> <ins> /// indirectly, should not hold a strong reference to itself to prevent a memory leak. /// Using this function, you get access to the weak pointer during the /// initialization of `T`, before the `Arc<T>` is created, such that you can /// clone and store it inside the `T`. </ins> /// <del> /// Since the new `Arc<T>` is not fully-constructed until /// `Arc<T>::new_cyclic` returns, calling [`upgrade`] on the weak /// reference inside `data_fn` will fail and result in a `None` value. </del> <ins> /// `new_cyclic` first allocates the managed allocation for the `Arc<T>`, /// then calls your closure, giving it a `Weak<T>` to this allocation, /// and only afterwards completes the construction of the `Arc<T>` by placing /// the `T` returned from your closure into the allocation. /// /// Since the new `Arc<T>` is not fully-constructed until `Arc<T>::new_cyclic` /// returns, calling [`upgrade`] on the weak reference inside your closure will /// fail and result in a `None` value. </ins> /// /// # Panics <ins> /// </ins> /// If `data_fn` panics, the panic is propagated to the caller, and the /// temporary [`Weak<T>`] is dropped normally. /// /// # Example <ins> /// </ins> /// ``` /// #![allow(dead_code)] /// use std::sync::{Arc, Weak};


<ins> // Copyright 2018 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. // aux-build:derive-two-attrs.rs #![feature(use_extern_macros)] extern crate derive_two_attrs as foo; use foo::A; #[derive(A)] #[b] #[b] struct B; fn main() {} </ins>


<ins> error[E0308]: mismatched types --> $DIR/issue-90213-expected-boxfuture-self-ice.rs:9:19 | LL |         Self::foo(None) |                   ^^^^ expected struct `Box`, found enum `Option` | = note: expected struct `Box<Option<S>>` found enum `Option<_>` = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html help: store this in the heap by calling `Box::new` | LL |         Self::foo(Box::new(None)) |                   +++++++++    + error: aborting due to previous error For more information about this error, try `rustc --explain E0308`. </ins>


intravisit::walk_foreign_item(self, it); } <del> fn visit_stmt(&mut self, e: &'tcx hir::Stmt<'tcx>) { // We will call `add_id` when we walk // the `StmtKind`. The outer statement itself doesn't // define the lint levels. intravisit::walk_stmt(self, e); </del> <ins> fn visit_stmt(&mut self, s: &'tcx hir::Stmt<'tcx>) { self.add_id(s.hir_id); intravisit::walk_stmt(self, s); </ins> } fn visit_expr(&mut self, e: &'tcx hir::Expr<'tcx>) {


}; let msg = match name { NamedField(name) => format!("field `{}` of {} is private", <del> token::get_ident(name), struct_desc), </del> <ins> token::get_name(name), struct_desc), </ins> UnnamedField(idx) => format!("field #{} of {} is private", idx + 1, struct_desc), };


<del> error[E0080]: evaluation of `<A<()> as Foo<()>>::BAR` failed --> $DIR/issue-50814-2.rs:14:24 | LL |     const BAR: usize = [5, 6, 7][T::BOO]; |                        ^^^^^^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 42 note: erroneous constant encountered --> $DIR/issue-50814-2.rs:18:6 | LL |     &<A<T> as Foo<T>>::BAR |      ^^^^^^^^^^^^^^^^^^^^^ note: the above error was encountered while instantiating `fn foo::<()>` --> $DIR/issue-50814-2.rs:30:22 | LL |     println!("{:x}", foo::<()>() as *const usize as usize); |                      ^^^^^^^^^^^ error: aborting due to previous error For more information about this error, try `rustc --explain E0080`. </del>


); let predicates = tcx.projection_predicates(trait_ty.def_id); debug!("compare_projection_bounds: projection_predicates={:?}", predicates); for predicate in predicates { <del> let concrete_ty_predicate = match predicate.kind() { ty::PredicateKind::Trait(poly_tr, c) => poly_tr .map_bound(|tr| { let trait_substs = translate_predicate_substs(tr.trait_ref.substs); ty::TraitRef { def_id: tr.def_id(), substs: trait_substs } }) .with_constness(*c) .to_predicate(tcx), ty::PredicateKind::Projection(poly_projection) => poly_projection .map_bound(|projection| { let projection_substs = translate_predicate_substs(projection.projection_ty.substs); ty::ProjectionPredicate { projection_ty: ty::ProjectionTy { substs: projection_substs, item_def_id: projection.projection_ty.item_def_id, }, ty: projection.ty.subst(tcx, rebased_substs), } }) .to_predicate(tcx), ty::PredicateKind::TypeOutlives(poly_outlives) => poly_outlives .map_bound(|outlives| { ty::OutlivesPredicate(impl_ty_value, outlives.1.subst(tcx, rebased_substs)) }) .to_predicate(tcx), _ => bug!("unexepected projection predicate kind: `{:?}`", predicate), }; </del> <ins> let concrete_ty_predicate = predicate.subst(tcx, rebased_substs); debug!("compare_projection_bounds: concrete predicate = {:?}", concrete_ty_predicate); </ins> let traits::Normalized { value: normalized_predicate, obligations } = traits::normalize( &mut selcx, <del> param_env, </del> <ins> normalize_param_env, </ins> normalize_cause.clone(), &concrete_ty_predicate, ); debug!("compare_projection_bounds: normalized predicate = {:?}", normalized_predicate); inh.register_predicates(obligations);


G(); H(); I(); <ins> K()(); </ins> }


ENV HOSTS=armv7-unknown-linux-gnueabihf <del> ENV RUST_CONFIGURE_ARGS --enable-full-tools --disable-docs </del> <ins> ENV RUST_CONFIGURE_ARGS --enable-full-tools --enable-profiler --disable-docs </ins> ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS


<ins> // check-pass #![feature(associated_type_defaults)] use std::io::Read; trait View { type Deserializers: Deserializer<Item = Self::RequestParams>; type RequestParams = DefaultRequestParams; } struct DefaultRequestParams; trait Deserializer { type Item; fn deserialize(r: impl Read) -> Self::Item; } fn main() {} </ins>


ty::Ref(..) | ty::RawPtr(_) => { return self.field(cx, index).llvm_type(cx); } <del> ty::Adt(def, _) if def.is_box() => { </del> <ins> // only wide pointer boxes are handled as pointers // thin pointer boxes with scalar allocators are handled by the general logic below ty::Adt(def, substs) if def.is_box() && cx.layout_of(substs.type_at(1)).is_zst() => { </ins> let ptr_ty = cx.tcx.mk_mut_ptr(self.ty.boxed_ty()); return cx.layout_of(ptr_ty).scalar_pair_element_llvm_type(cx, index, immediate); }


fn main() { static foo: Fn() -> u32 = || -> u32 { //~^ ERROR: mismatched types <ins> //~| ERROR: `std::ops::Fn() -> u32 + 'static: std::marker::Sized` is not satisfied </ins> 0 }; }


= note: the only supported types are integers, `bool` and `char` = help: more complex types are supported with `#![feature(adt_const_params)]` <del> error: aborting due to 7 previous errors </del> <ins> error: `&dyn for<'a> Foo<'a>` is forbidden as the type of a const generic parameter --> $DIR/unusual-rib-combinations.rs:29:21 | LL | struct Bar<const N: &'a (dyn for<'a> Foo<'a>)>; |                     ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` = help: more complex types are supported with `#![feature(adt_const_params)]` error: aborting due to 9 previous errors </ins> <del> Some errors have detailed explanations: E0106, E0214, E0308. </del> <ins> Some errors have detailed explanations: E0106, E0214, E0308, E0771. </ins> For more information about an error, try `rustc --explain E0106`.


<ins> error[E0283]: type annotations needed: cannot resolve `_: A` --> $DIR/issue-63496.rs:4:21 | LL |     const C: usize; |     --------------- required by `A::C` LL | LL |     fn f() -> ([u8; A::C], [u8; A::C]); |                     ^^^^ error[E0283]: type annotations needed: cannot resolve `_: A` --> $DIR/issue-63496.rs:4:33 | LL |     const C: usize; |     --------------- required by `A::C` LL | LL |     fn f() -> ([u8; A::C], [u8; A::C]); |                                 ^^^^ error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0283`. </ins>


where A: DoubleEndedIterator + ExactSizeIterator, B: DoubleEndedIterator + ExactSizeIterator; <ins> fn fold<Acc, F>(self, init: Acc, f: F) -> Acc where F: FnMut(Acc, Self::Item) -> Acc; </ins> // This has the same safety requirements as `Iterator::__iterator_get_unchecked` unsafe fn get_unchecked(&mut self, idx: usize) -> <Self as Iterator>::Item where


fn visit_impl_item(&mut self, ii: &'a ImplItem) { let def_data = match ii.node { ImplItemKind::Method(MethodSig { <del> header: FnHeader { asyncness: IsAsync::Async { closure_id, return_impl_trait_id, }, .. }, .. }, ..) => { </del> <ins> header: ref header @ FnHeader { asyncness: IsAsync::Async { .. }, .. }, ref decl, }, ref body) => { </ins> return self.visit_async_fn( ii.id, <del> closure_id, return_impl_trait_id, </del> ii.ident.name, ii.span, <del> |this| visit::walk_impl_item(this, ii) </del> <ins> header, &ii.generics, decl, body, </ins> ) } ImplItemKind::Method(..) | ImplItemKind::Const(..) =>


let path = cfg_file.unwrap_or_else(|| src_path.join("config.toml")); let settings = format!( "# Includes one of the default files in src/bootstrap/defaultsn <del> profile = "{}"n", profile </del> <ins> profile = "{}"n changelog-seen = {}n", profile, VERSION </ins> ); t!(fs::write(path, settings));


use std::path::PathBuf; pub static BINARY_PATH: OnceLock<PathBuf> = OnceLock::new(); <del> pub const RUN_OPTION: &str = "*doctest-inner-test"; pub const BIN_OPTION: &str = "*doctest-bin-path"; </del> <ins> pub const RUN_OPTION: &str = "RUSTDOC_DOCTEST_RUN_NB_TEST"; </ins> #[allow(unused)] pub fn doctest_path() -> Option<&'static PathBuf> {{


<ins> fn hello<Q>() -> Vec<Q> { Vec::<Q>::mew() //~^ ERROR no function or associated item named `mew` found for struct `Vec<Q>` in the current scope } fn main() {} </ins>


<ins> // Copyright 2012 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. //compile-flags: -Z borrowck=mir #![feature(slice_patterns)] fn mut_head_tail<'a, A>(v: &'a mut [A]) -> Option<(&'a mut A, &'a mut [A])> { match *v { [ref mut head, ref mut tail..] => { Some((head, tail)) } [] => None } } fn main() { let mut v = [1,2,3,4]; match mut_head_tail(&mut v) { None => {}, Some((h,t)) => { *h = 1000; t.reverse(); } } } </ins>


<ins> error[E0425]: cannot find value `bogus` in this scope --> $DIR/issue-59134-1.rs:8:37 | LL |         const CONST: Self::MyType = bogus.field; |                                     ^^^^^ not found in this scope error: aborting due to previous error For more information about this error, try `rustc --explain E0425`. </ins>


} declare_lint! { <ins> /// The `function_item_references` lint detects function references that are /// formatted with [`fmt::Pointer`] or transmuted. /// /// [`fmt::Pointer`]: https://doc.rust-lang.org/std/fmt/trait.Pointer.html /// /// ### Example /// /// ```rust /// fn foo() { } /// /// fn main() { ///     println!("{:p}", &foo); /// } /// ``` /// /// {{produces}} /// /// ### Explanation /// /// Taking a reference to a function may be mistaken as a way to obtain a /// pointer to that function. This can give unexpected results when /// formatting the reference as a pointer or transmuting it. This lint is /// issued when function references are formatted as pointers, passed as /// arguments bound by [`fmt::Pointer`] or transmuted. pub FUNCTION_ITEM_REFERENCES, Warn, "suggest casting to a function pointer when attempting to take references to function items", } declare_lint! { </ins> /// The `uninhabited_static` lint detects uninhabited statics. /// /// ### Example


/// If a file already exists in the source_map with the same id, that file is returned /// unmodified pub fn new_source_file(&self, filename: FileName, src: String) -> Lrc<SourceFile> { <ins> self.try_new_source_file(filename, src) .unwrap_or_else(|OffsetOverflowError| { eprintln!("fatal error: rustc does not support files larger than 4GB"); errors::FatalError.raise() }) } fn try_new_source_file( &self, filename: FileName, src: String ) -> Result<Lrc<SourceFile>, OffsetOverflowError> { </ins> let start_pos = self.next_start_pos(); // The path is used to determine the directory for loading submodules and


CONST_EVALUATABLE_UNCHECKED, INEFFECTIVE_UNSTABLE_TRAIT_IMPL, UNINHABITED_STATIC, <ins> FUNCTION_ITEM_REFERENCES, </ins> ] }


/// f.read_to_string(&mut buf).unwrap(); /// assert_eq!(&buf, hello); /// ``` <del> #[unstable(feature = "seek_rewind", issue = "85149")] </del> <ins> #[stable(feature = "seek_rewind", since = "1.55.0")] </ins> fn rewind(&mut self) -> Result<()> { self.seek(SeekFrom::Start(0))?; Ok(())


def update_submodules(self): """Update submodules""" <del> if (not os.path.exists(os.path.join(self.rust_root, ".git"))) or  self.get_toml('submodules') == "false": </del> <ins> has_git = os.path.exists(os.path.join(self.rust_root, ".git")) # This just arbitrarily checks for cargo, but any workspace member in # a submodule would work. has_submodules = os.path.exists(os.path.join(self.rust_root, "src/tools/cargo/Cargo.toml")) if not has_git and not has_submodules: print("This is not a git repository, and the requisite git submodules were not found.") print("If you downloaded the source from https://github.com/rust-lang/rust/releases,") print("those sources will not work. Instead, consider downloading from the source") print("releases linked at") print("https://forge.rust-lang.org/infra/other-installation-methods.html#source-code") print("or clone the repository at https://github.com/rust-lang/rust/.") raise SystemExit(1) if not has_git or self.get_toml('submodules') == "false": </ins> return default_encoding = sys.getdefaultencoding()


hasher.finish() }; let end_pos = start_pos.to_usize() + src.len(); <ins> if end_pos > u32::max_value() as usize { return Err(OffsetOverflowError); } </ins> let (lines, multibyte_chars, non_narrow_chars) = analyze_source_file::analyze_source_file(&src[..], start_pos); <del> SourceFile { </del> <ins> Ok(SourceFile { </ins> name, name_was_remapped, unmapped_path: Some(unmapped_path),


fn main() { let x = Foo; x.zero(0)   //~ ERROR this function takes 0 parameters but 1 parameter was supplied <ins> //~^ NOTE expected 0 parameters </ins> .one()     //~ ERROR this function takes 1 parameter but 0 parameters were supplied //~^ NOTE the following parameter type was expected <ins> //~| NOTE expected 1 parameter </ins> .two(0);   //~ ERROR this function takes 2 parameters but 1 parameter was supplied //~^ NOTE the following parameter types were expected <ins> //~| NOTE expected 2 parameters </ins> let y = Foo; y.zero()


<ins> error: expected `;`, found `#` --> $DIR/multiple-tail-expr-behind-cfg.rs:5:64 | LL |     #[cfg(feature = "validation")] |     ------------------------------ only `;` terminated statements or tail expressions are allowed after this attribute LL |     [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>() |                                                                ^ expected `;` here LL |     #[cfg(not(feature = "validation"))] |     - unexpected token | help: add `;` here | LL |     [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>(); |                                                                + help: alternatively, consider surrounding the expression with a block | LL |     { [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>() } |     +                                                             + help: it seems like you are trying to provide different expressions depending on `cfg`, consider using `if cfg!(..)` | LL ~     if cfg!(feature = "validation") { LL ~         [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>() LL ~     } else if cfg!(not(feature = "validation")) { LL ~         String::new() LL +     } | error: expected `;`, found `#` --> $DIR/multiple-tail-expr-behind-cfg.rs:12:64 | LL |     #[attr] |     ------- only `;` terminated statements or tail expressions are allowed after this attribute LL |     [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>() |                                                                ^ expected `;` here LL |     #[attr] |     - unexpected token | help: add `;` here | LL |     [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>(); |                                                                + help: alternatively, consider surrounding the expression with a block | LL |     { [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>() } |     +                                                             + error: cannot find attribute `attr` in this scope --> $DIR/multiple-tail-expr-behind-cfg.rs:13:7 | LL |     #[attr] |       ^^^^ error: aborting due to 3 previous errors </ins>


<ins> // Copyright 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. #![deny(unused_variable)] fn main() { for _ in range(1i, 101) { let x = (); //~ ERROR: unused variable: `x` match () { a => {} //~ ERROR: unused variable: `a` } } } </ins>


signature. Each type parameter must be explicitly declared, in an angle-bracket-enclosed, comma-separated list following the function name. <del> ```{.ignore} fn iter<T, F>(seq: &[T], f: F) where T: Copy, F: Fn(T) { for elt in seq { f(*elt); } } fn map<T, U, F>(seq: &[T], f: F) -> Vec<U> where T: Copy, U: Copy, F: Fn(T) -> U { let mut acc = vec![]; for elt in seq { acc.push(f(*elt)); } acc } </del> <ins> ```rust,ignore // foo is generic over A and B fn foo<A, B>(x: A, y: B) { </ins> ``` Inside the function signature and body, the name of the type parameter can be used as a type name. [Trait](#traits) bounds can be specified for type parameters to allow methods with that trait to be called on values of that type. This is <del> specified using the `where` syntax, as in the above example. </del> <ins> specified using the `where` syntax: ```rust,ignore fn foo<T>(x: T) where T: Debug { ``` </ins> When a generic function is referenced, its type is instantiated based on the context of the reference. For example, calling the `iter` function defined


#![allow(unused_variables)]; //~ ERROR expected item, found `;` <del> //~^ ERROR `main` function </del> fn foo() {} <ins> //~^ ERROR `main` function </ins>


See [LICENSE-APACHE](LICENSE-APACHE), [LICENSE-MIT](LICENSE-MIT), and [COPYRIGHT](COPYRIGHT) for details. <ins> ## Trademark [trademark]: #trademark The Rust programming language is an open source, community project governed by a core team. It is also sponsored by the Mozilla Foundation (“Mozilla”), which owns and protects the Rust and Cargo trademarks and logos (the “Rust Trademarks”). If you want to use these names or brands, please read the [media guide][media-guide]. Third-party logos may be subject to third-party copyrights and trademarks. See [Licenses][policies-licenses] for details. [media-guide]: https://www.rust-lang.org/policies/media-guide [policies-licenses]: https://www.rust-lang.org/policies/licenses </ins>


#[rustc_const_unstable(feature = "const_waker", issue = "102012")] pub const fn build(self) -> Context<'a> { let ContextBuilder { waker, local_waker, ext, _marker, _marker2 } = self; <del> Context { waker, local_waker, ext, _marker, _marker2 } </del> <ins> Context { waker, local_waker, ext: AssertUnwindSafe(ext), _marker, _marker2 } </ins> } }


///     } /// } /// ``` <del> fn lower_expr_await(&mut self, await_span: Span, expr: &Expr) -> hir::ExprKind<'hir> { let dot_await_span = expr.span.shrink_to_hi().to(await_span); </del> <ins> fn lower_expr_await(&mut self, dot_await_span: Span, expr: &Expr) -> hir::ExprKind<'hir> { let full_span = expr.span.to(dot_await_span); </ins> match self.generator_kind { Some(hir::GeneratorKind::Async(_)) => {} Some(hir::GeneratorKind::Gen) | None => { let mut err = struct_span_err!( self.sess, <del> await_span, </del> <ins> dot_await_span, </ins> E0728, "`await` is only allowed inside `async` functions and blocks" ); <del> err.span_label(await_span, "only allowed inside `async` functions and blocks"); </del> <ins> err.span_label(dot_await_span, "only allowed inside `async` functions and blocks"); </ins> if let Some(item_sp) = self.current_item { err.span_label(item_sp, "this is not `async`"); }


<ins> // compile-flags:--test // run-pass // ignore-emscripten no subprocess support use std::fmt; use std::fmt::{Display, Formatter}; pub struct A(Vec<u32>); impl Display for A { fn fmt(&self, _f: &mut Formatter<'_>) -> fmt::Result { self.0[0]; Ok(()) } } #[test] fn main() { let result = std::panic::catch_unwind(|| { let a = A(vec![]); eprintln!("{}", a); }); assert!(result.is_err()); } </ins>


<ins> error: using function pointers as const generic parameters is forbidden --> $DIR/default-ty-closure.rs:3:20 | LL | struct X<const FN: fn() = { || {} }>; |                    ^^^^ | = note: the only supported types are integers, `bool` and `char` error: aborting due to 1 previous error </ins>


<ins> // Copyright 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. // no-prefer-dynamic #[crate_id = "collections#0.10-pre"]; #[crate_type = "dylib"]; </ins>


let err = LifetimeOutliveErr { span: *span }; let mut diag = self.infcx.tcx.sess.create_err(err); <del> let fr_name = self.give_region_a_name(*fr).unwrap(); </del> <ins> // In certain scenarios, such as the one described in issue #118021, // we might encounter a lifetime that cannot be named. // These situations are bound to result in errors. // To prevent an immediate ICE, we opt to create a dummy name instead. let fr_name = self.give_region_a_name(*fr).unwrap_or(RegionName { name: kw::UnderscoreLifetime, source: RegionNameSource::Static, }); </ins> fr_name.highlight_region_name(&mut diag); let outlived_fr_name = self.give_region_a_name(*outlived_fr).unwrap(); outlived_fr_name.highlight_region_name(&mut diag);


participle: &'tcx str, name_list: DiagSymbolList, #[subdiagnostic] <del> change_fields_suggestion: ChangeFieldsToBeOfUnitType, </del> <ins> change_fields_suggestion: ChangeFields, </ins> #[subdiagnostic] parent_info: Option<ParentInfo<'tcx>>, #[subdiagnostic]


[78429]: https://github.com/rust-lang/rust/pull/78429 [82733]: https://github.com/rust-lang/rust/pull/82733 [82594]: https://github.com/rust-lang/rust/pull/82594 <ins> [79078]: https://github.com/rust-lang/rust/pull/79078 </ins> [cargo/9181]: https://github.com/rust-lang/cargo/pull/9181 [`char::MAX`]: https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.MAX [`char::REPLACEMENT_CHARACTER`]: https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.REPLACEMENT_CHARACTER


cx.span_lint(UNUSED_RESULTS, s.span, "unused result"); } <del> fn check_must_use( </del> <ins> // Returns whether an error has been emitted (and thus another does not need to be later). fn check_must_use_ty<'tcx>( cx: &LateContext<'_, 'tcx>, ty: Ty<'tcx>, expr: &hir::Expr, span: Span, descr_post_path: &str, ) -> bool { if ty.is_unit() || cx.tcx.is_ty_uninhabited_from( cx.tcx.hir().get_module_parent_by_hir_id(expr.hir_id), ty) { return true; } match ty.sty { ty::Adt(def, _) => check_must_use_def(cx, def.did, span, "", descr_post_path), ty::Opaque(def, _) => { let mut has_emitted = false; for (predicate, _) in &cx.tcx.predicates_of(def).predicates { if let ty::Predicate::Trait(ref poly_trait_predicate) = predicate { let trait_ref = poly_trait_predicate.skip_binder().trait_ref; let def_id = trait_ref.def_id; if check_must_use_def(cx, def_id, span, "implementer of ", "") { has_emitted = true; break; } } } has_emitted } ty::Dynamic(binder, _) => { let mut has_emitted = false; for predicate in binder.skip_binder().iter() { if let ty::ExistentialPredicate::Trait(ref trait_ref) = predicate { let def_id = trait_ref.def_id; if check_must_use_def(cx, def_id, span, "", " trait object") { has_emitted = true; break; } } } has_emitted } ty::Tuple(ref tys) => { let mut has_emitted = false; let spans = if let hir::ExprKind::Tup(comps) = &expr.node { debug_assert_eq!(comps.len(), tys.len()); comps.iter().map(|e| e.span).collect() } else { vec![] }; for (i, ty) in tys.iter().map(|k| k.expect_ty()).enumerate() { let descr_post_path = &format!(" in tuple element {}", i); let span = *spans.get(i).unwrap_or(&span); if check_must_use_ty(cx, ty, expr, span, descr_post_path) { has_emitted = true; } } has_emitted } _ => false, } } // Returns whether an error has been emitted (and thus another does not need to be later). fn check_must_use_def( </ins> cx: &LateContext<'_, '_>, def_id: DefId, <del> sp: Span, </del> <ins> span: Span, </ins> descr_pre_path: &str, descr_post_path: &str, ) -> bool {


// We only want to handle exclusive (`..`) ranges, // which are represented as `ExprKind::Struct`. if let ExprKind::Struct(_, eps, _) = &parent_expr.node { <del> debug_assert_eq!(eps.len(), 2); </del> <ins> if eps.len() != 2 { return false; } </ins> // We can suggest using an inclusive range // (`..=`) instead only if it is the `end` that is // overflowing and only by 1.


fn resolve( &self, path_str: &str, <ins> disambiguator: Option<&str>, </ins> ns: Namespace, current_item: &Option<String>, parent_id: Option<hir::HirId>,


<ins> // issue: rust-lang/rust#127868 fn main() { let a = [[[[[[[[[[[[[[[[[[[[1, {, (, [,; } //~ ERROR mismatched closing delimiter: `}` //~ ERROR this file contains an unclosed delimiter </ins>


#![feature(thread_local)] #![feature(trace_macros)] #![feature(trusted_len)] <del> #![feature(vec_remove_item)] </del> #![feature(stmt_expr_attributes)] #![feature(integer_atomics)] #![feature(test)]


item_name ) }).unwrap(); <del> let impl_span = fcx.tcx().map.def_id_span(impl_did, span); let item_span = fcx.tcx().map.def_id_span(item.def_id(), impl_span); </del> <ins> let note_span = fcx.tcx().map.span_if_local(item.def_id()).or_else(|| { fcx.tcx().map.span_if_local(impl_did) }); </ins> let impl_ty = check::impl_self_ty(fcx, span, impl_did).ty;


return (level, src) } <del> fn get_lint_id_level(&self, id: LintId, mut idx: u32) </del> <ins> fn get_lint_id_level(&self, id: LintId, mut idx: u32, aux: Option<&FxHashMap<LintId, (Level, LintSource)>>) </ins> -> (Option<Level>, LintSource) { <ins> if let Some(specs) = aux { if let Some(&(level, src)) = specs.get(&id) { return (Some(level), src) } } </ins> loop { match self.list[idx as usize] { LintSet::CommandLine { ref specs } => {


libc::execvp(self.get_argv()[0], self.get_argv().as_ptr()); io::Error::last_os_error() } <ins> #[cfg(not(any(target_os = "macos", target_os = "freebsd")))] fn posix_spawn(&mut self, _stdio: &ChildPipes, _envp: Option<&CStringArray>) -> io::Result<Option<Process>> { Ok(None) } #[cfg(any(target_os = "macos", target_os = "freebsd"))] fn posix_spawn(&mut self, stdio: &ChildPipes, envp: Option<&CStringArray>) -> io::Result<Option<Process>> { use mem; use sys; if self.get_cwd().is_some() || self.get_gid().is_some() || self.get_uid().is_some() || self.get_closures().len() != 0 { return Ok(None) } let mut p = Process { pid: 0, status: None }; struct PosixSpawnFileActions(libc::posix_spawn_file_actions_t); impl Drop for PosixSpawnFileActions { fn drop(&mut self) { unsafe { libc::posix_spawn_file_actions_destroy(&mut self.0); } } } struct PosixSpawnattr(libc::posix_spawnattr_t); impl Drop for PosixSpawnattr { fn drop(&mut self) { unsafe { libc::posix_spawnattr_destroy(&mut self.0); } } } unsafe { let mut file_actions = PosixSpawnFileActions(mem::uninitialized()); let mut attrs = PosixSpawnattr(mem::uninitialized()); libc::posix_spawnattr_init(&mut attrs.0); libc::posix_spawn_file_actions_init(&mut file_actions.0); if let Some(fd) = stdio.stdin.fd() { cvt(libc::posix_spawn_file_actions_adddup2(&mut file_actions.0, fd, libc::STDIN_FILENO))?; } if let Some(fd) = stdio.stdout.fd() { cvt(libc::posix_spawn_file_actions_adddup2(&mut file_actions.0, fd, libc::STDOUT_FILENO))?; } if let Some(fd) = stdio.stderr.fd() { cvt(libc::posix_spawn_file_actions_adddup2(&mut file_actions.0, fd, libc::STDERR_FILENO))?; } let mut set: libc::sigset_t = mem::uninitialized(); cvt(libc::sigemptyset(&mut set))?; cvt(libc::posix_spawnattr_setsigmask(&mut attrs.0, &set))?; cvt(libc::sigaddset(&mut set, libc::SIGPIPE))?; cvt(libc::posix_spawnattr_setsigdefault(&mut attrs.0, &set))?; let flags = libc::POSIX_SPAWN_SETSIGDEF | libc::POSIX_SPAWN_SETSIGMASK; cvt(libc::posix_spawnattr_setflags(&mut attrs.0, flags as _))?; let envp = envp.map(|c| c.as_ptr()) .unwrap_or(*sys::os::environ() as *const _); let ret = libc::posix_spawnp( &mut p.pid, self.get_argv()[0], &file_actions.0, &attrs.0, self.get_argv().as_ptr() as *const _, envp as *const _, ); if ret == 0 { Ok(Some(p)) } else { Err(io::Error::from_raw_os_error(ret)) } } } </ins> } ////////////////////////////////////////////////////////////////////////////////


span: name_binding.span, segments: path_segments, }; <del> result = Some((module, ImportSuggestion { path })); </del> <ins> let did = module.def().and_then(|def| def.opt_def_id()); result = Some((module, ImportSuggestion { did, path })); </ins> } else { // add the module to the lookup if seen_modules.insert(module.def_id().unwrap()) {


expr.id, method_call, r.datum.to_string(ccx)); return r; <del> /// We microoptimize derefs of owned pointers a bit here. Basically, the idea is to make the /// deref of an rvalue result in an rvalue. This helps to avoid intermediate stack slots in the /// resulting LLVM. The idea here is that, if the `Box<T>` pointer is an rvalue, then we can /// schedule a *shallow* free of the `Box<T>` pointer, and then return a ByRef rvalue into the /// pointer. Because the free is shallow, it is legit to return an rvalue, because we know that /// the contents are not yet scheduled to be freed. The language rules ensure that the contents /// will be used (or moved) before the free occurs. fn deref_owned_pointer<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, expr: &ast::Expr, datum: Datum<'tcx, Expr>, content_ty: Ty<'tcx>) -> DatumBlock<'blk, 'tcx, Expr> { match datum.kind { RvalueExpr(Rvalue { mode: ByRef }) => { let scope = cleanup::temporary_scope(bcx.tcx(), expr.id); let ptr = Load(bcx, datum.val); if !type_is_zero_size(bcx.ccx(), content_ty) { bcx.fcx.schedule_free_value(scope, ptr, cleanup::HeapExchange, content_ty); } } RvalueExpr(Rvalue { mode: ByValue }) => { let scope = cleanup::temporary_scope(bcx.tcx(), expr.id); if !type_is_zero_size(bcx.ccx(), content_ty) { bcx.fcx.schedule_free_value(scope, datum.val, cleanup::HeapExchange, content_ty); } } LvalueExpr => { } } // If we had an rvalue in, we produce an rvalue out. let (llptr, kind) = match datum.kind { LvalueExpr => { (Load(bcx, datum.val), LvalueExpr) } RvalueExpr(Rvalue { mode: ByRef }) => { (Load(bcx, datum.val), RvalueExpr(Rvalue::new(ByRef))) } RvalueExpr(Rvalue { mode: ByValue }) => { (datum.val, RvalueExpr(Rvalue::new(ByRef))) } }; let datum = Datum { ty: content_ty, val: llptr, kind: kind }; DatumBlock { bcx: bcx, datum: datum } } </del> } #[derive(Debug)]


HashSet, Hasher, Implied, <ins> IndexOutput, </ins> Input, Into, IntoDiagnostic,


let expn_id = ext_cx.resolver.expansion_for_ast_pass( DUMMY_SP, AstPass::TestHarness, <del> &[sym::test, sym::rustc_attrs], </del> <ins> &[sym::test, sym::rustc_attrs, sym::no_coverage], </ins> None, ); let def_site = DUMMY_SP.with_def_site_ctxt(expn_id.to_expn_id());


///     Ok(()) /// } /// ``` <del> #[unstable(feature = "buffered_io_capacity", issue = "68833")] </del> <ins> #[stable(feature = "buffered_io_capacity", since = "1.46.0")] </ins> pub fn capacity(&self) -> usize { self.buf.len() }


<ins> warning: the feature `const_generics` is incomplete and may cause the compiler to crash --> $DIR/issue-70167.rs:3:12 | LL | #![feature(const_generics)] |            ^^^^^^^^^^^^^^ | = note: `#[warn(incomplete_features)]` on by default </ins>


<ins> // #125634 struct Thing; // Invariant in 'a, Covariant in 'b struct TwoThings<'a, 'b>(*mut &'a (), &'b mut ()); impl Thing { fn enter_scope<'a>(self, _scope: impl for<'b> FnOnce(TwoThings<'a, 'b>)) {} } fn foo() { Thing.enter_scope(|ctx| { SameLifetime(ctx); //~ ERROR lifetime may not live long enough }); } struct SameLifetime<'a>(TwoThings<'a, 'a>); fn main() {} </ins>


<ins> // compile-flags:-C panic=abort // only-x86_64 #![feature(target_feature_11)] #![no_std] #![no_main] use core::panic::PanicInfo; #[panic_handler] #[target_feature(enable = "avx2")] //~^ ERROR `panic_impl` language item function is not allowed to have `#[target_feature]` fn panic(info: &PanicInfo) -> ! { unimplemented!(); } </ins>


last } <ins> /// True if a fragment of type `frag` can be followed by any sort of /// token.  We use this (among other things) as a useful approximation /// for when `frag` can be followed by a repetition like `$(...)*` or /// `$(...)+`. In general, these can be a bit tricky to reason about, /// so we adopt a conservative position that says that any fragment /// specifier which consumes at most one token tree can be followed by /// a fragment specifier (indeed, these fragments can be followed by /// ANYTHING without fear of future compatibility hazards). fn can_be_followed_by_any(frag: &str) -> bool { match frag { "item" |  // always terminated by `}` or `;` "block" | // exactly one token tree "ident" | // exactly one token tree "meta" |  // exactly one token tree "tt" =>    // exactly one token tree true, _ => false, } } /// True if `frag` can legally be followed by the token `tok`. For /// fragments that can consume an unbounded numbe of tokens, `tok` /// must be within a well-defined follow set. This is intended to /// guarantee future compatibility: for example, without this rule, if /// we expanded `expr` to include a new binary operator, we might /// break macros that were relying on that binary operator as a /// separator. </ins> fn is_in_follow(_: &ExtCtxt, tok: &Token, frag: &str) -> Result<bool, String> { if let &CloseDelim(_) = tok { <ins> // closing a token tree can never be matched by any fragment; // iow, we always require that `(` and `)` match, etc. </ins> Ok(true) } else { match frag {


"before", ":51] { foo += 1; eprintln!("before"); 7331 } = 7331", <ins> ":59] ("Yeah",) = (", "    "Yeah",", ")", ":62] 1 = 1", ":62] 2 = 2", ":66] 1u8 = 1", ":66] 2u32 = 2", ":66] "Yeah" = "Yeah"", </ins> ]); }


<ins> // Copyright 2016 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 main() { let tup = (0, 1, 2); // the case where we show a suggestion let _ = tup[0]; //~^ ERROR cannot index a value of type //~| HELP to access tuple elements, use tuple indexing syntax as shown //~| SUGGESTION let _ = tup.0 // the case where we show just a general hint let i = 0_usize; let _ = tup[i]; //~^ ERROR cannot index a value of type //~| HELP to access tuple elements, use tuple indexing syntax (e.g. `tuple.0`) } </ins>


let trait_ref = projection.to_poly_trait_ref(tcx); let is_fn = tcx.lang_items().fn_trait_kind(trait_ref.def_id()).is_some(); <del> let gen_trait = tcx.lang_items().gen_trait().unwrap(); </del> <ins> let gen_trait = tcx.require_lang_item(lang_items::GeneratorTraitLangItem); </ins> let is_gen = gen_trait == trait_ref.def_id(); if !is_fn && !is_gen { debug!("deduce_sig_from_projection: not fn or generator");


#[inline] pub(crate) fn extend_from_slice(&mut self, other: &[u8]) { self.bytes.extend_from_slice(other); <del> self.is_known_utf8 = self.is_known_utf8 || self.next_surrogate(0).is_none(); </del> <ins> self.is_known_utf8 = false; </ins> } }


_ => &[], }; let lt_def_names = parent_generics.iter().filter_map(|param| match param.kind { <del> hir::GenericParamKind::Lifetime { .. } => Some(param.name.ident().modern()), </del> <ins> hir::GenericParamKind::Lifetime { .. } => Some(param.name.modern()), </ins> _ => None, }); self.in_scope_lifetimes.extend(lt_def_names);


<ins> // run-pass #![feature(bench_black_box)] use std::hint; struct U16(u16); impl Drop for U16 { fn drop(&mut self) { // Prevent LLVM from optimizing away our alignment check. assert!(hint::black_box(self as *mut U16 as usize) % 2 == 0); } } struct HasDrop; impl Drop for HasDrop { fn drop(&mut self) {} } struct Wrapper { _a: U16, b: HasDrop, } #[repr(packed)] struct Misalign(u8, Wrapper); fn main() { let m = Misalign( 0, Wrapper { _a: U16(10), b: HasDrop, }, ); // Put it somewhere definitely even (so the `a` field is definitely at an odd address). let m: ([u16; 0], Misalign) = ([], m); // Move out one field, so we run custom per-field drop logic below. let _x = m.1.1.b; } </ins>


<ins> error: argument to `panic!()` in a const context must have type `&str` --> $DIR/issue-66693.rs:13:5 | LL |     panic!(&1); |     ^^^^^^^^^^^ | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error: argument to `panic!()` in a const context must have type `&str` --> $DIR/issue-66693.rs:6:15 | LL | const _: () = panic!(1); |               ^^^^^^^^^ | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error: argument to `panic!()` in a const context must have type `&str` --> $DIR/issue-66693.rs:9:19 | LL | static _FOO: () = panic!(true); |                   ^^^^^^^^^^^^ | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors </ins>


//! [rust-discord]: https://discord.gg/rust-lang //! [array]: prim@array //! [slice]: prim@slice // To run std tests without x.py without ending up with two copies of std, Miri needs to be // able to "empty" this crate. See <https://github.com/rust-lang/miri-test-libstd/issues/4>. // rustc itself never sets the feature, so this line has no effect there.


<ins> // Regression test: if we suggest replacing an `impl Trait` argument to an async // fn with a named type parameter in order to add bounds, the suggested function // signature should be well-formed. // // edition:2018 trait Foo { type Bar; fn bar(&self) -> Self::Bar; } async fn run(_: &(), foo: impl Foo) -> std::io::Result<()> { let bar = foo.bar(); assert_is_send(&bar); //~^ ERROR: `<impl Foo as Foo>::Bar` cannot be sent between threads safely Ok(()) } // Test our handling of cases where there is a generic parameter list in the // source, but only synthetic generic parameters async fn run2< >(_: &(), foo: impl Foo) -> std::io::Result<()> { let bar = foo.bar(); assert_is_send(&bar); //~^ ERROR: `<impl Foo as Foo>::Bar` cannot be sent between threads safely Ok(()) } fn assert_is_send<T: Send>(_: &T) {} fn main() {} </ins>


} fn check_overalign_requests<T: Alloc>(mut allocator: T) { <del> let size = 8; let align = 16; // greater than size let iterations = 100; unsafe { let pointers: Vec<_> = (0..iterations).map(|_| { allocator.alloc(Layout::from_size_align(size, align).unwrap()).unwrap() }).collect(); for &ptr in &pointers { assert_eq!((ptr.as_ptr() as usize) % align, 0, "Got a pointer less aligned than requested") } </del> <ins> for &align in &[4, 8, 16, 32] { // less than and bigger than `MIN_ALIGN` for &size in &[align/2, align-1] { // size less than alignment let iterations = 128; unsafe { let pointers: Vec<_> = (0..iterations).map(|_| { allocator.alloc(Layout::from_size_align(size, align).unwrap()).unwrap() }).collect(); for &ptr in &pointers { assert_eq!((ptr.as_ptr() as usize) % align, 0, "Got a pointer less aligned than requested") } </ins> <del> // Clean up for &ptr in &pointers { allocator.dealloc(ptr, Layout::from_size_align(size, align).unwrap()) </del> <ins> // Clean up for &ptr in &pointers { allocator.dealloc(ptr, Layout::from_size_align(size, align).unwrap()) } } </ins> } } }


}, x => { <del> bug!("unexpected sort of node in type_of_def_id(): {:?}", x); </del> <ins> bug!("unexpected sort of node in type_of(): {:?}", x); </ins> } } }


RUST_CONFIGURE_ARGS=--build=x86_64-apple-darwin SRC=. os: osx <ins> before_script: &osx_before_script > ulimit -c unlimited </ins> install: &osx_install_sccache > curl -L https://api.pub.build.mozilla.org/tooltool/sha512/d0025b286468cc5ada83b23d3fafbc936b9f190eaa7d4a981715b18e8e3bf720a7bcee7bfe758cfdeb8268857f6098fd52dcdd8818232692a30ce91039936596 | tar xJf - -C /usr/local/bin --strip-components=1 <ins> after_failure: &osx_after_failure > echo 'bt all' > cmds; for file in $(ls /cores); do echo core file $file; lldb -c $file `which ld` -b -s cmds; done </ins> - env: > RUST_CHECK_TARGET=check RUST_CONFIGURE_ARGS=--build=i686-apple-darwin SRC=. os: osx <ins> before_script: *osx_before_script </ins> install: *osx_install_sccache <ins> after_failure: *osx_after_failure </ins> - env: > RUST_CHECK_TARGET=check RUST_CONFIGURE_ARGS=--build=x86_64-apple-darwin --disable-rustbuild SRC=. os: osx <ins> before_script: *osx_before_script </ins> install: *osx_install_sccache <ins> after_failure: *osx_after_failure </ins> - env: > RUST_CHECK_TARGET= RUST_CONFIGURE_ARGS=--target=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,i386-apple-ios,x86_64-apple-ios SRC=. os: osx <ins> before_script: *osx_before_script </ins> install: *osx_install_sccache <ins> after_failure: *osx_after_failure </ins> env: global:


NonZeroUsize::new(remaining).map_or(Ok(()), Err) } <ins> #[inline] unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item { // SAFETY: The caller must provide an idx that is in bound of the remainder. unsafe { self.data.as_ptr().add(self.alive.start()).add(idx).cast::<T>().read() } } </ins> } #[stable(feature = "array_value_iter_impls", since = "1.40.0")]


<ins> error: named argument `world` is not used by name --> $DIR/sugg_with_positional_args_and_debug_fmt.rs:6:28 | LL |     println!("hello {:?}", world = "world"); |                     ----   ^^^^^ this named argument is referred to by position in formatting string |                     | |                     this formatting argument uses named argument `world` by position | note: the lint level is defined here --> $DIR/sugg_with_positional_args_and_debug_fmt.rs:3:9 | LL | #![deny(warnings)] |         ^^^^^^^^ = note: `#[deny(named_arguments_used_positionally)]` implied by `#[deny(warnings)]` help: use the named argument by name to avoid ambiguity | LL |     println!("hello {world:?}", world = "world"); |                      +++++ error: aborting due to previous error </ins>


n => { let m = cmp::min(n, self.steals); self.steals -= m; <del> self.cnt.fetch_add(n - m, atomics::SeqCst); </del> <ins> self.bump(n - m); </ins> } } assert!(self.steals >= 0); } <ins> self.steals += 1; </ins> Ok(data) }


<del> // no-prefer-dynamic </del> static mut DROP_RAN: bool = false; struct Foo;


<del> // no-prefer-dynamic </del> // ignore-cloudabi // ignore-emscripten // ignore-sgx no processes


<ins> // run-rustfix fn wat<T: Clone>(t: &T) -> T { t.clone() //~ ERROR E0308 } #[derive(Clone)] struct Foo; fn wut(t: &Foo) -> Foo { t.clone() //~ ERROR E0308 } fn main() { wat(&42); wut(&Foo); } </ins>


let it = xs.iter_mut().map(|x| *x = 1).enumerate().zip(&ys); it.count(); } <del> assert_eq!(&xs, &[1, 1, 1, 1, 1, 0]); </del> <ins> let length_aware =  &xs == &[1, 1, 1, 1, 0, 0]; let probe_first = &xs == &[1, 1, 1, 1, 1, 0]; // either implementation is valid according to zip documentation assert!(length_aware || probe_first); </ins> } #[test]


<del> error: unmatched angle bracket </del> <ins> error: expected one of `!`, `+`, `::`, `;`, `where`, or `{`, found `>` </ins> --> $DIR/issue-24780.rs:5:23 | LL | fn foo() -> Vec<usize>> { <del> |                       ^^ help: remove extra angle bracket </del> <ins> |                       ^ expected one of `!`, `+`, `::`, `;`, `where`, or `{` </ins> error: aborting due to previous error


let buildpath = fs::connect(_path, "/test"); need_dir(buildpath); #debug("Testing: %s -> %s", cf, buildpath); <del> let p = run::program_output("rustc", ["--out-dir", buildpath, "--test", cf]); </del> <ins> let p = run::program_output(rustc_sysroot(), ["--out-dir", buildpath, "--test", cf]); </ins> if p.status != 0 { error(#fmt["rustc failed: %dn%sn%s", p.status, p.err, p.out]); ret;


args.push(~"-dynamiclib"); args.push(~"-Wl,-dylib"); // FIXME (#9639): This needs to handle non-utf8 paths <del> args.push(~"-Wl,-install_name,@rpath/" + out_filename.filename_str().unwrap()); </del> <ins> if !sess.opts.no_rpath { args.push(~"-Wl,-install_name,@rpath/" + out_filename.filename_str().unwrap()); } </ins> } else { args.push(~"-shared") }


<ins> // issue: rust-lang/rust#125081 fn main() { let _: &str = 'β; //~^ ERROR expected `while`, `for`, `loop` or `{` after a label //~| ERROR mismatched types } </ins>


hir::ItemEnum(..)        | hir::ItemStruct(..)      | hir::ItemUnion(..)       => { <del> false </del> <ins> (false, false) </ins> } };


<ins> // edition:2018 fn main() { use a::ModPrivateStruct; let Box { 0: _, .. }: Box<()>; //~ ERROR field `0` of let Box { 1: _, .. }: Box<()>; //~ ERROR field `1` of let ModPrivateStruct { 1: _, .. } = ModPrivateStruct::default(); //~ ERROR field `1` of } mod a { #[derive(Default)] pub struct ModPrivateStruct(u8, u8); } </ins>


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


self.delegate.push_verify(origin, GenericKind::Alias(alias_ty), region, verify_bound); } <ins> #[instrument(level = "debug", skip(self))] </ins> fn substs_must_outlive( &mut self, substs: SubstsRef<'tcx>, origin: infer::SubregionOrigin<'tcx>, region: ty::Region<'tcx>, <ins> opt_variances: Option<&[ty::Variance]>, </ins> ) { let constraint = origin.to_constraint_category(); <del> for k in substs { </del> <ins> for (index, k) in substs.iter().enumerate() { </ins> match k.unpack() { GenericArgKind::Lifetime(lt) => { <del> self.delegate.push_sub_region_constraint( origin.clone(), region, lt, constraint, ); </del> <ins> let variance = if let Some(variances) = opt_variances { variances[index] } else { ty::Invariant }; if variance == ty::Invariant { self.delegate.push_sub_region_constraint( origin.clone(), region, lt, constraint, ); } </ins> } GenericArgKind::Type(ty) => { self.type_must_outlive(origin.clone(), ty, region, constraint);


source shared.sh <del> LLVM=llvmorg-11.0.1 </del> <ins> LLVM=llvmorg-10.0.0 </ins> mkdir llvm-project cd llvm-project


"Force drop flag checks on or off"), trace_macros: bool = (false, parse_bool, "For every macro invocation, print its name and arguments"), <del> disable_nonzeroing_move_hints: bool = (false, parse_bool, "Force nonzeroing move optimization off"), </del> <ins> enable_nonzeroing_move_hints: bool = (false, parse_bool, "Force nonzeroing move optimization on"), </ins> } pub fn default_lib_output() -> CrateType {


} } <del> fn no_such_field_err<T: Display>( </del> <ins> fn no_such_field_err( </ins> &self, <del> span: Span, field: T, expr_t: &ty::TyS<'_>, </del> <ins> field: Ident, expr_t: &'tcx ty::TyS<'tcx>, </ins> ) -> DiagnosticBuilder<'_> { <del> type_error_struct!( </del> <ins> let span = field.span; debug!("no_such_field_err(span: {:?}, field: {:?}, expr_t: {:?})", span, field, expr_t); let mut err = type_error_struct!( </ins> self.tcx().sess, <del> span, </del> <ins> field.span, </ins> expr_t, E0609, "no field `{}` on type `{}`", field, expr_t <del> ) </del> <ins> ); // try to add a suggestion in case the field is a nested field of a field of the Adt if let Some((fields, substs)) = self.get_field_candidates(span, &expr_t) { for candidate_field in fields.iter() { if let Some(field_path) = self.check_for_nested_field(span, field, candidate_field, substs, vec![]) { let field_path_str = field_path .iter() .map(|id| id.name.to_ident_string()) .collect::<Vec<String>>() .join("."); debug!("field_path_str: {:?}", field_path_str); err.span_suggestion_verbose( field.span.shrink_to_lo(), "one of the expressions' fields has a field of the same name", format!("{}.", field_path_str), Applicability::MaybeIncorrect, ); } } } err } fn get_field_candidates( &self, span: Span, base_t: Ty<'tcx>, ) -> Option<(&Vec<ty::FieldDef>, SubstsRef<'tcx>)> { debug!("get_field_candidates(span: {:?}, base_t: {:?}", span, base_t); let mut autoderef = self.autoderef(span, base_t); while let Some((base_t, _)) = autoderef.next() { match base_t.kind() { ty::Adt(base_def, substs) if !base_def.is_enum() => { let fields = &base_def.non_enum_variant().fields; // For compile-time reasons put a limit on number of fields we search if fields.len() > 100 { return None; } return Some((fields, substs)); } _ => {} } } None } /// This method is called after we have encountered a missing field error to recursively /// search for the field fn check_for_nested_field( &self, span: Span, target_field: Ident, candidate_field: &ty::FieldDef, subst: SubstsRef<'tcx>, mut field_path: Vec<Ident>, ) -> Option<Vec<Ident>> { debug!( "check_for_nested_field(span: {:?}, candidate_field: {:?}, field_path: {:?}", span, candidate_field, field_path ); if candidate_field.ident == target_field { Some(field_path) } else if field_path.len() > 3 { // For compile-time reasons and to avoid infinite recursion we only check for fields // up to a depth of three None } else { // recursively search fields of `candidate_field` if it's a ty::Adt field_path.push(candidate_field.ident.normalize_to_macros_2_0()); let field_ty = candidate_field.ty(self.tcx, subst); if let Some((nested_fields, _)) = self.get_field_candidates(span, &field_ty) { for field in nested_fields.iter() { let ident = field.ident.normalize_to_macros_2_0(); if ident == target_field { return Some(field_path); } else { let field_path = field_path.clone(); if let Some(path) = self.check_for_nested_field( span, target_field, field, subst, field_path, ) { return Some(path); } } } } None } </ins> } fn check_expr_index(


}, base_t, None); <ins> // Try to give some advice about indexing tuples. if let ty::TyTuple(_) = base_t.sty { let mut needs_note = true; // If the index is an integer, we can show the actual // fixed expression: if let hir::ExprLit(ref lit) = idx.node { if let ast::LitKind::Int(i, ast::LitIntType::Unsuffixed) = lit.node { let snip = fcx.tcx().sess.codemap().span_to_snippet(base.span); if let Ok(snip) = snip { err.span_suggestion(expr.span, "to access tuple elements, use tuple  indexing syntax as shown", format!("{}.{}", snip, i)); needs_note = false; } } } if needs_note { err.help("to access tuple elements, use tuple indexing  syntax (e.g. `tuple.0`)"); } } err.emit(); </ins> fcx.write_ty(id, fcx.tcx().types.err); } }


error[E0277]: the trait bound `NotDebugOrDisplay: Marker` is not satisfied <del> --> $DIR/overlap-marker-trait.rs:27:17 </del> <ins> --> $DIR/overlap-marker-trait.rs:28:17 </ins> | LL |     is_marker::<NotDebugOrDisplay>(); |                 ^^^^^^^^^^^^^^^^^ the trait `Marker` is not implemented for `NotDebugOrDisplay` | note: required by a bound in `is_marker` <del> --> $DIR/overlap-marker-trait.rs:15:17 </del> <ins> --> $DIR/overlap-marker-trait.rs:16:17 </ins> | LL | fn is_marker<T: Marker>() { } |                 ^^^^^^ required by this bound in `is_marker`


<ins> fn foo() { let x = Tr<A, A:>; //~^ ERROR expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `,` } fn main() {} </ins>


<ins> // revisions: min_const_fn const_fn // run-pass #![cfg_attr(const_fn, feature(const_fn))] trait ConstDefault { const DEFAULT: Self; } #[derive(PartialEq)] enum E { V(i32), W(usize), } impl ConstDefault for E { const DEFAULT: Self = Self::V(23); } impl ConstDefault for Option<i32> { const DEFAULT: Self = Self::Some(23); } impl E { const NON_DEFAULT: Self = Self::W(12); const fn local_fn() -> Self { Self::V(23) } } const fn explicit_qpath() -> E { let _x = <Option<usize>>::Some(23); <E>::W(12) } fn main() { assert!(E::DEFAULT == E::local_fn()); assert!(Option::DEFAULT == Some(23)); assert!(E::NON_DEFAULT == explicit_qpath()); } </ins>


probe CFG_FLEX             flex probe CFG_BISON            bison probe CFG_PANDOC           pandoc <del> probe CFG_PDFLATEX         pdflatex </del> probe CFG_XELATEX          xelatex <del> probe CFG_LUALATEX         lualatex </del> probe CFG_GDB              gdb probe CFG_LLDB             lldb


pub struct FrozenTupleStruct(pub int); #[locked] pub struct LockedTupleStruct(pub int); <ins> #[macro_export] macro_rules! macro_test( () => (deprecated()); ) </ins>


def read_current_status(current_commit, path): <ins> # type: (str, str) -> typing.Mapping[str, typing.Any] </ins> '''Reads build status of `current_commit` from content of `history/*.tsv` ''' <del> with open(path, 'rU') as f: </del> <ins> with open(path, 'r') as f: </ins> for line in f: (commit, status) = line.split('t', 1) if commit == current_commit:


cargo.env("RUSTC_TLS_MODEL_INITIAL_EXEC", "1"); } <del> if self.config.incremental { </del> <ins> // Ignore incremental modes except for stage0, since we're // not guaranteeing correctness across builds if the compiler // is changing under your feet. if self.config.incremental && compiler.stage == 0 { </ins> cargo.env("CARGO_INCREMENTAL", "1"); } else { // Don't rely on any default setting for incr. comp. in Cargo


StorageLive(_3);                 // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:15 StorageLive(_4);                 // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:6 _4 = &mut (*_1);                 // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:6 <del> _3 = move _4;                    // scope 1 at $SRC_DIR/libcore/convert/mod.rs:LL:COL </del> <ins> StorageLive(_5);                 // scope 1 at $SRC_DIR/libcore/convert/mod.rs:LL:COL _5 = &mut (*_4);                 // scope 1 at $SRC_DIR/libcore/convert/mod.rs:LL:COL _3 = &mut (*_5);                 // scope 1 at $SRC_DIR/libcore/convert/mod.rs:LL:COL StorageDead(_5);                 // scope 1 at $SRC_DIR/libcore/convert/mod.rs:LL:COL </ins> _2 = &mut (*_3);                 // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:15 StorageDead(_4);                 // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:14: 3:15 _0 = &mut (*_2);                 // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:15


/// Cancel the diagnostic (a structured diagnostic must either be emitted or /// canceled or it will panic when dropped). <del> /// BEWARE: if this DiagnosticBuilder is an error, then creating it will /// bump the error count on the Handler and canceling it won't undo that. /// If you want to decrement the error count you should use `Handler::cancel`. </del> pub fn cancel(&mut self) { self.level = Level::Cancelled; }


//~^ ERROR generic associated types are unstable } <ins> trait Bar { type Assoc where Self: Sized; //~^ ERROR where clauses on associated types are unstable } </ins> fn main() {}


let expn_data = prefix_span.ctxt().outer_expn_data(); if expn_data.edition >= Edition::Edition2021 { <del> let mut silence = false; </del> // In Rust 2021, this is a hard error. let sugg = if prefix == "rb" { Some(errors::UnknownPrefixSugg::UseBr(prefix_span))


<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. #![crate_type="lib"] pub trait Trait { // the issue is sensitive to interning order - so use names // unlikely to appear in libstd. type Issue25467FooT; type Issue25467BarT; } pub type Object = Option<Box<Trait<Issue25467FooT=(),Issue25467BarT=()>>>; </ins>


for autoderefs in range(0, fcx.tcx().sess.recursion_limit.get()) { let resolved_t = structurally_resolved_type(fcx, sp, t); <ins> if ty::type_is_bot(resolved_t) { return (resolved_t, autoderefs, None); } </ins> match should_stop(resolved_t, autoderefs) { Some(x) => return (resolved_t, autoderefs, Some(x)), None => {}


<ins> // Check that `async fn` inside of an impl with `'_` // in the header compiles correctly. // // Regression test for #63500. // // check-pass // edition:2018 #![feature(async_await)] struct Foo<'a>(&'a u8); impl Foo<'_> { async fn bar() {} } fn main() { } </ins>


#[inline] #[must_use] #[stable(feature = "rust1", since = "1.0.0")] <del> #[rustc_const_unstable(feature = "const_transmute_copy", issue = "83165")] </del> <ins> #[rustc_const_stable(feature = "const_transmute_copy", since = "CURRENT_RUSTC_VERSION")] </ins> pub const unsafe fn transmute_copy<Src, Dst>(src: &Src) -> Dst { assert!( size_of::<Src>() >= size_of::<Dst>(),


/// assert!(ascii.is_ascii()); /// assert!(!non_ascii.is_ascii()); /// ``` <del> #[unstable(feature = "osstring_ascii", issue = "70516")] </del> <ins> #[stable(feature = "osstring_ascii", since = "1.53.0")] </ins> #[inline] pub fn is_ascii(&self) -> bool { self.inner.is_ascii()


let p = Command::new("cmd").args(&["/C", "exit 0"]).env_clear().spawn(); assert!(p.is_ok()); } <ins> // See issue #91991 #[test] #[cfg(windows)] fn run_bat_script() { let tempdir = crate::sys_common::io::test::tmpdir(); let script_path = tempdir.join("hello.cmd"); crate::fs::write(&script_path, "@echo Hello, %~1!").unwrap(); let output = Command::new(&script_path) .arg("fellow Rustaceans") .stdout(crate::process::Stdio::piped()) .spawn() .unwrap() .wait_with_output() .unwrap(); assert!(output.status.success()); assert_eq!(String::from_utf8_lossy(&output.stdout).trim(), "Hello, fellow Rustaceans!"); } </ins>


if ast_util::is_local(self.item.def_id) { let mut path = Vec::new(); clean_srcpath(&cx.src_root, Path::new(&self.item.source.filename), <del> |component| { </del> <ins> true, |component| { </ins> path.push(component.to_string()); }); let href = if self.item.source.loline == self.item.source.hiline {


# tarball for a stable release you'll likely see `1.x.0-$date` where `1.x.0` was # released on `$date` <del> rustc: beta-2017-03-21 </del> <ins> rustc: beta-2017-04-05 </ins>


<del> Subproject commit bf88026f11f2cc7bb9fefdfe1dbcab642f110afa </del> <ins> Subproject commit f37425e33c864c697af06df66e7473444605c149 </ins>


without modifying the original"] #[inline] #[track_caller] <del> #[rustc_inherit_overflow_checks] #[allow(arithmetic_overflow)] </del> pub const fn ilog(self, base: Self) -> u32 { <del> match self.checked_ilog(base) { 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> assert!(base >= 2, "base of integer logarithm must be at least 2"); self.checked_ilog(base).expect("argument of integer logarithm must be positive") </ins> } /// Returns the base 2 logarithm of the number, rounded down. /// /// # Panics /// <del> /// When the number is zero it panics in debug mode and /// the return value is 0 in release mode. </del> <ins> /// This function will panic if `self` is zero. </ins> /// /// # Examples ///


numbers [no longer return platform-specific types][1.8r], but instead return widened integers. [RFC 1415]. * [Modules sourced from the filesystem cannot appear within arbitrary <del> blocks, but only within other modules][1.8m]. </del> <ins> blocks, but only within other modules][1.8mf]. </ins> * [`--cfg` compiler flags are parsed strictly as identifiers][1.8c]. * On Unix, [stack overflow triggers a runtime abort instead of a SIGSEGV][1.8so].


} return Ok((res, Some(path_str.to_owned()))); } <del> other => { debug!( "failed to resolve {} in namespace {:?} (got {:?})", path_str, ns, other ); </del> <ins> Res::Def(DefKind::Mod, _) => { // This resolved to a module, but if we were passed `type@`, // we want primitive types to take precedence instead. if disambiguator == Some("type") { if let Some(prim) = is_primitive(path_str, ns) { if extra_fragment.is_some() { return Err(ErrorKind::AnchorFailure( "primitive types cannot be followed by anchors", )); } return Ok((prim, Some(path_str.to_owned()))); } } return Ok((res, extra_fragment.clone())); } _ => { </ins> return Ok((res, extra_fragment.clone())); } };


<ins> struct Foo { field1: u8, field2: u8, } fn main() { let foo = Foo { field1: 1, field2: 2 }; let Foo { var @ field1, .. } = foo; //~ ERROR Unexpected `@` in struct pattern dbg!(var); //~ ERROR cannot find value `var` in this scope let Foo { field1: _, bar @ .. } = foo; //~ ERROR `@ ..` is not supported in struct patterns let Foo { bar @ .. } = foo; //~ ERROR `@ ..` is not supported in struct patterns let Foo { @ } = foo; //~ ERROR expected identifier, found `@` let Foo { @ .. } = foo; //~ ERROR expected identifier, found `@` } </ins>


t } <del> fn ambiguity( &self, kind: AmbiguityKind, primary_binding: &'a NameBinding<'a>, secondary_binding: &'a NameBinding<'a>, ) -> &'a NameBinding<'a> { self.arenas.alloc_name_binding(NameBinding { ambiguity: Some((secondary_binding, kind)), ..primary_binding.clone() }) } </del> // Define a dummy resolution containing a `Res::Err` as a placeholder for a failed // or indeterminate resolution, also mark such failed imports as used to avoid duplicate diagnostics. fn import_dummy_binding(&mut self, import: &'a Import<'a>, is_indeterminate: bool) {


use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use rustc_middle::ty; use rustc_middle::ty::adjustment::{Adjust, Adjustment, AllowTwoPhase}; <ins> use rustc_middle::ty::subst::SubstsRef; </ins> use rustc_middle::ty::Ty; use rustc_middle::ty::TypeFoldable; use rustc_middle::ty::{AdtKind, Visibility};


} log_rpaths("relative", rel_rpaths); <ins> log_rpaths("absolute", abs_rpaths); </ins> log_rpaths("fallback", fallback_rpaths); let mut rpaths = rel_rpaths; <ins> rpaths.push_all(abs_rpaths); </ins> rpaths.push_all(fallback_rpaths); // Remove duplicates