pub fn read_line(&self, buf: &mut String) -> io::Result<usize> { self.lock().read_line(buf) } <ins> // Locks this handle with any lifetime. This depends on the // implementation detail that the underlying `Mutex` is static. fn lock_any<'a>(&self) -> StdinLock<'a> { StdinLock { inner: self.inner.lock().unwrap_or_else(|e| e.into_inner()) } } /// Consumes this handle to the standard input stream, locking the /// shared global buffer associated with the stream and returning a /// readable guard. /// /// The lock is released when the returned guard goes out of scope. The /// returned guard also implements the [`Read`] and [`BufRead`] traits /// for accessing the underlying data. /// /// It is often simpler to directly get a locked handle using the /// [`stdin_locked`] function instead, unless nearby code also needs to /// use an unlocked handle. /// /// # Examples /// /// ```no_run /// #![feature(stdio_locked)] /// use std::io::{self, Read}; /// /// fn main() -> io::Result<()> { ///     let mut buffer = String::new(); ///     let mut handle = io::stdin().into_locked(); /// ///     handle.read_to_string(&mut buffer)?; ///     Ok(()) /// } /// ``` #[unstable(feature = "stdio_locked", issue = "none")] pub fn into_locked(self) -> StdinLock<'static> { self.lock_any() } </ins> } #[stable(feature = "std_debug", since = "1.16.0")]


<ins> error[E0310]: the associated type `<&'a V as IntoIterator>::Item` may not live long enough --> $DIR/issue-71546.rs:12:27 | LL |       let csv_str: String = value |  ___________________________^ LL | |         .into_iter() LL | |         .map(|elem| elem.to_string()) | |_____________________________________^ | = help: consider adding an explicit lifetime bound `<&'a V as IntoIterator>::Item: 'static`... = note: ...so that the type `<&'a V as IntoIterator>::Item` will meet its required lifetime bounds... note: ...that is required by this bound --> $DIR/issue-71546.rs:10:55 | LL |     for<'a> <&'a V as IntoIterator>::Item: ToString + 'static, |                                                       ^^^^^^^ error: aborting due to previous error For more information about this error, try `rustc --explain E0310`. </ins>


#![feature(cfg_target_has_atomic)] #![feature(cfg_target_thread_local)] #![feature(char_error_internals)] <ins> #![feature(char_internals)] </ins> #![feature(clamp)] #![feature(concat_idents)] #![feature(const_cstr_unchecked)]


), .. }) => { <del> let hir::Ty { span, .. } = inputs[local.index() - 1]; </del> <ins> let hir::Ty { span, .. } = *inputs.get(local.index() - 1)?; </ins> Some(span) } _ => None,


true } <ins> // Suggest to change `Option<&Vec<T>>::unwrap_or(&[])` to `Option::map_or(&[], |v| v)`. #[instrument(level = "trace", skip(self, err, provided_expr))] pub(crate) fn suggest_deref_unwrap_or( &self, err: &mut Diag<'_>, error_span: Span, callee_ty: Option<Ty<'tcx>>, call_ident: Option<Ident>, expected_ty: Ty<'tcx>, provided_ty: Ty<'tcx>, provided_expr: &Expr<'tcx>, is_method: bool, ) { if !is_method { return; } let Some(callee_ty) = callee_ty else { return; }; let ty::Adt(callee_adt, _) = callee_ty.peel_refs().kind() else { return; }; let adt_name = if self.tcx.is_diagnostic_item(sym::Option, callee_adt.did()) { "Option" } else if self.tcx.is_diagnostic_item(sym::Result, callee_adt.did()) { "Result" } else { return; }; let Some(call_ident) = call_ident else { return; }; if call_ident.name != sym::unwrap_or { return; } let ty::Ref(_, peeled, _mutability) = provided_ty.kind() else { return; }; // NOTE: Can we reuse `suggest_deref_or_ref`? // Create an dummy type `&[_]` so that both &[] and `&Vec<T>` can coerce to it. let dummy_ty = if let ty::Array(elem_ty, size) = peeled.kind() && let ty::Infer(_) = elem_ty.kind() && size.try_eval_target_usize(self.tcx, self.param_env) == Some(0) { let slice = Ty::new_slice(self.tcx, *elem_ty); Ty::new_imm_ref(self.tcx, self.tcx.lifetimes.re_static, slice) } else { provided_ty }; if !self.can_coerce(expected_ty, dummy_ty) { return; } let msg = format!("use `{adt_name}::map_or` to deref inner value of `{adt_name}`"); err.multipart_suggestion_verbose( msg, vec![ (call_ident.span, "map_or".to_owned()), (provided_expr.span.shrink_to_hi(), ", |v| v".to_owned()), ], Applicability::MachineApplicable, ); } </ins> /// Suggest wrapping the block in square brackets instead of curly braces /// in case the block was mistaken array syntax, e.g. `{ 1 }` -> `[ 1 ]`. pub(crate) fn suggest_block_to_brackets(


/// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn lock(&self) -> StdinLock<'_> { <del> StdinLock { inner: self.inner.lock().unwrap_or_else(|e| e.into_inner()) } </del> <ins> self.lock_any() </ins> } /// Locks this handle and reads a line of input, appending it to the specified buffer.


bug!("expected capture to be an upvar"); }; <del> assert!(child_capture.place.projections.len() >= parent_capture.place.projections.len()); </del> parent_base.var_path.hir_id == child_base.var_path.hir_id && std::iter::zip(&child_capture.place.projections, &parent_capture.place.projections) .all(|(child, parent)| child.kind == parent.kind)


span: Span, self_expr: &'tcx hir::Expr<'tcx>, call_expr: &'tcx hir::Expr<'tcx>, <ins> skip_record_for_diagnostics: bool, </ins> } impl<'a, 'tcx> Deref for ConfirmContext<'a, 'tcx> {


rm_rf(&build.out.join("tmp")); rm_rf(&build.out.join("dist")); rm_rf(&build.out.join("bootstrap")); <ins> rm_rf(&build.out.join("rustfmt.stamp")); </ins> for host in &build.hosts { let entries = match build.out.join(host.triple).read_dir() {


#[rustc_builtin_macro] #[macro_export] #[rustc_diagnostic_item = "assert_macro"] <del> #[allow_internal_unstable(panic_internals, edition_panic, generic_assert_internals)] </del> <ins> #[allow_internal_unstable( core_intrinsics, panic_internals, edition_panic, generic_assert_internals )] </ins> macro_rules! assert { ($cond:expr $(,)?) => {{ /* compiler built-in */ }}; ($cond:expr, $($arg:tt)+) => {{ /* compiler built-in */ }};


use syntax::visit; use syntax::visit::Visitor; <del> // An error has already been reported to the user, so no need to continue checking. </del> <ins> // Useful type to use with `Result<>` indicate that an error has already // been reported to the user, so no need to continue checking. </ins> #[deriving(Clone,Show)] pub struct ErrorReported;


<del> Subproject commit 01c8b654f9a01371414d1fd69cba38b289510a9e </del> <ins> Subproject commit 2b9078f4afae82f60c5ac0fdb4af42d269e2f2f3 </ins>


assert::<Box<T>>(); assert::<Vec<T>>(); assert::<RefCell<T>>(); <ins> assert::<AssertRecoverSafe<T>>(); assert::<&AssertRecoverSafe<T>>(); assert::<Rc<AssertRecoverSafe<T>>>(); assert::<Arc<AssertRecoverSafe<T>>>(); </ins> } }


rc::Rc, }; <ins> use std::time::Duration; //~^ ERROR expected item, found `require` use std::time::Instant; //~^ ERROR expected item, found `include` </ins> pub use std::io; //~^ ERROR expected item, found `using` fn main() { let x = Rc::new(1); let _ = write!(io::stdout(), "{:?}", x); <ins> let _ = Duration::new(5, 0); let _ = Instant::now(); </ins> }


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

<input type="checkbox">

<input type="checkbox" checked>

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


// #[repr(simd)], even if we don't actually use this struct directly. // // FIXME repr(simd) broken on emscripten and redox <del> // It's also broken on big-endian powerpc64 and s390x.  #42778 #[cfg_attr(not(any(target_os = "emscripten", target_os = "redox", target_endian = "big")), repr(simd))] </del> <ins> #[cfg_attr(not(any(target_os = "emscripten", target_os = "redox")), repr(simd))] </ins> struct Block(u64, u64, u64, u64); struct UnalignedBlock(u64, u64, u64, u64);


*slot = p.read_separator('.', i, |p| { // Disallow octal number in IP string. // https://tools.ietf.org/html/rfc6943#section-3.1.1 <del> match (p.peek_char(), p.read_number(10, None)) { (Some('0'), Some(number)) if number != 0 => None, (_, number) => number, } </del> <ins> p.read_number(10, Some(3), false) </ins> })?; }


key!(exe_suffix); key!(staticlib_prefix); key!(staticlib_suffix); <del> key!(os_family = "target_family", optional); </del> <ins> key!(os_family = "target-family", optional); </ins> key!(abi_return_struct_as_int, bool); key!(is_like_osx, bool); key!(is_like_solaris, bool);


<ins> error[E0277]: the trait bound `for<'a> &'a _: Trait` is not satisfied --> $DIR/issue-89333.rs:6:5 | LL |     test(&|| 0); |     ^^^^ the trait `for<'a> Trait` is not implemented for `&'a _` | note: required by a bound in `test` --> $DIR/issue-89333.rs:11:55 | LL | fn test<T>(arg: &impl Fn() -> T) where for<'a> &'a T: Trait {} |                                                       ^^^^^ required by this bound in `test` error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. </ins>


/// ```rust /// # use std::fmt::Write; /// # let mut buf = String::new(); <del> /// /// // Bad </del> /// writeln!(buf, "{}", "foo"); <del> /// /// // Good /// writeln!(buf, "foo"); </del> /// ``` pub WRITE_LITERAL, style,


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


} } <del> #[derive(Copy, Clone, PartialEq, Decodable, Encodable, Hash, HashStable_Generic)] </del> <ins> #[derive(Copy, Clone, PartialEq, Eq, Decodable, Encodable, Hash, HashStable_Generic)] </ins> #[rustc_pass_by_value] pub enum Variance { Covariant,     // T<A> <: T<B> iff A <: B -- e.g., function return type


