// SAFETY: left and right must be valid and part of v same for out. unsafe { <del> let to_copy = if is_less(&*right.sub(1), &*left.sub(1)) { decrement_and_get(left) } else { decrement_and_get(right) }; ptr::copy_nonoverlapping(to_copy, decrement_and_get(&mut out), 1); </del> <ins> let is_l = is_less(&*right.sub(1), &*left.sub(1)); *left = left.sub(is_l as usize); *right = right.sub(!is_l as usize); let to_copy = if is_l { *left } else { *right }; out = out.sub(1); ptr::copy_nonoverlapping(to_copy, out, 1); </ins> } } } // Finally, `hole` gets dropped. If the shorter run was not fully consumed, whatever remains of // it will now be copied into the hole in `v`. <del> unsafe fn get_and_increment<T>(ptr: &mut *mut T) -> *mut T { let old = *ptr; // SAFETY: ptr.add(1) must still be a valid pointer and part of `v`. *ptr = unsafe { ptr.add(1) }; old } unsafe fn decrement_and_get<T>(ptr: &mut *mut T) -> *mut T { // SAFETY: ptr.sub(1) must still be a valid pointer and part of `v`. *ptr = unsafe { ptr.sub(1) }; *ptr } </del> // When dropped, copies the range `start..end` into `dest..`. struct MergeHole<T> { start: *mut T,


| LL |     nc.clone() |     ^^ <ins> help: consider annotating `NotClone` with `#[derive(Clone)]` | LL | #[derive(Clone)] | </ins> error: aborting due to previous error


err.note("only the last field of a struct or enum variant  may have a dynamically sized type"); } <ins> ObligationCauseCode::ConstSized => { err.note("constant expressions must have a statically known size"); } </ins> ObligationCauseCode::SharedStatic => { err.note("shared static variables must have a type that implements `Sync`"); }


let info = Load(bcx, get_len(bcx, base_datum.val)); Store(bcx, info, get_len(bcx, scratch.val)); <del> DatumBlock::new(bcx, scratch.to_expr_datum()) </del> <ins> // Always generate an lvalue datum, because this pointer doesn't own // the data and cleanup is scheduled elsewhere. DatumBlock::new(bcx, Datum::new(scratch.val, scratch.ty, LvalueExpr)) </ins> } })


// @has proc_macro/macro.some_proc_macro.html // @has proc_macro/attr.some_proc_attr.html // @has proc_macro/derive.SomeDerive.html <del> pub use some_macros::{some_proc_macro, some_proc_attr, SomeDerive}; </del> <ins> // @has proc_macro/macro.some_proc_macro.html // @has - 'a proc-macro that swallows its input and does nothing.' pub use some_macros::some_proc_macro; </ins> // @has proc_macro/macro.reexported_macro.html // @has - 'Doc comment from the original crate' pub use some_macros::reexported_macro; <ins> // @has proc_macro/attr.some_proc_attr.html // @has - 'a proc-macro attribute that passes its item through verbatim.' pub use some_macros::some_proc_attr; // @has proc_macro/derive.SomeDerive.html // @has - 'a derive attribute that adds nothing to its input.' pub use some_macros::SomeDerive; </ins>


<ins> error[E0491]: in type `&'static &'a ()`, reference has a longer lifetime than the data it references --> $DIR/rpitit-hidden-types-self-implied-wf-via-param.rs:8:38 | LL |     fn extend<'a: 'a>(s: &'a str) -> (Option<&'static &'a ()>, &'static str) |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the pointer is valid for the static lifetime note: but the referenced data is only valid for the lifetime `'a` as defined here --> $DIR/rpitit-hidden-types-self-implied-wf-via-param.rs:8:15 | LL |     fn extend<'a: 'a>(s: &'a str) -> (Option<&'static &'a ()>, &'static str) |               ^^ error: aborting due to previous error For more information about this error, try `rustc --explain E0491`. </ins>


<ins> struct X<const N: usize = { (||1usize)() //~^ ERROR calls in constants are limited to }>; fn main() {} </ins>


if attr.check_name(sym::must_use) { let msg = format!("unused {}`{}`{} that must be used", descr_pre_path, cx.tcx.def_path_str(def_id), descr_post_path); <del> let mut err = cx.struct_span_lint(UNUSED_MUST_USE, sp, &msg); </del> <ins> let mut err = cx.struct_span_lint(UNUSED_MUST_USE, span, &msg); </ins> // check for #[must_use = "..."] if let Some(note) = attr.value_str() { err.note(&note.as_str());


//~ TRANS_ITEM fn vtable_through_const::mod1[0]::id[0]<char> @@ vtable_through_const[Internal] mod1::ID_CHAR('x'); } <del> //~ TRANS_ITEM drop-glue i8 </del>


<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. // compile-flags: --test #![test] //~ ERROR only functions may be used as tests </ins>


}; } <ins> /// Instead of e.g. `vec![a, b, c]` in a pattern context, suggest `[a, b, c]`. fn suggest_slice_pat(e: &mut DiagnosticBuilder<'_>, site_span: Span, parser: &Parser<'_>) { let mut suggestion = None; if let Ok(code) = parser.sess.source_map().span_to_snippet(site_span) { if let Some(bang) = code.find('!') { suggestion = Some(code[bang + 1..].to_string()); } } if let Some(suggestion) = suggestion { e.span_suggestion( site_span, "use a slice pattern here instead", suggestion, Applicability::MachineApplicable, ); } else { e.span_label(site_span, "use a slice pattern here instead"); } e.help( "for more information, see https://doc.rust-lang.org/edition-guide/ rust-2018/slice-patterns.html" ); } </ins> impl<'a> ParserAnyMacro<'a> { crate fn make(mut self: Box<ParserAnyMacro<'a>>, kind: AstFragmentKind) -> AstFragment { let ParserAnyMacro { site_span, macro_ident, ref mut parser, arm_span } = *self;


{ value.fold_with(&mut RegionFolder::new(self, &mut f)) } <del> pub fn super_fold_regions<T>( self, value: T, mut f: impl FnMut(ty::Region<'tcx>, ty::DebruijnIndex) -> ty::Region<'tcx>, ) -> T where T: TypeSuperFoldable<TyCtxt<'tcx>>, { value.super_fold_with(&mut RegionFolder::new(self, &mut f)) } </del> } /// Folds over the substructure of a type, visiting its component


use rustc_target::abi::FieldIdx; use rustc_target::spec::abi::Abi::RustIntrinsic; use rustc_trait_selection::infer::InferCtxtExt; <ins> use rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt; use rustc_trait_selection::traits::ObligationCtxt; </ins> use rustc_trait_selection::traits::{self, ObligationCauseCode}; impl<'a, 'tcx> FnCtxt<'a, 'tcx> {


} if self.config.rust_remap_debuginfo { <del> // FIXME: handle vendored sources let registry_src = t!(home::cargo_home()).join("registry").join("src"); </del> let mut env_var = OsString::new(); <del> for entry in t!(std::fs::read_dir(registry_src)) { if !env_var.is_empty() { env_var.push("t"); } env_var.push(t!(entry).path()); </del> <ins> if self.config.vendor { let vendor = self.build.src.join("vendor"); env_var.push(vendor); </ins> env_var.push("=/rust/deps"); <ins> } else { let registry_src = t!(home::cargo_home()).join("registry").join("src"); for entry in t!(std::fs::read_dir(registry_src)) { if !env_var.is_empty() { env_var.push("t"); } env_var.push(t!(entry).path()); env_var.push("=/rust/deps"); } </ins> } cargo.env("RUSTC_CARGO_REGISTRY_SRC_TO_REMAP", env_var); }


<ins> #![u={static N;}] fn main() {} </ins>


<ins> // Regression test for #61311 // We would ICE after failing to normalize `Self::Proj` in the `impl` below. // compile-pass pub struct Unit; trait Obj {} trait Bound {} impl Bound for Unit {} pub trait HasProj { type Proj; } impl<T> HasProj for T { type Proj = Unit; } trait HasProjFn { type Proj; fn the_fn(_: Self::Proj); } impl HasProjFn for Unit where Box<dyn Obj + 'static>: HasProj, <Box<dyn Obj + 'static> as HasProj>::Proj: Bound, { type Proj = Unit; fn the_fn(_: Self::Proj) {} } fn main() {} </ins>


'u{2004}', 'u{2005}', 'u{2006}', 'u{2007}', 'u{2008}', 'u{2009}', 'u{200A}', 'u{2028}', 'u{2029}', 'u{202F}', 'u{205F}', 'u{3000}']; <del> for c in &chars { let ws = c.is_whitespace(); println!("{} {}" , c , ws); } </del> <ins> for c in &chars { let ws = c.is_whitespace(); println!("{} {}", c, ws); } </ins> }


AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY) condition: and(succeeded(), or(eq(variables.DEPLOY, '1'), eq(variables.DEPLOY_ALT, '1'))) displayName: Upload artifacts <ins> # Upload CPU usage statistics that we've been gathering this whole time. Always # execute this step in case we want to inspect failed builds, but don't let # errors here ever fail the build since this is just informational. - bash: aws s3 cp --acl public-read cpu-usage.csv s3://$DEPLOY_BUCKET/rustc-builds/$BUILD_SOURCEVERSION/cpu-$SYSTEM_JOBNAME.csv env: AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY) condition: contains(variables, 'AWS_SECRET_ACCESS_KEY') continueOnError: true displayName: Upload CPU usage statistics </ins>


<ins> // Regression test for issue #130142 // Checks that we emit no warnings when a lint's level // is overridden by an expect or allow attr on a Stmt node //@ check-pass #[must_use] pub fn must_use_result() -> i32 { 42 } fn main() { #[expect(unused_must_use)] must_use_result(); #[allow(unused_must_use)] must_use_result(); } </ins>


} let feed_visibility = |this: &mut Self, def_id| { <del> let vis = this.r.tcx.visibility(def_id).expect_local(); </del> <ins> let vis = this.r.tcx.visibility(def_id); let vis = if vis.is_visible_locally() { vis.expect_local() } else { this.r.dcx().span_delayed_bug( span, "error should be emitted when an unexpected trait item is used", ); rustc_middle::ty::Visibility::Public }; </ins> this.r.feed_visibility(this.r.local_def_id(id), vis); };


<ins> // unit-test: Inline // compile-flags: --crate-type=lib -C panic=abort use std::any::Any; use std::any::TypeId; struct A<T: ?Sized + 'static> { a: i32, b: T, } // EMIT_MIR dont_inline_type_id.call.Inline.diff pub fn call<T: ?Sized + 'static>(s: &T) -> TypeId { s.type_id() } </ins>


#[inline] unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 { <ins> // See the comment above in `alloc` for why this check looks the way it does. </ins> if layout.align() <= MIN_ALIGN && layout.align() <= layout.size() { libc::calloc(layout.size(), 1) as *mut u8 } else {


<ins> //@ edition:2021 macro_rules! a { ( ) => { impl<'b> c for d { e::<f'g> //~ ERROR prefix `f` is unknown } }; } fn main() {} </ins>


Ok(pat) } <ins> /// Recover from a typoed `...` pattern that was encountered /// Ref: Issue #70388 fn recover_dotdotdot_rest_pat(&mut self, lo: Span) -> PatKind { // A typoed rest pattern `...`. self.bump(); // `...` // The user probably mistook `...` for a rest pattern `..`. self.struct_span_err(lo, "unexpected `...`") .span_label(lo, "not a valid pattern") .span_suggestion_short( lo, "for a rest pattern, use `..` instead of `...`", "..".to_owned(), Applicability::MachineApplicable, ) .emit(); PatKind::Rest } </ins> /// Try to recover the more general form `intersect ::= $pat_lhs @ $pat_rhs`. /// /// Allowed binding patterns generated by `binding ::= ref? mut? $ident @ $pat_rhs`


