jiebi/CodeConvo huggingface dataset:
Change:
<!-- Thank you for filing a bug report! Please provide a short summary of the bug, along with any information you feel relevant to replicating the bug. --I tried this code: I expected to see this happen: I would expect not to appear as its own item in the rustdoc sidebar for the struct. This would be consistent with the behavior of methods and associated types from trait impls, which also don't appear as their own item in the sidebar. Instead, this happened: The constant is listed under "Associated Constants" in the left-hand sidebar of the rustdoc page for . This is inconsistent with how methods from trait impls appear in documentation. ! <!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --:
This was intentionally in .
The inclusion of associated consts from inherent impls is intentional. But is it intentional that associated consts from trait impls also appear in the sidebar (even though methods from trait impls do not)? (I'm filing this bug because for a crate I'm developing, the current behavior makes the sidebar extremely messy. Restricting the list of associated constants to those from inherent impls would make navigating the documentation for my crate much more pleasant.)
I think the behavior proposes makes sense.

Discussion:
let used_links_bor = &mut used_links; let mut assoc_consts = v .iter() <ins> .filter(|i| i.inner_impl().trait_.is_none()) </ins> .flat_map(|i| get_associated_constants(i.inner_impl(), used_links_bor)) .collect::<Vec<_>>(); if !assoc_consts.is_empty() {

pub struct Bar; // @has 'foo/struct.Bar.html' <del> // @has - '//h3[@class="sidebar-title"]' 'Associated Constants' // @has - '//div[@class="sidebar-elems"]//a' 'FOO' </del> <ins> // @!has - '//h3[@class="sidebar-title"]' 'Associated Constants' // @!has - '//div[@class="sidebar-elems"]//a' 'FOO' </ins> impl Trait for Bar { const FOO: u32 = 1;

} // @has 'foo/enum.Foo.html' <del> // @has - '//h3[@class="sidebar-title"]' 'Associated Constants' // @has - '//div[@class="sidebar-elems"]//a' 'FOO' </del> <ins> // @!has - '//h3[@class="sidebar-title"]' 'Associated Constants' // @!has - '//div[@class="sidebar-elems"]//a' 'FOO' </ins> impl Trait for Foo { const FOO: u32 = 1; fn foo() {} } <ins> pub struct Baz; // @has 'foo/struct.Baz.html' // @has - '//h3[@class="sidebar-title"]' 'Associated Constants' // @has - '//div[@class="sidebar-elems"]//a' 'FOO' impl Baz { pub const FOO: u32 = 42; } pub enum Quux { B, } // @has 'foo/enum.Quux.html' // @has - '//h3[@class="sidebar-title"]' 'Associated Constants' // @has - '//div[@class="sidebar-elems"]//a' 'FOO' impl Quux { pub const FOO: u32 = 42; } </ins>
Change:
As of , some of our code utilizing macros in [] started to fail to compile. The code that is failing is some macro magic for making nice pin name aliases for microcontrollers, so it's not surprising that broke it. I see that some other repos were broken as well and that helped fix it, but I'm really not sure how to do the fix in our repo. To reproduce: clone the [] repo I expect this to compile properly like on stable, instead it fails to compile with: It most recently worked on: Regressed to with () : modify labels: +regression-from-stable-to-nightly -regression-untriaged []:
Fixed in
Thanks for the quick fix!

Discussion:
#![feature(crate_visibility_modifier)] #![feature(derive_default_enum)] <ins> #![feature(if_let_guard)] </ins> #![feature(let_chains)] #![feature(let_else)] #![feature(min_specialization)]