display: table; } .stab { <del> border-width: 1px; border-style: solid; </del> padding: 3px; margin-bottom: 5px; font-size: 90%;


<ins> error[E0308]: mismatched types --> $DIR/dont-record-adjustments-when-pointing-at-arg.rs:26:37 | LL |         ns_window.setFrame_display_(0); |                   ----------------- ^ expected `()`, found integer |                   | |                   arguments to this method are incorrect | note: method defined here --> $DIR/dont-record-adjustments-when-pointing-at-arg.rs:5:8 | LL |     fn setFrame_display_(self, display: ()) {} |        ^^^^^^^^^^^^^^^^^       ----------- error: aborting due to previous error For more information about this error, try `rustc --explain E0308`. </ins>


let mut _5: &mut [u8; 1024];         // in scope 0 at $DIR/simple.rs:6:10: 6:18 let mut _6: &mut [u8; 1024];         // in scope 0 at $DIR/simple.rs:6:10: 6:18 scope 1 { <del> -         debug buf => _2;                 // in scope 1 at $DIR/simple.rs:5:9: 5:16 +         debug buf => _0;                 // in scope 1 at $DIR/simple.rs:5:9: 5:16 </del> <ins> debug buf => _2;                 // in scope 1 at $DIR/simple.rs:5:9: 5:16 </ins> } bb0: { <del> -         StorageLive(_2);                 // scope 0 at $DIR/simple.rs:5:9: 5:16 -         _2 = [const 0_u8; 1024];         // scope 0 at $DIR/simple.rs:5:19: 5:28 +         nop;                             // scope 0 at $DIR/simple.rs:5:9: 5:16 +         _0 = [const 0_u8; 1024];         // scope 0 at $DIR/simple.rs:5:19: 5:28 </del> <ins> StorageLive(_2);                 // scope 0 at $DIR/simple.rs:5:9: 5:16 _2 = [const 0_u8; 1024];         // scope 0 at $DIR/simple.rs:5:19: 5:28 </ins> StorageLive(_3);                 // scope 1 at $DIR/simple.rs:6:5: 6:19 StorageLive(_4);                 // scope 1 at $DIR/simple.rs:6:5: 6:9 _4 = _1;                         // scope 1 at $DIR/simple.rs:6:5: 6:9 StorageLive(_5);                 // scope 1 at $DIR/simple.rs:6:10: 6:18 StorageLive(_6);                 // scope 1 at $DIR/simple.rs:6:10: 6:18 <del> -         _6 = &mut _2;                    // scope 1 at $DIR/simple.rs:6:10: 6:18 +         _6 = &mut _0;                    // scope 1 at $DIR/simple.rs:6:10: 6:18 </del> <ins> _6 = &mut _2;                    // scope 1 at $DIR/simple.rs:6:10: 6:18 </ins> _5 = &mut (*_6);                 // scope 1 at $DIR/simple.rs:6:10: 6:18 _3 = move _4(move _5) -> bb1;    // scope 1 at $DIR/simple.rs:6:5: 6:19 }


return None; } <ins> // Handle the special case of -Wall. let wall = matches.opt_strs("W"); if wall.iter().any(|x| *x == "all") { print_wall_help(); return None; } </ins> // Don't handle -W help here, because we might first load plugins. let r = matches.opt_strs("Z"); if r.iter().any(|x| *x == "help") {


} } } <del> self.visit_ty(&typ); if let &Some(ref trait_ref) = trait_ref { self.process_path(trait_ref.ref_id, &trait_ref.path); } self.process_generic_params(generics, "", item.id); for impl_item in impl_items { let map = &self.tcx.hir(); self.process_impl_item(impl_item, map.local_def_id_from_node_id(item.id)); } </del> <ins> let map = &self.tcx.hir(); self.nest_tables(item.id, |v| { v.visit_ty(&typ); if let &Some(ref trait_ref) = trait_ref { v.process_path(trait_ref.ref_id, &trait_ref.path); } v.process_generic_params(generics, "", item.id); for impl_item in impl_items { v.process_impl_item(impl_item, map.local_def_id_from_node_id(item.id)); } }); </ins> } fn process_trait(


base_generics: &ty::Generics<'tcx>) -> ty::Generics<'tcx> { <del> ty_generics(ccx, FnSpace, generics, base_generics) </del> <ins> ty_generics(ccx, FnSpace, generics, base_generics, false) </ins> } fn ty_generic_predicates_for_fn<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>,


let thread = thread_info::current_thread(); let name = thread.as_ref().and_then(|t| t.name()).unwrap_or("<unnamed>"); <del> let write = |err: &mut dyn crate::io::Write, backtrace: Option<BacktraceStyle>| { </del> <ins> let write = |err: &mut dyn crate::io::Write| { </ins> let _ = writeln!(err, "thread '{name}' panicked at {location}:n{msg}"); static FIRST_PANIC: AtomicBool = AtomicBool::new(true);


<ins> // Fixed in #66054. // ignore-tidy-trailing-newlines // error-pattern: aborting due to 2 previous errors #[Ѕ </ins>  No newline at end of file


#![feature(staged_api)] #![doc(issue_tracker_base_url = "https://issue_url/")] <del> #![unstable(feature="test", issue = "32374")] </del> <ins> #![unstable(feature = "test", issue = "32374")] </ins> // @matches issue_32374/index.html '//*[@class="item-left unstable deprecated module-item"]/span[@class="stab deprecated"]'  //      'Deprecated'


<ins> error[E0382]: use of moved value: `bar` --> $DIR/moved-value-on-as-ref-arg.rs:27:16 | LL |     let bar = Bar; |         --- move occurs because `bar` has type `Bar`, which does not implement the `Copy` trait LL |     foo(bar); |         --- value moved here LL |     let _baa = bar; |                ^^^ value used here after move | help: borrow the value to avoid moving it | LL |     foo(&bar); |         + error[E0382]: use of moved value: `bar` --> $DIR/moved-value-on-as-ref-arg.rs:30:16 | LL |     let mut bar = Bar; |         ------- move occurs because `bar` has type `Bar`, which does not implement the `Copy` trait LL |     qux(bar); |         --- value moved here LL |     let _baa = bar; |                ^^^ value used here after move | note: if `Bar` implemented `Clone`, you could clone the value --> $DIR/moved-value-on-as-ref-arg.rs:5:1 | LL | struct Bar; | ^^^^^^^^^^ consider implementing `Clone` for this type ... LL |     qux(bar); |         --- you could clone this value help: borrow the value to avoid moving it | LL |     qux(&mut bar); |         ++++ error[E0382]: use of moved value: `bar` --> $DIR/moved-value-on-as-ref-arg.rs:33:16 | LL |     let bar = Bar; |         --- move occurs because `bar` has type `Bar`, which does not implement the `Copy` trait LL |     bat(bar); |         --- value moved here LL |     let _baa = bar; |                ^^^ value used here after move | help: borrow the value to avoid moving it | LL |     bat(&bar); |         + error[E0382]: use of moved value: `bar` --> $DIR/moved-value-on-as-ref-arg.rs:36:16 | LL |     let mut bar = Bar; |         ------- move occurs because `bar` has type `Bar`, which does not implement the `Copy` trait LL |     baz(bar); |         --- value moved here LL |     let _baa = bar; |                ^^^ value used here after move | note: if `Bar` implemented `Clone`, you could clone the value --> $DIR/moved-value-on-as-ref-arg.rs:5:1 | LL | struct Bar; | ^^^^^^^^^^ consider implementing `Clone` for this type ... LL |     baz(bar); |         --- you could clone this value help: borrow the value to avoid moving it | LL |     baz(&mut bar); |         ++++ error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0382`. </ins>


<ins> // compile-flags: -Z unstable-options --document-hidden-items // test for trait methods with `doc(hidden)` with `--document-hidden-items` passed. #![crate_name = "foo"] // @has foo/trait.Trait.html // @has - '//*[@id="associatedtype.Foo"]' 'type Foo' // @has - '//*[@id="associatedtype.Bar"]' 'type Bar' // @has - '//*[@id="tymethod.f"]' 'fn f()' // @has - '//*[@id="tymethod.g"]' 'fn g()' pub trait Trait { #[doc(hidden)] type Foo; type Bar; #[doc(hidden)] fn f(); fn g(); } // @has foo/struct.S.html // @has - '//*[@id="associatedtype.Foo"]' 'type Foo' // @has - '//*[@id="associatedtype.Bar"]' 'type Bar' // @has - '//*[@id="method.f"]' 'fn f()' // @has - '//*[@id="method.g"]' 'fn g()' pub struct S; impl Trait for S { type Foo = (); type Bar = (); fn f() {} fn g() {} } </ins>


token::EQ => { // x = foo::bar self.bump(); <ins> let path_lo = self.span.lo; </ins> path = ~[self.parse_ident()]; while self.token == token::MOD_SEP { self.bump();


"

" + ret_others[0] + ret_in_args[0] + ret_returned[0] + "
";  var search = getSearchElement();  search.innerHTML = output; showSearchResults(search); var tds = search.getElementsByTagName("td");


use std::rc::Rc; use std::{i8, i16, i32, i64}; use syntax::abi::{X86, X86_64, Arm, Mips, Mipsel, Rust, RustCall}; <del> use syntax::abi::{RustIntrinsic, Abi}; </del> <ins> use syntax::abi::{RustIntrinsic, Abi, OsWindows}; </ins> use syntax::ast_util::{local_def, is_local}; use syntax::attr::AttrMetaMethods; use syntax::attr;


<ins> //! Regression test for <https://github.com/rust-lang/rust/issues/100531> #![feature(no_core)] #![no_core] #![crate_name = "export_extern_crate_as_self"] // ignore-tidy-linelength // @is export_extern_crate_as_self.json "$.index[*][?(@.kind=='module')].name" "export_extern_crate_as_self" pub extern crate self as export_extern_crate_as_self; // Must be the same name as the crate already has </ins>


<ins> An inherent `impl` was written on a dyn auto trait. Erroneous code example: ```compile_fail,E0785 #![feature(auto_traits)] auto trait AutoTrait {} impl dyn AutoTrait {} ``` Dyn objects allow any number of auto traits, plus at most one non-auto trait. The non-auto trait becomes the "principal trait". When checking if an impl on a dyn trait is coherent, the principal trait is normally the only one considered. Since the erroneous code has no principal trait, it cannot be implemented at all. Working example: ``` #![feature(auto_traits)] trait PrincipalTrait {} auto trait AutoTrait {} impl dyn PrincipalTrait + AutoTrait + Send {} ``` </ins>


match context { PlaceContext::MutatingUse(_) => ty::Invariant, <del> PlaceContext::NonUse(StorageDead | StorageLive | PlaceMention | VarDebugInfo) => { ty::Invariant } </del> <ins> PlaceContext::NonUse(StorageDead | StorageLive | VarDebugInfo) => ty::Invariant, </ins> PlaceContext::NonMutatingUse( <del> Inspect | Copy | Move | SharedBorrow | ShallowBorrow | UniqueBorrow | AddressOf | Projection, </del> <ins> Inspect | Copy | Move | PlaceMention | SharedBorrow | ShallowBorrow | UniqueBorrow | AddressOf | Projection, </ins> ) => ty::Covariant, PlaceContext::NonUse(AscribeUserTy) => ty::Covariant, }


<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. pub struct X([u8]); pub static Y: &'static X = { const Y: &'static [u8] = b""; &X(*Y) //~^ ERROR cannot move out //~^^ ERROR cannot move a //~^^^ ERROR cannot move a }; fn main() {} </ins>


// take the "else" branch if self.option_loud_drop(6).is_some() // 2 && self.option_loud_drop(5).is_some() // 1 <del> && let None = self.option_loud_drop(7) { // 3 </del> <ins> && let None = self.option_loud_drop(8) { // 4 </ins> unreachable!(); } else { <del> self.print(8); // 4 </del> <ins> self.print(7); // 3 </ins> } // let exprs interspersed


<ins> // This code (probably) _should_ compile, but it currently does not because we // are not smart enough about implied bounds. use std::io; fn real_dispatch<T, F>(f: F) -> Result<(), io::Error> //~^ NOTE required by a bound in this where F: FnOnce(&mut UIView<T>) -> Result<(), io::Error> + Send + 'static, //~^ NOTE required by this bound in `real_dispatch` //~| NOTE required by a bound in `real_dispatch` { todo!() } #[derive(Debug)] struct UIView<'a, T: 'a> { _phantom: std::marker::PhantomData<&'a mut T>, } trait Handle<'a, T: 'a, V, R> { fn dispatch<F>(&self, f: F) -> Result<(), io::Error> where F: FnOnce(&mut V) -> R + Send + 'static; } #[derive(Debug, Clone)] struct TUIHandle<T> { _phantom: std::marker::PhantomData<T>, } impl<'a, T: 'a> Handle<'a, T, UIView<'a, T>, Result<(), io::Error>> for TUIHandle<T> { fn dispatch<F>(&self, f: F) -> Result<(), io::Error> where F: FnOnce(&mut UIView<'a, T>) -> Result<(), io::Error> + Send + 'static, { real_dispatch(f) //~^ ERROR expected a `FnOnce<(&mut UIView<'_, T>,)>` closure, found `F` //~| NOTE expected an `FnOnce<(&mut UIView<'_, T>,)>` closure, found `F` //~| NOTE expected a closure with arguments //~| NOTE required by a bound introduced by this call } } fn main() {} </ins>


/// Parse a `mod <foo> { ... }` or `mod <foo>;` item fn parse_item_mod(&mut self, outer_attrs: &[Attribute]) -> PResult<'a, ItemInfo> { <del> let outer_attrs = ::config::StripUnconfigured { config: &self.cfg, sess: self.sess, should_test: false, // irrelevant features: None, // don't perform gated feature checking }.process_cfg_attrs(outer_attrs.to_owned()); </del> <ins> let (in_cfg, outer_attrs) = { let mut strip_unconfigured = ::config::StripUnconfigured { config: &self.cfg, sess: self.sess, should_test: false, // irrelevant features: None, // don't perform gated feature checking }; let outer_attrs = strip_unconfigured.process_cfg_attrs(outer_attrs.to_owned()); (strip_unconfigured.in_cfg(&outer_attrs), outer_attrs) }; </ins> let id_span = self.span; let id = self.parse_ident()?; if self.check(&token::Semi) { self.bump(); <del> // This mod is in an external file. Let's go get it! let (m, attrs) = self.eval_src_mod(id, &outer_attrs, id_span)?; Ok((id, m, Some(attrs))) </del> <ins> if in_cfg { // This mod is in an external file. Let's go get it! let (m, attrs) = self.eval_src_mod(id, &outer_attrs, id_span)?; Ok((id, m, Some(attrs))) } else { let placeholder = ast::Mod { inner: syntax_pos::DUMMY_SP, items: Vec::new() }; Ok((id, ItemKind::Mod(placeholder), None)) } </ins> } else { let directory = self.directory.clone(); self.push_directory(id, &outer_attrs);


} function showResults(results) { <del> if (results.others.length === 1 && getCurrentValue("rustdoc-go-to-only-result") === "true") { </del> <ins> var search = getSearchElement(); if (results.others.length === 1 && getCurrentValue("rustdoc-go-to-only-result") === "true" // By default, the search DOM element is "empty" (meaning it has no children not // text content). Once a search has been run, it won't be empty, even if you press // ESC or empty the search input (which also "cancels" the search). && (!search.firstChild || search.firstChild.innerText !== getSearchLoadingText())) { </ins> var elem = document.createElement("a"); elem.href = results.others[0].href; elem.style.display = "none"; // For firefox, we need the element to be in the DOM so it can be clicked. document.body.appendChild(elem); elem.click(); <ins> return; </ins> } var query = getQuery(search_input.value);


impl Encodable for Span { fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> { <del> try!(s.emit_u32(self.lo.0)); s.emit_u32(self.hi.0) </del> <ins> s.emit_struct("Span", 2, |s| { try!(s.emit_struct_field("lo", 0, |s| { self.lo.encode(s) })); s.emit_struct_field("hi", 1, |s| { self.hi.encode(s) }) }) </ins> } } impl Decodable for Span { fn decode<D: Decoder>(d: &mut D) -> Result<Span, D::Error> { <del> let lo = BytePos(try! { d.read_u32() }); let hi = BytePos(try! { d.read_u32() }); Ok(mk_sp(lo, hi)) </del> <ins> d.read_struct("Span", 2, |d| { let lo = try!(d.read_struct_field("lo", 0, |d| { BytePos::decode(d) })); let hi = try!(d.read_struct_field("hi", 1, |d| { BytePos::decode(d) })); Ok(mk_sp(lo, hi)) }) </ins> } }


self.r .session <del> .struct_span_warn(item.span, "`$crate` may not be imported") .note( "`use $crate;` was erroneously allowed and  will become a hard error in a future release", ) </del> <ins> .struct_span_err(item.span, "`$crate` may not be imported") </ins> .emit(); } }


pub(crate) fn unsafety(&self, tcx: TyCtxt<'_>) -> hir::Unsafety { tcx.trait_def(self.def_id).unsafety } <ins> pub(crate) fn is_object_safe(&self, tcx: TyCtxt<'_>) -> bool { tcx.check_is_object_safe(self.def_id) } </ins> } #[derive(Clone, Debug)]


val.into() } <del> Aggregate(ref kind, ref fields) => Value::Aggregate { fields: fields .iter() .map(|field| self.eval_operand(field).map_or(Value::Uninit, Value::Immediate)) .collect(), variant: match **kind { AggregateKind::Adt(_, variant, _, _, _) => variant, AggregateKind::Array(_) | AggregateKind::Tuple | AggregateKind::Closure(_, _) | AggregateKind::Coroutine(_, _) | AggregateKind::CoroutineClosure(_, _) => VariantIdx::new(0), }, }, </del> <ins> Aggregate(ref kind, ref fields) => { // Do not const pop union fields as they can be // made to produce values that don't match their // underlying layout's type (see ICE #121534). // If the last element of the `Adt` tuple // is `Some` it indicates the ADT is a union if let AggregateKind::Adt(_, _, _, _, Some(_)) = **kind { return None; }; Value::Aggregate { fields: fields .iter() .map(|field| { self.eval_operand(field).map_or(Value::Uninit, Value::Immediate) }) .collect(), variant: match **kind { AggregateKind::Adt(_, variant, _, _, _) => variant, AggregateKind::Array(_) | AggregateKind::Tuple | AggregateKind::Closure(_, _) | AggregateKind::Coroutine(_, _) | AggregateKind::CoroutineClosure(_, _) => VariantIdx::new(0), }, } } </ins> Repeat(ref op, n) => { trace!(?op, ?n);


Some(x) => x, }; if local_tmp_s0 != local_tmp_s1 <ins> // The field-and-variant information match up. </ins> || vf_s0 != vf_s1 <ins> // Source and target locals have the same type. // FIXME(Centril | oli-obk): possibly relax to same layout? || local_decls[local_0].ty != local_decls[local_1].ty // We're setting the discriminant of `local_0` to this variant. </ins> || Some((local_0, vf_s0.var_idx)) != match_set_discr(s2) { continue;


req_introduces_loc: subdiag, has_lifetime: sup_r.has_name(), <del> lifetime: sup_r.to_string(), </del> <ins> lifetime: lifetime_name.clone(), has_param_name: simple_ident.is_some(), param_name: simple_ident.map(|x| x.to_string()).unwrap_or_default(), </ins> spans_empty, bound, };