// Change value between simple literals --------------------------------------- <del> #[cfg(cfail1)] const CONST_CHANGE_VALUE_1: i16 = 1; #[cfg(not(cfail1))] </del> #[rustc_clean(cfg="cfail2", except="HirBody")] #[rustc_clean(cfg="cfail3")] #[rustc_metadata_clean(cfg="cfail3")] <del> const CONST_CHANGE_VALUE_1: i16 = 2; </del> <ins> const CONST_CHANGE_VALUE_1: i16 = { #[cfg(cfail1)] { 1 } #[cfg(not(cfail1))] { 2 } }; </ins> <del> // Change value between expressions ------------------------------------------- #[cfg(cfail1)] const CONST_CHANGE_VALUE_2: i16 = 1 + 1; #[cfg(not(cfail1))] </del> <ins> // Change value between expressions ------------------------------------------- </ins> #[rustc_clean(cfg="cfail2", except="HirBody")] #[rustc_clean(cfg="cfail3")] #[rustc_metadata_dirty(cfg="cfail2")] #[rustc_metadata_clean(cfg="cfail3")] <del> const CONST_CHANGE_VALUE_2: i16 = 1 + 2; </del> <ins> const CONST_CHANGE_VALUE_2: i16 = { #[cfg(cfail1)] { 1 + 1 } </ins> <del> #[cfg(cfail1)] const CONST_CHANGE_VALUE_3: i16 = 2 + 3; </del> <ins> #[cfg(not(cfail1))] { 1 + 2 } }; </ins> <del> #[cfg(not(cfail1))] </del> #[rustc_clean(cfg="cfail2", except="HirBody")] #[rustc_clean(cfg="cfail3")] #[rustc_metadata_dirty(cfg="cfail2")] #[rustc_metadata_clean(cfg="cfail3")] <del> const CONST_CHANGE_VALUE_3: i16 = 2 * 3; </del> <ins> const CONST_CHANGE_VALUE_3: i16 = { #[cfg(cfail1)] { 2 + 3 } </ins> <del> #[cfg(cfail1)] const CONST_CHANGE_VALUE_4: i16 = 1 + 2 * 3; </del> <ins> #[cfg(not(cfail1))] { 2 * 3 } }; </ins> <del> #[cfg(not(cfail1))] </del> #[rustc_clean(cfg="cfail2", except="HirBody")] #[rustc_clean(cfg="cfail3")] #[rustc_metadata_dirty(cfg="cfail2")] #[rustc_metadata_clean(cfg="cfail3")] <del> const CONST_CHANGE_VALUE_4: i16 = 1 + 2 * 4; </del> <ins> const CONST_CHANGE_VALUE_4: i16 = { #[cfg(cfail1)] { 1 + 2 * 3 } #[cfg(not(cfail1))] { 1 + 2 * 4 } }; </ins> // Change type indirectly -----------------------------------------------------


<ins> // Copyright 2017 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. // ignore-tidy-linelength // compile-flags: -g  --remap-path-prefix={{cwd}}=/the/aux-cwd --remap-path-prefix={{src-base}}/remap_path_prefix/auxiliary=/the/aux-src #![crate_type = "lib"] pub fn foo<T>() {} </ins>


<ins> error[E0531]: cannot find tuple struct or tuple variant `Cons` in this scope --> $DIR/issue-90113.rs:17:9 | LL |         Cons(..) => {} |         ^^^^ not found in this scope | help: consider importing this tuple variant | LL | use list::List::Cons; | error: aborting due to previous error For more information about this error, try `rustc --explain E0531`. </ins>


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


fn main() { macro_rules! test { <del> ($($fn_name:ident,)*) => { $( </del> <ins> ($($fn_name:expr,)*) => { $( </ins> test_future_yields_once_then_returns($fn_name); )* } } <ins> macro_rules! test_with_borrow { ($($fn_name:expr,)*) => { $( test_future_yields_once_then_returns(|x| { async move { await!($fn_name(&x)) } }); )* } } </ins> test! { async_block, async_nonmove_block, async_closure, async_fn, async_fn_with_internal_borrow, <ins> |x| { async move { unsafe { await!(unsafe_async_fn(x)) } } }, } test_with_borrow! { async_block_with_borrow_named_lifetime, async_fn_with_borrow, async_fn_with_borrow_named_lifetime, async_fn_with_impl_future_named_lifetime, |x| { async move { await!(async_fn_with_named_lifetime_multiple_args(x, x)) } }, </ins> } }


<ins> error[E0597]: `a` does not live long enough --> $DIR/location-insensitive-scopes-issue-117146.rs:10:18 | LL |     let b = |_| &a; |             --- -^ |             |   || |             |   |borrowed value does not live long enough |             |   returning this value requires that `a` is borrowed for `'static` |             value captured here ... LL | } | - `a` dropped here while still borrowed | note: due to current limitations in the borrow checker, this implies a `'static` lifetime --> $DIR/location-insensitive-scopes-issue-117146.rs:20:22 | LL | fn bad<F: Fn(&()) -> &()>(_: F) {} |                      ^^^ error: implementation of `Fn` is not general enough --> $DIR/location-insensitive-scopes-issue-117146.rs:13:5 | LL |     bad(&b); |     ^^^^^^^ implementation of `Fn` is not general enough | = note: closure with signature `fn(&'2 ()) -> &()` must implement `Fn<(&'1 (),)>`, for any lifetime `'1`... = note: ...but it actually implements `Fn<(&'2 (),)>`, for some specific lifetime `'2` error: implementation of `FnOnce` is not general enough --> $DIR/location-insensitive-scopes-issue-117146.rs:13:5 | LL |     bad(&b); |     ^^^^^^^ implementation of `FnOnce` is not general enough | = note: closure with signature `fn(&'2 ()) -> &()` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0597`. </ins>


# 32/64-bit MinGW builds. # <del> # The MinGW builds unfortunately have to both download a custom toolchain and # avoid the one installed by AppVeyor by default. Interestingly, though, for # different reasons! </del> <ins> # We are using MinGW with posix threads since LLVM does not compile with # the win32 threads version due to missing support for C++'s std::thread. </ins> # <del> # For 32-bit the installed gcc toolchain on AppVeyor uses the pthread # threading model. This is unfortunately not what we want, and if we compile # with it then there's lots of link errors in the standard library (undefined # references to pthread symbols). # # For 64-bit the installed gcc toolchain is currently 5.3.0 which # unfortunately segfaults on Windows with --enable-llvm-assertions (segfaults # in LLVM). See rust-lang/rust#28445 for more information, but to work around # this we go back in time to 4.9.2 specifically. </del> <ins> # Instead of relying on the MinGW version installed on appveryor we download # and install one ourselves so we won't be surprised by changes to appveyor's # build image. </ins> # # Finally, note that the downloads below are all in the `rust-lang-ci` S3 # bucket, but they cleraly didn't originate there! The downloads originally # came from the mingw-w64 SourceForge download site. Unfortunately # SourceForge is notoriously flaky, so we mirror it on our own infrastructure. <del> # # And as a final point of note, the 32-bit MinGW build using the makefiles do # *not* use debug assertions and llvm assertions. This is because they take # too long on appveyor and this is tested by rustbuild below. </del> - MSYS_BITS: 32 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-ninja SCRIPT: python x.py test MINGW_URL: https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror <del> MINGW_ARCHIVE: i686-6.2.0-release-win32-dwarf-rt_v5-rev1.7z </del> <ins> MINGW_ARCHIVE: i686-6.2.0-release-posix-dwarf-rt_v5-rev1.7z </ins> MINGW_DIR: mingw32 - MSYS_BITS: 64 SCRIPT: python x.py test RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-ninja MINGW_URL: https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror <del> MINGW_ARCHIVE: x86_64-6.2.0-release-win32-seh-rt_v5-rev1.7z </del> <ins> MINGW_ARCHIVE: x86_64-6.2.0-release-posix-seh-rt_v5-rev1.7z </ins> MINGW_DIR: mingw64 # 32/64 bit MSVC and GNU deployment


PYTHONPATH="$PYTHONPATH:$GDB_PYTHON_MODULE_DIRECTORY" exec ${RUST_GDB}  --directory="$GDB_PYTHON_MODULE_DIRECTORY"  -iex "add-auto-load-safe-path $GDB_PYTHON_MODULE_DIRECTORY"  <ins> -iex "set substitute-path /rustc/$RUSTC_COMMIT_HASH $RUSTC_SYSROOT/lib/rustlib/src/rust"  </ins> "$@"  No newline at end of file


initial_res: Option<Res>, res: Res| { if let Some(initial_res) = initial_res { <del> if res != initial_res && res != Res::Err && this.ambiguity_errors.is_empty() { </del> <ins> if res != initial_res { </ins> // Make sure compilation does not succeed if preferred macro resolution // has changed after the macro had been expanded. In theory all such <del> // situations should be reported as ambiguity errors, so this is a bug. span_bug!(span, "inconsistent resolution for a macro"); </del> <ins> // situations should be reported as errors, so this is a bug. this.session.delay_span_bug(span, "inconsistent resolution for a macro"); </ins> } } else { // It's possible that the macro was unresolved (indeterminate) and silently


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


<ins> // compile-flags:--test /// A check of using various process termination strategies /// /// # Examples /// /// ```rust /// assert!(true); // this returns `()`, all is well /// ``` /// /// You can also simply return `Ok(())`, but you'll need to disambiguate the /// type using turbofish, because we cannot infer the type: /// /// ```rust /// Ok::<(), &'static str>(()) /// ``` /// /// You can err with anything that implements `Debug`: /// /// ```rust,should_panic /// Err("This is returned from `main`, leading to panic")?; /// Ok::<(), &'static str>(()) /// ``` pub fn check_process_termination() {} </ins>


<ins> #![feature(return_position_impl_trait_in_trait)] trait Iterable { type Item<'a> where Self: 'a; fn iter(&self) -> impl Iterator<Item = Self::Item<'missing>>; //~^ ERROR use of undeclared lifetime name `'missing` } fn main() {} </ins>


out_filenames.push(out_filename); } <ins> if sess.opts.cg.save_temps { let _ = tmpdir.into_path(); } </ins> out_filenames }


passes.into_iter().collect(), css_file_extension, renderinfo, <del> render_type) </del> <ins> render_type, sort_modules_alphabetically) </ins> .expect("failed to generate documentation"); 0 }


"clippy_lints", "compiletest_rs", "derive-new", <ins> "git2", </ins> "lazy_static 1.3.0", "regex", "rustc-workspace-hack", "rustc_tools_util 0.2.0", "semver", "serde", <ins> "tempfile", </ins> "tester", ]


use crate::fluent_generated as fluent; use crate::parser; <ins> use crate::parser::attr::InnerAttrPolicy; </ins> use rustc_ast as ast; use rustc_ast::ptr::P; use rustc_ast::token::{self, Delimiter, Lit, LitKind, TokenKind};


<ins> error[E0599]: no function or associated item named `mew` found for struct `Vec<Q>` in the current scope --> $DIR/bad-builder.rs:2:15 | LL |     Vec::<Q>::mew() |               ^^^ |               | |               function or associated item not found in `Vec<Q>` |               help: there is an associated function with a similar name: `new` | note: if you're trying to build a new `Vec<Q>` consider using one of the following associated functions: Vec::<T>::new Vec::<T>::with_capacity Vec::<T>::from_raw_parts Vec::<T, A>::new_in and 2 others --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0599`. </ins>


<ins> #![allow(incomplete_features)] #![feature(generic_const_exprs)] #![feature(trait_alias)] trait Bar<const N: usize> {} trait BB = Bar<{ 2 + 1 }>; fn foo(x: &dyn BB) {} //~^ ERROR the trait alias `BB` cannot be made into an object [E0038] fn main() {} </ins>


<ins> // check-pass #![feature(const_generics)] //~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash pub trait Trait<const N: usize>: From<<Self as Trait<N>>::Item> { type Item; } fn main() {} </ins>


<ins> error: `start` language item function is not allowed to have `#[target_feature]` --> $DIR/start_lang_item_with_target_feature.rs:13:1 | LL | #[target_feature(enable = "avx2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize { | ------------------------------------------------------------------------------------------- `start` language item function is not allowed to have `#[target_feature]` error: aborting due to previous error </ins>


