#[test] fn uninit_write_slice_cloned_no_drop() { <del> let rc = Rc::new(()); </del> <ins> #[derive(Clone)] struct Bomb; impl Drop for Bomb { fn drop(&mut self) { panic!("dropped a bomb! kaboom") } } </ins> let mut dst = [MaybeUninit::uninit()]; <del> let src = [rc.clone()]; </del> <ins> let src = [Bomb]; </ins> MaybeUninit::write_slice_cloned(&mut dst, &src); <del> drop(src); assert_eq!(Rc::strong_count(&rc), 2); </del> <ins> forget(src); </ins> }


check-custom-code-classes collect-trait-impls check_doc_test_visibility <ins> strip-aliased-non-local </ins> strip-hidden  (when not --document-hidden-items) strip-private  (when not --document-private-items) strip-priv-imports  (when --document-private-items)


fn check_item_safety(&self, span: Span, safety: Safety) { match self.extern_mod_safety { Some(extern_safety) => { <del> if matches!(safety, Safety::Unsafe(_) | Safety::Safe(_)) && (extern_safety == Safety::Default || !self.features.unsafe_extern_blocks) { self.dcx().emit_err(errors::InvalidSafetyOnExtern { item_span: span, block: self.current_extern_span().shrink_to_lo(), }); </del> <ins> if matches!(safety, Safety::Unsafe(_) | Safety::Safe(_)) { if extern_safety == Safety::Default { self.dcx().emit_err(errors::InvalidSafetyOnExtern { item_span: span, block: Some(self.current_extern_span().shrink_to_lo()), }); } else if !self.features.unsafe_extern_blocks { self.dcx().emit_err(errors::InvalidSafetyOnExtern { item_span: span, block: None, }); } </ins> } } None => {


pub fn accept(&self, storage: *mut sockaddr, len: *mut socklen_t) -> io::Result<Socket> { // Unfortunately the only known way right now to accept a socket and // atomically set the CLOEXEC flag is to use the `accept4` syscall on <del> // Linux. This was added in 2.6.28, however, and because we support // 2.6.18 we must detect this support dynamically. #[cfg(target_os = "linux")] { syscall! { fn accept4( fd: c_int, addr: *mut sockaddr, addr_len: *mut socklen_t, flags: c_int ) -> c_int } let res = cvt_r(|| unsafe { accept4(self.0.raw(), storage, len, libc::SOCK_CLOEXEC) }); match res { Ok(fd) => return Ok(Socket(FileDesc::new(fd))), Err(ref e) if e.raw_os_error() == Some(libc::ENOSYS) => {} Err(e) => return Err(e), </del> <ins> // Linux. This was added in 2.6.28, glibc 2.10 and musl 0.9.5. cfg_if::cfg_if! { if #[cfg(target_os = "linux")] { let fd = cvt_r(|| unsafe { libc::accept4(self.0.raw(), storage, len, libc::SOCK_CLOEXEC) })?; Ok(Socket(FileDesc::new(fd))) } else { let fd = cvt_r(|| unsafe { libc::accept(self.0.raw(), storage, len) })?; let fd = FileDesc::new(fd); fd.set_cloexec()?; Ok(Socket(fd)) </ins> } } <del> let fd = cvt_r(|| unsafe { libc::accept(self.0.raw(), storage, len) })?; let fd = FileDesc::new(fd); fd.set_cloexec()?; Ok(Socket(fd)) </del> } pub fn duplicate(&self) -> io::Result<Socket> {


<ins> - // MIR for `size_of` before ConstProp + // MIR for `size_of` after ConstProp fn size_of() -> usize { let mut _0: usize; let mut _1: usize; scope 1 { debug a => _1; } bb0: { StorageLive(_1); _1 = const 0_usize; _1 = const _; _0 = _1; StorageDead(_1); return; } } </ins>


let mut where_clause = WhereClause { id: ast::DUMMY_NODE_ID, predicates: Vec::new(), <del> span: DUMMY_SP, </del> <ins> span: self.prev_span.to(self.prev_span), </ins> }; if !self.eat_keyword(kw::Where) {


op_to_const(&ecx, field) } <del> pub fn const_caller_location<'tcx>( </del> <ins> pub(crate) fn const_caller_location<'tcx>( </ins> tcx: TyCtxt<'tcx>, (file, line, col): (Symbol, u32, u32), ) -> &'tcx ty::Const<'tcx> {


<del> //@ known-bug: rust-lang/rust#124563 use std::marker::PhantomData; pub trait Trait {} pub trait Foo { type Trait: Trait; type Bar: Bar; fn foo(&mut self); } pub struct FooImpl<'a, 'b, A: Trait>(PhantomData<&'a &'b A>); impl<'a, 'b, T> Foo for FooImpl<'a, 'b, T> where T: Trait, { type Trait = T; type Bar = BarImpl<'a, 'b, T>; fn foo(&mut self) { self.enter_scope(|ctx| { BarImpl(ctx); }); } } impl<'a, 'b, T> FooImpl<'a, 'b, T> where T: Trait, { fn enter_scope(&mut self, _scope: impl FnOnce(&mut Self)) {} } pub trait Bar { type Foo: Foo; } pub struct BarImpl<'a, 'b, T: Trait>(&'b mut FooImpl<'a, 'b, T>); impl<'a, 'b, T> Bar for BarImpl<'a, 'b, T> where T: Trait, { type Foo = FooImpl<'a, 'b, T>; } </del>


#[plugin_registrar] pub fn registrar() {} //~^ ERROR compiler plugins are experimental <del> //~| HELP add #![feature(plugin_registrar)] to the crate attributes to enable </del> fn main() {}


If you do, Rust has been installed successfully! Congrats! <del> If you don't and you're on Windows, check that Rust is in your %PATH% system variable: `$ echo %PATH%`. If it isn't, run the installer again, select "Change" on the "Change, repair, or remove installation" page and ensure "Add to PATH" is installed on the local hard drive.  If you need to configure your path manually, you can find the Rust executables in a directory like `"C:Program FilesRust stable GNU 1.xbin"`. </del> <ins> If you don't, that probably means that the `PATH` environment variable doesn't include Cargo's binary directory, `~/.cargo/bin` on Unix, or `%USERPROFILE%.cargobin` on Windows. This is the directory where Rust development tools live, and most Rust developers keep it in their `PATH` environment variable, which makes it possible to run `rustc` on the command line. Due to differences in operating systems, command shells, and bugs in installation, you may need to restart your shell, log out of the system, or configure `PATH` manually as appropriate for your operating environment. </ins> Rust does not do its own linking, and so you’ll need to have a linker installed. Doing so will depend on your specific system. For


<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. #![deny(unnecessary_extern_crate)] #![feature(alloc, test, libc)] extern crate alloc; //~^ ERROR `extern crate` is unnecessary in the new edition //~| HELP remove extern crate alloc as x; //~^ ERROR `extern crate` is unnecessary in the new edition //~| HELP use `use` #[macro_use] extern crate test; pub extern crate test as y; //~^ ERROR `extern crate` is unnecessary in the new edition //~| HELP use `pub use` pub extern crate libc; //~^ ERROR `extern crate` is unnecessary in the new edition //~| HELP use `pub use` mod foo { extern crate alloc; //~^ ERROR `extern crate` is unnecessary in the new edition //~| HELP use `use` extern crate alloc as x; //~^ ERROR `extern crate` is unnecessary in the new edition //~| HELP use `use` pub extern crate test; //~^ ERROR `extern crate` is unnecessary in the new edition //~| HELP use `pub use` pub extern crate test as y; //~^ ERROR `extern crate` is unnecessary in the new edition //~| HELP use `pub use` mod bar { extern crate alloc; //~^ ERROR `extern crate` is unnecessary in the new edition //~| HELP use `use` extern crate alloc as x; //~^ ERROR `extern crate` is unnecessary in the new edition //~| HELP use `use` } } fn main() {} </ins>


<ins> // run-pass #![feature(inline_const)] // Makes sure we don't propagate generic instances of `Self: ?Sized` blanket impls. // This is relevant when we have an overlapping impl and builtin dyn instance. // See <https://github.com/rust-lang/rust/pull/114941> for more context. trait Trait { fn foo(&self) -> &'static str; } impl<T: ?Sized> Trait for T { fn foo(&self) -> &'static str { std::any::type_name::<T>() } } fn bar<T: ?Sized>() -> fn(&T) -> &'static str { const { Trait::foo as fn(&T) -> &'static str } // If const prop were to propagate the instance } fn main() { assert_eq!("i32", bar::<dyn Trait>()(&1i32)); } </ins>


_ => unreachable!(), }; <del> write_or_print(&out, ofile); </del> <ins> write_or_print(&out, ofile, tcx.sess); </ins> Ok(()) }


<ins> fn main() { while let 1 = 1 { vec![].last_mut().unwrap() = 3_u8; //~^ ERROR invalid left-hand side of assignment } } </ins>


use std::cell::Cell; use std::mem; <del> use std::ops::{Deref, DerefMut}; </del> /// Type lambda application, with a lifetime. #[allow(unused_lifetimes)]


#![feature(plugin, custom_attribute)] #![plugin(lint_for_crate)] #![crate_okay] <ins> #![crate_blue] #![crate_red] #![crate_grey] #![crate_green] </ins> pub fn main() { }


_ => false, } } <ins> pub fn is_known_rigid(self) -> bool { match self.kind() { Bool | Char | Int(_) | Uint(_) | Float(_) | Adt(_, _) | Foreign(_) | Str | Array(_, _) | Slice(_) | RawPtr(_) | Ref(_, _, _) | FnDef(_, _) | FnPtr(_) | Dynamic(_, _, _) | Closure(_, _) | Generator(_, _, _) | GeneratorWitness(_) | GeneratorWitnessMIR(_, _) | Never | Tuple(_) => true, Error(_) | Infer(_) | Alias(_, _) | Param(_) | Bound(_, _) | Placeholder(_) => false, } } </ins> } /// Extra information about why we ended up with a particular variance.


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


.enumerate() .skip(1) // Remove `Self` for `ExistentialPredicate`. .map(|(index, arg)| { <del> if let ty::GenericArgKind::Type(ty) = arg.unpack() { debug!(?ty); if ty == dummy_self { let param = &generics.params[index]; missing_type_params.push(param.name); tcx.ty_error().into() } else if ty.walk().any(|arg| arg == dummy_self.into()) { references_self = true; tcx.ty_error().into() } else { arg } } else { arg </del> <ins> if arg == dummy_self.into() { let param = &generics.params[index]; missing_type_params.push(param.name); return tcx.ty_error().into(); } else if arg.walk().any(|arg| arg == dummy_self.into()) { references_self = true; return tcx.ty_error().into(); </ins> } <ins> arg </ins> }) .collect(); let substs = tcx.intern_substs(&substs[..]);


// of  the function signature. In our example, the GAT in the return // type is `<Self as LendingIterator>::Item<'a>`, so 'a and Self are arguments. let (regions, types) = <del> GATSubstCollector::visit(trait_item.def_id.to_def_id(), sig.output()); </del> <ins> GATSubstCollector::visit(tcx, trait_item.def_id.to_def_id(), sig.output()); </ins> // If both regions and types are empty, then this GAT isn't in the // return type, and we shouldn't try to do clause analysis


/// Parses the fields of a struct-like pattern. fn parse_pat_fields(&mut self) -> PResult<'a, (ThinVec<PatField>, PatFieldsRest)> { <del> let mut fields = ThinVec::new(); </del> <ins> let mut fields: ThinVec<PatField> = ThinVec::new(); </ins> let mut etc = PatFieldsRest::None; let mut ate_comma = true; let mut delayed_err: Option<Diag<'a>> = None;


```text #[cfg(all(target_os = "wasi", target_env = "p2"))] ``` <ins> ## Enabled WebAssembly features The default set of WebAssembly features enabled for compilation is currently the same as [`wasm32-unknown-unknown`](./wasm32-unknown-unknown.md). See the documentation there for more information. </ins>


// Get the arguments for the found method, only specifying that `Self` is the receiver type. let Some(possible_rcvr_ty) = typeck_results.node_type_opt(rcvr.hir_id) else { return }; let args = GenericArgs::for_item(tcx, method_def_id, |param, _| { <del> if param.index == 0 { </del> <ins> if let ty::GenericParamDefKind::Lifetime = param.kind { tcx.lifetimes.re_erased.into() } else if param.index == 0 && param.name == kw::SelfUpper { </ins> possible_rcvr_ty.into() } else if param.index == closure_param.index { closure_ty.into()


Ident::new(keywords::SelfLower.name(), new_span) ), kind: ast::UseTreeKind::Simple( <del> Some(Ident::new(keywords::Underscore.name().gensymed(), new_span)), </del> <ins> Some(Ident::new(Name::gensym("__dummy"), new_span)), </ins> ast::DUMMY_NODE_ID, ast::DUMMY_NODE_ID, ),


fn visit(&mut self, span: Span, value: impl TypeVisitable<TyCtxt<'tcx>>) -> Self::Result; } <ins> #[instrument(level = "trace", skip(tcx, visitor))] </ins> pub fn walk_types<'tcx, V: SpannedTypeVisitor<'tcx>>( tcx: TyCtxt<'tcx>, item: LocalDefId,


for field in fields { let use_ctxt = field.ident.span; let index = self.tcx.field_index(field.hir_id, self.tables); <del> self.check_field(use_ctxt, field.span, adt, &variant.fields[index]); </del> <ins> self.check_field(use_ctxt, field.span, adt, &variant.fields[index], false); </ins> } } _ => {}


let link_meta = self.link_meta; let is_proc_macro = tcx.sess.crate_types.borrow().contains(&CrateTypeProcMacro); let root = self.lazy(&CrateRoot { <del> rustc_version: rustc_version(), </del> name: link_meta.crate_name, triple: tcx.sess.opts.target_triple.clone(), hash: link_meta.crate_hash,


<ins> // check-pass #![feature(type_alias_impl_trait)] fn opaque<'a: 'a>() -> impl Sized {} fn assert_static<T: 'static>(_: T) {} fn test_closure() { let closure = |_| { assert_static(opaque()); }; closure(&opaque()); } type Opaque<'a> = impl Sized; fn define<'a>() -> Opaque<'a> {} fn test_tait(_: &Opaque<'_>) { None::<&'static Opaque<'_>>; } fn main() {} </ins>


unstable("linker", |o| { o.optopt("", "linker", "linker used for building executable test code", "PATH") }), <ins> unstable("sort-modules-by-appearance", |o| { o.optflag("", "sort-modules-by-appearance", "sort modules by where they appear in the  program, rather than alphabetically") }), </ins> ] }


/// For most cases with placeholders, this function will return `None`. /// /// See [`fmt::Arguments::as_str`] for details. <del> #[unstable(feature = "panic_info_message", issue = "66745")] </del> <ins> #[stable(feature = "panic_info_message", since = "CURRENT_RUSTC_VERSION")] </ins> #[rustc_const_unstable(feature = "const_arguments_as_str", issue = "103900")] #[must_use] #[inline]


<del> //@ known-bug: #124342 trait Trait2 : Trait { reuse <() as Trait>::async { (async || {}).await; }; } </del>


.filter(|item| matches!(item.kind, ty::AssocKind::Fn) && !item.fn_has_self_parameter) .filter_map(|item| { // Only assoc fns that return `Self`, `Option<Self>` or `Result<Self, _>`. <del> let ret_ty = self.tcx.fn_sig(item.def_id).skip_binder().output(); </del> <ins> let ret_ty = self .tcx .fn_sig(item.def_id) .instantiate(self.tcx, self.fresh_args_for_item(DUMMY_SP, item.def_id)) .output(); </ins> let ret_ty = self.tcx.instantiate_bound_regions_with_erased(ret_ty); let ty::Adt(def, args) = ret_ty.kind() else { return None;


// For additional insurance via fuzzing and crater, we verify that the constraint's min // choice indeed escapes the function. In the future, we could e.g. turn this check into // a debug assert and early return as an optimization. <ins> let scc = sccs.scc(successor); </ins> for constraint in self.regioncx.applied_member_constraints(scc) { if universal_regions.is_universal_region(constraint.min_choice) { return;


T: Iterator<Item = &'a Symbol>, { let max_dist = dist.map_or_else(|| cmp::max(lookup.len(), 3) / 3, |d| d); <ins> let name_vec: Vec<&Symbol> = iter_names.collect(); </ins> <del> let (case_insensitive_match, levenstein_match) = iter_names </del> <ins> let (case_insensitive_match, levenshtein_match) = name_vec .iter() </ins> .filter_map(|&name| { let dist = lev_distance(lookup, &name.as_str()); if dist <= max_dist { Some((name, dist)) } else { None } }) // Here we are collecting the next structure: <del> // (case_insensitive_match, (levenstein_match, levenstein_distance)) </del> <ins> // (case_insensitive_match, (levenshtein_match, levenshtein_distance)) </ins> .fold((None, None), |result, (candidate, dist)| { ( if candidate.as_str().to_uppercase() == lookup.to_uppercase() {


<del> // no-prefer-dynamic </del> #![allow(dead_code)] // check dtor calling order when casting enums.


// Will be filed with the root position after encoding everything. cursor.write_all(&[0, 0, 0, 0]).unwrap(); <del> let root = EncodeContext { </del> <ins> let root = { let mut ecx = EncodeContext { </ins> opaque: opaque::Encoder::new(&mut cursor), tcx: tcx, reexports: reexports,


#![feature(maybe_uninit_uninit_array)] #![feature(maybe_uninit_write_slice)] #![feature(panic_can_unwind)] <del> #![feature(panic_info_message)] </del> #![feature(panic_internals)] #![feature(pointer_is_aligned_to)] #![feature(portable_simd)]


fn visit_assign(&mut self, place: &Place<'tcx>, rvalue: &Rvalue<'tcx>, location: Location) { self.super_assign(place, rvalue, location); <del> let Some(()) = self.check_rvalue(rvalue) else { return }; </del> <ins> let Some(()) = self.check_rvalue(rvalue) else { trace!("rvalue check failed, removing const"); Self::remove_const(&mut self.ecx, place.local); return; }; </ins> match self.ecx.machine.can_const_prop[place.local] { // Do nothing if the place is indirect.


/// # Examples /// /// ```no_run <del> /// #![feature(rw_exact_all_at)] </del> /// use std::fs::File; /// use std::io; /// use std::os::unix::prelude::FileExt;


pure fn ne(other: &Dest) -> bool { !self.eq(other) } } <ins> fn drop_and_cancel_clean(dat: Datum, bcx: block) -> block { let bcx = dat.drop_val(bcx); dat.cancel_clean(bcx); return bcx; } </ins> fn trans_to_datum(bcx: block, expr: @ast::expr) -> DatumBlock { debug!("trans_to_datum(expr=%s)", bcx.expr_to_str(expr));


// Check timestamps. let mut inputs = inputs.clone(); <del> inputs.add_path(&testpaths.file); </del> <ins> // Use `add_dir` to account for run-make tests, which use their individual directory inputs.add_dir(&testpaths.file); </ins> for aux in &props.aux { let path = testpaths.file.parent().unwrap().join("auxiliary").join(aux);


} fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> { <ins> // This prevents miri from being built for "dist" or "install" // on the stable/beta channels. It is a nightly-only tool and should // not be included. if !builder.build.unstable_features() { return None; } </ins> let compiler = self.compiler; let target = self.target; assert!(builder.config.extended);


return; } <del> let t = cx.tables.expr_ty(&expr); let type_permits_lack_of_use = if t.is_unit() || cx.tcx.is_ty_uninhabited_from( cx.tcx.hir().get_module_parent_by_hir_id(expr.hir_id), t) { true } else { match t.sty { ty::Adt(def, _) => check_must_use(cx, def.did, s.span, "", ""), ty::Opaque(def, _) => { let mut must_use = false; for (predicate, _) in &cx.tcx.predicates_of(def).predicates { if let ty::Predicate::Trait(ref poly_trait_predicate) = predicate { let trait_ref = poly_trait_predicate.skip_binder().trait_ref; if check_must_use(cx, trait_ref.def_id, s.span, "implementer of ", "") { must_use = true; break; } } } must_use } ty::Dynamic(binder, _) => { let mut must_use = false; for predicate in binder.skip_binder().iter() { if let ty::ExistentialPredicate::Trait(ref trait_ref) = predicate { if check_must_use(cx, trait_ref.def_id, s.span, "", " trait object") { must_use = true; break; } } } must_use } _ => false, } }; </del> <ins> let ty = cx.tables.expr_ty(&expr); let type_permits_lack_of_use = check_must_use_ty(cx, ty, &expr, s.span, ""); </ins> let mut fn_warned = false; let mut op_warned = false;


LifetimeReturnCategoryErr, RequireStaticErr, VarHereDenote, }; <del> use super::{OutlivesSuggestionBuilder, RegionName}; </del> <ins> use super::{OutlivesSuggestionBuilder, RegionName, RegionNameSource}; </ins> use crate::region_infer::{BlameConstraint, ExtraConstraintInfo}; use crate::{ nll::ConstraintDescription,


let used_link_args = &trans.crate_info.link_args; <del> if crate_type == config::CrateTypeExecutable && t.options.position_independent_executables { let empty_vec = Vec::new(); let args = sess.opts.cg.link_args.as_ref().unwrap_or(&empty_vec); let more_args = &sess.opts.cg.link_arg; let mut args = args.iter().chain(more_args.iter()).chain(used_link_args.iter()); if get_reloc_model(sess) == llvm::RelocMode::PIC && !sess.crt_static() && !args.any(|x| *x == "-static") { </del> <ins> if crate_type == config::CrateTypeExecutable { let mut position_independent_executable = false; if t.options.position_independent_executables { let empty_vec = Vec::new(); let args = sess.opts.cg.link_args.as_ref().unwrap_or(&empty_vec); let more_args = &sess.opts.cg.link_arg; let mut args = args.iter().chain(more_args.iter()).chain(used_link_args.iter()); if get_reloc_model(sess) == llvm::RelocMode::PIC && !sess.crt_static() && !args.any(|x| *x == "-static") { position_independent_executable = true; } } if position_independent_executable { </ins> cmd.position_independent_executable(); <ins> } else { // recent versions of gcc can be configured to generate position // independent executables by default. We have to pass -no-pie to // explicitly turn that off. if sess.target.target.options.linker_is_gnu { cmd.no_position_independent_executable(); } </ins> } }


Some(ExpectedSig { cause_span, sig }) } <ins> /// When an async closure is passed to a function that has a "two-part" `Fn` /// and `Future` trait bound, like: /// /// ```rust /// use std::future::Future; /// /// fn not_exactly_an_async_closure<F, Fut>(_f: F) /// where ///     F: FnOnce(String, u32) -> Fut, ///     Fut: Future<Output = i32>, /// {} /// ``` /// /// The we want to be able to extract the signature to guide inference in the async /// closure. We will have two projection predicates registered in this case. First, /// we identify the `FnOnce<Args, Output = ?Fut>` bound, and if the output type is /// an inference variable `?Fut`, we check if that is bounded by a `Future<Output = Ty>` /// projection. fn extract_sig_from_projection_and_future_bound( &self, cause_span: Option<Span>, projection: ty::PolyProjectionPredicate<'tcx>, ) -> Option<ExpectedSig<'tcx>> { let projection = self.resolve_vars_if_possible(projection); let arg_param_ty = projection.skip_binder().projection_term.args.type_at(1); debug!(?arg_param_ty); let ty::Tuple(input_tys) = *arg_param_ty.kind() else { return None; }; // If the return type is a type variable, look for bounds on it. // We could theoretically support other kinds of return types here, // but none of them would be useful, since async closures return // concrete anonymous future types, and their futures are not coerced // into any other type within the body of the async closure. let ty::Infer(ty::TyVar(return_vid)) = *projection.skip_binder().term.expect_type().kind() else { return None; }; // FIXME: We may want to elaborate here, though I assume this will be exceedingly rare. for bound in self.obligations_for_self_ty(return_vid) { if let Some(ret_projection) = bound.predicate.as_projection_clause() && let Some(ret_projection) = ret_projection.no_bound_vars() && self.tcx.is_lang_item(ret_projection.def_id(), LangItem::FutureOutput) { let sig = projection.rebind(self.tcx.mk_fn_sig( input_tys, ret_projection.term.expect_type(), false, hir::Safety::Safe, Abi::Rust, )); return Some(ExpectedSig { cause_span, sig }); } } None } </ins> fn sig_of_closure( &self, expr_def_id: LocalDefId,


} else { LifetimeUseSet::Many }), <del> LifetimeRibKind::Generics { .. } => None, LifetimeRibKind::ConstGeneric | LifetimeRibKind::AnonConst => { </del> <ins> LifetimeRibKind::Generics { .. } | LifetimeRibKind::ConstGeneric => None, LifetimeRibKind::AnonConst => { </ins> span_bug!(ident.span, "unexpected rib kind: {:?}", rib.kind) } })


Level::Cancelled => { false } <del> }; self.handler.emit_db(&self); self.cancel(); if is_error { self.handler.bump_err_count(); </del> } <del> // if self.is_fatal() { //     panic!(FatalError); // } </del> } /// Convenience function for internal use, clients should use one of the


<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. #[allow(dead_code)] fn check(a: &str) { let x = a as *const str; x == x; } fn main() {} </ins>


without modifying the original"] #[inline] #[track_caller] <del> #[rustc_inherit_overflow_checks] #[allow(arithmetic_overflow)] </del> pub const fn ilog2(self) -> u32 { <del> match self.checked_ilog2() { Some(n) => n, None => { // In debug builds, trigger a panic on None. // This should optimize completely out in release builds. let _ = Self::MAX + 1; 0 }, } </del> <ins> self.checked_ilog2().expect("argument of integer logarithm must be positive") </ins> } /// Returns the base 10 logarithm of the number, rounded down. /// /// # Panics /// <del> /// When the number is zero it panics in debug mode and the /// return value is 0 in release mode. </del> <ins> /// This function will panic if `self` is zero. </ins> /// /// # Example ///


|                  ^^^^^^^^^^^^^^^^^^^^^^^ error: this lint expectation is unfulfilled <ins> --> tests/ui/expect_tool_lint_rfc_2383.rs:36:18 | LL |         #[expect(invalid_nan_comparisons)] |                  ^^^^^^^^^^^^^^^^^^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: this lint expectation is unfulfilled </ins> --> tests/ui/expect_tool_lint_rfc_2383.rs:107:14 | LL |     #[expect(clippy::almost_swapped)]


fn clone(&self) -> Self { *self } } <del> fn main() { let one = (Some(Packed((&(), 0))), true); </del> <ins> fn sanity_check_size<T: Copy>(one: T) { </ins> let two = [one, one]; let stride = (&two[1] as *const _ as usize) - (&two[0] as *const _ as usize); <ins> assert_eq!(stride, std::mem::size_of_val(&one)); } fn main() { </ins> // This can fail if rustc and LLVM disagree on the size of a type. // In this case, `Option<Packed<(&(), u32)>>` was erronously not // marked as packed despite needing alignment `1` and containing // its `&()` discriminant, which has alignment larger than `1`. <del> assert_eq!(stride, std::mem::size_of_val(&one)); </del> <ins> sanity_check_size((Some(Packed((&(), 0))), true)); // In #46769, `Option<(Packed<&()>, bool)>` was found to have // pointer alignment, without actually being aligned in size. // E.g. on 64-bit platforms, it had alignment `8` but size `9`. sanity_check_size(Some((Packed(&()), true))); </ins> }


<ins> // compile-flags: --test --persist-doctests /../../ -Z unstable-options // failure-status: 101 // only-linux #![crate_name = "foo"] //! ```rust //! use foo::dummy; //! dummy(); //! ``` </ins>


#![feature(const_int_unchecked_arith)] #![feature(const_mut_refs)] #![feature(const_refs_to_cell)] <del> #![feature(const_cttz)] </del> #![feature(const_panic)] #![feature(const_pin)] #![feature(const_fn)]


<ins> // Copyright 2017 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // ignore-windows // ignore-tidy-linelength // compile-flags: -g -C metadata=foo -C no-prepopulate-passes // aux-build:xcrate-generic.rs #![crate_type = "lib"] extern crate xcrate_generic; pub fn foo() { xcrate_generic::foo::<u32>(); } // Here we check that local debuginfo is mapped correctly. // CHECK: !DIFile(filename: "/the/aux-src/xcrate-generic.rs", directory: "") </ins>


tmp } } <del> } </del> <ins> }; // Trailing comma with single argument is ignored ($val:expr,) => { dbg!($val) }; ($($val:expr),+ $(,)?) => { ($(dbg!($val)),+,) }; </ins> } /// Awaits the completion of an async call.


<ins> // Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. #![feature(core)] extern crate core; use core::marker::Sync; static SARRAY: [i32; 1] = [11]; struct MyStruct { pub arr: *const [i32], } unsafe impl Sync for MyStruct {} static mystruct: MyStruct = MyStruct { arr: &SARRAY }; fn main() {} </ins>


// If a string was expected and the found expression is a character literal, // perhaps the user meant to write `"s"` to specify a string literal. (ty::Ref(_, r, _), ty::Char) if r.is_str() => { <del> suggestions.push(TypeErrorAdditionalDiags::MeantStrLiteral { start: span.with_hi(span.lo() + BytePos(1)), end: span.with_lo(span.hi() - BytePos(1)), }) </del> <ins> if let Ok(code) = self.tcx.sess().source_map().span_to_snippet(span) && code.starts_with("'") && code.ends_with("'") { suggestions.push(TypeErrorAdditionalDiags::MeantStrLiteral { start: span.with_hi(span.lo() + BytePos(1)), end: span.with_lo(span.hi() - BytePos(1)), }); } </ins> } // For code `if Some(..) = expr `, the type mismatch may be expected `bool` but found `()`, // we try to suggest to add the missing `let` for `if let Some(..) = expr`


<ins> // compile-flags: -Zsave-analysis // Check that this doesn't ICE when processing associated const (type). fn func() { trait Trait { type MyType; const CONST: Self::MyType = bogus.field; //~ ERROR cannot find value `bogus` } } fn main() {} </ins>


return Ok(()); } <del> let param_env = tcx.param_env(impl_ty.def_id); </del> // Given // // impl<A, B> Foo<u32> for (A, B) {