pub use self::scoped_tls::ScopedKey; #[doc(hidden)] pub use self::local::__KeyInner as __LocalKeyInner; <ins> #[doc(hidden)] pub use self::scoped_tls::__KeyInner as __ScopedKeyInner; </ins> //////////////////////////////////////////////////////////////////////////////// // Builder


<ins> // run-rustfix // Regression test for #54505 - range borrowing suggestion had // incorrect syntax (missing parentheses). use std::ops::RangeBounds; // take a reference to any built-in range fn take_range(_r: &impl RangeBounds<i8>) {} fn main() { take_range(0..1); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(0..1) take_range(1..); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(1..) take_range(..); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(..) take_range(0..=1); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(0..=1) take_range(..5); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(..5) take_range(..=42); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(..=42) } </ins>


<ins> // Verify that lifetime resolution correctly accounts for `Fn` bare trait objects. // check-pass #![allow(bare_trait_objects)] // This should work as: fn next_u32(fill_buf: &mut dyn FnMut(&mut [u8])) fn next_u32(fill_buf: &mut FnMut(&mut [u8])) { let mut buf: [u8; 4] = [0; 4]; fill_buf(&mut buf); } fn explicit(fill_buf: &mut dyn FnMut(&mut [u8])) { let mut buf: [u8; 4] = [0; 4]; fill_buf(&mut buf); } fn main() { let _: fn(&mut FnMut(&mut [u8])) = next_u32; let _: &dyn Fn(&mut FnMut(&mut [u8])) = &next_u32; let _: fn(&mut FnMut(&mut [u8])) = explicit; let _: &dyn Fn(&mut FnMut(&mut [u8])) = &explicit; let _: fn(&mut dyn FnMut(&mut [u8])) = next_u32; let _: &dyn Fn(&mut dyn FnMut(&mut [u8])) = &next_u32; let _: fn(&mut dyn FnMut(&mut [u8])) = explicit; let _: &dyn Fn(&mut dyn FnMut(&mut [u8])) = &explicit; } </ins>


// components like the llvm tools and LLD. LLD is included below and // tools/LLDB come later, so let's just throw it in the rustc // component for now. <del> maybe_install_llvm_dylib(builder, host, image); </del> <ins> maybe_install_llvm_runtime(builder, host, image); </ins> // Copy over lld if it's there if builder.config.lld_enabled {


<del> error: `impl Trait` can only mention lifetimes bound at the fn or impl level </del> <ins> error: `impl Trait` can only mention lifetimes from an fn or impl </ins> --> $DIR/universal_wrong_hrtb.rs:5:73 | LL | fn test_argument_position(x: impl for<'a> Trait<'a, Assoc = impl Copy + 'a>) {} <del> |                                                                         ^^ | note: lifetime declared here --> $DIR/universal_wrong_hrtb.rs:5:39 | LL | fn test_argument_position(x: impl for<'a> Trait<'a, Assoc = impl Copy + 'a>) {} |                                       ^^ </del> <ins> |                                       -- lifetime declared here         ^^ </ins> error: aborting due to previous error


echo '{"ipv6":true,"fixed-cidr-v6":"fd9a:8454:6789:13f7::/64"}' | sudo tee /etc/docker/daemon.json sudo service docker restart displayName: Enable IPv6 <del> condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux')) </del> <ins> condition: and(succeeded(), not(variables.SKIP_JOB), eq(variables['Agent.OS'], 'Linux')) </ins> # Check out all our submodules, but more quickly than using git by using one of # our custom scripts


cx: &MatchCheckCtxt<'p, 'tcx>, column: &[&DeconstructedPat<'p, 'tcx>], ) -> Vec<WitnessPat<'tcx>> { <ins> if column.is_empty() { return Vec::new(); } </ins> let ty = column[0].ty(); let pcx = &PatCtxt { cx, ty, span: DUMMY_SP, is_top_level: false };