{ debug!(?obligation, "confirm_fn_pointer_candidate"); <del> // Okay to skip binder; it is reintroduced below. let self_ty = self.infcx.shallow_resolve(obligation.self_ty().skip_binder()); </del> <ins> let self_ty = self .infcx .shallow_resolve(obligation.self_ty().no_bound_vars()) .expect("fn pointer should not capture bound vars from predicate"); </ins> let sig = self_ty.fn_sig(self.tcx()); let trait_ref = closure_trait_ref_and_return_type( self.tcx(),


<ins> // Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. use foo::baz; use bar::baz; //~ ERROR a module named `baz` has already been imported use foo::Quux; use bar::Quux; //~ ERROR a trait named `Quux` has already been imported use foo::blah; use bar::blah; //~ ERROR a type named `blah` has already been imported use foo::WOMP; use bar::WOMP; //~ ERROR a value named `WOMP` has already been imported fn main() {} mod foo { pub mod baz {} pub trait Quux { } pub type blah = (f64, u32); pub const WOMP: u8 = 5; } mod bar { pub mod baz {} pub type Quux = i32; struct blah { x: i8 } pub const WOMP: i8 = -5; } </ins>


let trait_m = tcx.opt_associated_item(impl_m.trait_item_def_id.unwrap()).unwrap(); let impl_trait_ref = tcx.impl_trait_ref(impl_m.impl_container(tcx).unwrap()).unwrap().instantiate_identity(); <del> let param_env = tcx.param_env(impl_m_def_id); </del> // First, check a few of the same things as `compare_impl_method`, // just so we don't ICE during substitution later. check_method_is_structurally_compatible(tcx, impl_m, trait_m, impl_trait_ref, true)?;


ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS <del> # FIXME(#36150) this will fail the bootstrap. Probably means something bad is #               happening! ENV NO_LLVM_ASSERTIONS 1 </del>


<ins> error[E0669]: invalid value for constraint in inline assembly --> $DIR/issue-51431.rs:7:32 | LL |         asm! {"mov $0,$1"::"0"("bx"),"1"(0x00)} |                                ^^^^ error: aborting due to previous error </ins>


//! [`PathBuf`]; note that the paths may differ syntactically by the //! normalization described in the documentation for the [`components`] method. //! <ins> //! ## Case sensitivity //! //! Unless otherwise indicated path methods that do not access the filesystem, //! such as [`Path::starts_with`] and [`Path::ends_with`], are case sensitive no //! matter the platform or filesystem. An exception to this is made for Windows //! drive letters. //! </ins> //! ## Simple usage //! //! Path manipulation includes both parsing components from slices and building


match expr.node { ast::ExprField(ref base, ident) => { if let ty::ty_struct(id, _) = ty::expr_ty_adjusted(self.tcx, &**base).sty { <del> self.check_field(expr.span, id, NamedField(ident.node)); </del> <ins> self.check_field(expr.span, id, NamedField(ident.node.name)); </ins> } } ast::ExprTupField(ref base, idx) => {


panic!(); } <ins> #[test] fn panic_in_write_doesnt_flush_in_drop() { static WRITES: AtomicUsize = AtomicUsize::new(0); struct PanicWriter; impl Write for PanicWriter { fn write(&mut self, _: &[u8]) -> io::Result<usize> { WRITES.fetch_add(1, Ordering::SeqCst); panic!(); } fn flush(&mut self) -> io::Result<()> { Ok(()) } } thread::spawn(|| { let mut writer = BufWriter::new(PanicWriter); writer.write(b"hello world"); writer.flush(); }).join().err().unwrap(); assert_eq!(WRITES.load(Ordering::SeqCst), 1); } </ins> #[bench] fn bench_buffered_reader(b: &mut test::Bencher) { b.iter(|| {


// ignore it.  We can't put it on the struct header anyway. RegionKind::ReLateBound(..) => false, <ins> // This can appear in `where Self: ` bounds (#64855): // //     struct Bar<T>(<Self as Foo>::Type) where Self: ; //     struct Baz<'a>(&'a Self) where Self: ; RegionKind::ReEmpty => false, </ins> // These regions don't appear in types from type declarations: <del> RegionKind::ReEmpty | RegionKind::ReErased </del> <ins> RegionKind::ReErased </ins> | RegionKind::ReClosureBound(..) | RegionKind::ReScope(..) | RegionKind::ReVar(..)


|  |_____| | || LL | || <del> LL | || </del> LL | ||         use std::ptr::null; <ins> LL | ||         use std::task::{Context, RawWaker, RawWakerVTable, Waker}; </ins> ...  || LL | ||         drop(cx_ref); LL | ||     }); | ||_____-^ `&mut Context<'_>` may not be safely transferred across an unwind boundary |  |_____| <del> |        within this `{async block@$DIR/async-is-unwindsafe.rs:12:19: 30:6}` </del> <ins> |        within this `{async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6}` </ins> | <del> = help: within `{async block@$DIR/async-is-unwindsafe.rs:12:19: 30:6}`, the trait `UnwindSafe` is not implemented for `&mut Context<'_>`, which is required by `{async block@$DIR/async-is-unwindsafe.rs:12:19: 30:6}: UnwindSafe` </del> <ins> = help: within `{async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6}`, the trait `UnwindSafe` is not implemented for `&mut Context<'_>`, which is required by `{async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6}: UnwindSafe` = note: `UnwindSafe` is implemented for `&Context<'_>`, but not for `&mut Context<'_>` </ins> note: future does not implement `UnwindSafe` as this value is used across an await <del> --> $DIR/async-is-unwindsafe.rs:26:18 </del> <ins> --> $DIR/async-is-unwindsafe.rs:25:18 </ins> | LL |         let cx_ref = &mut cx; |             ------ has type `&mut Context<'_>` which does not implement `UnwindSafe`


Some(&def::DefVariant(_, variant_id, _)) => { for field in fields { self.check_field(pattern.span, variant_id, <del> NamedField(field.node.ident)); </del> <ins> NamedField(field.node.ident.name)); </ins> } } _ => self.tcx.sess.span_bug(pattern.span,


/// /// assert_eq!(n.leading_zeros(), 2); /// ``` <ins> #[doc = concat!("[`ilog2`]: ", stringify!($SelfT), "::ilog2")] </ins> #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "const_math", since = "1.32.0")] #[must_use = "this returns the result of the operation,


struct Wrapper<T>(T); struct Test<T: Copy> { <del> f1: extern "C-cmse-nonsecure-call" fn<U: Copy>(U, u32, u32, u32) -> u64, //~ ERROR cannot find type `U` in this scope //~^ ERROR function pointer types may not have generic parameters </del> <ins> f1: extern "C-cmse-nonsecure-call" fn<U: Copy>(U, u32, u32, u32) -> u64, //~^ ERROR cannot find type `U` in this scope //~| ERROR function pointer types may not have generic parameters </ins> f2: extern "C-cmse-nonsecure-call" fn(impl Copy, u32, u32, u32) -> u64, //~^ ERROR `impl Trait` is not allowed in `fn` pointer parameters f3: extern "C-cmse-nonsecure-call" fn(T, u32, u32, u32) -> u64, //~ ERROR [E0798] f4: extern "C-cmse-nonsecure-call" fn(Wrapper<T>, u32, u32, u32) -> u64, //~ ERROR [E0798] } <ins> type WithReference = extern "C-cmse-nonsecure-call" fn(&usize); trait Trait {} type WithTraitObject = extern "C-cmse-nonsecure-call" fn(&dyn Trait) -> &dyn Trait; //~^ ERROR return value of `"C-cmse-nonsecure-call"` function too large to pass via registers [E0798] type WithStaticTraitObject = extern "C-cmse-nonsecure-call" fn(&'static dyn Trait) -> &'static dyn Trait; //~^ ERROR return value of `"C-cmse-nonsecure-call"` function too large to pass via registers [E0798] #[repr(transparent)] struct WrapperTransparent<'a>(&'a dyn Trait); type WithTransparentTraitObject = extern "C-cmse-nonsecure-call" fn(WrapperTransparent) -> WrapperTransparent; //~^ ERROR return value of `"C-cmse-nonsecure-call"` function too large to pass via registers [E0798] type WithVarArgs = extern "C-cmse-nonsecure-call" fn(u32, ...); //~^ ERROR C-variadic function must have a compatible calling convention, like `C` or `cdecl` [E0045] </ins>


Attribute::NoInline.apply_llfn(Function, val); } } <del> None if requires_inline => Attribute::InlineHint.apply_llfn(Function, val), </del> None => {} }; }


<ins> // Regression test for #89606. Used to ICE. // // check-pass // revisions: twenty_eighteen twenty_twentyone // [twenty_eighteen]compile-flags: --edition 2018 // [twenty_twentyone]compile-flags: --edition 2021 struct S<'a>(Option<&'a mut i32>); fn by_ref(s: &mut S<'_>) { (|| { let S(_o) = s; s.0 = None; })(); } fn by_value(s: S<'_>) { (|| { let S(ref _o) = s; let _g = s.0; })(); } struct V<'a>((Option<&'a mut i32>,)); fn nested(v: &mut V<'_>) { (|| { let V((_o,)) = v; v.0 = (None, ); })(); } fn main() { let mut s = S(None); by_ref(&mut s); by_value(s); let mut v = V((None, )); nested(&mut v); } </ins>


use rustc_span::edition::Edition; use rustc_span::lev_distance::find_best_match_for_name; use rustc_span::symbol::{kw, Ident, Symbol}; <del> use rustc_span::{Span, DUMMY_SP}; </del> <ins> use rustc_span::Span; </ins> use rustc_target::spec::abi; use rustc_trait_selection::traits; use rustc_trait_selection::traits::astconv_object_safety_violations;


"anyhow", "cargo", "cargo-util", <del> "cargo_metadata 0.12.0", </del> <ins> "cargo_metadata 0.14.0", </ins> "clippy_lints", "crossbeam-channel", "difference", <del> "env_logger 0.7.1", </del> <ins> "env_logger 0.9.0", </ins> "futures 0.3.12", "heck", "home", <del> "itertools 0.9.0", </del> <ins> "itertools 0.10.1", </ins> "jsonrpc-core", "lazy_static", "log",


<del> // ignore-tidy-filelength </del> //! Error Reporting Code for the inference engine //! //! Because of the way inference, and in particular region inference,


