jiebi/CodeConvo huggingface dataset:
<ins> // Caveat - gdb doesn't know about UTF-32 character encoding and will print a // rust char as only its numerical value. // min-lldb-version: 310 // min-gdb-version: 8.0 // no-prefer-dynamic // compile-flags:-g -C lto // gdb-command:run // gdbg-command:print 'basic_types_globals::B' // gdbr-command:print B // gdb-check:$1 = false // gdbg-command:print 'basic_types_globals::I' // gdbr-command:print I // gdb-check:$2 = -1 // gdbg-command:print 'basic_types_globals::C' // gdbr-command:print C // gdbg-check:$3 = 97 // gdbr-check:$3 = 97 // gdbg-command:print/d 'basic_types_globals::I8' // gdbr-command:print I8 // gdb-check:$4 = 68 // gdbg-command:print 'basic_types_globals::I16' // gdbr-command:print I16 // gdb-check:$5 = -16 // gdbg-command:print 'basic_types_globals::I32' // gdbr-command:print I32 // gdb-check:$6 = -32 // gdbg-command:print 'basic_types_globals::I64' // gdbr-command:print I64 // gdb-check:$7 = -64 // gdbg-command:print 'basic_types_globals::U' // gdbr-command:print U // gdb-check:$8 = 1 // gdbg-command:print/d 'basic_types_globals::U8' // gdbr-command:print U8 // gdb-check:$9 = 100 // gdbg-command:print 'basic_types_globals::U16' // gdbr-command:print U16 // gdb-check:$10 = 16 // gdbg-command:print 'basic_types_globals::U32' // gdbr-command:print U32 // gdb-check:$11 = 32 // gdbg-command:print 'basic_types_globals::U64' // gdbr-command:print U64 // gdb-check:$12 = 64 // gdbg-command:print 'basic_types_globals::F32' // gdbr-command:print F32 // gdb-check:$13 = 2.5 // gdbg-command:print 'basic_types_globals::F64' // gdbr-command:print F64 // gdb-check:$14 = 3.5 // gdb-command:continue #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] // N.B. These are `mut` only so they don't constant fold away. static mut B: bool = false; static mut I: isize = -1; static mut C: char = 'a'; static mut I8: i8 = 68; static mut I16: i16 = -16; static mut I32: i32 = -32; static mut I64: i64 = -64; static mut U: usize = 1; static mut U8: u8 = 100; static mut U16: u16 = 16; static mut U32: u32 = 32; static mut U64: u64 = 64; static mut F32: f32 = 2.5; static mut F64: f64 = 3.5; fn main() { _zzz(); // #break let a = unsafe { (B, I, C, I8, I16, I32, I64, U, U8, U16, U32, U64, F32, F64) }; } fn _zzz() {()} </ins>
<del> // Caveats - gdb prints any 8-bit value (meaning rust I8 and u8 values) // as its numerical value along with its associated ASCII char, there // doesn't seem to be any way around this. Also, gdb doesn't know // about UTF-32 character encoding and will print a rust char as only // its numerical value. </del> <ins> // Caveat - gdb doesn't know about UTF-32 character encoding and will print a // rust char as only its numerical value. </ins> // min-lldb-version: 310 <del> // ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 </del> <ins> // min-gdb-version: 8.0 </ins> // compile-flags:-g // gdb-command:run
// gdbg-command:print 'basic_types_globals::C' // gdbr-command:print C // gdbg-check:$3 = 97 <del> // gdbr-check:$3 = 97 'a' </del> <ins> // gdbr-check:$3 = 97 </ins> // gdbg-command:print/d 'basic_types_globals::I8' // gdbr-command:print I8 // gdb-check:$4 = 68
}) .enumerate() .map(|(i, r)| match r { <del> Err(TypeError::Sorts(exp_found)) => Err(TypeError::ArgumentSorts(exp_found, i)), Err(TypeError::Mutability) => Err(TypeError::ArgumentMutability(i)), </del> <ins> Err(TypeError::Sorts(exp_found) | TypeError::ArgumentSorts(exp_found, _)) => { Err(TypeError::ArgumentSorts(exp_found, i)) } Err(TypeError::Mutability | TypeError::ArgumentMutability(_)) => { Err(TypeError::ArgumentMutability(i)) } </ins> r => r, }); Ok(ty::FnSig {
<ins> pub struct A; impl From<fn((), (), &())> for A { fn from(_: fn((), (), &mut ())) -> Self { //~^ error: method `from` has an incompatible type for trait loop {} } } pub struct B; impl From<fn((), (), u32)> for B { fn from(_: fn((), (), u64)) -> Self { //~^ error: method `from` has an incompatible type for trait loop {} } } fn main() {} </ins>
<ins> error[E0053]: method `from` has an incompatible type for trait --> $DIR/issue-90444.rs:3:16 | LL |     fn from(_: fn((), (), &mut ())) -> Self { |                ^^^^^^^^^^^^^^^^^^^ |                | |                types differ in mutability |                help: change the parameter type to match the trait: `for<'r> fn((), (), &'r ())` | = note: expected fn pointer `fn(for<'r> fn((), (), &'r ())) -> A` found fn pointer `fn(for<'r> fn((), (), &'r mut ())) -> A` error[E0053]: method `from` has an incompatible type for trait --> $DIR/issue-90444.rs:11:16 | LL |     fn from(_: fn((), (), u64)) -> Self { |                ^^^^^^^^^^^^^^^ |                | |                expected `u32`, found `u64` |                help: change the parameter type to match the trait: `fn((), (), u32)` | = note: expected fn pointer `fn(fn((), (), u32)) -> B` found fn pointer `fn(fn((), (), u64)) -> B` error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0053`. </ins>
pub fn staging_dep_graph_path(sess: &Session) -> PathBuf { in_incr_comp_dir_sess(sess, STAGING_DEP_GRAPH_FILENAME) } <del> pub fn dep_graph_path_from(incr_comp_session_dir: &Path) -> PathBuf { in_incr_comp_dir(incr_comp_session_dir, DEP_GRAPH_FILENAME) } </del> pub fn work_products_path(sess: &Session) -> PathBuf { in_incr_comp_dir_sess(sess, WORK_PRODUCTS_FILENAME)
// Calling `sess.incr_comp_session_dir()` will panic if `sess.opts.incremental.is_none()`. // Fortunately, we just checked that this isn't the case. <del> let path = dep_graph_path_from(&sess.incr_comp_session_dir()); </del> <ins> let path = dep_graph_path(&sess); </ins> let report_incremental_info = sess.opts.debugging_opts.incremental_info; let expected_hash = sess.opts.dep_tracking_hash(false);
The goal of each stage is to (a) leverage Cargo as much as possible and failing that (b) leverage Rust as much as possible! <del> ## Incremental builds You can configure rustbuild to use incremental compilation with the `--incremental` flag: ```sh $ ./x.py build --incremental ``` The `--incremental` flag will store incremental compilation artifacts in `build/<host>/stage0-incremental`. Note that we only use incremental compilation for the stage0 -> stage1 compilation -- this is because the stage1 compiler is changing, and we don't try to cache and reuse incremental artifacts across different versions of the compiler. You can always drop the `--incremental` to build as normal (but you will still be using the local nightly as your bootstrap). </del> ## Directory Layout This build system houses all output under the `build` directory, which looks
Changes that do not affect contributors to the compiler or users building rustc from source don't need an update to `VERSION`. <del> If you have any questions, feel free to reach out on the `#t-infra` channel in the [Rust Zulip server][rust-zulip] or ask on internals.rust-lang.org. When you encounter bugs, please file issues on the rust-lang/rust issue tracker. </del> <ins> If you have any questions, feel free to reach out on the `#t-infra/bootstrap` channel at [Rust Bootstrap Zulip server][rust-bootstrap-zulip]. When you encounter bugs, please file issues on the [Rust issue tracker][rust-issue-tracker]. </ins> <del> [rust-zulip]: https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra </del> <ins> [rust-bootstrap-zulip]: https://rust-lang.zulipchat.com/#narrow/stream/t-infra.2Fbootstrap [rust-issue-tracker]: https://github.com/rust-lang/rust/issues </ins>
<ins> error[E0412]: cannot find type `n` in this scope --> $DIR/issue-90871.rs:2:8 | LL |     2: n([u8; || 1]) |        ^ expecting a type here because of type ascription error[E0308]: mismatched types --> $DIR/issue-90871.rs:2:15 | LL |     2: n([u8; || 1]) |               ^^^^ expected `usize`, found closure | = note: expected type `usize` found closure `[closure@$DIR/issue-90871.rs:2:15: 2:17]` help: use parentheses to call this closure | LL |     2: n([u8; (|| 1)()]) |               +    +++ error: aborting due to 2 previous errors Some errors have detailed explanations: E0308, E0412. For more information about an error, try `rustc --explain E0308`. </ins>
} match t.kind() { ty::Dynamic(..) => { <del> // load size/align from vtable </del> <ins> // Load size/align from vtable. </ins> let vtable = info.unwrap(); <del> ( meth::VirtualIndex::from_index(ty::COMMON_VTABLE_ENTRIES_SIZE) .get_usize(bx, vtable), meth::VirtualIndex::from_index(ty::COMMON_VTABLE_ENTRIES_ALIGN) .get_usize(bx, vtable), ) </del> <ins> let size = meth::VirtualIndex::from_index(ty::COMMON_VTABLE_ENTRIES_SIZE) .get_usize(bx, vtable); let align = meth::VirtualIndex::from_index(ty::COMMON_VTABLE_ENTRIES_ALIGN) .get_usize(bx, vtable); // Alignment is always nonzero. bx.range_metadata(align, WrappingRange { start: 1, end: !0 }); (size, align) </ins> } ty::Slice(_) | ty::Str => { let unit = layout.field(bx, 0);
<ins> // compile-flags: -O #![crate_type = "lib"] // This test checks that we annotate alignment loads from vtables with nonzero range metadata, // and that this allows LLVM to eliminate redundant `align >= 1` checks. pub trait Trait { fn f(&self); } pub struct WrapperWithAlign1<T: ?Sized> { x: u8, y: T } pub struct WrapperWithAlign2<T: ?Sized> { x: u16, y: T } pub struct Struct<W: ?Sized> { _field: i8, dst: W, } // CHECK-LABEL: @eliminates_runtime_check_when_align_1 #[no_mangle] pub fn eliminates_runtime_check_when_align_1( x: &Struct<WrapperWithAlign1<dyn Trait>> ) -> &WrapperWithAlign1<dyn Trait> { // CHECK: load [[USIZE:i[0-9]+]], {{.+}} !range [[RANGE_META:![0-9]+]] // CHECK-NOT: icmp // CHECK-NOT: select // CHECK: ret &x.dst } // CHECK-LABEL: @does_not_eliminate_runtime_check_when_align_2 #[no_mangle] pub fn does_not_eliminate_runtime_check_when_align_2( x: &Struct<WrapperWithAlign2<dyn Trait>> ) -> &WrapperWithAlign2<dyn Trait> { // CHECK: [[X0:%[0-9]+]] = load [[USIZE]], {{.+}} !range [[RANGE_META]] // CHECK: [[X1:%[0-9]+]] = icmp {{.+}} [[X0]] // CHECK: [[X2:%[0-9]+]] = select {{.+}} [[X1]] // CHECK: ret &x.dst } // CHECK: [[RANGE_META]] = !{[[USIZE]] 1, [[USIZE]] 0} </ins>
// (e.g. the `bootimage` crate). for tool in LLVM_TOOLS { let tool_exe = exe(tool, target_compiler.host); <del> builder.copy(&llvm_bin_dir.join(&tool_exe), &libdir_bin.join(&tool_exe)); </del> <ins> let src_path = llvm_bin_dir.join(&tool_exe); // When using `donwload-ci-llvm`, some of the tools // may not exist, so skip trying to copy them. if src_path.exists() { builder.copy(&src_path, &libdir_bin.join(&tool_exe)); } </ins> } } }
impl<CTX> HashStable<CTX> for InferTy { fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) { use InferTy::*; <ins> discriminant(self).hash_stable(ctx, hasher); </ins> match self { TyVar(v) => v.as_u32().hash_stable(ctx, hasher), IntVar(v) => v.index.hash_stable(ctx, hasher),
* other tasks wishing to access the data will block until the closure * finishes running. * <del> * The reason this function is 'unsafe' is because it is possible to * construct a circular reference among multiple Arcs by mutating the * underlying data. This creates potential for deadlock, but worse, this * will guarantee a memory leak of all involved Arcs. Using MutexArcs * inside of other Arcs is safe in absence of circular references. * </del> * If you wish to nest MutexArcs, one strategy for ensuring safety at * runtime is to add a "nesting level counter" inside the stored data, and * when traversing the arcs, assert that they monotonically decrease.
* blocked on the mutex) will also fail immediately. */ #[inline] <del> pub unsafe fn unsafe_access<U>(&self, blk: |x: &mut T| -> U) -> U { </del> <ins> pub fn access<U>(&self, blk: |x: &mut T| -> U) -> U { </ins> let state = self.x.get(); <del> // Borrowck would complain about this if the function were // not already unsafe. See borrow_rwlock, far below. (&(*state).lock).lock(|| { check_poison(true, (*state).failed); let _z = PoisonOnFail::new(&mut (*state).failed); blk(&mut (*state).data) }) </del> <ins> unsafe { // Borrowck would complain about this if the code were // not already unsafe. See borrow_rwlock, far below. (&(*state).lock).lock(|| { check_poison(true, (*state).failed); let _z = PoisonOnFail::new(&mut (*state).failed); blk(&mut (*state).data) }) } </ins> } <del> /// As unsafe_access(), but with a condvar, as sync::mutex.lock_cond(). </del> <ins> /// As access(), but with a condvar, as sync::mutex.lock_cond(). </ins> #[inline] <del> pub unsafe fn unsafe_access_cond<U>(&self, blk: |x: &mut T, c: &Condvar| -> U) -> U { </del> <ins> pub fn access_cond<U>(&self, blk: |x: &mut T, c: &Condvar| -> U) -> U { </ins> let state = self.x.get(); <del> (&(*state).lock).lock_cond(|cond| { check_poison(true, (*state).failed); let _z = PoisonOnFail::new(&mut (*state).failed); blk(&mut (*state).data, &Condvar {is_mutex: true, failed: &(*state).failed, cond: cond }) }) } } impl<T:Freeze + Send> MutexArc<T> { /** * As unsafe_access. * * The difference between access and unsafe_access is that the former * forbids mutexes to be nested. While unsafe_access can be used on * MutexArcs without freezable interiors, this safe version of access * requires the Freeze bound, which prohibits access on MutexArcs which * might contain nested MutexArcs inside. * * The purpose of this is to offer a safe implementation of MutexArc to be * used instead of RWArc in cases where no readers are needed and slightly * better performance is required. * * Both methods have the same failure behaviour as unsafe_access and * unsafe_access_cond. */ #[inline] pub fn access<U>(&self, blk: |x: &mut T| -> U) -> U { unsafe { self.unsafe_access(blk) } } /// As unsafe_access_cond but safe and Freeze. #[inline] pub fn access_cond<U>(&self, blk: |x: &mut T, c: &Condvar| -> U) -> U { unsafe { self.unsafe_access_cond(blk) } </del> <ins> unsafe { (&(*state).lock).lock_cond(|cond| { check_poison(true, (*state).failed); let _z = PoisonOnFail::new(&mut (*state).failed); blk(&mut (*state).data, &Condvar {is_mutex: true, failed: &(*state).failed, cond: cond }) }) } </ins> } }
} #[test] <del> fn test_unsafe_mutex_arc_nested() { unsafe { // Tests nested mutexes and access // to underlaying data. let arc = ~MutexArc::new(1); let arc2 = ~MutexArc::new(*arc); task::spawn(proc() { (*arc2).unsafe_access(|mutex| { (*mutex).access(|one| { assert!(*one == 1); }) </del> <ins> fn test_mutex_arc_nested() { // Tests nested mutexes and access // to underlaying data. let arc = ~MutexArc::new(1); let arc2 = ~MutexArc::new(*arc); task::spawn(proc() { (*arc2).access(|mutex| { (*mutex).access(|one| { assert!(*one == 1); </ins> }) <del> }); } </del> <ins> }) }); </ins> } #[test]
<del> // 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. extern crate sync; use std::task; use sync::MutexArc; fn test_mutex_arc_nested() { let arc = ~MutexArc::new(1); let arc2 = ~MutexArc::new(*arc); task::spawn(proc() { (*arc2).access(|mutex| { //~ ERROR instantiating a type parameter with an incompatible type }) }); } fn main() {} </del>
}); assert!(actually_finished.load(Ordering::Relaxed)); } <ins> #[test] fn test_scoped_threads_nll() { // this is mostly a *compilation test* for this exact function: fn foo(x: &u8) { thread::scope(|s| { s.spawn(|| drop(x)); }); } // let's also run it for good measure let x = 42_u8; foo(&x); } </ins>
), .. }) => { <del> // We have a situation like `while Some(0) = value.get(0) {`, where `while let` // was more likely intended. err.span_suggestion_verbose( expr.span.shrink_to_lo(), "you might have meant to use pattern destructuring", "let ".to_string(), Applicability::MachineApplicable, ); </del> <ins> // Check if our lhs is a child of the condition of a while loop let expr_is_ancestor = std::iter::successors(Some(lhs.hir_id), |id| { self.tcx.hir().find_parent_node(*id) }) .take_while(|id| *id != parent) .any(|id| id == expr.hir_id); // if it is, then we have a situation like `while Some(0) = value.get(0) {`, // where `while let` was more likely intended. if expr_is_ancestor { err.span_suggestion_verbose( expr.span.shrink_to_lo(), "you might have meant to use pattern destructuring", "let ".to_string(), Applicability::MachineApplicable, ); } </ins> break; } hir::Node::Item(_)
&self, tcx: TyCtxt<'_>, ident: Ident, <ins> // Sorted in order of what kinds to look at </ins> kinds: &[AssocKind], parent_def_id: DefId, ) -> Option<&ty::AssocItem> { <del> self.filter_by_name_unhygienic(ident.name) .filter(|item| kinds.contains(&item.kind)) .find(|item| tcx.hygienic_eq(ident, item.ident(tcx), parent_def_id)) </del> <ins> kinds.iter().find_map(|kind| self.find_by_name_and_kind(tcx, ident, *kind, parent_def_id)) </ins> } /// Returns the associated item with the given name in the given `Namespace`, if one exists.
.find_by_name_and_kind(self.tcx(), assoc_name, ty::AssocKind::Type, trait_def_id) .is_some() } <del> fn trait_defines_associated_named(&self, trait_def_id: DefId, assoc_name: Ident) -> bool { </del> <ins> fn trait_defines_associated_const_named(&self, trait_def_id: DefId, assoc_name: Ident) -> bool { </ins> self.tcx() .associated_items(trait_def_id) <del> .find_by_name_and_kinds( self.tcx(), assoc_name, &[ty::AssocKind::Type, ty::AssocKind::Const], trait_def_id, ) </del> <ins> .find_by_name_and_kind(self.tcx(), assoc_name, ty::AssocKind::Const, trait_def_id) </ins> .is_some() }
// We have already adjusted the item name above, so compare with `ident.normalize_to_macros_2_0()` instead // of calling `filter_by_name_and_kind`. <del> let assoc_item = tcx .associated_items(candidate.def_id()) .filter_by_name_unhygienic(assoc_ident.name) .find(|i| { (i.kind == ty::AssocKind::Type || i.kind == ty::AssocKind::Const) && i.ident(tcx).normalize_to_macros_2_0() == assoc_ident }) </del> <ins> let find_item_of_kind = |kind| { tcx.associated_items(candidate.def_id()) .filter_by_name_unhygienic(assoc_ident.name) .find(|i| i.kind == kind && i.ident(tcx).normalize_to_macros_2_0() == assoc_ident) }; let assoc_item = find_item_of_kind(ty::AssocKind::Type) .or_else(|| find_item_of_kind(ty::AssocKind::Const)) </ins> .expect("missing associated type"); if !assoc_item.vis.is_accessible_from(def_scope, tcx) {
I: Iterator<Item = ty::PolyTraitRef<'tcx>>, { let mut matching_candidates = all_candidates() <del> .filter(|r| self.trait_defines_associated_named(r.def_id(), assoc_name)); let bound = match matching_candidates.next() { Some(bound) => bound, None => { </del> <ins> .filter(|r| self.trait_defines_associated_type_named(r.def_id(), assoc_name)); let mut const_candidates = all_candidates() .filter(|r| self.trait_defines_associated_const_named(r.def_id(), assoc_name)); let (bound, next_cand) = match (matching_candidates.next(), const_candidates.next()) { (Some(bound), _) => (bound, matching_candidates.next()), (None, Some(bound)) => (bound, const_candidates.next()), (None, None) => { </ins> self.complain_about_assoc_type_not_found( all_candidates, &ty_param_name(),
return Err(ErrorReported); } }; debug!("one_bound_for_assoc_type: bound = {:?}", bound); <del> if let Some(bound2) = matching_candidates.next() { </del> <ins> if let Some(bound2) = next_cand { </ins> debug!("one_bound_for_assoc_type: bound2 = {:?}", bound2); let is_equality = is_equality();
// We have already adjusted the item name above, so compare with `ident.normalize_to_macros_2_0()` instead // of calling `filter_by_name_and_kind`. <del> let item = tcx .associated_items(trait_did) .in_definition_order() .find(|i| { i.kind.namespace() == Namespace::TypeNS && i.ident(tcx).normalize_to_macros_2_0() == assoc_ident }) .expect("missing associated type"); </del> <ins> let item = tcx.associated_items(trait_did).in_definition_order().find(|i| { i.kind.namespace() == Namespace::TypeNS && i.ident(tcx).normalize_to_macros_2_0() == assoc_ident }); // Assume that if it's not matched, there must be a const defined with the same name // but it was used in a type position. let Some(item) = item else { let msg = format!("found associated const `{assoc_ident}` when type was expected"); tcx.sess.struct_span_err(span, &msg).emit(); return Err(ErrorReported); }; </ins> let ty = self.projected_ty_from_poly_trait_ref(span, item.def_id, assoc_segment, bound); let ty = self.normalize_ty(span, ty);
<ins> // Checking that none of these ICE, which was introduced in // https://github.com/rust-lang/rust/issues/93553 trait Foo { type Bar; } trait Baz: Foo { const Bar: Self::Bar; } trait Baz2: Foo { const Bar: u32; fn foo() -> Self::Bar; } trait Baz3 { const BAR: usize; const QUX: Self::BAR; //~^ ERROR found associated const } fn main() {} </ins>
} /// Iterates over the language items in the given crate. <del> fn get_lang_items(self, tcx: TyCtxt<'tcx>) -> &'tcx [(DefId, usize)] { tcx.arena.alloc_from_iter( self.root .lang_items .decode(self) .map(|(def_index, index)| (self.local_def_id(def_index), index)), ) </del> <ins> fn get_lang_items(self) -> impl Iterator<Item = (DefId, usize)> + 'a { self.root .lang_items .decode(self) .map(move |(def_index, index)| (self.local_def_id(def_index), index)) </ins> } /// Iterates over the diagnostic items in the given crate.
tcx.arena.alloc_slice(&result) } defined_lib_features => { cdata.get_lib_features(tcx) } <del> defined_lang_items => { cdata.get_lang_items(tcx) } </del> <ins> defined_lang_items => { tcx.arena.alloc_from_iter(cdata.get_lang_items()) } </ins> diagnostic_items => { cdata.get_diagnostic_items() } missing_lang_items => { cdata.get_missing_lang_items(tcx) }
) -> impl Iterator<Item = (DefId, DefId)> + '_ { self.get_crate_data(cnum).get_inherent_impls() } <ins> /// Decodes all lang items in the crate (for rustdoc). pub fn lang_items_untracked(&self, cnum: CrateNum) -> impl Iterator<Item = DefId> + '_ { self.get_crate_data(cnum).get_lang_items().map(|(def_id, _)| def_id) } </ins> } impl CrateStore for CStore {
Vec::from_iter(self.resolver.cstore().trait_impls_in_crate_untracked(cnum)); let all_inherent_impls = Vec::from_iter(self.resolver.cstore().inherent_impls_in_crate_untracked(cnum)); <ins> let all_lang_items = Vec::from_iter(self.resolver.cstore().lang_items_untracked(cnum)); </ins> // Querying traits in scope is expensive so we try to prune the impl and traits lists // using privacy, private traits and impls from other crates are never documented in
self.add_traits_in_parent_scope(impl_def_id); } } <ins> for def_id in all_lang_items { self.add_traits_in_parent_scope(def_id); } </ins> self.all_traits.extend(all_traits); self.all_trait_impls.extend(all_trait_impls.into_iter().map(|(_, def_id, _)| def_id));
<ins> // no-prefer-dynamic #![feature(lang_items)] #![crate_type = "rlib"] #![no_std] pub struct DerefsToF64(f64); impl core::ops::Deref for DerefsToF64 { type Target = f64; fn deref(&self) -> &Self::Target { &self.0 } } mod inner { #[lang = "f64_runtime"] impl f64 { /// [f64::clone] pub fn method() {} } } #[lang = "eh_personality"] fn foo() {} #[panic_handler] fn bar(_: &core::panic::PanicInfo) -> ! { loop {} } </ins>
<ins> // Reexport of a structure that derefs to a type with lang item impls having doc links in their // comments. The doc link points to an associated item, so we check that traits in scope for that // link are populated. // aux-build:extern-lang-item-impl-dep.rs #![no_std] extern crate extern_lang_item_impl_dep; pub use extern_lang_item_impl_dep::DerefsToF64; </ins>
ty::RawPtr(ty::TypeAndMut { ty: pointee_type, .. }) | ty::Ref(_, pointee_type, _) => { pointer_or_reference_metadata(cx, t, pointee_type, unique_type_id) } <del> ty::Adt(def, _) if def.is_box() => { </del> <ins> // Box<T, A> may have a non-ZST allocator A. In that case, we // cannot treat Box<T, A> as just an owned alias of `*mut T`. ty::Adt(def, substs) if def.is_box() && cx.layout_of(substs.type_at(1)).is_zst() => { </ins> pointer_or_reference_metadata(cx, t, t.boxed_ty(), unique_type_id) } ty::FnDef(..) | ty::FnPtr(_) => subroutine_type_metadata(cx, unique_type_id),