// We use the *previous* span because if the type is known *here* it means // it was *evaluated earlier*. We don't do this for method calls because we // evaluate the method's self type eagerly, but not in any other case. <del> err.span_label( span, with_forced_trimmed_paths!(format!( "here the type of `{ident}` is inferred to be `{ty}`", )), ); </del> <ins> if !span.overlaps(mismatch_span) { err.span_label( span, with_forced_trimmed_paths!(format!( "here the type of `{ident}` is inferred to be `{ty}`", )), ); } </ins> break; } prev = ty;


} 0 => {} _ => { <del> // linux returns POLLOUT|POLLERR|POLLHUP for refused connections (!), so look // for POLLHUP rather than read readiness if pollfd.revents & libc::POLLHUP != 0 { let e = self.take_error()?.unwrap_or_else(|| { io::const_io_error!( io::ErrorKind::Uncategorized, "no error set after POLLHUP", ) }); return Err(e); </del> <ins> if cfg!(target_os = "vxworks") { // VxWorks poll does not return  POLLHUP or POLLERR in revents. Check if the // connnection actually succeeded and return ok only when the socket is // ready and no errors were found. if let Some(e) = self.take_error()? { return Err(e); } } else { // linux returns POLLOUT|POLLERR|POLLHUP for refused connections (!), so look // for POLLHUP or POLLERR rather than read readiness if pollfd.revents & (libc::POLLHUP | libc::POLLERR) != 0 { let e = self.take_error()?.unwrap_or_else(|| { io::const_io_error!( io::ErrorKind::Uncategorized, "no error set after POLLHUP", ) }); return Err(e); } </ins> } return Ok(());


impl<'tcx> MirPass<'tcx> for SimplifyArmIdentity { fn run_pass(&self, _: TyCtxt<'tcx>, _: MirSource<'tcx>, body: &mut Body<'tcx>) { <del> for bb in body.basic_blocks_mut() { </del> <ins> let (basic_blocks, local_decls) = body.basic_blocks_and_local_decls_mut(); for bb in basic_blocks { </ins> // Need 3 statements: let (s0, s1, s2) = match &mut *bb.statements { [s0, s1, s2] => (s0, s1, s2),


loop { let tree = iter.stack.pop().or_else(|| { let next = iter.cursor.next_with_joint()?; <del> let lookahead = iter.cursor.look_ahead(0); Some(TokenTree::from_internal((next, lookahead, self.sess, &mut iter.stack))) </del> <ins> Some(TokenTree::from_internal((next, self.sess, &mut iter.stack))) </ins> })?; // A hack used to pass AST fragments to attribute and derive macros // as a single nonterminal token instead of a token stream.


#[license = "MIT/ASL2"]; #[crate_type = "rlib"]; #[crate_type = "dylib"]; <del> #[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk.png", </del> <ins> #[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", </ins> html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://static.rust-lang.org/doc/master")];


optopt("", "host", "the host to build for", "HOST"), optopt("", "gdb-version", "the version of GDB used", "VERSION STRING"), optopt("", "lldb-version", "the version of LLDB used", "VERSION STRING"), <ins> optopt("", "llvm-version", "the version of LLVM used", "VERSION STRING"), </ins> optopt("", "android-cross-path", "Android NDK standalone path", "PATH"), optopt("", "adb-path", "path to the android debugger", "PATH"), optopt("", "adb-test-dir", "path to tests for the android debugger", "PATH"),


'{' => { let curr_last_brace = self.last_opening_brace; let byte_pos = self.to_span_index(pos); <del> let lbrace_end = InnerOffset(byte_pos.0 + 1); </del> <ins> let lbrace_end = self.to_span_index(pos + 1); </ins> self.last_opening_brace = Some(byte_pos.to(lbrace_end)); self.cur.next(); if self.consume('{') {


} #[stable(feature = "rust1", since = "1.0.0")] <del> impl Read for File { </del> <ins> impl Read for &File { </ins> fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { self.inner.read(buf) }


<ins> //@ run-rustfix // Check the `unused_parens` suggestion for paren_expr with attributes. // The suggestion should retain attributes in the front. #![feature(stmt_expr_attributes)] #![deny(unused_parens)] pub fn foo() -> impl Fn() { let _ = (#[inline] #[allow(dead_code)] || println!("Hello!")); //~ERROR unnecessary parentheses (#[inline] #[allow(dead_code)] || println!("Hello!")) //~ERROR unnecessary parentheses } fn main() { let _ = foo(); } </ins>


lt_op: |_| self.tcx.lifetimes.re_erased, ct_op: |c| c, ty_op: |t| match *t.kind() { <del> ty::Infer(ty::TyVar(vid)) => self.tcx.mk_ty_infer(ty::TyVar(self.root_var(vid))), </del> <ins> ty::Infer(ty::TyVar(_)) => self.tcx.mk_ty_var(ty::TyVid::from_u32(0)), </ins> ty::Infer(ty::IntVar(_)) => { self.tcx.mk_ty_infer(ty::IntVar(ty::IntVid { index: 0 })) }


fn report(&mut self, error: GroupedMoveError<'tcx>) { let (mut err, err_span) = { <del> let (span, original_path, kind): (Span, &Place<'tcx>, &IllegalMoveOriginKind<'_>) = </del> <ins> let (span, use_spans, original_path, kind,): ( Span, Option<UseSpans>, &Place<'tcx>, &IllegalMoveOriginKind<'_>, ) = </ins> match error { GroupedMoveError::MovesFromPlace { span, ref original_path, ref kind, .. } | GroupedMoveError::MovesFromValue { span, ref original_path, ref kind, .. } => { <del> (span, original_path, kind) </del> <ins> (span, None, original_path, kind) </ins> } GroupedMoveError::OtherIllegalMove { use_spans, ref original_path, ref kind } => { <del> (use_spans.args_or_use(), original_path, kind) </del> <ins> (use_spans.args_or_use(), Some(use_spans), original_path, kind) </ins> }, }; debug!("report: original_path={:?} span={:?}, kind={:?}


0, ); if result != stackaddr || result == MAP_FAILED { <del> panic!("failed to allocate a guard page"); </del> <ins> panic!("failed to allocate a guard page: {}", io::Error::last_os_error()); </ins> } let result = mprotect(stackaddr, page_size, PROT_NONE); if result != 0 { <del> panic!("failed to protect the guard page"); </del> <ins> panic!("failed to protect the guard page: {}", io::Error::last_os_error()); </ins> } let guardaddr = stackaddr as usize;


// no number between dots let none: Option<Ipv4Addr> = "255.0..1".parse().ok(); assert_eq!(None, none); <ins> // octal let none: Option<Ipv4Addr> = "255.0.0.01".parse().ok(); assert_eq!(None, none); // octal zero let none: Option<Ipv4Addr> = "255.0.0.00".parse().ok(); assert_eq!(None, none); let none: Option<Ipv4Addr> = "255.0.00.0".parse().ok(); assert_eq!(None, none); </ins> } #[test]


r: A+'static } <del> fn new_struct(r: A+'static) -> Struct { </del> <ins> fn new_struct(r: A+'static) -> Struct { //~^  ERROR the trait `core::kinds::Sized` is not implemented </ins> //~^ ERROR the trait `core::kinds::Sized` is not implemented Struct { r: r } //~^ ERROR the trait `core::kinds::Sized` is not implemented


<ins> // Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. struct GradFn<F: Fn() -> usize>(F); fn main() { let GradFn(x_squared) : GradFn<_> = GradFn(|| -> usize { 2 }); let _  = x_squared(); } </ins>


return exports.iter().map(ToString::to_string).collect(); } <del> let mut symbols = Vec::new(); </del> <ins> if let CrateType::ProcMacro = crate_type { exported_symbols_for_proc_macro_crate(tcx) } else { exported_symbols_for_non_proc_macro(tcx, crate_type) } } fn exported_symbols_for_non_proc_macro(tcx: TyCtxt<'_>, crate_type: CrateType) -> Vec<String> { let mut symbols = Vec::new(); </ins> let export_threshold = symbol_export::crates_export_threshold(&[crate_type]); for_each_exported_symbols_include_dep(tcx, crate_type, |symbol, info, cnum| { if info.level.is_below_threshold(export_threshold) {


{ err.note("you may be trying to write a c-string literal"); err.note("c-string literals require Rust 2021 or later"); <del> HelpUseLatestEdition::new().add_to_diagnostic(&mut err); </del> <ins> err.subdiagnostic(self.dcx(), HelpUseLatestEdition::new()); </ins> } // `pub` may be used for an item or `pub(crate)`


); } else if matches!(span.desugaring_kind(), Some(DesugaringKind::ForLoop(_))) { let suggest = match self.infcx.tcx.get_diagnostic_item(sym::IntoIterator) { <del> Some(def_id) => type_known_to_meet_bound_modulo_regions( &self.infcx, self.param_env, self.infcx.tcx.mk_imm_ref(self.infcx.tcx.lifetimes.re_erased, ty), def_id, DUMMY_SP, ), </del> <ins> Some(def_id) => self.infcx.tcx.infer_ctxt().enter(|infcx| { type_known_to_meet_bound_modulo_regions( &infcx, self.param_env, infcx .tcx .mk_imm_ref(infcx.tcx.lifetimes.re_erased, infcx.tcx.erase_regions(ty)), def_id, DUMMY_SP, ) }), </ins> _ => false, }; if suggest {


symbols } <ins> fn exported_symbols_for_proc_macro_crate(tcx: TyCtxt<'_>) -> Vec<String> { // `exported_symbols` will be empty when !should_codegen. if !tcx.sess.opts.output_types.should_codegen() { return Vec::new(); } let stable_crate_id = tcx.sess.local_stable_crate_id(); let proc_macro_decls_name = tcx.sess.generate_proc_macro_decls_symbol(stable_crate_id); let metadata_symbol_name = exported_symbols::metadata_symbol_name(tcx); vec![proc_macro_decls_name, metadata_symbol_name] } </ins> pub(crate) fn linked_symbols( tcx: TyCtxt<'_>, crate_type: CrateType,


<ins> error: lifetime may not live long enough --> $DIR/issue-54779-anon-static-lifetime.rs:34:24 | LL |         cx: &dyn DebugContext, |             - let's call the lifetime of this reference `'1` ... LL |         bar.debug_with(cx); |                        ^^ cast requires that `'1` must outlive `'static` error: aborting due to previous error </ins>


<ins> // Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // forbid-output: &mut mut self struct Struct; impl Struct { fn foo(&mut self) { (&mut self).bar(); //~^ ERROR cannot borrow immutable argument `self` as mutable // ... and no SUGGESTION that suggests `&mut mut self` } // In this case we could keep the suggestion, but to distinguish the // two cases is pretty hard. It's an obscure case anyway. fn bar(self: &mut Self) { (&mut self).bar(); //~^ ERROR cannot borrow immutable argument `self` as mutable } } fn main () {} </ins>


.map_or(false, |output| output.status.success()) } <ins> fn ensure_stage1_toolchain_placeholder_exists(stage_path: &str) -> bool { let pathbuf = PathBuf::from(stage_path); if fs::create_dir_all(pathbuf.join("lib")).is_err() { return false; }; let pathbuf = pathbuf.join("bin"); if fs::create_dir_all(&pathbuf).is_err() { return false; }; let pathbuf = pathbuf.join(format!("rustc{}", EXE_SUFFIX)); if pathbuf.exists() { return true; } // Take care not to overwrite the file let result = File::options().append(true).create(true).open(&pathbuf); if result.is_err() { return false; } return true; } </ins> // Used to get the path for `Subcommand::Setup` pub fn interactive_path() -> io::Result<Profile> { fn abbrev_all() -> impl Iterator<Item = ((String, String), Profile)> {


} } <del> impl<'tcx> Debug for TerminatorKind<'tcx> { fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result { self.fmt_head(fmt)?; let successor_count = self.successors().count(); let labels = self.fmt_successor_labels(); assert_eq!(successor_count, labels.len()); match successor_count { 0 => Ok(()), 1 => write!(fmt, " -> {:?}", self.successors().next().unwrap()), _ => { write!(fmt, " -> [")?; for (i, target) in self.successors().enumerate() { if i > 0 { write!(fmt, ", ")?; } write!(fmt, "{}: {:?}", labels[i], target)?; } write!(fmt, "]") } } } } impl<'tcx> TerminatorKind<'tcx> { /// Writes the "head" part of the terminator; that is, its name and the data it uses to pick the /// successor basic block, if any. The only information not included is the list of possible /// successors, which may be rendered differently between the text and the graphviz format. pub fn fmt_head<W: Write>(&self, fmt: &mut W) -> fmt::Result { use self::TerminatorKind::*; match self { Goto { .. } => write!(fmt, "goto"), SwitchInt { discr, .. } => write!(fmt, "switchInt({:?})", discr), Return => write!(fmt, "return"), GeneratorDrop => write!(fmt, "generator_drop"), Resume => write!(fmt, "resume"), Abort => write!(fmt, "abort"), Yield { value, resume_arg, .. } => write!(fmt, "{:?} = yield({:?})", resume_arg, value), Unreachable => write!(fmt, "unreachable"), Drop { place, .. } => write!(fmt, "drop({:?})", place), DropAndReplace { place, value, .. } => { write!(fmt, "replace({:?} <- {:?})", place, value) } Call { func, args, destination, .. } => { if let Some((destination, _)) = destination { write!(fmt, "{:?} = ", destination)?; } write!(fmt, "{:?}(", func)?; for (index, arg) in args.iter().enumerate() { if index > 0 { write!(fmt, ", ")?; } write!(fmt, "{:?}", arg)?; } write!(fmt, ")") } Assert { cond, expected, msg, .. } => { write!(fmt, "assert(")?; if !expected { write!(fmt, "!")?; } write!(fmt, "{:?}, ", cond)?; msg.fmt_assert_args(fmt)?; write!(fmt, ")") } FalseEdge { .. } => write!(fmt, "falseEdge"), FalseUnwind { .. } => write!(fmt, "falseUnwind"), InlineAsm { template, ref operands, options, .. } => { write!(fmt, "asm!("{}"", InlineAsmTemplatePiece::to_string(template))?; for op in operands { write!(fmt, ", ")?; let print_late = |&late| if late { "late" } else { "" }; match op { InlineAsmOperand::In { reg, value } => { write!(fmt, "in({}) {:?}", reg, value)?; } InlineAsmOperand::Out { reg, late, place: Some(place) } => { write!(fmt, "{}out({}) {:?}", print_late(late), reg, place)?; } InlineAsmOperand::Out { reg, late, place: None } => { write!(fmt, "{}out({}) _", print_late(late), reg)?; } InlineAsmOperand::InOut { reg, late, in_value, out_place: Some(out_place), } => { write!( fmt, "in{}out({}) {:?} => {:?}", print_late(late), reg, in_value, out_place )?; } InlineAsmOperand::InOut { reg, late, in_value, out_place: None } => { write!(fmt, "in{}out({}) {:?} => _", print_late(late), reg, in_value)?; } InlineAsmOperand::Const { value } => { write!(fmt, "const {:?}", value)?; } InlineAsmOperand::SymFn { value } => { write!(fmt, "sym_fn {:?}", value)?; } InlineAsmOperand::SymStatic { def_id } => { write!(fmt, "sym_static {:?}", def_id)?; } } } write!(fmt, ", options({:?}))", options) } } } /// Returns the list of labels for the edges to the successor basic blocks. pub fn fmt_successor_labels(&self) -> Vec<Cow<'static, str>> { use self::TerminatorKind::*; match *self { Return | Resume | Abort | Unreachable | GeneratorDrop => vec![], Goto { .. } => vec!["".into()], SwitchInt { ref values, switch_ty, .. } => ty::tls::with(|tcx| { let param_env = ty::ParamEnv::empty(); let switch_ty = tcx.lift(&switch_ty).unwrap(); let size = tcx.layout_of(param_env.and(switch_ty)).unwrap().size; values .iter() .map(|&u| { ty::Const::from_scalar(tcx, Scalar::from_uint(u, size), switch_ty) .to_string() .into() }) .chain(iter::once("otherwise".into())) .collect() }), Call { destination: Some(_), cleanup: Some(_), .. } => { vec!["return".into(), "unwind".into()] } Call { destination: Some(_), cleanup: None, .. } => vec!["return".into()], Call { destination: None, cleanup: Some(_), .. } => vec!["unwind".into()], Call { destination: None, cleanup: None, .. } => vec![], Yield { drop: Some(_), .. } => vec!["resume".into(), "drop".into()], Yield { drop: None, .. } => vec!["resume".into()], DropAndReplace { unwind: None, .. } | Drop { unwind: None, .. } => { vec!["return".into()] } DropAndReplace { unwind: Some(_), .. } | Drop { unwind: Some(_), .. } => { vec!["return".into(), "unwind".into()] } Assert { cleanup: None, .. } => vec!["".into()], Assert { .. } => vec!["success".into(), "unwind".into()], FalseEdge { .. } => vec!["real".into(), "imaginary".into()], FalseUnwind { unwind: Some(_), .. } => vec!["real".into(), "cleanup".into()], FalseUnwind { unwind: None, .. } => vec!["real".into()], InlineAsm { destination: Some(_), .. } => vec!["".into()], InlineAsm { destination: None, .. } => vec![], } } } </del> /////////////////////////////////////////////////////////////////////////// // Statements


<ins> #![deny(improper_ctypes_definitions)] #[repr(C)] pub struct Foo { a: u8, b: (), } extern "C" fn foo(x: Foo) -> Foo { todo!() } struct NotSafe(u32); #[repr(C)] pub struct Bar { a: u8, b: (), c: NotSafe, } extern "C" fn bar(x: Bar) -> Bar { //~^ ERROR `extern` fn uses type `NotSafe`, which is not FFI-safe //~^^ ERROR `extern` fn uses type `NotSafe`, which is not FFI-safe todo!() } fn main() {} </ins>


<ins> #![warn(unused)] #![allow(dead_code)] #![deny(non_snake_case)] mod Impl {} //~^ ERROR module `Impl` should have a snake case name fn While() {} //~^ ERROR function `While` should have a snake case name fn main() { let Mod: usize = 0; //~^ ERROR variable `Mod` should have a snake case name //~^^ WARN unused variable: `Mod` let Super: usize = 0; //~^ ERROR variable `Super` should have a snake case name //~^^ WARN unused variable: `Super` } </ins>


} } <ins> fn record_pat_span(&mut self, node: NodeId, span: Span) { debug!("(recording pat) recording {:?} for {:?}", node, span); self.pat_span_map.insert(node, span); } </ins> fn is_accessible_from(&self, vis: ty::Visibility, module: Module<'a>) -> bool { vis.is_accessible_from(module.nearest_parent_mod, self) }


never_suggest_borrow.push(self.tcx.get_diagnostic_item(sym::send_trait).unwrap()); let param_env = obligation.param_env; <del> let trait_ref = trait_ref.skip_binder(); </del> <ins> let trait_ref = poly_trait_ref.skip_binder(); </ins> let found_ty = trait_ref.self_ty(); let found_ty_str = found_ty.to_string();


return tcx.arena.alloc(IndexVec::new()); } <del> let tainted_by_errors = tcx.mir_borrowck(def).tainted_by_errors; </del> <ins> tcx.ensure_with_value().mir_borrowck(def); </ins> let mut promoted = tcx.mir_promoted(def).1.steal(); for body in &mut promoted { <del> if let Some(error_reported) = tainted_by_errors { body.tainted_by_errors = Some(error_reported); } </del> run_analysis_to_runtime_passes(tcx, body); }


Variant2, } <ins> #[derive(Debug)] enum TupleVariant { Variant1(i32), //~ ERROR: variant `Variant1` is never constructed Variant2, } #[derive(Debug)] enum StructVariant { Variant1 { id: i32 }, //~ ERROR: variant `Variant1` is never constructed Variant2, } </ins> fn main() { let e = Enum::Variant2; e.clone(); <ins> let _ = TupleVariant::Variant2; let _ = StructVariant::Variant2; </ins> }


tool::Rustfmt, tool::Miri, tool::CargoMiri, <del> native::Lld </del> <ins> native::Lld, native::CrtBeginEnd </ins> ), Kind::Check | Kind::Clippy { .. } | Kind::Fix | Kind::Format => describe!( check::Std,


#[derive(Copy, Clone, RustcEncodable, RustcDecodable)] enum EntryKind { <ins> AnonConst(mir::ConstQualifs, Lazy<RenderedConst>), </ins> Const(mir::ConstQualifs, Lazy<RenderedConst>), ImmStatic, MutStatic,


}; // rhs has holes ( `$id` and `$(...)` that need filled) let tts = transcribe(&cx.parse_sess.span_diagnostic, Some(named_matches), rhs); <ins> if cx.trace_macros() { trace_macros_note(cx, sp, format!("to `{}`", tts)); } </ins> let directory = Directory { path: cx.current_expansion.module.directory.clone(), ownership: cx.current_expansion.directory_ownership,


}); cx.emit_spanned_lint(DEREF_INTO_DYN_SUPERTRAIT, cx.tcx.def_span(item.owner_id.def_id), SupertraitAsDerefTarget { t, <del> target_principal: target_principal.to_string(), </del> <ins> target_principal, </ins> label, }); }


return; }; let coroutine_ty = body.local_decls[ty::CAPTURE_STRUCT_LOCAL].ty; <del> let ty::Coroutine(_, args) = *coroutine_ty.kind() else { bug!() }; </del> <ins> if coroutine_ty.references_error() { return; } let ty::Coroutine(_, args) = *coroutine_ty.kind() else { bug!("{body:#?}") }; </ins> let coroutine_kind = args.as_coroutine().kind_ty().to_opt_closure_kind().unwrap(); if coroutine_kind == ty::ClosureKind::FnOnce {


}; if let ObligationCauseCode::ImplDerivedObligation(obligation) = &*code { <del> let expected_trait_ref = obligation.parent_trait_ref.skip_binder(); let new_imm_trait_ref = ty::TraitRef::new(obligation.parent_trait_ref.def_id(), imm_substs); let new_mut_trait_ref = ty::TraitRef::new(obligation.parent_trait_ref.def_id(), mut_substs); </del> <ins> let expected_trait_ref = obligation.parent_trait_ref; let new_imm_trait_ref = poly_trait_ref .rebind(ty::TraitRef::new(obligation.parent_trait_ref.def_id(), imm_substs)); let new_mut_trait_ref = poly_trait_ref .rebind(ty::TraitRef::new(obligation.parent_trait_ref.def_id(), mut_substs)); </ins> return try_borrowing(new_imm_trait_ref, new_mut_trait_ref, expected_trait_ref, &[]); } else if let ObligationCauseCode::BindingObligation(_, _) | ObligationCauseCode::ItemObligation(_) = &*code { return try_borrowing( <del> ty::TraitRef::new(trait_ref.def_id, imm_substs), ty::TraitRef::new(trait_ref.def_id, mut_substs), trait_ref, </del> <ins> poly_trait_ref.rebind(ty::TraitRef::new(trait_ref.def_id, imm_substs)), poly_trait_ref.rebind(ty::TraitRef::new(trait_ref.def_id, mut_substs)), *poly_trait_ref, </ins> &never_suggest_borrow[..], ); } else {


error: invalid register `invalid`: unknown register <del> --> $DIR/issue-72570.rs:7:18 </del> <ins> --> $DIR/issue-72570.rs:9:18 </ins> | LL |         asm!("", in("invalid") "".len()); |                  ^^^^^^^^^^^^^^^^^^^^^^


<ins> error[E0004]: non-exhaustive patterns: `(A, Some(A))`, `(A, Some(B))`, `(B, Some(B))` and 2 more not covered --> $DIR/issue-72377.rs:8:11 | LL |     match (x, y) { |           ^^^^^^ patterns `(A, Some(A))`, `(A, Some(B))`, `(B, Some(B))` and 2 more not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms = note: the matched value is of type `(X, Option<X>)` error: aborting due to previous error For more information about this error, try `rustc --explain E0004`. </ins>


#[test] #[cfg(unix)] <del> #[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)] </del> <ins> #[cfg_attr(any(target_os = "vxworks"), ignore)] </ins> fn signal_reported_right() { use crate::os::unix::process::ExitStatusExt; <del> let mut p = Command::new("/bin/sh").arg("-c").arg("read a").stdin(Stdio::piped()).spawn().unwrap(); </del> <ins> let mut p = shell_cmd().arg("-c").arg("read a").stdin(Stdio::piped()).spawn().unwrap(); </ins> p.kill().unwrap(); match p.wait().unwrap().signal() { Some(9) => {}


<ins> // check-pass // https://github.com/rust-lang/rust/issues/113257 #![deny(trivial_casts)] // The casts here are not trivial. struct Foo<'a> { a: &'a () } fn extend_lifetime_very_very_safely<'a>(v: *const Foo<'a>) -> *const Foo<'static> { // This should pass because raw pointer casts can do anything they want. v as *const Foo<'static> } trait Trait {} fn assert_static<'a>(ptr: *mut (dyn Trait + 'a)) -> *mut (dyn Trait + 'static) { ptr as _ } fn main() { let unit = (); let foo = Foo { a: &unit }; let _long: *const Foo<'static> = extend_lifetime_very_very_safely(&foo); } </ins>


// If this is a floating point literal that ends with '.', // get rid of it to stop this from becoming a member access. let snippet = snippet.strip_suffix('.').unwrap_or(&snippet); err.span_suggestion( lit.span, &format!(


let _a = stderr(); let _a = _a.lock(); } <ins> #[test] #[cfg_attr(target_os = "emscripten", ignore)] fn test_lock_stderr() { test_lock(stderr, stderr_locked); } #[test] #[cfg_attr(target_os = "emscripten", ignore)] fn test_lock_stdin() { test_lock(stdin, stdin_locked); } #[test] #[cfg_attr(target_os = "emscripten", ignore)] fn test_lock_stdout() { test_lock(stdout, stdout_locked); } // Helper trait to make lock testing function generic. trait Stdio<'a>: 'static where Self::Lock: 'a, { type Lock; fn lock(&'a self) -> Self::Lock; } impl<'a> Stdio<'a> for Stderr { type Lock = StderrLock<'a>; fn lock(&'a self) -> StderrLock<'a> { self.lock() } } impl<'a> Stdio<'a> for Stdin { type Lock = StdinLock<'a>; fn lock(&'a self) -> StdinLock<'a> { self.lock() } } impl<'a> Stdio<'a> for Stdout { type Lock = StdoutLock<'a>; fn lock(&'a self) -> StdoutLock<'a> { self.lock() } } // Helper trait to make lock testing function generic. trait StdioOwnedLock: 'static {} impl StdioOwnedLock for StderrLock<'static> {} impl StdioOwnedLock for StdinLock<'static> {} impl StdioOwnedLock for StdoutLock<'static> {} // Tests locking on stdio handles by starting two threads and checking that // they block each other appropriately. fn test_lock<T, U>(get_handle: fn() -> T, get_locked: fn() -> U) where T: for<'a> Stdio<'a>, U: StdioOwnedLock, { // State enum to track different phases of the test, primarily when // each lock is acquired and released. #[derive(Debug, PartialEq)] enum State { Start1, Acquire1, Start2, Release1, Acquire2, Release2, } use State::*; // Logging vector to be checked to make sure lock acquisitions and // releases happened in the correct order. let log = Arc::new(Mutex::new(Vec::new())); let ((tx1, rx1), (tx2, rx2)) = (sync_channel(0), sync_channel(0)); let th1 = { let (log, tx) = (Arc::clone(&log), tx1); thread::spawn(move || { log.lock().unwrap().push(Start1); let handle = get_handle(); { let locked = handle.lock(); log.lock().unwrap().push(Acquire1); tx.send(Acquire1).unwrap(); // notify of acquisition tx.send(Release1).unwrap(); // wait for release command log.lock().unwrap().push(Release1); } tx.send(Acquire1).unwrap(); // wait for th2 acquire { let locked = handle.lock(); log.lock().unwrap().push(Acquire1); } log.lock().unwrap().push(Release1); }) }; let th2 = { let (log, tx) = (Arc::clone(&log), tx2); thread::spawn(move || { tx.send(Start2).unwrap(); // wait for start command let locked = get_locked(); log.lock().unwrap().push(Acquire2); tx.send(Acquire2).unwrap(); // notify of acquisition tx.send(Release2).unwrap(); // wait for release command log.lock().unwrap().push(Release2); }) }; assert_eq!(rx1.recv().unwrap(), Acquire1); // wait for th1 acquire log.lock().unwrap().push(Start2); assert_eq!(rx2.recv().unwrap(), Start2); // block th2 assert_eq!(rx1.recv().unwrap(), Release1); // release th1 assert_eq!(rx2.recv().unwrap(), Acquire2); // wait for th2 acquire assert_eq!(rx1.recv().unwrap(), Acquire1); // block th1 assert_eq!(rx2.recv().unwrap(), Release2); // release th2 th2.join().unwrap(); th1.join().unwrap(); assert_eq!( *log.lock().unwrap(), [Start1, Acquire1, Start2, Release1, Acquire2, Release2, Acquire1, Release1] ); } </ins>


use rustc_metadata::creader::{CStore, LoadedMacro}; use rustc_middle::ty::fast_reject::SimplifiedType; use rustc_middle::ty::{self, TyCtxt}; <ins> use rustc_span::def_id::LOCAL_CRATE; </ins> use rustc_span::hygiene::MacroKind; use rustc_span::symbol::{kw, sym, Symbol};


} } <ins> /// Suggest using `while let` for call `next` on an iterator in a for loop. /// /// For example: /// ```ignore (illustrative) /// /// for x in iter { ///     ... ///     iter.next() /// } /// ``` pub(crate) fn explain_iterator_advancement_in_for_loop_if_applicable( &self, err: &mut Diagnostic, span: Span, issued_spans: &UseSpans<'tcx>, ) { let issue_span = issued_spans.args_or_use(); let tcx = self.infcx.tcx; let hir = tcx.hir(); let Some(body_id) = hir.get(self.mir_hir_id()).body_id() else { return }; let typeck_results = tcx.typeck(self.mir_def_id()); struct ExprFinder<'hir> { issue_span: Span, expr_span: Span, body_expr: Option<&'hir hir::Expr<'hir>>, loop_bind: Option<Symbol>, } impl<'hir> Visitor<'hir> for ExprFinder<'hir> { fn visit_expr(&mut self, ex: &'hir hir::Expr<'hir>) { if let hir::ExprKind::Loop(hir::Block{ stmts: [stmt, ..], ..}, _, hir::LoopSource::ForLoop, _) = ex.kind && let hir::StmtKind::Expr(hir::Expr{ kind: hir::ExprKind::Match(call, [_, bind, ..], _), ..}) = stmt.kind && let hir::ExprKind::Call(path, _args) = call.kind && let hir::ExprKind::Path(hir::QPath::LangItem(LangItem::IteratorNext, _, _, )) = path.kind && let hir::PatKind::Struct(path, [field, ..], _) = bind.pat.kind && let hir::QPath::LangItem(LangItem::OptionSome, _, _) = path && let PatField { pat: hir::Pat{ kind: hir::PatKind::Binding(_, _, ident, ..), .. }, ..} = field && self.issue_span.source_equal(call.span) { self.loop_bind = Some(ident.name); } if let hir::ExprKind::MethodCall(body_call, _recv, ..) = ex.kind && body_call.ident.name == sym::next && ex.span.source_equal(self.expr_span) { self.body_expr = Some(ex); } hir::intravisit::walk_expr(self, ex); } } let mut finder = ExprFinder { expr_span: span, issue_span, loop_bind: None, body_expr: None }; finder.visit_expr(hir.body(body_id).value); if let Some(loop_bind) = finder.loop_bind && let Some(body_expr) = finder.body_expr && let Some(def_id) = typeck_results.type_dependent_def_id(body_expr.hir_id) && let Some(trait_did) = tcx.trait_of_item(def_id) && tcx.is_diagnostic_item(sym::Iterator, trait_did) { err.note(format!( "a for loop advances the iterator for you, the result is stored in `{}`.", loop_bind )); err.help("if you want to call `next` on a iterator within the loop, consider using `while let`."); } } </ins> /// Suggest using closure argument instead of capture. /// /// For example:


_ => false, } } <ins> fn is_local(&self) -> bool { self.normal_ancestor_id.is_some() } </ins> } impl<'a> fmt::Debug for ModuleS<'a> {


[dependencies] core = { path = "../core" } <del> compiler_builtins = { version = "0.1.114", features = ['rustc-dep-of-std'] } [target.'cfg(not(any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")))'.dependencies] compiler_builtins = { version = "0.1.114", features = ["no-f16-f128"] } </del> <ins> compiler_builtins = { version = "0.1.117", features = ['rustc-dep-of-std'] } </ins> [dev-dependencies] rand = { version = "0.8.5", default-features = false, features = ["alloc"] }


<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. pub trait AbstractRenderer {} fn _create_render(_: &()) -> AbstractRenderer //~^ ERROR: the trait `core::kinds::Sized` is not implemented { match 0u { _ => unimplemented!() } } fn main() { } </ins>


<del> Subproject commit a416c5e0f7c4c9473069a58410d3ec3e86b1ac0d </del> <ins> Subproject commit fc24fce73f878e641094b1802df1e748c5fe233a </ins>


<del> error[E0308]: mismatched types --> $DIR/issue-30904.rs:20:45 | LL |     let _: for<'a> fn(&'a str) -> Str<'a> = Str; |                                             ^^^ expected concrete lifetime, found bound lifetime parameter 'a | = note: expected type `for<'a> fn(&'a str) -> Str<'a>` found type `fn(&str) -> Str<'_> {Str::<'_>}` error[E0631]: type mismatch in function arguments --> $DIR/issue-30904.rs:26:10 | LL | fn test<F: for<'x> FnOnce<(&'x str,)>>(_: F) {} |    ----    -------------------------- required by this bound in `test` ... LL | struct Str<'a>(&'a str); | ------------------------ found signature of `fn(&str) -> _` ... LL |     test(Str); |          ^^^ expected signature of `for<'x> fn(&'x str) -> _` error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0308`. </del>


<ins> // aux-build:issue-99221-aux.rs // build-aux-docs // ignore-cross-compile #![crate_name = "foo"] #[macro_use] extern crate issue_99221_aux; pub use issue_99221_aux::*; // @count foo/index.html '//a[@class="macro"]' 1 #[macro_export] macro_rules! print { () => () } </ins>


}) } <del> pub fn predicate_for_default_trait_impl<'tcx>( </del> <ins> pub fn predicate_for_trait_def<'tcx>( </ins> tcx: &ty::ctxt<'tcx>, cause: ObligationCause<'tcx>, trait_def_id: ast::DefId,


|                   ^ expected identifier, found reserved identifier error: associated constant in `impl` without body <del> --> $DIR/typeck_type_placeholder_item.rs:203:5 </del> <ins> --> $DIR/typeck_type_placeholder_item.rs:205:5 </ins> | LL |     const C: _; |     ^^^^^^^^^^-


install_sh(builder, "clippy", self.compiler.stage, Some(self.target), &tarball); }; Miri, alias = "miri", Self::should_build(_config), only_hosts: true, { <del> let tarball = builder .ensure(dist::Miri { compiler: self.compiler, target: self.target }) .expect("missing miri"); install_sh(builder, "miri", self.compiler.stage, Some(self.target), &tarball); </del> <ins> if let Some(tarball) = builder.ensure(dist::Miri { compiler: self.compiler, target: self.target }) { install_sh(builder, "miri", self.compiler.stage, Some(self.target), &tarball); } else { // Miri is only available on nightly builder.info( &format!("skipping Install miri stage{} ({})", self.compiler.stage, self.target), ); } </ins> }; LlvmTools, alias = "llvm-tools", Self::should_build(_config), only_hosts: true, { let tarball = builder


<ins> // Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // Test that methods from shadowed traits cannot be used mod foo { pub trait T { fn f(&self) {} } impl T for () {} } mod bar { pub use foo::T; } fn main() { pub use bar::*; struct T; ().f() //~ ERROR no method } </ins>


<ins> warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/nested-apit-mentioning-outer-bound-var.rs:1:12 | LL | #![feature(non_lifetime_binders)] |            ^^^^^^^^^^^^^^^^^^^^ | = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information = note: `#[warn(incomplete_features)]` on by default error: `impl Trait` can only mention type parameters from an fn or impl --> $DIR/nested-apit-mentioning-outer-bound-var.rs:8:52 | LL | fn uwu(_: impl for<T> Trait<(), Assoc = impl Trait<T>>) {} |                    - type parameter declared here  ^ error: aborting due to previous error; 1 warning emitted </ins>


// Once we're done with llvm 14 and earlier, this test can be deleted. <del> #![crate_type="lib"] </del> <ins> #![crate_type = "lib"] </ins> use std::mem::MaybeUninit;


// and about 2 * (len1 + len2) comparisons in the worst case // while `extend` takes O(len2 * log(len1)) operations // and about 1 * len2 * log_2(len1) comparisons in the worst case, <del> // assuming len1 >= len2. </del> <ins> // assuming len1 >= len2. For larger heaps, the crossover point // no longer follows this reasoning and was determined empirically. </ins> #[inline] fn better_to_rebuild(len1: usize, len2: usize) -> bool { <del> 2 * (len1 + len2) < len2 * log2_fast(len1) </del> <ins> let tot_len = len1 + len2; if tot_len <= 2048 { 2 * tot_len < len2 * log2_fast(len1) } else { 2 * tot_len < len2 * 11 } </ins> } if better_to_rebuild(self.len(), other.len()) {


} _ => token.span, }, <del> Some(tree) => tree.span(), None => colon_span, </del> <ins> // Invalid, return a nice source location _ => colon_span.with_lo(start_sp.lo()), </ins> } } <del> Some(tree) => tree.span(), None => start_sp, </del> <ins> // Whether it's none or some other tree, it doesn't belong to // the current meta variable, returning the original span. _ => start_sp, </ins> }; result.push(TokenTree::MetaVarDecl(span, ident, None));