Err(err) } <ins> pub(super) fn attr_on_non_tail_expr(&self, expr: &Expr) { // Missing semicolon typo error. let span = self.prev_token.span.shrink_to_hi(); let mut err = self.sess.create_err(ExpectedSemi { span, token: self.token.clone(), unexpected_token_label: Some(self.token.span), sugg: ExpectedSemiSugg::AddSemi(span), }); let attr_span = match &expr.attrs[..] { [] => unreachable!(), [only] => only.span, [first, rest @ ..] => { for attr in rest { err.span_label(attr.span, ""); } first.span } }; err.span_label( attr_span, format!( "only `;` terminated statements or tail expressions are allowed after {}", if expr.attrs.len() == 1 { "this attribute" } else { "these attributes" }, ), ); if self.token == token::Pound && self.look_ahead(1, |t| t.kind == token::OpenDelim(Delimiter::Bracket)) { // We have // #[attr] // expr // #[not_attr] // other_expr err.span_label(span, "expected `;` here"); err.multipart_suggestion( "alternatively, consider surrounding the expression with a block", vec![ (expr.span.shrink_to_lo(), "{ ".to_string()), (expr.span.shrink_to_hi(), " }".to_string()), ], Applicability::MachineApplicable, ); let mut snapshot = self.create_snapshot_for_diagnostic(); if let [attr] = &expr.attrs[..] && let ast::AttrKind::Normal(attr_kind) = &attr.kind && let [segment] = &attr_kind.item.path.segments[..] && segment.ident.name == sym::cfg && let Ok(next_attr) = snapshot.parse_attribute(InnerAttrPolicy::Forbidden(None)) && let ast::AttrKind::Normal(next_attr_kind) = next_attr.kind && let [next_segment] = &next_attr_kind.item.path.segments[..] && segment.ident.name == sym::cfg && let Ok(next_expr) = snapshot.parse_expr() { // We have for sure // #[cfg(..)] // expr // #[cfg(..)] // other_expr // So we suggest using `if cfg!(..) { expr } else if cfg!(..) { other_expr }`. let margin = self.sess.source_map().span_to_margin(next_expr.span).unwrap_or(0); let sugg = vec![ (attr.span.with_hi(segment.span().hi()), "if cfg!".to_string()), ( attr_kind.item.args.span().unwrap().shrink_to_hi().with_hi(attr.span.hi()), " {".to_string(), ), (expr.span.shrink_to_lo(), "    ".to_string()), ( next_attr.span.with_hi(next_segment.span().hi()), "} else if cfg!".to_string(), ), ( next_attr_kind .item .args .span() .unwrap() .shrink_to_hi() .with_hi(next_attr.span.hi()), " {".to_string(), ), (next_expr.span.shrink_to_lo(), "    ".to_string()), (next_expr.span.shrink_to_hi(), format!("n{}}}", " ".repeat(margin))), ]; err.multipart_suggestion( "it seems like you are trying to provide different expressions depending on  `cfg`, consider using `if cfg!(..)`", sugg, Applicability::MachineApplicable, ); } } err.emit(); } </ins> fn check_too_many_raw_str_terminators(&mut self, err: &mut Diagnostic) -> bool { let sm = self.sess.source_map(); match (&self.prev_token.kind, &self.token.kind) {


all(target_vendor = "fortanix", target_env = "sgx") ) ))] <del> mod doc { // On certain platforms right now the "main modules" modules that are // documented don't compile (missing things in `libc` which is empty), // so just omit them with an empty module. #[unstable(issue = "none", feature = "std_internals")] pub mod unix {} #[unstable(issue = "none", feature = "std_internals")] pub mod linux {} #[unstable(issue = "none", feature = "std_internals")] pub mod wasi {} #[unstable(issue = "none", feature = "std_internals")] pub mod windows {} } #[cfg(doc)] #[stable(feature = "os", since = "1.0.0")] pub use doc::*; #[cfg(not(doc))] #[path = "."] mod imp { // If we're not documenting std then we only expose modules appropriate for the // current platform. #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] pub mod fortanix_sgx; #[cfg(target_os = "hermit")] #[path = "hermit/mod.rs"] pub mod unix; </del> <ins> #[unstable(issue = "none", feature = "std_internals")] pub mod linux {} #[cfg(all( doc, any( all(target_arch = "wasm32", not(target_os = "wasi")), all(target_vendor = "fortanix", target_env = "sgx") ) ))] #[unstable(issue = "none", feature = "std_internals")] pub mod wasi {} #[cfg(all( doc, any( all(target_arch = "wasm32", not(target_os = "wasi")), all(target_vendor = "fortanix", target_env = "sgx") ) ))] #[unstable(issue = "none", feature = "std_internals")] pub mod windows {} </ins> <del> #[cfg(target_os = "android")] pub mod android; #[cfg(target_os = "dragonfly")] pub mod dragonfly; #[cfg(target_os = "emscripten")] pub mod emscripten; #[cfg(target_os = "espidf")] pub mod espidf; #[cfg(target_os = "freebsd")] pub mod freebsd; #[cfg(target_os = "fuchsia")] pub mod fuchsia; #[cfg(target_os = "haiku")] pub mod haiku; #[cfg(target_os = "illumos")] pub mod illumos; #[cfg(target_os = "ios")] pub mod ios; #[cfg(target_os = "l4re")] pub mod linux; #[cfg(target_os = "linux")] pub mod linux; #[cfg(target_os = "macos")] pub mod macos; #[cfg(target_os = "netbsd")] pub mod netbsd; #[cfg(target_os = "openbsd")] pub mod openbsd; #[cfg(target_os = "redox")] pub mod redox; #[cfg(target_os = "solaris")] pub mod solaris; #[cfg(unix)] pub mod unix; </del> <ins> // unix #[cfg(not(all( doc, any( all(target_arch = "wasm32", not(target_os = "wasi")), all(target_vendor = "fortanix", target_env = "sgx") ) )))] #[cfg(target_os = "hermit")] #[path = "hermit/mod.rs"] pub mod unix; #[cfg(not(all( doc, any( all(target_arch = "wasm32", not(target_os = "wasi")), all(target_vendor = "fortanix", target_env = "sgx") ) )))] #[cfg(all(not(target_os = "hermit"), any(unix, doc)))] pub mod unix; </ins> <del> #[cfg(target_os = "vxworks")] pub mod vxworks; </del> <ins> // linux #[cfg(not(all( doc, any( all(target_arch = "wasm32", not(target_os = "wasi")), all(target_vendor = "fortanix", target_env = "sgx") ) )))] #[cfg(any(target_os = "linux", target_os = "l4re", doc))] pub mod linux; </ins> <del> #[cfg(target_os = "wasi")] pub mod wasi; </del> <ins> // wasi #[cfg(not(all( doc, any( all(target_arch = "wasm32", not(target_os = "wasi")), all(target_vendor = "fortanix", target_env = "sgx") ) )))] #[cfg(any(target_os = "wasi", doc))] pub mod wasi; </ins> <del> #[cfg(windows)] pub mod windows; } #[cfg(not(doc))] #[stable(feature = "os", since = "1.0.0")] pub use imp::*; </del> <ins> // windows #[cfg(not(all( doc, any( all(target_arch = "wasm32", not(target_os = "wasi")), all(target_vendor = "fortanix", target_env = "sgx") ) )))] #[cfg(any(windows, doc))] pub mod windows; // Others. #[cfg(target_os = "android")] pub mod android; #[cfg(target_os = "dragonfly")] pub mod dragonfly; #[cfg(target_os = "emscripten")] pub mod emscripten; #[cfg(target_os = "espidf")] pub mod espidf; #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] pub mod fortanix_sgx; #[cfg(target_os = "freebsd")] pub mod freebsd; #[cfg(target_os = "fuchsia")] pub mod fuchsia; #[cfg(target_os = "haiku")] pub mod haiku; #[cfg(target_os = "illumos")] pub mod illumos; #[cfg(target_os = "ios")] pub mod ios; #[cfg(target_os = "macos")] pub mod macos; #[cfg(target_os = "netbsd")] pub mod netbsd; #[cfg(target_os = "openbsd")] pub mod openbsd; #[cfg(target_os = "redox")] pub mod redox; #[cfg(target_os = "solaris")] pub mod solaris; #[cfg(target_os = "vxworks")] pub mod vxworks; </ins> #[cfg(any(unix, target_os = "wasi", doc))] mod fd;


self.as_operand(block, local_scope, expr) } <ins> /// Returns an operand suitable for use until the end of the current scope expression and /// suitable also to be passed as function arguments. /// /// The operand returned from this function will *not be valid* after an ExprKind::Scope is /// passed, so please do *not* return it from functions to avoid bad miscompiles.  Returns an /// operand suitable for use as a call argument. This is almost always equivalent to /// `as_operand`, except for the particular case of passing values of (potentially) unsized /// types "by value" (see details below). /// /// The operand returned from this function will *not be valid* /// after the current enclosing `ExprKind::Scope` has ended, so /// please do *not* return it from functions to avoid bad /// miscompiles. /// /// # Parameters of unsized types /// /// We tweak the handling of parameters of unsized type slightly to avoid the need to create a /// local variable of unsized type. For example, consider this program: /// /// ```rust /// fn foo(p: dyn Debug) { ... } /// /// fn bar(box_p: Box<dyn Debug>) { foo(*p); } /// ``` /// /// Ordinarily, for sized types, we would compile the call `foo(*p)` like so: /// /// ```rust /// let tmp0 = *box_p; // tmp0 would be the operand returned by this function call /// foo(tmp0) /// ``` /// /// But because the parameter to `foo` is of the unsized type `dyn Debug`, and because it is /// being moved the deref of a box, we compile it slightly differently. The temporary `tmp0` /// that we create *stores the entire box*, and the parameter to the call itself will be /// `*tmp0`: /// /// ```rust /// let tmp0 = box_p; call foo(*tmp0) /// ``` /// /// This way, the temporary `tmp0` that we create has type `Box<dyn Debug>`, which is sized. /// The value passed to the call (`*tmp0`) still has the `dyn Debug` type -- but the way that /// calls are compiled means that this parameter will be passed "by reference", meaning that we /// will actually provide a pointer to the interior of the box, and not move the `dyn Debug` /// value to the stack. /// /// See #68034 for more details. crate fn as_local_call_operand<M>( &mut self, block: BasicBlock, expr: M, ) -> BlockAnd<Operand<'tcx>> where M: Mirror<'tcx, Output = Expr<'tcx>>, { let local_scope = self.local_scope(); self.as_call_operand(block, local_scope, expr) } </ins> /// Compile `expr` into a value that can be used as an operand. /// If `expr` is a place like `x`, this will introduce a /// temporary `tmp = x`, so that we capture the value of `x` at


<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. //compile-flags: -Z borrowck=mir #![feature(slice_patterns)] fn nop(_s: &[& i32]) {} fn nop_subslice(_s: &[i32]) {} fn const_index_ok(s: &mut [i32]) { if let [ref first, ref second, _, ref fourth, ..] = *s { if let [_, _, ref mut third, ..] = *s { nop(&[first, second, third, fourth]); } } } fn const_index_err(s: &mut [i32]) { if let [ref first, ref second, ..] = *s { if let [_, ref mut  second2, ref mut third, ..] = *s { //~ERROR nop(&[first, second, second2, third]); } } } fn const_index_from_end_ok(s: &mut [i32]) { if let [.., ref fourth, ref third, _, ref first] = *s { if let [.., ref mut second, _] = *s { nop(&[first, second, third, fourth]); } } } fn const_index_from_end_err(s: &mut [i32]) { if let [.., ref fourth, ref third, _, ref first] = *s { if let [.., ref mut third2, _, _] = *s { //~ERROR nop(&[first, third, third2, fourth]); } } } fn const_index_mixed(s: &mut [i32]) { if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s { if let [ref mut from_begin0, ..] = *s { nop(&[from_begin0, from_end1, from_end3, from_end4]); } if let [_, ref mut from_begin1, ..] = *s { //~ERROR nop(&[from_begin1, from_end1, from_end3, from_end4]); } if let [_, _, ref mut from_begin2, ..] = *s { //~ERROR nop(&[from_begin2, from_end1, from_end3, from_end4]); } if let [_, _, _, ref mut from_begin3, ..] = *s { //~ERROR nop(&[from_begin3, from_end1, from_end3, from_end4]); } } if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s { if let [.., ref mut from_end1] = *s { nop(&[from_begin0, from_begin1, from_begin3, from_end1]); } if let [.., ref mut from_end2, _] = *s { //~ERROR nop(&[from_begin0, from_begin1, from_begin3, from_end2]); } if let [.., ref mut from_end3, _,  _] = *s { //~ERROR nop(&[from_begin0, from_begin1, from_begin3, from_end3]); } if let [.., ref mut from_end4, _, _, _] = *s { //~ERROR nop(&[from_begin0, from_begin1, from_begin3, from_end4]); } } } fn const_index_and_subslice_ok(s: &mut [i32]) { if let [ref first, ref second, ..] = *s { if let [_, _, ref mut tail..] = *s { nop(&[first, second]); nop_subslice(tail); } } } fn const_index_and_subslice_err(s: &mut [i32]) { if let [ref first, ref second, ..] = *s { if let [_, ref mut tail..] = *s { //~ERROR nop(&[first, second]); nop_subslice(tail); } } } fn const_index_and_subslice_from_end_ok(s: &mut [i32]) { if let [.., ref second, ref first] = *s { if let [ref mut tail.., _, _] = *s { nop(&[first, second]); nop_subslice(tail); } } } fn const_index_and_subslice_from_end_err(s: &mut [i32]) { if let [.., ref second, ref first] = *s { if let [ref mut tail.., _] = *s { //~ERROR nop(&[first, second]); nop_subslice(tail); } } } fn subslices(s: &mut [i32]) { if let [_, _, _, ref s1..] = *s { if let [ref mut s2.., _, _, _] = *s { //~ERROR nop_subslice(s1); nop_subslice(s2); } } } fn main() { let mut v = [1,2,3,4]; const_index_ok(&mut v); const_index_err(&mut v); const_index_from_end_ok(&mut v); const_index_from_end_err(&mut v); const_index_and_subslice_ok(&mut v); const_index_and_subslice_err(&mut v); const_index_and_subslice_from_end_ok(&mut v); const_index_and_subslice_from_end_err(&mut v); subslices(&mut v); } </ins>


LLVM_BUILD_DIR= LLVM_INST_DIR=$CFG_LLVM_ROOT do_reconfigure=0 <ins> # Check that LLVm FileCheck is available. Needed for the tests need_cmd $LLVM_INST_DIR/bin/FileCheck </ins> fi if [ ${do_reconfigure} -ne 0 ] then # because git is hilarious, it might have put the module index


