|                            help: replace with the correct return type: `main::FnTest9` error[E0121]: the type placeholder `_` is not allowed within types on item signatures <del> --> $DIR/typeck_type_placeholder_item.rs:199:14 </del> <ins> --> $DIR/typeck_type_placeholder_item.rs:201:14 </ins> | LL |     type A = _; |              ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures <del> --> $DIR/typeck_type_placeholder_item.rs:201:14 </del> <ins> --> $DIR/typeck_type_placeholder_item.rs:203:14 </ins> | LL |     type B = _; |              ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures <del> --> $DIR/typeck_type_placeholder_item.rs:203:14 </del> <ins> --> $DIR/typeck_type_placeholder_item.rs:205:14 </ins> | LL |     const C: _; |              ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures <del> --> $DIR/typeck_type_placeholder_item.rs:206:14 </del> <ins> --> $DIR/typeck_type_placeholder_item.rs:208:14 </ins> | LL |     const D: _ = 42; |              ^


pub fn is_file(&self) -> bool { self.0.is_file() } /// Test whether this file type represents a symbolic link. <ins> /// The result is mutually exclusive to the results of /// [`is_dir`] and [`is_file`]; only zero or one of these /// tests may pass. </ins> /// /// The underlying [`Metadata`] struct needs to be retrieved /// with the [`fs::symlink_metadata`] function and not the


f.write_str(" ")?; if let Some(ref ty) = self.trait_ { <del> match self.polarity { ty::ImplPolarity::Positive | ty::ImplPolarity::Reservation => {} ty::ImplPolarity::Negative => write!(f, "!")?, </del> <ins> if self.is_negative_trait_impl() { write!(f, "!")?; </ins> } ty.print(cx).fmt(f)?; write!(f, " for ")?;


use rustc_hir::Node; use rustc_middle::dep_graph::DepContext; use rustc_middle::ty::print::with_no_trimmed_paths; <ins> use rustc_middle::ty::relate::{self, RelateResult, TypeRelation}; </ins> use rustc_middle::ty::{ self, error::TypeError, Binder, List, Region, Subst, Ty, TyCtxt, TypeFoldable, TypeSuperVisitable, TypeVisitable,


return; } <del> // FIXME(#99978) hide #[no_mangle] symbols for proc-macros </del> let is_windows = self.sess.target.is_like_windows; let path = tmpdir.join(if is_windows { "list.def" } else { "list" });


self.as_mut_vec().truncate(0); // verbatim paths need . and .. removed <del> } else if comps.prefix_verbatim() { </del> <ins> } else if comps.prefix_verbatim() && !path.inner.is_empty() { </ins> let mut buf: Vec<_> = comps.collect(); for c in path.components() { match c {


split_or_candidate |= self.simplify_candidate(candidate); } <del> if split_or_candidate { // At least one of the candidates has been split into subcandidates. // We need to change the candidate list to include those. let mut new_candidates = Vec::new(); </del> <ins> ensure_sufficient_stack(|| { if split_or_candidate { // At least one of the candidates has been split into subcandidates. // We need to change the candidate list to include those. let mut new_candidates = Vec::new(); </ins> <del> for candidate in candidates { candidate.visit_leaves(|leaf_candidate| new_candidates.push(leaf_candidate)); </del> <ins> for candidate in candidates { candidate.visit_leaves(|leaf_candidate| new_candidates.push(leaf_candidate)); } self.match_simplified_candidates( span, start_block, otherwise_block, &mut *new_candidates, fake_borrows, ); } else { self.match_simplified_candidates( span, start_block, otherwise_block, candidates, fake_borrows, ); </ins> } <del> self.match_simplified_candidates( span, start_block, otherwise_block, &mut *new_candidates, fake_borrows, ); } else { self.match_simplified_candidates( span, start_block, otherwise_block, candidates, fake_borrows, ); }; </del> <ins> }); </ins> } fn match_simplified_candidates(


} } #[stable(feature = "rust1", since = "1.0.0")] <del> impl Seek for File { </del> <ins> impl Seek for &File { </ins> fn seek(&mut self, pos: SeekFrom) -> io::Result<u64> { self.inner.seek(pos) } } #[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> { <del> self.inner.read(buf) </del> <ins> (&*self).read(buf) } fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> { (&*self).read_vectored(bufs) </ins> } fn read_buf(&mut self, cursor: BorrowedCursor<'_>) -> io::Result<()> { <del> self.inner.read_buf(cursor) </del> <ins> (&*self).read_buf(cursor) } #[inline] fn is_read_vectored(&self) -> bool { (&&*self).is_read_vectored() } fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> { (&*self).read_to_end(buf) } fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> { (&*self).read_to_string(buf) } } #[stable(feature = "rust1", since = "1.0.0")] impl Write for File { fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (&*self).write(buf) } fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> io::Result<usize> { (&*self).write_vectored(bufs) } #[inline] fn is_write_vectored(&self) -> bool { (&&*self).is_write_vectored() } fn flush(&mut self) -> io::Result<()> { (&*self).flush() } } #[stable(feature = "rust1", since = "1.0.0")] impl Seek for File { fn seek(&mut self, pos: SeekFrom) -> io::Result<u64> { (&*self).seek(pos) </ins> } <ins> } #[stable(feature = "io_traits_arc", since = "CURRENT_RUSTC_VERSION")] impl Read for Arc<File> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { (&**self).read(buf) } </ins> fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> { <del> self.inner.read_vectored(bufs) </del> <ins> (&**self).read_vectored(bufs) } fn read_buf(&mut self, cursor: BorrowedCursor<'_>) -> io::Result<()> { (&**self).read_buf(cursor) </ins> } #[inline] fn is_read_vectored(&self) -> bool { <del> self.inner.is_read_vectored() </del> <ins> (&**self).is_read_vectored() </ins> } <del> // Reserves space in the buffer based on the file size when available. </del> fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> { <del> let size = buffer_capacity_required(self); buf.reserve(size.unwrap_or(0)); io::default_read_to_end(self, buf, size) </del> <ins> (&**self).read_to_end(buf) </ins> } <del> // Reserves space in the buffer based on the file size when available. </del> fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> { <del> let size = buffer_capacity_required(self); buf.reserve(size.unwrap_or(0)); io::default_read_to_string(self, buf, size) </del> <ins> (&**self).read_to_string(buf) </ins> } } <del> #[stable(feature = "rust1", since = "1.0.0")] impl Write for &File { </del> <ins> #[stable(feature = "io_traits_arc", since = "CURRENT_RUSTC_VERSION")] impl Write for Arc<File> { </ins> fn write(&mut self, buf: &[u8]) -> io::Result<usize> { <del> self.inner.write(buf) </del> <ins> (&**self).write(buf) </ins> } fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> io::Result<usize> { <del> self.inner.write_vectored(bufs) </del> <ins> (&**self).write_vectored(bufs) </ins> } #[inline] fn is_write_vectored(&self) -> bool { <del> self.inner.is_write_vectored() </del> <ins> (&**self).is_write_vectored() </ins> } fn flush(&mut self) -> io::Result<()> { <del> self.inner.flush() </del> <ins> (&**self).flush() </ins> } } <del> #[stable(feature = "rust1", since = "1.0.0")] impl Seek for &File { </del> <ins> #[stable(feature = "io_traits_arc", since = "CURRENT_RUSTC_VERSION")] impl Seek for Arc<File> { </ins> fn seek(&mut self, pos: SeekFrom) -> io::Result<u64> { <del> self.inner.seek(pos) </del> <ins> (&**self).seek(pos) </ins> } }


const D: _ = 42; //~^ ERROR the type placeholder `_` is not allowed within types on item signatures // type E: _; // FIXME: make the parser propagate the existence of `B` <ins> type F: std::ops::Fn(_); //~^ ERROR the type placeholder `_` is not allowed within types on item signatures </ins> } impl Qux for Struct { type A = _;


target } <ins> const MAX_INT_REGS: usize = 6; // RDI, RSI, RDX, RCX, R8, R9 const MAX_SSE_REGS: usize = 8; // XMM0-7 </ins> pub fn compute_abi_info<'a, Ty, C>(cx: &C, fty: &mut FnType<'a, Ty>) where Ty: TyLayoutMethods<'a, C> + Copy, C: LayoutOf<Ty = Ty, TyLayout = TyLayout<'a, Ty>> + HasDataLayout { <del> let mut int_regs = 6; // RDI, RSI, RDX, RCX, R8, R9 let mut sse_regs = 8; // XMM0-7 </del> <ins> let mut int_regs = MAX_INT_REGS; let mut sse_regs = MAX_SSE_REGS; </ins> let mut x86_64_ty = |arg: &mut ArgType<'a, Ty>, is_arg: bool| { let mut cls_or_mem = classify_arg(cx, arg); <del> let mut needed_int = 0; let mut needed_sse = 0; </del> if is_arg { if let Ok(cls) = cls_or_mem { <ins> let mut needed_int = 0; let mut needed_sse = 0; </ins> for &c in &cls { match c { Some(Class::Int) => needed_int += 1,


err.help("the semantics of slice patterns changed recently; see issue #62254"); } else if self.autoderef(span, expected_ty) .any(|(ty, _)| matches!(ty.kind(), ty::Slice(..) | ty::Array(..))) <del> && let (Some(span), true) = (ti.span, ti.origin_expr) </del> <ins> && let Some(span) = ti.span && let Some(_) = ti.origin_expr </ins> && let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(span) { let ty = self.resolve_vars_if_possible(ti.expected);


use rustc_hir::intravisit::{self, Visitor}; use rustc_hir::Node; use rustc_middle::bug; <del> use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags; </del> <ins> use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs}; </ins> use rustc_middle::middle::privacy::{self, Level}; use rustc_middle::mir::interpret::{ConstAllocation, ErrorHandled, GlobalAlloc}; use rustc_middle::query::Providers;


} } <del> #[cfg(any(target_arch = "x86_64", target_arch = "arm"))] </del> <ins> #[cfg(not(target_arch = "x86"))] </ins> #[macro_use] mod imp { pub type ptr_t = u32;


/// } /// ``` #[stable(feature = "rust1", since = "1.0.0")] <ins> #[inline] </ins> pub fn raw_os_error(&self) -> Option<i32> { match self.repr { Repr::Os(i) => Some(i),


<ins> // revisions: current next //[next] compile-flags: -Znext-solver // check-pass #![feature(non_lifetime_binders)] //~^ WARN the feature `non_lifetime_binders` is incomplete pub trait Foo<T: ?Sized> { type Bar<K: ?Sized>: ?Sized; } impl Foo<usize> for () { type Bar<K: ?Sized> = K; } pub fn f<T1, T2>(a: T1, b: T2) where T1: for<T> Foo<usize, Bar<T> = T>, T2: for<T> Foo<usize, Bar<T> = <T1 as Foo<usize>>::Bar<T>>, { } fn it_works() { f((), ()); } fn main() {} </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. // aux-build:plugin.rs #![feature(proc_macro)] #[macro_use] extern crate plugin; #[derive(Foo, Bar)] struct Baz { a: i32, b: i32, } fn main() {} </ins>