<ins> #![feature(fn_traits, unboxed_closures)] fn test<F: for<'x> FnOnce<(&'x str,)>>(_: F) {} struct Compose<F,G>(F,G); impl<T,F,G> FnOnce<(T,)> for Compose<F,G> where F: FnOnce<(T,)>, G: FnOnce<(F::Output,)> { type Output = G::Output; extern "rust-call" fn call_once(self, (x,): (T,)) -> G::Output { (self.1)((self.0)(x)) } } fn bad<T>(f: fn(&'static str) -> T) { test(Compose(f, |_| {})); //~ ERROR: mismatched types } fn main() {} </ins>


/// A type that allows convenient usage of a UDP stream connected to one /// address via the `Reader` and `Writer` traits. <ins> /// /// # Note /// /// This structure has been deprecated because `Reader` is a stream-oriented API but UDP /// is a packet-oriented protocol. Every `Reader` method will read a whole packet and /// throw all superfluous bytes away so that they are no longer available for further /// method calls. #[deprecated] </ins> pub struct UdpStream { socket: UdpSocket, connected_to: SocketAddr


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


// panicking thread consumes at least 2 bytes of address space. static GLOBAL_PANIC_COUNT: AtomicUsize = AtomicUsize::new(0); <ins> // Return the state of the ALWAYS_ABORT_FLAG and number of panics. // // If ALWAYS_ABORT_FLAG is not set, the number is determined on a per-thread // base (stored in LOCAL_PANIC_COUNT), i.e. it is the amount of recursive calls // of the calling thread. // If ALWAYS_ABORT_FLAG is set, the number equals the *global* number of panic // calls. See above why LOCAL_PANIC_COUNT is not used. </ins> pub fn increase() -> (bool, usize) { <del> ( GLOBAL_PANIC_COUNT.fetch_add(1, Ordering::Relaxed) & ALWAYS_ABORT_FLAG != 0, </del> <ins> let global_count = GLOBAL_PANIC_COUNT.fetch_add(1, Ordering::Relaxed); let must_abort = global_count & ALWAYS_ABORT_FLAG != 0; let panics = if must_abort { global_count & !ALWAYS_ABORT_FLAG } else { </ins> LOCAL_PANIC_COUNT.with(|c| { let next = c.get() + 1; c.set(next); next <del> }), ) </del> <ins> }) }; (must_abort, panics) </ins> } pub fn decrease() {