use rustc_infer::infer::{self, InferOk, TyCtxtInferExt}; use rustc_middle::ty; use rustc_middle::ty::error::{ExpectedFound, TypeError}; <del> use rustc_middle::ty::subst::{InternalSubsts, Subst, SubstsRef}; </del> <ins> use rustc_middle::ty::subst::{InternalSubsts, Subst}; </ins> use rustc_middle::ty::util::ExplicitSelf; <del> use rustc_middle::ty::{GenericParamDefKind, ToPredicate, TyCtxt, WithConstness}; </del> <ins> use rustc_middle::ty::{GenericParamDefKind, ToPredicate, TyCtxt}; </ins> use rustc_span::Span; use rustc_trait_selection::traits::error_reporting::InferCtxtExt; use rustc_trait_selection::traits::{self, ObligationCause, ObligationCauseCode, Reveal}; use super::{potentially_plural_count, FnCtxt, Inherited}; <del> use std::iter; </del> /// Checks that a method from an impl conforms to the signature of /// the same method as declared in the trait.


} tcx.sess.track_errors(|| { <del> tcx.sess.time("impl_wf_inference", || { tcx.hir().for_each_module(|module| tcx.ensure().check_mod_impl_wf(module)) }); })?; tcx.sess.track_errors(|| { </del> tcx.sess.time("coherence_checking", || { <ins> // Check impls constrain their parameters tcx.hir().for_each_module(|module| tcx.ensure().check_mod_impl_wf(module)); </ins> for &trait_def_id in tcx.all_local_trait_impls(()).keys() { tcx.ensure().coherent_trait(trait_def_id); }


/// assert!(ptr::eq(ptr, inner.as_ptr())); /// ``` #[inline] <del> #[unstable(feature = "arc_unwrap_or_clone", issue = "93610")] </del> <ins> #[stable(feature = "arc_unwrap_or_clone", since = "CURRENT_RUSTC_VERSION")] </ins> pub fn unwrap_or_clone(this: Self) -> T { Arc::try_unwrap(this).unwrap_or_else(|arc| (*arc).clone()) }


variant.fields.iter().enumerate().filter_map(move |(i, field)| { let ty = field.ty(cx.tcx, substs); <ins> // `field.ty()` doesn't normalize after substituting. let ty = cx.tcx.normalize_erasing_regions(cx.param_env, ty); </ins> let is_visible = adt.is_enum() || field.vis.is_accessible_from(cx.module, cx.tcx); let is_uninhabited = cx.is_uninhabited(ty);


); } <del> let trait_sig = ocx.normalize(&norm_cause, param_env, unnormalized_trait_sig); </del> <ins> let trait_sig = ocx.normalize(&misc_cause, param_env, unnormalized_trait_sig); </ins> trait_sig.error_reported()?; let trait_return_ty = trait_sig.output(); <ins> // RPITITs are allowed to use the implied predicates of the method that // defines them. This is because we want code like: // ``` // trait Foo { //     fn test<'a, T>(_: &'a T) -> impl Sized; // } // impl Foo for () { //     fn test<'a, T>(x: &'a T) -> &'a T { x } // } // ``` // .. to compile. However, since we use both the normalized and unnormalized // inputs and outputs from the substituted trait signature, we will end up // seeing the hidden type of an RPIT in the signature itself. Naively, this // means that we will use the hidden type to imply the hidden type's own // well-formedness. // // To avoid this, we replace the infer vars used for hidden type inference // with placeholders, which imply nothing about outlives bounds, and then // prove below that the hidden types are well formed. let universe = infcx.create_next_universe(); let mut idx = 0; let mapping: FxHashMap<_, _> = collector .types .iter() .map(|(_, &(ty, _))| { assert!( infcx.resolve_vars_if_possible(ty) == ty && ty.is_ty_var(), "{ty:?} should not have been constrained via normalization", ty = infcx.resolve_vars_if_possible(ty) ); idx += 1; ( ty, Ty::new_placeholder( tcx, ty::Placeholder { universe, bound: ty::BoundTy { var: ty::BoundVar::from_usize(idx), kind: ty::BoundTyKind::Anon, }, }, ), ) }) .collect(); let mut type_mapper = BottomUpFolder { tcx, ty_op: |ty| *mapping.get(&ty).unwrap_or(&ty), lt_op: |lt| lt, ct_op: |ct| ct, }; </ins> let wf_tys = FxIndexSet::from_iter( <del> unnormalized_trait_sig.inputs_and_output.iter().chain(trait_sig.inputs_and_output.iter()), </del> <ins> unnormalized_trait_sig .inputs_and_output .iter() .chain(trait_sig.inputs_and_output.iter()) .map(|ty| ty.fold_with(&mut type_mapper)), </ins> ); match ocx.eq(&cause, param_env, trait_return_ty, impl_return_ty) {


"README.md", "RELEASES.md", "configure", <del> "Makefile.in" </del> <ins> "Makefile.in", "x.py", </ins> ]; let src_dirs = [ "man",


attr: &Attribute, span: Span, target: Target, <ins> attrs: &[Attribute], </ins> ) -> bool { match target { <del> Target::Fn | Target::Method(MethodKind::Trait { body: true } | MethodKind::Inherent) => true, </del> <ins> Target::Fn => { // `#[target_feature]` is not allowed in language items. if let Some((lang_item, _)) = hir::lang_items::extract(attrs) // Calling functions with `#[target_feature]` is // not unsafe on WASM, see #84988 && !self.tcx.sess.target.is_like_wasm && !self.tcx.sess.opts.actually_rustdoc { let hir::Node::Item(item) = self.tcx.hir().get(hir_id) else { unreachable!(); }; let hir::ItemKind::Fn(sig, _, _) = item.kind else { // target is `Fn` unreachable!(); }; self.tcx.sess.emit_err(errors::LangItemWithTargetFeature { attr_span: attr.span, name: lang_item, sig_span: sig.span, }); false } else { true } } Target::Method(MethodKind::Trait { body: true } | MethodKind::Inherent) => true, </ins> // FIXME: #[target_feature] was previously erroneously allowed on statements and some // crates used this, so only emit a warning. Target::Statement => {


<del> use std::any::Any; fn foo<T: Any>(value: &T) -> Box<dyn Any> { Box::new(value) as Box<dyn Any> //~^ ERROR lifetime may not live long enough } fn main() { let _ = foo(&5); } </del>


<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. use std::rc::Rc; struct Foo<'r>(&'r mut i32); impl<'r> Drop for Foo<'r> { fn drop(&mut self) { *self.0 += 1; } } fn main() { let mut drops = 0; { let _: Rc<Send> = Rc::new(Foo(&mut drops)); } assert_eq!(1, drops); } </ins>


<del> { "message": "unnecessary parentheses around assigned value", "code": { "code": "unused_parens", "explanation": null }, "level": "warning", "spans": [ { "file_name": "$DIR/unused_parens_json_suggestion.rs", "byte_start": 654, "byte_end": 667, "line_start": 17, "line_end": 17, "column_start": 14, "column_end": 27, "is_primary": true, "text": [ { "text": "    let _a = (1 / (2 + 3));", "highlight_start": 14, "highlight_end": 27 } ], "label": null, "suggested_replacement": null, "suggestion_applicability": null, "expansion": null } ], "children": [ { "message": "lint level defined here", "code": null, "level": "note", "spans": [ { "file_name": "$DIR/unused_parens_json_suggestion.rs", "byte_start": 472, "byte_end": 485, "line_start": 11, "line_end": 11, "column_start": 9, "column_end": 22, "is_primary": true, "text": [ { "text": "#![warn(unused_parens)]", "highlight_start": 9, "highlight_end": 22 } ], "label": null, "suggested_replacement": null, "suggestion_applicability": null, "expansion": null } ], "children": [], "rendered": null }, { "message": "remove these parentheses", "code": null, "level": "help", "spans": [ { "file_name": "$DIR/unused_parens_json_suggestion.rs", "byte_start": 654, "byte_end": 667, "line_start": 17, "line_end": 17, "column_start": 14, "column_end": 27, "is_primary": true, "text": [ { "text": "    let _a = (1 / (2 + 3));", "highlight_start": 14, "highlight_end": 27 } ], "label": null, "suggested_replacement": "1 / (2 + 3)", "suggestion_applicability": "MachineApplicable", "expansion": null } ], "children": [], "rendered": null } ], "rendered": "warning: unnecessary parentheses around assigned value --> $DIR/unused_parens_json_suggestion.rs:17:14 </del> <ins> {"message":"unnecessary parentheses around assigned value","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":596,"byte_end":609,"line_start":16,"line_end":16,"column_start":14,"column_end":27,"is_primary":true,"text":[{"text":"    let _a = (1 / (2 + 3)); --> $DIR/unused_parens_json_suggestion.rs:16:14 </ins> | LL |     let _a = (1 / (2 + 3)); |              ^^^^^^^^^^^^^ help: remove these parentheses | note: lint level defined here <del> --> $DIR/unused_parens_json_suggestion.rs:11:9 </del> <ins> --> $DIR/unused_parens_json_suggestion.rs:10:9 </ins> | <del> LL | #![warn(unused_parens)] </del> <ins> LL | #![deny(unused_parens)] </ins> |         ^^^^^^^^^^^^^ <del> " } </del> <ins> "} {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error "} </ins>


<del> // revisions: min_const_fn const_fn #![cfg_attr(const_fn, feature(const_fn))] enum E { V(i32), } const EXTERNAL_CONST: Option<i32> = {Some}(1); //[min_const_fn]~^ ERROR is not yet stable as a const fn //[const_fn]~^^ ERROR is not yet stable as a const fn const LOCAL_CONST: E = {E::V}(1); //[min_const_fn]~^ ERROR is not yet stable as a const fn //[const_fn]~^^ ERROR is not yet stable as a const fn const fn external_fn() { let _ = {Some}(1); //[min_const_fn]~^ ERROR is not yet stable as a const fn //[const_fn]~^^ ERROR is not yet stable as a const fn } const fn local_fn() { let _ = {E::V}(1); //[min_const_fn]~^ ERROR is not yet stable as a const fn //[const_fn]~^^ ERROR is not yet stable as a const fn } fn main() {} </del>


#[stable(feature = "rust1", since = "1.0.0")] impl<W: Write> Drop for BufWriter<W> { fn drop(&mut self) { <del> if self.inner.is_some() { </del> <ins> if self.inner.is_some() && !self.panicked { </ins> // dtors should not panic, so we ignore a failed flush let _r = self.flush_buf(); }


/// /// # Panics /// <del> /// When the number is zero, or if the base is not at least 2; /// it panics in debug mode and the return value is 0 in release mode. </del> <ins> /// This function will panic if `self` is zero, or if `base` is less then 2. </ins> /// /// # Examples ///


<ins> // Issue #3878 // Issue Name: Unused move causes a crash // Abstract: zero-fill to block after drop fn main() { let y = ~1; move y; } </ins>  No newline at end of file


unsafe { foo(); //~ ERROR: this function takes at least 2 parameters but 0 parameters were supplied //~^ NOTE the following parameter types were expected <ins> //~| NOTE expected at least 2 parameters </ins> foo(1); //~ ERROR: this function takes at least 2 parameters but 1 parameter was supplied //~^ NOTE the following parameter types were expected <ins> //~| NOTE expected at least 2 parameters </ins> let x: unsafe extern "C" fn(f: isize, x: u8) = foo; //~^ ERROR: mismatched types


fn inner() { let _ = foo!(third); } <ins> #[allow(semicolon_in_expressions_from_macros)] async { let _ = foo!(fourth); }; </ins> }


<ins> // check-pass // edition:2021 #![feature(async_fn_in_trait)] #![allow(incomplete_features)] use std::future::Future; async fn yield_now() {} trait AsyncIterator { type Item; async fn next(&mut self) -> Option<Self::Item>; } struct YieldingRange { counter: u32, stop: u32, } impl AsyncIterator for YieldingRange { type Item = u32; async fn next(&mut self) -> Option<Self::Item> { if self.counter == self.stop { None } else { let c = self.counter; self.counter += 1; yield_now().await; Some(c) } } } async fn async_main() { let mut x = YieldingRange { counter: 0, stop: 10 }; while let Some(v) = x.next().await { println!("Hi: {v}"); } } fn main() { let _ = async_main(); } </ins>


fn add_object(&mut self, path: &Path); fn gc_sections(&mut self, keep_metadata: bool); fn position_independent_executable(&mut self); <ins> fn no_position_independent_executable(&mut self); </ins> fn partial_relro(&mut self); fn full_relro(&mut self); fn optimize(&mut self);


discr, variants }, <del> // FIXME(eddyb): using `FieldPlacement::Arbitrary` here results // in lost optimizations, specifically around allocations, see // `test/codegen/{alloc-optimisation,vec-optimizes-away}.rs`. fields: FieldPlacement::Union(1), </del> <ins> fields: FieldPlacement::Arbitrary { offsets: vec![Size::from_bytes(0)], memory_index: vec![0] }, </ins> abi, align, size


fn remove_dir_all_recursive(parent_fd: Option<RawFd>, p: &Path) -> io::Result<()> { let pcstr = cstr(p)?; <del> // entry is expected to be a directory, open as such let fd = openat_nofollow_dironly(parent_fd, &pcstr)?; </del> <ins> // try opening as directory let fd = match openat_nofollow_dironly(parent_fd, &pcstr) { Err(err) if err.raw_os_error() == Some(libc::ENOTDIR) => { // not a directory - don't traverse further return match parent_fd { // unlink... Some(parent_fd) => { cvt(unsafe { unlinkat(parent_fd, pcstr.as_ptr(), 0) }).map(drop) } // ...unless this was supposed to be the deletion root directory None => Err(err), }; } result => result?, }; </ins> // open the directory passing ownership of the fd let (dir, fd) = fdreaddir(fd)?;


<ins> - // MIR for `call` before Inline + // MIR for `call` after Inline fn call(_1: &T) -> i32 { debug s => _1; let mut _0: i32; let mut _2: &T; +     scope 1 (inlined <T as Foo>::bar) { +         debug self => _2; +     } bb0: { StorageLive(_2); _2 = &(*_1); -         _0 = <T as Foo>::bar(move _2) -> [return: bb1, unwind unreachable]; -     } - -     bb1: { +         _0 = const 0_i32; StorageDead(_2); return; } } </ins>


cx: X, input: X::Input, <del> result: X::Result, </del> <ins> origin_result: X::Result, </ins> dep_node: X::DepNodeIndex, additional_depth: usize, encountered_overflow: bool, nested_goals: NestedGoals<X>, ) { <del> let result = cx.mk_tracked(result, dep_node); </del> <ins> let result = cx.mk_tracked(origin_result, dep_node); </ins> let entry = self.map.entry(input).or_default(); if encountered_overflow { let with_overflow = WithOverflow { nested_goals, result }; let prev = entry.with_overflow.insert(additional_depth, with_overflow); <del> assert!(prev.is_none()); </del> <ins> if let Some(prev) = &prev { assert!(cx.evaluation_is_concurrent()); assert_eq!(cx.get_tracked(&prev.result), origin_result); } </ins> } else { let prev = entry.success.replace(Success { additional_depth, nested_goals, result }); <del> assert!(prev.is_none()); </del> <ins> if let Some(prev) = &prev { assert!(cx.evaluation_is_concurrent()); assert_eq!(cx.get_tracked(&prev.result), origin_result); } </ins> } }


<ins> error[E0658]: generic associated types are unstable --> $DIR/gat-dont-ice-on-absent-feature.rs:7:5 | LL |     type Item<'b> = &'b Foo; |     ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: for more information, see https://github.com/rust-lang/rust/issues/44265 = help: add #![feature(generic_associated_types)] to the crate attributes to enable error: aborting due to previous error For more information about this error, try `rustc --explain E0658`. </ins>


pub fn normal_test_fn() { #[expect(unused_mut, reason = "this expectation will create a diagnostic with the default lint level")] //~^ WARNING this lint expectation is unfulfilled <ins> //~| WARNING this lint expectation is unfulfilled </ins> //~| NOTE this expectation will create a diagnostic with the default lint level <ins> //~| NOTE this expectation will create a diagnostic with the default lint level //~| NOTE duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` </ins> let mut v = vec![1, 1, 2, 3, 5]; v.sort(); // Check that lint lists including `unfulfilled_lint_expectations` are also handled correctly #[expect(unused, unfulfilled_lint_expectations, reason = "the expectation for `unused` should be fulfilled")] //~^ WARNING this lint expectation is unfulfilled <ins> //~| WARNING this lint expectation is unfulfilled //~| NOTE the expectation for `unused` should be fulfilled </ins> //~| NOTE the expectation for `unused` should be fulfilled //~| NOTE the `unfulfilled_lint_expectations` lint can't be expected and will always produce this message <ins> //~| NOTE the `unfulfilled_lint_expectations` lint can't be expected and will always produce this message //~| NOTE duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` </ins> let value = "I'm unused"; }


} if (*task).unwinder.unwinding { <del> rtabort!("unwinding again"); </del> <ins> // If a task fails while it's already unwinding then we // have limited options. Currently our preference is to // just abort. In the future we may consider resuming // unwinding or otherwise exiting the task cleanly. rterrln!("task failed during unwinding (double-failure - total drag!)") rterrln!("rust must abort now. so sorry."); intrinsics::abort(); </ins> } }


// Verify that '>' is not both expected and found at the same time, as it used // to happen in #24780. For example, following should be an error: <del> // expected one of ..., `>`, ... found `>`. No longer exactly this, but keeping for posterity. </del> <ins> // expected one of ..., `>`, ... found `>`. </ins> <del> fn foo() -> Vec<usize>> { //~ ERROR unmatched angle bracket </del> <ins> fn foo() -> Vec<usize>> { //~ ERROR expected one of `!`, `+`, `::`, `;`, `where`, or `{`, found `>` </ins> Vec::new() }


.emit(); } <del> if has_trait_upcasting_coercion && !self.tcx().features().trait_upcasting { feature_err( </del> <ins> if let Some((sub, sup)) = has_trait_upcasting_coercion && !self.tcx().features().trait_upcasting { // Renders better when we erase regions, since they're not really the point here. let (sub, sup) = self.tcx.erase_regions((sub, sup)); let mut err = feature_err( </ins> &self.tcx.sess.parse_sess, sym::trait_upcasting, self.cause.span, <del> "trait upcasting coercion is experimental", ) .emit(); </del> <ins> &format!("cannot cast `{sub}` to `{sup}`, trait upcasting coercion is experimental"), ); err.note(&format!("required when coercing `{source}` into `{target}`")); err.emit(); </ins> } Ok(coercion)


ifdef TRACE CFG_RUSTC_FLAGS += -Z trace endif <ins> ifdef DISABLE_RPATH # NOTE: make this CFG_RUSTC_FLAGS after stage0 snapshot RUSTFLAGS_STAGE1 += --no-rpath RUSTFLAGS_STAGE2 += --no-rpath RUSTFLAGS_STAGE3 += --no-rpath endif </ins> # The executables crated during this compilation process have no need to include # static copies of libstd and libextra. We also generate dynamic versions of all


use ascii; use borrow::{Cow, ToOwned, Borrow}; use boxed::Box; <del> use clone::Clone; </del> use convert::{Into, From}; use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering}; use error::Error;


#![feature(rustc_attrs)] fn main() { <del> #![rustc_dummy("hi" , 1 , 2 , 1.012 , pi = 3.14 , bye , name ("John"))] </del> <ins> #![rustc_dummy("hi", 1, 2, 1.012, pi = 3.14, bye, name ("John"))] </ins> #[rustc_dummy = 8] fn f() { } <del> #[rustc_dummy(1 , 2 , 3)] </del> <ins> #[rustc_dummy(1, 2, 3)] </ins> fn g() { } }


!msg.contains("if and else have incompatible types") && !msg.contains("if may be missing an else clause") && !msg.contains("match arms have incompatible types") && <del> !msg.contains("structure constructor specifies a structure of type") { </del> <ins> !msg.contains("structure constructor specifies a structure of type") && !msg.contains("has an incompatible type for trait") { </ins> return None } let first = msg.match_indices("expected").filter(|s| {


match ty.normalized.ty_adt_def() { Some(adt_def) if adt_def.has_ctor() => { let (ctor_kind, ctor_def_id) = adt_def.non_enum_variant().ctor.unwrap(); <ins> // Check the visibility of the ctor. let vis = tcx.visibility(ctor_def_id); if !vis.is_accessible_from(tcx.parent_module(hir_id).to_def_id(), tcx) { tcx.sess .emit_err(CtorIsPrivate { span, def: tcx.def_path_str(adt_def.did()) }); } </ins> let new_res = Res::Def(DefKind::Ctor(CtorOf::Struct, ctor_kind), ctor_def_id); let user_substs = Self::user_substs_for_adt(ty); user_self_ty = user_substs.user_self_ty;


FfiUnsafe { ty: Ty<'tcx>, reason: String, help: Option<String> }, } <del> fn ty_is_known_nonnull<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> bool { match ty.kind { ty::FnPtr(_) => true, ty::Ref(..) => true, ty::Adt(field_def, substs) if field_def.repr.transparent() && !field_def.is_union() => { for field in field_def.all_fields() { let field_ty = tcx.normalize_erasing_regions(ParamEnv::reveal_all(), field.ty(tcx, substs)); if field_ty.is_zst(tcx, field.did) { continue; } </del> <ins> impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { /// Is type known to be non-null? fn ty_is_known_nonnull(&self, ty: Ty<'tcx>) -> bool { match ty.kind { ty::FnPtr(_) => true, ty::Ref(..) => true, ty::Adt(field_def, substs) if field_def.repr.transparent() && !field_def.is_union() => { for field in field_def.all_fields() { let field_ty = self.cx.tcx.normalize_erasing_regions( self.cx.param_env, field.ty(self.cx.tcx, substs), ); if field_ty.is_zst(self.cx.tcx, field.did) { continue; } </ins> <del> let attrs = tcx.get_attrs(field_def.did); if attrs.iter().any(|a| a.check_name(sym::rustc_nonnull_optimization_guaranteed)) || ty_is_known_nonnull(tcx, field_ty) { return true; </del> <ins> let attrs = self.cx.tcx.get_attrs(field_def.did); if attrs .iter() .any(|a| a.check_name(sym::rustc_nonnull_optimization_guaranteed)) || self.ty_is_known_nonnull(field_ty) { return true; } </ins> } <del> } false </del> <ins> false } _ => false, </ins> } <del> _ => false, </del> } <del> } /// Check if this enum can be safely exported based on the /// "nullable pointer optimization". Currently restricted /// to function pointers, references, core::num::NonZero*, /// core::ptr::NonNull, and #[repr(transparent)] newtypes. /// FIXME: This duplicates code in codegen. fn is_repr_nullable_ptr<'tcx>( tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, ty_def: &'tcx ty::AdtDef, substs: SubstsRef<'tcx>, ) -> bool { if ty_def.variants.len() != 2 { return false; } </del> <ins> /// Check if this enum can be safely exported based on the "nullable pointer optimization". /// Currently restricted to function pointers, references, `core::num::NonZero*`, /// `core::ptr::NonNull`, and `#[repr(transparent)]` newtypes. fn is_repr_nullable_ptr( &self, ty: Ty<'tcx>, ty_def: &'tcx ty::AdtDef, substs: SubstsRef<'tcx>, ) -> bool { if ty_def.variants.len() != 2 { return false; } </ins> <del> let get_variant_fields = |index| &ty_def.variants[VariantIdx::new(index)].fields; let variant_fields = [get_variant_fields(0), get_variant_fields(1)]; let fields = if variant_fields[0].is_empty() { &variant_fields[1] } else if variant_fields[1].is_empty() { &variant_fields[0] } else { return false; }; </del> <ins> let get_variant_fields = |index| &ty_def.variants[VariantIdx::new(index)].fields; let variant_fields = [get_variant_fields(0), get_variant_fields(1)]; let fields = if variant_fields[0].is_empty() { &variant_fields[1] } else if variant_fields[1].is_empty() { &variant_fields[0] } else { return false; }; </ins> <del> if fields.len() != 1 { return false; } </del> <ins> if fields.len() != 1 { return false; } </ins> <del> let field_ty = fields[0].ty(tcx, substs); if !ty_is_known_nonnull(tcx, field_ty) { return false; } </del> <ins> let field_ty = fields[0].ty(self.cx.tcx, substs); if !self.ty_is_known_nonnull(field_ty) { return false; } </ins> <del> // At this point, the field's type is known to be nonnull and the parent enum is Option-like. // If the computed size for the field and the enum are different, the nonnull optimization isn't // being applied (and we've got a problem somewhere). let compute_size_skeleton = |t| SizeSkeleton::compute(t, tcx, ParamEnv::reveal_all()).unwrap(); if !compute_size_skeleton(ty).same_size(compute_size_skeleton(field_ty)) { bug!("improper_ctypes: Option nonnull optimization not applied?"); } </del> <ins> // At this point, the field's type is known to be nonnull and the parent enum is // Option-like. If the computed size for the field and the enum are different, the non-null // optimization isn't being applied (and we've got a problem somewhere). let compute_size_skeleton = |t| SizeSkeleton::compute(t, self.cx.tcx, self.cx.param_env).unwrap(); if !compute_size_skeleton(ty).same_size(compute_size_skeleton(field_ty)) { bug!("improper_ctypes: Option nonnull optimization not applied?"); } </ins> <del> true } </del> <ins> true } </ins> <del> impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { </del> /// Check if the type is array and emit an unsafe type lint. fn check_for_array_ty(&mut self, sp: Span, ty: Ty<'tcx>) -> bool { if let ty::Array(..) = ty.kind {


<ins> error[E0224]: at least one trait is required for an object type --> $DIR/issue-79467.rs:4:5 | LL |     dyn 'static: 'static + Copy, |     ^^^^^^^^^^^ error: aborting due to previous error For more information about this error, try `rustc --explain E0224`. </ins>


expr.span); } Err(..) => { <del> rcx.fcx.tcx().sess.span_note(expr.span, "cat_expr_unadjusted Errd during dtor check"); </del> <ins> let tcx = rcx.fcx.tcx(); if tcx.sess.has_errors() { // cannot run dropck; okay b/c in error state anyway. } else { tcx.sess.span_bug(expr.span, "cat_expr_unadjusted Errd"); } </ins> } } }


#![crate_id="lint_stability#0.1"] #![crate_type = "lib"] <ins> #![feature(macro_rules)] #![macro_escape] </ins> #[deprecated] pub fn deprecated() {} #[deprecated="text"]


let receiver_ty = sig.inputs()[0]; let receiver_ty = wfcx.normalize(span, None, receiver_ty); <ins> // If the receiver already has errors reported, consider it valid to avoid // unnecessary errors (#58712). if receiver_ty.references_error() { return Ok(()); } </ins> if tcx.features().arbitrary_self_types { if !receiver_is_valid(wfcx, span, receiver_ty, self_ty, true) { // Report error; `arbitrary_self_types` was enabled.


let filename = "tests/parser/unclosed-delims/issue_4466.rs"; assert_parser_error(filename); } <ins> #[test] fn crate_parsing_stashed_diag() { // See also https://github.com/rust-lang/rust/issues/121450 let filename = "tests/parser/stashed-diag.rs"; assert_parser_error(filename); } </ins>


<ins> #![feature(external_doc)] #![crate_name = "foo"] // @has foo/struct.Example.html // @matches - '//pre[@class="rust rust-example-rendered"]'  //     '(?m)let example = Example::new()n    .first()n    .second()n    .build();Z' /// ```rust /// let example = Example::new() ///     .first() #[cfg_attr(not(feature = "one"), doc = "    .second()")] ///     .build(); /// ``` pub struct Example; // @has foo/struct.F.html // @matches - '//pre[@class="rust rust-example-rendered"]'  //     '(?m)let example = Example::new()n    .first()n    .another()n    .build();Z' ///```rust ///let example = Example::new() ///    .first() #[cfg_attr(not(feature = "one"), doc = "    .another()")] ///    .build(); /// ``` pub struct F; // @has foo/struct.G.html // @matches - '//pre[@class="rust rust-example-rendered"]'  //     '(?m)let example = Example::new()n.first()n    .another()n.build();Z' ///```rust ///let example = Example::new() ///.first() #[cfg_attr(not(feature = "one"), doc = "    .another()")] ///.build(); ///``` pub struct G; // @has foo/struct.H.html // @has - '//div[@class="docblock"]/p' 'no whitespace lol' ///no whitespace #[doc = " lol"] pub struct H; // @has foo/struct.I.html // @matches - '//pre[@class="rust rust-example-rendered"]' '(?m)4 whitespaces!Z' ///     4 whitespaces! #[doc = "something"] pub struct I; // @has foo/struct.J.html // @matches - '//div[@class="docblock"]/p' '(?m)anno whitespacenJust some text.Z' ///a ///no whitespace #[doc(include = "unindent.md")] pub struct J; // @has foo/struct.K.html // @matches - '//pre[@class="rust rust-example-rendered"]' '(?m)4 whitespaces!Z' ///a /// ///    4 whitespaces! /// #[doc(include = "unindent.md")] pub struct K; </ins>


#![crate_name = "foo"] // @has foo/fn.f.html <del> // @has - '//*[@class="rust fn"]' 'pub fn f(0u8 ...255: u8)' </del> <ins> // @has - '//*[@class="rust fn"]' 'pub fn f(_: u8)' </ins> pub fn f(0u8...255: u8) {}


} // Empty groups `a::b::{}` are turned into synthetic `self` imports <del> // `a::b::c::{self as _}`, so that their prefixes are correctly </del> <ins> // `a::b::c::{self as __dummy}`, so that their prefixes are correctly </ins> // resolved and checked for privacy/stability/etc. if items.is_empty() && !empty_for_self(&prefix) { let new_span = prefix[prefix.len() - 1].ident.span;


<ins> // error-pattern: requires `generator` lang_item #![feature(no_core, lang_items, unboxed_closures)] #![no_core] #[lang = "sized"] pub trait Sized { } #[lang = "fn_once"] #[rustc_paren_sugar] pub trait FnOnce<Args> { type Output; extern "rust-call" fn call_once(self, args: Args) -> Self::Output; } pub fn abc() -> impl FnOnce(f32) { |_| {} } fn main() {} </ins>


"num_cpus", "ordslice", "racer", <del> "rand 0.7.3", </del> <ins> "rand 0.8.4", </ins> "rayon", "regex", "rls-analysis",


pub mod c_str; pub mod os; pub mod path; <ins> pub mod path2; </ins> pub mod rand; pub mod run; pub mod sys;


<ins> error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants --> $DIR/issue-93647.rs:2:5 | LL |     (||1usize)() |     ^^^^^^^^^^^^ error: aborting due to previous error For more information about this error, try `rustc --explain E0015`. </ins>


match self.find_library_crate() { Some(t) => t, None => { <ins> self.sess.abort_if_errors(); </ins> let message = match root_ident { None => format!("can't find crate for `{}`", self.ident), Some(c) => format!("can't find crate for `{}` which `{}` depends on",


#[cfg(any(target_os = "horizon", target_os = "hurd"))] pub fn modified(&self) -> io::Result<SystemTime> { <del> Ok(SystemTime::from(self.stat.st_mtim)) </del> <ins> SystemTime::new(self.stat.st_mtim.tv_sec as i64, self.stat.st_mtim.tv_nsec as i64) </ins> } #[cfg(not(any(


let result = match e.node { hir::ExprUnary(hir::UnNeg, ref inner) => { // unary neg literals already got their sign during creation <del> match inner.node { hir::ExprLit(ref lit) => { use syntax::ast::*; use syntax::ast::LitIntType::*; const I8_OVERFLOW: u64 = ::std::i8::MAX as u64 + 1; const I16_OVERFLOW: u64 = ::std::i16::MAX as u64 + 1; const I32_OVERFLOW: u64 = ::std::i32::MAX as u64 + 1; const I64_OVERFLOW: u64 = ::std::i64::MAX as u64 + 1; match (&lit.node, ety.map(|t| &t.sty)) { (&LitKind::Int(I8_OVERFLOW, Unsuffixed), Some(&ty::TyInt(IntTy::I8))) | (&LitKind::Int(I8_OVERFLOW, Signed(IntTy::I8)), _) => { return Ok(Integral(I8(::std::i8::MIN))) }, (&LitKind::Int(I16_OVERFLOW, Unsuffixed), Some(&ty::TyInt(IntTy::I16))) | (&LitKind::Int(I16_OVERFLOW, Signed(IntTy::I16)), _) => { return Ok(Integral(I16(::std::i16::MIN))) }, (&LitKind::Int(I32_OVERFLOW, Unsuffixed), Some(&ty::TyInt(IntTy::I32))) | (&LitKind::Int(I32_OVERFLOW, Signed(IntTy::I32)), _) => { return Ok(Integral(I32(::std::i32::MIN))) }, (&LitKind::Int(I64_OVERFLOW, Unsuffixed), Some(&ty::TyInt(IntTy::I64))) | (&LitKind::Int(I64_OVERFLOW, Signed(IntTy::I64)), _) => { return Ok(Integral(I64(::std::i64::MIN))) }, (&LitKind::Int(n, Unsuffixed), Some(&ty::TyInt(IntTy::Is))) | (&LitKind::Int(n, Signed(IntTy::Is)), _) => { match tcx.sess.target.int_type { IntTy::I16 => if n == I16_OVERFLOW { return Ok(Integral(Isize(Is16(::std::i16::MIN)))); }, IntTy::I32 => if n == I32_OVERFLOW { return Ok(Integral(Isize(Is32(::std::i32::MIN)))); }, IntTy::I64 => if n == I64_OVERFLOW { return Ok(Integral(Isize(Is64(::std::i64::MIN)))); }, _ => bug!(), } }, _ => {}, } }, hir::ExprUnary(hir::UnNeg, ref inner) => { // skip `--$expr` return eval_const_expr_partial(tcx, inner, ty_hint, fn_args); }, _ => {}, </del> <ins> if let hir::ExprLit(ref lit) = inner.node { use syntax::ast::*; use syntax::ast::LitIntType::*; const I8_OVERFLOW: u64 = ::std::i8::MAX as u64 + 1; const I16_OVERFLOW: u64 = ::std::i16::MAX as u64 + 1; const I32_OVERFLOW: u64 = ::std::i32::MAX as u64 + 1; const I64_OVERFLOW: u64 = ::std::i64::MAX as u64 + 1; match (&lit.node, ety.map(|t| &t.sty)) { (&LitKind::Int(I8_OVERFLOW, Unsuffixed), Some(&ty::TyInt(IntTy::I8))) | (&LitKind::Int(I8_OVERFLOW, Signed(IntTy::I8)), _) => { return Ok(Integral(I8(::std::i8::MIN))) }, (&LitKind::Int(I16_OVERFLOW, Unsuffixed), Some(&ty::TyInt(IntTy::I16))) | (&LitKind::Int(I16_OVERFLOW, Signed(IntTy::I16)), _) => { return Ok(Integral(I16(::std::i16::MIN))) }, (&LitKind::Int(I32_OVERFLOW, Unsuffixed), Some(&ty::TyInt(IntTy::I32))) | (&LitKind::Int(I32_OVERFLOW, Signed(IntTy::I32)), _) => { return Ok(Integral(I32(::std::i32::MIN))) }, (&LitKind::Int(I64_OVERFLOW, Unsuffixed), Some(&ty::TyInt(IntTy::I64))) | (&LitKind::Int(I64_OVERFLOW, Signed(IntTy::I64)), _) => { return Ok(Integral(I64(::std::i64::MIN))) }, (&LitKind::Int(n, Unsuffixed), Some(&ty::TyInt(IntTy::Is))) | (&LitKind::Int(n, Signed(IntTy::Is)), _) => { match tcx.sess.target.int_type { IntTy::I16 => if n == I16_OVERFLOW { return Ok(Integral(Isize(Is16(::std::i16::MIN)))); }, IntTy::I32 => if n == I32_OVERFLOW { return Ok(Integral(Isize(Is32(::std::i32::MIN)))); }, IntTy::I64 => if n == I64_OVERFLOW { return Ok(Integral(Isize(Is64(::std::i64::MIN)))); }, _ => bug!(), } }, _ => {}, } </ins> } match eval_const_expr_partial(tcx, &inner, ty_hint, fn_args)? { Float(f) => Float(-f),


fn poll_write_vectored( self, cx: &mut Option<String>,  bufs: &[usize]   bufs: &[usize],  ) -> Option<Result<usize, Error>> { ... } }  No newline at end of file


use crate::build::expr::category::{Category, RvalueFunc}; use crate::build::{BlockAnd, BlockAndExtension, BlockFrame, Builder}; use crate::hair::*; <del> use rustc_middle::mir::*; use rustc_middle::ty::{self, CanonicalUserTypeAnnotation}; </del> use rustc_data_structures::fx::FxHashMap; use rustc_hir as hir; <ins> use rustc_middle::mir::*; use rustc_middle::ty::{self, CanonicalUserTypeAnnotation}; </ins> use rustc_span::symbol::sym; use rustc_target::spec::abi::Abi;


<ins> // The problem in #66357 was that the call trace: // // - parse_fn_block_decl // - expect_or // - unexpected // - expect_one_of // - expected_one_of_not_found // - recover_closing_delimiter // // ended up bubbling up `Ok(true)` to `unexpected` which then used `unreachable!()`. fn f() { |[](* } //~^ ERROR expected one of `,` or `:`, found `(` //~| ERROR expected one of `)`, `-`, `_`, `box`, `mut`, `ref`, `|`, identifier, or path, found `*` </ins>


<ins> const QUERY = 'MyForeignType::my_method'; const EXPECTED = { 'others': [ // Test case for https://github.com/rust-lang/rust/pull/96887#pullrequestreview-967154358 // Validates that the parent path for a foreign type method is correct. { 'path': 'foreign_type_path::aaaaaaa::MyForeignType', 'name': 'my_method' }, ], }; </ins>


Obligation::misc(tcx, span, self.mir_def_id(), self.param_env, pred) })); <del> if ocx.select_all_or_error().is_empty() { </del> <ins> if ocx.select_all_or_error().is_empty() && count > 0 { </ins> diag.span_suggestion_verbose( tcx.hir().body(*body).value.peel_blocks().span.shrink_to_lo(), "dereference the return value",


#![forbid(dead_code)] #[derive(Debug)] <del> pub struct Whatever { //~ ERROR struct `Whatever` is never constructed </del> <ins> pub struct Whatever { </ins> pub field0: (), <del> field1: (), </del> <ins> field1: (), //~ ERROR fields `field1`, `field2`, `field3`, and `field4` are never read </ins> field2: (), field3: (), field4: (),


issue_url = gh_url() + '/{}/comments'.format(number) response = urllib2.urlopen(urllib2.Request( issue_url, <del> json.dumps({'body': maybe_delink(message)}), </del> <ins> json.dumps({'body': maybe_delink(message)}).encode(), </ins> { 'Authorization': 'token ' + github_token, 'Content-Type': 'application/json', } )) response.read() <del> except urllib2.HTTPError as e: print("HTTPError: %sn%s" % (e, e.read())) </del> <ins> except HTTPError as e: print("HTTPError: %sn%r" % (e, e.read())) </ins> raise


= note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) <ins> Future breakage diagnostic: error: reference to packed field is unaligned --> $DIR/unaligned_references.rs:90:20 | LL |         let _ref = &m1.1.a; |                    ^^^^^^^ | note: the lint level is defined here --> $DIR/unaligned_references.rs:1:9 | LL | #![deny(unaligned_references)] |         ^^^^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523> = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) Future breakage diagnostic: error: reference to packed field is unaligned --> $DIR/unaligned_references.rs:100:20 | LL |         let _ref = &m2.1.a; |                    ^^^^^^^ | note: the lint level is defined here --> $DIR/unaligned_references.rs:1:9 | LL | #![deny(unaligned_references)] |         ^^^^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523> = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) </ins>


// + span: $DIR/nrvo-simple.rs:3:20: 3:21 // + literal: Const { ty: u8, val: Value(Scalar(0x00)) } StorageLive(_3);                 // scope 1 at $DIR/nrvo-simple.rs:4:5: 4:19 <ins> StorageLive(_5);                 // scope 1 at $DIR/nrvo-simple.rs:4:10: 4:18 StorageLive(_6);                 // scope 1 at $DIR/nrvo-simple.rs:4:10: 4:18 </ins> -         _6 = &mut _2;                    // scope 1 at $DIR/nrvo-simple.rs:4:10: 4:18 +         _6 = &mut _0;                    // scope 1 at $DIR/nrvo-simple.rs:4:10: 4:18 <del> _3 = move _1(move _6) -> bb1;    // scope 1 at $DIR/nrvo-simple.rs:4:5: 4:19 </del> <ins> _5 = &mut (*_6);                 // scope 1 at $DIR/nrvo-simple.rs:4:10: 4:18 _3 = move _1(move _5) -> bb1;    // scope 1 at $DIR/nrvo-simple.rs:4:5: 4:19 </ins> } bb1: { <ins> StorageDead(_5);                 // scope 1 at $DIR/nrvo-simple.rs:4:18: 4:19 StorageDead(_6);                 // scope 1 at $DIR/nrvo-simple.rs:4:19: 4:20 </ins> StorageDead(_3);                 // scope 1 at $DIR/nrvo-simple.rs:4:19: 4:20 -         _0 = _2;                         // scope 1 at $DIR/nrvo-simple.rs:5:5: 5:8 -         StorageDead(_2);                 // scope 0 at $DIR/nrvo-simple.rs:6:1: 6:2


this.visit_ty(&ty); } } <del> GenericParamKind::Const { ref ty, .. } => { </del> <ins> GenericParamKind::Const { ref ty, default } => { </ins> let was_in_const_generic = this.is_in_const_generic; this.is_in_const_generic = true; walk_list!(this, visit_param_bound, param.bounds); this.visit_ty(&ty); <ins> if let Some(default) = default { this.visit_body(this.tcx.hir().body(default.body)); } </ins> this.is_in_const_generic = was_in_const_generic; } }


} else { cmd = Command::new(&output_file); if doctest.is_multiple_tests { <del> cmd.arg("*doctest-bin-path"); cmd.arg(&output_file); </del> <ins> cmd.env("RUSTDOC_DOCTEST_BIN_PATH", &output_file); </ins> } } if let Some(run_directory) = &rustdoc_options.test_run_directory {


fn f() -> bool { let c = false; <del> if c { </del> <ins> if c { //~ ERROR unnecessary parentheses </ins> println!("next"); } <del> if c { </del> <ins> if c { //~ ERROR unnecessary parentheses </ins> println!("prev"); } while false && true { <del> if c { </del> <ins> if c { //~ ERROR unnecessary parentheses </ins> println!("norm"); } } <del> while true && false { for _ in 0 .. 3 { </del> <ins> while true && false { //~ ERROR unnecessary parentheses for _ in 0 .. 3 { //~ ERROR unnecessary parentheses </ins> println!("e~") } } <del> for _ in 0 .. 3 { while true && false { </del> <ins> for _ in 0 .. 3 { //~ ERROR unnecessary parentheses while true && false { //~ ERROR unnecessary parentheses </ins> println!("e~") } }


<ins> fn foo<T: impl Trait>() {} //~^ ERROR expected trait bound, found `impl Trait` type fn main() {} </ins>


<ins> mod foo { pub struct B(()); } mod bar { use foo::B; fn foo() { B(()); //~ ERROR expected function, found struct `B` [E0423] } } mod baz { fn foo() { B(()); //~ ERROR cannot find function `B` in this scope [E0425] } } fn main() {} </ins>


prepare("rust-mingw"); } <del> builder.install(&xform(&etc.join("exe/rust.iss")), &exe, 0o644); builder.install(&etc.join("exe/modpath.iss"), &exe, 0o644); builder.install(&etc.join("exe/upgrade.iss"), &exe, 0o644); </del> builder.install(&etc.join("gfx/rust-logo.ico"), &exe, 0o644); <del> builder.create(&exe.join("LICENSE.txt"), &license); // Generate exe installer builder.info("building `exe` installer with `iscc`"); let mut cmd = Command::new("iscc"); cmd.arg("rust.iss").arg("/Q").current_dir(&exe); if target.contains("windows-gnu") { cmd.arg("/dMINGW"); } add_env(builder, &mut cmd, target); let time = timeit(builder); builder.run(&mut cmd); drop(time); builder.install( &exe.join(format!("{}-{}.exe", pkgname(builder, "rust"), target)), &distdir(builder), 0o755, ); </del> // Generate msi installer let wix = PathBuf::from(env::var_os("WIX").unwrap());


<ins> Version 1.54.0 (2021-07-29) ============================ Language ----------------------- - [You can now use macros for values in built-in attribute macros.][83366] While a seemingly minor addition on its own, this enables a lot of powerful functionality when combined correctly. Most notably you can now include external documentation in your crate by writing the following. ```rust #![doc = include_str!("README.md")] ``` You can also use this to include auto-generated modules: ```rust #[path = concat!(env!("OUT_DIR"), "/generated.rs")] mod generated; ``` - [You can now cast between unsized slice types (and types which contain unsized slices) in `const fn`.][85078] - [You can now use multiple generic lifetimes with `impl Trait` where the lifetimes don't explicitly outlive another.][84701] In code this means that you can now have `impl Trait<'a, 'b>` where as before you could only have `impl Trait<'a, 'b> where 'b: 'a`. Compiler ----------------------- - [Rustc will now search for custom JSON targets in `/lib/rustlib/<target-triple>/target.json` where `/` is the "sysroot" directory.][83800] You can find your sysroot directory by running `rustc --print sysroot`. - [Added `wasm` as a `target_family` for WebAssembly platforms.][84072] - [You can now use `#[target_feature]` on safe functions when targeting WebAssembly platforms.][84988] - [Improved debugger output for enums on Windows MSVC platforms.][85292] - [Added tier 3* support for `bpfel-unknown-none` and `bpfeb-unknown-none`.][79608] * Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support. Libraries ----------------------- - [`panic::panic_any` will now `#[track_caller]`.][85745] - [Added `OutOfMemory` as a variant of `io::ErrorKind`.][84744] - [ `proc_macro::Literal` now implements `FromStr`.][84717] - [The implementations of vendor intrinsics in core::arch have been significantly refactored.][83278] The main user-visible changes are a 50% reduction in the size of libcore.rlib and stricter validation of constant operands passed to intrinsics. The latter is technically a breaking change, but allows Rust to more closely match the C vendor intrinsics API. Stabilized APIs --------------- - [`BTreeMap::into_keys`] - [`BTreeMap::into_values`] - [`HashMap::into_keys`] - [`HashMap::into_values`] - [`arch::wasm32`] - [`VecDeque::binary_search`] - [`VecDeque::binary_search_by`] - [`VecDeque::binary_search_by_key`] - [`VecDeque::partition_point`] Cargo ----------------------- - [Added the `--prune <spec>` option to `cargo-tree` to remove a package from the dependency graph.][cargo/9520] - [Added the `--depth` option to `cargo-tree` to print only to a certain depth in the tree ][cargo/9499] - [Added the `no-proc-macro` value to `cargo-tree --edges` to hide procedural macro dependencies.][cargo/9488] - [A new environment variable named `CARGO_TARGET_TMPDIR` is available.][cargo/9375] This variable points to a directory that integration tests and benches can use as a "scratchpad" for testing filesystem operations. [79608]: https://github.com/rust-lang/rust/pull/79608 [84988]: https://github.com/rust-lang/rust/pull/84988 [84701]: https://github.com/rust-lang/rust/pull/84701 [84072]: https://github.com/rust-lang/rust/pull/84072 [85745]: https://github.com/rust-lang/rust/pull/85745 [84744]: https://github.com/rust-lang/rust/pull/84744 [85078]: https://github.com/rust-lang/rust/pull/85078 [84717]: https://github.com/rust-lang/rust/pull/84717 [83800]: https://github.com/rust-lang/rust/pull/83800 [83366]: https://github.com/rust-lang/rust/pull/83366 [83278]: https://github.com/rust-lang/rust/pull/83278 [85292]: https://github.com/rust-lang/rust/pull/85292 [cargo/9520]: https://github.com/rust-lang/cargo/pull/9520 [cargo/9499]: https://github.com/rust-lang/cargo/pull/9499 [cargo/9488]: https://github.com/rust-lang/cargo/pull/9488 [cargo/9375]: https://github.com/rust-lang/cargo/pull/9375 [`BTreeMap::into_keys`]: https://doc.rust-lang.org/std/collections/struct.BTreeMap.html#method.into_keys [`BTreeMap::into_values`]: https://doc.rust-lang.org/std/collections/struct.BTreeMap.html#method.into_values [`HashMap::into_keys`]: https://doc.rust-lang.org/std/collections/struct.HashMap.html#method.into_keys [`HashMap::into_values`]: https://doc.rust-lang.org/std/collections/struct.HashMap.html#method.into_values [`arch::wasm32`]: https://doc.rust-lang.org/core/arch/wasm32/index.html [`VecDeque::binary_search`]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.binary_search [`VecDeque::binary_search_by`]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.binary_search_by [`VecDeque::binary_search_by_key`]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.binary_search_by_key [`VecDeque::partition_point`]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.partition_point </ins> Version 1.53.0 (2021-06-17) ============================


//! contains further primitive shared memory types, including [`atomic`] and //! [`mpsc`], which contains the channel types for message passing. //! <ins> //! # Use before and after `main()` //! //! Many parts of the standard library are expected to work before and after `main()`; //! but this is not guaranteed or ensured by tests. It is recommended that you write your own tests //! and run them on each platform you wish to support. //! This means that use of `std` before/after main, especially of features that interact with the //! OS or global state, is exempted from stability and portability guarantees and instead only //! provided on a best-effort basis. Nevertheless bug reports are appreciated. //! //! On the other hand `core` and `alloc` are most likely to work in such environments with //! the caveat that any hookable behavior such as panics, oom handling or allocators will also //! depend on the compatibility of the hooks. //! //! Some features may also behave differently outside main, e.g. stdio could become unbuffered, //! some panics might turn into aborts, backtraces might not get symbolicated or similar. //! //! Non-exhaustive list of known limitations: //! //! - after-main use of thread-locals, which also affects additional features: //!   - [`thread::current()`] //!   - [`thread::scope()`] //!   - [`sync::mpsc`] //! - before-main stdio file descriptors are not guaranteed to be open on unix platforms //! //! </ins> //! [I/O]: io //! [`MIN`]: i32::MIN //! [`MAX`]: i32::MAX


| LL | unsafe extern "C" { | ^^^^^^ <ins> | = note: see issue #123743 <https://github.com/rust-lang/rust/issues/123743> for more information = help: add `#![feature(unsafe_extern_blocks)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date </ins> error[E0658]: `unsafe extern {}` blocks and `safe` keyword are experimental --> $DIR/feature-gate-unsafe-extern-blocks.rs:9:5


## missing_doc_code_examples <del> This lint is **allowed by default**. It detects when a documentation block </del> <ins> This lint is **allowed by default** and is **nightly-only**. It detects when a documentation block </ins> is missing a code example. For example: ```rust


use std::cmp; <del> use std::string::String; use crate::clean::{self, DocFragment, Item}; </del> <ins> use crate::clean::{self, DocFragment, DocFragmentKind, Item}; </ins> use crate::core::DocContext; use crate::fold::{self, DocFolder}; use crate::passes::Pass;


Available passes for running rustdoc: check-custom-code-classes - check for custom code classes without the feature-gate enabled check_doc_test_visibility - run various visibility-related lints on doctests <ins> strip-aliased-non-local - strips all non-local private aliased items from the output </ins> strip-hidden - strips all `#[doc(hidden)]` items from the output strip-private - strips all private items from a crate which cannot be seen externally, implies strip-priv-imports strip-priv-imports - strips all private import statements (`use`, `extern crate`) from a crate


mode: SolverMode, f: impl FnOnce(&mut GlobalCache<Self>) -> R, ) -> R; <ins> fn evaluation_is_concurrent(&self) -> bool; </ins> } pub trait Delegate {


//~ TRANS_ITEM fn unsizing::{{impl}}[3]::foo[0] let _wrapper_sized = wrapper_sized as Wrapper<Trait>; } <del> //~ TRANS_ITEM drop-glue i8 </del>


LL |     let _y = x; |              ^ | <del> help: a local variable with a similar name exists, consider changing it </del> <ins> help: a local variable with a similar name exists, consider renaming `_x` into `x` </ins> | LL |     let x = 42; |         ~


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


.. }, method, <del> )) if Some(recv_ty.def_id()) == pin_did && method.ident.name == sym::new => { </del> <ins> )) if recv_ty.opt_def_id() == pin_did && method.ident.name == sym::new => { </ins> err.span_suggestion( fn_name.span, "use `Box::pin` to pin and box this expression",


fn main() { foo(1, 2, 3); //~^ ERROR this function takes 4 parameters but 3 <del> //~^^ NOTE the following parameter types were expected </del> <ins> //~| NOTE the following parameter types were expected //~| NOTE expected 4 parameters </ins> }


/// Mark LLVM function to use provided inline heuristic. #[inline] <del> fn inline(cx: &CodegenCx<'ll, '_>, val: &'ll Value, inline: InlineAttr, requires_inline: bool) { </del> <ins> fn inline(cx: &CodegenCx<'ll, '_>, val: &'ll Value, inline: InlineAttr) { </ins> use self::InlineAttr::*; match inline { Hint => Attribute::InlineHint.apply_llfn(Function, val),


<ins> error[E0308]: mismatched types --> $DIR/proper-span-for-type-error.rs:8:5 | LL |     a().await |     ^^^^^^^^^ expected enum `Result`, found `()` | = note:   expected enum `Result<(), i32>` found unit type `()` help: try wrapping the expression in `Ok` | LL |     Ok(a().await) |     +++         + error: aborting due to previous error For more information about this error, try `rustc --explain E0308`. </ins>


// Because it is `?Sized`, it will always be the last field in memory. // Note: This is a detail of the current implementation of the compiler, // and is not a guaranteed language detail. Do not rely on it outside of std. <del> unsafe { data_offset_align(align_of_val(&*ptr)) } </del> <ins> unsafe { data_offset_align(align_of_val_raw(ptr)) } </ins> } #[inline]


#![feature(ptr_metadata)] #![feature(once_cell)] #![feature(unsized_tuple_coercion)] <del> #![feature(nonzero_leading_trailing_zeros)] </del> #![feature(const_option)] #![feature(integer_atomics)] #![feature(slice_group_by)]