<ins> error: Unexpected `@` in struct pattern --> $DIR/at-in-struct-patterns.rs:8:15 | LL |     let Foo { var @ field1, .. } = foo; |         ---   ^^^^^ |         | |         while parsing the fields for this pattern | = note: struct patterns use `field: pattern` syntax to bind to fields = help: consider replacing `new_name @ field_name` with `field_name: new_name` if that is what you intended error: `@ ..` is not supported in struct patterns --> $DIR/at-in-struct-patterns.rs:10:26 | LL |     let Foo { field1: _, bar @ .. } = foo; |         ---              ^^^^^^^^ |         | |         while parsing the fields for this pattern | help: bind to each field separately or, if you don't need them, just remove `bar @` | LL -     let Foo { field1: _, bar @ .. } = foo; LL +     let Foo { field1: _, .. } = foo; | error: `@ ..` is not supported in struct patterns --> $DIR/at-in-struct-patterns.rs:11:15 | LL |     let Foo { bar @ .. } = foo; |         ---   ^^^^^^^^ |         | |         while parsing the fields for this pattern | help: bind to each field separately or, if you don't need them, just remove `bar @` | LL -     let Foo { bar @ .. } = foo; LL +     let Foo { .. } = foo; | error: expected identifier, found `@` --> $DIR/at-in-struct-patterns.rs:12:15 | LL |     let Foo { @ } = foo; |         ---   ^ expected identifier |         | |         while parsing the fields for this pattern error: expected identifier, found `@` --> $DIR/at-in-struct-patterns.rs:13:15 | LL |     let Foo { @ .. } = foo; |         ---   ^ expected identifier |         | |         while parsing the fields for this pattern error[E0425]: cannot find value `var` in this scope --> $DIR/at-in-struct-patterns.rs:9:10 | LL |     dbg!(var); |          ^^^ not found in this scope | help: consider importing this function | LL + use std::env::var; | error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0425`. </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. // error-pattern: expected item, found `parse_error` include!("../auxiliary/issue-21146-inc.rs"); fn main() {} </ins>


this.pat_bindings(&**pat, |this, ln, var, sp, id| { this.warn_about_unused(sp, id, ln, var); }); <ins> visit::walk_expr(this, expr); </ins> } // no correctness conditions related to liveness


impl Foo for u32 { fn len(&self) -> u32 { *self } <del> //~^ ERROR incompatible type for trait: expected unsafe fn, found normal fn </del> <ins> //~^ ERROR method `len` has an incompatible type for trait //~| expected unsafe fn, //~| found normal fn </ins> } fn main() { }


/// impl Gadget { ///     /// Construct a reference counted Gadget. ///     fn new() -> Rc<Self> { <del> ///         Rc::new_cyclic(|me| Gadget { me: me.clone() }) </del> <ins> ///         // `me` is a `Weak<Gadget>` pointing at the new allocation of the ///         // `Rc` we're constructing. ///         Rc::new_cyclic(|me| { ///             // Create the actual struct here. ///             Gadget { me: me.clone() } ///         }) </ins> ///     } /// ///     /// Return a reference counted pointer to Self.


} } <del> inline(cx, llfn, codegen_fn_attrs.inline.clone(), instance.def.requires_inline(cx.tcx)); </del> <ins> let inline_attr = if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::NAKED) { InlineAttr::Never } else if codegen_fn_attrs.inline == InlineAttr::None && instance.def.requires_inline(cx.tcx) { InlineAttr::Hint } else { codegen_fn_attrs.inline }; inline(cx, llfn, inline_attr); </ins> // The `uwtable` attribute according to LLVM is: //


expr_is_from_block, ); } <ins> MustUsePath::Pinned(path) => { let descr_pre = &format!("{descr_pre}pinned "); emit_must_use_untranslated( cx, path, descr_pre, descr_post, plural_len, true, expr_is_from_block, ); } </ins> MustUsePath::Opaque(path) => { let descr_pre = &format!("{descr_pre}implementer{plural_suffix} of "); emit_must_use_untranslated(


self.output); } } <del> mir::Rvalue::Box(_) => { </del> <ins> mir::Rvalue::Box(..) => { </ins> let exchange_malloc_fn_def_id = self.scx .tcx()


error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates <del> --> $DIR/impl-unused-tps.rs:13:8 </del> <ins> --> $DIR/impl-unused-tps.rs:15:8 </ins> | LL | impl<T,U> Foo<T> for [isize;1] { |        ^ unconstrained type parameter error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates <del> --> $DIR/impl-unused-tps.rs:30:8 </del> <ins> --> $DIR/impl-unused-tps.rs:31:8 </ins> | LL | impl<T,U> Bar for T { |        ^ unconstrained type parameter error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates <del> --> $DIR/impl-unused-tps.rs:38:8 </del> <ins> --> $DIR/impl-unused-tps.rs:39:8 </ins> | LL | impl<T,U> Bar for T |        ^ unconstrained type parameter error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates <del> --> $DIR/impl-unused-tps.rs:46:8 </del> <ins> --> $DIR/impl-unused-tps.rs:47:8 </ins> | LL | impl<T,U,V> Foo<T> for T |        ^ unconstrained type parameter error[E0207]: the type parameter `V` is not constrained by the impl trait, self type, or predicates <del> --> $DIR/impl-unused-tps.rs:46:10 </del> <ins> --> $DIR/impl-unused-tps.rs:47:10 </ins> | LL | impl<T,U,V> Foo<T> for T |          ^ unconstrained type parameter <del> error: aborting due to 5 previous errors </del> <ins> error[E0119]: conflicting implementations of trait `Foo<_>` for type `[isize; 0]` --> $DIR/impl-unused-tps.rs:27:1 | LL | impl<T> Foo<T> for [isize;0] { | ---------------------------- first implementation here ... LL | impl<T,U> Foo<T> for U { | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `[isize; 0]` error[E0275]: overflow evaluating the requirement `([isize; 0], _): Sized` | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`impl_unused_tps`) note: required for `([isize; 0], _)` to implement `Bar` --> $DIR/impl-unused-tps.rs:31:11 | LL | impl<T,U> Bar for T { |      -    ^^^     ^ |      | |      unsatisfied trait bound introduced here = note: 126 redundant requirements hidden = note: required for `([isize; 0], _)` to implement `Bar` error: aborting due to 7 previous errors </ins> <del> For more information about this error, try `rustc --explain E0207`. </del> <ins> Some errors have detailed explanations: E0119, E0207, E0275. For more information about an error, try `rustc --explain E0119`. </ins>


sig: ty::PolyFnSig<'tcx>, tuple_arguments: TupleArgumentsFlag, ) -> ty::Binder<'tcx, (ty::TraitRef<'tcx>, Ty<'tcx>)> { <ins> assert!(!self_ty.has_escaping_bound_vars()); </ins> let arguments_tuple = match tuple_arguments { TupleArgumentsFlag::No => sig.skip_binder().inputs()[0], TupleArgumentsFlag::Yes => tcx.intern_tup(sig.skip_binder().inputs()), }; <del> debug_assert!(!self_ty.has_escaping_bound_vars()); </del> let trait_ref = tcx.mk_trait_ref(fn_trait_def_id, [self_ty, arguments_tuple]); sig.map_bound(|sig| (trait_ref, sig.output())) }


} } <del> pub fn retokenize(sess: &'a ParseSess, mut span: Span) -> Self { let begin = sess.source_map().lookup_byte_offset(span.lo()); let end = sess.source_map().lookup_byte_offset(span.hi()); // Make the range zero-length if the span is invalid. if begin.sf.start_pos != end.sf.start_pos { span = span.shrink_to_lo(); } let mut sr = StringReader::new(sess, begin.sf, None); // Seek the lexer to the right byte range. sr.end_src_index = sr.src_index(span.hi()); sr } </del> fn mk_sp(&self, lo: BytePos, hi: BytePos) -> Span { self.override_span.unwrap_or_else(|| Span::with_root_ctxt(lo, hi)) }


/// # Examples /// /// ``` <del> /// #![feature(osstring_ascii)] </del> /// use std::ffi::OsString; /// /// let mut s = OsString::from("Grüße, Jürgen ❤");