<ins> error[E0644]: closure/coroutine type that references itself --> $DIR/cyclic_type_ice.rs:3:7 | LL |     f(f); |       ^ cyclic type of infinite size | = note: closures cannot capture themselves or take themselves as argument; this error may be the result of a recent compiler bug-fix, see issue #46062 <https://github.com/rust-lang/rust/issues/46062> for more information error[E0057]: this function takes 2 arguments but 1 argument was supplied --> $DIR/cyclic_type_ice.rs:3:5 | LL |     f(f); |     ^--- an argument is missing | note: closure defined here --> $DIR/cyclic_type_ice.rs:2:13 | LL |     let f = |_, _| (); |             ^^^^^^ help: provide the argument | LL |     f(/*  */, /*  */); |      ~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors Some errors have detailed explanations: E0057, E0644. For more information about an error, try `rustc --explain E0057`. </ins>


"concatenates all document attributes into one document attribute"), ("strip-private", passes::strip_private, "strips all private items from a crate which cannot be seen externally"), <ins> ("strip-priv-imports", passes::strip_priv_imports, "strips all private import statements (`use`, `extern crate`) from a crate"), </ins> ]; const DEFAULT_PASSES: &'static [&'static str] = &[


<ins> # only-linux # ignore-32bit -include ../tools.mk all: $(RUSTC) eh_frame-terminator.rs $(call RUN,eh_frame-terminator) | $(CGREP) '1122334455667788' objdump --dwarf=frames $(TMPDIR)/eh_frame-terminator | $(CGREP) 'ZERO terminator' </ins>


<ins> // check-fail // dont-check-compiler-stdout // dont-check-compiler-stderr fn�a<e>(){fn�p(){e}} //~ ERROR unknown start of token: u{fffd} //~^ ERROR unknown start of token: u{fffd} //~^^ ERROR can't use generic parameters from outer function [E0401] //~^^^ WARN type parameter `e` should have an upper camel case name fn main(){} </ins>


<ins> error[E0308]: mismatched types --> $DIR/suggest-call-on-pat-mismatch.rs:7:12 | LL |     if let E::One(var1, var2) = var { |            ^^^^^^^^^^^^^^^^^^   --- this expression has type `fn(i32, i32) -> E {E::One}` |            | |            expected enum constructor, found `E` | = note: expected enum constructor `fn(i32, i32) -> E {E::One}` found enum `E` help: use parentheses to construct this tuple variant | LL |     if let E::One(var1, var2) = var(/* i32 */, /* i32 */) { |                                    ++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/suggest-call-on-pat-mismatch.rs:13:9 | LL |     let Some(x) = Some; |         ^^^^^^^   ---- this expression has type `fn(_) -> Option<_> {Option::<_>::Some}` |         | |         expected enum constructor, found `Option<_>` | = note: expected enum constructor `fn(_) -> Option<_> {Option::<_>::Some}` found enum `Option<_>` help: use parentheses to construct this tuple variant | LL |     let Some(x) = Some(/* value */); |                       +++++++++++++ error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0308`. </ins>


/// /// [`to_ascii_uppercase()`]: #method.to_ascii_uppercase #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")] <del> #[rustc_const_unstable(feature = "const_make_ascii", issue = "130698")] </del> <ins> #[rustc_const_stable(feature = "const_make_ascii", since = "CURRENT_RUSTC_VERSION")] </ins> #[inline] <ins> #[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))] </ins> pub const fn make_ascii_uppercase(&mut self) { *self = self.to_ascii_uppercase(); }


> { after_tail: usize, after_head: usize, <del> iter: Iter<'a, T>, </del> <ins> ring: NonNull<[T]>, tail: usize, head: usize, </ins> deque: NonNull<VecDeque<T, A>>, <ins> _phantom: PhantomData<&'a T>, </ins> } impl<'a, T, A: Allocator> Drain<'a, T, A> { pub(super) unsafe fn new( after_tail: usize, after_head: usize, <del> iter: Iter<'a, T>, </del> <ins> ring: &'a [MaybeUninit<T>], tail: usize, head: usize, </ins> deque: NonNull<VecDeque<T, A>>, ) -> Self { <del> Drain { after_tail, after_head, iter, deque } </del> <ins> let ring = unsafe { NonNull::new_unchecked(ring as *const [MaybeUninit<T>] as *mut _) }; Drain { after_tail, after_head, ring, tail, head, deque, _phantom: PhantomData } </ins> } }


use crate::io::ErrorKind; use crate::str; <del> // FIXME(#10380) these tests should not all be ignored on android. </del> <ins> #[cfg(target_os = "android")] fn shell_cmd() -> Command { Command::new("/system/bin/sh") } #[cfg(not(target_os = "android"))] fn shell_cmd() -> Command { Command::new("/bin/sh") } </ins> #[test] <del> #[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)] </del> <ins> #[cfg_attr(any(target_os = "vxworks"), ignore)] </ins> fn smoke() { let p = if cfg!(target_os = "windows") { Command::new("cmd").args(&["/C", "exit 0"]).spawn() } else { <del> Command::new("true").spawn() </del> <ins> shell_cmd().arg("-c").arg("true").spawn() </ins> }; assert!(p.is_ok()); let mut p = p.unwrap();


LL | | /// Some docs. LL | | ...  | <del> LL | |     pub fn bar() {} </del> <ins> LL | |     } </ins> LL | | } | |_^ |


<ins> // check-pass // Regression test for issue #55099 // Tests that we don't incorrectly consider a lifetime to part // of the concrete type #![feature(type_alias_impl_trait)] trait Future { } struct AndThen<F>(F); impl<F> Future for AndThen<F> { } struct Foo<'a> { x: &'a mut (), } type F = impl Future; impl<'a> Foo<'a> { fn reply(&mut self) -> F { AndThen(|| ()) } } fn main() {} </ins>


<del> Subproject commit 20da8f45c601d0eec8af8c0897abd536ad57951f </del> <ins> Subproject commit 71be6f62fa920c0bd10cdf3a29aeb8c6719a8075 </ins>


<ins> warning: `extern` block uses type `TransparentCustomZst`, which is not FFI-safe --> $DIR/repr-transparent-issue-87496.rs:8:18 | LL |     fn good17(p: TransparentCustomZst); |                  ^^^^^^^^^^^^^^^^^^^^ not FFI-safe | = note: `#[warn(improper_ctypes)]` on by default = note: this struct contains only zero-sized fields note: the type is defined here --> $DIR/repr-transparent-issue-87496.rs:6:1 | LL | struct TransparentCustomZst(()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: 1 warning emitted </ins>


| NonMutatingUseContext::Copy | NonMutatingUseContext::Inspect | NonMutatingUseContext::Move <ins> | NonMutatingUseContext::PlaceMention </ins> | NonMutatingUseContext::ShallowBorrow | NonMutatingUseContext::SharedBorrow | NonMutatingUseContext::UniqueBorrow,


// Check whether a span corresponding to a range expression is a // range literal, rather than an explicit struct or `new()` call. fn is_lit(sm: &SourceMap, span: &Span) -> bool { <del> let end_point = sm.end_point(*span); if let Ok(end_string) = sm.span_to_snippet(end_point) { !(end_string.ends_with('}') || end_string.ends_with(')')) } else { false } </del> <ins> sm.span_to_snippet(*span).map(|range_src| range_src.contains("..")).unwrap_or(false) </ins> }; match expr.kind {


// @has blanket_with_local.json "$.index[*][?(@.name=='Load')]" pub trait Load { <ins> // @has - "$.index[*][?(@.name=='load')]" </ins> fn load() {} <ins> // @has - "$.index[*][?(@.name=='write')]" fn write(self) {} </ins> } impl<P> Load for P { fn load() {} <ins> fn write(self) {} </ins> } // @has - "$.index[*][?(@.name=='Wrapper')]"


<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. pub fn main() { let command = "a"; match command { "foo" => println!("foo"), _     => println!("{}", command), } } </ins>


<ins> // Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. #![crate_type = "lib"] #[macro_export] macro_rules! declare { () => ( pub fn aaa() {} pub mod bbb { use super::aaa; pub fn ccc() { aaa(); } } ) } </ins>


} else if #[cfg(target_os = "hermit")] { #[path = "hermit.rs"] mod real_imp; <del> } else if #[cfg(all(target_env = "msvc", target_arch = "aarch64"))] { #[path = "dummy.rs"] mod real_imp; </del> } else if #[cfg(target_env = "msvc")] { #[path = "seh.rs"] mod real_imp;


documentation: ~~~ <del> #[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk.png", </del> <ins> #[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", </ins> html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://static.rust-lang.org/doc/master")]; ~~~


<ins> error: expected exactly one integer literal argument --> $DIR/invalid_rustc_layout_scalar_valid_range.rs:3:1 | LL | #[rustc_layout_scalar_valid_range_start(u32::MAX)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: expected exactly one integer literal argument --> $DIR/invalid_rustc_layout_scalar_valid_range.rs:6:1 | LL | #[rustc_layout_scalar_valid_range_end(1, 2)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: expected exactly one integer literal argument --> $DIR/invalid_rustc_layout_scalar_valid_range.rs:9:1 | LL | #[rustc_layout_scalar_valid_range_end(a = "a")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: attribute should be applied to a struct --> $DIR/invalid_rustc_layout_scalar_valid_range.rs:12:1 | LL |   #[rustc_layout_scalar_valid_range_end(1)] |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | / enum E { LL | |     X = 1, LL | |     Y = 14, LL | | } | |_- not a struct error: aborting due to 4 previous errors </ins>


pub(super) node_to_hir_id: IndexVec<ast::NodeId, hir::HirId>, macro_def_scopes: FxHashMap<Mark, DefId>, expansions: FxHashMap<DefIndex, Mark>, <del> keys_created: FxHashSet<DefKey>, </del> <ins> next_disambiguator: FxHashMap<(DefIndex, DefPathData), u32>, </ins> } // Unfortunately we have to provide a manual impl of Clone because of the


<ins> // compile-pass #[deny(warnings)] enum Empty { } trait Bar<T> {} impl Bar<Empty> for () {} fn boo() -> impl Bar<Empty> {} fn main() { boo(); } </ins>


} Some(BacktraceStyle::Off) => { if FIRST_PANIC.swap(false, Ordering::SeqCst) { <del> if let Some(path) = path { let _ = writeln!( err, "note: a backtrace for this error was stored at `{}`", path.display(), ); } else { let _ = writeln!( err, "note: run with `RUST_BACKTRACE=1` environment variable to display a  </del> <ins> let _ = writeln!( err, "note: run with `RUST_BACKTRACE=1` environment variable to display a  </ins> backtrace" <del> ); } </del> <ins> ); </ins> } } // If backtraces aren't supported or are forced-off, do nothing.


"x86_64-pc-windows-gnu", ]; <del> static TOOLSTATE: &str = "https://raw.githubusercontent.com/rust-lang-nursery/rust-toolstate/master/history/linux.tsv"; </del> #[derive(Serialize)] #[serde(rename_all = "kebab-case")] struct Manifest {


<ins> # Rustdoc in-doc settings Rustdoc's HTML output includes a settings menu, and this chapter describes what each setting in this menu does. It can be accessed by clicking on the gear button (<i class="fa fa-cog" aria-hidden="true"></i>) in the upper right. ## Changing displayed theme It is possible to change the theme. If you pick the "system preference", you will be able to see two new sub-menus: "Preferred light theme" and "Preferred dark theme". It means that if your system preference is set to "light", then rustdoc will use the theme you selected in "Preferred light theme". ## Auto-hide item contents for large items If the type definition contains more than 12 items, and this setting is enabled, it'll collapse them by default. You can see them by clicking on the `[+]` button to expand them. A good example of this setting in use can be seen in the [`Iterator`](https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html) doc page: ![Collapsed long item](../images/collapsed-long-item.png) ## Auto-hide item methods' documentation If enabled, this setting will collapse all trait implementations blocks. It is convenient if you just want an overview of all the methods available. You can still see a method's documentation by expanding it. ## Auto-hide trait implementation documentation If enabled, this setting will collapse all trait implementations blocks (you can see them in the "Trait Implementations" section). It is convenient if you just want an overview of all the trait implemented on a type. You can still see a trait implementation's associated items by expanding it. Example: ![Collapsed trait implementations](../images/collapsed-trait-impls.png) ## Directly go to item in search if there is only one result If this setting is enabled, you will directly be taken to the result page if your search only returned one element. Useful if you know exactly what you're looking for and want to be taken there directly and not waste time selecting the only search result. ## Show line numbers on code examples If enabled, this setting will add line numbers to the code examples in the documentation. It provides a visual aide for the code reading. ## Disable keyboard shortcuts If this setting is enabled, the keyboard shortcuts will be disabled. It's useful in case some of these shortcuts are already used by a web extension you're using. To see the full list of the rustdoc keyboard shortcuts, you can open the help menu (the button with the question mark on the left of the setting menu button). </ins>


env, ffi::{OsStr, OsString}, fs::{self, File}, <del> io::{BufRead, BufReader, ErrorKind}, </del> <ins> io::{self, BufRead, BufReader, ErrorKind}, </ins> path::{Path, PathBuf}, process::{Command, Stdio}, };


// We have a valid span in almost all cases, but we don't have one when linting a crate // name provided via the command line. if !ident.span.is_dummy() { <ins> let sc_ident = Ident::from_str_and_span(&sc, ident.span); let (message, suggestion) = if sc_ident.is_reserved() { // We shouldn't suggest a reserved identifier to fix non-snake-case identifiers. // Instead, recommend renaming the identifier entirely or, if permitted, // escaping it to create a raw identifier. if sc_ident.name.can_be_raw() { ("rename the identifier or convert it to a snake case raw identifier", sc_ident.to_string()) } else { err.note(&format!("`{}` cannot be used as a raw identifier", sc)); ("rename the identifier", String::new()) } } else { ("convert the identifier to snake case", sc) }; </ins> err.span_suggestion( ident.span, <del> "convert the identifier to snake case", sc, </del> <ins> message, suggestion, </ins> Applicability::MaybeIncorrect, ); } else {


// be added explicitly if necessary, see the error in `fn link_rlib`) compiled // as an executable due to `--test`. Use whole-archive implicitly, like before // the introduction of native lib modifiers. <del> || (bundle != Some(false) && sess.opts.test) </del> <ins> || (whole_archive == None && bundle != Some(false) && sess.opts.test) </ins> { cmd.link_whole_staticlib( name,


/// /// [`to_ascii_uppercase`]: Self::to_ascii_uppercase #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")] <del> #[rustc_const_unstable(feature = "const_make_ascii", issue = "130698")] </del> <ins> #[rustc_const_stable(feature = "const_make_ascii", since = "CURRENT_RUSTC_VERSION")] </ins> #[inline] <ins> #[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))] </ins> pub const fn make_ascii_uppercase(&mut self) { *self = self.to_ascii_uppercase(); }


} self.cx.borrowck_context.constraints.outlives_constraints.push(constraint) } <del> for live_region in liveness_constraints.rows() { self.cx .borrowck_context .constraints .liveness_constraints .add_element(live_region, location); </del> <ins> for region in liveness_constraints.rows() { // If the region is live at at least one location in the promoted MIR, // then add a liveness constraint to the main MIR for this region // at the location provided as an argument to this method if let Some(_) = liveness_constraints.get_elements(region).next() { self.cx .borrowck_context .constraints .liveness_constraints .add_element(region, location); } </ins> } if !closure_bounds.is_empty() {


param_env: ty::ParamEnv<'tcx>, cause: &ObligationCause<'tcx>, ) -> Option<ty::PolyExistentialTraitRef<'tcx>> { <ins> // Don't drop any candidates in intercrate mode, as it's incomplete. // (Not that it matters, since `Unsize` is not a stable trait.) if self.infcx.intercrate { return None; } </ins> let tcx = self.tcx(); if tcx.features().trait_upcasting { return None;


#[stable(feature = "rust1", since = "1.0.0")] pub fn is_dir(&self) -> bool { self.file_type().is_dir() } <del> /// Returns whether this metadata is for a regular file. </del> <ins> /// Returns whether this metadata is for a regular file. The /// result is mutually exclusive to the result of /// [`is_dir`], and will be false for symlink metadata /// obtained from [`symlink_metadata`]. /// /// [`is_dir`]: struct.Metadata.html#method.is_dir /// [`symlink_metadata`]: fn.symlink_metadata.html </ins> /// /// # Examples ///


<ins> // edition:2018 // aux-build:external_macro.rs // Ensure that CONST_ERR lint errors // are not silenced in external macros. // https://github.com/rust-lang/rust/issues/65300 extern crate external_macro; use external_macro::static_assert; fn main() { static_assert!(2 + 2 == 5); //~ ERROR } </ins>


ignore_unresolved_invocations: bool, record_used: Option<Span>) -> Result<&'a NameBinding<'a>, Determinacy> { <del> let ident = ident.unhygienize(); </del> self.populate_module_if_necessary(module); let resolution = self.resolution(module, ident, ns)


#[inline] fn next(&mut self) -> Option<$elem> { // could be implemented with slices, but this avoids bounds checks <del> if self.ptr == self.end { None } else { unsafe { if mem::size_of::<T>() != 0 { ::intrinsics::assume(!self.ptr.is_null()); ::intrinsics::assume(!self.end.is_null()); } </del> <ins> unsafe { if mem::size_of::<T>() != 0 { assume(!self.ptr.is_null()); assume(!self.end.is_null()); } if self.ptr == self.end { None } else { </ins> let old = self.ptr; self.ptr = slice_offset!(self.ptr, 1); Some(slice_ref!(old))


C([Box<A>]), } <del> fn c(c:char) -> A { B(c) //~ ERROR cannot move a value of type A: the size of A cannot be statically determined </del> <ins> fn c(c:char) { B(c); //~^ ERROR cannot move a value of type A: the size of A cannot be statically determined </ins> } pub fn main() {}


let mut is_valid = true; if let Some(mi) = attr.meta() && let Some(list) = mi.meta_item_list() { <del> for (meta_index, meta) in list.into_iter().enumerate() { </del> <ins> for meta in list { </ins> if let Some(i_meta) = meta.meta_item() { match i_meta.name_or_empty() { sym::alias


<ins> #![crate_type = "lib"] struct Apple((Apple, Option(Banana ? Citron))); //~^ ERROR invalid `?` in type //~| ERROR expected one of `)` or `,`, found `Citron` //~| ERROR cannot find type `Citron` in this scope [E0412] //~| ERROR parenthesized type parameters may only be used with a `Fn` trait [E0214] //~| ERROR recursive type `Apple` has infinite size [E0072] </ins>


declare_lint! { pub CONST_ERR, Deny, <del> "constant evaluation detected erroneous expression" </del> <ins> "constant evaluation detected erroneous expression", report_in_external_macro: true </ins> } declare_lint! {


// ignore-sgx no libc // ignore-emscripten no processes // ignore-sgx no processes <del> // ignore-android: FIXME(#85261) </del> // ignore-fuchsia no fork #![feature(rustc_private)]


<ins> // Regression test for issue 123710. // Tests that the we do not ICE in KnownPanicsLint // when a union contains an enum with an repr(packed), // which is a repr not supported for enums #[repr(packed)] //~^ ERROR attribute should be applied to a struct or union #[repr(u32)] enum E { A, B, C, } fn main() { union InvalidTag { int: u32, e: E, //~^ ERROR field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union } let _invalid_tag = InvalidTag { int: 4 }; } </ins>


(self.generics.clean(cx), (&self.decl, self.body).clean(cx)) }); <ins> let did = cx.tcx.hir().local_def_id(self.id); let constness = if cx.tcx.is_min_const_fn(did) { hir::Constness::Const } else { hir::Constness::NotConst }; </ins> Item { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx),


/// /// **Example:** /// ```rust <del> /// // Bad </del> /// println!(""); <del> /// /// // Good /// println!(); </del> /// ``` pub PRINTLN_EMPTY_STRING, style,


<ins> // compile-flags:--test /// ``` /// assert!(true) /// ``` pub fn f() {} pub fn f() {} </ins>


<ins> error[E0433]: failed to resolve: there are too many leading `super` keywords --> $DIR/issue-82156.rs:2:5 | LL |     super(); |     ^^^^^ there are too many leading `super` keywords error: aborting due to previous error For more information about this error, try `rustc --explain E0433`. </ins>


// Record, lower it to `$binding_mode $ident @ _`, and stop here. PatKind::Ident(ref bm, ident, Some(ref sub)) if sub.is_rest() => { prev_rest_span = Some(sub.span); <del> let lower_sub = |this: &mut Self| Some(this.pat_wild_with_node_id_of(sub)); let node = self.lower_pat_ident(pat, bm, ident, lower_sub); slice = Some(self.pat_with_node_id_of(pat, node)); </del> <ins> slice = Some(lower_rest_sub(self, pat, bm, ident, sub)); </ins> break; } // It was not a subslice pattern so lower it normally.


<ins> error: unnecessary parentheses around assigned value --> $DIR/unused-parens-for-stmt-expr-attributes-issue-129833.rs:9:13 | LL |     let _ = (#[inline] #[allow(dead_code)] || println!("Hello!")); |             ^                                                   ^ | note: the lint level is defined here --> $DIR/unused-parens-for-stmt-expr-attributes-issue-129833.rs:6:9 | LL | #![deny(unused_parens)] |         ^^^^^^^^^^^^^ help: remove these parentheses | LL -     let _ = (#[inline] #[allow(dead_code)] || println!("Hello!")); LL +     let _ = #[inline] #[allow(dead_code)] || println!("Hello!"); | error: unnecessary parentheses around block return value --> $DIR/unused-parens-for-stmt-expr-attributes-issue-129833.rs:10:5 | LL |     (#[inline] #[allow(dead_code)] || println!("Hello!")) |     ^                                                   ^ | help: remove these parentheses | LL -     (#[inline] #[allow(dead_code)] || println!("Hello!")) LL +     #[inline] #[allow(dead_code)] || println!("Hello!") | error: aborting due to 2 previous errors </ins>


LL |     let _: Wow<{ A.0 }>; |                +     + <ins> error: expected type, found `]` --> $DIR/bad-const-generic-exprs.rs:16:17 | LL |     let _: Wow<[]>; |                 ^ expected type | help: expressions must be enclosed in braces to be used as const generic arguments | LL |     let _: Wow<{ [] }>; |                +    + </ins> error: expected type, found `12` --> $DIR/bad-const-generic-exprs.rs:19:17 | LL |     let _: Wow<[12]>; |                 ^^ expected type <del> error[E0747]: type provided when a constant was expected </del> <ins> error: invalid const generic expression </ins> --> $DIR/bad-const-generic-exprs.rs:19:16 | LL |     let _: Wow<[12]>; |                ^^^^ <ins> | help: expressions must be enclosed in braces to be used as const generic arguments | LL |     let _: Wow<{ [12] }>; |                +      + error: expected type, found `0` --> $DIR/bad-const-generic-exprs.rs:23:17 | LL |     let _: Wow<[0, 1, 3]>; |                 ^ expected type | help: expressions must be enclosed in braces to be used as const generic arguments | LL |     let _: Wow<{ [0, 1, 3] }>; |                +           + error: expected type, found `0xff` --> $DIR/bad-const-generic-exprs.rs:26:17 | LL |     let _: Wow<[0xff; 8]>; |                 ^^^^ expected type error: invalid const generic expression --> $DIR/bad-const-generic-exprs.rs:26:16 | LL |     let _: Wow<[0xff; 8]>; |                ^^^^^^^^^ | help: expressions must be enclosed in braces to be used as const generic arguments | LL |     let _: Wow<{ [0xff; 8] }>; |                +           + error: expected type, found `1` --> $DIR/bad-const-generic-exprs.rs:30:17 | LL |     let _: Wow<[1, 2]>; // Regression test for issue #81698. |                 ^ expected type | help: expressions must be enclosed in braces to be used as const generic arguments | LL |     let _: Wow<{ [1, 2] }>; // Regression test for issue #81698. |                +        + error: expected type, found `0` --> $DIR/bad-const-generic-exprs.rs:33:17 | LL |     let _: Wow<&0>; |                 ^ expected type | help: expressions must be enclosed in braces to be used as const generic arguments | LL |     let _: Wow<{ &0 }>; |                +    + error: expected type, found `""` --> $DIR/bad-const-generic-exprs.rs:36:17 | LL |     let _: Wow<("", 0)>; |                 ^^ expected type | help: expressions must be enclosed in braces to be used as const generic arguments | LL |     let _: Wow<{ ("", 0) }>; |                +         + error: expected type, found `1` --> $DIR/bad-const-generic-exprs.rs:39:17 | LL |     let _: Wow<(1 + 2) * 3>; |                 ^ expected type | help: expressions must be enclosed in braces to be used as const generic arguments | LL |     let _: Wow<{ (1 + 2) * 3 }>; |                +             + error: expected one of `,` or `>`, found `0` --> $DIR/bad-const-generic-exprs.rs:43:17 | LL |     let _: Wow<!0>; |         -       ^ expected one of `,` or `>` |         | |         while parsing the type for `_` | help: you might have meant to end the type parameters here | LL |     let _: Wow<!>0>; |                 + </ins> <del> error: aborting due to 6 previous errors </del> <ins> error: aborting due to 15 previous errors </ins> <del> For more information about this error, try `rustc --explain E0747`. </del>


| NonMutatingUse(NonMutatingUseContext::Move) | NonMutatingUse(NonMutatingUseContext::Inspect) | NonMutatingUse(NonMutatingUseContext::Projection) <ins> | NonMutatingUse(NonMutatingUseContext::PlaceMention) </ins> | NonUse(_) => {} // These could be propagated with a smarter analysis or just some careful thinking about


} } <del> // FIXME(eddyb) do we need "not promotable" in anything // other than `Mode::Fn` by any chance? false </del> <ins> Self::in_operand(cx, callee) || args.iter().any(|arg| Self::in_operand(cx, arg)) </ins> } }


args: vec![Operand::Consume(data.value.clone())], destination: Some((unit_temp, target)), cleanup: None <del> }); block </del> <ins> } </ins> }