/// "successfully written" (by returning nonzero success values from /// `write`), any 0-length writes from `inner` must be reported as i/o /// errors from this method. <del> pub(super) fn flush_buf(&mut self) -> io::Result<()> { </del> <ins> pub(in crate::io) fn flush_buf(&mut self) -> io::Result<()> { </ins> /// Helper struct to ensure the buffer is updated after all the writes /// are complete. It tracks the number of written bytes and drains them /// all from the front of the buffer when dropped.


} let size = ret.layout.size; let bits = size.bits(); <del> if bits <= 128 { </del> <ins> if bits <= 256 { </ins> let unit = if bits <= 8 { Reg::i8() } else if bits <= 16 {


<ins> error: missing `in` in `for` loop --> $DIR/issue-40782.rs:12:10 | 12 |     for i 0..2 { |          ^ help: try adding `in` here error: aborting due to previous error </ins>


if !types.is_empty() { write!(w, "
Associated Types

 Associated Types

 ")?; for t in &types {


|| found_assoc(tcx.types.u64) || found_assoc(tcx.types.u128) || found_assoc(tcx.types.f32) <del> || found_assoc(tcx.types.f32); </del> <ins> || found_assoc(tcx.types.f64); </ins> if found_candidate && actual.is_numeric() && !actual.has_concrete_skeleton()


if v.is_ascii() { bytes.push(cx.expr_u8(expr.span, v as u8)); } else { <del> cx.span_err(expr.span, "non-ascii char literal in bytes!") </del> <ins> cx.span_err(expr.span, "non-ascii char literal in bytes!"); err = true; </ins> } } <del> _ => cx.span_err(expr.span, "unsupported literal in bytes!") </del> <ins> _ => { cx.span_err(expr.span, "unsupported literal in bytes!"); err = true; } </ins> }, <del> _ => cx.span_err(expr.span, "non-literal in bytes!") </del> <ins> _ => { cx.span_err(expr.span, "non-literal in bytes!"); err = true; } </ins> } } <ins> // For some reason using quote_expr!() here aborts if we threw an error. // I'm assuming that the end of the recursive parse tricks the compiler // into thinking this is a good time to stop. But we'd rather keep going. if err { // Since the compiler will stop after the macro expansion phase anyway, we // don't need type info, so we can just return a DummyResult return DummyResult::expr(sp); } </ins> let e = cx.expr_vec_slice(sp, bytes); <ins> let e = quote_expr!(cx, { static BYTES: &'static [u8] = $e; BYTES}); </ins> MacExpr::new(e) }


let fs = fields.move_map(|f| { Spanned { span: folder.new_span(f.span), node: ast::FieldPat { <del> ident: f.node.ident, </del> <ins> ident: folder.fold_ident(f.node.ident), </ins> pat: folder.fold_pat(f.node.pat), is_shorthand: f.node.is_shorthand, }}


<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. // aux-build:import_crate_var.rs // error-pattern: `$crate` may not be imported // error-pattern: `use $crate;` was erroneously allowed and will become a hard error #![feature(rustc_attrs)] #[macro_use] extern crate import_crate_var; m!(); #[rustc_error] fn main() {} </ins>


self.points.contains(row, index) } <ins> /// Returns an iterator of all the elements contained by the region `r` crate fn get_elements(&self, row: N) -> impl Iterator<Item = Location> + '_ { self.points .row(row) .into_iter() .flat_map(|set| set.iter()) .take_while(move |&p| self.elements.point_in_range(p)) .map(move |p| self.elements.to_location(p)) } </ins> /// Returns a "pretty" string value of the region. Meant for debugging. crate fn region_value_str(&self, r: N) -> String { <del> region_value_str( self.points .row(r) .into_iter() .flat_map(|set| set.iter()) .take_while(|&p| self.elements.point_in_range(p)) .map(|p| self.elements.to_location(p)) .map(RegionElement::Location), ) </del> <ins> region_value_str(self.get_elements(r).map(RegionElement::Location)) </ins> } }


/// (e.g. `min`, `minimum`, `max`, `maximum`); other aspects of their semantics and which IEEE 754 /// operation they correspond to are documented with the respective functions. /// <del> /// When a floating-point operation is executed in `const` context, the same rules apply: no /// guarantee is made about which of the NaN bit patterns described above will be returned. The /// result does not have to match what happens when executing the same code at runtime, and the /// result can vary depending on factors such as compiler version and flags. </del> <ins> /// When an arithmetic floating-point operation is executed in `const` context, the same rules /// apply: no guarantee is made about which of the NaN bit patterns described above will be /// returned. The result does not have to match what happens when executing the same code at /// runtime, and the result can vary depending on factors such as compiler version and flags. </ins> /// /// ### Target-specific "extra" NaN values // FIXME: Is there a better place to put this?


use clean::Variant::*; match variant { CLike(disr) => Variant::Plain(disr.map(|disr| disr.into_tcx(tcx))), <del> Tuple(fields) => Variant::Tuple( fields .into_iter() .filter_map(|f| match *f.kind { clean::StructFieldItem(ty) => Some(ty.into_tcx(tcx)), clean::StrippedItem(_) => None, _ => unreachable!(), }) .collect(), ), Struct(s) => Variant::Struct(ids(s.fields, tcx)), </del> <ins> Tuple(fields) => Variant::Tuple(ids_keeping_stripped(fields, tcx)), Struct(s) => Variant::Struct { fields_stripped: s.has_stripped_entries(), fields: ids(s.fields, tcx), }, </ins> } } }


self.check_export_name(hir_id, &attr, span, target) } else if self.tcx.sess.check_name(attr, sym::rustc_args_required_const) { self.check_rustc_args_required_const(&attr, span, target, item) <ins> } else if self.tcx.sess.check_name(attr, sym::rustc_layout_scalar_valid_range_start) { self.check_rustc_layout_scalar_valid_range(&attr, span, target) } else if self.tcx.sess.check_name(attr, sym::rustc_layout_scalar_valid_range_end) { self.check_rustc_layout_scalar_valid_range(&attr, span, target) </ins> } else if self.tcx.sess.check_name(attr, sym::allow_internal_unstable) { self.check_allow_internal_unstable(hir_id, &attr, span, target, &attrs) } else if self.tcx.sess.check_name(attr, sym::rustc_allow_const_fn_unstable) {


/// Returns a map from a sufficiently visible external item (i.e. an external item that is /// visible from at least one local module) to a sufficiently visible parent (considering /// modules that re-export the external item to be parents). <del> fn visible_parent_map<'a>(&'a self) -> ::std::cell::RefMut<'a, DefIdMap<DefId>> { let mut visible_parent_map = self.visible_parent_map.borrow_mut(); if !visible_parent_map.is_empty() { return visible_parent_map; } </del> <ins> fn visible_parent_map<'a>(&'a self) -> ::std::cell::Ref<'a, DefIdMap<DefId>> { { let visible_parent_map = self.visible_parent_map.borrow(); if !visible_parent_map.is_empty() { return visible_parent_map; } } </ins> use std::collections::vec_deque::VecDeque; use std::collections::hash_map::Entry; <ins> let mut visible_parent_map = self.visible_parent_map.borrow_mut(); </ins> for cnum in (1 .. self.next_crate_num().as_usize()).map(CrateNum::new) { let cdata = self.get_crate_data(cnum);


without modifying the original"] #[stable(feature = "unicode_case_mapping", since = "1.2.0")] pub fn to_lowercase(&self) -> String { <del> let out = convert_while_ascii(self.as_bytes(), u8::to_ascii_lowercase); </del> <ins> let (mut s, rest) = convert_while_ascii(self, u8::to_ascii_lowercase); </ins> <del> // Safety: we know this is a valid char boundary since // out.len() is only progressed if ascii bytes are found let rest = unsafe { self.get_unchecked(out.len()..) }; // Safety: We have written only valid ASCII to our vec let mut s = unsafe { String::from_utf8_unchecked(out) }; </del> <ins> let prefix_len = s.len(); </ins> for (i, c) in rest.char_indices() { if c == 'Σ' {


#[rustc_doc_primitive = "f16"] #[doc(alias = "half")] <del> /// A 16-bit floating point type (specifically, the "binary16" type defined in IEEE 754-2008). </del> <ins> /// A 16-bit floating-point type (specifically, the "binary16" type defined in IEEE 754-2008). </ins> /// /// This type is very similar to [`prim@f32`] but has decreased precision because it uses half as many /// bits. Please see [the documentation for `f32`](prim@f32) or [Wikipedia on half-precision


<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. fn f(x: &mut u32) {} fn main() { let x = Box::new(3); f(&mut *x); } </ins>


node_to_hir_id: self.node_to_hir_id.clone(), macro_def_scopes: self.macro_def_scopes.clone(), expansions: self.expansions.clone(), <del> keys_created: self.keys_created.clone(), </del> <ins> next_disambiguator: self.next_disambiguator.clone(), </ins> } } }


} if self.index < self.len { self.len -= 1; <ins> self.a_len -= 1; </ins> let i = self.len; // SAFETY: `i` is smaller than the previous value of `self.len`, // which is also smaller than or equal to `self.a.len()` and `self.b.len()`


<ins> error: this file contains an un-closed delimiter --> $DIR/issue-63135.rs:3:16 | LL | fn i(n{...,f # |     - -        ^ |     | | |     | un-closed delimiter |     un-closed delimiter error: expected field pattern, found `...` --> $DIR/issue-63135.rs:3:8 | LL | fn i(n{...,f # |        ^^^ help: to omit remaining fields, use one fewer `.`: `..` error: expected `}`, found `,` --> $DIR/issue-63135.rs:3:11 | LL | fn i(n{...,f # |        ---^ |        |  | |        |  expected `}` |        `..` must be at the end and cannot have a trailing comma error: expected `[`, found `}` --> $DIR/issue-63135.rs:3:15 | LL | fn i(n{...,f # |               ^ expected `[` error: expected `:`, found `)` --> $DIR/issue-63135.rs:3:15 | LL | fn i(n{...,f # |               ^ expected `:` error: expected one of `->`, `where`, or `{`, found `<eof>` --> $DIR/issue-63135.rs:3:15 | LL | fn i(n{...,f # |               ^ expected one of `->`, `where`, or `{` here error: aborting due to 6 previous errors </ins>


<ins> PRINT-BANG INPUT (DISPLAY): ; PRINT-BANG INPUT (DEBUG): TokenStream [ Group { delimiter: None, stream: TokenStream [ Punct { ch: ';', spacing: Alone, span: $DIR/issue-80760-empty-stmt.rs:25:17: 25:18 (#0), }, ], span: $DIR/issue-80760-empty-stmt.rs:13:21: 13:23 (#4), }, ] </ins>


<ins> #![crate_type="lib"] #[repr(i8)] pub enum Type { Type1 = 0, Type2 = 1 } // CHECK: define signext i8 @test() #[no_mangle] pub extern "C" fn test() -> Type { Type::Type1 } </ins>


rc::Rc, }; <ins> require std::time::Duration; //~^ ERROR expected item, found `require` include std::time::Instant; //~^ ERROR expected item, found `include` </ins> pub using 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> }


<ins> error[E0594]: cannot assign to `self.foo`, which is behind a `&` reference --> $DIR/issue-93093.rs:8:9 | LL |     async fn bar(&self) { |                  ----- help: consider changing this to be a mutable reference: `&mut self` LL | LL |         self.foo += 1; |         ^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be written error: aborting due to previous error For more information about this error, try `rustc --explain E0594`. </ins>


t!(read_byte(file)); // compensate for padding } <del> let numbers_map: HashMap<String, u16> = t! { (0..numbers_count).filter_map(|i| match read_le_u16(file) { Ok(0xFFFF) => None, Ok(n) => Some(Ok((nnames[i].to_string(), n))), Err(e) => Some(Err(e)) </del> <ins> let numbers_map: HashMap<String, u32> = t! { (0..numbers_count).filter_map(|i| { let number = if extended { read_le_u32(file) } else { read_le_u16(file).map(Into::into) }; match number { Ok(0xFFFF) => None, Ok(n) => Some(Ok((nnames[i].to_string(), n))), Err(e) => Some(Err(e)) } </ins> }).collect() };


<ins> use crate::mir::interpret::Scalar; use crate::ty::{self, Ty, TyCtxt}; use rustc_ast::ast::{InlineAsmOptions, InlineAsmTemplatePiece}; use super::{ AssertMessage, BasicBlock, InlineAsmOperand, Operand, Place, SourceInfo, Successors, SuccessorsMut, }; pub use rustc_ast::ast::Mutability; use rustc_macros::HashStable; use rustc_span::Span; use std::borrow::Cow; use std::fmt::{self, Debug, Formatter, Write}; use std::iter; use std::slice; pub use super::query::*; #[derive(Clone, RustcEncodable, RustcDecodable, HashStable, PartialEq)] pub enum TerminatorKind<'tcx> { /// Block should have one successor in the graph; we jump there. Goto { target: BasicBlock }, /// Operand evaluates to an integer; jump depending on its value /// to one of the targets, and otherwise fallback to `otherwise`. SwitchInt { /// The discriminant value being tested. discr: Operand<'tcx>, /// The type of value being tested. /// This is always the same as the type of `discr`. /// FIXME: remove this redundant information. Currently, it is relied on by pretty-printing. switch_ty: Ty<'tcx>, /// Possible values. The locations to branch to in each case /// are found in the corresponding indices from the `targets` vector. values: Cow<'tcx, [u128]>, /// Possible branch sites. The last element of this vector is used /// for the otherwise branch, so targets.len() == values.len() + 1 /// should hold. // // This invariant is quite non-obvious and also could be improved. // One way to make this invariant is to have something like this instead: // // branches: Vec<(ConstInt, BasicBlock)>, // otherwise: Option<BasicBlock> // exhaustive if None // // However we’ve decided to keep this as-is until we figure a case // where some other approach seems to be strictly better than other. targets: Vec<BasicBlock>, }, /// Indicates that the landing pad is finished and unwinding should /// continue. Emitted by `build::scope::diverge_cleanup`. Resume, /// Indicates that the landing pad is finished and that the process /// should abort. Used to prevent unwinding for foreign items. Abort, /// Indicates a normal return. The return place should have /// been filled in before this executes. This can occur multiple times /// in different basic blocks. Return, /// Indicates a terminator that can never be reached. Unreachable, /// Drop the `Place`. Drop { place: Place<'tcx>, target: BasicBlock, unwind: Option<BasicBlock> }, /// Drop the `Place` and assign the new value over it. This ensures /// that the assignment to `P` occurs *even if* the destructor for /// place unwinds. Its semantics are best explained by the /// elaboration: /// /// ``` /// BB0 { ///   DropAndReplace(P <- V, goto BB1, unwind BB2) /// } /// ``` /// /// becomes /// /// ``` /// BB0 { ///   Drop(P, goto BB1, unwind BB2) /// } /// BB1 { ///   // P is now uninitialized ///   P <- V /// } /// BB2 { ///   // P is now uninitialized -- its dtor panicked ///   P <- V /// } /// ``` DropAndReplace { place: Place<'tcx>, value: Operand<'tcx>, target: BasicBlock, unwind: Option<BasicBlock>, }, /// Block ends with a call of a converging function. Call { /// The function that’s being called. func: Operand<'tcx>, /// Arguments the function is called with. /// These are owned by the callee, which is free to modify them. /// This allows the memory occupied by "by-value" arguments to be /// reused across function calls without duplicating the contents. args: Vec<Operand<'tcx>>, /// Destination for the return value. If some, the call is converging. destination: Option<(Place<'tcx>, BasicBlock)>, /// Cleanups to be done if the call unwinds. cleanup: Option<BasicBlock>, /// `true` if this is from a call in HIR rather than from an overloaded /// operator. True for overloaded function call. from_hir_call: bool, /// This `Span` is the span of the function, without the dot and receiver /// (e.g. `foo(a, b)` in `x.foo(a, b)` fn_span: Span, }, /// Jump to the target if the condition has the expected value, /// otherwise panic with a message and a cleanup target. Assert { cond: Operand<'tcx>, expected: bool, msg: AssertMessage<'tcx>, target: BasicBlock, cleanup: Option<BasicBlock>, }, /// A suspend point. Yield { /// The value to return. value: Operand<'tcx>, /// Where to resume to. resume: BasicBlock, /// The place to store the resume argument in. resume_arg: Place<'tcx>, /// Cleanup to be done if the generator is dropped at this suspend point. drop: Option<BasicBlock>, }, /// Indicates the end of the dropping of a generator. GeneratorDrop, /// A block where control flow only ever takes one real path, but borrowck /// needs to be more conservative. FalseEdge { /// The target normal control flow will take. real_target: BasicBlock, /// A block control flow could conceptually jump to, but won't in /// practice. imaginary_target: BasicBlock, }, /// A terminator for blocks that only take one path in reality, but where we /// reserve the right to unwind in borrowck, even if it won't happen in practice. /// This can arise in infinite loops with no function calls for example. FalseUnwind { /// The target normal control flow will take. real_target: BasicBlock, /// The imaginary cleanup block link. This particular path will never be taken /// in practice, but in order to avoid fragility we want to always /// consider it in borrowck. We don't want to accept programs which /// pass borrowck only when `panic=abort` or some assertions are disabled /// due to release vs. debug mode builds. This needs to be an `Option` because /// of the `remove_noop_landing_pads` and `no_landing_pads` passes. unwind: Option<BasicBlock>, }, /// Block ends with an inline assembly block. This is a terminator since /// inline assembly is allowed to diverge. InlineAsm { /// The template for the inline assembly, with placeholders. template: &'tcx [InlineAsmTemplatePiece], /// The operands for the inline assembly, as `Operand`s or `Place`s. operands: Vec<InlineAsmOperand<'tcx>>, /// Miscellaneous options for the inline assembly. options: InlineAsmOptions, /// Source spans for each line of the inline assembly code. These are /// used to map assembler errors back to the line in the source code. line_spans: &'tcx [Span], /// Destination block after the inline assembly returns, unless it is /// diverging (InlineAsmOptions::NORETURN). destination: Option<BasicBlock>, }, } #[derive(Clone, Debug, RustcEncodable, RustcDecodable, HashStable)] pub struct Terminator<'tcx> { pub source_info: SourceInfo, pub kind: TerminatorKind<'tcx>, } impl<'tcx> Terminator<'tcx> { pub fn successors(&self) -> Successors<'_> { self.kind.successors() } pub fn successors_mut(&mut self) -> SuccessorsMut<'_> { self.kind.successors_mut() } pub fn unwind(&self) -> Option<&Option<BasicBlock>> { self.kind.unwind() } pub fn unwind_mut(&mut self) -> Option<&mut Option<BasicBlock>> { self.kind.unwind_mut() } } impl<'tcx> TerminatorKind<'tcx> { pub fn if_( tcx: TyCtxt<'tcx>, cond: Operand<'tcx>, t: BasicBlock, f: BasicBlock, ) -> TerminatorKind<'tcx> { static BOOL_SWITCH_FALSE: &[u128] = &[0]; TerminatorKind::SwitchInt { discr: cond, switch_ty: tcx.types.bool, values: From::from(BOOL_SWITCH_FALSE), targets: vec![f, t], } } pub fn successors(&self) -> Successors<'_> { use self::TerminatorKind::*; match *self { Resume | Abort | GeneratorDrop | Return | Unreachable | Call { destination: None, cleanup: None, .. } | InlineAsm { destination: None, .. } => None.into_iter().chain(&[]), Goto { target: ref t } | Call { destination: None, cleanup: Some(ref t), .. } | Call { destination: Some((_, ref t)), cleanup: None, .. } | Yield { resume: ref t, drop: None, .. } | DropAndReplace { target: ref t, unwind: None, .. } | Drop { target: ref t, unwind: None, .. } | Assert { target: ref t, cleanup: None, .. } | FalseUnwind { real_target: ref t, unwind: None } | InlineAsm { destination: Some(ref t), .. } => Some(t).into_iter().chain(&[]), Call { destination: Some((_, ref t)), cleanup: Some(ref u), .. } | Yield { resume: ref t, drop: Some(ref u), .. } | DropAndReplace { target: ref t, unwind: Some(ref u), .. } | Drop { target: ref t, unwind: Some(ref u), .. } | Assert { target: ref t, cleanup: Some(ref u), .. } | FalseUnwind { real_target: ref t, unwind: Some(ref u) } => { Some(t).into_iter().chain(slice::from_ref(u)) } SwitchInt { ref targets, .. } => None.into_iter().chain(&targets[..]), FalseEdge { ref real_target, ref imaginary_target } => { Some(real_target).into_iter().chain(slice::from_ref(imaginary_target)) } } } pub fn successors_mut(&mut self) -> SuccessorsMut<'_> { use self::TerminatorKind::*; match *self { Resume | Abort | GeneratorDrop | Return | Unreachable | Call { destination: None, cleanup: None, .. } | InlineAsm { destination: None, .. } => None.into_iter().chain(&mut []), Goto { target: ref mut t } | Call { destination: None, cleanup: Some(ref mut t), .. } | Call { destination: Some((_, ref mut t)), cleanup: None, .. } | Yield { resume: ref mut t, drop: None, .. } | DropAndReplace { target: ref mut t, unwind: None, .. } | Drop { target: ref mut t, unwind: None, .. } | Assert { target: ref mut t, cleanup: None, .. } | FalseUnwind { real_target: ref mut t, unwind: None } | InlineAsm { destination: Some(ref mut t), .. } => Some(t).into_iter().chain(&mut []), Call { destination: Some((_, ref mut t)), cleanup: Some(ref mut u), .. } | Yield { resume: ref mut t, drop: Some(ref mut u), .. } | DropAndReplace { target: ref mut t, unwind: Some(ref mut u), .. } | Drop { target: ref mut t, unwind: Some(ref mut u), .. } | Assert { target: ref mut t, cleanup: Some(ref mut u), .. } | FalseUnwind { real_target: ref mut t, unwind: Some(ref mut u) } => { Some(t).into_iter().chain(slice::from_mut(u)) } SwitchInt { ref mut targets, .. } => None.into_iter().chain(&mut targets[..]), FalseEdge { ref mut real_target, ref mut imaginary_target } => { Some(real_target).into_iter().chain(slice::from_mut(imaginary_target)) } } } pub fn unwind(&self) -> Option<&Option<BasicBlock>> { match *self { TerminatorKind::Goto { .. } | TerminatorKind::Resume | TerminatorKind::Abort | TerminatorKind::Return | TerminatorKind::Unreachable | TerminatorKind::GeneratorDrop | TerminatorKind::Yield { .. } | TerminatorKind::SwitchInt { .. } | TerminatorKind::FalseEdge { .. } | TerminatorKind::InlineAsm { .. } => None, TerminatorKind::Call { cleanup: ref unwind, .. } | TerminatorKind::Assert { cleanup: ref unwind, .. } | TerminatorKind::DropAndReplace { ref unwind, .. } | TerminatorKind::Drop { ref unwind, .. } | TerminatorKind::FalseUnwind { ref unwind, .. } => Some(unwind), } } pub fn unwind_mut(&mut self) -> Option<&mut Option<BasicBlock>> { match *self { TerminatorKind::Goto { .. } | TerminatorKind::Resume | TerminatorKind::Abort | TerminatorKind::Return | TerminatorKind::Unreachable | TerminatorKind::GeneratorDrop | TerminatorKind::Yield { .. } | TerminatorKind::SwitchInt { .. } | TerminatorKind::FalseEdge { .. } | TerminatorKind::InlineAsm { .. } => None, TerminatorKind::Call { cleanup: ref mut unwind, .. } | TerminatorKind::Assert { cleanup: ref mut unwind, .. } | TerminatorKind::DropAndReplace { ref mut unwind, .. } | TerminatorKind::Drop { ref mut unwind, .. } | TerminatorKind::FalseUnwind { ref mut unwind, .. } => Some(unwind), } } } 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![], } } } </ins>


//! //! * Should probably have something like this for strings. //! * Should they implement Closable? Would take extra state. <ins> use cmp::max; </ins> use cmp::min; use prelude::*; use super::*;


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


<del> use std::iter; </del> use either::Either; <ins> use hir::PatField; </ins> use rustc_data_structures::captures::Captures; use rustc_data_structures::fx::FxIndexSet; use rustc_errors::{


<ins> error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker1` --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:14:1 | LL | impl Marker1 for dyn Object + Marker2 { }   //~ ERROR E0371 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker1` error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker2` --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:16:1 | LL | impl Marker2 for dyn Object + Marker2 { }   //~ ERROR E0371 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker2` error[E0117]: only traits defined in the current crate can be implemented for arbitrary types --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:22:1 | LL | unsafe impl Send for dyn Marker2 {} //~ ERROR E0117 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate | = note: the impl does not reference only types defined in this crate = note: define and implement a trait or new type instead error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `(dyn Object + 'static)` --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:26:1 | LL | unsafe impl Send for dyn Object {} //~ ERROR E0321 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `(dyn Object + Marker2 + 'static)` --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:27:1 | LL | unsafe impl Send for dyn Object + Marker2 {} //~ ERROR E0321 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type error: aborting due to 5 previous errors Some errors occurred: E0117, E0321, E0371. For more information about an error, try `rustc --explain E0117`. </ins>


E0696, // `continue` pointing to a labeled block //  E0702, // replaced with a generic attribute input check E0703, // invalid ABI <del> E0706, // `async fn` in trait </del> //  E0707, // multiple elided lifetimes used in arguments of `async fn` E0708, // `async` non-`move` closures with parameters are not currently // supported


stride * field } layout::FieldPlacement::Union(count) => { <ins> // This is a narrow bug-fix for rust-lang/rust#69191: if we are // trying to access absent field of uninhabited variant, then // signal UB (but don't ICE the compiler). // FIXME temporary hack to work around incoherence between // layout computation and MIR building if field >= count as u64 && base.layout.abi == layout::Abi::Uninhabited { throw_ub!(Unreachable); } </ins> assert!( field < count as u64, "Tried to access field {} of union {:#?} with {} fields",


//! [`Iterator`]: trait.Iterator.html //! [`next`]: trait.Iterator.html#tymethod.next //! [`Option`]: ../../std/option/enum.Option.html <ins> //! [`TryIter`]: ../../std/sync/mpsc/struct.TryIter.html </ins> //! //! # The three forms of iteration //!


<ins> error[E0229]: associated type bindings are not allowed here --> $DIR/issue-102335-const.rs:4:17 | LL |     type A: S<C<X = 0i32> = 34>; |                 ^^^^^^^^ associated type not allowed here error: aborting due to previous error For more information about this error, try `rustc --explain E0229`. </ins>


If you’d like to dive into this topic in greater detail, [this paper][wilson] is a great introduction. <del> [wilson]: http://www.cs.northwestern.edu/~pdinda/icsclass/doc/dsa.pdf </del> <ins> [wilson]: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.143.4688 </ins> ## Semantic impact


<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. // error-pattern:bad input fn main() { Some("foo").unwrap_or(fail!("bad input")).to_string(); } </ins>


} #[test] <del> #[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)] </del> <ins> #[cfg_attr(any(target_os = "vxworks"), ignore)] </ins> fn test_process_output_output() { let Output { status, stdout, stderr } = if cfg!(target_os = "windows") { Command::new("cmd").args(&["/C", "echo hello"]).output().unwrap() } else { <del> Command::new("echo").arg("hello").output().unwrap() </del> <ins> shell_cmd().arg("-c").arg("echo hello").output().unwrap() </ins> }; let output_str = str::from_utf8(&stdout).unwrap();


<ins> #![feature(prelude_import)] #![no_std] // This test certify that we can mix attribute macros from Rust and external proc-macros. // For instance, `#[derive(Default)]` uses `#[default]` and `#[derive(SmartPointer)]` uses // `#[pointee]`. // The scoping rule should allow the use of the said two attributes when external proc-macros // are in scope. //@ check-pass //@ aux-build: another-proc-macro.rs //@ compile-flags: -Zunpretty=expanded #![feature(derive_smart_pointer)] #[prelude_import] use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; #[macro_use] extern crate another_proc_macro; const _: () = { const POINTEE_MACRO_ATTR_DERIVED: () = (); }; const _: () = { const DEFAULT_MACRO_ATTR_DERIVED: () = (); }; </ins>


} fn write_u16s(handle: c::HANDLE, data: &[u16]) -> io::Result<usize> { <ins> debug_assert!(data.len() < u32::MAX as usize); </ins> let mut written = 0; cvt(unsafe { c::WriteConsoleW(


/// [`slice_from_raw_parts`]: fn.slice_from_raw_parts.html /// [`from_raw_parts_mut`]: ../../std/slice/fn.from_raw_parts_mut.html #[inline] <del> #[unstable(feature = "slice_from_raw_parts", reason = "recently added", issue = "36925")] </del> <ins> #[stable(feature = "slice_from_raw_parts", since = "1.42.0")] </ins> #[rustc_const_unstable(feature = "const_slice_from_raw_parts", issue = "67456")] pub const fn slice_from_raw_parts_mut<T>(data: *mut T, len: usize) -> *mut [T] { unsafe { Repr { raw: FatPtr { data, len } }.rust_mut }


<del> error: expected expression, found reserved keyword `try` --> $DIR/try-block-in-match.rs:6:11 | LL |     match try { false } { _ => {} } |     ----- ^^^ expected expression |     | |     while parsing this match expression error: aborting due to previous error </del>


} #[test] <del> #[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)] </del> <ins> #[cfg_attr(any(target_os = "vxworks"), ignore)] </ins> fn stdout_works() { if cfg!(target_os = "windows") { let mut cmd = Command::new("cmd"); cmd.args(&["/C", "echo foobar"]).stdout(Stdio::piped()); assert_eq!(run_output(cmd), "foobarrn"); } else { <del> let mut cmd = Command::new("echo"); cmd.arg("foobar").stdout(Stdio::piped()); </del> <ins> let mut cmd = shell_cmd(); cmd.arg("-c").arg("echo foobar").stdout(Stdio::piped()); </ins> assert_eq!(run_output(cmd), "foobarn"); } } #[test] <del> #[cfg_attr(any(windows, target_os = "android", target_os = "vxworks"), ignore)] </del> <ins> #[cfg_attr(any(windows, target_os = "vxworks"), ignore)] </ins> fn set_current_dir_works() { <del> let mut cmd = Command::new("/bin/sh"); </del> <ins> let mut cmd = shell_cmd(); </ins> cmd.arg("-c").arg("pwd").current_dir("/").stdout(Stdio::piped()); assert_eq!(run_output(cmd), "/n"); } #[test] <del> #[cfg_attr(any(windows, target_os = "android", target_os = "vxworks"), ignore)] </del> <ins> #[cfg_attr(any(windows, target_os = "vxworks"), ignore)] </ins> fn stdin_works() { <del> let mut p = Command::new("/bin/sh") </del> <ins> let mut p = shell_cmd() </ins> .arg("-c") .arg("read line; echo $line") .stdin(Stdio::piped())


<ins> // Regression test for #81899. // The `panic!()` below is important to trigger the fixed ICE. const _CONST: &[u8] = &f(&[], |_| {}); const fn f<F>(_: &[u8], _: F) -> &[u8] where F: FnMut(&u8), { panic!() //~ ERROR: evaluation of constant value failed } fn main() {} </ins>


use rustc_middle::ty::{ self, fold::BottomUpFolder, print::TraitPredPrintModifiersAndPath, Ty, TypeFoldable, }; <del> use rustc_span::Span; </del> <ins> use rustc_span::{symbol::kw, Span}; </ins> use rustc_trait_selection::traits; use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt;


fn the(&self); } } <ins> #[cfg(any())] mod nonexistent_file; // Check that unconfigured non-inline modules are not loaded or parsed. </ins>


(&TestKind::Range { .. }, _) => None, (&TestKind::Eq { .. } | &TestKind::Len { .. }, _) => { <ins> // The call to `self.test(&match_pair)` below is not actually used to generate any // MIR. Instead, we just want to compare with `test` (the parameter of the method) // to see if it is the same. // // However, at this point we can still encounter or-patterns that were extracted // from previous calls to `sort_candidate`, so we need to manually address that // case to avoid panicking in `self.test()`. if let PatKind::Or { .. } = &*match_pair.pattern.kind { return None; } </ins> // These are all binary tests. // // FIXME(#29623) we can be more clever here


<ins> // Copyright 2014-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. //! Scoped thread-local storage //! //! This module provides the ability to generate *scoped* thread-local //! variables. In this sense, scoped indicates that thread local storage //! actually stores a reference to a value, and this reference is only placed //! in storage for a scoped amount of time. //! //! There are no restrictions on what types can be placed into a scoped //! variable, but all scoped variables are initialized to the equivalent of //! null. Scoped thread local storage is useful when a value is present for a known //! period of time and it is not required to relinquish ownership of the //! contents. //! //! # Examples //! //! ``` //! # #![feature(scoped_tls)] //! scoped_thread_local!(static FOO: u32); //! //! // Initially each scoped slot is empty. //! assert!(!FOO.is_set()); //! //! // When inserting a value, the value is only in place for the duration //! // of the closure specified. //! FOO.set(&1, || { //!     FOO.with(|slot| { //!         assert_eq!(*slot, 1); //!     }); //! }); //! ``` #![unstable(feature = "thread_local_internals")] use prelude::v1::*; // macro hygiene sure would be nice, wouldn't it? #[doc(hidden)] pub mod __impl { pub use super::imp::KeyInner; pub use sys_common::thread_local::INIT as OS_INIT; } /// Type representing a thread local storage key corresponding to a reference /// to the type parameter `T`. /// /// Keys are statically allocated and can contain a reference to an instance of /// type `T` scoped to a particular lifetime. Keys provides two methods, `set` /// and `with`, both of which currently use closures to control the scope of /// their contents. #[unstable(feature = "scoped_tls", reason = "scoped TLS has yet to have wide enough use to fully consider  stabilizing its interface")] pub struct ScopedKey<T> { #[doc(hidden)] pub inner: __impl::KeyInner<T> } /// Declare a new scoped thread local storage key. /// /// This macro declares a `static` item on which methods are used to get and /// set the value stored within. #[macro_export] #[allow_internal_unstable] macro_rules! scoped_thread_local { (static $name:ident: $t:ty) => ( __scoped_thread_local_inner!(static $name: $t); ); (pub static $name:ident: $t:ty) => ( __scoped_thread_local_inner!(pub static $name: $t); ); } #[macro_export] #[doc(hidden)] #[allow_internal_unstable] macro_rules! __scoped_thread_local_inner { (static $name:ident: $t:ty) => ( #[cfg_attr(not(any(windows, target_os = "android", target_os = "ios", target_os = "openbsd", target_arch = "aarch64")), thread_local)] static $name: ::std::thread::ScopedKey<$t> = __scoped_thread_local_inner!($t); ); (pub static $name:ident: $t:ty) => ( #[cfg_attr(not(any(windows, target_os = "android", target_os = "ios", target_os = "openbsd", target_arch = "aarch64")), thread_local)] pub static $name: ::std::thread::ScopedKey<$t> = __scoped_thread_local_inner!($t); ); ($t:ty) => ({ use std::thread::ScopedKey as __Key; #[cfg(not(any(windows, target_os = "android", target_os = "ios", target_os = "openbsd", target_arch = "aarch64")))] const _INIT: __Key<$t> = __Key { inner: ::std::thread::__scoped::KeyInner { inner: ::std::cell::UnsafeCell { value: 0 as *mut _ }, } }; #[cfg(any(windows, target_os = "android", target_os = "ios", target_os = "openbsd", target_arch = "aarch64"))] const _INIT: __Key<$t> = __Key { inner: ::std::thread::__scoped::KeyInner { inner: ::std::thread::__scoped::OS_INIT, marker: ::std::marker::PhantomData::<::std::cell::Cell<$t>>, } }; _INIT }) } #[unstable(feature = "scoped_tls", reason = "scoped TLS has yet to have wide enough use to fully consider  stabilizing its interface")] impl<T> ScopedKey<T> { /// Insert a value into this scoped thread local storage slot for a /// duration of a closure. /// /// While `cb` is running, the value `t` will be returned by `get` unless /// this function is called recursively inside of `cb`. /// /// Upon return, this function will restore the previous value, if any /// was available. /// /// # Examples /// /// ``` /// # #![feature(scoped_tls)] /// scoped_thread_local!(static FOO: u32); /// /// FOO.set(&100, || { ///     let val = FOO.with(|v| *v); ///     assert_eq!(val, 100); /// ///     // set can be called recursively ///     FOO.set(&101, || { ///         // ... ///     }); /// ///     // Recursive calls restore the previous value. ///     let val = FOO.with(|v| *v); ///     assert_eq!(val, 100); /// }); /// ``` pub fn set<R, F>(&'static self, t: &T, cb: F) -> R where F: FnOnce() -> R, { struct Reset<'a, T: 'a> { key: &'a __impl::KeyInner<T>, val: *mut T, } #[unsafe_destructor] impl<'a, T> Drop for Reset<'a, T> { fn drop(&mut self) { unsafe { self.key.set(self.val) } } } let prev = unsafe { let prev = self.inner.get(); self.inner.set(t as *const T as *mut T); prev }; let _reset = Reset { key: &self.inner, val: prev }; cb() } /// Get a value out of this scoped variable. /// /// This function takes a closure which receives the value of this /// variable. /// /// # Panics /// /// This function will panic if `set` has not previously been called. /// /// # Examples /// /// ```no_run /// # #![feature(scoped_tls)] /// scoped_thread_local!(static FOO: u32); /// /// FOO.with(|slot| { ///     // work with `slot` /// }); /// ``` pub fn with<R, F>(&'static self, cb: F) -> R where F: FnOnce(&T) -> R { unsafe { let ptr = self.inner.get(); assert!(!ptr.is_null(), "cannot access a scoped thread local  variable without calling `set` first"); cb(&*ptr) } } /// Test whether this TLS key has been `set` for the current thread. pub fn is_set(&'static self) -> bool { unsafe { !self.inner.get().is_null() } } } #[cfg(not(any(windows, target_os = "android", target_os = "ios", target_os = "openbsd", target_arch = "aarch64")))] mod imp { use std::cell::UnsafeCell; #[doc(hidden)] pub struct KeyInner<T> { pub inner: UnsafeCell<*mut T> } unsafe impl<T> ::marker::Sync for KeyInner<T> { } #[doc(hidden)] impl<T> KeyInner<T> { #[doc(hidden)] pub unsafe fn set(&self, ptr: *mut T) { *self.inner.get() = ptr; } #[doc(hidden)] pub unsafe fn get(&self) -> *mut T { *self.inner.get() } } } #[cfg(any(windows, target_os = "android", target_os = "ios", target_os = "openbsd", target_arch = "aarch64"))] mod imp { use marker; use std::cell::Cell; use sys_common::thread_local::StaticKey as OsStaticKey; #[doc(hidden)] pub struct KeyInner<T> { pub inner: OsStaticKey, pub marker: marker::PhantomData<Cell<T>>, } unsafe impl<T> ::marker::Sync for KeyInner<T> { } #[doc(hidden)] impl<T> KeyInner<T> { #[doc(hidden)] pub unsafe fn set(&self, ptr: *mut T) { self.inner.set(ptr as *mut _) } #[doc(hidden)] pub unsafe fn get(&self) -> *mut T { self.inner.get() as *mut _ } } } #[cfg(test)] mod tests { use cell::Cell; use prelude::v1::*; scoped_thread_local!(static FOO: u32); #[test] fn smoke() { scoped_thread_local!(static BAR: u32); assert!(!BAR.is_set()); BAR.set(&1, || { assert!(BAR.is_set()); BAR.with(|slot| { assert_eq!(*slot, 1); }); }); assert!(!BAR.is_set()); } #[test] fn cell_allowed() { scoped_thread_local!(static BAR: Cell<u32>); BAR.set(&Cell::new(1), || { BAR.with(|slot| { assert_eq!(slot.get(), 1); }); }); } #[test] fn scope_item_allowed() { assert!(!FOO.is_set()); FOO.set(&1, || { assert!(FOO.is_set()); FOO.with(|slot| { assert_eq!(*slot, 1); }); }); assert!(!FOO.is_set()); } } </ins>


<ins> error: this file contains an un-closed delimiter --> $DIR/issue-58094-missing-right-square-bracket.rs:4:4 | LL | #[Ѕ |  - ^ |  | |  un-closed delimiter error: expected item after attributes --> $DIR/issue-58094-missing-right-square-bracket.rs:4:4 | LL | #[Ѕ |    ^ error: aborting due to 2 previous errors </ins>


} } <ins> impl rustc_errors::IntoDiagnosticArg for PolyExistentialTraitRef<'_> { fn into_diagnostic_arg(self) -> rustc_errors::DiagnosticArgValue<'static> { self.to_string().into_diagnostic_arg() } } </ins> #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)] #[derive(HashStable)] pub enum BoundVariableKind {


} let sig = tcx.erase_late_bound_regions(sig); <del> if !sig.output().is_unit() { let r = self.check_type_for_ffi(cache, sig.output()); match r { FfiSafe => {} _ => { return r; } } } </del> for arg in sig.inputs() { <del> let r = self.check_type_for_ffi(cache, *arg); match r { </del> <ins> match self.check_type_for_ffi(cache, *arg) { </ins> FfiSafe => {} <del> _ => { return r; } </del> <ins> r => return r, </ins> } } <del> FfiSafe </del> <ins> let ret_ty = sig.output(); if ret_ty.is_unit() { return FfiSafe; } self.check_type_for_ffi(cache, ret_ty) </ins> } ty::Foreign(..) => FfiSafe,


.filter_map(|lang_item| self.tcx.lang_items().require(*lang_item).ok()) .collect(); <del> never_suggest_borrow.push(self.tcx.get_diagnostic_item(sym::Send).unwrap()); </del> <ins> if let Some(def_id) = self.tcx.get_diagnostic_item(sym::Send) { never_suggest_borrow.push(def_id); } </ins> let param_env = obligation.param_env; let trait_ref = poly_trait_ref.skip_binder();


continue; } <del> let missing = match source { PathSource::Trait(..) | PathSource::TraitItem(..) | PathSource::Type => true, </del> <ins> let node_ids = self.r.next_node_ids(expected_lifetimes); self.record_lifetime_res( segment_id, LifetimeRes::ElidedAnchor { start: node_ids.start, end: node_ids.end }, LifetimeElisionCandidate::Ignore, ); let inferred = match source { PathSource::Trait(..) | PathSource::TraitItem(..) | PathSource::Type => false, </ins> PathSource::Expr(..) | PathSource::Pat | PathSource::Struct <del> | PathSource::TupleStruct(..) => false, </del> <ins> | PathSource::TupleStruct(..) => true, </ins> }; <del> if !missing && !segment.has_generic_args { </del> <ins> if inferred { // Do not create a parameter for patterns and expressions: type checking can infer // the appropriate lifetime for us. for id in node_ids { self.record_lifetime_res( id, LifetimeRes::Infer, LifetimeElisionCandidate::Named, ); } </ins> continue; }


move_place: &Place<'tcx>, deref_target_place: &Place<'tcx>, span: Span, <ins> use_spans: Option<UseSpans>, </ins> ) -> DiagnosticBuilder<'a> { // Inspect the type of the content behind the // borrow to provide feedback about why this


<ins> // compile-flags: -Znext-solver #![feature(lazy_type_alias)] //~^ WARN the feature `lazy_type_alias` is incomplete trait Foo {} type A<T: Foo> = T; struct W<T>(T); // For `W<A<usize>>` to be WF, `A<usize>: Sized` must hold. However, when assembling // alias bounds for `A<usize>`, we try to normalize it, but it doesn't hold because // `usize: Foo` doesn't hold. Therefore we ICE, because we don't expect to still // encounter weak types in `assemble_alias_bound_candidates_recur`. fn hello(_: W<A<usize>>) {} //~^ ERROR the type `W<A<usize>>` is not well-formed fn main() {} </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. fn main() { let mut c = (1, "".to_owned()); match c { c2 => { c.0 = 2; assert_eq!(c2.0, 1); } } } </ins>


// option. This file may not be copied, modified, or distributed // except according to those terms. <ins> #[doc(keyword = "as")] // /// The type coercion keyword. /// /// `as` is most commonly used to turn primitive types into other primitive types, but it has other /// uses that include turning pointers into addresses, addresses into pointers, and pointers into /// other pointers. /// /// ```rust /// let thing1: u8 = 89.0 as u8; /// assert_eq!('B' as u32, 66); /// assert_eq!(thing1 as char, 'Y'); /// let thing2: f32 = thing1 as f32 + 10.5; /// assert_eq!(true as u8 + thing2 as u8, 100); /// ``` /// /// In general, any coercion that can be performed via writing out type hints can also be done /// using `as`, so instead of writing `let x: u32 = 123`, you can write `let x = 123 as u32` (Note: /// `let x = 123u32` would be best in that situation). The same is not true in the other direction, /// however, explicitly using `as` allows a few more coercions that aren't allowed implicitly, such /// as changing the type of a raw pointer or turning closures into raw pointers. /// /// For more information on what `as` is capable of, see the [Reference] /// /// [Reference]: https://doc.rust-lang.org/reference/expressions/operator-expr.html#type-cast-expressions mod as_keyword { } #[doc(keyword = "const")] // /// The keyword for defining constants. /// /// Sometimes a certain value is used many times throughout a program, and it can become /// inconvenient to copy it over and over. What's more, it's not always possible or desirable to /// make it a variable that gets carried around to each function that needs it. In these cases, the /// `const` keyword provides a convenient alternative to code duplication. /// /// ```rust /// const THING: u32 = 0xABAD1DEA; /// /// let foo = 123 + THING; /// ``` /// /// Constants must be explicitly typed, unlike with `let` you can't ignore its type and let the /// compiler figure it out. Any constant value can be defined in a const, which in practice happens /// to be most things that would be reasonable to have a constant. For example, you can't have a /// File as a `const`. /// /// The only lifetime allowed in a constant is 'static, which is the lifetime that encompasses all /// others in a Rust program. For example, if you wanted to define a constant string, it would look /// like this: /// /// ```rust /// const WORDS: &'static str = "hello rust!"; /// ``` /// /// Thanks to static lifetime elision, you usually don't have to explicitly use 'static: /// /// ```rust /// const WORDS: &str = "hello convenience!"; /// ``` /// /// `const` items looks remarkably similar to [`static`] items, which introduces some confusion as /// to which one should be used at which times. To put it simply, constants are inlined wherever /// they're used, making using them identical to simply replacing the name of the const with its /// value. Static variables on the other hand point to a single location in memory, which all /// accesses share. This means that, unlike with constants, they can't have destructors, but it /// also means that (via unsafe code) they can be mutable, which is useful for the rare situations /// in which you can't avoid using global state. /// /// Constants, as with statics, should always be in SCREAMING_SNAKE_CASE. /// /// The `const` keyword is also used in raw pointers in combination with `mut`, as seen in `*const /// T` and `*mut T`. More about that can be read at the [pointer] primitive part of the Rust docs. /// /// For more detail on `const`, see the [Rust Book] or the [Reference] /// /// [`static`]: keyword.static.html /// [pointer]: primitive.pointer.html /// [Rust Book]: https://doc.rust-lang.org/stable/book/2018-edition/ch03-01-variables-and-mutability.html#differences-between-variables-and-constants /// [Reference]: https://doc.rust-lang.org/reference/items/constant-items.html mod const_keyword { } #[doc(keyword = "crate")] // /// The `crate` keyword. /// /// The primary use of the `crate` keyword is as a part of `extern crate` declarations, which are /// used to specify a dependency on a crate external to the one it's declared in. Crates are the /// fundamental compilation unit of Rust code, and can be seen as libraries or projects. More can /// be read about crates in the [Reference]. /// /// ```rust ignore /// extern crate rand; /// extern crate my_crate as thing; /// extern crate std; // implicitly added to the root of every Rust project /// ``` /// /// The `as` keyword can be used to change what the crate is referred to as in your project. If a /// crate name includes a dash, it is implicitly imported with the dashes replaced by underscores. /// /// `crate` is also used as in conjunction with [`pub`] to signify that the item it's attached to /// is public only to other members of the same crate it's in. /// /// ```rust /// # #[allow(unused_imports)] /// pub(crate) use std::io::Error as IoError; /// pub(crate) enum CoolMarkerType { } /// pub struct PublicThing { ///     pub(crate) semi_secret_thing: bool, /// } /// ``` /// /// [Reference]: https://doc.rust-lang.org/reference/items/extern-crates.html /// [`pub`]: keyword.pub.html mod crate_keyword { } #[doc(keyword = "enum")] // /// For defining enumerations. /// /// Enums in Rust are similar to those of other compiled languages like C, but have important /// differences that make them considerably more powerful. What Rust calls enums are more commonly /// known as Algebraic Data Types if you're coming from a functional programming background, but /// the important part is that data can go with the enum variants. /// /// ```rust /// # struct Coord; /// enum SimpleEnum { ///     FirstVariant, ///     SecondVariant, ///     ThirdVariant, /// } /// /// enum Location { ///     Unknown, ///     Anonymous, ///     Known(Coord), /// } /// /// enum ComplexEnum { ///     Nothing, ///     Something(u32), ///     LotsOfThings { ///         usual_struct_stuff: bool, ///         blah: String, ///     } /// } /// /// enum EmptyEnum { } /// ``` /// /// The first enum shown is the usual kind of enum you'd find in a C-style language. The second /// shows off a hypothetical example of something storing location data, with Coord being any other /// type that's needed, for example a struct. The third example demonstrates the kind of variant a /// variant can store, ranging from nothing, to a tuple, to an anonymous struct. /// /// Instantiating enum variants involves explicitly using the enum's name as its namespace, /// followed by one of its variants. `SimpleEnum::SecondVariant` would be an example from above. /// When data follows along with a variant, such as with rust's built-in [`Option`] type, the data /// is added as the type describes, for example `Option::Some(123)`. The same follows with /// struct-like variants, with things looking like `ComplexEnum::LotsOfThings { usual_struct_stuff: /// true, blah: "hello!".to_string(), }`. Empty Enums are similar to () in that they cannot be /// instantiated at all, and are used mainly to mess with the type system in interesting ways. /// /// For more information, take a look at the [Rust Book] or the [Reference] /// /// [`Option`]: option/enum.Option.html /// [Rust Book]: https://doc.rust-lang.org/book/second-edition/ch06-01-defining-an-enum.html /// [Reference]: https://doc.rust-lang.org/reference/items/enumerations.html mod enum_keyword { } #[doc(keyword = "extern")] // /// For external connections in Rust code. /// /// The `extern` keyword is used in two places in Rust. One is in conjunction with the [`crate`] /// keyword to make your Rust code aware of other Rust crates in your project, i.e. `extern crate /// lazy_static;`. The other use is in foreign function interfaces (FFI). /// /// `extern` is used in two different contexts within FFI. The first is in the form of external /// blcoks, for declaring function interfaces that Rust code can call foreign code by. /// /// ```rust ignore /// #[link(name = "my_c_library")] /// extern "C" { ///     fn my_c_function(x: i32) -> bool; /// } /// ``` /// /// This code would attempt to link with libmy_c_library.so on unix-like systems and /// my_c_library.dll on Windows at runtime, and panic if it can't find something to link to. Rust /// code could then use `my_c_function` as if it were any other unsafe Rust function. Working with /// non-Rust languages and FFI is inherently unsafe, so wrappers are usually built around C APIs. /// /// The mirror use case of FFI is also done via the `extern` keyword: /// /// ```rust /// # #![allow(private_no_mangle_fns)] /// #[no_mangle] /// pub extern fn callable_from_c(x: i32) -> bool { ///     x % 3 == 0 /// } /// ``` /// /// If compiled as a dylib, the resulting .so could then be linked to from a C library, and the /// function could be used as if it was from any other library. /// /// For more information on FFI, check the [Rust book] or the [Reference]. /// /// [Rust book]: https://doc.rust-lang.org/book/second-edition/ch19-01-unsafe-rust.html#using-extern-functions-to-call-external-code /// [Reference]: https://doc.rust-lang.org/reference/items/external-blocks.html mod extern_keyword { } </ins> #[doc(keyword = "fn")] // <del> /// The `fn` keyword. </del> <ins> /// The keyword for defining functions. </ins> /// <del> /// The `fn` keyword is used to declare a function. </del> <ins> /// Functions are the primary way code is executed within Rust. Function blocks, usually just /// called functions, can be defined in a variety of different places and be assigned many /// different attributes and modifiers. </ins> /// <del> /// Example: </del> <ins> /// Standalone functions that just sit within a module not attached to anything else are common, /// but most functions will end up being inside [`impl`] blocks, either on another type itself, or /// as a trait impl for that type. </ins> /// /// ```rust <del> /// fn some_function() { ///     // code goes in here </del> <ins> /// fn standalone_function() { ///     // code /// } /// /// pub fn public_thing(argument: bool) -> String { ///     // code ///     # "".to_string() /// } /// /// struct Thing { ///     foo: i32, /// } /// /// impl Thing { ///     pub fn new() -> Self { ///         Self { ///             foo: 42, ///         } ///     } </ins> /// } /// ``` /// <del> /// For more information about functions, take a look at the [Rust Book][book]. </del> <ins> /// See docs on [`impl`] and [`self`] for relevant details on those. /// /// In addition to presenting fixed types in the form of `fn name(arg: type, ..) -> return_type`, /// functions can also declare a list of type parameters along with trait bounds that they fall /// into. /// /// ```rust /// fn generic_function<T: Clone>(x: T) -> (T, T, T) { ///     (x.clone(), x.clone(), x.clone()) /// } </ins> /// <del> /// [book]: https://doc.rust-lang.org/book/second-edition/ch03-03-how-functions-work.html </del> <ins> /// fn generic_where<T>(x: T) -> T ///     where T: std::ops::Add<Output=T> + Copy /// { ///     x + x + x /// } /// ``` /// /// Declaring trait bounds in the angle brackets is functionally identical to using a [`where`] /// clause, but `where` is preferred due to it being easier to understand at a glance. /// /// Along with being made public via [`pub`], `fn` can also have an [`extern`] added for use in /// FFI. /// /// For more information on the various types of functions and how they're used, consult the [Rust /// book] or the [Reference]. /// /// [`impl`]: keyword.impl.html /// [`self`]: keyword.self.html /// [`where`]: keyword.where.html /// [`pub`]: keyword.pub.html /// [`extern`]: keyword.extern.html /// [Rust book]: https://doc.rust-lang.org/book/second-edition/ch03-03-how-functions-work.html /// [Reference]: https://doc.rust-lang.org/reference/items/functions.html </ins> mod fn_keyword { } <ins> #[doc(keyword = "for")] // /// The `for` keyword. /// /// `for` is primarily used in for-in-loops, but it has a few other pieces of syntactic uses such as /// `impl Trait for Type` (see [`impl`] for more info on that). for-in-loops, or to be more /// precise, iterator loops, are a simple syntactic sugar over an exceedingly common practice /// within Rust, which is to loop over an iterator until that iterator returns None (or [`break`] /// is called). /// /// ```rust /// for i in 0..5 { ///     println!("{}", i * 2); /// } /// /// for i in std::iter::repeat(5) { ///     println!("turns out {} never stops being 5", i); ///     break; // would loop forever otherwise /// } /// /// 'outer: for x in 5..50 { ///     for y in 0..10 { ///         if x == y { ///             break 'outer; ///         } ///     } /// } /// ``` /// /// As shown in the example above, `for` loops (along with all other loops) can be tagged, using /// similar syntax to lifetimes (only visually similar, entirely distinct in practice). Giving the /// same tag to `break` breaks the tagged loop, which is useful for inner loops. It is definitely /// not a goto. /// /// A `for` loop expands as shown: /// /// ```rust /// # fn code() { } /// # let iterator = 0..2; /// for loop_variable in iterator { ///     code() /// } /// ``` /// /// ```rust /// # fn code() { } /// # let iterator = 0..2; /// { ///     let mut _iter = std::iter::IntoIterator::into_iter(iterator); ///     loop { ///         match _iter.next() { ///             Some(loop_variable) => { ///                 code() ///             }, ///             None => break, ///         } ///     } /// } /// ``` /// /// More details on the functionality shown can be seen at the [`IntoIterator`] docs. /// /// For more information on for-loops, see the [Rust book] or the [Reference]. /// /// [`impl`]: keyword.impl.html /// [`break`]: keyword.break.html /// [`IntoIterator`]: iter/trait.IntoIterator.html /// [Rust book]: https://doc.rust-lang.org/book/2018-edition/ch03-05-control-flow.html#looping-through-a-collection-with-for /// [Reference]: https://doc.rust-lang.org/reference/expressions/loop-expr.html#iterator-loops mod for_keyword { } #[doc(keyword = "if")] // /// If statements and expressions. /// /// `if` is a familiar construct to most programmers, and is the main way you'll often do logic in /// your code. However, unlike in most languages, `if` blocks can also act as expressions. /// /// ```rust /// # let rude = true; /// if 1 == 2 { ///     println!("whoops, mathematics broke"); /// } else { ///     println!("everything's fine!"); /// } /// /// let greeting = if rude { ///     "sup nerd." /// } else { ///     "hello, friend!" /// }; /// /// if let Ok(x) = "123".parse::<i32>() { ///     println!("{} double that and you get {}!", greeting, x * 2); /// } /// ``` /// /// Shown above are the three typical forms an `if` block comes in. First is the usual kind of /// thing you'd see in many languages, with an optional `else` block. Second uses `if` as an /// expression, which is only possible if all branches return the same type. An `if` expression can /// be used everywhere you'd expect. The third kind of `if` block is an `if let` block, which /// behaves similarly to using a [`match`] expression: /// /// ```rust /// if let Some(x) = Some(123) { ///     // code ///     # let _ = x; /// } else { ///     // something else /// } /// /// match Some(123) { ///     Some(x) => { ///         // code ///         # let _ = x; ///     }, ///     _ => { ///         // something else ///     }, /// } /// ``` /// /// See [`let`] for more information on pattern bindings. /// /// Each kind of `if` expression can be mixed and matched as needed. /// /// ```rust /// if true == false { ///     println!("oh no"); /// } else if "something" == "other thing" { ///     println!("oh dear"); /// } else if let Some(200) = "blarg".parse::<i32>().ok() { ///     println!("uh oh"); /// } else { ///     println!("phew, nothing's broken"); /// } /// ``` /// /// The `if` keyword is used in one other place in Rust, namely as a part of pattern matching /// itself, allowing patterns such as `Some(x) if x > 200` to be used. /// /// For more information on `if` expressions, see the [Rust book] or the [Reference]. /// /// [`match`]: keyword.match.html /// [`let`]: keyword.let.html /// [Rust book]: https://doc.rust-lang.org/stable/book/2018-edition/ch03-05-control-flow.html#if-expressions /// [Reference]: https://doc.rust-lang.org/reference/expressions/if-expr.html mod if_keyword { } </ins> #[doc(keyword = "let")] // /// The `let` keyword.


<del> error: expected expression, found reserved keyword `try` --> $DIR/try-block-in-while.rs:6:11 </del> <ins> error[E0277]: the trait bound `bool: std::ops::Try` is not satisfied --> $DIR/try-block-in-while.rs:6:15 </ins> | LL |     while try { false } {} <del> |           ^^^ expected expression </del> <ins> |               ^^^^^^^^^ the trait `std::ops::Try` is not implemented for `bool` | = note: required by `std::ops::Try::from_ok` </ins> error: aborting due to previous error <ins> For more information about this error, try `rustc --explain E0277`. </ins>


.iter() .enumerate() .filter(|x| x.1.hir_id == *hir_id) <del> .map(|(i, _)| init_tup.get(i).unwrap()) .next() </del> <ins> .find_map(|(i, _)| init_tup.get(i)) </ins> { self.note_type_is_not_clone_inner_expr(init) } else {


<ins> struct TestClient; impl TestClient { fn get_inner_ref(&self) -> &Vec<usize> { todo!() } } fn main() { let client = TestClient; let inner = client.get_inner_ref(); //~^ HELP consider changing this to be a mutable reference inner.clear(); //~^ ERROR cannot borrow `*inner` as mutable, as it is behind a `&` reference [E0596] } </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. </ins>


let _: Wow<A.0>; //~^ ERROR expected one of //~| HELP expressions must be enclosed in braces to be used as const generic arguments <del> // FIXME(compiler-errors): This one is still unsatisfying, // and probably a case I could see someone typing by accident.. </del> <ins> let _: Wow<[]>; //~^ ERROR expected type //~| HELP expressions must be enclosed in braces to be used as const generic arguments </ins> let _: Wow<[12]>; <del> //~^ ERROR expected type, found //~| ERROR type provided when a constant was expected </del> <ins> //~^ ERROR expected type //~| ERROR invalid const generic expression //~| HELP expressions must be enclosed in braces to be used as const generic arguments let _: Wow<[0, 1, 3]>; //~^ ERROR expected type //~| HELP expressions must be enclosed in braces to be used as const generic arguments let _: Wow<[0xff; 8]>; //~^ ERROR expected type //~| ERROR invalid const generic expression //~| HELP expressions must be enclosed in braces to be used as const generic arguments let _: Wow<[1, 2]>; // Regression test for issue #81698. //~^ ERROR expected type //~| HELP expressions must be enclosed in braces to be used as const generic arguments let _: Wow<&0>; //~^ ERROR expected type //~| HELP expressions must be enclosed in braces to be used as const generic arguments let _: Wow<("", 0)>; //~^ ERROR expected type //~| HELP expressions must be enclosed in braces to be used as const generic arguments let _: Wow<(1 + 2) * 3>; //~^ ERROR expected type //~| HELP expressions must be enclosed in braces to be used as const generic arguments // FIXME(fmease): This one is pretty bad. let _: Wow<!0>; //~^ ERROR expected one of //~| HELP you might have meant to end the type parameters here </ins> }


<ins> // revisions:rpass1 rpass2 struct A; #[cfg(rpass2)] impl From<A> for () { fn from(_: A) {} } fn main() {} </ins>


} /// Builds drops for pop_scope and exit_scope. <del> fn build_scope_drops<'tcx>(mut block: BasicBlock, </del> <ins> fn build_scope_drops<'tcx>(cfg: &mut CFG<'tcx>, </ins> scope: &Scope<'tcx>, earlier_scopes: &[Scope<'tcx>], <del> cfg: &mut CFG<'tcx>) </del> <ins> mut block: BasicBlock) </ins> -> BlockAnd<()> { let mut iter = scope.drops.iter().rev().peekable(); while let Some(drop_data) = iter.next() {


DependencyType::TargetSelfContained, ); } <ins> let crt_path = builder.ensure(native::CrtBeginEnd { target }); </ins> for &obj in &["crtbegin.o", "crtbeginS.o", "crtend.o", "crtendS.o"] { <del> let src = compiler_file(builder, builder.cc(target), target, obj); </del> <ins> let src = crt_path.join(obj); </ins> let target = libdir_self_contained.join(obj); builder.copy(&src, &target); target_deps.push((target, DependencyType::TargetSelfContained));


cx.generated_synthetics.insert((ty, trait_def_id)); <ins> let hir_imp = impl_def_id.as_local() .map(|local| cx.tcx.hir().expect_item(local)) .and_then(|item| if let hir::ItemKind::Impl(i) = &item.kind { Some(i) } else { None }); let items = match hir_imp { Some(imp) => imp .items .iter() .map(|ii| cx.tcx.hir().impl_item(ii.id).clean(cx)) .collect::<Vec<_>>(), None => cx.tcx .associated_items(impl_def_id) .in_definition_order() .map(|x| x.clean(cx)) .collect::<Vec<_>>(), }; </ins> impls.push(Item { name: None, attrs: Default::default(),


<ins> error: expected one of `(`, `,`, `=`, `{`, or `}`, found `#` --> $DIR/help-set-edition-ice-122130.rs:2:6 | LL |     s#[c"owned_box"] |      ^ expected one of `(`, `,`, `=`, `{`, or `}` | = note: you may be trying to write a c-string literal = note: c-string literals require Rust 2021 or later = help: pass `--edition 2021` to `rustc` = note: for more on editions, read https://doc.rust-lang.org/edition-guide error: expected item, found `"owned_box"` --> $DIR/help-set-edition-ice-122130.rs:2:9 | LL |     s#[c"owned_box"] |         ^^^^^^^^^^^ expected item | = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html> error: aborting due to 2 previous errors </ins>


<ins> // Suggest to a user to use the print macros // instead to use the printf. fn main() { let x = 4; printf("%d", x); //~^ ERROR cannot find function `printf` in this scope //~| HELP you may have meant to use the `print` macro } </ins>


#[subdiagnostic] pub req_introduces_loc: Option<ReqIntroducedLocations>, <ins> pub has_param_name: bool, pub param_name: String, </ins> pub spans_empty: bool, pub has_lifetime: bool, pub lifetime: String,


<ins> // force-host // no-prefer-dynamic #![crate_type = "proc-macro"] extern crate proc_macro; use proc_macro::TokenStream; #[proc_macro_attribute] pub fn vec_ice(_attr: TokenStream, input: TokenStream) -> TokenStream { // This redundant convert is necessary to reproduce ICE. input.into_iter().collect() } </ins>


match view_path.node { ViewPathSimple(binding, ref full_path) => { <del> let source_name = full_path.segments.last().unwrap().identifier.name; if source_name.as_str() == "mod" || source_name.as_str() == "self" { </del> <ins> let mut source = full_path.segments.last().unwrap().identifier; let source_name = source.name.as_str(); if source_name == "mod" || source_name == "self" { </ins> resolve_error(self, view_path.span, ResolutionError::SelfImportsOnlyAllowedWithin); <ins> } else if source_name == "$crate" && full_path.segments.len() == 1 { let crate_root = self.resolve_crate_var(source.ctxt); let crate_name = match crate_root.kind { ModuleKind::Def(_, name) => name, ModuleKind::Block(..) => unreachable!(), }; source.name = crate_name; self.session.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") .emit(); </ins> } <del> let subclass = ImportDirectiveSubclass::single(binding.name, source_name); </del> <ins> let subclass = ImportDirectiveSubclass::single(binding.name, source.name); </ins> let span = view_path.span; self.add_import_directive(module_path, subclass, span, item.id, vis); }


//! //! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/mir/index.html <del> // ignore-tidy-filelength </del> use crate::mir::interpret::{GlobalAlloc, Scalar}; use crate::mir::visit::MirVisitable; use crate::ty::adjustment::PointerCast;


all( not(target_arch = "aarch64"), not(target_arch = "powerpc"), <ins> not(target_arch = "s390x"), </ins> not(target_arch = "x86_64") ), all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios")),


let hir_id = self.tcx().hir().as_local_hir_id(def_id).unwrap(); let instantiated_ty = self.resolve(&opaque_defn.concrete_ty, &hir_id); <ins> debug_assert!(!instantiated_ty.has_escaping_bound_vars()); </ins> let generics = self.tcx().generics_of(def_id); let definition_ty = if generics.parent.is_some() {


src_href: src_href.as_deref(), }; <del> let heading = item_vars.render().unwrap(); buf.write_str(&heading); </del> <ins> item_vars.render_into(buf).unwrap(); </ins> match *item.kind { clean::ModuleItem(ref m) => item_module(buf, cx, item, &m.items),


expr: &hir::Expr<'_>, found: Ty<'tcx>, expected: Ty<'tcx>, <ins> mismatch_span: Span, </ins> ) -> bool { let map = self.tcx.hir();


&& adt.is_fundamental() { for ty in generics { <del> if let Some(did) = ty.def_id(self.cache) { dids.insert(did); } </del> <ins> dids.extend(ty.def_id(self.cache)); </ins> } } }


<ins> error: trait objects without an explicit `dyn` are deprecated --> $DIR/issue-61963.rs:20:14 | LL |     bar: Box<Bar>, |              ^^^ help: use `dyn`: `dyn Bar` | note: lint level defined here --> $DIR/issue-61963.rs:3:9 | LL | #![deny(bare_trait_objects)] |         ^^^^^^^^^^^^^^^^^^ error: aborting due to previous error </ins>


<ins> // Note: this test is paired with logo-class.rs. // @has logo_class_default/struct.SomeStruct.html '//*[@class="logo-container"]/img[@class="rust-logo"]' '' // @has logo_class_default/struct.SomeStruct.html '//*[@class="sub-logo-container"]/img[@class="rust-logo"]' '' pub struct SomeStruct; </ins>


.and_modify(|e| { *e = (e.0.clone(), Some(rhs.ty().unwrap().clone())) }) <del> .or_insert((None, Some(rhs.ty().unwrap().clone()))); </del> <ins> .or_insert(( PolyTrait { trait_: trait_.clone(), generic_params: Vec::new(), }, Some(rhs.ty().unwrap().clone()), )); </ins> continue; }


else_ty) } None => { <del> check_block_no_value(fcx, then_blk); ty::mk_nil() </del> <ins> infer::common_supertype(fcx.infcx(), infer::IfExpressionWithNoElse(sp), false, then_ty, ty::mk_nil()) </ins> } };


if !self.any_library { // If we are building an executable, only explicitly extern // types need to be exported. <del> if has_custom_linkage(self.tcx, search_item) { </del> <ins> let codegen_attrs = if self.tcx.def_kind(search_item).has_codegen_attrs() { self.tcx.codegen_fn_attrs(search_item) } else { CodegenFnAttrs::EMPTY }; let is_extern = codegen_attrs.contains_extern_indicator(); let std_internal = codegen_attrs.flags.contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL); if is_extern || std_internal { </ins> self.reachable_symbols.insert(search_item); } } else {


<ins> error[E0271]: type mismatch resolving `<&i32 as Deref>::Target == String` --> $DIR/default-body-type-err.rs:7:22 | LL |     fn lol(&self) -> impl Deref<Target = String> { |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found struct `String` LL | LL |         &1i32 |         ----- return type was inferred to be `&i32` here error: aborting due to previous error For more information about this error, try `rustc --explain E0271`. </ins>


<ins> trait Trait {} impl Trait for i32 {} // Since `Assoc` doesn't actually exist, it's "stranded", and won't show up in // the list of opaques that may be defined by the function. Make sure we don't // ICE in this case. fn produce<T>() -> impl Trait<Assoc = impl Trait> { //~^ ERROR associated type `Assoc` not found for `Trait` 16 } fn main () {} </ins>


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


// *in Rust code* may unwind. Foreign items like `extern "C" { // fn foo(); }` are assumed not to unwind **unless** they have // a `#[unwind]` attribute. <del> } else if !cx.tcx.is_foreign_item(id) { </del> <ins> } else if id.map(|id| !cx.tcx.is_foreign_item(id)).unwrap_or(false) { </ins> Some(true) } else { None


Box::new(MaybeUninit::uninit()) } <del> // FIXME: add a test for a bigger box. Currently broken, see // https://github.com/rust-lang/rust/issues/58201. </del> <ins> // https://github.com/rust-lang/rust/issues/58201 #[no_mangle] pub fn box_uninitialized2() -> Box<MaybeUninit<[usize; 1024 * 1024]>> { // CHECK-LABEL: @box_uninitialized2 // CHECK-NOT: store // CHECK-NOT: alloca // CHECK-NOT: memcpy // CHECK-NOT: memset Box::new(MaybeUninit::uninit()) } </ins> // Hide the LLVM 15+ `allocalign` attribute in the declaration of __rust_alloc // from the CHECK-NOT above. We don't check the attributes here because we can't rely


addClass(search, "hidden"); removeClass(main, "hidden"); document.title = titleBeforeSearch; <ins> // We also remove the query parameter from the URL. if (browserSupportsHistoryApi()) { history.replaceState("", window.currentCrate + " - Rust", getNakedUrl() + window.location.hash); } </ins> } // used for special search precedence


self.parent_scope.module = old_module; } else { match &item.kind { <del> ItemKind::Impl(box ast::Impl { of_trait: Some(..), .. }) => { </del> <ins> ItemKind::Impl(box ast::Impl { of_trait: Some(trait_ref), .. }) => { if let Some(partial_res) = self.resolver.get_partial_res(trait_ref.ref_id) && let Some(res) = partial_res.full_res() && let Some(trait_def_id) = res.opt_def_id() && !trait_def_id.is_local() && self.visited_mods.insert(trait_def_id) { self.resolve_doc_links_extern_impl(trait_def_id, false); } </ins> self.all_trait_impls.push(self.resolver.local_def_id(item.id).to_def_id()); } ItemKind::MacroDef(macro_def) if macro_def.macro_rules => {


var params = getQueryStringParams(); if (params && params.search) { var search = getSearchElement();  search.innerHTML = "
Loading search results...
";   search.innerHTML = "
" + getSearchLoadingText() + "
";  showSearchResults(search); }


/// `&mut T` references can be freely coerced into `&T` references with the same referent type, and /// references with longer lifetimes can be freely coerced into references with shorter ones. /// <ins> /// Reference equality by address, instead of comparing the values pointed to, is accomplished via /// implicit reference-pointer coercion and raw pointer equality via [`ptr::eq`], while /// [`PartialEq`] compares values. /// /// [`ptr::eq`]: ptr/fn.eq.html /// [`PartialEq`]: cmp/trait.PartialEq.html /// /// ``` /// use std::ptr; /// /// let five = 5; /// let other_five = 5; /// let five_ref = &five; /// let same_five_ref = &five; /// let other_five_ref = &other_five; /// /// assert!(five_ref == same_five_ref); /// assert!(five_ref == other_five_ref); /// /// assert!(ptr::eq(five_ref, same_five_ref)); /// assert!(!ptr::eq(five_ref, other_five_ref)); /// ``` /// </ins> /// For more information on how to use references, see [the book's section on "References and /// Borrowing"][book-refs]. /// /// [book-refs]: ../book/second-edition/ch04-02-references-and-borrowing.html /// <ins> /// # Trait implementations /// </ins> /// The following traits are implemented for all `&T`, regardless of the type of its referent: /// /// * [`Copy`]


// Ensure that `libLLVM.so` ends up in the newly build compiler directory, // so that it can be found when the newly built `rustc` is run. <del> dist::maybe_install_llvm_dylib(builder, target_compiler.host, &sysroot); </del> <ins> dist::maybe_install_llvm_runtime(builder, target_compiler.host, &sysroot); dist::maybe_install_llvm_target(builder, target_compiler.host, &sysroot); </ins> // Link the compiler binary itself into place let out_dir = builder.cargo_out(build_compiler, Mode::Rustc, host);


let mode = match tcx.hir().body_owner_kind(hir_id) { HirKind::Closure => return None, <del> HirKind::Fn if tcx.is_const_fn(def_id) => ConstKind::ConstFn, </del> <ins> // Note: this is deliberately checking for `is_const_fn_raw`, as the `is_const_fn` // checks take into account the `rustc_const_unstable` attribute combined with enabled // feature gates. Otherwise, const qualification would _not check_ whether this // function body follows the `const fn` rules, as an unstable `const fn` would // be considered "not const". More details are available in issue #67053. HirKind::Fn if tcx.is_const_fn_raw(def_id) => ConstKind::ConstFn, </ins> HirKind::Fn => return None, HirKind::Const => ConstKind::Const,


/// # Examples /// /// ``` <del> /// #![feature(ptr_hash)] </del> /// use std::collections::hash_map::DefaultHasher; /// use std::hash::{Hash, Hasher}; /// use std::ptr;


<del> use crate::spec::{LinkerFlavor, PanicStrategy, Target, TargetResult}; </del> <ins> use crate::spec::{LinkerFlavor, Target, TargetResult}; </ins> pub fn target() -> TargetResult { let mut base = super::windows_msvc_base::opts();


//~^ ERROR doesn't implement } <del> pub fn main() { } </del> <ins> trait Foo<T> { const SIZE: usize = core::mem::size_of::<Self>(); //~^ ERROR the size for values of type `Self` cannot be known at compilation time } trait Bar: std::fmt::Display { const SIZE: usize = core::mem::size_of::<Self>(); //~^ ERROR the size for values of type `Self` cannot be known at compilation time } trait Baz where Self: std::fmt::Display { const SIZE: usize = core::mem::size_of::<Self>(); //~^ ERROR the size for values of type `Self` cannot be known at compilation time } trait Qux<T> where Self: std::fmt::Display { const SIZE: usize = core::mem::size_of::<Self>(); //~^ ERROR the size for values of type `Self` cannot be known at compilation time } trait Bat<T>: std::fmt::Display { const SIZE: usize = core::mem::size_of::<Self>(); //~^ ERROR the size for values of type `Self` cannot be known at compilation time } fn main() { } </ins>


AscribeUserTy, /// The data of a user variable, for debug info. VarDebugInfo, <del> /// PlaceMention statement. PlaceMention, </del> } #[derive(Copy, Clone, Debug, PartialEq, Eq)]


let node_id = scope.node_id(self.tcx, &self.region_scope_tree); match self.tcx.hir.find(node_id) { Some(hir_map::NodeStmt(_)) => { <del> db.note("consider using a `let` binding to increase its lifetime"); </del> <ins> if *sub_scope != ty::ReStatic { db.note("consider using a `let` binding to increase its lifetime"); } </ins> } _ => {} }


<ins> error[E0596]: cannot borrow immutable `Box` content `*x` as mutable --> $DIR/issue-36400.rs:15:12 | 14 |     let x = Box::new(3); |         - consider changing this to `mut x` 15 |     f(&mut *x); |            ^^ cannot borrow as mutable error: aborting due to previous error </ins>


[[package]] name = "ar_archive_writer" <del> version = "0.4.0" </del> <ins> version = "0.4.2" </ins> source = "registry+https://github.com/rust-lang/crates.io-index" <del> checksum = "de11a9d32db3327f981143bdf699ade4d637c6887b13b97e6e91a9154666963c" </del> <ins> checksum = "01667f6f40216b9a0b2945e05fed5f1ad0ab6470e69cb9378001e37b1c0668e4" </ins> dependencies = [ "object 0.36.2", ]


if let (Some(fmt_str), expr) = self.check_tts(cx, &mac.args.inner_tokens(), true) { if fmt_str.symbol == Symbol::intern("") { let mut applicability = Applicability::MachineApplicable; <del> let suggestion = if let Some(e) = expr { snippet_with_applicability(cx, e.span, "v", &mut applicability) } else { applicability = Applicability::HasPlaceholders; Cow::Borrowed("v") </del> <ins> let suggestion = match expr { Some(expr) => snippet_with_applicability(cx, expr.span, "v", &mut applicability), None => { applicability = Applicability::HasPlaceholders; Cow::Borrowed("v") }, </ins> }; span_lint_and_sugg(


fBopt-levelfR=fIVALfR Optimize with possible levels 0[en]3 <ins> .SH ENVIRONMENT VARIABLES Some of these affect the output of the compiler, while others affect programs which link to the standard library. .TP fBRUST_TEST_THREADSfR The test framework Rust provides executes tests in parallel. This variable sets the maximum number of threads used for this purpose. .TP fBRUST_TEST_NOCAPTUREfR A synonym for the --nocapture flag. .TP fBRUST_MIN_STACKfR Sets the minimum stack size for new threads. .TP fBRUST_BACKTRACEfR If set, produces a backtrace in the output of a program which panics. </ins> .SH "EXAMPLES" To build an executable from a source file with a main function: $ rustc -o hello hello.rs


self.tcx.struct_span_lint_hir( lint::builtin::RUST_2021_INCOMPATIBLE_CLOSURE_CAPTURES, closure_hir_id, <del> closure_head_span, </del> <ins> closure_head_span, </ins> |lint| { let mut diagnostics_builder = lint.build( format!(


<del> Subproject commit 5399a24c66cb6164cf32280e7d300488c90d5765 </del> <ins> Subproject commit b31c30a9bb4dbbd13c359d0e2bea7f65d20adf3f </ins>


<ins> #![feature(unboxed_closures)] #![feature(fn_traits)] fn main() { let handlers: Option<Box<dyn for<'a> FnMut<&'a mut (), Output=()>>> = None; handlers.unwrap().as_mut().call_mut(&mut ()); //~ ERROR: `&mut ()` is not a tuple } </ins>


#[cfg(test)] mod tests; <ins> #[doc(no_inline)] </ins> pub use hir::*; pub use hir_id::*; pub use lang_items::{LangItem, LanguageItems};


src = t!(fs::canonicalize(src)); } else { let link = t!(fs::read_link(src)); <del> t!(self.symlink_file(link, dst)); </del> <ins> t!(self.config.symlink_file(link, dst)); </ins> return; } }


<ins> // Regression test for #100143 use std::iter::Peekable; pub struct Span<F: Fn(&i32)> { inner: Peekable<ConditionalIterator<F>>, } pub struct ConditionalIterator<F> { f: F, } // @has 'fn_bound/struct.ConditionalIterator.html' '//h3[@class="code-header in-band"]' 'impl<F: Fn(&i32)> Iterator for ConditionalIterator<F>' impl<F: Fn(&i32)> Iterator for ConditionalIterator<F> { type Item = (); fn next(&mut self) -> Option<Self::Item> { todo!() } } </ins>


// Types of fields (other than the last) in a struct must be sized. FieldSized, <ins> // Only Sized types can be made into objects ObjectSized, </ins> } pub type Obligations<'tcx> = subst::VecPerParamSpace<Obligation<'tcx>>;