pub fn process_token(&mut self, token: Token) -> TokenStream { match token.kind { <ins> token::Interpolated(nt) if let token::NtIdent(ident, is_raw) = *nt => { TokenTree::Token(Token::new(token::Ident(ident.name, is_raw), ident.span)).into() } </ins> token::Interpolated(nt) => { let tts = (self.nt_to_tokenstream)(&nt, self.parse_sess, self.synthesize_tokens); TokenTree::Delimited(

PRINT-BANG INPUT (DISPLAY): FirstStruct PRINT-BANG INPUT (DEBUG): TokenStream [ <del> Group { delimiter: None, stream: TokenStream [ Ident { ident: "FirstStruct", span: $DIR/auxiliary/nested-macro-rules.rs:16:14: 16:25 (#7), }, ], span: $DIR/auxiliary/nested-macro-rules.rs:9:30: 9:35 (#6), </del> <ins> Ident { ident: "FirstStruct", span: $DIR/auxiliary/nested-macro-rules.rs:16:14: 16:25 (#7), </ins> }, ] PRINT-ATTR INPUT (DISPLAY): struct FirstAttrStruct {}

ident: "struct", span: $DIR/auxiliary/nested-macro-rules.rs:10:32: 10:38 (#6), }, <del> Group { delimiter: None, stream: TokenStream [ Ident { ident: "FirstAttrStruct", span: $DIR/auxiliary/nested-macro-rules.rs:16:27: 16:42 (#7), }, ], span: $DIR/auxiliary/nested-macro-rules.rs:10:39: 10:56 (#6), </del> <ins> Ident { ident: "FirstAttrStruct", span: $DIR/auxiliary/nested-macro-rules.rs:16:27: 16:42 (#7), </ins> }, Group { delimiter: Brace,
Change:
It is possible to write to a thanks to , but it is not possible to read from a as the corresponding is missing. This seems to be entirely an accident, given that  does work on . Cc <!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
Seems reasonable to me. We'd need to FCP the resulting PR, since trait impls are insta-stable.
claim
Sorry, I didn't have time to add it. So see if any other contributors would like to add it. Unassign myself.
claim
claim

Discussion:
} } <ins> #[stable(feature = "read_shared_stdin", since = "CURRENT_RUSTC_VERSION")] impl Read for &Stdin { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { self.lock().read(buf) } fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> io::Result<()> { self.lock().read_buf(buf) } fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> { self.lock().read_vectored(bufs) } #[inline] fn is_read_vectored(&self) -> bool { self.lock().is_read_vectored() } fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> { self.lock().read_to_end(buf) } fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> { self.lock().read_to_string(buf) } fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> { self.lock().read_exact(buf) } } </ins> // only used by platform-dependent io::copy specializations, i.e. unused on some platforms #[cfg(any(target_os = "linux", target_os = "android"))] impl StdinLock<'_> {
Change:
The ICE appears with and , but not . Beta: <details<summary<strongBacktrace</strong</summary<p</p</details
this is a regression affecting the release that is being prepared today.
I'll take a look.

Discussion:
let externs = options.externs.clone(); let render_options = options.render_options.clone(); let scrape_examples_options = options.scrape_examples_options.clone(); <ins> let document_private = options.render_options.document_private; </ins> let config = core::create_config(options); interface::create_compiler_and_run(config, |compiler| {

let (resolver, resolver_caches) = { let (krate, resolver, _) = &*abort_on_err(queries.expansion(), sess).peek(); let resolver_caches = resolver.borrow_mut().access(|resolver| { <del> collect_intra_doc_links::early_resolve_intra_doc_links(resolver, krate, externs) </del> <ins> collect_intra_doc_links::early_resolve_intra_doc_links( resolver, krate, externs, document_private, ) </ins> }); (resolver.clone(), resolver_caches) };

resolver: &mut Resolver<'_>, krate: &ast::Crate, externs: Externs, <ins> document_private_items: bool, </ins> ) -> ResolverCaches { let mut loader = IntraLinkCrateLoader { resolver,

traits_in_scope: Default::default(), all_traits: Default::default(), all_trait_impls: Default::default(), <ins> document_private_items, </ins> }; // Because of the `crate::` prefix, any doc comment can reference

traits_in_scope: DefIdMap<Vec<TraitCandidate>>, all_traits: Vec<DefId>, all_trait_impls: Vec<DefId>, <ins> document_private_items: bool, </ins> } impl IntraLinkCrateLoader<'_, '_> {

} for child in self.resolver.module_children_or_reexports(module_id) { <del> if child.vis == Visibility::Public { </del> <ins> if child.vis == Visibility::Public || self.document_private_items { </ins> if let Some(def_id) = child.res.opt_def_id() { self.add_traits_in_parent_scope(def_id); }

<ins> // compile-flags: --document-private-items // This ensures that no ICE is triggered when rustdoc is run on this code. mod stdlib { pub (crate) use std::i8; } </ins>
Change:
<!-- Thank you for finding an Internal Compiler Error! If possible, try to provide a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for how to create smaller examples. --<!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --: Also reproduces on 1.58.0 and 1.59.0. <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details<!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
claim

Discussion:
use crate::collect::ItemCtxt; use rustc_hir as hir; use rustc_hir::intravisit::{self, Visitor}; <del> use rustc_hir::HirId; </del> <ins> use rustc_hir::{ForeignItem, ForeignItemKind, HirId}; </ins> use rustc_infer::infer::TyCtxtInferExt; use rustc_infer::traits::TraitEngine; use rustc_infer::traits::{ObligationCause, WellFormedLoc};

ref item => bug!("Unexpected item {:?}", item), }, hir::Node::Field(field) => Some(field.ty), <ins> hir::Node::ForeignItem(ForeignItem { kind: ForeignItemKind::Static(ty, _), .. }) => Some(*ty), </ins> ref node => bug!("Unexpected node {:?}", node), }, WellFormedLoc::Param { function: _, param_idx } => {

<ins> // Regression test for the ICE described in #95665. // Ensure that the expected error is output (and thus that there is no ICE) pub trait Trait: {} pub struct Struct<T: Trait> { member: T, } // uncomment and bug goes away // impl Trait for u8 {} extern "C" { static VAR: Struct<u8>; //~^ 14:17: 14:27: the trait bound `u8: Trait` is not satisfied [E0277] } fn main() {} </ins>

<ins> error[E0277]: the trait bound `u8: Trait` is not satisfied --> $DIR/issue-95665.rs:14:17 | LL |     static VAR: Struct<u8>; |                 ^^^^^^^^^^ the trait `Trait` is not implemented for `u8` | note: required by a bound in `Struct` --> $DIR/issue-95665.rs:6:22 | LL | pub struct Struct<T: Trait> { |                      ^^^^^ required by this bound in `Struct` error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. </ins>
Change:
I tried this code: I expected to see this happen: should trigger for this definition. Instead, this happened: It is not linted.

Discussion:
<ins> #[deny(improper_ctypes_definitions)] // It's an improper ctype (a slice) arg in an extern "C" fnptr. pub type F = extern "C" fn(&[u8]); //~^ ERROR: `extern` fn uses type `[u8]`, which is not FFI-safe fn main() {} </ins>

<ins> error: `extern` fn uses type `[u8]`, which is not FFI-safe --> $DIR/extern-C-fnptr-lints-slices.rs:5:14 | LL | pub type F = extern "C" fn(&[u8]); |              ^^^^^^^^^^^^^^^^^^^^ not FFI-safe | = help: consider using a raw pointer instead = note: slices have no C equivalent note: the lint level is defined here --> $DIR/extern-C-fnptr-lints-slices.rs:1:8 | LL | #[deny(improper_ctypes_definitions)] |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error </ins>
Change:
Given the following code: The current output is: <!-- The following is not always necessary. --Ideally the output should look like: Note: The bound is treated incorrectly. <!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
claim
You mean that does not handle correctly, right?
Correct, the suggestion reads which is not syntactical. The fix would be to detect this case and correctly suggest
It's my first time contributing and i was taking a look at and didn't find a way to detect . So i ended up adding a flag to , setting it in and checking the flag in to handle the case. Does that seem reasonable?
Adding a new flag to seems a bit heavy. I was thinking you could one of the methods on  to detect if there is a colon following the generic param. Also hmm... I think was also looking at ... I opened up this issue before he said that he was trying to , though I'm not sure if in general or just a specific case in something he was working on (i.e. another suggestion). Perhaps he could comment to see if he's already solved this, in order to deduplicate work?
So. I was fixing the same problem in and I just got a working fix! My solution is to use in order to find the span of . It may be hacky, but I think it's good enough for diagnostics. It seems like my fix doesn't fix this issue, because this suggestion is created using different API (), but it should be easy to extend it to this case too. For example could use internally ( produces better suggestions anyway :D). I'll try to clean my fix & create a PR today.
I took a look at your PR, that's way better than my solution. I will use the method you to to fix this issue if you aren't working on it as well.

Discussion:
}; let sp = hir.span(id); let sp = if let Some(first_bound) = has_bounds { <del> // `sp` only covers `T`, change it so that it covers // `T:` when appropriate </del> sp.until(first_bound.span()) <ins> } else if let Some(colon_sp) = // If the generic param is declared with a colon but without bounds: // fn foo<T:>(t: T) { ... } param.colon_span_for_suggestions( self.inh.tcx.sess.source_map(), ) { sp.to(colon_sp) </ins> } else { sp };

<ins> // Test for #95898: The trait suggestion had an extra `:` after the trait. // edition:2021 fn foo<T:>(t: T) { t.clone(); //~^ ERROR no method named `clone` found for type parameter `T` in the current scope } fn main() {} </ins>

<ins> error[E0599]: no method named `clone` found for type parameter `T` in the current scope --> $DIR/issue-95898.rs:5:7 | LL |     t.clone(); |       ^^^^^ method not found in `T` | = help: items from traits can only be used if the type parameter is bounded by the trait help: the following trait defines an item `clone`, perhaps you need to restrict type parameter `T` with it: | LL | fn foo<T: Clone>(t: T) { |        ~~~~~~~~ error: aborting due to previous error For more information about this error, try `rustc --explain E0599`. </ins>
Change:
<!-- Thank you for finding an Internal Compiler Error! If possible, try to provide a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for how to create smaller examples. --code from glacier / <!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details
another case 
Probably caused by cc
Oops. That's my b, I'll have a PR up in 10 minutes

Discussion:
| ty::FnPtr(..) ) } <del> // None of the possible types have lifetimes, so we can just compare // directly if a != b { </del> <ins> // The function pointer types can have lifetimes if !self.mir_assign_valid_types(a, b) { </ins> self.fail( location, format!("Cannot compare unequal types {:?} and {:?}", a, b),

}; // since CopyNonOverlapping is parametrized by 1 type, // we only need to check that they are equal and not keep an extra parameter. <del> if op_src_ty != op_dst_ty { </del> <ins> if !self.mir_assign_valid_types(op_src_ty, op_dst_ty) { </ins> self.fail(location, format!("bad arg ({:?} != {:?})", op_src_ty, op_dst_ty)); }

/// * `Offset` has the same semantics as [`offset`](pointer::offset), except that the second ///   parameter may be a `usize` as well. /// * The comparison operations accept `bool`s, `char`s, signed or unsigned integers, floats, <del> ///   raw pointers, or function pointers of matching types and return a `bool`. </del> <ins> ///   raw pointers, or function pointers and return a `bool`. The types of the operands must be ///   matching, up to the usual caveat of the lifetimes in function pointers. </ins> /// * Left and right shift operations accept signed or unsigned integers not necessarily of the ///   same type and return a value of the same type as their LHS. Like in Rust, the RHS is ///   truncated as needed.

<ins> // check-pass // compile-flags: -Zvalidate-mir fn foo(_a: &str) {} fn main() { let x = foo as fn(&'static str); let _ = x == foo; } </ins>
Change:
These tests were recently broken by It shouldn't be possible for these to be broken on master - nearly everyone who contributes to the standard library uses , and this makes it very hard to verify changes. We should get these running in mingw-check or some other builder. label +P-high +A-testsuite +T-libs Originally posted by in <!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
claim
cc Any idea re this? :)
here's where the code for mingw check lives: that job is also run on a full merge (bors r+) so it should be enough to only modify that.
Awesome, thanks!
Should be resolved by

Discussion:
python3 ../x.py build --stage 0 src/tools/build-manifest &&  python3 ../x.py test --stage 0 src/tools/compiletest &&  python3 ../x.py test --stage 2 src/tools/tidy &&  <ins> python3 ../x.py test --stage 0 core alloc std test proc_macro &&  </ins> python3 ../x.py doc --stage 0 library/test &&  /scripts/validate-toolstate.sh &&  /scripts/validate-error-codes.sh &&
Change:
While debugging the CI failure in , I saw the following output in the logs: The first one is and the second I think is , by the fields it has. But we should just print that in the debug logs rather than having to guess. label +A-contributor-roadblock +C-enhancement
This will be annoying to fix because we'll have to remove for and implement it by hand. Maybe we could introduce a new macro making it easier? The module name is available through
label +E-medium +E-mentor +A-rustbuild
The way to go is likely to add type_name to the timing print rather than solely relying on Debug.

Discussion:
<del> use std::any::Any; </del> <ins> use std::any::{type_name, Any}; </ins> use std::cell::{Cell, RefCell}; use std::collections::BTreeSet; use std::env;

}; if self.config.print_step_timings && !self.config.dry_run { <del> println!("[TIMING] {:?} -- {}.{:03}", step, dur.as_secs(), dur.subsec_millis()); </del> <ins> let step_string = format!("{:?}", step); let brace_index = step_string.find("{").unwrap_or(0); let type_string = type_name::<S>(); println!( "[TIMING] {} {} -- {}.{:03}", &type_string.strip_prefix("bootstrap::").unwrap_or(type_string), &step_string[brace_index..], dur.as_secs(), dur.subsec_millis() ); </ins> } {
Change:
<!-- Thank you for finding an Internal Compiler Error! If possible, try to provide a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for how to create smaller examples. --<!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --<!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details
cc
Rustdoc assumes that there is always a module for every primitive type referred to by a doc link, which is not the case in the code example above or any "minimal core" example not containing the primitive documentation modules.
Fixed in

Discussion:
} } <del> fn def_id(self, tcx: TyCtxt<'_>) -> DefId { </del> <ins> fn def_id(self, tcx: TyCtxt<'_>) -> Option<DefId> { </ins> match self { <del> Res::Def(_, id) => id, Res::Primitive(prim) => *PrimitiveType::primitive_locations(tcx).get(&prim).unwrap(), </del> <ins> Res::Def(_, id) => Some(id), Res::Primitive(prim) => PrimitiveType::primitive_locations(tcx).get(&prim).copied(), </ins> } }

} } <del> Some(ItemLink { </del> <ins> res.def_id(self.cx.tcx).map(|page_id| ItemLink { </ins> link: ori_link.link.clone(), link_text: link_text.clone(), <del> page_id: res.def_id(self.cx.tcx), </del> <ins> page_id, </ins> fragment, }) }

link_resolver.resolve_doc_links_local(&krate.attrs); link_resolver.process_module_children_or_reexports(CRATE_DEF_ID.to_def_id()); visit::walk_crate(&mut link_resolver, krate); <del> link_resolver.process_extern_impls(); </del> // FIXME: somehow rustdoc is still missing crates even though we loaded all // the known necessary crates. Load them all unconditionally until we find a way to fix this.

link_resolver.resolver.resolve_rustdoc_path(extern_name, TypeNS, parent_scope); } <ins> link_resolver.process_extern_impls(); </ins> ResolverCaches { markdown_links: Some(link_resolver.markdown_links), doc_link_resolutions: link_resolver.doc_link_resolutions,

<ins> // Crate tree without a `doc(primitive)` module for primitive type linked to by a doc link. #![deny(rustdoc::broken_intra_doc_links)] #![feature(no_core, lang_items, rustc_attrs)] #![no_core] #![rustc_coherence_is_core] #![crate_type = "rlib"] // @has no_doc_primitive/index.html //! A [`char`] and its [`char::len_utf8`]. impl char { pub fn len_utf8(self) -> usize { 42 } } </ins>
Change:
Here is a complete (minimized) reproducer: It can be reproduced with a workspace with two crates "a" and "b" where: The crate "a" depends on the public () crate and its code is: . The crate "b" depends on the workspace crate and its code is: With that setup, the command rightfully succeeds using the stable toolchain. But fails when using the latest (2022-04-25) nightly toolchain. The bug is observable on nightly only (works fine on stable, and beta) : <details<summary<strongBacktrace</strong</summary<p</p</details
Fixed in

Discussion:
if let Res::Def(DefKind::Mod, ..) = child.res { self.resolve_doc_links_extern_inner(def_id); // Inner attribute scope } <del> // Traits are processed in `add_extern_traits_in_scope`. </del> <ins> // `DefKind::Trait`s are processed in `process_extern_impls`. </ins> if let Res::Def(DefKind::Mod | DefKind::Enum, ..) = child.res { self.process_module_children_or_reexports(def_id); } <ins> if let Res::Def(DefKind::Struct | DefKind::Union | DefKind::Variant, _) = child.res { let field_def_ids = Vec::from_iter( self.resolver .cstore() .associated_item_def_ids_untracked(def_id, self.sess), ); for field_def_id in field_def_ids { self.resolve_doc_links_extern_outer(field_def_id, scope_id); } } </ins> } } }

<ins> // Traits in scope are collected for doc links in field attributes. // check-pass // aux-build: assoc-field-dep.rs extern crate assoc_field_dep; pub use assoc_field_dep::*; #[derive(Clone)] pub struct Struct; pub mod mod1 { pub struct Fields { /// [crate::Struct::clone] pub field: u8, } } pub mod mod2 { pub enum Fields { V { /// [crate::Struct::clone] field: u8, }, } } </ins>

<ins> #[derive(Clone)] pub struct Struct; pub mod dep_mod1 { pub struct Fields { /// [crate::Struct::clone] pub field: u8, } } pub mod dep_mod2 { pub enum Fields { V { /// [crate::Struct::clone] field: u8, }, } } </ins>