<ins> // Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. pub fn main() { let f = || || 0; std::thread::spawn(f()); } </ins>


} } <ins> fn get_rustfmt_version(build: &Builder<'_>) -> Option<(String, PathBuf)> { let stamp_file = build.out.join("rustfmt.stamp"); let mut cmd = Command::new(match build.initial_rustfmt() { Some(p) => p, None => return None, }); cmd.arg("--version"); let output = match cmd.output() { Ok(status) => status, Err(_) => return None, }; if !output.status.success() { return None; } Some((String::from_utf8(output.stdout).unwrap(), stamp_file)) } /// Return whether the format cache can be reused. fn verify_rustfmt_version(build: &Builder<'_>) -> bool { let Some((version, stamp_file)) = get_rustfmt_version(build) else {return false;}; !program_out_of_date(&stamp_file, &version) } /// Updates the last rustfmt version used fn update_rustfmt_version(build: &Builder<'_>) { let Some((version, stamp_file)) = get_rustfmt_version(build) else {return;}; t!(std::fs::write(stamp_file, version)) } /// Returns the files modified between the `merge-base` of HEAD and /// rust-lang/master and what is now on the disk. /// /// Returns `None` if all files should be formatted. fn get_modified_files(build: &Builder<'_>) -> Option<Vec<String>> { let Ok(remote) = get_rust_lang_rust_remote() else {return None;}; if !verify_rustfmt_version(build) { return None; } Some( output( build .config .git() .arg("diff-index") .arg("--name-only") .arg("--merge-base") .arg(&format!("{remote}/master")), ) .lines() .map(|s| s.trim().to_owned()) .collect(), ) } /// Finds the remote for rust-lang/rust. /// For example for these remotes it will return `upstream`. /// ```text /// origin  https://github.com/Nilstrieb/rust.git (fetch) /// origin  https://github.com/Nilstrieb/rust.git (push) /// upstream        https://github.com/rust-lang/rust (fetch) /// upstream        https://github.com/rust-lang/rust (push) /// ``` fn get_rust_lang_rust_remote() -> Result<String, String> { let mut git = Command::new("git"); git.args(["config", "--local", "--get-regex", "remote..*.url"]); let output = git.output().map_err(|err| format!("{err:?}"))?; if !output.status.success() { return Err("failed to execute git config command".to_owned()); } let stdout = String::from_utf8(output.stdout).map_err(|err| format!("{err:?}"))?; let rust_lang_remote = stdout .lines() .find(|remote| remote.contains("rust-lang")) .ok_or_else(|| "rust-lang/rust remote not found".to_owned())?; let remote_name = rust_lang_remote.split('.').nth(1).ok_or_else(|| "remote name not found".to_owned())?; Ok(remote_name.into()) } </ins> #[derive(serde::Deserialize)] struct RustfmtConfig { ignore: Vec<String>,