<del> //@ known-bug: #116308 #![feature(adt_const_params)] pub trait Identity { type Identity; } impl<T> Identity for T { type Identity = Self; } pub fn foo<const X: <i32 as Identity>::Identity>() {} fn main() { foo::<12>(); } </del>


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


if tcx.fn_sig(did).skip_binder().abi() == RustIntrinsic && tcx.item_name(did) == sym::transmute { <del> let from = fn_sig.inputs().skip_binder()[0]; </del> <ins> let Some(from) = fn_sig.inputs().skip_binder().get(0) else { let e = self.dcx().span_delayed_bug( tcx.def_span(did), "intrinsic fn `transmute` defined with no parameters", ); self.set_tainted_by_errors(e); return Ty::new_error(tcx, e); }; </ins> let to = fn_sig.output().skip_binder(); // We defer the transmute to the end of typeck, once all inference vars have // been resolved or we errored. This is important as we can only check transmute // on concrete types, but the output type may not be known yet (it would only // be known if explicitly specified via turbofish). <del> self.deferred_transmute_checks.borrow_mut().push((from, to, expr.hir_id)); </del> <ins> self.deferred_transmute_checks.borrow_mut().push((*from, to, expr.hir_id)); </ins> } if !tcx.features().unsized_fn_params { // We want to remove some Sized bounds from std functions,


cargo, rustc, rustfmt, <ins> cargo_clippy, </ins> docs, compiler_docs, library_docs_private_items,


[[package]] name = "racer" <del> version = "2.1.48" </del> <ins> version = "2.2.0" </ins> source = "registry+https://github.com/rust-lang/crates.io-index" <del> checksum = "7fec2e85e7a30f8fd31b7cf288ad363b5e51fd2cb6f53b416b0cfaabd84e1ccb" </del> <ins> checksum = "b0b4b5faaf07040474e8af74a9e19ff167d5d204df5db5c5c765edecfb900358" </ins> dependencies = [ "bitflags", "clap 2.34.0",


impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> { fn visit_local(&mut self, local: &Local, context: PlaceContext, location: Location) { <ins> if self.body.local_decls.get(*local).is_none() { self.fail( location, format!("local {:?} has no corresponding declaration in `body.local_decls`", local), ); } </ins> if self.reachable_blocks.contains(location.block) && context.is_use() { // Uses of locals must occur while the local's storage is allocated. self.storage_liveness.seek_after_primary_effect(location);


<del> Subproject commit 5d967343acae16fd7b53a61e6cd4e93a1ac6f199 </del> <ins> Subproject commit 569507ef2beefcce4b666af41e09276f06445e96 </ins>


use super::*; <ins> use rustc_span::source_map::DUMMY_SP; fn create_doc_fragment(s: &str) -> Vec<DocFragment> { vec![DocFragment { line: 0, span: DUMMY_SP, parent_module: None, doc: s.to_string(), kind: DocFragmentKind::SugaredDoc, }] } #[track_caller] fn run_test(input: &str, expected: &str) { let mut s = create_doc_fragment(input); unindent_fragments(&mut s); assert_eq!(s[0].doc, expected); } </ins> #[test] fn should_unindent() { <del> let s = "    line1n    line2".to_string(); let r = unindent(&s); assert_eq!(r, "line1nline2"); </del> <ins> run_test("    line1n    line2", "line1nline2"); </ins> } #[test] fn should_unindent_multiple_paragraphs() { <del> let s = "    line1nn    line2".to_string(); let r = unindent(&s); assert_eq!(r, "line1nnline2"); </del> <ins> run_test("    line1nn    line2", "line1nnline2"); </ins> } #[test] fn should_leave_multiple_indent_levels() { // Line 2 is indented another level beyond the // base indentation and should be preserved <del> let s = "    line1nn        line2".to_string(); let r = unindent(&s); assert_eq!(r, "line1nn    line2"); </del> <ins> run_test("    line1nn        line2", "line1nn    line2"); </ins> } #[test] fn should_ignore_first_line_indent() { <del> // The first line of the first paragraph may not be indented as // far due to the way the doc string was written: // // #[doc = "Start way over here //          and continue here"] let s = "line1n    line2".to_string(); let r = unindent(&s); assert_eq!(r, "line1nline2"); </del> <ins> run_test("line1n    line2", "line1n    line2"); </ins> } #[test] fn should_not_ignore_first_line_indent_in_a_single_line_para() { <del> let s = "line1nn    line2".to_string(); let r = unindent(&s); assert_eq!(r, "line1nn    line2"); </del> <ins> run_test("line1nn    line2", "line1nn    line2"); </ins> } #[test] fn should_unindent_tabs() { <del> let s = "tline1ntline2".to_string(); let r = unindent(&s); assert_eq!(r, "line1nline2"); </del> <ins> run_test("tline1ntline2", "line1nline2"); </ins> } #[test] fn should_trim_mixed_indentation() { <del> let s = "t    line1nt    line2".to_string(); let r = unindent(&s); assert_eq!(r, "line1nline2"); let s = "    tline1n    tline2".to_string(); let r = unindent(&s); assert_eq!(r, "line1nline2"); </del> <ins> run_test("t    line1nt    line2", "line1nline2"); run_test("    tline1n    tline2", "line1nline2"); </ins> } #[test] fn should_not_trim() { <del> let s = "t    line1  nt    line2".to_string(); let r = unindent(&s); assert_eq!(r, "line1  nline2"); let s = "    tline1  n    tline2".to_string(); let r = unindent(&s); assert_eq!(r, "line1  nline2"); </del> <ins> run_test("t    line1  nt    line2", "line1  nline2"); run_test("    tline1  n    tline2", "line1  nline2"); </ins> }


<ins> error[E0261]: use of undeclared lifetime name `'missing` --> $DIR/missing-lt-outlives-in-rpitit-114274.rs:8:55 | LL |     fn iter(&self) -> impl Iterator<Item = Self::Item<'missing>>; |                                                       ^^^^^^^^ undeclared lifetime | = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html help: consider making the bound lifetime-generic with a new `'missing` lifetime | LL |     fn iter(&self) -> impl for<'missing> Iterator<Item = Self::Item<'missing>>; |                            +++++++++++++ help: consider introducing lifetime `'missing` here | LL |     fn iter<'missing>(&self) -> impl Iterator<Item = Self::Item<'missing>>; |            ++++++++++ help: consider introducing lifetime `'missing` here | LL | trait Iterable<'missing> { |               ++++++++++ error: aborting due to previous error For more information about this error, try `rustc --explain E0261`. </ins>


| PathSource::Struct | PathSource::TupleStruct(..) => false, }; <del> let mut error = false; </del> <ins> let mut res = LifetimeRes::Error; </ins> for rib in self.lifetime_ribs.iter().rev() { match rib.kind { // In create-parameter mode we error here because we don't want to support


let lo = self.token.span; if !self.eat(&token::OpenDelim(token::Brace)) { <del> let sp = self.token.span; let tok = self.this_token_descr(); let mut e = self.span_fatal(sp, &format!("expected `{{`, found {}", tok)); let do_not_suggest_help = self.token.is_keyword(kw::In) || self.token == token::Colon; if self.token.is_ident_named(sym::and) { e.span_suggestion_short( self.token.span, "use `&&` instead of `and` for the boolean operator", "&&".to_string(), Applicability::MaybeIncorrect, ); } if self.token.is_ident_named(sym::or) { e.span_suggestion_short( self.token.span, "use `||` instead of `or` for the boolean operator", "||".to_string(), Applicability::MaybeIncorrect, ); } </del> <ins> return self.error_block_no_opening_brace(); } </ins> <del> // Check to see if the user has written something like // //    if (cond) //      bar; // // which is valid in other languages, but not Rust. match self.parse_stmt_without_recovery(false) { Ok(Some(stmt)) => { if self.look_ahead(1, |t| t == &token::OpenDelim(token::Brace)) || do_not_suggest_help { // If the next token is an open brace (e.g., `if a b {`), the place- // inside-a-block suggestion would be more likely wrong than right. e.span_label(sp, "expected `{`"); return Err(e); } let mut stmt_span = stmt.span; // Expand the span to include the semicolon, if it exists. if self.eat(&token::Semi) { stmt_span = stmt_span.with_hi(self.prev_span.hi()); } if let Ok(snippet) = self.span_to_snippet(stmt_span) { e.span_suggestion( stmt_span, "try placing this code inside a block", format!("{{ {} }}", snippet), // Speculative; has been misleading in the past (#46836). Applicability::MaybeIncorrect, ); } </del> <ins> self.parse_block_tail(lo, BlockCheckMode::Default) } fn error_block_no_opening_brace<T>(&mut self) -> PResult<'a, T> { let sp = self.token.span; let tok = self.this_token_descr(); let mut e = self.span_fatal(sp, &format!("expected `{{`, found {}", tok)); let do_not_suggest_help = self.token.is_keyword(kw::In) || self.token == token::Colon; if self.token.is_ident_named(sym::and) { e.span_suggestion_short( self.token.span, "use `&&` instead of `and` for the boolean operator", "&&".to_string(), Applicability::MaybeIncorrect, ); } if self.token.is_ident_named(sym::or) { e.span_suggestion_short( self.token.span, "use `||` instead of `or` for the boolean operator", "||".to_string(), Applicability::MaybeIncorrect, ); } // Check to see if the user has written something like // //    if (cond) //      bar; // // which is valid in other languages, but not Rust. match self.parse_stmt_without_recovery(false) { Ok(Some(stmt)) => { if self.look_ahead(1, |t| t == &token::OpenDelim(token::Brace)) || do_not_suggest_help { // If the next token is an open brace (e.g., `if a b {`), the place- // inside-a-block suggestion would be more likely wrong than right. e.span_label(sp, "expected `{`"); return Err(e); </ins> } <del> Err(mut e) => { self.recover_stmt_(SemiColonMode::Break, BlockMode::Ignore); e.cancel(); </del> <ins> let stmt_span = if self.eat(&token::Semi) { // Expand the span to include the semicolon. stmt.span.with_hi(self.prev_span.hi()) } else { stmt.span }; if let Ok(snippet) = self.span_to_snippet(stmt_span) { e.span_suggestion( stmt_span, "try placing this code inside a block", format!("{{ {} }}", snippet), // Speculative; has been misleading in the past (#46836). Applicability::MaybeIncorrect, ); </ins> } <del> _ => () </del> } <del> e.span_label(sp, "expected `{`"); return Err(e); </del> <ins> Err(mut e) => { self.recover_stmt_(SemiColonMode::Break, BlockMode::Ignore); e.cancel(); } _ => {} </ins> } <del> self.parse_block_tail(lo, BlockCheckMode::Default) </del> <ins> e.span_label(sp, "expected `{`"); return Err(e); </ins> } /// Parses a block. Inner attributes are allowed.


<ins> // revisions: imported unimported //[imported] check-pass </ins> mod private { pub trait Future { <ins> //[unimported]~^^ HELP perhaps add a `use` for it </ins> fn wait(&self) where Self: Sized; }


{ // When the suggested binding change would be from `x` to `_x`, suggest changing the // original binding definition instead. (#60164) <del> (span, snippet, ", consider changing it") </del> <ins> let post = format!(", consider renaming `{}` into `{snippet}`", suggestion.candidate); (span, snippet, post) </ins> } else { <del> (span, suggestion.candidate.to_string(), "") </del> <ins> (span, suggestion.candidate.to_string(), String::new()) </ins> }; let msg = match suggestion.target { SuggestionTarget::SimilarlyNamed => format!(


<ins> error: this operation will panic at runtime --> $DIR/unconditional_panic_98444.rs:6:13 | LL |     let _ = xs[7]; |             ^^^^^ index out of bounds: the length is 5 but the index is 7 | = note: `#[deny(unconditional_panic)]` on by default error: aborting due to previous error </ins>


<ins> // run-pass // Makes sure we don't propagate generic instances of `Self: ?Sized` blanket impls. // This is relevant when we have an overlapping impl and builtin dyn instance. // See <https://github.com/rust-lang/rust/pull/114941> for more context. trait Trait { fn foo(&self) -> &'static str; } impl<T: ?Sized> Trait for T { fn foo(&self) -> &'static str { std::any::type_name::<T>() } } const fn bar<T: ?Sized>() -> fn(&T) -> &'static str { Trait::foo // If const prop were to propagate the instance } fn main() { assert_eq!("i32", bar::<dyn Trait>()(&1i32)); } </ins>


let snippet = cx .sess() .source_map() <del> .span_to_snippet(span_of_attrs(attrs)) </del> <ins> .span_to_snippet(span_of_attrs(attrs)?) </ins> .ok()?; let starting_line = markdown[..md_range.start].matches('n').count();


let pred = trait_ref.without_const().to_predicate(tcx).to_string(); let pred = pred.replace(&impl_trait_str, &type_param_name); let mut sugg = vec![ <ins> // Find the last of the generic parameters contained within the span of // the generics </ins> match generics .params .iter() <del> .filter(|p| match p.kind { hir::GenericParamKind::Type { synthetic: Some(hir::SyntheticTyParamKind::ImplTrait), .. } => false, _ => true, }) .last() </del> <ins> .map(|p| p.bounds_span().unwrap_or(p.span)) .filter(|&span| generics.span.contains(span) && span.desugaring_kind().is_none()) .max_by_key(|span| span.hi()) </ins> { // `fn foo(t: impl Trait)` //        ^ suggest `<T: Trait>` here None => (generics.span, format!("<{}>", type_param)), // `fn foo<A>(t: impl Trait)` //        ^^^ suggest `<A, T: Trait>` here <del> Some(param) => ( param.bounds_span().unwrap_or(param.span).shrink_to_hi(), format!(", {}", type_param), ), </del> <ins> Some(span) => (span.shrink_to_hi(), format!(", {}", type_param)), </ins> }, // `fn foo(t: impl Trait)` //                       ^ suggest `where <T as Trait>::A: Bound`


<ins> //! Regression test for #74400: Type mismatch in function arguments E0631, E0271 are falsely //! recognized as E0308 mismatched types. use std::convert::identity; fn main() {} fn f<T, S>(data: &[T], key: impl Fn(&T) -> S) { } fn g<T>(data: &[T]) { f(data, identity) //~ ERROR implementation of `FnOnce` is not general } </ins>


LL - fn f2<X: ?Sized, Y: ?Sized>(x: &X) { LL + fn f2<X, Y: ?Sized>(x: &X) { | <ins> help: consider borrowing here | LL |     let y: &X; |            + </ins> error[E0277]: the size for values of type `Y` cannot be known at compilation time --> $DIR/unsized6.rs:17:12


// The lifetime was defined on node that doesn't own a body, // which in practice can only mean a trait or an impl, that // is the parent of a method, and that is enforced below. <del> assert_eq!(Some(param_owner_id), self.root_parent, "free_scope: {:?} not recognized by the  region scope tree for {:?} / {:?}", param_owner, self.root_parent.map(|id| tcx.hir().local_def_id_from_hir_id(id)), self.root_body.map(|hir_id| DefId::local(hir_id.owner))); </del> <ins> if Some(param_owner_id) != self.root_parent { tcx.sess.delay_span_bug( DUMMY_SP, &format!("free_scope: {:?} not recognized by the  region scope tree for {:?} / {:?}", param_owner, self.root_parent.map(|id| tcx.hir().local_def_id_from_hir_id(id)), self.root_body.map(|hir_id| DefId::local(hir_id.owner)))); } </ins> // The trait/impl lifetime is in scope for the method's body. self.root_body.unwrap().local_id


Value(int), Missing, } <del> fn main() { let x = Value(5); let y = Missing; match x { Value(n) => println!("x is {}", n), Missing  => println!("x is missing!"), } match y { Value(n) => println!("y is {}", n), Missing  => println!("y is missing!"), } } </del> ``` This enum represents an `int` that we may or may not have. In the `Missing`


span } = *self; <del> hcx.hash_hir_item_like(attrs, |hcx| { </del> <ins> let is_const = match *node { hir::TraitItemKind::Const(..) | hir::TraitItemKind::Type(..) => true, hir::TraitItemKind::Method(hir::MethodSig { constness, .. }, _) => { constness == hir::Constness::Const } }; hcx.hash_hir_item_like(attrs, is_const, |hcx| { </ins> name.hash_stable(hcx, hasher); attrs.hash_stable(hcx, hasher); generics.hash_stable(hcx, hasher);


<ins> error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try` --> $DIR/issue-72766.rs:14:5 | LL |     SadGirl {}.call()?; |     ^^^^^^^^^^^^^^^^^^ |     | |     the `?` operator cannot be applied to type `impl std::future::Future` |     help: consider using `.await` here: `SadGirl {}.call().await?` | = help: the trait `std::ops::Try` is not implemented for `impl std::future::Future` = note: required by `std::ops::Try::into_result` error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. </ins>


--> $DIR/invalid-const-arg-for-type-param.rs:6:23 | LL |     let _: u32 = 5i32.try_into::<32>().unwrap(); <del> |                       ^^^^^^^^------ help: remove these generics |                       | |                       expected 0 generic arguments </del> <ins> |                       ^^^^^^^^ expected 0 generic arguments </ins> | note: associated function defined here, with 0 generic parameters --> $SRC_DIR/core/src/convert/mod.rs:LL:COL | LL |     fn try_into(self) -> Result<T, Self::Error>; |        ^^^^^^^^ <ins> help: consider moving this generic argument to the `TryInto` trait, which takes up to 1 argument | LL |     let _: u32 = TryInto::<32>::try_into(5i32).unwrap(); |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ help: remove these generics | LL -     let _: u32 = 5i32.try_into::<32>().unwrap(); LL +     let _: u32 = 5i32.try_into().unwrap(); | </ins> error[E0599]: no method named `f` found for struct `S` in the current scope --> $DIR/invalid-const-arg-for-type-param.rs:9:7


<ins> error[E0310]: the associated type `<impl Iterator as Iterator>::Item` may not live long enough --> $DIR/closure-in-projection-issue-97405.rs:24:5 | LL |     assert_static(opaque(async move { t; }).next()); |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `<impl Iterator as Iterator>::Item: 'static`... = note: ...so that the type `<impl Iterator as Iterator>::Item` will meet its required lifetime bounds error[E0310]: the associated type `<impl Iterator as Iterator>::Item` may not live long enough --> $DIR/closure-in-projection-issue-97405.rs:26:5 | LL |     assert_static(opaque(move || { t; }).next()); |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `<impl Iterator as Iterator>::Item: 'static`... = note: ...so that the type `<impl Iterator as Iterator>::Item` will meet its required lifetime bounds error[E0310]: the associated type `<impl Iterator as Iterator>::Item` may not live long enough --> $DIR/closure-in-projection-issue-97405.rs:28:5 | LL |     assert_static(opaque(opaque(async move { t; }).next()).next()); |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `<impl Iterator as Iterator>::Item: 'static`... = note: ...so that the type `<impl Iterator as Iterator>::Item` will meet its required lifetime bounds error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0310`. </ins>


use core::mem; use core::ops::{CoerceUnsized, Deref, DerefMut}; use core::ops::{Placer, Boxed, Place, InPlace, BoxPlace}; <del> use core::ptr::Unique; </del> <ins> use core::ptr::{self, Unique}; </ins> use core::raw::{TraitObject}; /// A value that represents the heap. This is the default place that the `box`


// Create the intermediate directories let mut cur = self.dst.clone(); let mut root_path = String::from_str("../../"); <del> clean_srcpath(&self.cx.src_root, &p, |component| { </del> <ins> clean_srcpath(&self.cx.src_root, &p, false, |component| { </ins> cur.push(component); mkdir(&cur).unwrap(); root_path.push_str("../");


<ins> pub trait Foo { type Type; } pub struct Bar<T>(<Self as Foo>::Type) where Self: ; //~^ ERROR the trait bound `Bar<T>: Foo` is not satisfied fn main() {} </ins>


HTML_DEPS := endif <del> # Check for the various external utilities for the EPUB/PDF docs: ifeq ($(CFG_LUALATEX),) $(info cfg: no lualatex found, deferring to xelatex) ifeq ($(CFG_XELATEX),) $(info cfg: no xelatex found, deferring to pdflatex) ifeq ($(CFG_PDFLATEX),) $(info cfg: no pdflatex found, disabling LaTeX docs) NO_PDF_DOCS = 1 else CFG_LATEX := $(CFG_PDFLATEX) endif else </del> <ins> # Check for xelatex ifeq ($(CFG_XELATEX),) </ins> CFG_LATEX := $(CFG_XELATEX) XELATEX = 1 <del> endif else CFG_LATEX := $(CFG_LUALATEX) </del> <ins> else $(info cfg: no xelatex found, disabling LaTeX docs) NO_PDF_DOCS = 1 </ins> endif ifeq ($(CFG_PANDOC),) $(info cfg: no pandoc found, omitting PDF and EPUB docs) ONLY_HTML_DOCS = 1


Some(ns @ TypeNS) => { match self.resolve( path_str, <ins> disambiguator, </ins> ns, &current_item, base_node,


| KeywordItem => [].iter(), } } <ins> /// Returns `true` if this item does not appear inside an impl block. pub(crate) fn is_non_assoc(&self) -> bool { matches!( self, StructItem(_) | UnionItem(_) | EnumItem(_) | TraitItem(_) | ModuleItem(_) | ExternCrateItem { .. } | FunctionItem(_) | TypedefItem(_) | OpaqueTyItem(_) | StaticItem(_) | ConstantItem(_) | TraitAliasItem(_) | ForeignFunctionItem(_) | ForeignStaticItem(_) | ForeignTypeItem | MacroItem(_) | ProcMacroItem(_) | PrimitiveItem(_) ) } </ins> } #[derive(Clone, Debug)]


# Find out where the pretty printer Python module is RUSTC_SYSROOT="$("$RUSTC" --print=sysroot)" GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc" <ins> # Get the commit hash for path remapping RUSTC_COMMIT_HASH="$("$RUSTC" -vV | sed -n 's/commit-hash: (w*)/1/p')" </ins> # Set the environment variable `RUST_GDB` to overwrite the call to a # different/specific command (defaults to `gdb`).


padding: 5px 10px; } h5, h6 { <del> color: black; </del> text-decoration: underline; }


fn output_filename(&mut self, path: &Path) { self.cmd.arg("-o").arg(path); } fn add_object(&mut self, path: &Path) { self.cmd.arg(path); } fn position_independent_executable(&mut self) { self.cmd.arg("-pie"); } <ins> fn no_position_independent_executable(&mut self) { self.cmd.arg("-no-pie"); } </ins> fn partial_relro(&mut self) { self.linker_arg("-z,relro"); } fn full_relro(&mut self) { self.linker_arg("-z,relro,-z,now"); } fn build_static_executable(&mut self) { self.cmd.arg("-static"); }


// We errored. Signal that in the pattern, so that follow up errors can be silenced. let kind = PatKind::Error(e); return Box::new(Pat { span: self.span, ty: cv.ty(), kind }); <ins> } else if let ty::Adt(..) = cv.ty().kind() && matches!(cv, mir::Const::Val(..)) { // This branch is only entered when the current `cv` is `mir::Const::Val`. // This is because `mir::Const::ty` has already been handled by `Self::recur` // and the invalid types may be ignored. let err = TypeNotStructural { span: self.span, non_sm_ty }; let e = self.tcx().sess.emit_err(err); let kind = PatKind::Error(e); return Box::new(Pat { span: self.span, ty: cv.ty(), kind }); </ins> } else if !self.saw_const_match_lint.get() { if let Some(mir_structural_match_violation) = mir_structural_match_violation { match non_sm_ty.kind() {


<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. #![allow(dead_code)] struct Foo; impl Foo { fn new() -> Self { Foo } fn bar() { Self::new(); } } fn main() {} </ins>


<ins> use crate::infer::outlives::components::{compute_components_recursive, Component}; </ins> use crate::infer::outlives::env::RegionBoundPairs; use crate::infer::region_constraints::VerifyIfEq; use crate::infer::{GenericKind, VerifyBound}; use rustc_data_structures::captures::Captures; use rustc_data_structures::sso::SsoHashSet; use rustc_hir::def_id::DefId; <del> use rustc_middle::ty::subst::{GenericArg, GenericArgKind, Subst}; </del> <ins> use rustc_middle::ty::subst::{GenericArg, Subst}; </ins> use rustc_middle::ty::{self, EarlyBinder, Ty, TyCtxt}; <ins> use smallvec::smallvec; </ins> /// The `TypeOutlives` struct has the job of "lowering" a `T: 'a` /// obligation into a series of `'a: 'b` constraints and "verifys", as /// described on the module comment. The final constraints are emitted


fn outer(self) { fn inner(_: Self) { //~^ ERROR can't use type parameters from outer function <del> //~^^ ERROR use of undeclared type name `Self` </del> <ins> //~^^ ERROR use of `Self` outside of an impl or trait </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. trait Foo: Sized { fn foo(self) {} } trait Bar: Sized { fn bar(self) {} } struct S; impl<'l> Foo for &'l S {} impl<T: Foo> Bar for T {} fn main() { let s = S; s.foo(); (&s).bar(); s.bar(); } </ins>


use rustc::hir::def::{Res, DefKind}; use rustc::hir::def_id::DefId; use rustc::lint; <del> use rustc::ty; </del> <ins> use rustc::ty::{self, Ty}; </ins> use rustc::ty::adjustment; use rustc_data_structures::fx::FxHashMap; use lint::{LateContext, EarlyContext, LintContext, LintArray};


#[primary_span] pub item_span: Span, #[suggestion(code = "unsafe ", applicability = "machine-applicable", style = "verbose")] <del> pub block: Span, </del> <ins> pub block: Option<Span>, </ins> } #[derive(Diagnostic)]


<ins> error: prefix `world` is unknown --> $DIR/lex-bad-str-literal-as-char-3.rs:5:21 | LL |     println!('hello world'); |                     ^^^^^ unknown prefix | = note: prefixed identifiers and literals are reserved since Rust 2021 help: if you meant to write a string literal, use double quotes | LL |     println!("hello world"); |              ~           ~ </ins> error[E0762]: unterminated character literal --> $DIR/lex-bad-str-literal-as-char-3.rs:5:26 |


<ins> error[E0631]: type mismatch in closure arguments --> $DIR/issue-41366.rs:10:5 | LL |     (&|_|()) as &dyn for<'x> Fn(<u32 as T<'x>>::V); |     ^^-----^ |     | | |     | found signature of `fn(_) -> _` |     expected signature of `for<'x> fn(<u32 as T<'x>>::V) -> _` | = note: required for the cast to the object type `dyn for<'x> std::ops::Fn(<u32 as T<'x>>::V)` error[E0271]: type mismatch resolving `for<'x> <[closure@$DIR/issue-41366.rs:10:7: 10:12] as std::ops::FnOnce<(<u32 as T<'x>>::V,)>>::Output == ()` --> $DIR/issue-41366.rs:10:5 | LL |     (&|_|()) as &dyn for<'x> Fn(<u32 as T<'x>>::V); |     ^^^^^^^^ expected bound lifetime parameter 'x, found concrete lifetime | = note: required for the cast to the object type `dyn for<'x> std::ops::Fn(<u32 as T<'x>>::V)` error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0271`. </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. // @has issue_31899/index.html // @has - 'Make this line a bit longer.' // @!has - 'rust rust-example-rendered' // @!has - 'use ndarray::arr2' // @!has - 'prohibited' /// A tuple or fixed size array that can be used to index an array. /// Make this line a bit longer. /// /// ``` /// use ndarray::arr2; /// /// let mut a = arr2(&[[0, 1], [0, 0]]); /// a[[1, 1]] = 1; /// assert_eq!(a[[0, 1]], 1); /// assert_eq!(a[[1, 1]], 1); /// ``` /// /// **Note** the blanket implementation that's not visible in rustdoc: /// `impl<D> NdIndex for D where D: Dimension { ... }` pub fn bar() {} /// Some line /// /// # prohibited pub fn foo() {} /// Some line /// /// 1. prohibited /// 2. bar pub fn baz() {} /// Some line /// /// - prohibited /// - bar pub fn qux() {} /// Some line /// /// * prohibited /// * bar pub fn quz() {} /// Some line /// /// > prohibited /// > bar pub fn qur() {} /// Some line /// /// prohibited /// ===== /// /// Second /// ------ pub fn qut() {} </ins>


<ins> error[E0277]: the trait bound `T: Clone` is not satisfied --> $DIR/global-cache-and-parallel-frontend.rs:15:17 | LL | #[derive(Clone, Eq)] |                 ^^ the trait `Clone` is not implemented for `T`, which is required by `Struct<T>: PartialEq` | note: required for `Struct<T>` to implement `PartialEq` --> $DIR/global-cache-and-parallel-frontend.rs:18:19 | LL | impl<T: Clone, U> PartialEq<U> for Struct<T> |         -----     ^^^^^^^^^^^^     ^^^^^^^^^ |         | |         unsatisfied trait bound introduced here note: required by a bound in `Eq` --> $SRC_DIR/core/src/cmp.rs:LL:COL = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `T` | LL | pub struct Struct<T: std::clone::Clone>(T); |                    +++++++++++++++++++ error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0277`. </ins>


("thread_local", Whitelisted, Gated(Stability::Unstable, "thread_local", "`#[thread_local]` is an experimental feature, and does  <del> not currently handle destructors. There is no  corresponding `#[task_local]` mapping to the task  model", </del> <ins> not currently handle destructors.", </ins> cfg_fn!(thread_local))), ("rustc_on_unimplemented", Normal, Gated(Stability::Unstable,


<ins> trait Foo {} impl<T> Foo for T {} fn main() { let array = [(); { loop {} }]; //~ ERROR constant evaluation is taking a long time let tup = (7,); let x: &dyn Foo = &tup.0; } </ins>


// want to keep their span info to improve diagnostics in these cases in a later stage. (true, Some(AssocOp::Multiply)) | // `{ 42 } *foo = bar;` or `{ 42 } * 3` (true, Some(AssocOp::Subtract)) | // `{ 42 } -5` <del> (true, Some(AssocOp::Add)) => { // `{ 42 } + 42 </del> <ins> (true, Some(AssocOp::LAnd)) | // `{ 42 } &&x` (#61475) (true, Some(AssocOp::Add)) // `{ 42 } + 42 // If the next token is a keyword, then the tokens above *are* unambiguously incorrect: // `if x { a } else { b } && if y { c } else { d }` if !self.look_ahead(1, |t| t.is_reserved_ident()) => { </ins> // These cases are ambiguous and can't be identified in the parser alone let sp = self.sess.source_map().start_point(self.span); self.sess.ambiguous_block_expr_parse.borrow_mut().insert(sp, lhs.span);


<ins> mod b { #[derive(Default)] pub struct A(u32); } impl b::A { fn inherent_bypass(&self) { let Self(x) = self; //~^ ERROR: tuple struct constructor `A` is private println!("{x}"); } } pub trait B { fn f(&self); } impl B for b::A { fn f(&self) { let Self(a) = self; //~^ ERROR: tuple struct constructor `A` is private println!("{}", a); } } pub trait Projector { type P; } impl Projector for () { type P = b::A; } pub trait Bypass2 { fn f2(&self); } impl Bypass2 for <() as Projector>::P { fn f2(&self) { let Self(a) = self; //~^ ERROR: tuple struct constructor `A` is private println!("{}", a); } } fn main() {} </ins>


| -------------- variant or associated item `PIE` not found here ... LL |     ApplePie = Delicious::Apple as isize | Delicious::PIE as isize, <del> |                                                       ^^^ variant or associated item not found in `Delicious` </del> <ins> |                                                       ^^^ |                                                       | |                                                       variant or associated item not found in `Delicious` |                                                       help: there is a variant with a similar name: `Pie` </ins> error: aborting due to previous error


<ins> // check-pass // compile-flags: --emit=mir,link // Regression test for #66930, this ICE requires `--emit=mir` flag. static UTF8_CHAR_WIDTH: [u8; 0] = []; pub fn utf8_char_width(b: u8) -> usize { UTF8_CHAR_WIDTH[b as usize] as usize } fn main() {} </ins>


[[package]] name = "racer" <del> version = "2.1.46" </del> <ins> version = "2.1.47" </ins> source = "registry+https://github.com/rust-lang/crates.io-index" <del> checksum = "e7cbda48a9124ed2e83766d2c15e3725710d344abca35fad8cf52341a55883b1" </del> <ins> checksum = "513c70e67444a0d62fdc581dffa521c6820942a5f08300d0864863f8d0e750e3" </ins> dependencies = [ "bitflags", "clap",


} } <ins> #[derive(Debug)] pub struct OffsetOverflowError; </ins> /// A single source in the `SourceMap`. #[derive(Clone)] pub struct SourceFile {


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


<ins> // Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // Regression test for issue #25436: check that things which can be // followed by any token also permit X* to come afterwards. macro_rules! foo { ( $a:tt $($b:tt)* ) => { }; ( $a:ident $($b:tt)* ) => { }; ( $a:item $($b:tt)* ) => { }; ( $a:block $($b:tt)* ) => { }; ( $a:meta $($b:tt)* ) => { } } fn main() { } </ins>


So, no need to manually enter those Unicode characters! <ins> ### Adding a warning block If you want to make a warning or similar note stand out in the documentation, you can wrap it like this: ```md /// documentation /// /// <div class="warning">A big warning!</div> /// /// more documentation ``` </ins> [`backtrace`]: https://docs.rs/backtrace/0.3.50/backtrace/ [commonmark markdown specification]: https://commonmark.org/ [commonmark quick reference]: https://commonmark.org/help/


error[E0382]: borrow of moved value: `x` --> $DIR/borrow-after-move.rs:39:24 | <ins> LL |         let x = "hello".to_owned().into_boxed_str(); |             - move occurs because `x` has type `std::boxed::Box<str>`, which does not implement the `Copy` trait </ins> LL |         x.foo(); |         - value moved here LL |         println!("{}", &x); <del> |                        ^^ value borrowed here after partial move | = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait </del> <ins> |                        ^^ value borrowed here after move </ins> error: aborting due to 5 previous errors


<ins> #![feature(fn_delegation)] #![allow(incomplete_features)] mod to_reuse {} trait Trait { reuse to_reuse::foo { foo } //~^ ERROR cannot find function `foo` in module `to_reuse` //~| ERROR cannot find value `foo` in this scope } fn main() {} </ins>


tt @ &TtSequence(..) => { check_matcher(cx, Some(tt).into_iter(), &Eof); }, <del> _ => cx.span_bug(sp, "wrong-structured lhs for follow check (didn't find  a TtDelimited or TtSequence)") </del> <ins> _ => cx.span_err(sp, "Invalid macro matcher; matchers must be contained  in balanced delimiters or a repetition indicator") </ins> }, _ => cx.span_bug(sp, "wrong-structured lhs for follow check (didn't find a  MatchedNonterminal)")


<ins> // Regression test for #92111. // // The issue was that we normalize trait bounds before caching // results of selection. Checking that `impl NoDrop for S` requires // checking `S: !Drop` because it cannot overlap with the blanket // impl. Then we save the (unsatisfied) result from checking `S: Drop`. // Then the call to `a` checks whether `S: ~const Drop` but we normalize // it to `S: Drop` which the cache claims to be unsatisfied. // // check-pass #![feature(const_trait_impl)] #![feature(const_fn_trait_bound)] pub trait Tr {} #[allow(drop_bounds)] impl<T: Drop> Tr for T {} #[derive(Debug)] pub struct S(i32); impl Tr for S {} const fn a<T: ~const Drop>(t: T) {} fn main() { a(S(0)); } </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. macro_rules! items { () => { type A = (); fn a() {} } } trait Foo { type A; fn a(); } impl Foo for () { items!(); } fn main() { } </ins>


<ins> struct Foo(i32); fn main() { let Foo(...) = Foo(0); //~ ERROR unexpected `...` let [_, ..., _] = [0, 1]; //~ ERROR unexpected `...` let _recovery_witness: () = 0; //~ ERROR mismatched types } </ins>


<ins> mod list { pub use self::List::Cons; pub enum List<T> { Cons(T, Box<List<T>>), } } mod alias { use crate::list::List; pub type Foo = List<String>; } fn foo(l: crate::alias::Foo) { match l { Cons(..) => {} //~ ERROR: cannot find tuple struct or tuple variant `Cons` in this scope } } fn main() {} </ins>


<ins> Couldn't create directory for doctest executables: Permission denied (os error 13) </ins>


fn main() { let x = box 3; //~^ ERROR box expression syntax is experimental; you can call `Box::new` instead. <del> //~| HELP add #![feature(box_syntax)] to the crate attributes to enable </del> }


<ins> // compile-flags: -Ztrait-solver=next-coherence // Makes sure we don't ICE on associated const projection when the feature gate // is not enabled, since we should avoid encountering ICEs on stable if possible. trait Bar { const ASSOC: usize; } impl Bar for () { const ASSOC: usize = 1; } trait Foo {} impl Foo for () {} impl<T> Foo for T where T: Bar<ASSOC = 0> {} //~^ ERROR associated const equality is incomplete //~| ERROR conflicting implementations of trait `Foo` for type `()` fn main() {} </ins>


let scope = if self.monotonic { invoc.expansion_data.mark } else { orig_expansion_data.mark }; <ins> let attr_id_before = invoc.attr_id(); </ins> let ext = match self.cx.resolver.resolve_invoc(&mut invoc, scope, force) { Ok(ext) => Some(ext), Err(Determinacy::Determined) => None, Err(Determinacy::Undetermined) => { <ins> // Sometimes attributes which we thought were invocations // end up being custom attributes for custom derives. If // that's the case our `invoc` will have changed out from // under us. If this is the case we're making progress so we // want to flag it as such, and we test this by looking if // the `attr_id()` method has been changing over time. if invoc.attr_id() != attr_id_before { progress = true; } </ins> undetermined_invocations.push(invoc); continue }


| LL | extern "C" unsafe { |            ^^^^^^ <ins> | = note: see issue #123743 <https://github.com/rust-lang/rust/issues/123743> for more information = help: add `#![feature(unsafe_extern_blocks)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date </ins> error: items in unadorned `extern` blocks cannot have safety qualifiers --> $DIR/unsafe-foreign-mod-2.rs:4:5 | LL |     unsafe fn foo(); |     ^^^^^^^^^^^^^^^^ <del> | help: add unsafe to this `extern` block | LL | unsafe extern "C" unsafe { | ++++++ </del> error: aborting due to 3 previous errors


<ins> // Don't suggest double quotes when encountering an expr of type `char` where a `&str` // is expected if the expr is not a char literal. // issue: rust-lang/rust#125595 fn main() { let _: &str = ('a'); //~ ERROR mismatched types let token = || 'a'; let _: &str = token(); //~ ERROR mismatched types } </ins>


<ins> error[E0771]: use of non-static lifetime `'a` in const generic --> $DIR/outer-lifetime-in-const-generic-default.rs:4:17 | LL |         let x: &'a (); |                 ^^ | = note: for more information, see issue #74052 <https://github.com/rust-lang/rust/issues/74052> error: aborting due to previous error For more information about this error, try `rustc --explain E0771`. </ins>


/// ``` ``` <ins> As of version 1.34.0, one can also omit the `fn main()`, but you will have to disambiguate the error type: ```ignore /// ``` /// use std::io; /// let mut input = String::new(); /// io::stdin().read_line(&mut input)?; /// # Ok::<(), io:Error>(()) /// ``` ``` This is an unfortunate consequence of the `?` operator adding an implicit conversion, so type inference fails because the type is not unique. Please note that you must write the `(())` in one sequence without intermediate whitespace so that rustdoc understands you want an implicit `Result`-returning function. </ins> ## Documenting macros Here’s an example of documenting a macro:


<ins> error: macro-expanded `extern crate` items cannot shadow names passed with `--extern` --> $DIR/issue-78325-inconsistent-resolution.rs:3:9 | LL |         extern crate std as core; |         ^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | define_other_core!(); | --------------------- in this macro invocation | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error </ins>


#[stable(feature = "rust1", since = "1.0.0")] pub trait PhantomFn<A:?Sized,R:?Sized=()> { } <del> /// `PhantomData` is a way to tell the compiler about fake fields. /// Phantom data is required whenever type parameters are not used. /// The idea is that if the compiler encounters a `PhantomData<T>` /// instance, it will behave *as if* an instance of the type `T` were /// present for the purpose of various automatic analyses. </del> <ins> /// `PhantomData<T>` allows you to describe that a type acts as if it stores a value of type `T`, /// even though it does not. This allows you to inform the compiler about certain safety properties /// of your code. /// /// Though they both have scary names, `PhantomData<T>` and "phantom types" are unrelated. 👻👻👻 </ins> /// /// # Examples /// /// When handling external resources over a foreign function interface, `PhantomData<T>` can <del> /// prevent mismatches by enforcing types in the method implementations, although the struct /// doesn't actually contain values of the resource type. </del> <ins> /// prevent mismatches by enforcing types in the method implementations: </ins> /// /// ``` /// # trait ResType { fn foo(&self); };


use std::fmt::{Debug, Display}; <del> #[marker] trait Marker {} </del> <ins> #[marker] trait Marker {} </ins> impl<T: Debug> Marker for T {} impl<T: Display> Marker for T {}


pub fn new_raw(fam: c_int, ty: c_int) -> io::Result<Socket> { unsafe { <del> // On linux we first attempt to pass the SOCK_CLOEXEC flag to // atomically create the socket and set it as CLOEXEC. Support for // this option, however, was added in 2.6.27, and we still support // 2.6.18 as a kernel, so if the returned error is EINVAL we // fallthrough to the fallback. #[cfg(target_os = "linux")] { match cvt(libc::socket(fam, ty | libc::SOCK_CLOEXEC, 0)) { Ok(fd) => return Ok(Socket(FileDesc::new(fd))), Err(ref e) if e.raw_os_error() == Some(libc::EINVAL) => {} Err(e) => return Err(e), } } let fd = cvt(libc::socket(fam, ty, 0))?; let fd = FileDesc::new(fd); fd.set_cloexec()?; let socket = Socket(fd); </del> <ins> cfg_if::cfg_if! { if #[cfg(target_os = "linux")] { // On Linux we pass the SOCK_CLOEXEC flag to atomically create // the socket and set it as CLOEXEC, added in 2.6.27. let fd = cvt(libc::socket(fam, ty | libc::SOCK_CLOEXEC, 0))?; Ok(Socket(FileDesc::new(fd))) } else { let fd = cvt(libc::socket(fam, ty, 0))?; let fd = FileDesc::new(fd); fd.set_cloexec()?; let socket = Socket(fd); </ins> <del> // macOS and iOS use `SO_NOSIGPIPE` as a `setsockopt` // flag to disable `SIGPIPE` emission on socket. #[cfg(target_vendor = "apple")] setsockopt(&socket, libc::SOL_SOCKET, libc::SO_NOSIGPIPE, 1)?; </del> <ins> // macOS and iOS use `SO_NOSIGPIPE` as a `setsockopt` // flag to disable `SIGPIPE` emission on socket. #[cfg(target_vendor = "apple")] setsockopt(&socket, libc::SOL_SOCKET, libc::SO_NOSIGPIPE, 1)?; </ins> <del> Ok(socket) </del> <ins> Ok(socket) } } </ins> } }


<del> Subproject commit 4cf36f285084f8f841f3cff7b29d44b1d95ee1dd </del> <ins> Subproject commit 54bbbd13ac532deed80416295a224ce12547a40c </ins>


pub mod map; pub mod set; <ins> #[doc(hidden)] </ins> trait Recover<Q: ?Sized> { type Key;


assert_eq!(c.stream_position()?, 8); assert_eq!(c.stream_position()?, 8); <ins> c.rewind()?; assert_eq!(c.stream_position()?, 0); assert_eq!(c.stream_position()?, 0); </ins> Ok(()) }


<ins> // edition: 2021 use std::collections::HashMap; use std::future::Future; use std::pin::Pin; pub trait Trait { fn do_something<'async_trait>(byte: u8) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>; } pub struct Struct; impl Trait for Struct { fn do_something<'async_trait>(byte: u8) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> { Box::pin( async move { let byte = byte; let _: () = {}; }) } } pub struct Map { map: HashMap<u16, fn(u8) -> Pin<Box<dyn Future<Output = ()> + Send>>>, } impl Map { pub fn new() -> Self { let mut map = HashMap::new(); map.insert(1, Struct::do_something); Self { map } //~^ ERROR mismatched types } } fn main() {} </ins>


<ins> // build-pass // compile-flags: -O // min-llvm-version: 14.0.5 // needs-asm-support // only-x86_64 // only-linux // regression test for #96797 #![feature(asm_sym)] use std::arch::global_asm; #[no_mangle] fn my_func() {} global_asm!("call_foobar: jmp {}", sym foobar); fn foobar() {} fn main() { extern "Rust" { fn call_foobar(); } unsafe { call_foobar() }; } </ins>


// These are either the stage0 downloaded binaries or the locally installed ones. pub initial_cargo: PathBuf, pub initial_rustc: PathBuf, <ins> pub initial_cargo_clippy: Option<PathBuf>, </ins> #[cfg(not(test))] initial_rustfmt: RefCell<RustfmtState>,


<ins> error: expected item, found `;` --> $DIR/missing-main-issue-124935-semi-after-item.rs:5:1 | LL | ; | ^ help: remove this semicolon | = help: function declarations are not followed by a semicolon error: aborting due to 1 previous error </ins>


fn visit_async_fn( &mut self, id: NodeId, <del> async_node_id: NodeId, return_impl_trait_id: NodeId, </del> name: Name, span: Span, <del> visit_fn: impl FnOnce(&mut DefCollector<'a>) </del> <ins> header: &FnHeader, generics: &'a Generics, decl: &'a FnDecl, body: &'a Block, </ins> ) { <ins> let (closure_id, return_impl_trait_id) = match header.asyncness { IsAsync::Async { closure_id, return_impl_trait_id, } => (closure_id, return_impl_trait_id), _ => unreachable!(), }; </ins> // For async functions, we need to create their inner defs inside of a // closure to match their desugared representation. let fn_def_data = DefPathData::ValueNs(name.as_interned_str()); let fn_def = self.create_def(id, fn_def_data, ITEM_LIKE_SPACE, span); return self.with_parent(fn_def, |this| { this.create_def(return_impl_trait_id, DefPathData::ImplTrait, REGULAR_SPACE, span); <del> let closure_def = this.create_def(async_node_id, </del> <ins> visit::walk_generics(this, generics); visit::walk_fn_decl(this, decl); let closure_def = this.create_def(closure_id, </ins> DefPathData::ClosureExpr, REGULAR_SPACE, span); <del> this.with_parent(closure_def, visit_fn) </del> <ins> this.with_parent(closure_def, |this| { visit::walk_block(this, body); }) </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. use std::ops::Add; fn f<T: Add>(a: T, b: T) -> <T as Add>::Output { a + b } fn main() { println!("a + b is {}", f::<f32>(100f32, 200f32)); } </ins>


}; let diag = match report_on { <del> ReportOn::TupleField => MultipleDeadCodes::UnusedTupleStructFields { multiple, num, descr, participle, name_list, change_fields_suggestion: ChangeFieldsToBeOfUnitType { num, spans: spans.clone() }, parent_info, ignored_derived_impls, }, </del> <ins> ReportOn::TupleField => { let tuple_fields = if let Some(parent_id) = parent_item && let node = tcx.hir_node_by_def_id(parent_id) && let hir::Node::Item(hir::Item { kind: hir::ItemKind::Struct(hir::VariantData::Tuple(fields, _, _), _), .. }) = node { *fields } else { &[] }; let trailing_tuple_fields = if tuple_fields.len() >= dead_codes.len() { LocalDefIdSet::from_iter( tuple_fields .iter() .skip(tuple_fields.len() - dead_codes.len()) .map(|f| f.def_id), ) } else { LocalDefIdSet::default() }; let fields_suggestion = // Suggest removal if all tuple fields are at the end. // Otherwise suggest removal or changing to unit type if dead_codes.iter().all(|dc| trailing_tuple_fields.contains(&dc.def_id)) { ChangeFields::Remove { num } } else { ChangeFields::ChangeToUnitTypeOrRemove { num, spans: spans.clone() } }; MultipleDeadCodes::UnusedTupleStructFields { multiple, num, descr, participle, name_list, change_fields_suggestion: fields_suggestion, parent_info, ignored_derived_impls, } } </ins> ReportOn::NamedField => MultipleDeadCodes::DeadCodes { multiple, num,


parse_only: bool, no_trans: bool, no_analysis: bool, <ins> no_rpath: bool, </ins> debugging_opts: u64, android_cross_path: Option<~str>, /// Whether to write dependency files. It's (enabled, optional filename).


let new_loan_indices = self.loans_generated_by(node); debug!("new_loan_indices = {:?}", new_loan_indices); <del> self.each_issued_loan(node, |issued_loan| { for &new_loan_index in &new_loan_indices { </del> <ins> for &new_loan_index in &new_loan_indices { self.each_issued_loan(node, |issued_loan| { </ins> let new_loan = &self.all_loans[new_loan_index]; <del> self.report_error_if_loans_conflict(issued_loan, new_loan); } true }); </del> <ins> // Only report an error for the first issued loan that conflicts // to avoid O(n^2) errors. self.report_error_if_loans_conflict(issued_loan, new_loan) }); } </ins> for (i, &x) in new_loan_indices.iter().enumerate() { let old_loan = &self.all_loans[x];


<ins> // check-pass #![feature(or_patterns)] enum MyEnum { FirstCase(u8), OtherCase(u16), } fn my_fn(x @ (MyEnum::FirstCase(_) | MyEnum::OtherCase(_)): MyEnum) {} fn main() { my_fn(MyEnum::FirstCase(0)); } </ins>


] [[package]] <del> name = "rustc-ap-rustc_arena" version = "722.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "550ca1a0925d31a0af089b18c89f5adf3b286e319e3e1f1a5204c21bd2f17371" dependencies = [ "rustc-ap-rustc_data_structures", "smallvec", ] [[package]] name = "rustc-ap-rustc_ast" version = "722.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4aa53b68080df17994a54747f7c37b0686288a670efb9ba3b382ce62e744aed2" dependencies = [ "bitflags", "rustc-ap-rustc_data_structures", "rustc-ap-rustc_index", "rustc-ap-rustc_lexer", "rustc-ap-rustc_macros", "rustc-ap-rustc_serialize", "rustc-ap-rustc_span", "smallvec", "tracing", ] [[package]] name = "rustc-ap-rustc_ast_pretty" version = "722.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ae71e68fada466a4b2c39c79ca6aee3226587abe6787170d2f6c92237569565" dependencies = [ "rustc-ap-rustc_ast", "rustc-ap-rustc_span", "tracing", ] [[package]] name = "rustc-ap-rustc_data_structures" version = "722.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "faa484d6e0ca32d1d82303647275c696f745599b3d97e686f396ceef5b99d7ae" dependencies = [ "arrayvec", "bitflags", "cfg-if 0.1.10", "crossbeam-utils", "ena", "indexmap", "jobserver", "libc", "measureme 9.1.2", "memmap2", "parking_lot", "rustc-ap-rustc_graphviz", "rustc-ap-rustc_index", "rustc-ap-rustc_macros", "rustc-ap-rustc_serialize", "rustc-hash", "rustc-rayon", "rustc-rayon-core", "smallvec", "stable_deref_trait", "stacker", "tempfile", "tracing", "winapi", ] [[package]] name = "rustc-ap-rustc_errors" version = "722.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f85ba19cca320ad797e3a29c35cab9bddfff0e7adbde336a436249e54cee7b1" dependencies = [ "annotate-snippets", "atty", "rustc-ap-rustc_data_structures", "rustc-ap-rustc_lint_defs", "rustc-ap-rustc_macros", "rustc-ap-rustc_serialize", "rustc-ap-rustc_span", "termcolor", "termize", "tracing", "unicode-width", "winapi", ] [[package]] name = "rustc-ap-rustc_feature" version = "722.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97d538adab96b8b2b1ca9fcd4c8c47d4e23e862a23d1a38b6c15cd8fd52b34b1" dependencies = [ "rustc-ap-rustc_data_structures", "rustc-ap-rustc_span", ] [[package]] name = "rustc-ap-rustc_fs_util" version = "722.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ad6f13d240944fa8f360d2f3b849a7cadaec75e477829e7dde61e838deda83d" [[package]] name = "rustc-ap-rustc_graphviz" version = "722.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08b3451153cc5828c02cc4f1a0df146d25ac4b3382a112e25fd9d3f5bff15cdc" [[package]] name = "rustc-ap-rustc_index" version = "722.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd39a9f01b442c629bdff5778cb3dd29b7c2ea4afe62d5ab61d216bd1b556692" dependencies = [ "arrayvec", "rustc-ap-rustc_macros", "rustc-ap-rustc_serialize", ] [[package]] name = "rustc-ap-rustc_lexer" version = "722.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5de290c44a90e671d2cd730062b9ef73d11155da7e44e7741d633e1e51e616e" dependencies = [ "unicode-xid", ] [[package]] name = "rustc-ap-rustc_lint_defs" version = "722.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69570b4beb61088926b131579865bbe70d124d30778c46307a62ec8b310ae462" dependencies = [ "rustc-ap-rustc_ast", "rustc-ap-rustc_data_structures", "rustc-ap-rustc_macros", "rustc-ap-rustc_serialize", "rustc-ap-rustc_span", "rustc-ap-rustc_target", "tracing", ] [[package]] name = "rustc-ap-rustc_macros" version = "722.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86bd877df37f15c5a44d9679d1b5207ebc95f3943fbc336eeac670195ac58610" dependencies = [ "proc-macro2", "quote", "syn", "synstructure", ] [[package]] name = "rustc-ap-rustc_parse" version = "722.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02502d8522ba31d0bcad28a78822b68c1b6ba947a2b4aa6a2341b30594379b80" dependencies = [ "bitflags", "rustc-ap-rustc_ast", "rustc-ap-rustc_ast_pretty", "rustc-ap-rustc_data_structures", "rustc-ap-rustc_errors", "rustc-ap-rustc_feature", "rustc-ap-rustc_lexer", "rustc-ap-rustc_session", "rustc-ap-rustc_span", "smallvec", "tracing", "unicode-normalization", ] [[package]] name = "rustc-ap-rustc_serialize" version = "722.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f741f8e9aee6323fbe127329490608a5a250cc0072ac91e684ef62518cdb1ff" dependencies = [ "indexmap", "smallvec", ] [[package]] name = "rustc-ap-rustc_session" version = "722.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dba61eca749f4fced4427ad1cc7f23342cfc6527c3bcc624e3aa56abc1f81298" dependencies = [ "bitflags", "getopts", "num_cpus", "rustc-ap-rustc_ast", "rustc-ap-rustc_data_structures", "rustc-ap-rustc_errors", "rustc-ap-rustc_feature", "rustc-ap-rustc_fs_util", "rustc-ap-rustc_lint_defs", "rustc-ap-rustc_macros", "rustc-ap-rustc_serialize", "rustc-ap-rustc_span", "rustc-ap-rustc_target", "tracing", ] [[package]] name = "rustc-ap-rustc_span" version = "722.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a642e8d6fc883f34e0778e079f8242ac40c6614a6b7a0ef61681333e847f5e62" dependencies = [ "cfg-if 0.1.10", "md-5", "rustc-ap-rustc_arena", "rustc-ap-rustc_data_structures", "rustc-ap-rustc_index", "rustc-ap-rustc_macros", "rustc-ap-rustc_serialize", "scoped-tls", "sha-1 0.9.1", "sha2", "tracing", "unicode-width", ] [[package]] name = "rustc-ap-rustc_target" version = "722.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "80feebd8c323b80dd73a395fa7fabba9e2098b6277670ff89c473f618ffa07de" dependencies = [ "bitflags", "rustc-ap-rustc_data_structures", "rustc-ap-rustc_index", "rustc-ap-rustc_macros", "rustc-ap-rustc_serialize", "rustc-ap-rustc_span", "tracing", ] [[package]] </del> name = "rustc-demangle" version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index"


use crate::infer::{InferCtxt, InferOk, TypeFreshener}; use crate::traits::error_reporting::TypeErrCtxtExt; <ins> use crate::traits::project::try_normalize_with_depth_to; </ins> use crate::traits::project::ProjectAndUnifyResult; use crate::traits::project::ProjectionCacheKeyExt; use crate::traits::ProjectionCacheKey;


return wrap(Sub); } <ins> extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateMethod( LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, size_t NameLen, const char *LinkageName, size_t LinkageNameLen, LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty, LLVMRustDIFlags Flags, LLVMRustDISPFlags SPFlags, LLVMMetadataRef TParam) { DITemplateParameterArray TParams = DITemplateParameterArray(unwrap<MDTuple>(TParam)); DISubprogram::DISPFlags llvmSPFlags = fromRust(SPFlags); DINode::DIFlags llvmFlags = fromRust(Flags); DISubprogram *Sub = Builder->createMethod( unwrapDI<DIScope>(Scope), StringRef(Name, NameLen), StringRef(LinkageName, LinkageNameLen), unwrapDI<DIFile>(File), LineNo, unwrapDI<DISubroutineType>(Ty), 0, 0, nullptr, // VTable params aren't used llvmFlags, llvmSPFlags, TParams); return wrap(Sub); } </ins> extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateBasicType( LLVMRustDIBuilderRef Builder, const char *Name, size_t NameLen, uint64_t SizeInBits, unsigned Encoding) {


without modifying the original"] #[inline] #[track_caller] <del> #[rustc_inherit_overflow_checks] #[allow(arithmetic_overflow)] </del> pub const fn ilog(self, base: Self) -> u32 { <del> match self.checked_ilog(base) { Some(n) => n, None => { // In debug builds, trigger a panic on None. // This should optimize completely out in release builds. let _ = Self::MAX + 1; 0 }, } </del> <ins> assert!(base >= 2, "base of integer logarithm must be at least 2"); self.checked_ilog(base).expect("argument of integer logarithm must be positive") </ins> } /// Returns the base 2 logarithm of the number, rounded down. /// /// # Panics /// <del> /// When the number is negative or zero it panics in debug mode and the return value /// is 0 in release mode. </del> <ins> /// This function will panic if `self` is less than or equal to zero. </ins> /// /// # Examples ///


"this was erroneously allowed and will become a hard error in a future release" }).emit(); } <ins> fn mk_stmt(&self, span: Span, kind: StmtKind) -> Stmt { Stmt { id: DUMMY_NODE_ID, kind, span } } </ins> }


// noop } <ins> fn no_position_independent_executable(&mut self) { // noop } </ins> fn partial_relro(&mut self) { // noop }


if self.cursor.first() == ''' && let Some(start) = self.last_lifetime && self.cursor.third() != ''' <ins> && let end = self.mk_sp(self.pos, self.pos + BytePos(1)) && !self.psess.source_map().is_multiline(start.until(end)) </ins> { <del> // An "unclosed `char`" error will be emitted already, silence redundant error. silence = true; Some(errors::UnknownPrefixSugg::MeantStr { start, end: self.mk_sp(self.pos, self.pos + BytePos(1)), }) </del> <ins> // FIXME: An "unclosed `char`" error will be emitted already in some cases, // but it's hard to silence this error while not also silencing important cases // too. We should use the error stashing machinery instead. Some(errors::UnknownPrefixSugg::MeantStr { start, end }) </ins> } else { Some(errors::UnknownPrefixSugg::Whitespace(prefix_span.shrink_to_hi())) } } else { None }; <del> let err = errors::UnknownPrefix { span: prefix_span, prefix, sugg }; if silence { self.dcx().create_err(err).delay_as_bug(); } else { self.dcx().emit_err(err); } </del> <ins> self.dcx().emit_err(errors::UnknownPrefix { span: prefix_span, prefix, sugg }); </ins> } else { // Before Rust 2021, only emit a lint for migration. self.psess.buffer_lint_with_diagnostic(


use super::{ForceCollect, Parser, PathStyle, Restrictions, Trailing, UsePreAttrPos}; use crate::errors::{ <del> self, AmbiguousRangePattern, DotDotDotForRemainingFields, DotDotDotRangeToPatternNotAllowed, DotDotDotRestPattern, EnumPatternInsteadOfIdentifier, ExpectedBindingLeftOfAt, ExpectedCommaAfterPatternField, GenericArgsInPatRequireTurbofishSyntax, InclusiveRangeExtraEquals, InclusiveRangeMatchArrow, InclusiveRangeNoEnd, InvalidMutInPattern, ParenRangeSuggestion, PatternOnWrongSideOfAt, RemoveLet, RepeatedMutInPattern, SwitchRefBoxOrder, TopLevelOrPatternNotAllowed, TopLevelOrPatternNotAllowedSugg, TrailingVertNotAllowed, UnexpectedExpressionInPattern, UnexpectedExpressionInPatternSugg, UnexpectedLifetimeInPattern, UnexpectedParenInRangePat, UnexpectedParenInRangePatSugg, UnexpectedVertVertBeforeFunctionParam, UnexpectedVertVertInPattern, WrapInParens, </del> <ins> self, AmbiguousRangePattern, AtDotDotInStructPattern, AtInStructPattern, DotDotDotForRemainingFields, DotDotDotRangeToPatternNotAllowed, DotDotDotRestPattern, EnumPatternInsteadOfIdentifier, ExpectedBindingLeftOfAt, ExpectedCommaAfterPatternField, GenericArgsInPatRequireTurbofishSyntax, InclusiveRangeExtraEquals, InclusiveRangeMatchArrow, InclusiveRangeNoEnd, InvalidMutInPattern, ParenRangeSuggestion, PatternOnWrongSideOfAt, RemoveLet, RepeatedMutInPattern, SwitchRefBoxOrder, TopLevelOrPatternNotAllowed, TopLevelOrPatternNotAllowedSugg, TrailingVertNotAllowed, UnexpectedExpressionInPattern, UnexpectedExpressionInPatternSugg, UnexpectedLifetimeInPattern, UnexpectedParenInRangePat, UnexpectedParenInRangePatSugg, UnexpectedVertVertBeforeFunctionParam, UnexpectedVertVertInPattern, WrapInParens, </ins> }; use crate::parser::expr::{could_be_unclosed_char_literal, DestructuredFloat}; use crate::{maybe_recover_from_interpolated_ty_qpath, maybe_whole};


<ins> // build-pass fn main() { let mut log_service = LogService { inner: Inner }; log_service.call(()); } pub trait Service<Request> { type Response; fn call(&mut self, req: Request) -> Self::Response; } pub struct LogService<S> { inner: S, } impl<T, U, S> Service<T> for LogService<S> where S: Service<T, Response = U>, U: Extension + 'static, for<'a> U::Item<'a>: std::fmt::Debug, { type Response = S::Response; fn call(&mut self, req: T) -> Self::Response { self.inner.call(req) } } pub struct Inner; impl Service<()> for Inner { type Response = Resp; fn call(&mut self, req: ()) -> Self::Response { Resp::A(req) } } pub trait Extension { type Item<'a>; fn touch<F>(self, f: F) -> Self where for<'a> F: Fn(Self::Item<'a>); } pub enum Resp { A(()), } impl Extension for Resp { type Item<'a> = RespItem<'a>; fn touch<F>(self, _f: F) -> Self where for<'a> F: Fn(Self::Item<'a>), { match self { Self::A(a) => Self::A(a), } } } pub enum RespItem<'a> { A(&'a ()), } impl<'a> std::fmt::Debug for RespItem<'a> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::A(arg0) => f.debug_tuple("A").field(arg0).finish(), } } } </ins>


#[derive(RustcEncodable, RustcDecodable)] pub struct CrateRoot { <del> pub rustc_version: String, </del> pub name: Symbol, pub triple: String, pub hash: hir::svh::Svh,


// linking executables as pie. Different versions of gcc seem to use // different quotes in the error message so don't check for them. if sess.target.target.options.linker_is_gnu && <ins> sess.linker_flavor() != LinkerFlavor::Ld && </ins> (out.contains("unrecognized command line option") || out.contains("unknown argument")) && out.contains("-no-pie") &&


- [You can now use `#[repr(transparent)]` on univariant `enum`s.][68122] Meaning that you can create an enum that has the exact layout and ABI of the type it contains. <del> - [You can now use outer attribute procedural macros on inline modules.][64273] </del> <ins> - [You can now use outer attribute procedural macros on inline modules.][64273] </ins> - [There are some *syntax-only* changes:][67131] - `default` is syntactically allowed before items in `trait` definitions. - Items in `impl`s (i.e. `const`s, `type`s, and `fn`s) may syntactically


}, ) }); <ins> // Priority of matches: // 1. Exact case insensitive match // 2. Levenshtein distance match // 3. Sorted word match </ins> if let Some(candidate) = case_insensitive_match { <del> Some(candidate) // exact case insensitive match has a higher priority </del> <ins> Some(*candidate) } else if levenshtein_match.is_some() { levenshtein_match.map(|(candidate, _)| *candidate) </ins> } else { <del> levenstein_match.map(|(candidate, _)| candidate) </del> <ins> find_match_by_sorted_words(name_vec, lookup) </ins> } } <ins> fn find_match_by_sorted_words<'a>(iter_names: Vec<&'a Symbol>, lookup: &str) -> Option<Symbol> { iter_names.iter().fold(None, |result, candidate| { if sort_by_words(&candidate.as_str()) == sort_by_words(lookup) { Some(**candidate) } else { result } }) } fn sort_by_words(name: &str) -> String { let mut split_words: Vec<&str> = name.split('_').collect(); split_words.sort(); split_words.join("_") } </ins>


#![feature(unboxed_closures)] #![feature(unwrap_infallible)] #![feature(vec_into_raw_parts)] <del> #![feature(vec_spare_capacity)] </del> // NB: the above list is sorted to minimize merge conflicts. #![default_lib_allocator]


<ins> error: expected `{`, found `;` --> $DIR/semi-in-let-chain.rs:7:23 | LL |         && let () = (); |                       ^ expected `{` | note: you likely meant to continue parsing the let-chain starting here --> $DIR/semi-in-let-chain.rs:8:9 | LL |         && let () = () |         ^^^^^^ help: consider removing this semicolon to parse the `let` as part of the same chain | LL -         && let () = (); LL +         && let () = () | error: expected `{`, found `;` --> $DIR/semi-in-let-chain.rs:15:20 | LL |         && () == (); |                    ^ expected `{` | note: the `if` expression is missing a block after this condition --> $DIR/semi-in-let-chain.rs:14:8 | LL |       if let () = () |  ________^ LL | |         && () == (); | |___________________^ error: expected `{`, found `;` --> $DIR/semi-in-let-chain.rs:23:20 | LL |         && () == (); |                    ^ expected `{` | note: you likely meant to continue parsing the let-chain starting here --> $DIR/semi-in-let-chain.rs:24:9 | LL |         && let () = () |         ^^^^^^ help: consider removing this semicolon to parse the `let` as part of the same chain | LL -         && () == (); LL +         && () == () | error: aborting due to 3 previous errors </ins>


try!(self.flush_buf()); } if buf.len() >= self.buf.capacity() { <del> self.inner.as_mut().unwrap().write(buf) </del> <ins> self.panicked = true; let r = self.inner.as_mut().unwrap().write(buf); self.panicked = false; r </ins> } else { let amt = cmp::min(buf.len(), self.buf.capacity()); Write::write(&mut self.buf, &buf[..amt])