self.super_terminator(terminator, location); match &terminator.kind { <del> TerminatorKind::Call { func, .. } => { </del> <ins> TerminatorKind::Call { func, args, .. } => { </ins> let ConstCx { tcx, body, param_env, .. } = *self.ccx; let caller = self.def_id().to_def_id();


fn find_library_crate(&self) -> Option<Library> { let filesearch = self.sess.filesearch; <del> let crate_name = self.name.clone(); </del> let (dyprefix, dysuffix) = self.dylibname(); // want: crate_name.dir_part() + prefix + crate_name.file_part + "-" <del> let dylib_prefix = format!("{}{}-", dyprefix, crate_name); let rlib_prefix = format!("lib{}-", crate_name); </del> <ins> let dylib_prefix = format!("{}{}-", dyprefix, self.name); let rlib_prefix = format!("lib{}-", self.name); </ins> <del> let mut matches = ~[]; filesearch.search(|path| { match path.filename_str() { None => FileDoesntMatch, Some(file) => { let (candidate, existing) = if file.starts_with(rlib_prefix) && file.ends_with(".rlib") { debug!("{} is an rlib candidate", path.display()); (true, self.add_existing_rlib(matches, path, file)) } else if file.starts_with(dylib_prefix) && file.ends_with(dysuffix) { debug!("{} is a dylib candidate", path.display()); (true, self.add_existing_dylib(matches, path, file)) } else { (false, false) }; </del> <ins> let mut candidates = HashMap::new(); </ins> <del> if candidate && existing { </del> <ins> // First, find all possible candidate rlibs and dylibs purely based on // the name of the files themselves. We're trying to match against an // exact crate_id and a possibly an exact hash. // // During this step, we can filter all found libraries based on the // name and id found in the crate id (we ignore the path portion for // filename matching), as well as the exact hash (if specified). If we // end up having many candidates, we must look at the metadata to // perform exact matches against hashes/crate ids. Note that opening up // the metadata is where we do an exact match against the full contents // of the crate id (path/name/id). // // The goal of this step is to look at as little metadata as possible. filesearch.search(|path| { let file = match path.filename_str() { None => return FileDoesntMatch, Some(file) => file, }; if file.starts_with(rlib_prefix) && file.ends_with(".rlib") { info!("rlib candidate: {}", path.display()); match self.try_match(file, rlib_prefix, ".rlib") { Some(hash) => { info!("rlib accepted, hash: {}", hash); let slot = candidates.find_or_insert_with(hash, |_| { (HashSet::new(), HashSet::new()) }); let (ref mut rlibs, _) = *slot; rlibs.insert(path.clone()); </ins> FileMatches <del> } else if candidate { match get_metadata_section(self.os, path) { Some(cvec) => if crate_matches(cvec.as_slice(), self.name.clone(), self.version.clone(), self.hash.clone()) { debug!("found {} with matching crate_id", path.display()); let (rlib, dylib) = if file.ends_with(".rlib") { (Some(path.clone()), None) } else { (None, Some(path.clone())) }; matches.push(Library { rlib: rlib, dylib: dylib, metadata: cvec, }); FileMatches } else { debug!("skipping {}, crate_id doesn't match", path.display()); FileDoesntMatch }, _ => { debug!("could not load metadata for {}", path.display()); FileDoesntMatch } } } else { </del> <ins> } None => { info!("rlib rejected"); </ins> FileDoesntMatch } } <ins> } else if file.starts_with(dylib_prefix) && file.ends_with(dysuffix){ info!("dylib candidate: {}", path.display()); match self.try_match(file, dylib_prefix, dysuffix) { Some(hash) => { info!("dylib accepted, hash: {}", hash); let slot = candidates.find_or_insert_with(hash, |_| { (HashSet::new(), HashSet::new()) }); let (_, ref mut dylibs) = *slot; dylibs.insert(path.clone()); FileMatches } None => { info!("dylib rejected"); FileDoesntMatch } } } else { FileDoesntMatch </ins> } }); <del> match matches.len() { </del> <ins> // We have now collected all known libraries into a set of candidates // keyed of the filename hash listed. For each filename, we also have a // list of rlibs/dylibs that apply. Here, we map each of these lists // (per hash), to a Library candidate for returning. // // A Library candidate is created if the metadata for the set of // libraries corresponds to the crate id and hash criteria that this // serach is being performed for. let mut libraries = ~[]; for (_hash, (rlibs, dylibs)) in candidates.move_iter() { let mut metadata = None; let rlib = self.extract_one(rlibs, "rlib", &mut metadata); let dylib = self.extract_one(dylibs, "dylib", &mut metadata); match metadata { Some(metadata) => { libraries.push(Library { dylib: dylib, rlib: rlib, metadata: metadata, }) } None => {} } } // Having now translated all relevant found hashes into libraries, see // what we've got and figure out if we found multiple candidates for // libraries or not. match libraries.len() { </ins> 0 => None, <del> 1 => Some(matches[0]), </del> <ins> 1 => Some(libraries[0]), </ins> _ => { self.sess.span_err(self.span, <del> format!("multiple matching crates for `{}`", crate_name)); </del> <ins> format!("multiple matching crates for `{}`", self.name)); </ins> self.sess.note("candidates:"); <del> for lib in matches.iter() { </del> <ins> for lib in libraries.iter() { </ins> match lib.dylib { Some(ref p) => { self.sess.note(format!("path: {}", p.display()));


match eh_action { EHAction::None | EHAction::Cleanup(_) => return continue_unwind(exception_object, context), <del> EHAction::Catch(_) => return uw::_URC_HANDLER_FOUND, </del> <ins> EHAction::Catch(_) => { // EHABI requires the personality routine to update the // SP value in the barrier cache of the exception object. (*exception_object).private[5] = uw::_Unwind_GetGR(context, uw::UNWIND_SP_REG); return uw::_URC_HANDLER_FOUND; } </ins> EHAction::Terminate => return uw::_URC_FAILURE, } } else {


if let Some(path) = env::var_os("PATH") { new_path.extend(env::split_paths(&path)); } <ins> if sess.target.target.options.is_like_msvc { new_path.extend(msvc::host_dll_path()); } </ins> env::join_paths(new_path).unwrap() }


llvm::LLVMRustInstallFatalErrorHandler(); <ins> fn llvm_arg_to_arg_name(full_arg: &str) -> &str { full_arg.trim().split(|c: char| { c == '=' || c.is_whitespace() }).next().unwrap_or("") } let user_specified_args: FxHashSet<_> = sess .opts .cg .llvm_args .iter() .map(|s| llvm_arg_to_arg_name(s)) .filter(|s| s.len() > 0) .collect(); </ins> { <del> let mut add = |arg: &str| { let s = CString::new(arg).unwrap(); llvm_args.push(s.as_ptr()); llvm_c_strs.push(s); </del> <ins> // This adds the given argument to LLVM. Unless `force` is true // user specified arguments are *not* overridden. let mut add = |arg: &str, force: bool| { if force || !user_specified_args.contains(llvm_arg_to_arg_name(arg)) { let s = CString::new(arg).unwrap(); llvm_args.push(s.as_ptr()); llvm_c_strs.push(s); } </ins> }; <del> add("rustc"); // fake program name if sess.time_llvm_passes() { add("-time-passes"); } if sess.print_llvm_passes() { add("-debug-pass=Structure"); } if sess.opts.debugging_opts.disable_instrumentation_preinliner { add("-disable-preinline"); } </del> <ins> add("rustc", true); // fake program name if sess.time_llvm_passes() { add("-time-passes", false); } if sess.print_llvm_passes() { add("-debug-pass=Structure", false); } </ins> if sess.opts.debugging_opts.generate_arange_section { <del> add("-generate-arange-section"); </del> <ins> add("-generate-arange-section", false); </ins> } if get_major_version() >= 8 { match sess.opts.debugging_opts.merge_functions


#![feature(iter_advance_by)] #![feature(slice_group_by)] #![feature(slice_partition_dedup)] <del> #![feature(vec_spare_capacity)] </del> #![feature(string_remove_matches)] #![feature(const_btree_new)] #![feature(const_default_impls)]


<ins> // This test ensures that non-glob reexports don't get their attributes merge with // the reexported item whereas glob reexports do. // Regression test for <https://github.com/rust-lang/rust/issues/120487>. #![crate_name = "foo"] #![feature(doc_cfg)] // @has 'foo/index.html' // There are two items. // @count - '//*[@class="item-table"]//div[@class="item-name"]' 2 // Only one of them should have an attribute. // @count - '//*[@class="item-table"]//div[@class="item-name"]/*[@class="stab portability"]' 1 mod a { #[doc(cfg(not(feature = "a")))] #[cfg(not(feature = "a"))] pub struct Test1; } mod b { #[doc(cfg(not(feature = "a")))] #[cfg(not(feature = "a"))] pub struct Test2; } // @has 'foo/struct.Test1.html' // @count - '//*[@id="main-content"]/*[@class="item-info"]' 1 // @has - '//*[@id="main-content"]/*[@class="item-info"]' 'Available on non-crate feature a only.' pub use a::*; // @has 'foo/struct.Test2.html' // @count - '//*[@id="main-content"]/*[@class="item-info"]' 0 pub use b::Test2; </ins>


pub mod dump_mir; pub mod early_otherwise_branch; pub mod elaborate_drops; <ins> pub mod function_item_references; </ins> pub mod generator; pub mod inline; pub mod instcombine;


<ins> // Copyright 2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // // compile-pass trait DictLike<'a> { type ItemsIterator: Iterator<Item=u8>; fn get(c: Self::ItemsIterator) { c.into_iter(); } } trait DictLike2<'a> { type ItemsIterator: Iterator<Item=u8>; fn items(&self) -> Self::ItemsIterator; fn get(&self)  { for _ in self.items() {} } } fn main() {} </ins>


let res = binding.res(); self.check_reserved_macro_name(key.ident, res); self.set_binding_parent_module(binding, module); <del> let mut resolution = self.resolution(module, key).borrow_mut(); let old_binding = resolution.binding(); let mut t = Ok(()); if let Some(old_binding) = resolution.binding { if res == Res::Err && old_binding.res() != Res::Err { // Do not override real bindings with `Res::Err`s from error recovery. } else { </del> <ins> self.update_resolution(module, key, |this, resolution| { if let Some(old_binding) = resolution.binding { if res == Res::Err && old_binding.res() != Res::Err { // Do not override real bindings with `Res::Err`s from error recovery. return Ok(()); } </ins> match (old_binding.is_glob_import(), binding.is_glob_import()) { (true, true) => { if res != old_binding.res() { <del> resolution.binding = Some(self.ambiguity( </del> <ins> resolution.binding = Some(this.ambiguity( </ins> AmbiguityKind::GlobVsGlob, old_binding, binding, )); <del> } else if !old_binding.vis.is_at_least(binding.vis, self.tcx) { </del> <ins> } else if !old_binding.vis.is_at_least(binding.vis, this.tcx) { </ins> // We are glob-importing the same item but with greater visibility. resolution.binding = Some(binding); }


// write_volatile causes an LLVM assert with composite types <ins> // ignore-emscripten See #41299: probably a bad optimization </ins> #![feature(volatile)] use std::ptr::{read_volatile, write_volatile};


}; } <del> tool_check_step!(Rustdoc, "src/tools/rustdoc", "src/librustdoc", SourceType::InTree); </del> <ins> tool_check_step!(Rustdoc, "rustdoc", "src/tools/rustdoc", "src/librustdoc", SourceType::InTree); </ins> // Clippy, miri and Rustfmt are hybrids. They are external tools, but use a git subtree instead // of a submodule. Since the SourceType only drives the deny-warnings // behavior, treat it as in-tree so that any new warnings in clippy will be // rejected. <del> tool_check_step!(Clippy, "src/tools/clippy", SourceType::InTree); tool_check_step!(Miri, "src/tools/miri", SourceType::InTree); tool_check_step!(CargoMiri, "src/tools/miri/cargo-miri", SourceType::InTree); tool_check_step!(Rls, "src/tools/rls", SourceType::InTree); tool_check_step!(Rustfmt, "src/tools/rustfmt", SourceType::InTree); tool_check_step!(MiroptTestTools, "src/tools/miropt-test-tools", SourceType::InTree); tool_check_step!(TestFloatParse, "src/etc/test-float-parse", SourceType::InTree); tool_check_step!(Bootstrap, "src/bootstrap", SourceType::InTree, false); </del> <ins> tool_check_step!(Clippy, "clippy", "src/tools/clippy", SourceType::InTree); tool_check_step!(Miri, "miri", "src/tools/miri", SourceType::InTree); tool_check_step!(CargoMiri, "cargo-miri", "src/tools/miri/cargo-miri", SourceType::InTree); tool_check_step!(Rls, "rls", "src/tools/rls", SourceType::InTree); tool_check_step!(Rustfmt, "rustfmt", "src/tools/rustfmt", SourceType::InTree); tool_check_step!( MiroptTestTools, "miropt-test-tools", "src/tools/miropt-test-tools", SourceType::InTree ); tool_check_step!( TestFloatParse, "test-float-parse", "src/etc/test-float-parse", SourceType::InTree ); tool_check_step!(Bootstrap, "bootstrap", "src/bootstrap", SourceType::InTree, false); </ins> /// Cargo's output path for the standard library in a given stage, compiled /// by a particular compiler for the specified target.


pub fn duplicate(&self) -> io::Result<FileDesc> { // We want to atomically duplicate this file descriptor and set the // CLOEXEC flag, and currently that's done via F_DUPFD_CLOEXEC. This <del> // flag, however, isn't supported on older Linux kernels (earlier than // 2.6.24). // // To detect this and ensure that CLOEXEC is still set, we // follow a strategy similar to musl [1] where if passing // F_DUPFD_CLOEXEC causes `fcntl` to return EINVAL it means it's not // supported (the third parameter, 0, is always valid), so we stop // trying that. // // Also note that Android doesn't have F_DUPFD_CLOEXEC, but get it to // resolve so we at least compile this. // // [1]: http://comments.gmane.org/gmane.linux.lib.musl.general/2963 #[cfg(any(target_os = "android", target_os = "haiku"))] use libc::F_DUPFD as F_DUPFD_CLOEXEC; #[cfg(not(any(target_os = "android", target_os = "haiku")))] use libc::F_DUPFD_CLOEXEC; let make_filedesc = |fd| { let fd = FileDesc::new(fd); fd.set_cloexec()?; Ok(fd) }; static TRY_CLOEXEC: AtomicBool = AtomicBool::new(!cfg!(target_os = "android")); let fd = self.raw(); if TRY_CLOEXEC.load(Ordering::Relaxed) { match cvt(unsafe { libc::fcntl(fd, F_DUPFD_CLOEXEC, 0) }) { // We *still* call the `set_cloexec` method as apparently some // linux kernel at some point stopped setting CLOEXEC even // though it reported doing so on F_DUPFD_CLOEXEC. Ok(fd) => { return Ok(if cfg!(target_os = "linux") { make_filedesc(fd)? } else { FileDesc::new(fd) }); } Err(ref e) if e.raw_os_error() == Some(libc::EINVAL) => { TRY_CLOEXEC.store(false, Ordering::Relaxed); } Err(e) => return Err(e), } } cvt(unsafe { libc::fcntl(fd, libc::F_DUPFD, 0) }).and_then(make_filedesc) </del> <ins> // is a POSIX flag that was added to Linux in 2.6.24. let fd = cvt(unsafe { libc::fcntl(self.raw(), libc::F_DUPFD_CLOEXEC, 0) })?; Ok(FileDesc::new(fd)) </ins> } }


self.expr_as_operand(block, scope, expr) } <ins> /// Like `as_local_call_operand`, except that the argument will /// not be valid once `scope` ends. fn as_call_operand<M>( &mut self, block: BasicBlock, scope: Option<region::Scope>, expr: M, ) -> BlockAnd<Operand<'tcx>> where M: Mirror<'tcx, Output = Expr<'tcx>>, { let expr = self.hir.mirror(expr); self.expr_as_call_operand(block, scope, expr) } </ins> fn expr_as_operand( &mut self, mut block: BasicBlock,


<ins> macro_rules! define_other_core { ( ) => { extern crate std as core; //~^ ERROR macro-expanded `extern crate` items cannot shadow names passed with `--extern` }; } fn main() { core::panic!(); } define_other_core!(); </ins>


<ins> //! This test makes sure that with never show the inner fields in the //! aliased type view of type alias. #![crate_name = "foo"] use std::collections::BTreeMap; // @has 'foo/type.FooBar.html' '//*[@class="rust item-decl"]/code' 'struct FooBar { /* private fields */ }' pub type FooBar = BTreeMap<u32, String>; </ins>


<ins> // check-pass #![feature(marker_trait_attr)] #[marker] trait Marker {} impl Marker for &'static () {} impl Marker for &'static () {} fn main() {} </ins>


<ins> // compile-flags: -Zsave-analysis // Check that this doesn't ICE when processing associated const (field expr). pub fn f() { trait Trait {} impl Trait { const FLAG: u32 = bogus.field; //~ ERROR cannot find value `bogus` } } fn main() {} </ins>


<ins> // check-pass struct Foo<'a>(&'a ()); fn with_fn() -> fn(Foo) { |_| () } fn with_impl_fn() -> impl Fn(Foo) { |_| () } fn with_where_fn<T>() where T: Fn(Foo), { } fn main() {} </ins>


<del> Subproject commit e8b556b6a8836147429abe391d6ed18806867b45 </del> <ins> Subproject commit 3adf16e0cb1a0d9d7216883ac47857a6d1ee6581 </ins>


<ins> // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // Test that multibyte characters don't crash the compiler fn main() { io::println("마이너스 사인이 없으면"); } </ins>


let mut path_str; let (res, fragment) = { let mut kind = None; <ins> let mut disambiguator = None; </ins> path_str = if let Some(prefix) = ["struct@", "enum@", "type@", "trait@", "union@"] .iter() .find(|p| link.starts_with(**p)) { kind = Some(TypeNS); <ins> disambiguator = Some(&prefix[..prefix.len() - 1]); </ins> link.trim_start_matches(prefix) } else if let Some(prefix) = [ "const@",


) { let sccs = self.regioncx.constraint_sccs(); let universal_regions = self.regioncx.universal_regions(); <del> let issuing_region_scc = sccs.scc(issuing_region); </del> // We first handle the cases where the loan doesn't go out of scope, depending on the issuing // region's successors. <del> for scc in sccs.depth_first_search(issuing_region_scc) { </del> <ins> for successor in self.regioncx.region_graph().depth_first_search(issuing_region) { </ins> // 1. Via applied member constraints // // The issuing region can flow into the choice regions, and they are either:


.iter() .enumerate() .map(|(i, ty)| Argument { <del> name: Symbol::intern(&rustc_hir_pretty::param_to_string(&body.params[i])), </del> <ins> name: name_from_pat(&body.params[i].pat), </ins> type_: ty.clean(cx), }) .collect(),


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


<del> error: struct `Whatever` is never constructed --> $DIR/clone-debug-dead-code-in-the-same-struct.rs:4:12 </del> <ins> error: fields `field1`, `field2`, `field3`, and `field4` are never read --> $DIR/clone-debug-dead-code-in-the-same-struct.rs:6:5 </ins> | LL | pub struct Whatever { <del> |            ^^^^^^^^ </del> <ins> |            -------- fields in this struct LL |     pub field0: (), LL |     field1: (), |     ^^^^^^ LL |     field2: (), |     ^^^^^^ LL |     field3: (), |     ^^^^^^ LL |     field4: (), |     ^^^^^^ </ins> | <ins> = note: `Whatever` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis </ins> note: the lint level is defined here --> $DIR/clone-debug-dead-code-in-the-same-struct.rs:1:11 |


/// Parses a statement. This stops just before trailing semicolons on everything but items. /// e.g., a `StmtKind::Semi` parses to a `StmtKind::Expr`, leaving the trailing `;` unconsumed. pub fn parse_stmt(&mut self) -> PResult<'a, Option<Stmt>> { <del> Ok(self.parse_stmt_(true)) } fn parse_stmt_(&mut self, macro_legacy_warnings: bool) -> Option<Stmt> { self.parse_stmt_without_recovery(macro_legacy_warnings).unwrap_or_else(|mut e| { </del> <ins> Ok(self.parse_stmt_without_recovery(true).unwrap_or_else(|mut e| { </ins> e.emit(); self.recover_stmt_(SemiColonMode::Break, BlockMode::Ignore); None <del> }) </del> <ins> })) </ins> } fn parse_stmt_without_recovery(


label: &Destination, cf_type: &str, ) -> bool { <del> if self.cx == LabeledBlock { </del> <ins> if !span.is_desugaring(DesugaringKind::QuestionMark) && self.cx == LabeledBlock { </ins> if label.label.is_none() { struct_span_err!( self.sess,


<del> Subproject commit a7348ae0df3c71581dbe3d355fc0fb6ce6332dd0 </del> <ins> Subproject commit e048e97f5280e8a232a43ae134d395aeab67c2e8 </ins>


} impl<'tcx> FieldDef { <del> /// Returns the type of this field. The `subst` is typically obtained /// via the second field of `TyKind::AdtDef`. </del> <ins> /// Returns the type of this field. The resulting type is not normalized. The `subst` is /// typically obtained via the second field of `TyKind::AdtDef`. </ins> pub fn ty(&self, tcx: TyCtxt<'tcx>, subst: SubstsRef<'tcx>) -> Ty<'tcx> { tcx.type_of(self.did).subst(tcx, subst) }


<ins> // only-x86_64 // check-fail #![feature(lang_items, no_core, target_feature_11)] #![no_core] #[lang = "copy"] pub trait Copy {} #[lang = "sized"] pub trait Sized {} #[lang = "start"] #[target_feature(enable = "avx2")] //~^ ERROR `start` language item function is not allowed to have `#[target_feature]` fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize { 0 } fn main() {} </ins>


use rustc_middle::mir::interpret::{sign_extend, truncate}; use rustc_middle::ty::layout::{IntegerExt, SizeSkeleton}; use rustc_middle::ty::subst::SubstsRef; <del> use rustc_middle::ty::{self, AdtKind, ParamEnv, Ty, TyCtxt, TypeFoldable}; </del> <ins> use rustc_middle::ty::{self, AdtKind, Ty, TypeFoldable}; </ins> use rustc_span::source_map; use rustc_span::symbol::sym; use rustc_span::{Span, DUMMY_SP};


/// } /// ``` #[must_use] <del> #[unstable(feature = "panic_info_message", issue = "66745")] </del> <ins> #[stable(feature = "panic_info_message", since = "CURRENT_RUSTC_VERSION")] </ins> pub fn message(&self) -> PanicMessage<'_> { PanicMessage { message: self.message } }


error[E0508]: cannot move out of type `[u8]`, a non-copy slice <del> --> $DIR/unsized-exprs2.rs:22:19 </del> <ins> --> $DIR/unsized-exprs2.rs:22:5 </ins> | LL |     udrop::<[u8]>(foo()[..]); <del> |                   ^^^^^^^^^ |                   | |                   cannot move out of here |                   move occurs because value has type `[u8]`, which does not implement the `Copy` trait </del> <ins> |     ^^^^^^^^^^^^^^^^^^^^^^^^ |     | |     cannot move out of here |     move occurs because value has type `[u8]`, which does not implement the `Copy` trait </ins> error: aborting due to previous error


rm $(TMPDIR)/bar $(RUSTC) foo.rs --emit=asm,ir,bc,obj,link --crate-type=staticlib rm $(TMPDIR)/bar.ll <del> rm $(TMPDIR)/bar.bc </del> rm $(TMPDIR)/bar.s rm $(TMPDIR)/bar.o rm $(TMPDIR)/$(call STATICLIB_GLOB,bar)


[1.8h]: https://github.com/rust-lang/rust/pull/31460 [1.8l]: https://github.com/rust-lang/rust/pull/31668 [1.8m]: https://github.com/rust-lang/rust/pull/31020 <del> [1.8m]: https://github.com/rust-lang/rust/pull/31534 </del> <ins> [1.8mf]: https://github.com/rust-lang/rust/pull/31534 </ins> [1.8mp]: https://github.com/rust-lang/rust/pull/30894 [1.8mr]: https://users.rust-lang.org/t/multirust-0-8-with-cross-std-installation/4901 [1.8ms]: https://github.com/rust-lang/rust/pull/30448


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


<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. // // no-system-llvm // compile-flags: -O #![crate_type="lib"] #[no_mangle] pub fn sum_me() -> i32 { // CHECK-LABEL: @sum_me // CHECK-NEXT: {{^.*:$}} // CHECK-NEXT: ret i32 6 vec![1, 2, 3].iter().sum::<i32>() } </ins>


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


// for where the type was defined. On the other // hand, `paths` always has the right // information if present. <del> Some(&( ref fqp, ItemType::Trait | ItemType::Struct | ItemType::Union | ItemType::Enum, )) => Some(&fqp[..fqp.len() - 1]), Some(..) => Some(&*self.cache.stack), </del> <ins> Some(&(ref fqp, _)) => Some(&fqp[..fqp.len() - 1]), </ins> None => None, }; ((Some(*last), path), true)


<ins> // Assuming that the hidden type in these tests is `&'_#15r u8`, // we have a member constraint: `'_#15r member ['static, 'a, 'b, 'c]`. // // Make sure we pick up the minimum non-ambiguous region among them. // We will have to exclude `['b, 'c]` because they're incomparable, // and then we should pick `'a` because we know `'static: 'a`. // check-pass trait Cap<'a> {} impl<T> Cap<'_> for T {} fn type_test<'a, T: 'a>() -> &'a u8 { &0 } // Basic test: make sure we don't bail out because 'b and 'c are incomparable. fn basic<'a, 'b, 'c>() -> impl Cap<'a> + Cap<'b> + Cap<'c> where 'a: 'b, 'a: 'c, { &0 } // Make sure we don't pick `'static`. fn test_static<'a, 'b, 'c, T>() -> impl Cap<'a> + Cap<'b> + Cap<'c> where 'a: 'b, 'a: 'c, T: 'a, { type_test::<'_, T>() // This will fail if we pick 'static } fn main() {} </ins>


#![cfg_attr(const_fn, feature(const_fn))] <del> #![feature(const_constructor)] </del> // Ctor(..) is transformed to Ctor { 0: ... } in HAIR lowering, so directly // calling constructors doesn't require them to be const.


<ins> enum e{A((?'a a+?+l))} //~^ ERROR `?` may only modify trait bounds, not lifetime bounds //~| ERROR expected one of `)`, `+`, or `,` //~| ERROR expected trait bound, not lifetime bound </ins>


/// /// Note that the arguments are not passed through a shell, but given /// literally to the program. This means that shell syntax like quotes, <del> /// escaped characters, word splitting, glob patterns, substitution, etc. </del> <ins> /// escaped characters, word splitting, glob patterns, variable substitution, etc. </ins> /// have no effect. /// /// # Examples


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


35 |     #[stable = "1300"] impl S { } |     ^^^^^^^^^^^^^^^^^^ <del> error: aborting due to 9 previous errors </del> <ins> error: aborting due to 8 previous errors </ins>


} _ if sp == expr.span && !is_macro => { if let Some(steps) = self.deref_steps(checked_ty, expected) { <ins> let expr = expr.peel_blocks(); </ins> if steps == 1 { <del> // For a suggestion to make sense, the type would need to be `Copy`. if self.infcx.type_is_copy_modulo_regions(self.param_env, expected, sp) { if let Ok(code) = sm.span_to_snippet(sp) { </del> <ins> if let hir::ExprKind::AddrOf(_, mutbl, inner) = expr.kind { // If the expression has `&`, removing it would fix the error let prefix_span = expr.span.with_hi(inner.span.lo()); let message = match mutbl { hir::Mutability::Not => "consider removing the `&`", hir::Mutability::Mut => "consider removing the `&mut`", }; let suggestion = String::new(); return Some(( prefix_span, message, suggestion, Applicability::MachineApplicable, )); } else if self.infcx.type_is_copy_modulo_regions( self.param_env, expected, sp, ) { // For this suggestion to make sense, the type would need to be `Copy`. if let Ok(code) = sm.span_to_snippet(expr.span) { </ins> let message = if checked_ty.is_region_ptr() { "consider dereferencing the borrow" } else {


-include ../../run-make-fulldeps/tools.mk <del> # only-thumbv7m-none-eabi # only-thumbv6m-none-eabi </del> <ins> # only-thumb </ins> # How to run this # $ ./x.py clean


<ins> error[E0261]: use of undeclared lifetime name `'a` --> $DIR/erase-error-in-mir-drop-tracking.rs:11:46 | LL |     fn connect(&'_ self) -> Self::Connecting<'a>; |                                              ^^ undeclared lifetime | help: consider introducing lifetime `'a` here | LL |     fn connect<'a>(&'_ self) -> Self::Connecting<'a>; |               ++++ help: consider introducing lifetime `'a` here | LL | trait Client<'a> { |             ++++ error: `C` does not live long enough --> $DIR/erase-error-in-mir-drop-tracking.rs:19:5 | LL |     async move { c.connect().await } |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0261`. </ins>


// Allows irrefutable patterns in if-let and while-let statements (RFC 2086) (active, irrefutable_let_patterns, "1.27.0", Some(44495), None), <del> // Allows use of the :literal macro fragment specifier (RFC 1576) (active, macro_literal_matcher, "1.27.0", Some(35625), None), </del> // inconsistent bounds in where clauses (active, trivial_bounds, "1.28.0", Some(48214), None),


// Only "class" methods are generally understood by LLVM, // so avoid methods on other types (e.g., `<*mut T>::null`). <del> match impl_self_ty.kind() { ty::Adt(def, ..) if !def.is_box() => { // Again, only create type information if full debuginfo is enabled if cx.sess().opts.debuginfo == DebugInfo::Full && !impl_self_ty.has_param() { Some(type_di_node(cx, impl_self_ty)) } else { Some(namespace::item_namespace(cx, def.did())) } </del> <ins> if let ty::Adt(def, ..) = impl_self_ty.kind() && !def.is_box() { // Again, only create type information if full debuginfo is enabled if cx.sess().opts.debuginfo == DebugInfo::Full && !impl_self_ty.has_param() { return (type_di_node(cx, impl_self_ty), true); } else { return (namespace::item_namespace(cx, def.did()), false); </ins> } <del> _ => None, </del> } } else { // For trait method impls we still use the "parallel namespace" // strategy <del> None </del> } <del> }); </del> <ins> } </ins> <del> self_type.unwrap_or_else(|| { namespace::item_namespace( cx, DefId { krate: instance.def_id().krate, index: cx .tcx .def_key(instance.def_id()) .parent .expect("get_containing_scope: missing parent?"), }, ) }) </del> <ins> let scope = namespace::item_namespace( cx, DefId { krate: instance.def_id().krate, index: cx .tcx .def_key(instance.def_id()) .parent .expect("get_containing_scope: missing parent?"), }, ); (scope, false) </ins> } }


// declared as public (due to pruning, we don't explore // outside crate private modules => no need to check this) if !in_module_is_extern || name_binding.vis == ty::Visibility::Public { <del> candidates.push(ImportSuggestion { path }); </del> <ins> let did = match def { Def::StructCtor(did, _) | Def::VariantCtor(did, _) => self.parent(did), _ => def.opt_def_id(), }; candidates.push(ImportSuggestion { did, path }); </ins> } } }


write!(f, "{}", hi) } IntRange(range) => write!(f, "{:?}", range), // Best-effort, will render e.g. `false` as `0..=0` <del> Wildcard | Missing { .. } | NonExhaustive => write!(f, "_"), </del> <ins> Wildcard | Missing { .. } | NonExhaustive => write!(f, "_ : {:?}", self.ty), </ins> Or => { for pat in self.iter_fields() { write!(f, "{}{:?}", start_or_continue(" | "), pat)?;


relevant_pr_url, relevant_pr_user, pr_reviewer, <del> cur_datetime </del> <ins> cur_datetime, github_token, </ins> ) if not message: print('<Nothing changed>')


} } else { debug!("receiver_is_valid: type `{:?}` does not deref to `{:?}`", receiver_ty, self_ty); <del> // If the receiver already has errors reported due to it, consider it valid to avoid // unnecessary errors (#58712). return receiver_ty.references_error(); </del> <ins> return false; </ins> } }


<ins> // check-pass // incremental struct Struct<T>(T); impl<T> std::ops::Deref for Struct<T> { type Target = dyn Fn(T); fn deref(&self) -> &Self::Target { unimplemented!() } } fn main() { let f = Struct(Default::default()); f(0); f(0); } </ins>


let tcx = self.tcx; let def_id = instance.def_id(); <del> let containing_scope = get_containing_scope(self, instance); </del> <ins> let (containing_scope, is_method) = get_containing_scope(self, instance); </ins> let span = tcx.def_span(def_id); let loc = self.lookup_debug_loc(span.lo()); let file_metadata = file_metadata(self, &loc.file);


<del> // #![feature(stdsimd)] </del> #![no_main] #![no_std] use core::fmt::Write;


//~^ ERROR missing lifetime specifier //~| ERROR `S<'_>` is forbidden as the type of a const generic parameter <ins> trait Foo<'a> {} struct Bar<const N: &'a (dyn for<'a> Foo<'a>)>; //~^ ERROR use of non-static lifetime `'a` in const generic //~| ERROR `&dyn for<'a> Foo<'a>` is forbidden as the type of a const generic parameter </ins> fn main() {}


20 |     m!(MyTrait<>); //~ ERROR generic arguments in macro path |               ^^ <del> error: aborting due to 5 previous errors </del> <ins> error: aborting due to 4 previous errors </ins>


unsafe impl GlobalAlloc for System { #[inline] unsafe fn alloc(&self, layout: Layout) -> *mut u8 { <ins> // jemalloc provides alignment less than MIN_ALIGN for small allocations. // So only rely on MIN_ALIGN if size >= align. // Also see <https://github.com/rust-lang/rust/issues/45955> and // <https://github.com/rust-lang/rust/issues/62251#issuecomment-507580914>. </ins> if layout.align() <= MIN_ALIGN && layout.align() <= layout.size() { libc::malloc(layout.size()) as *mut u8 } else {


<ins> fn s() -> String { let a = String::new(); dbg!(a); return a; //~ ERROR use of moved value: } fn m() -> String { let a = String::new(); dbg!(1, 2, a, 1, 2); return a; //~ ERROR use of moved value: } fn t(a: String) -> String { let b: String = "".to_string(); dbg!(a, b); return b; //~ ERROR use of moved value: } fn x(a: String) -> String { let b: String = "".to_string(); dbg!(a, b); return a; //~ ERROR use of moved value: } macro_rules! my_dbg { () => { eprintln!("[{}:{}:{}]", file!(), line!(), column!()) }; ($val:expr $(,)?) => { match $val { tmp => { eprintln!("[{}:{}:{}] {} = {:#?}", file!(), line!(), column!(), stringify!($val), &tmp); tmp } } }; ($($val:expr),+ $(,)?) => { ($(my_dbg!($val)),+,) }; } fn test_my_dbg() -> String { let b: String = "".to_string(); my_dbg!(b, 1); return b; //~ ERROR use of moved value: } fn test_not_macro() -> String { let a = String::new(); let _b = match a { tmp => { eprintln!("dbg: {}", tmp); tmp } }; return a; //~ ERROR use of moved value: } fn get_expr(_s: String) {} fn test() { let a: String = "".to_string(); let _res = get_expr(dbg!(a)); let _l = a.len(); //~ ERROR borrow of moved value } fn main() {} </ins>


//! Performs various peephole optimizations. use crate::transform::{MirPass, MirSource}; <del> use rustc_data_structures::fx::FxHashMap; </del> <ins> use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_hir::Mutability; </ins> use rustc_index::vec::Idx; use rustc_middle::mir::visit::{MutVisitor, Visitor}; use rustc_middle::mir::{ <del> Body, Constant, Local, Location, Mutability, Operand, Place, PlaceRef, ProjectionElem, Rvalue, </del> <ins> Body, Constant, Local, Location, Operand, Place, PlaceRef, ProjectionElem, Rvalue, </ins> }; use rustc_middle::ty::{self, TyCtxt}; use std::mem;


/// Declare a static `LintArray` and return it as an expression. #[macro_export] <del> macro_rules! lint_array { ($( $lint:expr ),*) => ( { static ARRAY: LintArray = &[ $( &$lint ),* ]; ARRAY } ) } </del> <ins> macro_rules! lint_array { ($( $lint:expr ),*,) => { lint_array!( $( $lint ),* ) }; ($( $lint:expr ),*) => {{ static ARRAY: LintArray = &[ $( &$lint ),* ]; ARRAY }} } </ins> pub type LintArray = &'static [&'static &'static Lint];


<ins> // Copyright 2013 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. //! Cross-platform file path handling (re-write) use container::Container; use c_str::CString; use clone::Clone; use iter::Iterator; use option::{Option, None, Some}; use str; use str::StrSlice; use vec; use vec::{CopyableVector, OwnedCopyableVector, OwnedVector}; use vec::{ImmutableEqVector, ImmutableVector}; pub mod posix; pub mod windows; /// Typedef for POSIX file paths. /// See `posix::Path` for more info. pub type PosixPath = posix::Path; /// Typedef for Windows file paths. /// See `windows::Path` for more info. pub type WindowsPath = windows::Path; /// Typedef for the platform-native path type #[cfg(unix)] pub type Path = PosixPath; /// Typedef for the platform-native path type #[cfg(windows)] pub type Path = WindowsPath; /// Typedef for the POSIX path component iterator. /// See `posix::ComponentIter` for more info. pub type PosixComponentIter<'self> = posix::ComponentIter<'self>; // /// Typedef for the Windows path component iterator. // /// See `windows::ComponentIter` for more info. // pub type WindowsComponentIter<'self> = windows::ComponentIter<'self>; /// Typedef for the platform-native component iterator #[cfg(unix)] pub type ComponentIter<'self> = PosixComponentIter<'self>; // /// Typedef for the platform-native component iterator //#[cfg(windows)] //pub type ComponentIter<'self> = WindowsComponentIter<'self>; // Condition that is raised when a NUL is found in a byte vector given to a Path function condition! { // this should be a &[u8] but there's a lifetime issue null_byte: ~[u8] -> ~[u8]; } /// A trait that represents the generic operations available on paths pub trait GenericPath: Clone + GenericPathUnsafe { /// Creates a new Path from a byte vector. /// The resulting Path will always be normalized. /// /// # Failure /// /// Raises the `null_byte` condition if the path contains a NUL. /// /// See individual Path impls for additional restrictions. #[inline] fn from_vec(path: &[u8]) -> Self { if contains_nul(path) { let path = self::null_byte::cond.raise(path.to_owned()); assert!(!contains_nul(path)); unsafe { GenericPathUnsafe::from_vec_unchecked(path) } } else { unsafe { GenericPathUnsafe::from_vec_unchecked(path) } } } /// Creates a new Path from a string. /// The resulting Path will always be normalized. /// /// # Failure /// /// Raises the `null_byte` condition if the path contains a NUL. #[inline] fn from_str(path: &str) -> Self { let v = path.as_bytes(); if contains_nul(v) { GenericPath::from_vec(path.as_bytes()) // let from_vec handle the condition } else { unsafe { GenericPathUnsafe::from_str_unchecked(path) } } } /// Creates a new Path from a CString. /// The resulting Path will always be normalized. /// /// See individual Path impls for potential restrictions. #[inline] fn from_c_str(path: CString) -> Self { // CStrings can't contain NULs unsafe { GenericPathUnsafe::from_vec_unchecked(path.as_bytes()) } } /// Returns the path as a string, if possible. /// If the path is not representable in utf-8, this returns None. #[inline] fn as_str<'a>(&'a self) -> Option<&'a str> { str::from_utf8_slice_opt(self.as_vec()) } /// Returns the path as a byte vector fn as_vec<'a>(&'a self) -> &'a [u8]; /// Returns the directory component of `self`, as a byte vector (with no trailing separator). /// If `self` has no directory component, returns ['.']. fn dirname<'a>(&'a self) -> &'a [u8]; /// Returns the directory component of `self`, as a string, if possible. /// See `dirname` for details. #[inline] fn dirname_str<'a>(&'a self) -> Option<&'a str> { str::from_utf8_slice_opt(self.dirname()) } /// Returns the file component of `self`, as a byte vector. /// If `self` represents the root of the file hierarchy, returns the empty vector. /// If `self` is ".", returns the empty vector. fn filename<'a>(&'a self) -> &'a [u8]; /// Returns the file component of `self`, as a string, if possible. /// See `filename` for details. #[inline] fn filename_str<'a>(&'a self) -> Option<&'a str> { str::from_utf8_slice_opt(self.filename()) } /// Returns the stem of the filename of `self`, as a byte vector. /// The stem is the portion of the filename just before the last '.'. /// If there is no '.', the entire filename is returned. fn filestem<'a>(&'a self) -> &'a [u8] { let name = self.filename(); let dot = '.' as u8; match name.rposition_elem(&dot) { None | Some(0) => name, Some(1) if name == bytes!("..") => name, Some(pos) => name.slice_to(pos) } } /// Returns the stem of the filename of `self`, as a string, if possible. /// See `filestem` for details. #[inline] fn filestem_str<'a>(&'a self) -> Option<&'a str> { str::from_utf8_slice_opt(self.filestem()) } /// Returns the extension of the filename of `self`, as an optional byte vector. /// The extension is the portion of the filename just after the last '.'. /// If there is no extension, None is returned. /// If the filename ends in '.', the empty vector is returned. fn extension<'a>(&'a self) -> Option<&'a [u8]> { let name = self.filename(); let dot = '.' as u8; match name.rposition_elem(&dot) { None | Some(0) => None, Some(1) if name == bytes!("..") => None, Some(pos) => Some(name.slice_from(pos+1)) } } /// Returns the extension of the filename of `self`, as a string, if possible. /// See `extension` for details. #[inline] fn extension_str<'a>(&'a self) -> Option<&'a str> { self.extension().and_then(|v| str::from_utf8_slice_opt(v)) } /// Replaces the directory portion of the path with the given byte vector. /// If `self` represents the root of the filesystem hierarchy, the last path component /// of the given byte vector becomes the filename. /// /// # Failure /// /// Raises the `null_byte` condition if the dirname contains a NUL. #[inline] fn set_dirname(&mut self, dirname: &[u8]) { if contains_nul(dirname) { let dirname = self::null_byte::cond.raise(dirname.to_owned()); assert!(!contains_nul(dirname)); unsafe { self.set_dirname_unchecked(dirname) } } else { unsafe { self.set_dirname_unchecked(dirname) } } } /// Replaces the directory portion of the path with the given string. /// See `set_dirname` for details. #[inline] fn set_dirname_str(&mut self, dirname: &str) { if contains_nul(dirname.as_bytes()) { self.set_dirname(dirname.as_bytes()) // triggers null_byte condition } else { unsafe { self.set_dirname_str_unchecked(dirname) } } } /// Replaces the filename portion of the path with the given byte vector. /// If the replacement name is [], this is equivalent to popping the path. /// /// # Failure /// /// Raises the `null_byte` condition if the filename contains a NUL. #[inline] fn set_filename(&mut self, filename: &[u8]) { if contains_nul(filename) { let filename = self::null_byte::cond.raise(filename.to_owned()); assert!(!contains_nul(filename)); unsafe { self.set_filename_unchecked(filename) } } else { unsafe { self.set_filename_unchecked(filename) } } } /// Replaces the filename portion of the path with the given string. /// See `set_filename` for details. #[inline] fn set_filename_str(&mut self, filename: &str) { if contains_nul(filename.as_bytes()) { self.set_filename(filename.as_bytes()) // triggers null_byte condition } else { unsafe { self.set_filename_str_unchecked(filename) } } } /// Replaces the filestem with the given byte vector. /// If there is no extension in `self` (or `self` has no filename), this is equivalent /// to `set_filename`. Otherwise, if the given byte vector is [], the extension (including /// the preceding '.') becomes the new filename. /// /// # Failure /// /// Raises the `null_byte` condition if the filestem contains a NUL. fn set_filestem(&mut self, filestem: &[u8]) { // borrowck is being a pain here let val = { let name = self.filename(); if !name.is_empty() { let dot = '.' as u8; match name.rposition_elem(&dot) { None | Some(0) => None, Some(idx) => { let mut v; if contains_nul(filestem) { let filestem = self::null_byte::cond.raise(filestem.to_owned()); assert!(!contains_nul(filestem)); v = vec::with_capacity(filestem.len() + name.len() - idx); v.push_all(filestem); } else { v = vec::with_capacity(filestem.len() + name.len() - idx); v.push_all(filestem); } v.push_all(name.slice_from(idx)); Some(v) } } } else { None } }; match val { None => self.set_filename(filestem), Some(v) => unsafe { self.set_filename_unchecked(v) } } } /// Replaces the filestem with the given string. /// See `set_filestem` for details. #[inline] fn set_filestem_str(&mut self, filestem: &str) { self.set_filestem(filestem.as_bytes()) } /// Replaces the extension with the given byte vector. /// If there is no extension in `self`, this adds one. /// If the given byte vector is [], this removes the extension. /// If `self` has no filename, this is a no-op. /// /// # Failure /// /// Raises the `null_byte` condition if the extension contains a NUL. fn set_extension(&mut self, extension: &[u8]) { // borrowck causes problems here too let val = { let name = self.filename(); if !name.is_empty() { let dot = '.' as u8; match name.rposition_elem(&dot) { None | Some(0) => { if extension.is_empty() { None } else { let mut v; if contains_nul(extension) { let extension = self::null_byte::cond.raise(extension.to_owned()); assert!(!contains_nul(extension)); v = vec::with_capacity(name.len() + extension.len() + 1); v.push_all(name); v.push(dot); v.push_all(extension); } else { v = vec::with_capacity(name.len() + extension.len() + 1); v.push_all(name); v.push(dot); v.push_all(extension); } Some(v) } } Some(idx) => { if extension.is_empty() { Some(name.slice_to(idx).to_owned()) } else { let mut v; if contains_nul(extension) { let extension = self::null_byte::cond.raise(extension.to_owned()); assert!(!contains_nul(extension)); v = vec::with_capacity(idx + extension.len() + 1); v.push_all(name.slice_to(idx+1)); v.push_all(extension); } else { v = vec::with_capacity(idx + extension.len() + 1); v.push_all(name.slice_to(idx+1)); v.push_all(extension); } Some(v) } } } } else { None } }; match val { None => (), Some(v) => unsafe { self.set_filename_unchecked(v) } } } /// Replaces the extension with the given string. /// See `set_extension` for details. #[inline] fn set_extension_str(&mut self, extension: &str) { self.set_extension(extension.as_bytes()) } /// Returns a new Path constructed by replacing the dirname with the given byte vector. /// See `set_dirname` for details. /// /// # Failure /// /// Raises the `null_byte` condition if the dirname contains a NUL. #[inline] fn with_dirname(&self, dirname: &[u8]) -> Self { let mut p = self.clone(); p.set_dirname(dirname); p } /// Returns a new Path constructed by replacing the dirname with the given string. /// See `set_dirname` for details. #[inline] fn with_dirname_str(&self, dirname: &str) -> Self { let mut p = self.clone(); p.set_dirname_str(dirname); p } /// Returns a new Path constructed by replacing the filename with the given byte vector. /// See `set_filename` for details. /// /// # Failure /// /// Raises the `null_byte` condition if the filename contains a NUL. #[inline] fn with_filename(&self, filename: &[u8]) -> Self { let mut p = self.clone(); p.set_filename(filename); p } /// Returns a new Path constructed by replacing the filename with the given string. /// See `set_filename` for details. #[inline] fn with_filename_str(&self, filename: &str) -> Self { let mut p = self.clone(); p.set_filename_str(filename); p } /// Returns a new Path constructed by setting the filestem to the given byte vector. /// See `set_filestem` for details. /// /// # Failure /// /// Raises the `null_byte` condition if the filestem contains a NUL. #[inline] fn with_filestem(&self, filestem: &[u8]) -> Self { let mut p = self.clone(); p.set_filestem(filestem); p } /// Returns a new Path constructed by setting the filestem to the given string. /// See `set_filestem` for details. #[inline] fn with_filestem_str(&self, filestem: &str) -> Self { let mut p = self.clone(); p.set_filestem_str(filestem); p } /// Returns a new Path constructed by setting the extension to the given byte vector. /// See `set_extension` for details. /// /// # Failure /// /// Raises the `null_byte` condition if the extension contains a NUL. #[inline] fn with_extension(&self, extension: &[u8]) -> Self { let mut p = self.clone(); p.set_extension(extension); p } /// Returns a new Path constructed by setting the extension to the given string. /// See `set_extension` for details. #[inline] fn with_extension_str(&self, extension: &str) -> Self { let mut p = self.clone(); p.set_extension_str(extension); p } /// Returns the directory component of `self`, as a Path. /// If `self` represents the root of the filesystem hierarchy, returns `self`. fn dir_path(&self) -> Self { // self.dirname() returns a NUL-free vector unsafe { GenericPathUnsafe::from_vec_unchecked(self.dirname()) } } /// Returns the file component of `self`, as a relative Path. /// If `self` represents the root of the filesystem hierarchy, returns None. fn file_path(&self) -> Option<Self> { // self.filename() returns a NUL-free vector match self.filename() { [] => None, v => Some(unsafe { GenericPathUnsafe::from_vec_unchecked(v) }) } } /// Pushes a path (as a byte vector) onto `self`. /// If the argument represents an absolute path, it replaces `self`. /// /// # Failure /// /// Raises the `null_byte` condition if the path contains a NUL. #[inline] fn push(&mut self, path: &[u8]) { if contains_nul(path) { let path = self::null_byte::cond.raise(path.to_owned()); assert!(!contains_nul(path)); unsafe { self.push_unchecked(path) } } else { unsafe { self.push_unchecked(path) } } } /// Pushes a path (as a string) onto `self. /// See `push` for details. #[inline] fn push_str(&mut self, path: &str) { if contains_nul(path.as_bytes()) { self.push(path.as_bytes()) // triggers null_byte condition } else { unsafe { self.push_str_unchecked(path) } } } /// Pushes a Path onto `self`. /// If the argument represents an absolute path, it replaces `self`. #[inline] fn push_path(&mut self, path: &Self) { self.push(path.as_vec()) } /// Pops the last path component off of `self` and returns it. /// If `self` represents the root of the file hierarchy, None is returned. fn pop_opt(&mut self) -> Option<~[u8]>; /// Pops the last path component off of `self` and returns it as a string, if possible. /// `self` will still be modified even if None is returned. /// See `pop_opt` for details. #[inline] fn pop_opt_str(&mut self) -> Option<~str> { self.pop_opt().and_then(|v| str::from_utf8_owned_opt(v)) } /// Returns a new Path constructed by joining `self` with the given path (as a byte vector). /// If the given path is absolute, the new Path will represent just that. /// /// # Failure /// /// Raises the `null_byte` condition if the path contains a NUL. #[inline] fn join(&self, path: &[u8]) -> Self { let mut p = self.clone(); p.push(path); p } /// Returns a new Path constructed by joining `self` with the given path (as a string). /// See `join` for details. #[inline] fn join_str(&self, path: &str) -> Self { let mut p = self.clone(); p.push_str(path); p } /// Returns a new Path constructed by joining `self` with the given path. /// If the given path is absolute, the new Path will represent just that. #[inline] fn join_path(&self, path: &Self) -> Self { let mut p = self.clone(); p.push_path(path); p } /// Returns whether `self` represents an absolute path. /// An absolute path is defined as one that, when joined to another path, will /// yield back the same absolute path. fn is_absolute(&self) -> bool; /// Returns whether `self` is equal to, or is an ancestor of, the given path. /// If both paths are relative, they are compared as though they are relative /// to the same parent path. fn is_ancestor_of(&self, other: &Self) -> bool; /// Returns the Path that, were it joined to `base`, would yield `self`. /// If no such path exists, None is returned. /// If `self` is absolute and `base` is relative, or on Windows if both /// paths refer to separate drives, an absolute path is returned. fn path_relative_from(&self, base: &Self) -> Option<Self>; } /// A trait that represents the unsafe operations on GenericPaths pub trait GenericPathUnsafe { /// Creates a new Path from a byte vector without checking for null bytes. /// The resulting Path will always be normalized. unsafe fn from_vec_unchecked(path: &[u8]) -> Self; /// Creates a new Path from a str without checking for null bytes. /// The resulting Path will always be normalized. #[inline] unsafe fn from_str_unchecked(path: &str) -> Self { GenericPathUnsafe::from_vec_unchecked(path.as_bytes()) } /// Replaces the directory portion of the path with the given byte vector without /// checking for null bytes. /// See `set_dirname` for details. unsafe fn set_dirname_unchecked(&mut self, dirname: &[u8]); /// Replaces the directory portion of the path with the given str without /// checking for null bytes. /// See `set_dirname_str` for details. #[inline] unsafe fn set_dirname_str_unchecked(&mut self, dirname: &str) { self.set_dirname_unchecked(dirname.as_bytes()) } /// Replaces the filename portion of the path with the given byte vector without /// checking for null bytes. /// See `set_filename` for details. unsafe fn set_filename_unchecked(&mut self, filename: &[u8]); /// Replaces the filename portion of the path with the given str without /// checking for null bytes. /// See `set_filename_str` for details. #[inline] unsafe fn set_filename_str_unchecked(&mut self, filename: &str) { self.set_filename_unchecked(filename.as_bytes()) } /// Pushes a byte vector onto `self` without checking for null bytes. /// See `push` for details. unsafe fn push_unchecked(&mut self, path: &[u8]); /// Pushes a str onto `self` without checking for null bytes. /// See `push_str` for details. #[inline] unsafe fn push_str_unchecked(&mut self, path: &str) { self.push_unchecked(path.as_bytes()) } } #[inline(always)] fn contains_nul(v: &[u8]) -> bool { v.iter().any(|&x| x == 0) } </ins>


/// Returns an iterator over all function arguments. #[inline] <del> pub fn args_iter(&self) -> impl Iterator<Item = Local> { </del> <ins> pub fn args_iter(&self) -> impl Iterator<Item = Local> + ExactSizeIterator { </ins> let arg_count = self.arg_count; <del> (1..=arg_count).map(Local::new) </del> <ins> (1..arg_count + 1).map(Local::new) </ins> } /// Returns an iterator over all user-defined variables and compiler-generated temporaries (all /// locals that are neither arguments nor the return place). #[inline] <del> pub fn vars_and_temps_iter(&self) -> impl Iterator<Item = Local> { </del> <ins> pub fn vars_and_temps_iter(&self) -> impl Iterator<Item = Local> + ExactSizeIterator { </ins> let arg_count = self.arg_count; let local_count = self.local_decls.len(); (arg_count + 1..local_count).map(Local::new)


})); } <ins> let (inh_first, inh_second) = { let mut inh_variants = (0..variants.len()).filter(|&v| { variants[v].iter().all(|f| f.abi != Abi::Uninhabited) }); (inh_variants.next(), inh_variants.next()) }; if inh_first.is_none() { // Uninhabited because it has no variants, or only uninhabited ones. return Ok(tcx.intern_layout(LayoutDetails::uninhabited(0))); } </ins> let is_struct = !def.is_enum() || // Only one variant is inhabited. (inh_second.is_none() &&


for i in 0..tupled_arg_tys.len() { let arg = &fx.fn_ty.args[idx]; idx += 1; <ins> if arg.pad.is_some() { llarg_idx += 1; } </ins> arg.store_fn_arg(bx, &mut llarg_idx, place.project_field(bx, i)); }


} fn crate_matches(crate_data: &[u8], <del> name: ~str, version: ~str, hash: ~str) -> bool { </del> <ins> name: &str, version: &str, hash: &str) -> bool { </ins> let attrs = decoder::get_crate_attributes(crate_data); match attr::find_crateid(attrs) { None => false, Some(crateid) => { if !hash.is_empty() { let chash = decoder::get_crate_hash(crate_data); <del> if chash != hash { return false; } </del> <ins> if chash.as_slice() != hash { return false; } </ins> } name == crateid.name && (version.is_empty() ||


let args = vec!(self_arg); // Add all the fields as a value which needs to be cleaned at the end of <del> // this scope. for (i, ty) in st.fields.iter().enumerate() { </del> <ins> // this scope. Iterate in reverse order so a Drop impl doesn't reverse // the order in which fields get dropped. for (i, ty) in st.fields.iter().enumerate().rev() { </ins> let llfld_a = adt::struct_field_ptr(variant_cx, &*st, value, i, false); variant_cx.fcx.schedule_drop_mem(cleanup::CustomScope(field_scope), llfld_a, *ty);


/// # Examples /// /// ``` <ins> /// #![feature(inner_deref)] /// let mut s = "HELLO".to_string(); </ins> /// let mut x: Result<String, u32> = Ok("hello".to_string()); <del> /// let y: Result<&mut str, &mut u32> = Ok("HELLO"); </del> <ins> /// let y: Result<&mut str, &mut u32> = Ok(&mut s); </ins> /// assert_eq!(x.as_deref_mut().map(|x| { x.make_ascii_uppercase(); x }), y); /// <ins> /// let mut i = 42; </ins> /// let mut x: Result<String, u32> = Err(42); <del> /// let y: Result<&mut str, &mut u32> = Err(&42); </del> <ins> /// let y: Result<&mut str, &mut u32> = Err(&mut i); </ins> /// assert_eq!(x.as_deref_mut().map(|x| { x.make_ascii_uppercase(); x }), y); /// ``` pub fn as_deref_mut(&mut self) -> Result<&mut T::Target, &mut E> {


if let (local, []) = (&place.local, proj_base) { let decl = &self.body.local_decls[*local]; if decl.internal { <del> // Internal locals are used in the `move_val_init` desugaring. // We want to check unsafety against the source info of the // desugaring, rather than the source info of the RHS. self.source_info = self.body.local_decls[*local].source_info; } else if let LocalInfo::StaticRef { def_id, .. } = decl.local_info { if self.tcx.is_mutable_static(def_id) { self.require_unsafe( "use of mutable static", "mutable statics can be mutated by multiple threads: aliasing  violations or data races will cause undefined behavior", UnsafetyViolationKind::General, ); return; } else if self.tcx.is_foreign_item(def_id) { self.require_unsafe( "use of extern static", "extern statics are not controlled by the Rust type system:  invalid data, aliasing violations or data races will cause  undefined behavior", UnsafetyViolationKind::General, ); return; </del> <ins> if let LocalInfo::StaticRef { def_id, .. } = decl.local_info { if self.tcx.is_mutable_static(def_id) { self.require_unsafe( "use of mutable static", "mutable statics can be mutated by multiple threads: aliasing  violations or data races will cause undefined behavior", UnsafetyViolationKind::General, ); return; } else if self.tcx.is_foreign_item(def_id) { self.require_unsafe( "use of extern static", "extern statics are not controlled by the Rust type system:  invalid data, aliasing violations or data races will cause  undefined behavior", UnsafetyViolationKind::General, ); return; } } else { // Internal locals are used in the `move_val_init` desugaring. // We want to check unsafety against the source info of the // desugaring, rather than the source info of the RHS. self.source_info = self.body.local_decls[*local].source_info; </ins> } } }


.arg("--manifest-path") .arg(builder.src.join("src/tools/miri/test-cargo-miri/Cargo.toml")); cargo.arg("--target").arg(target.rustc_target_arg()); <del> cargo.arg("--tests"); // don't run doctests, they are too confused by the staging </del> cargo.arg("--").args(builder.config.test_args()); <ins> // `prepare_tool_cargo` sets RUSTDOC to the bootstrap wrapper and RUSTDOC_REAL to a dummy path as this is a "run", not a "test". // Also, we want the rustdoc from the "next" stage for the same reason that we build a std from the next stage. // So let's just set that here, and bypass bootstrap's RUSTDOC (just like cargo-miri already ignores bootstrap's RUSTC_WRAPPER). cargo.env("RUSTDOC", builder.rustdoc(compiler_std)); </ins> // Tell `cargo miri` where to find things. cargo.env("MIRI_SYSROOT", &miri_sysroot); cargo.env("MIRI_HOST_SYSROOT", sysroot);


&[], ); miri.add_rustc_lib_path(builder); <del> // Forward arguments. </del> miri.arg("--").arg("--target").arg(target.rustc_target_arg()); <del> miri.args(builder.config.args()); </del> // miri tests need to know about the stage sysroot <del> miri.env("MIRI_SYSROOT", &miri_sysroot); </del> <ins> miri.arg("--sysroot").arg(miri_sysroot); // Forward arguments. This may contain further arguments to the program // after another --, so this must be at the end. miri.args(builder.config.args()); </ins> let mut miri = Command::from(miri); builder.run(&mut miri);


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


} ``` <del> Enums with values are quite useful, but as I mentioned, they're even more useful when they're generic across types. But before we get to generics, let's talk about how to fix these big `if`/`else` statements we've been writing. We'll do that with `match`. </del> <ins> And you can also have something like this: ```{rust} enum StringResult { StringOK(String), ErrorReason(String), } ``` Where a `StringResult` is either an `StringOK`, with the result of a computation, or an `ErrorReason` with a `String` explaining what caused the computation to fail. This kind of `enum`s are actually very useful and are even part of the standard library. As you can see `enum`s with values are quite a powerful tool for data representation, and can be even more useful when they're generic across types. But before we get to generics, let's talk about how to use them with pattern matching, a tool that will let us deconstruct this sum type (the type theory term for enums) in a very elegant way and avoid all these messy `if`/`else`s. </ins> # Match


<del> // Copyright 2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // Test that the :lifetime macro fragment cannot be used when macro_lifetime_matcher // feature gate is not used. macro_rules! m { ($lt:literal) => {} } //~^ ERROR :literal fragment specifier is experimental and subject to change fn main() { m!("some string literal"); } </del>


| ty::Alias(..) | ty::Param(..) | ty::Bound(..) <del> | ty::Error(_) => {} ty::Infer(_) => { </del> <ins> | ty::Error(_) | ty::Infer( ty::InferTy::IntVar(_) | ty::InferTy::FloatVar(_) | ty::InferTy::FreshIntTy(_) | ty::InferTy::FreshFloatTy(_), ) => {} ty::Infer(ty::InferTy::TyVar(_) | ty::InferTy::FreshTy(_)) => { </ins> candidates.ambiguous = true; } }


let loop_hir_id = self.lower_node_id(loop_node_id); let ready_arm = { let x_ident = Ident::with_dummy_span(sym::result); <del> let (x_pat, x_pat_hid) = self.pat_ident(span, x_ident); let x_expr = self.expr_ident(span, x_ident, x_pat_hid); let ready_field = self.single_pat_field(span, x_pat); </del> <ins> let (x_pat, x_pat_hid) = self.pat_ident(gen_future_span, x_ident); let x_expr = self.expr_ident(gen_future_span, x_ident, x_pat_hid); let ready_field = self.single_pat_field(gen_future_span, x_pat); </ins> let ready_pat = self.pat_lang_item_variant( span, hir::LangItem::PollReady,


} debug!(?choice_regions, "after ub"); <del> // If we ruled everything out, we're done. if choice_regions.is_empty() { return false; } // Otherwise, we need to find the minimum remaining choice, if // any, and take that. debug!("choice_regions remaining are {:#?}", choice_regions); let Some(&min_choice) = choice_regions.iter().find(|&r1| { </del> <ins> // At this point we can pick any member of `choice_regions`, but to avoid potential // non-determinism we will pick the *unique minimum* choice. // // Because universal regions are only partially ordered (i.e, not every two regions are // comparable), we will ignore any region that doesn't compare to all others when picking // the minimum choice. // For example, consider `choice_regions = ['static, 'a, 'b, 'c, 'd, 'e]`, where // `'static: 'a, 'static: 'b, 'a: 'c, 'b: 'c, 'c: 'd, 'c: 'e`. // `['d, 'e]` are ignored because they do not compare - the same goes for `['a, 'b]`. let totally_ordered_subset = choice_regions.iter().copied().filter(|&r1| { </ins> choice_regions.iter().all(|&r2| { <del> self.universal_region_relations.outlives(r2, *r1) </del> <ins> self.universal_region_relations.outlives(r1, r2) || self.universal_region_relations.outlives(r2, r1) </ins> }) <ins> }); // Now we're left with `['static, 'c]`. Pick `'c` as the minimum! let Some(min_choice) = totally_ordered_subset.reduce(|r1, r2| { let r1_outlives_r2 = self.universal_region_relations.outlives(r1, r2); let r2_outlives_r1 = self.universal_region_relations.outlives(r2, r1); match (r1_outlives_r2, r2_outlives_r1) { (true, true) => r1.min(r2), (true, false) => r2, (false, true) => r1, (false, false) => bug!("incomparable regions in total order"), } </ins> }) else { <del> debug!("no choice region outlived by all others"); </del> <ins> debug!("no unique minimum choice"); </ins> return false; };


} def load_json_from_response(resp): <ins> # type: (typing.Any) -> typing.Any </ins> content = resp.read() if isinstance(content, bytes): <del> content = content.decode('utf-8') </del> <ins> content_str = content.decode('utf-8') </ins> else: print("Refusing to decode " + str(type(content)) + " to str") <del> return json.loads(content) </del> <ins> return json.loads(content_str) </ins> def validate_maintainers(repo, github_token): <ins> # type: (str, str) -> None </ins> '''Ensure all maintainers are assignable on a GitHub repo''' next_link_re = re.compile(r'<([^>]+)>; rel="next"') # Load the list of assignable people in the GitHub repo <del> assignable = [] url = 'https://api.github.com/repos/%s/collaborators?per_page=100' % repo </del> <ins> assignable = [] # type: typing.List[str] url = 'https://api.github.com/repos/'  + '%s/collaborators?per_page=100' % repo # type: typing.Optional[str] </ins> while url is not None: response = urllib2.urlopen(urllib2.Request(url, headers={ 'Authorization': 'token ' + github_token,


// EMIT_MIR jump_threading.assume.JumpThreading.diff // EMIT_MIR jump_threading.aggregate_copy.JumpThreading.diff // EMIT_MIR jump_threading.floats.JumpThreading.diff <ins> // EMIT_MIR jump_threading.bitwise_not.JumpThreading.diff </ins>


--> $DIR/functional-struct-update-respects-privacy.rs:28:49 | LL |     let s_2 = foo::S { b: format!("ess two"), ..s_1 }; // FRU ... <del> |                                                 ^^^ private field </del> <ins> |                                                 ^^^ field `secret_uid` is private </ins> error: aborting due to previous error


use rustc_hir::def::{DefKind, DocLinkResMap, Namespace, Res}; use rustc_hir::HirId; use rustc_lint_defs::Applicability; <del> use rustc_resolve::rustdoc::source_span_for_markdown_range; </del> <ins> use rustc_resolve::rustdoc::{prepare_to_doc_link_resolution, source_span_for_markdown_range}; </ins> use rustc_span::def_id::DefId; use rustc_span::Symbol;


sess.note(&format!("{:?}", &cmd)); let mut output = prog.stderr.clone(); output.push_all(&prog.stdout); <del> sess.note(str::from_utf8(&output[..]).unwrap()); </del> <ins> sess.note(&*escape_string(&output[..])); </ins> sess.abort_if_errors(); } <del> info!("linker stderr:n{}", String::from_utf8(prog.stderr).unwrap()); info!("linker stdout:n{}", String::from_utf8(prog.stdout).unwrap()); </del> <ins> info!("linker stderr:n{}", escape_string(&prog.stderr[..])); info!("linker stdout:n{}", escape_string(&prog.stdout[..])); </ins> }, Err(e) => { sess.fatal(&format!("could not exec the linker `{}`: {}", pname, e));


codegen_fn_attrs.export_name = Some(s); } } else if attr.check_name(sym::target_feature) { <del> if tcx.fn_sig(id).unsafety() == Unsafety::Normal { </del> <ins> if tcx.is_closure(id) || tcx.fn_sig(id).unsafety() == Unsafety::Normal { </ins> let msg = "`#[target_feature(..)]` can only be applied to `unsafe` functions"; tcx.sess .struct_span_err(attr.span, msg)


// except according to those terms. // run-pass <del> #![feature(macro_literal_matcher)] </del> macro_rules! a { ($i:literal) => { "right" };


cargo: Option<PathBuf> = "cargo", rustc: Option<PathBuf> = "rustc", rustfmt: Option<PathBuf> = "rustfmt", <ins> cargo_clippy: Option<PathBuf> = "cargo-clippy", </ins> docs: Option<bool> = "docs", compiler_docs: Option<bool> = "compiler-docs", library_docs_private_items: Option<bool> = "library-docs-private-items",


run_path_with_cstr(original, &|original| { run_path_with_cstr(link, &|link| { cfg_if::cfg_if! { <del> if #[cfg(any(target_os = "vxworks", target_os = "redox", target_os = "android", target_os = "espidf", target_os = "horizon", target_os = "vita", target_os = "nto"))] { </del> <ins> if #[cfg(any(target_os = "vxworks", target_os = "redox", target_os = "android", target_os = "espidf", target_os = "horizon", target_os = "vita", target_env = "nto70"))] { </ins> // VxWorks, Redox and ESP-IDF lack `linkat`, so use `link` instead. POSIX leaves // it implementation-defined whether `link` follows symlinks, so rely on the // `symlink_hard_link` test in library/std/src/fs/tests.rs to check the behavior.


} pub fn return_type_impl_trait(self, scope_def_id: LocalDefId) -> Option<(Ty<'tcx>, Span)> { <del> // HACK: `type_of_def_id()` will fail on these (#55796), so return `None`. </del> <ins> // `type_of()` will fail on these (#55796, #86483), so only allow `fn`s or closures. </ins> let hir_id = self.hir().local_def_id_to_hir_id(scope_def_id); match self.hir().get(hir_id) { <del> Node::Item(item) => { match item.kind { ItemKind::Fn(..) => { /* `type_of_def_id()` will work */ } _ => { return None; } } } _ => { /* `type_of_def_id()` will work or panic */ } </del> <ins> Node::Item(&hir::Item { kind: ItemKind::Fn(..), .. }) => {} Node::TraitItem(&hir::TraitItem { kind: TraitItemKind::Fn(..), .. }) => {} Node::ImplItem(&hir::ImplItem { kind: ImplItemKind::Fn(..), .. }) => {} Node::Expr(&hir::Expr { kind: ExprKind::Closure(..), .. }) => {} _ => return None, </ins> } let ret_ty = self.type_of(scope_def_id);


pub fn replace<'a, R>( &self, replacement: <T as ApplyL<'a>>::Out, <del> f: impl for<'b, 'c> FnOnce(RefMutL<'b, 'c, T>) -> R, </del> <ins> f: impl for<'b, 'c> FnOnce(&'b mut <T as ApplyL<'c>>::Out) -> R, </ins> ) -> R { /// Wrapper that ensures that the cell always gets filled /// (with the original state, optionally changed by `f`),


<ins> // Regression test for #61320 // This is the same issue as #61311, just a larger test case. // compile-pass pub struct AndThen<A, B, F> where A: Future, B: IntoFuture, { state: (A, B::Future, F), } pub struct FutureResult<T, E> { inner: Option<Result<T, E>>, } impl<T, E> Future for FutureResult<T, E> { type Item = T; type Error = E; fn poll(&mut self) -> Poll<T, E> { unimplemented!() } } pub type Poll<T, E> = Result<T, E>; impl<A, B, F> Future for AndThen<A, B, F> where A: Future, B: IntoFuture<Error = A::Error>, F: FnOnce(A::Item) -> B, { type Item = B::Item; type Error = B::Error; fn poll(&mut self) -> Poll<B::Item, B::Error> { unimplemented!() } } pub trait Future { type Item; type Error; fn poll(&mut self) -> Poll<Self::Item, Self::Error>; fn and_then<F, B>(self, f: F) -> AndThen<Self, B, F> where F: FnOnce(Self::Item) -> B, B: IntoFuture<Error = Self::Error>, Self: Sized, { unimplemented!() } } pub trait IntoFuture { /// The future that this type can be converted into. type Future: Future<Item = Self::Item, Error = Self::Error>; /// The item that the future may resolve with. type Item; /// The error that the future may resolve with. type Error; /// Consumes this object and produces a future. fn into_future(self) -> Self::Future; } impl<F: Future> IntoFuture for F { type Future = F; type Item = F::Item; type Error = F::Error; fn into_future(self) -> F { self } } impl<F: ?Sized + Future> Future for ::std::boxed::Box<F> { type Item = F::Item; type Error = F::Error; fn poll(&mut self) -> Poll<Self::Item, Self::Error> { (**self).poll() } } impl<T, E> IntoFuture for Result<T, E> { type Future = FutureResult<T, E>; type Item = T; type Error = E; fn into_future(self) -> FutureResult<T, E> { unimplemented!() } } struct Request<T>(T); trait RequestContext {} impl<T> RequestContext for T {} struct NoContext; impl AsRef<NoContext> for NoContext { fn as_ref(&self) -> &Self { &NoContext } } type BoxedError = Box<dyn std::error::Error + Send + Sync>; type DefaultFuture<T, E> = Box<dyn Future<Item = T, Error = E> + Send>; trait Guard: Sized { type Result: IntoFuture<Item = Self, Error = BoxedError>; fn from_request(request: &Request<()>) -> Self::Result; } trait FromRequest: Sized { type Context; type Future: Future<Item = Self, Error = BoxedError> + Send; fn from_request(request: Request<()>) -> Self::Future; } struct MyGuard; impl Guard for MyGuard { type Result = Result<Self, BoxedError>; fn from_request(_request: &Request<()>) -> Self::Result { Ok(MyGuard) } } struct Generic<I> { _inner: I, } impl<I> FromRequest for Generic<I> where MyGuard: Guard, <MyGuard as Guard>::Result: IntoFuture<Item = MyGuard, Error = BoxedError>, <<MyGuard as Guard>::Result as IntoFuture>::Future: Send, I: FromRequest<Context = NoContext>, { type Future = DefaultFuture<Self, BoxedError>; type Context = NoContext; fn from_request(headers: Request<()>) -> DefaultFuture<Self, BoxedError> { let _future = <MyGuard as Guard>::from_request(&headers) .into_future() .and_then(move |_| { <I as FromRequest>::from_request(headers) .into_future() .and_then(move |fld_inner| Ok(Generic { _inner: fld_inner }).into_future()) }); panic!(); } } fn main() {} </ins>


// // We could remove this hack whenever we decide to drop macOS 10.10 support. if self.tcx.sess.target.target.options.is_like_osx { <del> assert_eq!(alloc.relocations().len(), 0); let is_zeroed = { // Treats undefined bytes as if they were defined with the byte value that // happens to be currently assigned in mir. This is valid since reading // undef bytes may yield arbitrary values. // // FIXME: ignore undef bytes even with representation `!= 0`. // // The `inspect` method is okay here because we checked relocations, and // because we are doing this access to inspect the final interpreter state // (not as part of the interpreter execution). alloc </del> <ins> // The `inspect` method is okay here because we checked relocations, and // because we are doing this access to inspect the final interpreter state // (not as part of the interpreter execution). // // FIXME: This check requires that the (arbitrary) value of undefined bytes // happens to be zero. Instead, we should only check the value of defined bytes // and set all undefined bytes to zero if this allocation is headed for the // BSS. let all_bytes_are_zero = alloc.relocations().is_empty() && alloc </ins> .inspect_with_undef_and_ptr_outside_interpreter(0..alloc.len()) .iter() <del> .all(|b| *b == 0) }; let sect_name = if is_zeroed { </del> <ins> .all(|&byte| byte == 0); let sect_name = if all_bytes_are_zero { </ins> CStr::from_bytes_with_nul_unchecked(b"__DATA,__thread_bss0") } else { CStr::from_bytes_with_nul_unchecked(b"__DATA,__thread_data0")


pluralize, CodeSuggestion, Diagnostic, DiagnosticId, Level, SubDiagnostic, SuggestionStyle, }; <ins> use log::*; </ins> use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync::Lrc; use rustc_span::hygiene::{ExpnKind, MacroKind};


<ins> struct Foo< 'a, const N: usize = { let x: &'a (); //~^ ERROR use of non-static lifetime `'a` in const generic 3 }, >(&'a ()); fn main() {} </ins>


// @matches foo/fn.function_with_a_really_long_name.html '//*[@class="rust item-decl"]//code' " //     function_with_a_really_long_name(n //        parameter_one: i32,n <del> //        parameter_two: i32n </del> <ins> //        parameter_two: i32,n </ins> //    ) -> Option<i32>$" pub fn function_with_a_really_long_name(parameter_one: i32, parameter_two: i32) -> Option<i32> { Some(parameter_one + parameter_two)


RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-extended --enable-ninja SCRIPT: python x.py dist MINGW_URL: https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror <del> MINGW_ARCHIVE: i686-6.2.0-release-win32-dwarf-rt_v5-rev1.7z </del> <ins> MINGW_ARCHIVE: i686-6.2.0-release-posix-dwarf-rt_v5-rev1.7z </ins> MINGW_DIR: mingw32 DEPLOY: 1 - MSYS_BITS: 64 SCRIPT: python x.py dist RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-extended --enable-ninja MINGW_URL: https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror <del> MINGW_ARCHIVE: x86_64-6.2.0-release-win32-seh-rt_v5-rev1.7z </del> <ins> MINGW_ARCHIVE: x86_64-6.2.0-release-posix-seh-rt_v5-rev1.7z </ins> MINGW_DIR: mingw64 DEPLOY: 1


use cortex_m_rt::entry; use cortex_m_semihosting as semihosting; <del> //FIXME: This imports the provided #[panic_handler]. #[allow(rust_2018_idioms)] extern crate panic_halt; entry!(main); </del> <ins> use panic_halt as _; #[entry] </ins> fn main() -> ! { let x = 42;


// We couldn't calculate the span of the markdown block that had the error, so our // diagnostics are going to be a bit lacking. let mut diag = self.cx.sess().struct_span_warn( <del> super::span_of_attrs(&item.attrs), </del> <ins> super::span_of_attrs(&item.attrs).unwrap_or(item.source.span()), </ins> "doc comment contains an invalid Rust code block", );


<ins> -include ../tools.mk # Test output to be four # The original error only occurred when printing, not when comparing using assert! all: $(RUSTC) foo.rs -O [ `$(call RUN,foo)` = "4" ] </ins>


<ins> // build-pass // edition:2018 static mut A: [i32; 5] = [1, 2, 3, 4, 5]; fn is_send_sync<T: Send + Sync>(_: T) {} async fn fun() { let u = unsafe { A[async { 1 }.await] }; unsafe { match A { i if async { true }.await => (), _ => (), } } } fn main() { let index_block = async { let u = unsafe { A[async { 1 }.await] }; }; let match_block = async { unsafe { match A { i if async { true }.await => (), _ => (), } } }; is_send_sync(index_block); is_send_sync(match_block); is_send_sync(fun()); } </ins>


static G: fn() = aux::G; static H: &(dyn Fn() + Sync) = aux::H; static I: fn() = aux::I; <ins> static K: fn() -> fn() = aux::K; </ins> fn v() -> *const u32 { V


) } <ins> fn is_glob_import(tcx: TyCtxt<'_>, import_id: LocalDefId) -> bool { if let Some(node) = tcx.opt_hir_node_by_def_id(import_id) && let hir::Node::Item(item) = node && let hir::ItemKind::Use(_, use_kind) = item.kind { use_kind == hir::UseKind::Glob } else { false } } </ins> fn generate_item_with_correct_attrs( cx: &mut DocContext<'_>, kind: ItemKind,


f: F) { let prev_owner = self.current_dep_node_owner; let prev_signature_dep_index = self.current_signature_dep_index; <del> let prev_full_dep_index = self.current_signature_dep_index; </del> <ins> let prev_full_dep_index = self.current_full_dep_index; </ins> let prev_in_body = self.currently_in_body; let def_path_hash = self.definitions.def_path_hash(dep_node_owner);


#[cfg(unix, test)] mod test { use core::prelude::*; <ins> use core::os; </ins> // FIXME(#2119): the outer attribute should be #[cfg(unix, test)], then // these redundant #[cfg(test)] blocks can be removed #[cfg(test)] #[cfg(test)] <del> use back::rpath::{get_install_prefix_rpath}; </del> <ins> use back::rpath::{get_absolute_rpath, get_install_prefix_rpath}; </ins> use back::rpath::{get_relative_to, get_rpath_relative_to_output}; use back::rpath::{minimize_rpaths, rpaths_to_flags}; use driver::session;


<ins> // Regression test for #97405. // In `good_generic_fn` the param `T` ends up in the substs of closures/generators, // but we should be able to prove `<Gen<T> as Iterator>::Item: 'static` without // requiring `T: 'static` // edition:2018 // check-fail fn opaque<F>(_: F) -> impl Iterator { b"".iter() } fn assert_static<T: 'static>(_: T) {} fn good_generic_fn<T>() { // Previously, proving `<OpaqueTy<type_of(async {})> as Iterator>::Item: 'static` // used to require `T: 'static`. assert_static(opaque(async {}).next()); assert_static(opaque(|| {}).next()); assert_static(opaque(opaque(async {}).next()).next()); } // This should fail because `T` ends up in the upvars of the closure. fn bad_generic_fn<T: Copy>(t: T) { assert_static(opaque(async move { t; }).next()); //~^ ERROR the associated type `<impl Iterator as Iterator>::Item` may not live long enough assert_static(opaque(move || { t; }).next()); //~^ ERROR the associated type `<impl Iterator as Iterator>::Item` may not live long enough assert_static(opaque(opaque(async move { t; }).next()).next()); //~^ ERROR the associated type `<impl Iterator as Iterator>::Item` may not live long enough } fn main() {} </ins>


<ins> error: conflicting implementations of trait `FnMarker` for type `fn(&_)` --> $DIR/negative-coherence-placeholder-region-constraints-on-unification.rs:21:1 | LL | impl<T: ?Sized + Marker> FnMarker for fn(T) {} | ------------------------------------------- first implementation here LL | impl<T: ?Sized> FnMarker for fn(&T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `fn(&_)` | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #56105 <https://github.com/rust-lang/rust/issues/56105> = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details note: the lint level is defined here --> $DIR/negative-coherence-placeholder-region-constraints-on-unification.rs:4:11 | LL | #![forbid(coherence_leak_check)] |           ^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error </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 A { type Output; fn a(&self) -> <Self as A>::X; //~^ ERROR: use of undeclared associated type `A::X` } impl A for u32 { type Output = u32; fn a(&self) -> u32 { 0 } } fn main() { let a: u32 = 0; let b: u32 = a.a(); } </ins>


passes_proc_macro_bad_sig = {$kind} has incorrect signature <ins> passes_remove_fields = consider removing { $num -> [one] this *[other] these } { $num -> [one] field *[other] fields } </ins> passes_repr_conflicting = conflicting representation hints


/// commonly necessary if the structure is using an unsafe pointer /// like `*mut T` whose referent may be dropped when the type is /// dropped, as a `*mut T` is otherwise not treated as owned. <del> /// /// FIXME. Better documentation and examples of common patterns needed /// here! For now, please see [RFC 738][738] for more information. /// /// [738]: https://github.com/rust-lang/rfcs/blob/master/text/0738-variance.md </del> #[lang="phantom_data"] #[stable(feature = "rust1", since = "1.0.0")] pub struct PhantomData<T:?Sized>;


unpack(tarball, tarball_suffix, self.bin_root(stage0), match=pattern, verbose=self.verbose) def _download_ci_llvm(self, llvm_sha, llvm_assertions): <ins> if not llvm_sha: print("error: could not find commit hash for downloading LLVM") print("help: maybe your repository history is too shallow?") print("help: consider disabling `download-ci-llvm`") print("help: or fetch enough history to include one upstream commit") exit(1) </ins> cache_prefix = "llvm-{}-{}".format(llvm_sha, llvm_assertions) cache_dst = os.path.join(self.build_dir, "cache") rustc_cache = os.path.join(cache_dst, cache_prefix)


/// # Examples /// /// ``` <del> /// #![feature(osstring_ascii)] </del> /// use std::ffi::OsString; /// /// let ascii = OsString::from("hello!n");


let text = lines.collect::<Vec<&str>>().join("n"); if rendered { return } PLAYGROUND_KRATE.with(|krate| { <del> let mut s = String::new(); </del> <ins> // insert newline to clearly separate it from the // previous block so we can shorten the html output let mut s = String::from("n"); </ins> krate.borrow().as_ref().map(|krate| { let test = origtext.lines().map(|l| { stripped_filtered_line(l).unwrap_or(l)


/// # Examples /// /// ``` <del> /// #![feature(osstring_ascii)] </del> /// use std::ffi::OsString; /// /// let mut s = OsString::from("GRÜßE, JÜRGEN ❤");


<ins> #![feature(adt_const_params)] #![allow(incomplete_features)] use std::marker::ConstParamTy; #[derive(ConstParamTy)] //~^ the trait `ConstParamTy` cannot be implemented for this ty struct Foo([*const u8; 1]); #[derive(ConstParamTy)] //~^ the trait `ConstParamTy` cannot be implemented for this ty struct Foo2([*mut u8; 1]); #[derive(ConstParamTy)] //~^ the trait `ConstParamTy` cannot be implemented for this ty struct Foo3([fn(); 1]); fn main() {} </ins>


return Err(reported); } <del> let collected_types = collector.types; </del> // Finally, resolve all regions. This catches wily misuses of // lifetime parameters. let outlives_env = OutlivesEnvironment::with_bounds(


// crates they depend on. let rel_rpaths = get_rpaths_relative_to_output(os, output, libs); <ins> // Make backup absolute paths to the libraries. Binaries can // be moved as long as the crates they link against don't move. let abs_rpaths = get_absolute_rpaths(libs); </ins> // And a final backup rpath to the global library location. let fallback_rpaths = ~[get_install_prefix_rpath(target_triple)];


|          - unclosed delimiter ... LL | fn foo() { <del> |          - unclosed delimiter ... LL | fn bar() { |          - unclosed delimiter </del> <ins> |          - another 3 unclosed delimiters begin from here </ins> ... <del> LL | fn baz() { |          - unclosed delimiter LL |     if false { </del> LL |         { |         - this delimiter might not be properly closed... LL |             && let () = ()


Ok(()) } <del> fn is_legal_fragment_specifier(sess: &ParseSess, features: &Features, attrs: &[ast::Attribute], </del> <ins> fn is_legal_fragment_specifier(_sess: &ParseSess, _features: &Features, _attrs: &[ast::Attribute], </ins> frag_name: &str, <del> frag_span: Span) -> bool { </del> <ins> _frag_span: Span) -> bool { /* * If new fragment specifiers are invented in nightly, `_sess`, * `_features`, `_attrs`, and `_frag_span` will be useful here * for checking against feature gates. See past versions of * this function. */ </ins> match frag_name { "item" | "block" | "stmt" | "expr" | "pat" | "lifetime" | <del> "path" | "ty" | "ident" | "meta" | "tt" | "vis" | "" => true, "literal" => { if !features.macro_literal_matcher && !attr::contains_name(attrs, "allow_internal_unstable") { let explain = feature_gate::EXPLAIN_LITERAL_MATCHER; emit_feature_err(sess, "macro_literal_matcher", frag_span, GateIssue::Language, explain); } true }, </del> <ins> "path" | "ty" | "ident" | "meta" | "tt" | "vis" | "literal" | "" => true, </ins> _ => false, } }