{"query_id": "q-en-rust-000b59b247fe72240ce2ced6fe809c3f2182e217a66df18b14c5e9d0c1ab5a24", "query": " // build-pass // compile-flags:-Zmir-opt-level=3 struct D; trait Tr { type It; fn foo(self) -> Option; } impl<'a> Tr for &'a D { type It = (); fn foo(self) -> Option<()> { None } } fn run(f: F) where for<'a> &'a D: Tr, F: Fn(<&D as Tr>::It), { let d = &D; while let Some(i) = d.foo() { f(i); } } fn main() { run(|_| {}); } ", "positive_passages": [{"docid": "doc-en-rust-71b0b3759ab65d55872300b2e31707587c6b35ae4ebfcbc7b4efe6636becb2c5", "text": " $DIR/issue-69103-extra-binding-subslice.rs:6:22 | LL | let [a @ .., b @ ..] = &mut [1, 2]; | -- ^^ can only be used once per slice pattern | | | previously used here error: `..` can only be used once per slice pattern --> $DIR/issue-69103-extra-binding-subslice.rs:10:18 | LL | let [.., c @ ..] = [1, 2]; | -- ^^ can only be used once per slice pattern | | | previously used here error: `..` patterns are not allowed here --> $DIR/issue-69103-extra-binding-subslice.rs:15:18 | LL | let (.., d @ ..) = (1, 2); | ^^ | = note: only allowed in tuple, tuple struct, and slice patterns error: aborting due to 3 previous errors ", "positive_passages": [{"docid": "doc-en-rust-0489f46ff12c4bce4972c67faff50e0b64c6a4338130f902673bc284c1641a7d", "text": "The ICE only occurs when is used. $DIR/issue-50802.rs:15:21 | LL | break while continue { //~ ERROR E0590 | ^^^^^^^^ unlabeled `continue` in the condition of a `while` loop error: aborting due to previous error For more information about this error, try `rustc --explain E0590`. ", "positive_passages": [{"docid": "doc-en-rust-b76e112f1e4cbb436398930f986d3eed507af3f2037ed83dcf9ff14e23d82e17", "text": "Input: Output: This is on commit .\nI've edited that code just recently so would want to work on this\nMade PR to fix this\nThanks for fixing this :-) I also reported a couple of other looping-related bugs in in case you also want to have a look at those.\nwow those are quite nice bugs :p. Will have a look.", "commid": "rust_issue_50802", "tokennum": 75}], "negative_passages": []}
{"query_id": "q-en-rust-0101595a15b45d15c4ac268147c85c447b7a886b27496c38e1fb31ffad0c74f8", "query": "used_trait_imports.extend(imports.iter()); } for id in tcx.hir().items() { if matches!(tcx.def_kind(id.def_id), DefKind::Use) { if tcx.visibility(id.def_id).is_public() { continue; } let item = tcx.hir().item(id); if item.span.is_dummy() { continue; } if let hir::ItemKind::Use(path, _) = item.kind { check_import(tcx, &mut used_trait_imports, item.item_id(), path.span); } for &id in tcx.maybe_unused_trait_imports(()) { debug_assert_eq!(tcx.def_kind(id), DefKind::Use); if tcx.visibility(id).is_public() { continue; } if used_trait_imports.contains(&id) { continue; } let item = tcx.hir().expect_item(id); if item.span.is_dummy() { continue; } let hir::ItemKind::Use(path, _) = item.kind else { unreachable!() }; tcx.struct_span_lint_hir(lint::builtin::UNUSED_IMPORTS, item.hir_id(), path.span, |lint| { let msg = if let Ok(snippet) = tcx.sess.source_map().span_to_snippet(path.span) { format!(\"unused import: `{}`\", snippet) } else { \"unused import\".to_owned() }; lint.build(&msg).emit(); }); } unused_crates_lint(tcx); } fn check_import<'tcx>( tcx: TyCtxt<'tcx>, used_trait_imports: &mut FxHashSet, item_id: hir::ItemId, span: Span, ) { if !tcx.maybe_unused_trait_import(item_id.def_id) { return; } if used_trait_imports.contains(&item_id.def_id) { return; } tcx.struct_span_lint_hir(lint::builtin::UNUSED_IMPORTS, item_id.hir_id(), span, |lint| { let msg = if let Ok(snippet) = tcx.sess.source_map().span_to_snippet(span) { format!(\"unused import: `{}`\", snippet) } else { \"unused import\".to_owned() }; lint.build(&msg).emit(); }); } fn unused_crates_lint(tcx: TyCtxt<'_>) { let lint = lint::builtin::UNUSED_EXTERN_CRATES;", "positive_passages": [{"docid": "doc-en-rust-d3a2b532d482dc9bfe690e1f20ef1b6bd36119bdf4e17b42711c930f09282693", "text": "The resolver gathers a list of possibly unused trait imports in . This list is passed to resolver outputs, into the query. This query takes a and returns whether the import is possibly unused. This is used by the post-typeck unused import check in . This query iterates over all the statements in the crate, checks whether they may be unused trait imports, and warns if they are indeed unused. As there are typically very few unused trait imports compared to the number of items in a crate, it would make sense to directly iterate on . Steps: make an both in and , this will ensure a deterministic iteration order; rename query and give it the signature , and adapt the call site; we do not want to access directly, as this would prevent the query system from detecting that the set has not changed; in , inline and replace the loop over by a loop over ; the filter over there can be removed too (or replaced by a debug-assertion): the set may only point to use statements. Extra: investigate why we check for , and the consequences of removing that check; investigate the impact on perf of converting the to a simple when producing from . I am available on Zulip for any question. $DIR/issue-51515.rs:17:5 | LL | let foo = &16; | --- help: consider changing this to be a mutable reference: `&mut 16` ... LL | *foo = 32; | ^^^^^^^^^ `foo` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*bar` which is behind a `&` reference --> $DIR/issue-51515.rs:22:5 | LL | let bar = foo; | --- help: consider changing this to be a mutable reference: `&mut i32` ... LL | *bar = 64; | ^^^^^^^^^ `bar` is a `&` reference, so the data it refers to cannot be written error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0594`. ", "positive_passages": [{"docid": "doc-en-rust-3243bc8f69ddcb545fea14fc56ecf46c064642d30448c829a66128784655b4f2", "text": "When I build this code on nightly... ...I get these errors: The first error is fine, but the second one is missing the first character of . It looks like rustc assumes the first character is an and removes it without checking. :\nCurrently working on a fix here: Still need to add UI tests, which I'll do once I figure out how they work.\nAdding to the Rust 2018 Edition Preview milestone. Has a pending PR, too.", "commid": "rust_issue_51515", "tokennum": 96}], "negative_passages": []}
{"query_id": "q-en-rust-01e4d028e684deab1c37ae62b5a65e1cf4fe041c325ce62c61a43561689b7c30", "query": "use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc::infer::InferCtxt; use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::adjustment::{Adjust, Adjustment}; use rustc::ty::fold::{TypeFoldable, TypeFolder}; use rustc::util::nodemap::DefIdSet; use syntax::ast;", "positive_passages": [{"docid": "doc-en-rust-b3cba9b3919341f5e14c73e5121cb13d0e92702e03554e8e921382cfb972ae43", "text": "Hello, today we've found some weird behaviour of array indexing. Here is the Code snippet: The question is, why is the indexing operator behaves depending on whether we evaluate in place or not.\nHighly related question :\nMoreover, does not compile too.\npoints to this being a difference in how builtin indexing works vs overloaded indexing. My cleaned up version of the transcript: Highly related to , which will cause these types of situations to occur more frequently.\nAs a workaround, you can write an explicit type of which will then allow builtin indexing to happen:", "commid": "rust_issue_46095", "tokennum": 123}], "negative_passages": []}
{"query_id": "q-en-rust-01e4d028e684deab1c37ae62b5a65e1cf4fe041c325ce62c61a43561689b7c30", "query": "use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc::infer::InferCtxt; use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::adjustment::{Adjust, Adjustment}; use rustc::ty::fold::{TypeFoldable, TypeFolder}; use rustc::util::nodemap::DefIdSet; use syntax::ast;", "positive_passages": [{"docid": "doc-en-rust-1287b51f7d35c6eb9c973eafbc3584910d36447e86cc13fa2972ed754eda244f", "text": "It appears that when it's not obvious the index type is , we fall back to overloaded indexing: Fails in constant checking, : And also with the new MIR-based constant checker, :", "commid": "rust_issue_33903", "tokennum": 42}], "negative_passages": []}
{"query_id": "q-en-rust-0209c8f3cc58a2d0888214e4ae0bde83a3e96692e08d3f46c98ec5d3ad080f88", "query": "if is_fn { ty_to_fn .entry(ty.clone()) .and_modify(|e| *e = (Some(poly_trait.clone()), e.1.clone())) .or_insert(((Some(poly_trait.clone())), None)); .and_modify(|e| *e = (poly_trait.clone(), e.1.clone())) .or_insert(((poly_trait.clone()), None)); ty_to_bounds.entry(ty.clone()).or_default(); } else {", "positive_passages": [{"docid": "doc-en-rust-7d14553b985fdabc964c1c42351cefeda5dded8f0f8c342baa05cb27120b5584", "text": "No crash in stable 1.62.1, crashes with nightly 2022-07-24 and 2022-08-03 : $DIR/two_files_data.rs:5:1 | LL | type Bar = dyn Foo; | ^^^^^^^^^^^^^^^^^^^ LL | trait Bar = dyn Foo; | error: aborting due to previous error", "positive_passages": [{"docid": "doc-en-rust-052f9a9aec870e28059ffe9c1e7337a77b20b0d7d4cf8514ca3d9ce6b70f92a2", "text": "I managed to reproduce the problem with this snippet: The compiler yells E0404 at me, but fair enough I always ask it to a bit more about it :) However this time, it only says this: This is confusing because the snippet above doesn't involve the keyword so I didn't understand initially what I was doing wrong, then I read the error message again: I first tried this, and it worked, but having to repeat the whole syntax everywhere wasn't too compelling, hence the alias: The compiler error message makes it very clear that I can't alias a trait, but the E0404 explanation doesn't mention it at all. I hope the description could also include this use case as I've seen sometimes EXXXX explanations go over several facets of the same problem. That won't help me, but maybe others that may trip on the same problem. I would have submitted a pull request for the docs myself, but I have no idea why you can't use type aliases for traits so I can't it ;) I'm using stable Rust 1.19.0 (on Fedora).\nOne more thing, even though the compiler lets me create an alias for a trait, I don't know when I can use such an alias. Maybe this should be explained too.\nCurrent output (in nightly):\nCurrent output: No structured suggestion for the nightly feature (should be and the feature flag).", "commid": "rust_issue_43913", "tokennum": 307}], "negative_passages": []}
{"query_id": "q-en-rust-02374f0d4708135d578419c352d2a5357dfb969d242efd00eaf4e874b841123a", "query": "use std::rc::Rc; use syntax::ast; use syntax::codemap::Span; use util::common::ErrorReported; use util::ppaux::{UserString, Repr, ty_to_string}; pub fn check_object_cast<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,", "positive_passages": [{"docid": "doc-en-rust-1597bc3357422d85a67991628860a84f9cccd97a50630342ca991857bae415f6", "text": "cc\ncc too, presumably a consequence of the trait reform/new vtable lookup code\nHmm, yes. Probably we can fix this by just...allowing it to skolemize an open existential type. I just didn't expect this to ever happen.\nactually, while debugging this I remembered that it is not possible to make an object out of an unsized type. We need to add a check for this I guess!\nExplanation from PR: In the general case, at least, it is not possible to make an object out of an unsized type. This is because the object type would have to store the fat pointer information for the self value and the vtable -- meaning it'd have to be a fat pointer with three words -- but for the compiler to know that the object requires three words, it would have to know the self-type of the object (is self a thin or fat pointer?), which of course it doesn't.", "commid": "rust_issue_18333", "tokennum": 204}], "negative_passages": []}
{"query_id": "q-en-rust-02487e83bc8755547f39575e30543e56ae320dc6c30eda69627ead3d11734f83", "query": "} } if digit_count == 0 { None } else { Some(result) } if digit_count == 0 { None } else if !allow_zero_prefix && has_leading_zero && digit_count > 1 { None } else { Some(result) } }) }", "positive_passages": [{"docid": "doc-en-rust-2b41261bb4d5a89bb81915260bae528c2831d4ac9d897fc4c9e6a998c9b842be", "text": "According to the , \"The four octets are in decimal notation, divided by . (this is called 'dot-decimal notation'). Notably, octal numbers and hexadecimal numbers are not allowed per IETF RFC 6943\"; however the parsing of the violates the \"strict\" form mentioned in \u2014this form is what prohibits octal and hexadecimal numbers\u2014meanwhile the conforms to it. IETF RFC 6943 Section 3.1.1. states: If the af argument of inetpton() is AFINET, the src string shall be in the standard IPv4 dotted-decimal form: where \"ddd\" is a one to three digit decimal number between 0 and The inetpton() function does not accept other formats (such as the octal numbers, hexadecimal numbers, and fewer than four numbers that inetaddr() accepts). As shown above, inetpton() uses what we will refer to as the \"strict\" form of an IPv4 address literal. Some platforms also use the strict form with getaddrinfo() when the AINUMERICHOST flag is passed to it. I tried this code: I expected to see this happen: both s not causing a panic since the first has an octet represented by more than three base-10 numbers despite the requirement per RFC 6943 stating each octet be a \"one to three digit decimal number\". The second is valid per RFC 6943 since it is a string of exactly 4 octets separated by where each octet is a \"one to three digit decimal number\". Instead, this happened: Both lines cause a panic. : : $DIR/error-body.rs:5:5 | LL | missing(); | ^^^^^^^ not found in this scope error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0425`. ", "positive_passages": [{"docid": "doc-en-rust-f31491731abb5ef1d0c92adee21ce51b58c58845dc75f9537aab385761a91a64", "text": " $DIR/error-body.rs:5:5 | LL | missing(); | ^^^^^^^ not found in this scope error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0425`. ", "positive_passages": [{"docid": "doc-en-rust-f7fab762657b144fee4fc6db717c8406c0d6eefb5171dd364981dbc47698a6d0", "text": " $DIR/issue-54505-no-std.rs:28:16 | LL | take_range(0..1); | ^^^^ | | | expected reference, found struct `core::ops::Range` | help: consider borrowing here: `&(0..1)` | = note: expected type `&_` found type `core::ops::Range<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-std.rs:33:16 | LL | take_range(1..); | ^^^ | | | expected reference, found struct `core::ops::RangeFrom` | help: consider borrowing here: `&(1..)` | = note: expected type `&_` found type `core::ops::RangeFrom<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-std.rs:38:16 | LL | take_range(..); | ^^ | | | expected reference, found struct `core::ops::RangeFull` | help: consider borrowing here: `&(..)` | = note: expected type `&_` found type `core::ops::RangeFull` error[E0308]: mismatched types --> $DIR/issue-54505-no-std.rs:43:16 | LL | take_range(0..=1); | ^^^^^ | | | expected reference, found struct `core::ops::RangeInclusive` | help: consider borrowing here: `&(0..=1)` | = note: expected type `&_` found type `core::ops::RangeInclusive<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-std.rs:48:16 | LL | take_range(..5); | ^^^ | | | expected reference, found struct `core::ops::RangeTo` | help: consider borrowing here: `&(..5)` | = note: expected type `&_` found type `core::ops::RangeTo<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-std.rs:53:16 | LL | take_range(..=42); | ^^^^^ | | | expected reference, found struct `core::ops::RangeToInclusive` | help: consider borrowing here: `&(..=42)` | = note: expected type `&_` found type `core::ops::RangeToInclusive<{integer}>` error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0308`. ", "positive_passages": [{"docid": "doc-en-rust-2a328d2d875e9b888a816998d4d269ab1d4b3c3e85d3f788748090cd2d85e388", "text": "is an incorrect suggestion because has higher precedence than . It should suggest .\nIf someone wants to tackle this issue, it should be straightforward to fix. In: there should be another branch for , where the path of the call is . This code is a good reference: This issue affects the other range syntaxes too, so those should also be fixed (although these are not \u2014 look at for clues).\nHi I'd like to tackle this and take the plunge into the Rust compiler code :)\ngreat! Let me know if you hit any snags or need any more tips. You'll want to add tests for these (in ). The is a good place for general information about the compiler. When you're done, include in the pull request and I'll review it!\nyou've anticipated most of my newbie questions already :) Thanks for that info, very useful! I'm now in the process of stressing my PC with lots of compiling to actually get started. Skimming the test code I'm really impressed by how easy it is to add \"UI\" tests for these sorts of things (compile this, expect this error on this line). Snazzy! That's all great, but do you anticipate I should also add \"deeper\" tests? I guess I'm trying to understand if the scope of this is just pure UI or do I need to touch some syntax parsing/immediate representations, since you mentioned code in . Because the compiler is emitting a syntax suggestion, we might want to assert that the suggestion is correct syntax in the first place. I don't know if that's how deep the rabbit hole goes and if there's a facility to help out, but my hunch is that since we have all of the compiler at hand, why not use it to validate the suggestion syntax? EDIT: OK, reading up on adding new tests to the compiler I encountered mention of , and it seems to be sort-of what I was after.\nThe issue here is just a diagnostic issue, so checking that we're getting the updated hint is enough. The code in is just helpful to see what ranges like and are desugared into, so you can catch them in \u2014 you shouldn't need to modify anything (apart from the test) outside of . It would technically be possible to do something like this, but it would probably be more trouble than it's worth.", "commid": "rust_issue_54505", "tokennum": 502}], "negative_passages": []}
{"query_id": "q-en-rust-09a06697fbc4231a846de2c13d7cd29f61f5b8aad2cfd53cf82133cd865a5f3e", "query": " error: `#[panic_handler]` function required, but not found error[E0308]: mismatched types --> $DIR/issue-54505-no-std.rs:28:16 | LL | take_range(0..1); | ^^^^ | | | expected reference, found struct `core::ops::Range` | help: consider borrowing here: `&(0..1)` | = note: expected type `&_` found type `core::ops::Range<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-std.rs:33:16 | LL | take_range(1..); | ^^^ | | | expected reference, found struct `core::ops::RangeFrom` | help: consider borrowing here: `&(1..)` | = note: expected type `&_` found type `core::ops::RangeFrom<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-std.rs:38:16 | LL | take_range(..); | ^^ | | | expected reference, found struct `core::ops::RangeFull` | help: consider borrowing here: `&(..)` | = note: expected type `&_` found type `core::ops::RangeFull` error[E0308]: mismatched types --> $DIR/issue-54505-no-std.rs:43:16 | LL | take_range(0..=1); | ^^^^^ | | | expected reference, found struct `core::ops::RangeInclusive` | help: consider borrowing here: `&(0..=1)` | = note: expected type `&_` found type `core::ops::RangeInclusive<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-std.rs:48:16 | LL | take_range(..5); | ^^^ | | | expected reference, found struct `core::ops::RangeTo` | help: consider borrowing here: `&(..5)` | = note: expected type `&_` found type `core::ops::RangeTo<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-std.rs:53:16 | LL | take_range(..=42); | ^^^^^ | | | expected reference, found struct `core::ops::RangeToInclusive` | help: consider borrowing here: `&(..=42)` | = note: expected type `&_` found type `core::ops::RangeToInclusive<{integer}>` error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0308`. ", "positive_passages": [{"docid": "doc-en-rust-d92648ddb74268feded1b17c36bb64c5cc2fed311f1f68293677fe19655afc18", "text": "(I'm not aware of a facility to do this easily already.) I think manually going through the possible s and checking that the parenthesisation behaviour is correct in each case would be a lot simpler: if we handle the different s in an exhaustive now (it's likely that if the ranges were handled incorrectly, there could be some others that are also missed at the moment), then this should be a one-time fix and the tests should prevent it regressing. A simple UI test should be sufficient here: will generate the output files, which will include all the relevant notes.\nThere was a similar problem with the suggestions, and it was fixed in . Further use of the operator precedence list can be seen in (which introduced the error fixed in the other PR).\nThanks for your guidance and much appreciated. I have dug into HIR and built-in ranges a bit more. Decided to check all the built-in range types and concluded they are all indeed affected by this problem. The following test I came up with demonstrates my intended fix (fails with nightly as well as stage 1 compiled from master): None of the fix suggestions, when applied, constitute valid syntax. My test checks for syntax I believe should be suggested by the compiler. I'm keen to tackle all of the range types at once in the scope of this issue. The problem I see though is just how wildly different each of the range types is represented in HIR. Adding a call just above this line: Revealed the following: for isfor isfor isfor isfor isfor is I'm quite bewildered by this non-uniformity and I guess I need some help unifying all of these into a elegant condition to tell \"is this a built-in range?\". I could probably brute-force it in a with explicit checks for , but maybe we can do better. Thanks in advance! EDIT realized that this non-uniformity was actually mentioned in the second comment from , but my plea still stands. Thanks for your patience.\nI think you can match on all of these with something along the lines of (pseudocode):\nRight, that's what I had in mind, but was also wondering if something like a check for trait would work better. I guess we want to match against built-in range literals though, and explicitly.", "commid": "rust_issue_54505", "tokennum": 479}], "negative_passages": []}
{"query_id": "q-en-rust-09a06697fbc4231a846de2c13d7cd29f61f5b8aad2cfd53cf82133cd865a5f3e", "query": " error: `#[panic_handler]` function required, but not found error[E0308]: mismatched types --> $DIR/issue-54505-no-std.rs:28:16 | LL | take_range(0..1); | ^^^^ | | | expected reference, found struct `core::ops::Range` | help: consider borrowing here: `&(0..1)` | = note: expected type `&_` found type `core::ops::Range<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-std.rs:33:16 | LL | take_range(1..); | ^^^ | | | expected reference, found struct `core::ops::RangeFrom` | help: consider borrowing here: `&(1..)` | = note: expected type `&_` found type `core::ops::RangeFrom<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-std.rs:38:16 | LL | take_range(..); | ^^ | | | expected reference, found struct `core::ops::RangeFull` | help: consider borrowing here: `&(..)` | = note: expected type `&_` found type `core::ops::RangeFull` error[E0308]: mismatched types --> $DIR/issue-54505-no-std.rs:43:16 | LL | take_range(0..=1); | ^^^^^ | | | expected reference, found struct `core::ops::RangeInclusive` | help: consider borrowing here: `&(0..=1)` | = note: expected type `&_` found type `core::ops::RangeInclusive<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-std.rs:48:16 | LL | take_range(..5); | ^^^ | | | expected reference, found struct `core::ops::RangeTo` | help: consider borrowing here: `&(..5)` | = note: expected type `&_` found type `core::ops::RangeTo<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-std.rs:53:16 | LL | take_range(..=42); | ^^^^^ | | | expected reference, found struct `core::ops::RangeToInclusive` | help: consider borrowing here: `&(..=42)` | = note: expected type `&_` found type `core::ops::RangeToInclusive<{integer}>` error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0308`. ", "positive_passages": [{"docid": "doc-en-rust-04048c692dc9819ef667c0600ed6363f81ba395743e88f4323ddb01c5813593d", "text": "Here's how I rationalize it: because they are parsed and desugared by the compiler, the check needs to be explicit and hardcode all paths to builtin ranges. Handle a special case with a special case.\nYes, this is where the lowering code comes in handy, because you can see exactly how the different syntax is desugared differently, to make sure you really are catching all the cases. Yes, I agree. It'd be nice if there was a more uniform way to handle them, but it's not convenient at the moment. You could include a reference back to in a comment to where the desugaring takes place, which will provide some motivation for matching in .\nAll clear now, thanks. I have succeeded in matching all range types and getting the test to pass. Needs some cleanups, but hopefully should be ready for PR soon. I have a few more questions before that though :smile: I have noticed that most of my code would actually be irrelevant if I re-used functions and constants defined in , e.g.: Can't deny that I have used these as inspiration / guideline (albeit I did not do a stupid copy-paste). What's the policy on using clippy code (clippy is a submodule of main repo)? This is purely in the interest of pursuing . The diff is not that big (52 new lines to , fairly specific to matching paths) -- but still, my clean code sense tingles because of possible DRY violation. Another conundrum I have is whether we should address and paths (and if so, how to work out we're not using at compile time)?\nUnfortunately, there's not much sharing from clippy to rustc. I wouldn't worry about it. If you can encapsulate it easily, it's possible that clippy could make use of the code in rustc instead. The function in picks the correct path for / \u2014 you should be able to use that.\nThanks for the suggestion for , unfortunately I can't really make the association of and . It seems to me they are disjoint -- in : lowering happens in , whereas typechecking happens in . in takes : The it uses needs an awful lot of things to be instantiated. Not sure if I can get the hold of it all in .", "commid": "rust_issue_54505", "tokennum": 492}], "negative_passages": []}
{"query_id": "q-en-rust-09a06697fbc4231a846de2c13d7cd29f61f5b8aad2cfd53cf82133cd865a5f3e", "query": " error: `#[panic_handler]` function required, but not found error[E0308]: mismatched types --> $DIR/issue-54505-no-std.rs:28:16 | LL | take_range(0..1); | ^^^^ | | | expected reference, found struct `core::ops::Range` | help: consider borrowing here: `&(0..1)` | = note: expected type `&_` found type `core::ops::Range<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-std.rs:33:16 | LL | take_range(1..); | ^^^ | | | expected reference, found struct `core::ops::RangeFrom` | help: consider borrowing here: `&(1..)` | = note: expected type `&_` found type `core::ops::RangeFrom<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-std.rs:38:16 | LL | take_range(..); | ^^ | | | expected reference, found struct `core::ops::RangeFull` | help: consider borrowing here: `&(..)` | = note: expected type `&_` found type `core::ops::RangeFull` error[E0308]: mismatched types --> $DIR/issue-54505-no-std.rs:43:16 | LL | take_range(0..=1); | ^^^^^ | | | expected reference, found struct `core::ops::RangeInclusive` | help: consider borrowing here: `&(0..=1)` | = note: expected type `&_` found type `core::ops::RangeInclusive<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-std.rs:48:16 | LL | take_range(..5); | ^^^ | | | expected reference, found struct `core::ops::RangeTo` | help: consider borrowing here: `&(..5)` | = note: expected type `&_` found type `core::ops::RangeTo<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-std.rs:53:16 | LL | take_range(..=42); | ^^^^^ | | | expected reference, found struct `core::ops::RangeToInclusive` | help: consider borrowing here: `&(..=42)` | = note: expected type `&_` found type `core::ops::RangeToInclusive<{integer}>` error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0308`. ", "positive_passages": [{"docid": "doc-en-rust-777e75cd63fa474e6caa8604f5d86d41d1c949172a6bc028486951816b9b74f4", "text": "Another problem I encountered while writing tests is that the changes I have made will affect suggestions for code like this: With my changes, the suggestion would be . I believe the correct suggestion would not involve the needless parentheses. This is due to not differentiating between \"de-sugared\" form coming from and between these de-sugared forms being supplied explicitly as input source code. With this in mind, I think current code is not PR worthy just yet. If of interest, here's the branch:\nLeft a couple of comments on possible approaches on that commit. The code looks fine.", "commid": "rust_issue_54505", "tokennum": 120}], "negative_passages": []}
{"query_id": "q-en-rust-09a49dd53445ec08d475fd66091d3e0171b903d15e6a928bd220dd113f79f998", "query": "/// # Examples /// /// ```no_run /// # #![feature(bufreader_buffer)] /// use std::io::BufWriter; /// use std::net::TcpStream; ///", "positive_passages": [{"docid": "doc-en-rust-0ef0d7c47de84ce09615e9f4d1e1ffeaa57986e3af6adf27e8cda44c8924c939", "text": "Update: this is the tracking issue for: is both unstable and deprecated, it should be removed. There is currently no way to tell whether there is any data buffered inside a BufReader. This is unfortunate because it means that an application has no way to know whether calls to read() and fillbuffer() will return instantly or trigger a potentially expensive call to the underlying Reader. I propose adding an is_empty() method to BufReader to fill this gap.\nnow that has been merged, I'm guessing this should get the label?\nWhat's left for this to stabilize? I'm parsing bytes from a to MsgPack using . The function will stop parsing once a valid MsgPack value has been found. But in my application the parsing should fail if the buffer hasn't been consumed completely. Checking would probably be the cleanest way to do so.\nthe method proposed in may also be useful for that purpose, though that may take even longer to land.\nThis is the tracking issue for: Looks good to me to stabilize. fcp merge\nTeam member has proposed to merge this. The next step is review by the rest of the tagged teams: [x] [x] [x] [ ] [x] [x] [ ] No concerns currently listed. Once a majority of reviewers approve (and none object), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See for info about what commands tagged team members can give me.\nThis seems fine to stabilize, but it seems like it'd be more useful to know how many bytes are buffered, rather than just that there are some number of bytes.\nWhy not both? Slices have even though it\u2019s somewhat redundant with .\nFor sure. Would it be reasonable to try to squeeze that into this stabilization?\nSounds ok to me, though we should probably (re)start FCP after the implementation is merged.\nNaming wise, I don't think fits since that seems to me like it'd refer to the length of the entire reader rather than just the current buffered data (similarly is a bit confusing). How about and ?\nAgreed. Sounds good to me.\nAlternatively, we could add to just return the buffer, which is also a thing people want separately from this issue. At that point seems not much worse than so we could have one method instead of three.", "commid": "rust_issue_45323", "tokennum": 511}], "negative_passages": []}
{"query_id": "q-en-rust-09a49dd53445ec08d475fd66091d3e0171b903d15e6a928bd220dd113f79f998", "query": "/// # Examples /// /// ```no_run /// # #![feature(bufreader_buffer)] /// use std::io::BufWriter; /// use std::net::TcpStream; ///", "positive_passages": [{"docid": "doc-en-rust-f6c7e74bfce9056d3cce689ba3b3b1e1320506b6105eaecbc2ff88b6d3835b2d", "text": "adds and deprecates .\n:bell: This is now entering its final comment period, as per the . :bell:\nWith alternative (and IMO better) proposal just introduced, should this still be going into its final comment period?\nfcp cancel Let\u2019s start again after has landed.\nproposal cancelled.\nWe should likely also add a method to for consistency?\nThat can't be done backwards compatibly.\nwhy not? It's just a , right? Just like .\nOh derp I somehow read that as .\nHaha, no worries. Is there even a trait?\nNo there isn't _Off of the topic of me needing more caffeine, it definitely seems reasonable to add to , and fold it into the same feature gate as 's.\nIt has been a while since landed. Is this ready to stabilize?\nis implemented, but discussed above is not. (I\u2019ve updated the issue\u2019s description with the current status.)\nWait, we aren't proposing to stabilize the (already deprecated) is_empty method are we?\nNo, sorry I didn\u2019t clarify. An API marked both unstable and deprecated is to be removed (after something like a couple release cycles of deprecation period, which we\u2019re at in this case).\nI'm excited to see that this is so close to landing. Is this still waiting on an implementation of ? Would it be possible to track that feature separately to unblock this one?\nBump. Is there anything else blocking stabilization?\nIs there any particular reason not to add to ? It seems like a useful enough general-purpose API (\"get me however many bytes you can easily give me\"), and I found myself looking for such a method while working on parser tooling. Individual implementations could make stricter guarantees about the lower bounds, of which \"at least the unconsumed fraction of the last \" would be a common one.\nYeah, this has been a while. is this ready for a vote to stabilize?\nThis issue seems to have been stuck in a strange limbo state for quite a while now. Pinging more people the rfcbot mentioned...\nSorry we dropped the ball here. This is now one method on the and structs. fcp merge\nTeam member has proposed to merge this. The next step is review by the rest of the tagged team members: [ ] [x] [x] [x] [x] [x] [ ] No concerns currently listed.", "commid": "rust_issue_45323", "tokennum": 514}], "negative_passages": []}
{"query_id": "q-en-rust-09a49dd53445ec08d475fd66091d3e0171b903d15e6a928bd220dd113f79f998", "query": "/// # Examples /// /// ```no_run /// # #![feature(bufreader_buffer)] /// use std::io::BufWriter; /// use std::net::TcpStream; ///", "positive_passages": [{"docid": "doc-en-rust-b9e69d0035c30875cc5e53ff85355ea18490fffca5d319ba808f0b1fdf6bc92a", "text": "Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See for info about what commands tagged team members can give me.\nThere is nothing called in std. Did you mean the trait? A downside is that to add it now we would have to make it a default method, which would (at first) have an inconsistent behavior with for existing impls. We can update impls in std at the same time, but that leaves impls in other crates.\n:bell: This is now entering its final comment period, as per the . :bell:\nSorry, yes, I meant . For my use cases, not having a lower bound is fine. Anything that does can use a marker subtrait that encompasses that guarantee. I think the only stipulation should be that it not provide more than , but less is fine. For example, an implementation might copy existing data around on to make a larger contiguous segment, but can't/shouldn't do so in (I think it should be a cheap conversion, wouldn't have been an unreasonable name).\nThe final comment period, with a disposition to merge, as per the , is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. The RFC will be merged soon.", "commid": "rust_issue_45323", "tokennum": 307}], "negative_passages": []}
{"query_id": "q-en-rust-09b2d11ff31be2bcaa15fd59b396afbf7e06c12a242bc34ed970e09824eabba0", "query": "exact_paths: DefIdMap>, modules: Vec>, is_importable_from_parent: bool, inside_body: bool, } impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {", "positive_passages": [{"docid": "doc-en-rust-bbe8f6c4ef3fd4e46044fb2030f057cc11c45acb6c589d226a7bb70754301a00", "text": " $DIR/issue-52049.rs:16:10 | LL | foo(&unpromotable(5u32)); | ^^^^^^^^^^^^^^^^^^ temporary value does not live long enough LL | } | - temporary value only lives until here | = note: borrowed value must be valid for the static lifetime... error: aborting due to previous error For more information about this error, try `rustc --explain E0597`. ", "positive_passages": [{"docid": "doc-en-rust-cb642c3520b1a6a98785c95cb2d4c71b5240bc747600036763c64341d0734a29", "text": "suggests but still won't give us a lifetime. We should not emit the if the required lifetime is for the inside the source presume there's some code already checking for producing the \"borrowed value must be valid for the static lifetime\" message, find that code and bubble up the knowledge about that until you have it in the scope of the \"consider using a binding to increase its lifetime\" message 't emit the message in that case 'll already fail a bunch of tests, I don't think you need any new tests. Running should succeed and give you a bunch of changes to commit. Check that all changes make sense and just commit them.\ncan I take this on if nobody is working on this?\nAll yours!\nclosing it, as required code change has been merged.", "commid": "rust_issue_52049", "tokennum": 161}], "negative_passages": []}
{"query_id": "q-en-rust-0a879985da1f6513a75e1b27672012468ee0dda4c115afc5cd9778180230fa15", "query": "}; use crate::traits::{Obligation, PredicateObligations}; use rustc_middle::ty::relate::{Relate, RelateResult, TypeRelation}; use rustc_middle::ty::relate::{ relate_args_invariantly, relate_args_with_variances, Relate, RelateResult, TypeRelation, }; use rustc_middle::ty::TyVar; use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_span::Span;", "positive_passages": [{"docid": "doc-en-rust-984bd2cc5e2a7acbf009902bd7c274f0ba42a4999bd245893cbf466bf1db45e4", "text": " $DIR/hash-tyvid-regression-3.rs:17:19 | LL | node.keys.some_function(); | ^^^^^^^^^^^^^ method not found in `SmallVec<{ D * 2 }>` ... LL | struct SmallVec {} | ------------------------------- method `some_function` not found for this error: aborting due to previous error For more information about this error, try `rustc --explain E0599`. ", "positive_passages": [{"docid": "doc-en-rust-3d2230ccded0ff5952dbebfbbd96c9c301c1ac68e367c71bd716549b3b445522", "text": " $DIR/hash-tyvid-regression-3.rs:17:19 | LL | node.keys.some_function(); | ^^^^^^^^^^^^^ method not found in `SmallVec<{ D * 2 }>` ... LL | struct SmallVec {} | ------------------------------- method `some_function` not found for this error: aborting due to previous error For more information about this error, try `rustc --explain E0599`. ", "positive_passages": [{"docid": "doc-en-rust-1a3b49bd155e83a8f86240b49a187aef8e1c92419f3d78270ee3b5ee0b9101d7", "text": " $DIR/try-block-unused-delims.rs:10:13 | LL | consume((try {})); | ^^^^^^^^ help: remove these parentheses | note: the lint level is defined here --> $DIR/try-block-unused-delims.rs:5:9 | LL | #![warn(unused_parens, unused_braces)] | ^^^^^^^^^^^^^ warning: unnecessary braces around function argument --> $DIR/try-block-unused-delims.rs:13:13 | LL | consume({ try {} }); | ^^^^^^^^^^ help: remove these braces | note: the lint level is defined here --> $DIR/try-block-unused-delims.rs:5:24 | LL | #![warn(unused_parens, unused_braces)] | ^^^^^^^^^^^^^ warning: unnecessary parentheses around `match` scrutinee expression --> $DIR/try-block-unused-delims.rs:16:11 | LL | match (try {}) { | ^^^^^^^^ help: remove these parentheses warning: unnecessary parentheses around `let` scrutinee expression --> $DIR/try-block-unused-delims.rs:21:22 | LL | if let Err(()) = (try {}) {} | ^^^^^^^^ help: remove these parentheses warning: unnecessary parentheses around `match` scrutinee expression --> $DIR/try-block-unused-delims.rs:24:11 | LL | match (try {}) { | ^^^^^^^^ help: remove these parentheses warning: 5 warnings emitted ", "positive_passages": [{"docid": "doc-en-rust-d03ab53e09be54af6f2060c02dede3b6c0e9e862953db046b716e90ff0e372f3", "text": "This produces a lint: But removing the parentheses produces an error. This bug was already mentioned in , but that issue is lost in feature-request purgatory since it asks for the version without parentheses to be allowed. I'm opening this issue to track the incorrect lint specifically. (Edit: Fixed the example.) $DIR/try-block-unused-delims.rs:10:13 | LL | consume((try {})); | ^^^^^^^^ help: remove these parentheses | note: the lint level is defined here --> $DIR/try-block-unused-delims.rs:5:9 | LL | #![warn(unused_parens, unused_braces)] | ^^^^^^^^^^^^^ warning: unnecessary braces around function argument --> $DIR/try-block-unused-delims.rs:13:13 | LL | consume({ try {} }); | ^^^^^^^^^^ help: remove these braces | note: the lint level is defined here --> $DIR/try-block-unused-delims.rs:5:24 | LL | #![warn(unused_parens, unused_braces)] | ^^^^^^^^^^^^^ warning: unnecessary parentheses around `match` scrutinee expression --> $DIR/try-block-unused-delims.rs:16:11 | LL | match (try {}) { | ^^^^^^^^ help: remove these parentheses warning: unnecessary parentheses around `let` scrutinee expression --> $DIR/try-block-unused-delims.rs:21:22 | LL | if let Err(()) = (try {}) {} | ^^^^^^^^ help: remove these parentheses warning: unnecessary parentheses around `match` scrutinee expression --> $DIR/try-block-unused-delims.rs:24:11 | LL | match (try {}) { | ^^^^^^^^ help: remove these parentheses warning: 5 warnings emitted ", "positive_passages": [{"docid": "doc-en-rust-3ba5bb88027e7cecc79035147d0b62d98b80eadac1e1b9462a7357fbc041c450", "text": "The following code fails to compile (): The compiler error is: Adding parentheses or braces, it will compile fine: The same issue happens with other constructs such as:\ncc\nI believe the error is expected here, the same as with : Which also needs to be to compile. That said, the warning to remove the necessary parens is definitely wrong. EDIT: Hmm, I might be wrong, actually. The following compiles, which surprised me: as does this: So maybe the parser restriction is only for struct literals, not for keyword-introduced expressions.\nYeah I think is the better comparison here so it's probably a bug.\nThis is exactly what a thought. I didn't know that this:\nFor , hmmm... well, I can't come up with a truly devastating example, but eliminating the parentheses could hurt diagnostics.", "commid": "rust_issue_56828", "tokennum": 185}], "negative_passages": []}
{"query_id": "q-en-rust-0b12e8a0d5147776d82fc88e8a27269ed861e56da23423747d75251805b2e8bc", "query": "} // Visit everything except for private impl items. hir::ItemKind::Impl(ref impl_) => { for impl_item_ref in impl_.items { if impl_.of_trait.is_some() || self.tcx.visibility(impl_item_ref.id.def_id) == ty::Visibility::Public { self.update(impl_item_ref.id.def_id, item_level); } } if item_level.is_some() { self.reach(item.def_id, item_level).generics().predicates().ty().trait_ref();", "positive_passages": [{"docid": "doc-en-rust-12986e5abee77ce3b20a0cf776214e22d4434ee35686f35e800971b37babe538", "text": "EDIT (ehuss) Reproduction: Clone $DIR/issue-5067.rs:4:8 --> $DIR/issue-5067.rs:9:8 | LL | ( $()* ) => {}; | ^^ error: repetition matches empty token tree --> $DIR/issue-5067.rs:6:8 --> $DIR/issue-5067.rs:11:8 | LL | ( $()+ ) => {}; | ^^ error: repetition matches empty token tree --> $DIR/issue-5067.rs:12:9 --> $DIR/issue-5067.rs:13:8 | LL | ( $()? ) => {}; | ^^ error: repetition matches empty token tree --> $DIR/issue-5067.rs:18:9 | LL | ( [$()*] ) => {}; | ^^ error: repetition matches empty token tree --> $DIR/issue-5067.rs:14:9 --> $DIR/issue-5067.rs:20:9 | LL | ( [$()+] ) => {}; | ^^ error: repetition matches empty token tree --> $DIR/issue-5067.rs:20:8 --> $DIR/issue-5067.rs:22:9 | LL | ( [$()?] ) => {}; | ^^ error: repetition matches empty token tree --> $DIR/issue-5067.rs:27:8 | LL | ( $($()* $(),* $(a)* $(a),* )* ) => {}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: repetition matches empty token tree --> $DIR/issue-5067.rs:22:8 --> $DIR/issue-5067.rs:29:8 | LL | ( $($()* $(),* $(a)* $(a),* )+ ) => {}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: repetition matches empty token tree --> $DIR/issue-5067.rs:28:12 --> $DIR/issue-5067.rs:31:8 | LL | ( $($()* $(),* $(a)* $(a),* )? ) => {}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: repetition matches empty token tree --> $DIR/issue-5067.rs:33:8 | LL | ( $($()? $(),* $(a)? $(a),* )* ) => {}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: repetition matches empty token tree --> $DIR/issue-5067.rs:35:8 | LL | ( $($()? $(),* $(a)? $(a),* )+ ) => {}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: repetition matches empty token tree --> $DIR/issue-5067.rs:37:8 | LL | ( $($()? $(),* $(a)? $(a),* )? ) => {}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: repetition matches empty token tree --> $DIR/issue-5067.rs:47:12 | LL | ( $(a $()+)* ) => {}; | ^^ error: repetition matches empty token tree --> $DIR/issue-5067.rs:30:12 --> $DIR/issue-5067.rs:49:12 | LL | ( $(a $()*)+ ) => {}; | ^^ error: repetition matches empty token tree --> $DIR/issue-5067.rs:38:18 --> $DIR/issue-5067.rs:51:12 | LL | ( $(a $()+)? ) => {}; | ^^ error: repetition matches empty token tree --> $DIR/issue-5067.rs:53:12 | LL | ( $(a $()?)+ ) => {}; | ^^ error: repetition matches empty token tree --> $DIR/issue-5067.rs:60:18 | LL | (a $e1:expr $($(, a $e2:expr)*)*) => ([$e1 $($(, $e2)*)*]); | ^^^^^^^^^^^^^^^^^^ error: repetition matches empty token tree --> $DIR/issue-5067.rs:50:8 --> $DIR/issue-5067.rs:71:8 | LL | ( $()* ) => {} LL | ( $()* ) => {}; | ^^ error: aborting due to 10 previous errors error: aborting due to 18 previous errors ", "positive_passages": [{"docid": "doc-en-rust-604ce591f19269597d6325732dad0b77a980d250a5dff6eff6b5d2f4cfa86c61", "text": "The following code will cause the compiler to fail: Playground link: It should error that the inner matcher can match an empty string and reject it, just as it does if is used in place of .\nThe fix should be very easy, since this was already fixed for repetitions in (original bug: ): Looks like just needs to be checked against , too.\ncc\nNote that with on the outside, this errors properly, although with inconsistent error messages: if the inner repetition uses only, the error is \"repetition matches empty token tree\", but it seems that if any of the repetitions are , then the error is \"multiple successful parses\".\nThe behaviour in my previous comment is because the check for \"repetition matches empty token tree\" is done at definition time, but does not catch ; this is caught at expansion time however. Ideally all of this will be moved to definition time and the expansion-time check should probably be a) corrected to address the first comment and b) possibly become an ICE, since it should never be encountered since the RFC 550 rules should eliminate all ambiguity at definition time?\nHmm... I don't really remember how most of this code works... Just grepping, but it looks like there are a couple of other places we might want to look at:\nI've opened", "commid": "rust_issue_57597", "tokennum": 270}], "negative_passages": []}
{"query_id": "q-en-rust-0dd6be5c9f16f74bf1a6c6da6236f0916245febcfb33ea12cbb9815fab824779", "query": " // Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. fn main() { let a = if true { 0 } else if false { //~^ ERROR if may be missing an else clause: expected `()`, found `` 1 }; } ", "positive_passages": [{"docid": "doc-en-rust-e3cf1fac562151f2d349788ec62fb2793092642586d2479a24bf816426c7a8c4", "text": "I apologize in advance if this is a separate issue. With the map() generic function from the tutorial: That code gives a nice error message: However, remove the assignment and what should be the same error message becomes:\nYes, that is unrelated to this issue. You're seeing an expected type mismatch error since the return type of main() is () and your samples result in two different non-() results.\nThanks I was one hour into learning Rust when I came across this. I understand what is going on now. I still think the error message could be improved to mention that \"expected \" is referring to the return type of main(). That simple clue could help people not as familiar with Rust to remember the semicolon rule to turn a statement into an expression.\nNot critical for 0.7, but improving error messages is always good. Nominating for milestone 5.\ndeclined. this is bad but it's not a blocker.\nConfirmed that the situation is unchanged.\nThis is still an issue.\nBug triage. Still an issue.\nVery, very small change:", "commid": "rust_issue_4201", "tokennum": 226}], "negative_passages": []}
{"query_id": "q-en-rust-0df8e653ed055651c4371f93c833b2f4b415d168fcda8bb9b24acc150cdd97c7", "query": "let incr_comp_session_dir: PathBuf = sess.incr_comp_session_dir().clone(); if sess.has_errors() { if sess.has_errors_or_delayed_span_bugs() { // If there have been any errors during compilation, we don't want to // publish this session directory. Rather, we'll just delete it.", "positive_passages": [{"docid": "doc-en-rust-2ef0bc00808ab608a43071a7b3daaefca38598257fa122121f024b4c2658ea13", "text": "When compiling a testcase (e.g. the last snippet in on the current nightly, or any of the other examples in that issue on older compilers) with (or Cargo which does that by default), only the initial run will ICE. Subsequent runs will succeed without an ICE, in the absence of any regular errors. However, changing the relevant code (e.g. adding a space) can cause the query that calls to be recomputed and bring the ICE back. IIUC, incremental compilation stores diagnostics and replays them on subsequent runs, but that appears to not apply to ICEs. cc\nIt looks like without incremental we output artifacts (like ). Do we do this in case of errors too? It seems bad to produce artifacts after an ICE.\nNominating and proposing P-high (mostly because of potential annoyance factor). This should possibly also be labeled I-unsound under the assumption that under the general case of this issue, we might produce artifacts under subsequent runs that may produce UB traces. (However, it is probable that the user will notice the ICE at some other point in time and therefore discard the artifact.)\nThe current expected behavior of the compiler is to not save any incremental state if an error occurs. may slip through the cracks here.\nIn that case, it seems to me like it's a matter of recording the fact that we did a (which we already do, ) and then have this mean \"there was an error\" in terms of \"should we save incremental state?\".\nYep, the following check should also take into account: While we are at it, we could also add a similar check to and , as not to waste time producing values that will then be discarded anyway:\nI'd like to start contributing to rustc and I wanted to ask if this is a good issue to start on (I have read the rustc book)\nSure, this is a decently good issue to start on and should be pretty interesting in terms of learning the infrastructure. If you get stuck, need help, and want to talk synchronously you can hop into https://rust- and we'll try to help out.\nfixes this issue. It would still be good to have a test case for it.\nI have started to write the code making this test possible, I'll open a PR shortly", "commid": "rust_issue_65401", "tokennum": 496}], "negative_passages": []}
{"query_id": "q-en-rust-0e1daf20db5ddd1a8c1aa8a12381bc407ee8e15553d1c66df5c588b161c946c1", "query": "if (InstrProfileOutput) { Options.InstrProfileOutput = InstrProfileOutput; } // cargo run tests in multhreading mode by default // so use atomics for coverage counters Options.Atomic = true; MPM.addPass(InstrProfiling(Options, false)); } );", "positive_passages": [{"docid": "doc-en-rust-3d0c8a4b7a8996da658ea96bca1bc84154ef9a79f167b3e96fd5d396f364660f", "text": " $DIR/issue-64732.rs:3:17 | LL | let _foo = b'hello0'; | ^^^^^^^^^ help: if you meant to write a byte string literal, use double quotes | LL | let _foo = b\"hello0\"; | ^^^^^^^^^ error: character literal may only contain one codepoint --> $DIR/issue-64732.rs:6:16 | LL | let _bar = 'hello'; | ^^^^^^^ help: if you meant to write a `str` literal, use double quotes | LL | let _bar = \"hello\"; | ^^^^^^^ error: aborting due to 2 previous errors ", "positive_passages": [{"docid": "doc-en-rust-aa5bd814d21900267d6f5c7b6ede9e7dd6b2d292e51e36489855f8a454e7c5b9", "text": "When creating a byte literal with single quotes, like , The error message says: But following the directions would not give us a literal, it would give a literal.\nThis should be easy to fix, by replacing the message with: when the literal is prefixed by . You may need to see work out which call is originating from (in ) to pass information about the nature of the literal.\nCan I work on this?\ngo ahead! :) Let me know if you have any questions.\nHi, I have been doing some work in this issue, cause this is the first time I'm sending PR to rust, can you give me some feedback. Thanks!", "commid": "rust_issue_64732", "tokennum": 134}], "negative_passages": []}
{"query_id": "q-en-rust-0e7c6b875fc10908f9bf27ef496355624e3d5f4b0b97583f2294c5e7fe2d41a6", "query": "// aux-build:sepcomp_lib.rs // compile-flags: -C lto // no-prefer-dynamic // ignore-android FIXME #18800 extern crate sepcomp_lib; use sepcomp_lib::a::one;", "positive_passages": [{"docid": "doc-en-rust-47846a3431b006ffe0fcec892d923ae88adb4c7f412d69d4aa9169992e312d3a", "text": "The test run-pass/sepcomp-lib- can fail on android apparently due to the fact that a pthread shim dependency is present in libstd (as part of librust_builtin), but it stripped out early. It may be possible to work around this by moving the dependency into liballoc instead, but a more thorough examination is needed.\ncc\nThe problem here on android was as follows: jemalloc requires the symbol, which android does not provide. jemalloc is also statically linked to liballoc We provide a dummy definition of in , which is assembled into and is statically linked to . When building with LTO, we remove all rust-generated code from an rlib (it's all in the LTO object), but we still link the rlib. When linking, we pass libstd's rlib first, then liballoc's rlib on the command line. The linker detects that we're not using any symbols from the libstd's rlib by the time its reached on the command line (scans from left-to-right) because we actually aren't using any symbols from or any other objects in the archive. The linker then strips from the linkage step, which then later yields an unresolved reference. The solution here is to break apart to be less of a conglomerate and instead link specific symbols to specific libraries wherever necessary. For example all of the time-related functionality should be a lib linked directly to , not to . In this example we need to link the symbol directly to , not to , because is not the one that needs it. Just some general cleanup, most things should still work as advertised!\nTriage: this test is still ignored on android, but I don't know what is nowadays.\n! So I guess this can be closed, but should we check if the affected test was actually fixed?\nYeah I think this is all taken care of, so closing.", "commid": "rust_issue_18800", "tokennum": 417}], "negative_passages": []}
{"query_id": "q-en-rust-0e887d838764a1972c15e9173615c3375730d6031076ad8963f24d7847ba97c4", "query": "path.push(id); } let path = ast::Path { span: mk_sp(lo, self.span.hi), span: mk_sp(path_lo, self.span.hi), global: false, segments: path.move_iter().map(|identifier| { ast::PathSegment {", "positive_passages": [{"docid": "doc-en-rust-18a86246e991ecdcf7e68b1472fd760095c8edf835357fb0bf580756c82d5079", "text": "For 'use' items of the form . [I don't see how to assign this to myself, but I have a patch which I will make into a PR soon]", "commid": "rust_issue_11317", "tokennum": 36}], "negative_passages": []}
{"query_id": "q-en-rust-0e8b07fa7b6c296f02159fe3a2fbc61462cf3148b27994f9e3d5f88f217063d0", "query": "--lldb-python $$(CFG_LLDB_PYTHON) --gdb-version=\"$(CFG_GDB_VERSION)\" --lldb-version=\"$(CFG_LLDB_VERSION)\" --llvm-version=\"$$(LLVM_VERSION_$(3))\" --android-cross-path=$(CFG_ARM_LINUX_ANDROIDEABI_NDK) --adb-path=$(CFG_ADB) --adb-test-dir=$(CFG_ADB_TEST_DIR) ", "positive_passages": [{"docid": "doc-en-rust-cc1e529334a830d470299359e9891eda03d6ff286ee8a07879c9523222ba07cb", "text": "I believe this is due to travis using system llvm which misses the fix backported in . cc\nCan we do anything about this?\nOur best bet is to add a for tests, I think (alternative is to drop support for LLVM pre 3.9, which would be a shame, even if its buggy in certain cases). Implementation of such directive could be implemented by injecting an environment variable or some such (done ) and checking for that in\nThere's no need to set an extra environment variable, just check if is set (or if you're boring :wink: )\nbut\u2026 but\u2026 what if people have on their own systems too?\ncc\nno we do not have existing infrastructure for this. I'd prefer to avoid as that's not the relevant piece here, but rather something like or . Distros or anyone else building with an older LLVM are likely to hit this and we'd need a solution for them as well. That being said I think it's fine to temporarily disable the test until we get that. There's basically a 0% chance of us regressing that test as it's just an LLVM bug, and they already have a regression test upstream as well.\nAnother option would be to create a base Docker image (publishing it to Docker Hub) that is just and the appropriate steps to build whatever version of LLVM we want.\nWe currently advertise ourselves as supporting LLVM 3.7+, and Travis is kinda our test for that, so I'd prefer to not pull that forward just yet (but instead just fix this)\nFor the record, I downgraded our LLVM version in a botched rebase and only this test stopped it at bors. Hopefully, someone would have noticed the absence of a fix, but you can't count of that.\ntouche!", "commid": "rust_issue_36138", "tokennum": 393}], "negative_passages": []}
{"query_id": "q-en-rust-0ed6abe0721448ed2dca502272afd31dd2418eed9c89abfe3ca51ea3f96e43d3", "query": " // Regression test of #43913. // run-rustfix #![feature(trait_alias)] #![allow(bare_trait_objects, dead_code)] type Strings = Iterator; struct Struct(S); //~^ ERROR: expected trait, found type alias `Strings` fn main() {} ", "positive_passages": [{"docid": "doc-en-rust-052f9a9aec870e28059ffe9c1e7337a77b20b0d7d4cf8514ca3d9ce6b70f92a2", "text": "I managed to reproduce the problem with this snippet: The compiler yells E0404 at me, but fair enough I always ask it to a bit more about it :) However this time, it only says this: This is confusing because the snippet above doesn't involve the keyword so I didn't understand initially what I was doing wrong, then I read the error message again: I first tried this, and it worked, but having to repeat the whole syntax everywhere wasn't too compelling, hence the alias: The compiler error message makes it very clear that I can't alias a trait, but the E0404 explanation doesn't mention it at all. I hope the description could also include this use case as I've seen sometimes EXXXX explanations go over several facets of the same problem. That won't help me, but maybe others that may trip on the same problem. I would have submitted a pull request for the docs myself, but I have no idea why you can't use type aliases for traits so I can't it ;) I'm using stable Rust 1.19.0 (on Fedora).\nOne more thing, even though the compiler lets me create an alias for a trait, I don't know when I can use such an alias. Maybe this should be explained too.\nCurrent output (in nightly):\nCurrent output: No structured suggestion for the nightly feature (should be and the feature flag).", "commid": "rust_issue_43913", "tokennum": 307}], "negative_passages": []}
{"query_id": "q-en-rust-0ed7d23ee46fa0e21547952b20d93dd9d21b16aeb052ef2ca248bcb7f46671ae", "query": "buffer: String, } impl core::fmt::Write for Buffer { #[inline] fn write_str(&mut self, s: &str) -> fmt::Result { self.buffer.write_str(s) } #[inline] fn write_char(&mut self, c: char) -> fmt::Result { self.buffer.write_char(c) } #[inline] fn write_fmt(self: &mut Self, args: fmt::Arguments<'_>) -> fmt::Result { self.buffer.write_fmt(args) } } impl Buffer { crate fn empty_from(v: &Buffer) -> Buffer { Buffer { for_html: v.for_html, buffer: String::new() }", "positive_passages": [{"docid": "doc-en-rust-98d299cbe6fc312534166423bc5a5429f8a0c2fa42a476431ce71e5d9e466fbb", "text": "A further performance improvement here would be to make sure that impls , in which case we could use rather than , avoiding the allocation of a temporary here. internally seems to just hold a and it has and methods already, so perhaps it would make sense to implement that trait? I'm not sure how big/relevant the performance improvement would be. Originally posted by in $DIR/unused-attr-doc-hidden.rs:29:5 | LL | #[doc(hidden)] | ^^^^^^^^^^^^^^ help: remove this attribute | note: the lint level is defined here --> $DIR/unused-attr-doc-hidden.rs:4:9 | LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: whether the impl item is `doc(hidden)` or not entirely depends on the corresponding trait item error: `#[doc(hidden)]` is ignored on trait impl items --> $DIR/unused-attr-doc-hidden.rs:34:5 | LL | #[doc(hidden)] | ^^^^^^^^^^^^^^ help: remove this attribute | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: whether the impl item is `doc(hidden)` or not entirely depends on the corresponding trait item error: `#[doc(hidden)]` is ignored on trait impl items --> $DIR/unused-attr-doc-hidden.rs:39:11 | LL | #[doc(hidden, alias = \"aka\")] | ^^^^^^-- | | | help: remove this attribute | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: whether the impl item is `doc(hidden)` or not entirely depends on the corresponding trait item error: `#[doc(hidden)]` is ignored on trait impl items --> $DIR/unused-attr-doc-hidden.rs:44:27 | LL | #[doc(alias = \"this\", hidden,)] | ^^^^^^- | | | help: remove this attribute | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: whether the impl item is `doc(hidden)` or not entirely depends on the corresponding trait item error: `#[doc(hidden)]` is ignored on trait impl items --> $DIR/unused-attr-doc-hidden.rs:49:11 | LL | #[doc(hidden, hidden)] | ^^^^^^-- | | | help: remove this attribute | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: whether the impl item is `doc(hidden)` or not entirely depends on the corresponding trait item error: `#[doc(hidden)]` is ignored on trait impl items --> $DIR/unused-attr-doc-hidden.rs:49:19 | LL | #[doc(hidden, hidden)] | ^^^^^^ help: remove this attribute | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: whether the impl item is `doc(hidden)` or not entirely depends on the corresponding trait item error: aborting due to 6 previous errors ", "positive_passages": [{"docid": "doc-en-rust-58aa9ebee18cbf86476a607328342790283de7458a8b64e0ed3334fb279ea928", "text": "The warning by claims that on an impl item is ignored by rustdoc, but it isn't necessarily. The warning says: which is not true in the following repro: This warning is a false positive. Rustdoc does pay attention to this attribute. For the code above, the rendered documentation of and looks like:
error: `#[doc(hidden)]` is ignored on trait impl items --> $DIR/unused-attr-doc-hidden.rs:29:5 | LL | #[doc(hidden)] | ^^^^^^^^^^^^^^ help: remove this attribute | note: the lint level is defined here --> $DIR/unused-attr-doc-hidden.rs:4:9 | LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: whether the impl item is `doc(hidden)` or not entirely depends on the corresponding trait item error: `#[doc(hidden)]` is ignored on trait impl items --> $DIR/unused-attr-doc-hidden.rs:34:5 | LL | #[doc(hidden)] | ^^^^^^^^^^^^^^ help: remove this attribute | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: whether the impl item is `doc(hidden)` or not entirely depends on the corresponding trait item error: `#[doc(hidden)]` is ignored on trait impl items --> $DIR/unused-attr-doc-hidden.rs:39:11 | LL | #[doc(hidden, alias = \"aka\")] | ^^^^^^-- | | | help: remove this attribute | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: whether the impl item is `doc(hidden)` or not entirely depends on the corresponding trait item error: `#[doc(hidden)]` is ignored on trait impl items --> $DIR/unused-attr-doc-hidden.rs:44:27 | LL | #[doc(alias = \"this\", hidden,)] | ^^^^^^- | | | help: remove this attribute | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: whether the impl item is `doc(hidden)` or not entirely depends on the corresponding trait item error: `#[doc(hidden)]` is ignored on trait impl items --> $DIR/unused-attr-doc-hidden.rs:49:11 | LL | #[doc(hidden, hidden)] | ^^^^^^-- | | | help: remove this attribute | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: whether the impl item is `doc(hidden)` or not entirely depends on the corresponding trait item error: `#[doc(hidden)]` is ignored on trait impl items --> $DIR/unused-attr-doc-hidden.rs:49:19 | LL | #[doc(hidden, hidden)] | ^^^^^^ help: remove this attribute | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: whether the impl item is `doc(hidden)` or not entirely depends on the corresponding trait item error: aborting due to 6 previous errors ", "positive_passages": [{"docid": "doc-en-rust-343120f90f6fabb0ff3862971ba73cfaacf77f39835d800f6b2074263fcc98ab", "text": "Just wanted to add that this is also affecting , but in a different way: // set VSLANG to 1033 can prevent link.exe from using // language packs, and avoid generating Non-UTF-8 error // messages if a link error occurred. link_env: vec![(\"VSLANG\".to_string(), \"1033\".to_string())], pre_link_args: args, crt_static_allows_dylibs: true, crt_static_respected: true,", "positive_passages": [{"docid": "doc-en-rust-bafc7c8a486fd8f6ca3ce61653c06094ae1bf452560092cfe96f0540dcb8d85e", "text": "A localized (e.g. German) MSVC can produce non-UTF-8 output, which can become almost unreadable in the way it's currently forwarded to the user. This can be seen in an (otherwise unrelated) issue comment: Note especially this line: That output might be a lot longer for multiple LNK errors (one line per error, but the lines are not properly separated in the output, because they are converted to ) and become really hard to read. If possible, the output should be converted to Unicode in this case. (previously reported as ) NOTE from Please install Visual Studio English Language Pack side by side with your favorite language pack for UI\nI\u2019m surprised we try to interpret any output in Windows as UTF-8 as opposed to UTF-16, like we should.\nI suspect that the MSVC compiler's raw output is encoded as Windows-1252 or Windows-1250 (for German) depending on the current console code page and not as UTF-16. Does solve the encoding problem?\nNo, neither in nor in (usually I'm working with the latter). It prints but the encoding problems persist.\nIs it just MSVC which is localized, or is your system codepage itself different? If we know that a certain program's output is the system codepage we could use with to convert it. Perhaps we could check whether the output is UTF-8, and attempt to do the codepage conversion if it isn't.\nI am using a German localized Windows. How can I find out the system codepage? The default CP for console windows is \"850 (OEM - Multilingual Lateinisch I)\".\nYou can call with or .\nThat returns codepage numbers 1252 for and 850 for .\nIn which case the output from the linker appears to be , so now someone just has to add code to rustc which detects when the linker output isn't utf-8 on windows and use with instead.\nI ran into this problem as well (also on a German Windows 10). As a workaround it helps if you go to in Win 10 to Settings -Region and Language -Language and add English as a language and make it default ( you may have to log out and back in again). After that, programs like should output using a locale that works with rust as it is right now.", "commid": "rust_issue_35785", "tokennum": 495}], "negative_passages": []}
{"query_id": "q-en-rust-110741c6b5677bb67eda59812bd0aafcb890919d102f39238e5c95969a5b756b", "query": "target_family: Some(\"windows\".to_string()), is_like_windows: true, is_like_msvc: true, // set VSLANG to 1033 can prevent link.exe from using // language packs, and avoid generating Non-UTF-8 error // messages if a link error occurred. link_env: vec![(\"VSLANG\".to_string(), \"1033\".to_string())], pre_link_args: args, crt_static_allows_dylibs: true, crt_static_respected: true,", "positive_passages": [{"docid": "doc-en-rust-d5ca547af4714618bac41366b556e9484a1a422439ae1a0d9fb66e71ccaf8577", "text": "It would still be great if this could be fixed in rust :)\nJust saw another instance of this in , except with ) (a common encoding in China), where got printed instead of the desired .\nUsing nightly 2019-07-04, we can confirm that this issue is fixed. (I'm using Chinese version of Visual Studio).\nFor me, it still does not work even with nightly build (1.38 x86_64-pc-windows-msvc, Russian version of VS). I try to compile a Hello world project in Intellij Idea but always get the exception:\nCould you execute and see what that outputs?\nThat's a little strange. Could you open \"x64 Native Tools Command Prompt for Visual Studio 2019\" from start menu, and execute the following command: And see whether the output is English? If the output's still not in English, would you mind open \"Visual Studio Installer\" from start menu, choose \"Modify\" for the corresponding Visual Studio edition, and in the Language packs tab, install the English language pack. And try the instructions above again?\nthanks! The hint about installing the English language pack has made the previous error disappear. But now I have another message while running in Idea: I haven't changed the path to the std library, it's looks like\nYes, this is the same error as before, it's because you didn't install windows sdk. Choose the newest one in the visual studio installer too.\nthank you again. Now it's compiling and running. I'm happy ;) Just out of curiosity: was I supposed to know in advance that I would need an English lang pack and a Windows SDK when installing Visual Studio?\nPlease feel free to point out places where Rust tells you to install Visual Studio but does not tell you to install the Windows SDK, so that we can fix those places. It might still be worth implementing the text encoding version of the fix for people who don't have the English language pack, though I really wish we could just get unicode output out of VS without having to specify a language.\nsorry, seems I was a bit inattentive. Now I double-checked: after starting rustup- the screen info says, I should assure that I have Windows SDK installed. So my fault, nothing to fix there :) Thanks.\nThis is not a fix anymore.", "commid": "rust_issue_35785", "tokennum": 494}], "negative_passages": []}
{"query_id": "q-en-rust-110741c6b5677bb67eda59812bd0aafcb890919d102f39238e5c95969a5b756b", "query": "target_family: Some(\"windows\".to_string()), is_like_windows: true, is_like_msvc: true, // set VSLANG to 1033 can prevent link.exe from using // language packs, and avoid generating Non-UTF-8 error // messages if a link error occurred. link_env: vec![(\"VSLANG\".to_string(), \"1033\".to_string())], pre_link_args: args, crt_static_allows_dylibs: true, crt_static_respected: true,", "positive_passages": [{"docid": "doc-en-rust-b42b4772e97289b24bf9cfae11e435e42a50466f33be2fadfa594f9e95731750", "text": "refer to\nPlease make sure you have installed Visual Studio English Language Pack side by side with your favorite language pack for UI for this to work.\nI'm not sure this problem is really fixed. The PR that closed this kinda works around the issue because English is usually ASCII which is the same in UTF-8. However, as noted above, this relies on the Visual Studio English language pack being installed which it isn't always. And that there's no non-ascii output (e.g. file paths, etc). The suggestion to use with seems like a better fix, imho.", "commid": "rust_issue_35785", "tokennum": 127}], "negative_passages": []}
{"query_id": "q-en-rust-11243c62c9a4c30fe352906f58d969c203106793ba93bd6e3165739950d08453", "query": "python2.7 \"$BUILD_SOURCESDIRECTORY/src/tools/publish_toolstate.py\" \"$(git rev-parse HEAD)\" \"$(git log --format=%s -n1 HEAD)\" \"\" \"\" cd .. rm -rf rust-toolstate condition: and(succeeded(), eq(variables['IMAGE'], 'mingw-check')) condition: and(succeeded(), not(variables.SKIP_JOB), eq(variables['IMAGE'], 'mingw-check')) displayName: Verify the publish_toolstate script works - bash: |", "positive_passages": [{"docid": "doc-en-rust-53d2d25b6ecda1c8cd4210e84cc4c97f063a5cf31414824de730b2ad07f867de", "text": "This issue is meant to track where on Travis we currently whenever the commit message looks like it updates a submodule. We should enable something similar for Azure Pipelines where whenever a PR is detected as updating a submodule (either via actually looking at the git history or at the git commit message) then we schedule the builder on the PR. The purpose of this PR build is to help weed out errors even sooner than before where we're just running a smoke tests on Linux on each PR.", "commid": "rust_issue_61837", "tokennum": 106}], "negative_passages": []}
{"query_id": "q-en-rust-113ac596f1a902840ef1a41ade27791428e565026fd1d1a4f85ce2cffa04f2a6", "query": "#![crate_name = \"foo\"] // The goal of this test is to answer that it won't be generated as a list because // The goal of this test is to ensure that it won't be generated as a list because // block doc comments can have their lines starting with a star. // @has foo/fn.foo.html", "positive_passages": [{"docid": "doc-en-rust-189d97bff364768ec29be21c8bfe9ee256f15acfdad0add7da20347d6d526e41", "text": "Hi, I've just published a new version of my crate and the generated documentation is including a lot of bullet points that have never been included before. When I generate the docs locally on the 1.8.1 source code using the latest stable version of rust I see the same formatting for the 1.8.0 that generated, so I think this is a bug that's slipped into the nightly version of Stable local docs: ! ! My guess is that it's because I'm using block comments, the unwanted bullet points seem to match up with empty lines in the documentation comment which consist of just a . Thanks\nSeems potentially related to , but the latest builds were from a nightly that should have that fixed in; cc you probably have some idea on where the issue is.\nThis is highly surprising indeed. Can you run with the last nightly locally and tell us if it reproduces the bug please? If so, I'll try to check what's wrong in rustdoc.\nI have ran cargo doc on the latest nightly locally (nightly-x86_64-unknown-linux-gnu rustc 1.60.0-nightly ( 2022-01-20)) and it has reproduced the bug - I see the same generated docs as from the build.\nIt'll be fixed by\nThanks, is there any way I can get to rebuild the docs for the affected versions or will I have to submit a new version of my library to get a fixed build?\nSure. But that for that, please open an issue on repository directly.", "commid": "rust_issue_93309", "tokennum": 322}], "negative_passages": []}
{"query_id": "q-en-rust-117ead81c5c5a12b2cc0a204e022a8c2aa81e16d804408a33d1ca50e958d83dc", "query": " error[E0271]: type mismatch resolving ` as Stream>::Item == Repr` --> $DIR/issue-89008.rs:38:43 | LL | fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> { | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch resolving ` as Stream>::Item == Repr` | | | this type parameter | note: expected this to be `()` --> $DIR/issue-89008.rs:17:17 | LL | type Item = (); | ^^ = note: expected unit type `()` found type parameter `Repr` error: aborting due to previous error For more information about this error, try `rustc --explain E0271`. ", "positive_passages": [{"docid": "doc-en-rust-12b65699efe1682bdd41783774d4731ae3a731807bd72b7dd51b8b76a0a358cf", "text": " $DIR/issue-3907.rs:5:1 | LL | type Foo = dyn issue_3907::Foo; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | trait Foo = dyn issue_3907::Foo; | help: consider importing this trait instead | LL | use issue_3907::Foo;", "positive_passages": [{"docid": "doc-en-rust-052f9a9aec870e28059ffe9c1e7337a77b20b0d7d4cf8514ca3d9ce6b70f92a2", "text": "I managed to reproduce the problem with this snippet: The compiler yells E0404 at me, but fair enough I always ask it to a bit more about it :) However this time, it only says this: This is confusing because the snippet above doesn't involve the keyword so I didn't understand initially what I was doing wrong, then I read the error message again: I first tried this, and it worked, but having to repeat the whole syntax everywhere wasn't too compelling, hence the alias: The compiler error message makes it very clear that I can't alias a trait, but the E0404 explanation doesn't mention it at all. I hope the description could also include this use case as I've seen sometimes EXXXX explanations go over several facets of the same problem. That won't help me, but maybe others that may trip on the same problem. I would have submitted a pull request for the docs myself, but I have no idea why you can't use type aliases for traits so I can't it ;) I'm using stable Rust 1.19.0 (on Fedora).\nOne more thing, even though the compiler lets me create an alias for a trait, I don't know when I can use such an alias. Maybe this should be explained too.\nCurrent output (in nightly):\nCurrent output: No structured suggestion for the nightly feature (should be and the feature flag).", "commid": "rust_issue_43913", "tokennum": 307}], "negative_passages": []}
{"query_id": "q-en-rust-13ccc30dca59000fe2f5b84f957e43d38761ed620e67902e89c50c95ffcd5a56", "query": "// `public_items` map, so we can skip inserting into the // paths map if there was already an entry present and we're // not a public item. if !self.cache.paths.contains_key(&item.item_id.expect_def_id()) let item_def_id = item.item_id.expect_def_id(); if !self.cache.paths.contains_key(&item_def_id) || self .cache .effective_visibilities .is_directly_public(self.tcx, item.item_id.expect_def_id()) .is_directly_public(self.tcx, item_def_id) { self.cache.paths.insert( item.item_id.expect_def_id(), (self.cache.stack.clone(), item.type_()), ); self.cache .paths .insert(item_def_id, (self.cache.stack.clone(), item.type_())); } } }", "positive_passages": [{"docid": "doc-en-rust-4f4ec5fc69039eacbca3494799c58df541f483b7be27c0766ebfd47c910b0250", "text": "Generated rustdoc JSON for every one of dozens of crates I've looked at seems to contain unexpected inlined items that look like an block and its contents. I expected to see this happen: rustdoc JSON file contains only the items defined or re-exported by the corresponding crate. Instead, this happened: the rustdoc JSON file contains items like this: In this example, is and here are the names of the items contained in that impl (also part of the rustdoc JSON): Similarly, you can find items from : Invocation for generating rustdoc JSON: : You can find a variety of pre-generated rustdoc JSON files with this issue here: Briefly discussed in Zulip: https://rust- I'll have to work around this behavior to shield , which uses the same codebase as the playground link above. I can hold off on updating the playground for, say, another week, but at some point I'll need to upgrade it to include my workaround which means those items will cease being shown. label +T-rustdoc +A-rustdoc-json\nPossibly duplicate of\nMight be! Definitely at least some overlap, not entirely sure if duplicate. Do you mind if I ship the workaround for this in cargo-semver-checks and the playground, which will hide these items from our lints and from queries in the playground?\nYeah, it's easy enough to reproduce in raw json, I'm not worried about the repro breaking.", "commid": "rust_issue_114039", "tokennum": 323}], "negative_passages": []}
{"query_id": "q-en-rust-13d80c7d2b66c4a10eaf927088224400fe5942bc1a480eb9bec85ce896b2e96b", "query": " // 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 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. struct Foo; impl Foo { fn putc(&self, b: u8) { } fn puts(&self, s: &str) { for byte in s.bytes() { self.putc(byte) } } } fn main() {} ", "positive_passages": [{"docid": "doc-en-rust-7f11a8d075e37c6c84cc4623987108dcdb8090f81fbe2e9074371b2da4908f89", "text": "Minimised example: Both the and the fail in the same way, with an ICE: Adding bounds to and on the trait or in the fn\u2019s where clause doesn\u2019t fix it, but changing to does fix it. (In the particular case that I was dealing with, the lifetime could_ be changed to where this was a problem, but it would only have taken a slight variation of it for me to be in a situation where I needed a non- implementation. There were, of course, other arguments which were using the .) The whole thing around there seems a bit fragile and I\u2019m not quite sure what\u2019s supposed to work and what\u2019s not; if we just take an and transmute it to , for example, we get \u201cerror: cannot transmute to or from a type that contains type parameters in its interior [E0139]\u201d. Anyway, an ICE is always a bug, so here\u2019s the report!\nNo longer repros. compiles now. Fails with: But no ICE.", "commid": "rust_issue_21174", "tokennum": 214}], "negative_passages": []}
{"query_id": "q-en-rust-13d80c7d2b66c4a10eaf927088224400fe5942bc1a480eb9bec85ce896b2e96b", "query": " // 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 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. struct Foo; impl Foo { fn putc(&self, b: u8) { } fn puts(&self, s: &str) { for byte in s.bytes() { self.putc(byte) } } } fn main() {} ", "positive_passages": [{"docid": "doc-en-rust-79507fc1f7658b8719484b7b52a60ae2888563c06a9dda557dae762966b7a798", "text": "While trying to learn how to return a closure.... I came across this.. gives....\nCommenting-out the body of still results in an ICE.\nI can't seem to produce an ICE no matter what I do.\nThose closure kinds info are already gone, so I think many related bugs are gone as well. e.g. I cannot reproduce a bug related to closure kinds and macro", "commid": "rust_issue_20862", "tokennum": 85}], "negative_passages": []}
{"query_id": "q-en-rust-13d9467847b1fabbd5159243dead28df3fa7d831945e992e280136d55bcfd8f2", "query": " // check-pass // aux-build:test-macros.rs // compile-flags: -Z span-debug #![no_std] // Don't load unnecessary hygiene information from std extern crate std; #[macro_use] extern crate test_macros; macro_rules! empty_stmt { ($s:stmt) => { print_bang!($s); // Currently, all attributes are ignored // on an empty statement #[print_attr] #[rustc_dummy(first)] #[rustc_dummy(second)] $s } } fn main() { empty_stmt!(;); } ", "positive_passages": [{"docid": "doc-en-rust-00a16e75b2da07497159a633bb6026bc5678ea714a8488545f2abb4a75530a50", "text": "This the the of a proc macro crate : And here is the of another crate: When building, this outputs: 49.0, 1.50.0-beta.5 rustc 1.51.0-nightly ( 2021-01-05) binary: rustc commit-hash: commit-date: 2021-01-05 host: x86_64-unknown-linux-gnu release: 1.51.0-nightly\ncc\ncc\nAssigning as discussed as part of the and removing .\nassigning to self to confirm if is the cause of the breakage, and if so, revert the PR until it can be revised to handle this case.\nThis is caused by us not handling properly - I'm working on a fix.\nOpened", "commid": "rust_issue_80760", "tokennum": 155}], "negative_passages": []}
{"query_id": "q-en-rust-13ddc92944b64a8c0ff9340c269286f2b556e94680bc56e27e4abd4b75c04f85", "query": " #!/bin/sh CARGO_TARGET_DIR=$(pwd)/target/ export CARGO_TARGET_DIR echo 'Deprecated! `util/dev` usage is deprecated, please use `cargo dev` instead.' cd clippy_dev && cargo run -- \"$@\" ", "positive_passages": [{"docid": "doc-en-rust-5890e6640ff80e26ad239b6745c8682bd0cdc9e7c64042d2c8d720ffec246dd1", "text": "The following sample crashed rustc: Removing the , or unwrapping the (leaving only ), or replacing the predicate (leaving ), solves the crash. Reproduced on Windows 64-bit, Fedora 32-bit, Ubuntu 64-bit. Full crash log (thanks to ) @ Short crash message:\nFixed pending\nFixed in", "commid": "rust_issue_5741", "tokennum": 72}], "negative_passages": []}
{"query_id": "q-en-rust-13ddc92944b64a8c0ff9340c269286f2b556e94680bc56e27e4abd4b75c04f85", "query": " #!/bin/sh CARGO_TARGET_DIR=$(pwd)/target/ export CARGO_TARGET_DIR echo 'Deprecated! `util/dev` usage is deprecated, please use `cargo dev` instead.' cd clippy_dev && cargo run -- \"$@\" ", "positive_passages": [{"docid": "doc-en-rust-a993c24a1c7513b381ddbf290bffb122c28afde548309e53b088fb69e578e155", "text": "While I was playing with the new rustc 0.6, I encountered an internal compiler error The source code is here: Compiler version is 0.6, built with gcc, on OS X 10.7.5\nIf you run rustc under gdb and break on , could you paste the backtrace here?\nOK. Here is the backtrace:\nLooks like stack exhaustion to me. What happens if you remove ?\nThe code compiles with no problem when I wrap the rest of the code with mod block. Like:\nThis yields a proper error message now; closing.", "commid": "rust_issue_5711", "tokennum": 120}], "negative_passages": []}
{"query_id": "q-en-rust-13ddc92944b64a8c0ff9340c269286f2b556e94680bc56e27e4abd4b75c04f85", "query": " #!/bin/sh CARGO_TARGET_DIR=$(pwd)/target/ export CARGO_TARGET_DIR echo 'Deprecated! `util/dev` usage is deprecated, please use `cargo dev` instead.' cd clippy_dev && cargo run -- \"$@\" ", "positive_passages": [{"docid": "doc-en-rust-0286fbc1470d315343e826c245536ac7e84696408891dbe18ff9f46cd1875a69", "text": "When you download the 0.6 tarball and execute ./configure && make, a download occurs. and a wget info dump appears. It would be really awesome if this piece was integrated with the tarball. Not all environments are friendly to downloading arbitrary code off the net. E.g., I might be in a SCIF[1] and experimenting with Rust on a machine disconnected from the public net. Or I might be on a laptop working in a no-wifi area. :-/ (I know this is probably a real low priority issue, but it IS a (usually minor) hassle) [1]\nPlease note that you can avoid that if you already have a (compatible) locally installed rust compiler. Check the --local-rust and --local-rust-root parameters for ./configure. Also, I'm against bundling binaries in source tarballs. They are target-dependent and bundling all of them will make the released archive quite large. Downloading an external bootstrapper is a minor issue for downstream packagers too, though. See\nfar-future\nYeah, you can also just populate the directory in your builddir with an appropriate snapshot tarball. There's not much else we can do here. Putting binaries in a source tarball feels even worse, to me. Closing as I don't expect we're going to much change the requirements here and have several workable workarounds.", "commid": "rust_issue_5705", "tokennum": 311}], "negative_passages": []}
{"query_id": "q-en-rust-13ddc92944b64a8c0ff9340c269286f2b556e94680bc56e27e4abd4b75c04f85", "query": " #!/bin/sh CARGO_TARGET_DIR=$(pwd)/target/ export CARGO_TARGET_DIR echo 'Deprecated! `util/dev` usage is deprecated, please use `cargo dev` instead.' cd clippy_dev && cargo run -- \"$@\" ", "positive_passages": [{"docid": "doc-en-rust-5d52a79cd2609550f06e1c362d9d5af2980991e05c9aa928d7960502fa72c743", "text": "As seen in , LLVM has lots of places where it will insert calls to libm directly, not switching stacks. One of places that I recall seeing this before is the translation of the instruction. Rust has floating point modulus and presumably it is doing it in the red zone.\nWe can solve this with an lang item.\nIs this an issue with calls to compiler-rt too? Or are they compiled in some special way to avoid the issue?\nNominating for milestone 5, production-ready\n, , and are also all generated. As far as I can tell, we can't prevent it from generating these by altering the IR we output.\nWe can possibly be selective about when we emit memcpy/memmov, second guessing LLVM (like, never for big things)\naccepted for production-ready milestone\nClosing due to segmented stacks being gone (stack switches no longer a thing)", "commid": "rust_issue_5702", "tokennum": 185}], "negative_passages": []}
{"query_id": "q-en-rust-13e4a92f6d2c0dd1625c678ce538da02f7fdc7024f2225f9b28680fdda3ffc9a", "query": "id: AllocId, liveness: AllocCheck, ) -> InterpResult<'static, (Size, Align)> { // Regular allocations. if let Ok(alloc) = self.get(id) { return Ok((Size::from_bytes(alloc.bytes.len() as u64), alloc.align)); } // Function pointers. if let Ok(_) = self.get_fn_alloc(id) { return if let AllocCheck::Dereferencable = liveness { // The caller requested no function pointers. err!(DerefFunctionPointer) } else { Ok((Size::ZERO, Align::from_bytes(1).unwrap())) }; } // Foreign statics. // Can't do this in the match argument, we may get cycle errors since the lock would // be held throughout the match. let alloc = self.tcx.alloc_map.lock().get(id); match alloc { Some(GlobalAlloc::Static(did)) => { assert!(self.tcx.is_foreign_item(did)); // Use size and align of the type let ty = self.tcx.type_of(did); let layout = self.tcx.layout_of(ParamEnv::empty().and(ty)).unwrap(); return Ok((layout.size, layout.align.abi)); // Don't use `self.get` here as that will // a) cause cycles in case `id` refers to a static // b) duplicate a static's allocation in miri match self.alloc_map.get_or(id, || Err(())) { Ok((_, alloc)) => Ok((Size::from_bytes(alloc.bytes.len() as u64), alloc.align)), Err(()) => { // Not a local allocation, check the global `tcx.alloc_map`. // Can't do this in the match argument, we may get cycle errors since the lock would // be held throughout the match. let alloc = self.tcx.alloc_map.lock().get(id); match alloc { Some(GlobalAlloc::Static(did)) => { // Use size and align of the type. let ty = self.tcx.type_of(did); let layout = self.tcx.layout_of(ParamEnv::empty().and(ty)).unwrap(); Ok((layout.size, layout.align.abi)) }, Some(GlobalAlloc::Memory(alloc)) => // Need to duplicate the logic here, because the global allocations have // different associated types than the interpreter-local ones. Ok((Size::from_bytes(alloc.bytes.len() as u64), alloc.align)), Some(GlobalAlloc::Function(_)) => { if let AllocCheck::Dereferencable = liveness { // The caller requested no function pointers. err!(DerefFunctionPointer) } else { Ok((Size::ZERO, Align::from_bytes(1).unwrap())) } }, // The rest must be dead. None => if let AllocCheck::MaybeDead = liveness { // Deallocated pointers are allowed, we should be able to find // them in the map. Ok(*self.dead_alloc_map.get(&id) .expect(\"deallocated pointers should all be recorded in `dead_alloc_map`\")) } else { err!(DanglingPointerDeref) }, } } _ => {} } // The rest must be dead. if let AllocCheck::MaybeDead = liveness { // Deallocated pointers are allowed, we should be able to find // them in the map. Ok(*self.dead_alloc_map.get(&id) .expect(\"deallocated pointers should all be recorded in `dead_alloc_map`\")) } else { err!(DanglingPointerDeref) } }", "positive_passages": [{"docid": "doc-en-rust-b528c292f3c91eb97461730abd6ebc6ed83d5c8516b498e33d4b4d2c09405674", "text": "Let's tying to compile this code.This code compiled ok on stable and on nightly-2019-06-17 (for example at rust play site) But in current rustc 1.37.0-nightly ( 2019-06-26) compilation fails with message:\nBisected to: Ok Fail ...\nI bisected to , which is also part of the range identified. I get build failures when I try to bisect further into the commits of that PR. cc\nHmm curious, we do have tests for such situations. I'll investigate, but it'll drop into beta today. It's probably an easy fix\nToday? Beta cutoff is on Tuesday.\nNot this time I believe\nBeta cutoff is 2019-06-29 https://rust-\ntriage: P-high, remove nomination, assign to\nFYI, Oli is on vacation for 2 weeks.\nShould this be marked regression-from-stable-to-beta now?", "commid": "rust_issue_62189", "tokennum": 201}], "negative_passages": []}
{"query_id": "q-en-rust-142f0cf17e4e9f9909838a614522c35e244acd08ebef51fc9a4e35bbc263aded", "query": " // We used to not lower the extra `b @ ..` into `b @ _` which meant that no type // was registered for the binding `b` although it passed through resolve. // This resulted in an ICE (#69103). fn main() { let [a @ .., b @ ..] = &mut [1, 2]; //~^ ERROR `..` can only be used once per slice pattern b; let [.., c @ ..] = [1, 2]; //~^ ERROR `..` can only be used once per slice pattern c; // This never ICEd, but let's make sure it won't regress either. let (.., d @ ..) = (1, 2); //~^ ERROR `..` patterns are not allowed here d; } ", "positive_passages": [{"docid": "doc-en-rust-0489f46ff12c4bce4972c67faff50e0b64c6a4338130f902673bc284c1641a7d", "text": "The ICE only occurs when is used. $DIR/deprecation-sanity.rs:19:25 | LL | #[deprecated(note = b\"test\")] //~ ERROR literal in `deprecated` value must be a string | ^^^^^^^ help: consider removing the prefix: `\"test\"` error[E0565]: item in `deprecated` must be a key/value pair --> $DIR/deprecation-sanity.rs:22:18 | LL | #[deprecated(\"test\")] //~ ERROR item in `deprecated` must be a key/value pair | ^^^^^^ error[E0550]: multiple deprecated attributes --> $DIR/deprecation-sanity.rs:22:1 --> $DIR/deprecation-sanity.rs:28:1 | LL | fn multiple1() { } //~ ERROR multiple deprecated attributes | ^^^^^^^^^^^^^^^^^^ error[E0538]: multiple 'since' items --> $DIR/deprecation-sanity.rs:24:27 --> $DIR/deprecation-sanity.rs:30:27 | LL | #[deprecated(since = \"a\", since = \"b\", note = \"c\")] //~ ERROR multiple 'since' items | ^^^^^^^^^^^ error: aborting due to 7 previous errors error: aborting due to 9 previous errors Some errors occurred: E0538, E0541, E0550, E0551. Some errors occurred: E0538, E0541, E0550, E0551, E0565. For more information about an error, try `rustc --explain E0538`.", "positive_passages": [{"docid": "doc-en-rust-699165934c80543c4268112ded5c2fa751811cc13a5ca9806fbd70804b62c091", "text": "Look for example to It is deprecated, and in source code there is hint what should be used instead: but in generated html documentation there is no hint about\nisn't the correct syntax for the attribute. It should be . You can see it work: . This isn't a rustdoc issue. It's an issue with rustc that it doesn't reject .", "commid": "rust_issue_48271", "tokennum": 79}], "negative_passages": []}
{"query_id": "q-en-rust-14cf61dbcc35a90cdf855f783fa77785d7ead83d62a6529ee884578029d5070d", "query": "// ensure that we issue lints in a repeatable order def_ids.sort_by_cached_key(|&def_id| self.tcx.def_path_hash(def_id)); for def_id in def_ids { 'lifetimes: for def_id in def_ids { debug!(\"check_uses_for_lifetimes_defined_by_scope: def_id = {:?}\", def_id); let lifetimeuseset = self.lifetime_uses.remove(&def_id);", "positive_passages": [{"docid": "doc-en-rust-9db1c43dc45e5ab0a7fbb7e0e1897675a3e63a6fabb8ff4c7eed50d353c89c2b", "text": "I tried this code: I expected to see this happen: the code is correct. Instead, this happened: Just swap the functions, then the code compiles: Update : The examples may be misleading. I forgot that takes effect on a single item. It was a typo. Here is a new example. It should be correct. But the compiler does not accept it. $DIR/tainted-promoteds.rs:7:5 | LL | let a = 0; | - | | | first assignment to `a` | help: consider making this binding mutable: `mut a` LL | a = &0 * &1 * &2 * &3; | ^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable error: aborting due to previous error For more information about this error, try `rustc --explain E0384`. ", "positive_passages": [{"docid": "doc-en-rust-2b90d168513602c37576513999bdf3df0376853b8259a4b14dba589bceba8904", "text": "I tried : I expected to see this happen: an error about not being able to move out of a slice Instead, this happened: the error and a bunch of Fails on , works fine on\nIt also applies to way simpler code like:\nsearched nightlies: from nightly-2023-04-01 to nightly-2023-04-26 regressed nightly: nightly-2023-04-22 searched commit range: regressed commit: { assert!( inner_attrs.len() == 0, \"Found outer attribute {:?} after inner attrs {:?}\", attr, inner_attrs ); outer_attrs.push(attr); } crate::AttrStyle::Inner => {", "positive_passages": [{"docid": "doc-en-rust-27c231f161e5b0e90caf267be78168c96a08f80e611682933af7a2d0eb404e20", "text": " $DIR/issue-85347.rs:3:46 | LL | type Bar<'a>: Deref::Bar>; | ^^^^^^^^^^^^^ associated type not allowed here error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0107`. Some errors have detailed explanations: E0107, E0229. For more information about an error, try `rustc --explain E0107`. ", "positive_passages": [{"docid": "doc-en-rust-242010517afb69b1e791421aa2d510d7720c198f4829b4c835dd1b7443b77273", "text": "I expect the following code to be rejected by the compiler but it is actually accepted and compiles successfully: The associated constant does not have any generic parameters / associated items (constants cannot have those anyways in the current version of Rust) and thus the argument list should be flagged as erroneous. Interestingly, if you remove the , the compiler correctly identifies this as an error: . I think is to be interpreted as a nested equality constraint (and not as a \u201cdefaulted\u201d parameter, i.e. a parameter with a default value). : label T-compiler requires-nightly (it now does) Hence, I am just going to mention its tracking issue: . CC $DIR/bad-type-in-vec-push.rs:11:17 | LL | vector.sort(); | ------ here the type of `vector` is inferred to be `Vec<_>` LL | result.push(vector); | ---- ^^^^^^ expected integer, found struct `Vec` | | | arguments to this method are incorrect | = note: expected type `{integer}` found struct `Vec<_>` note: associated function defined here --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL error[E0308]: mismatched types --> $DIR/bad-type-in-vec-push.rs:18:12 | LL | x.push(\"\"); | ---- ^^ expected integer, found `&str` | | | arguments to this method are incorrect | note: associated function defined here --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0308`. ", "positive_passages": [{"docid": "doc-en-rust-e14b33a3b2605301059f85b9149806a16211f7d17607c31c926a01cea980827c", "text": "I tried this code on nightly: I expected to see this happen: compiler does not panic. Instead, this happened: compiler panics and suggests I open a bug report. I initially posted to , but says this is a different issue, despite panicking on the same line in . (Though I'm realizing now that might be the proximal cause but not very related to the root cause.) : ) { // This gets called by `promote-release` // (https://github.com/rust-lang/rust-central-station/tree/master/promote-release). let mut cmd = builder.tool_cmd(Tool::BuildManifest); if builder.config.dry_run { return;", "positive_passages": [{"docid": "doc-en-rust-0096f2a625f337b8a36c79fcb98e4288dc1989cf6d778df9ad1090bdbd118670", "text": "Seems like no nightly was released today. That might be related to Unfortunately I don't think I have access to the logs. Cc\nLogs are missing on the server, let me start a manual release...\nWell that is odd. You wouldn't know what commit is is using? ( file in the tarball, if I recall correctly.)\nIs there a way for me to download the \"dist\" artifacts for better testing? Right now I am manually grabbing a bunch of files from https://s3-us-west- (and we only get dir listing for alt builds there it seems so I am using those). That's not very convenient at all.\nApparently not all commits are pushed to toolstate ( vs ), for example the latest one () is missing in toolstate .\nReverting the cause in the meantime --\nAlternatively we could land which will just skip of the toolstate is not found. That installs a toolchain based on these artifacts, but I don't think it gives me access to the tarballs. FTR, for now I did So we are only committing when the toolstate changed? Ouch. That kills my entire approach :(\nIt should print the URLs it's downloading though, and you can use to avoid it actually downloading stuff.", "commid": "rust_issue_64540", "tokennum": 273}], "negative_passages": []}
{"query_id": "q-en-rust-187831d0df53994235b5dda27398760a1c1b64a1bb1e8d6bd450fc1986b5ab69", "query": "impl ErrorIndex { pub fn command(builder: &Builder<'_>) -> Command { // This uses stage-1 to match the behavior of building rustdoc. // Error-index-generator links with the rustdoc library, so we want to // use the same librustdoc to avoid building rustdoc twice (and to // avoid building the compiler an extra time). This uses // saturating_sub to deal with building with stage 0. (Using stage 0 // isn't recommended, since it will fail if any new error index tests // use new syntax, but it should work otherwise.) let compiler = builder.compiler(builder.top_stage.saturating_sub(1), builder.config.build); // Error-index-generator links with the rustdoc library, so we need to add `rustc_lib_paths` // for rustc_private and libLLVM.so, and `sysroot_lib` for libstd, etc. let host = builder.config.build; let compiler = builder.compiler_for(builder.top_stage, host, host); let mut cmd = Command::new(builder.ensure(ErrorIndex { compiler })); add_dylib_path( vec![ PathBuf::from(&builder.sysroot_libdir(compiler, compiler.host)), builder.rustc_libdir(compiler), ], &mut cmd, ); let mut dylib_paths = builder.rustc_lib_paths(compiler); dylib_paths.push(PathBuf::from(&builder.sysroot_libdir(compiler, compiler.host))); add_dylib_path(dylib_paths, &mut cmd); cmd } }", "positive_passages": [{"docid": "doc-en-rust-b60e846454a58f796c0b93ffa409dff3d7eacf4762b2c3ae5cd8daa901078018", "text": "Steps: Checkout commit Have in . In particular, this implies Run Output (on the second run):\ncc\nFor what it\u2019s worth is just what I happened to get after running today. I mentioned it in case something changes later, it\u2019s a coincidence that that commit happens to be related to downloading LLVM from Rust CI.\nI think this is a duplicate of\nThat issue is closed, and its final comment points to this issue.\nI just hit this on the following sequence. Do a fresh clone of Run Select option (b) \"compiler: Contribute to the compiler itself\" Run The build finished like so:\nIMO the proper fix for this is to remove error-index's dependency on rustdoc, either by moving the relevant code out into a library that doesn't use rustc_private, or by duplicating the code altogether. There are other ways to solve this but they'll be more complicated and take longer to compile for no real benefit.\nby making it invoke rustdoc-the-binary (through ), rather than using rustdoc-the-library.\nyou should be able to work around this by adding --stage 2 I think.\nThanks, that worked\nI think you're right that the binary will be easier - parsing the markdown requires parsing doctests so that it can generate the \"Run\" button, and parsing doctests requires all of .", "commid": "rust_issue_80096", "tokennum": 298}], "negative_passages": []}
{"query_id": "q-en-rust-1879d9353e28d89365ff22524b348e7686623c83dfa09b40943d1dc074622cb2", "query": " #![feature(doc_alias)] #![feature(trait_alias)] pub struct Foo; pub trait Bar { const BAZ: u8; } impl Bar for Foo { #[doc(alias = \"CONST_BAZ\")] //~ ERROR const BAZ: u8 = 0; } impl Foo { #[doc(alias = \"CONST_FOO\")] // ok! pub const FOO: u8 = 0; pub fn bar() -> u8 { Self::FOO } } ", "positive_passages": [{"docid": "doc-en-rust-08f7c2c98e1da082202212ce8fb8908d608f929f37cdaf0c9f6dfe78586f2938", "text": "Now that has been merged, only a few checks remain to be in order to stabilize this feature. First, we need to actually perform those checks in the compiler directly instead of rustdoc. You mentioned other checks too ? This issue is part of .\nWe should reject on items that don't actually appear in the search index such as blocks and s.\nOk, makes sense! Last question: I remember you telling that you'd prefer this check in rustc directly instead of rustdoc. I can move things there, just wanted to check one last time before doing it.\nYeah, rustc validates some attributes in and it might make sense to validate the attribute there as well.\nSince has been merged, we can close this issue.\nWe're still not rejecting on associated s in trait impls like:\nOk! Putting on hold then!", "commid": "rust_issue_73721", "tokennum": 174}], "negative_passages": []}
{"query_id": "q-en-rust-1899d88e199059e4dfc1c5a74ecc48ec62edff95212be03291def0c29a041a26", "query": "fn test1() { let a: i32 = \"foo\"; //~^ ERROR: mismatched types let b: i32 = \"f'oo\"; //~^ ERROR: mismatched types } fn test2() {", "positive_passages": [{"docid": "doc-en-rust-569cb2e7913ae4d7d2667aa7a4839c8ede03b64a9d1b7c6f885f9d13861ada2c", "text": "This is minimized from the dramatic forum thread . The following code is fine in nightly-2018-04-12 but breaks with nightly-2018-04-15. Oddly, lots of minor perturbations make it succeed. For example remove the two characters and it works. Or remove the single quote in the string and it works.\nAlrighty-roo. As everything these days with hygiene, there's a couple of bugs here. With this one though I think only two! Everything has to do here with basically. AKA anything that runs through that falls off The usual reasons we think you fall off the \"happy path\" are due to things like inner attributes, , macro expansion, etc. None of that's present here! It should be the case that above can be losslessly converted to a based on what we've cached. Turns out though had a bug in it (surprise surprise!). There we're using to compare the resulting two token streams which eventually bottoms out in . As it turns out this isn't quite what we want! The implementation is structural, but the token stream we get when stringifying is slightly different than what we parsed. Here in the example you're using the literal string , but rustc stringifies this token as . Similarly if you replaced the string with something like it'll be stringified as . This means that the tokens are not literally byte-for-byte equal, which means we fall off the happy path! tl;dr the token stream of is not equivalent to the token stream . This causes us to fall off the happy path and used a stringified token stream. OK so in the case above we're falling off the happy path when we didn't expect to, but even still there's some weird bad hygiene behavior when we're not on the happy path. There's still something to fix! It turns out that there's also a regression due to (found via bisection). Before that PR this example would compile just fine, afterwards though it's hitting this error. can you help diagnose this and see what's going on? The reduced test case I have right now is: (note the inner attribute on to force using a non-cached token stream)\nI've posted a fix for the \"happy path\" at will actually fix example above.", "commid": "rust_issue_50061", "tokennum": 489}], "negative_passages": []}
{"query_id": "q-en-rust-1899d88e199059e4dfc1c5a74ecc48ec62edff95212be03291def0c29a041a26", "query": "fn test1() { let a: i32 = \"foo\"; //~^ ERROR: mismatched types let b: i32 = \"f'oo\"; //~^ ERROR: mismatched types } fn test2() {", "positive_passages": [{"docid": "doc-en-rust-165bd9195f81a7145c7d1069debc8b20d6870a1d2e30a67a3d6beaa9287350c1", "text": "That PR does not, however, fix the regression from which is still reproducible with the example I gisted.\nAny idea why my repro case above is fixed if you remove the tokens? It seems like should fall off the happy path just as much.\nIf you remove the tokens we're still on the stringification path (aka not the happy path). For whatever reason though the hygiene bug goes away. That's likely caused from a subtelty introduced in (or at least so I'm hoping). I don't know much about , so I'm hoping will be able to look at this and know what's going on!\nI don't know much about , so I'm hoping will be able to look at this and know what's going on! I'll investigate.\nis the commit causing the regression. Further investigation is in progress.\nAn issue recently popped up on Rocket () that appears to be identical to this one and is not resolved in any recent nightly. It's possible that the root cause is , however.", "commid": "rust_issue_50061", "tokennum": 222}], "negative_passages": []}
{"query_id": "q-en-rust-18cb5ae81a91e786478b316ef08cf11f396ccc8cd86051a698f861c24e622132", "query": "fn after_krate(&mut self) -> Result<(), Error> { debug!(\"Done with crate\"); debug!(\"Adding Primitive impls\"); for primitive in Rc::clone(&self.cache).primitive_locations.values() { self.get_impls(*primitive); } let e = ExternalCrate { crate_num: LOCAL_CRATE }; let index = (*self.index).clone().into_inner(); debug!(\"Constructing Output\");", "positive_passages": [{"docid": "doc-en-rust-4f4ec5fc69039eacbca3494799c58df541f483b7be27c0766ebfd47c910b0250", "text": "Generated rustdoc JSON for every one of dozens of crates I've looked at seems to contain unexpected inlined items that look like an block and its contents. I expected to see this happen: rustdoc JSON file contains only the items defined or re-exported by the corresponding crate. Instead, this happened: the rustdoc JSON file contains items like this: In this example, is and here are the names of the items contained in that impl (also part of the rustdoc JSON): Similarly, you can find items from : Invocation for generating rustdoc JSON: : You can find a variety of pre-generated rustdoc JSON files with this issue here: Briefly discussed in Zulip: https://rust- I'll have to work around this behavior to shield , which uses the same codebase as the playground link above. I can hold off on updating the playground for, say, another week, but at some point I'll need to upgrade it to include my workaround which means those items will cease being shown. label +T-rustdoc +A-rustdoc-json\nPossibly duplicate of\nMight be! Definitely at least some overlap, not entirely sure if duplicate. Do you mind if I ship the workaround for this in cargo-semver-checks and the playground, which will hide these items from our lints and from queries in the playground?\nYeah, it's easy enough to reproduce in raw json, I'm not worried about the repro breaking.", "commid": "rust_issue_114039", "tokennum": 323}], "negative_passages": []}
{"query_id": "q-en-rust-18cdf94a4b4635600ae292d0b6e413874ee5be12bde942e92fec9fcf2050c6c6", "query": " // Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. //! Scoped thread-local storage //! //! This module provides the ability to generate *scoped* thread-local //! variables. In this sense, scoped indicates that thread local storage //! actually stores a reference to a value, and this reference is only placed //! in storage for a scoped amount of time. //! //! There are no restrictions on what types can be placed into a scoped //! variable, but all scoped variables are initialized to the equivalent of //! null. Scoped thread local storage is useful when a value is present for a known //! period of time and it is not required to relinquish ownership of the //! contents. //! //! # Examples //! //! ``` //! # #![feature(scoped_tls)] //! scoped_thread_local!(static FOO: u32); //! //! // Initially each scoped slot is empty. //! assert!(!FOO.is_set()); //! //! // When inserting a value, the value is only in place for the duration //! // of the closure specified. //! FOO.set(&1, || { //! FOO.with(|slot| { //! assert_eq!(*slot, 1); //! }); //! }); //! ``` #![unstable(feature = \"thread_local_internals\")] use prelude::v1::*; // macro hygiene sure would be nice, wouldn't it? #[doc(hidden)] pub mod __impl { pub use super::imp::KeyInner; pub use sys_common::thread_local::INIT as OS_INIT; } /// Type representing a thread local storage key corresponding to a reference /// to the type parameter `T`. /// /// Keys are statically allocated and can contain a reference to an instance of /// type `T` scoped to a particular lifetime. Keys provides two methods, `set` /// and `with`, both of which currently use closures to control the scope of /// their contents. #[unstable(feature = \"scoped_tls\", reason = \"scoped TLS has yet to have wide enough use to fully consider stabilizing its interface\")] pub struct ScopedKey { #[doc(hidden)] pub inner: __impl::KeyInner } /// Declare a new scoped thread local storage key. /// /// This macro declares a `static` item on which methods are used to get and /// set the value stored within. #[macro_export] #[allow_internal_unstable] macro_rules! scoped_thread_local { (static $name:ident: $t:ty) => ( __scoped_thread_local_inner!(static $name: $t); ); (pub static $name:ident: $t:ty) => ( __scoped_thread_local_inner!(pub static $name: $t); ); } #[macro_export] #[doc(hidden)] #[allow_internal_unstable] macro_rules! __scoped_thread_local_inner { (static $name:ident: $t:ty) => ( #[cfg_attr(not(any(windows, target_os = \"android\", target_os = \"ios\", target_os = \"openbsd\", target_arch = \"aarch64\")), thread_local)] static $name: ::std::thread::ScopedKey<$t> = __scoped_thread_local_inner!($t); ); (pub static $name:ident: $t:ty) => ( #[cfg_attr(not(any(windows, target_os = \"android\", target_os = \"ios\", target_os = \"openbsd\", target_arch = \"aarch64\")), thread_local)] pub static $name: ::std::thread::ScopedKey<$t> = __scoped_thread_local_inner!($t); ); ($t:ty) => ({ use std::thread::ScopedKey as __Key; #[cfg(not(any(windows, target_os = \"android\", target_os = \"ios\", target_os = \"openbsd\", target_arch = \"aarch64\")))] const _INIT: __Key<$t> = __Key { inner: ::std::thread::__scoped::KeyInner { inner: ::std::cell::UnsafeCell { value: 0 as *mut _ }, } }; #[cfg(any(windows, target_os = \"android\", target_os = \"ios\", target_os = \"openbsd\", target_arch = \"aarch64\"))] const _INIT: __Key<$t> = __Key { inner: ::std::thread::__scoped::KeyInner { inner: ::std::thread::__scoped::OS_INIT, marker: ::std::marker::PhantomData::<::std::cell::Cell<$t>>, } }; _INIT }) } #[unstable(feature = \"scoped_tls\", reason = \"scoped TLS has yet to have wide enough use to fully consider stabilizing its interface\")] impl ScopedKey { /// Insert a value into this scoped thread local storage slot for a /// duration of a closure. /// /// While `cb` is running, the value `t` will be returned by `get` unless /// this function is called recursively inside of `cb`. /// /// Upon return, this function will restore the previous value, if any /// was available. /// /// # Examples /// /// ``` /// # #![feature(scoped_tls)] /// scoped_thread_local!(static FOO: u32); /// /// FOO.set(&100, || { /// let val = FOO.with(|v| *v); /// assert_eq!(val, 100); /// /// // set can be called recursively /// FOO.set(&101, || { /// // ... /// }); /// /// // Recursive calls restore the previous value. /// let val = FOO.with(|v| *v); /// assert_eq!(val, 100); /// }); /// ``` pub fn set(&'static self, t: &T, cb: F) -> R where F: FnOnce() -> R, { struct Reset<'a, T: 'a> { key: &'a __impl::KeyInner, val: *mut T, } #[unsafe_destructor] impl<'a, T> Drop for Reset<'a, T> { fn drop(&mut self) { unsafe { self.key.set(self.val) } } } let prev = unsafe { let prev = self.inner.get(); self.inner.set(t as *const T as *mut T); prev }; let _reset = Reset { key: &self.inner, val: prev }; cb() } /// Get a value out of this scoped variable. /// /// This function takes a closure which receives the value of this /// variable. /// /// # Panics /// /// This function will panic if `set` has not previously been called. /// /// # Examples /// /// ```no_run /// # #![feature(scoped_tls)] /// scoped_thread_local!(static FOO: u32); /// /// FOO.with(|slot| { /// // work with `slot` /// }); /// ``` pub fn with(&'static self, cb: F) -> R where F: FnOnce(&T) -> R { unsafe { let ptr = self.inner.get(); assert!(!ptr.is_null(), \"cannot access a scoped thread local variable without calling `set` first\"); cb(&*ptr) } } /// Test whether this TLS key has been `set` for the current thread. pub fn is_set(&'static self) -> bool { unsafe { !self.inner.get().is_null() } } } #[cfg(not(any(windows, target_os = \"android\", target_os = \"ios\", target_os = \"openbsd\", target_arch = \"aarch64\")))] mod imp { use std::cell::UnsafeCell; #[doc(hidden)] pub struct KeyInner { pub inner: UnsafeCell<*mut T> } unsafe impl ::marker::Sync for KeyInner { } #[doc(hidden)] impl KeyInner { #[doc(hidden)] pub unsafe fn set(&self, ptr: *mut T) { *self.inner.get() = ptr; } #[doc(hidden)] pub unsafe fn get(&self) -> *mut T { *self.inner.get() } } } #[cfg(any(windows, target_os = \"android\", target_os = \"ios\", target_os = \"openbsd\", target_arch = \"aarch64\"))] mod imp { use marker; use std::cell::Cell; use sys_common::thread_local::StaticKey as OsStaticKey; #[doc(hidden)] pub struct KeyInner { pub inner: OsStaticKey, pub marker: marker::PhantomData>, } unsafe impl ::marker::Sync for KeyInner { } #[doc(hidden)] impl KeyInner { #[doc(hidden)] pub unsafe fn set(&self, ptr: *mut T) { self.inner.set(ptr as *mut _) } #[doc(hidden)] pub unsafe fn get(&self) -> *mut T { self.inner.get() as *mut _ } } } #[cfg(test)] mod tests { use cell::Cell; use prelude::v1::*; scoped_thread_local!(static FOO: u32); #[test] fn smoke() { scoped_thread_local!(static BAR: u32); assert!(!BAR.is_set()); BAR.set(&1, || { assert!(BAR.is_set()); BAR.with(|slot| { assert_eq!(*slot, 1); }); }); assert!(!BAR.is_set()); } #[test] fn cell_allowed() { scoped_thread_local!(static BAR: Cell); BAR.set(&Cell::new(1), || { BAR.with(|slot| { assert_eq!(slot.get(), 1); }); }); } #[test] fn scope_item_allowed() { assert!(!FOO.is_set()); FOO.set(&1, || { assert!(FOO.is_set()); FOO.with(|slot| { assert_eq!(*slot, 1); }); }); assert!(!FOO.is_set()); } } ", "positive_passages": [{"docid": "doc-en-rust-c46e2a2e48db1f369f82675933e751d6439f50ec44391ed1e531c46ad88402ce", "text": "I have no idea what's causing this, but on the current nightly, this fails: with \"use of unstable library feature 'threadlocalinternals'.\" Enabling the feature works, but this should be a stable function. Interestingly, tweaking the works: I wonder if it's because there is a (private) sub-module called which has a module-wide marker. Version info:\nThis change was introduced just recently: I reproduced the problem without using anything thread-related: Commands: Output: If I remove the attribute from the module, the code gives me the error. I mark as stable, then the code compiles. If I instead remove the function, I get the bar error. cc\nWith merged, is this fixed?\nThe exact issue at hand has been resolved, but the underlying issue remains. Specifically a module and free-function of the same name but different stability level will cause problems.\nAlso hit by this; still affecting the nightly for osx right now, but hopefully the next build will include the fix.\nStability is an internal detail. This is unlikely to impact out-of-tree code.", "commid": "rust_issue_24334", "tokennum": 234}], "negative_passages": []}
{"query_id": "q-en-rust-19132f39ad0b17482a29a93b782085ce185ed2f81ffd344a3c0e0b52d7c4638a", "query": " use core::fmt; use core::iter::FusedIterator; use core::marker::PhantomData; use core::mem::{self, MaybeUninit}; use core::ptr::{self, NonNull}; use core::{fmt, mem}; use crate::alloc::{Allocator, Global}; use super::{count, Iter, VecDeque}; use super::{count, wrap_index, VecDeque}; /// A draining iterator over the elements of a `VecDeque`. ///", "positive_passages": [{"docid": "doc-en-rust-9803b273c49e3ff20d7dade93eee9e913729e091316d49009f773f28818d7a80", "text": "liballoc's fails when run in Miri. The error occurs in the call: is called with a as argument. contains contains a shared reference to a slice; that slice is thus marked as \"must not be mutated for the entire duration of this function call\". calls calls calls calls , which eventually drops the . calls to re-arrange stuff (I have not fully understood this yet), and in some cases this will end up writing to memory that the slice in points to. I am not sure what the best way to fix this is. We have to fix holding (indirectly) a shared reference to something that it'll mutate during its . The mutation is likely there for a reason, so I guess the shared reference has to go. (FWIW, this shared reference already caused other trouble, but that was fixed by ) Cc $DIR/dont-drop-upcast-candidate.rs:10:1 | LL | impl Bar for T where dyn Foo: Unsize {} | ------------------------------------------------ first implementation here LL | impl Bar for () {} | ^^^^^^^^^^^^^^^ conflicting implementation for `()` error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0119`. ", "positive_passages": [{"docid": "doc-en-rust-a513e6977dca308333de450358ef9d6dce197fa65965fa39bccfe3e4f51073ce", "text": " $DIR/typeck_type_placeholder_item.rs:197:26 | LL | type F: std::ops::Fn(_); | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:40:24 | LL | fn test9(&self) -> _ { () }", "positive_passages": [{"docid": "doc-en-rust-ec5ec337fdebda62ea6f5accc58590e1fbf1820463e97831c3b7b842a50e3a3f", "text": "First time filing a bug report, apologies if i missed anything or if this is a duplicate. Encountered this bug while writing some non-sensical associated function types. Searched around for any similar issues and the closest i found was , seems closely related? Minimal example: Playground link: The ICE happens on all channels it seems\nYes, I think so too. The snippet is rejected as expected on 1.42 but ICE occurs instead since 1.43.\nAssigning as and removing .", "commid": "rust_issue_74612", "tokennum": 99}], "negative_passages": []}
{"query_id": "q-en-rust-1b692043bf57b8b75df39c7ea704bb4fcac55fbed2e668cfb50f94cc68e3014f", "query": " // aux-build:impl-const.rs // run-pass #![feature(const_generics)] #![allow(incomplete_features)] extern crate impl_const; use impl_const::*; pub fn main() { let n = Num::<5>; n.five(); } ", "positive_passages": [{"docid": "doc-en-rust-960d2586d11b988aa483482a4e7aa423148003a702f6e7438777e8b598638b1a", "text": "Currently with const generics you can create a \"specialized\" implementation, such as: Which has the following output: (playground link: ) However, when using such a type in another crate this causes a stack overflow in the compiler. For example, with the following code (full example: ): I would expect it to produce the same output as the playground link above, however it produces the following:\nA bisect shows this stopped crashing after , marked as needing a test\nI was still encountering this in my code with and after trying to minimize it seems that the original example is fixed but the stack overflow still occurs when the const expression in the has braces around it. After experimenting I found some more examples of what works and what doesn't: (see to try it) compiles and runs successfully while and (or ) crash the compiler with the same error as the original: :", "commid": "rust_issue_68104", "tokennum": 185}], "negative_passages": []}
{"query_id": "q-en-rust-1b9de160c954b28d122a0d937c3ecb1c21f6afb14b0cb9ba4bc99a60e58d8931", "query": "/// } /// ``` #[stable(feature = \"io_error_inner\", since = \"1.3.0\")] #[inline] pub fn into_inner(self) -> Option> { match self.repr { Repr::Os(..) => None,", "positive_passages": [{"docid": "doc-en-rust-3d274eb64f118874f0c31aafa1ca0fa3936b8f8d6bc908a146a800355c4fdbeb", "text": "I am facing a problem while reading different kinds of binary formats. If you are going to read primitives like too often, then performance degrades. This is mainly due to the fact that returns box. Also it does boxing TWICE! doc link: I wrote simple bench to show pref problem. Use to get it We can clearly see that performance is degrading. The more calls it takes to read, the worse the results will be. The first very popular crate that comes to mind is . It mainly depends on the data format. But what if you need to receive data over the network? The attacker may abuse wrong data to make ton of pointless memory allocations. stdlib is also use often enough. Let's run a simple bash to make sure of this In many cases, you will see that it is used . stdlib sometimes create with macro, however it doesn't happen very often. Consider adding a new static method such as and new internal member of that's enum. How about using something like , but with static lifetime? : Update 07.03.2021: Benchmarks have been improved as per the comment. This should show the problem better.\nThe \"std_err\" bench is still pretty slow though\nYes, I probably made a mistake while copying the code for the benchmark of . It should be . However, this shows that not zero-cost.\nThis is fixed by\nTurns out it was three times, if you also count the that the is copied into.\nRunning your benchmark (thanks!): Before: After: Looks like it isn't completely solved yet. Adding to now... :)\nThat fixed it.", "commid": "rust_issue_82812", "tokennum": 344}], "negative_passages": []}
{"query_id": "q-en-rust-1bc6d485bcab4deadb19de23dd6f11a5c83c4318e84ec74712df47e324969d38", "query": " // Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. fn main() { if true { proc(_) {} } else { proc(_: &mut ()) {} }; } ", "positive_passages": [{"docid": "doc-en-rust-c83959d18d520c5546820268205c0afa588f89ed296fa17aea98ee80146f1eaf", "text": "Here is the error Here is the code that generates the error My system is x86_64 archlinux. The rust compiler version is Let me know if you guys need anything else. (The code is really short so it shouldn't be hard to just type it in to duplicate the bug)\nIt only needs one line for me\nWorkaround (in the sense that the compiler no longer ICE's): I think there is some unfortunate interaction here with the way we attempt to infer which kind of numeric literals are in the array (, , etc) and other code not being prepared to handle the that results when you don't have that information available.\nThis is almost certainly a duplicate of (but maybe the integer inference codepath is slightly different?).\nThis also causes the same ICE -\nSimilarly:\nLooks like it's been fixed.", "commid": "rust_issue_15730", "tokennum": 175}], "negative_passages": []}
{"query_id": "q-en-rust-1bc6d485bcab4deadb19de23dd6f11a5c83c4318e84ec74712df47e324969d38", "query": " // Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. fn main() { if true { proc(_) {} } else { proc(_: &mut ()) {} }; } ", "positive_passages": [{"docid": "doc-en-rust-a575b50f6576a49cb11d93e43c8560c9bbead14f2503d9c21253ba31f7777073", "text": "Swapping the order of the branches compiles fine. cc\nJust checked: this fails with a normal closure too, not just a proc.\nCompiles fine now but potentially needs a test.", "commid": "rust_issue_14039", "tokennum": 41}], "negative_passages": []}
{"query_id": "q-en-rust-1bc6d485bcab4deadb19de23dd6f11a5c83c4318e84ec74712df47e324969d38", "query": " // Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. fn main() { if true { proc(_) {} } else { proc(_: &mut ()) {} }; } ", "positive_passages": [{"docid": "doc-en-rust-e53419d7a8f733f8416dba054313c602b1d913c75a45bd7e1e649cc2a004ddc4", "text": "Versions: Code to reproduce the ICE: Compilation output:\nSeems to be fine now but potentially needs a test.\nNope, still failing. An updated example:\nThat code example fails to compile, but it's because the function signature for is wrong. It should be: When you make that change and make the struct fields public, the code compiles fine. Without the change I also didn't see any internal compiler errors. Rust Version: 0.12.0-pre-nightly, , Linux x8664\nYeah, I think this can be closed.\nFlagging as needstest (not sure if one is checked in already)", "commid": "rust_issue_13624", "tokennum": 132}], "negative_passages": []}
{"query_id": "q-en-rust-1bc6d485bcab4deadb19de23dd6f11a5c83c4318e84ec74712df47e324969d38", "query": " // Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. fn main() { if true { proc(_) {} } else { proc(_: &mut ()) {} }; } ", "positive_passages": [{"docid": "doc-en-rust-575d42a88d66b5a122a05bfbcfe4231e6f04811dcc41c853c56ab1168ad60fec", "text": "It gives\ncc\nLooks like it no longer causes an ICE.\nI agree, it is fixed, I close it.", "commid": "rust_issue_13202", "tokennum": 23}], "negative_passages": []}
{"query_id": "q-en-rust-1c02cfa45a99df2ede8c126f14f38d21a27eac2420d63367f5ccf09e1196fb83", "query": "let bin_root = self.out.join(host.triple).join(\"rustfmt\"); let rustfmt_path = bin_root.join(\"bin\").join(exe(\"rustfmt\", host)); let rustfmt_stamp = bin_root.join(\".rustfmt-stamp\"); let legacy_rustfmt = self.initial_rustc.with_file_name(exe(\"rustfmt\", host)); if !legacy_rustfmt.exists() { t!(self.symlink_file(&rustfmt_path, &legacy_rustfmt)); } if rustfmt_path.exists() && !program_out_of_date(&rustfmt_stamp, &channel) { return Some(rustfmt_path); }", "positive_passages": [{"docid": "doc-en-rust-88a4065972b63f545a86177d37581ba6cb916f5e9f708be097e6d3b58f7b7b71", "text": "broke the rust-analyzer config we suggest in the dev-guide: https://rustc-dev- since now rustfmt is in instead of . Originally posted by in $DIR/seggest_print_over_printf.rs:6:5 | LL | printf(\"%d\", x); | ^^^^^^ not found in this scope | help: you may have meant to use the `print` macro | LL | print!(\"%d\", x); | ~~~~~~ error: aborting due to previous error For more information about this error, try `rustc --explain E0425`. ", "positive_passages": [{"docid": "doc-en-rust-94309f6cc9d5d0fef179b4807cf091964caf1f9a518ddf9d41adc91b9a81bd19", "text": "We already translate from C-style formatting strings to Rust formatting strings when passed to the family of macros. We should also detect invalid calls from other languages that were meant to be macro calls: currently emits the dry while it could be $DIR/issue-57404.rs:6:41 | LL | handlers.unwrap().as_mut().call_mut(&mut ()); | -------- -^^^^^^ | | | | | the trait `Tuple` is not implemented for `&mut ()` | | help: consider removing the leading `&`-reference | required by a bound introduced by this call | note: required by a bound in `call_mut` --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. ", "positive_passages": [{"docid": "doc-en-rust-6bf7f645516d09c6ec566261a4af196a18a7158622afae61e1d9086d6eb79f9e", "text": "Reduced example\ne\nThe first compilation error -- the example with looks fine to me. Types used for static variables must outlive the lifetime. The compiler can prove that outlives only if . Hence lifetimes are inferred in lieu of the anonymous lifetimes. Since your variable does not live for the whole lifetime, it cannot be used as you are trying to. Maybe the actual bug is that should desugar to , as it would be for ? It may be weird to special-case only the traits though -- i.e. if you define your own trait , then just means for some lifetime to be inferred by the compiler, it does not mean . Your reduced example is actually different since it actually does not involve static data. It seems to be the same bug as in , and hence is a bug with the feature. Going from to (note the tuple of size ) makes the ICE go away.\nFixed by", "commid": "rust_issue_57404", "tokennum": 192}], "negative_passages": []}
{"query_id": "q-en-rust-1d998adc3448d96d2171fc5eed79a03c6ed0210d492e3607800844217278bcf4", "query": "impl Step for RustcDocs { type Output = Option; const DEFAULT: bool = true; const ONLY_HOSTS: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { let builder = run.builder;", "positive_passages": [{"docid": "doc-en-rust-10f0aa987e5786e750c00245833765a24034c9e7dbd3e180b8a33820d2e714e1", "text": "With and the following file: the command fails while installing docs because it can't find the target's directory. This makes sense because the directory is created in one of two places: and both of these are only invoked for the host (in the enclosing impls of each of those call sites, is set to true). So the problem is that the step, which relies on the existence of the directory (see ), is run for the target ( ), but the steps that would create that directory have only been run for the host. I was able to fix this by adding inside the ( ), so that rustc docs aren't generated for the target. I'm not sure if that's the right solution, and in general I'm unsure about the logic for which pieces of documentation are generated for the host and which ones for the target under cross-compilation. The end of the output, showing that fails due to reading a nonexistent directory, is:\nn.b. I'm not sure I actually was using correctly -- my goal is to cross-compile snapshots that I can use for bootstrapping Rust on a riscv64 system, and based on the output, I think I probably should have used: instead. But this still shouldn't happen.\nI think this will be fixed by\nIn general RustcDocs is pretty broken, see\nmerged but this is still unfortunately still an issue :( reproduced with did you ever find a quick workaround?", "commid": "rust_issue_110071", "tokennum": 314}], "negative_passages": []}
{"query_id": "q-en-rust-1d99fb1300f77ef10a84d2f924b6c92597e0852b22f045430b5e9b63a87bb795", "query": " error: mismatched closing delimiter: `]` --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:42 | LL | V = [PhantomData; { [ () ].len() ].len() as isize, | - - ^ mismatched closing delimiter | | | | | unclosed delimiter | closing delimiter possibly meant for this error: mismatched closing delimiter: `]` --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:36 | LL | V = [Vec::new; { [].len() ].len() as isize, | - - ^ mismatched closing delimiter | | | | | unclosed delimiter | closing delimiter possibly meant for this error: mismatched closing delimiter: `]` --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:36 | LL | V = [Vec::new; { [0].len() ].len() as isize, | - - ^ mismatched closing delimiter | | | | | unclosed delimiter | closing delimiter possibly meant for this error: mismatched closing delimiter: `]` --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:42 | LL | V = [PhantomData; { [ () ].len() ].len() as isize, | - - ^ mismatched closing delimiter | | | | | unclosed delimiter | closing delimiter possibly meant for this error: mismatched closing delimiter: `]` --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:36 | LL | V = [Vec::new; { [].len() ].len() as isize, | - - ^ mismatched closing delimiter | | | | | unclosed delimiter | closing delimiter possibly meant for this error: mismatched closing delimiter: `]` --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:36 | LL | V = [Vec::new; { [0].len() ].len() as isize, | - - ^ mismatched closing delimiter | | | | | unclosed delimiter | closing delimiter possibly meant for this error: mismatched closing delimiter: `]` --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:42 | LL | V = [PhantomData; { [ () ].len() ].len() as isize, | - - ^ mismatched closing delimiter | | | | | unclosed delimiter | closing delimiter possibly meant for this error: mismatched closing delimiter: `]` --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:36 | LL | V = [Vec::new; { [].len() ].len() as isize, | - - ^ mismatched closing delimiter | | | | | unclosed delimiter | closing delimiter possibly meant for this error: mismatched closing delimiter: `]` --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:36 | LL | V = [Vec::new; { [0].len() ].len() as isize, | - - ^ mismatched closing delimiter | | | | | unclosed delimiter | closing delimiter possibly meant for this error: mismatched closing delimiter: `]` --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:42 | LL | V = [PhantomData; { [ () ].len() ].len() as isize, | - - ^ mismatched closing delimiter | | | | | unclosed delimiter | closing delimiter possibly meant for this error: mismatched closing delimiter: `]` --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:36 | LL | V = [Vec::new; { [].len() ].len() as isize, | - - ^ mismatched closing delimiter | | | | | unclosed delimiter | closing delimiter possibly meant for this error: mismatched closing delimiter: `]` --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:36 | LL | V = [Vec::new; { [0].len() ].len() as isize, | - - ^ mismatched closing delimiter | | | | | unclosed delimiter | closing delimiter possibly meant for this error[E0282]: type annotations needed --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:29 | LL | V = [Vec::new; { [].len() ].len() as isize, | ^^^ cannot infer type for type parameter `T` error[E0282]: type annotations needed --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:14 | LL | V = [Vec::new; { [0].len() ].len() as isize, | ^^^^^^^^ cannot infer type for type parameter `T` error: aborting due to 14 previous errors For more information about this error, try `rustc --explain E0282`. ", "positive_passages": [{"docid": "doc-en-rust-f93c91d9866ef3a47065d5d1275709e29cedb005edb0674dec9a8b61f45edc93", "text": "The following ICE's on stable, beta and nightly: (notice the was NOT closed) euv::RefBinding(..) => { euv::RefBinding(..) | euv::MatchDiscriminant(..) => { format!(\"previous borrow of `{}` occurs here\", self.bccx.loan_path_to_string(&*old_loan.loan_path)) }", "positive_passages": [{"docid": "doc-en-rust-1a12006d024279fa8475b1aa755ca045b88e351de146fd634f30bc96d4b7f187", "text": "Sorry for not providing smaller case but I hope this is better than nothing: Both versions works (compile and start), but runtime behavior changes. The code that follows the above part: will match no matter what really is, if the value is partially moved (so mouse events are updating my game). If I use the version with , the code works as intended and game is updated only on keyboard presses.\nMinimal: This shouldn't compile at all.\nNominating.\nLooks like a regression. 0.10 rejects this code.", "commid": "rust_issue_17385", "tokennum": 111}], "negative_passages": []}
{"query_id": "q-en-rust-1db5248d1b2c0eddd506850c57ab4cf866769951e402eb7abe526cc8afc2c11c", "query": " error[E0499]: cannot borrow `chars` as mutable more than once at a time --> $DIR/issue-102972.rs:4:9 | LL | for _c in chars.by_ref() { | -------------- | | | first mutable borrow occurs here | first borrow later used here LL | chars.next(); | ^^^^^^^^^^^^ second mutable borrow occurs here | = note: a for loop advances the iterator for you, the result is stored in `_c`. = help: if you want to call `next` on a iterator within the loop, consider using `while let`. error[E0382]: borrow of moved value: `iter` --> $DIR/issue-102972.rs:12:9 | LL | let mut iter = v.iter(); | -------- move occurs because `iter` has type `std::slice::Iter<'_, i32>`, which does not implement the `Copy` trait LL | for _i in iter { | ---- `iter` moved due to this implicit call to `.into_iter()` LL | iter.next(); | ^^^^^^^^^^^ value borrowed here after move | = note: a for loop advances the iterator for you, the result is stored in `_i`. = help: if you want to call `next` on a iterator within the loop, consider using `while let`. note: `into_iter` takes ownership of the receiver `self`, which moves `iter` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL error: aborting due to 2 previous errors Some errors have detailed explanations: E0382, E0499. For more information about an error, try `rustc --explain E0382`. ", "positive_passages": [{"docid": "doc-en-rust-faa7b127efdfcd7a977a481c780c5217512eb271e499d4de9c03d90a0f57739d", "text": " $DIR/issue-102972.rs:4:9 | LL | for _c in chars.by_ref() { | -------------- | | | first mutable borrow occurs here | first borrow later used here LL | chars.next(); | ^^^^^^^^^^^^ second mutable borrow occurs here | = note: a for loop advances the iterator for you, the result is stored in `_c`. = help: if you want to call `next` on a iterator within the loop, consider using `while let`. error[E0382]: borrow of moved value: `iter` --> $DIR/issue-102972.rs:12:9 | LL | let mut iter = v.iter(); | -------- move occurs because `iter` has type `std::slice::Iter<'_, i32>`, which does not implement the `Copy` trait LL | for _i in iter { | ---- `iter` moved due to this implicit call to `.into_iter()` LL | iter.next(); | ^^^^^^^^^^^ value borrowed here after move | = note: a for loop advances the iterator for you, the result is stored in `_i`. = help: if you want to call `next` on a iterator within the loop, consider using `while let`. note: `into_iter` takes ownership of the receiver `self`, which moves `iter` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL error: aborting due to 2 previous errors Some errors have detailed explanations: E0382, E0499. For more information about an error, try `rustc --explain E0382`. ", "positive_passages": [{"docid": "doc-en-rust-588cfabf2a850f65b9fd9da1422a6fa333793ecfacdab72ba5abf2da5f8cbdcc", "text": "In this case, turns out there's only one: And there we see that there is already some conditional suggestion being made; it calls . And it seems there's a family of those . So I think it would make sense to try to write your own or something like that. You'll need to figure out how to sort of \"back track\" from the MIR back to the HIR or the AST so you can figure out whether you're inside a loop. I would study the code in to try to figure out how to do that. And don't forget to write a handful of regression tests in somewhere, maybe in : https://rustc-dev- It might also be possible to perform this check at a higher level, say, in . If you can figure out that you're in a for loop, and that the user is trying to call on the iterator, then you could raise the error then.", "commid": "rust_issue_102972", "tokennum": 195}], "negative_passages": []}
{"query_id": "q-en-rust-1e19b26604193a5af0c9d04320e06294b061e4f7d3e4a55dd919cd2fd0ae4f46", "query": "fn fmt(&self, f: &mut Formatter) -> Result { try!(write!(f, \"\"\")); for c in self.chars().flat_map(|c| c.escape_default()) { try!(write!(f, \"{}\", c)); try!(f.write_char(c)) } write!(f, \"\"\") }", "positive_passages": [{"docid": "doc-en-rust-67d0e148078ec5af95ba4d3814179a577bb94e2fdc477598ae4bd13f94a03083", "text": "Formatting a string containing special characters with usually prints them escaped i.e.. This snippet runs as expected in the . However on Windows, using both and , the is printed unescaped : From what I can gather, only concerns itself with faulty surrogates and completely ignores special characters.", "commid": "rust_issue_27211", "tokennum": 62}], "negative_passages": []}
{"query_id": "q-en-rust-1e1c8ffde5f297e643b3b2820bbf4758d443e6cbeda978b216926b73a488e148", "query": " //@ check-pass #![feature(inherent_associated_types)] //~^ WARN the feature `inherent_associated_types` is incomplete struct D { a: T } impl D { type Item = T; fn next() -> Self::Item { Self::Item::default() } } fn main() { } ", "positive_passages": [{"docid": "doc-en-rust-984bd2cc5e2a7acbf009902bd7c274f0ba42a4999bd245893cbf466bf1db45e4", "text": " $DIR/issue-103748-ICE-wrong-braces.rs:3:36 | LL | struct Apple((Apple, Option(Banana ? Citron))); | ^ `?` is only allowed on expressions, not types | help: if you meant to express that the type might not contain a value, use the `Option` wrapper type | LL | struct Apple((Apple, Option(Option Citron))); | +++++++ ~ error: expected one of `)` or `,`, found `Citron` --> $DIR/issue-103748-ICE-wrong-braces.rs:3:38 | LL | struct Apple((Apple, Option(Banana ? Citron))); | -^^^^^^ expected one of `)` or `,` | | | help: missing `,` error[E0412]: cannot find type `Citron` in this scope --> $DIR/issue-103748-ICE-wrong-braces.rs:3:38 | LL | struct Apple((Apple, Option(Banana ? Citron))); | ^^^^^^ not found in this scope error[E0214]: parenthesized type parameters may only be used with a `Fn` trait --> $DIR/issue-103748-ICE-wrong-braces.rs:3:22 | LL | struct Apple((Apple, Option(Banana ? Citron))); | ^^^^^^^^^^^^^^^^^^^^^^^ only `Fn` traits may use parentheses | help: use angle brackets instead | LL | struct Apple((Apple, Option)); | ~ ~ error[E0072]: recursive type `Apple` has infinite size --> $DIR/issue-103748-ICE-wrong-braces.rs:3:1 | LL | struct Apple((Apple, Option(Banana ? Citron))); | ^^^^^^^^^^^^ ----- recursive without indirection | help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle | LL | struct Apple((Box, Option(Banana ? Citron))); | ++++ + error: aborting due to 5 previous errors Some errors have detailed explanations: E0072, E0214, E0412. For more information about an error, try `rustc --explain E0072`. ", "positive_passages": [{"docid": "doc-en-rust-6027c5555d361568a7f957605a03efd7d40623eb8905f1712a0de8fff3f4e461", "text": " error: invalid `?` in type --> $DIR/issue-103748-ICE-wrong-braces.rs:3:36 | LL | struct Apple((Apple, Option(Banana ? Citron))); | ^ `?` is only allowed on expressions, not types | help: if you meant to express that the type might not contain a value, use the `Option` wrapper type | LL | struct Apple((Apple, Option(Option Citron))); | +++++++ ~ error: expected one of `)` or `,`, found `Citron` --> $DIR/issue-103748-ICE-wrong-braces.rs:3:38 | LL | struct Apple((Apple, Option(Banana ? Citron))); | -^^^^^^ expected one of `)` or `,` | | | help: missing `,` error[E0412]: cannot find type `Citron` in this scope --> $DIR/issue-103748-ICE-wrong-braces.rs:3:38 | LL | struct Apple((Apple, Option(Banana ? Citron))); | ^^^^^^ not found in this scope error[E0214]: parenthesized type parameters may only be used with a `Fn` trait --> $DIR/issue-103748-ICE-wrong-braces.rs:3:22 | LL | struct Apple((Apple, Option(Banana ? Citron))); | ^^^^^^^^^^^^^^^^^^^^^^^ only `Fn` traits may use parentheses | help: use angle brackets instead | LL | struct Apple((Apple, Option)); | ~ ~ error[E0072]: recursive type `Apple` has infinite size --> $DIR/issue-103748-ICE-wrong-braces.rs:3:1 | LL | struct Apple((Apple, Option(Banana ? Citron))); | ^^^^^^^^^^^^ ----- recursive without indirection | help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle | LL | struct Apple((Box, Option(Banana ? Citron))); | ++++ + error: aborting due to 5 previous errors Some errors have detailed explanations: E0072, E0214, E0412. For more information about an error, try `rustc --explain E0072`. ", "positive_passages": [{"docid": "doc-en-rust-6df879d099706e7c89effbdd5db3b7dec5eb12ccd0653f1903c03a44c9a8a9f2", "text": "I have a real Dev experience when working on , I was editing an file with 3k+ lines of code, and I forgetted remove an extra '{', then the compiler give about 20+ errors, the first two are from parsing: But there are many many other errors from later phases... I need to scroll up several pages to the beginning of error to find the rootcause.\nIf we can not get valid AST in parsing, later phases such as analysising will report out extra (mostly unhelpful) errors?\nThe assertion is inside of the data structure. I generally expect data structures to simply assert on pre-conditions. We could put a delay-bug before the call, but that also seems like overkill since that is already on the error-reporting path. I agree there are cases where rustc should quit sooner. But in general I think we have to err on the side of recover-and-continue if there is some possibility that more helpful errors may be emitted.\nThis can happen. The parser should be more realistic on what it recovers and avoid errors from later passes that do not make sense. A few years back we would stop as soon as any error occurred in a given pass and avoid trying any further evaluation, and that was also a usability issue, because people would get a false sense of \"how much work is left to fix\". We shouldn't have a blanket evaluation stop, but maybe be more aggressive about pruning the AST when multiple parse errors have occurred.\ndo you want to take over this issue? I currently don't have any clue about the rootcause. Or we give it an simple fix now.\nI can take a look.", "commid": "rust_issue_103748", "tokennum": 356}], "negative_passages": []}
{"query_id": "q-en-rust-217f3555e35d74e60ea6b9a32d25835584f1964c109f36bba74e805304f965a0", "query": "// Multibyte case is a fn to allow char_range_at to inline cleanly fn multibyte_char_range_at(s: &str, i: uint) -> CharRange { let mut val = s[i] as uint; let mut val = s[i] as u32; let w = UTF8_CHAR_WIDTH[val] as uint; assert!((w != 0));", "positive_passages": [{"docid": "doc-en-rust-f3e2780cf4358f85a278001b362f5e3b3b3b013b0c68b4c825cdbd5635d2d14c", "text": "We need some way to interpret a as UTF-8, using the replacement character for invalid sequences instead of conditions. This would ideally be provided in the form of an .\nCould we remove the current condition API in favour of this? It doesn't really seem to offer anything but failing, and we already have an API returning an .\nI would be quite pleased if we could do that. Using the condition is rather awkward, and I would rather just have replacement chars myself.\nThis is a duplicate of , no?\nAnd also the e-mail thread here I think is relevant:\nThis is an implementation of a mostly complete \u2192 UTF-8 decoder\nIt's only a duplicate if the intended resolution of is to use the replacement char instead of conditions, but it's unclear from the discussion if that's the plan.\nI guess my thinking was that a maximally expressive condition-based solution would let one express a replacement char approach using conditions. But I don't actually favor doing that at this point. Or at least, I don't favor making that the only way to accomplish this, since I suspect a more specialized approach will be much nicer to use (both in terms of programmer convenience and in terms of efficiency). So okay, this is not a duplicate of .\nRust needs to support both fatal and replacement error handling modes, it should follow the WHATWG spec simonsapin has said (edit by is WHATWG spec.)\nthe fatal mode is already handled by the API\nwell, the current functions in str don't handle decoding buffers in chunks like the proposed encodings API. But yes, it does handle one-off decoding with 'fatal' error handling.\nI think we need to improve/extend our API along the lines suggested here for 1.0. Nominating for P-backcompat-lang. (Arguably we could avoid the backwards compatibility hazard by offering a fail-only method for 1.0 and then adding an alternative entry point that provides the more flexible API supporting replacement characters in post 1.0. But I think this case is important enough that we should try to get the primary API method to provide both choices up front. That, or put dynamic fluid support in for representing the state of that choice.)\nI submitted a PR for this last night, although I forgot there was an open issue too so I didn't link them. The PR is", "commid": "rust_issue_9516", "tokennum": 493}], "negative_passages": []}
{"query_id": "q-en-rust-2185c11d719580ae6a96bf23adb79035c9d3125dbd763d73071a729c1a03be63", "query": "let crate_types = if options.proc_macro_crate { vec![config::CrateType::ProcMacro] } else { vec![config::CrateType::Dylib] vec![config::CrateType::Rlib] }; let sessopts = config::Options {", "positive_passages": [{"docid": "doc-en-rust-92aaa6ba7fb910876b9f1b232c97d8ece54e1c12f44fb74569fdc0e310d7aff2", "text": "I have a no_std crate that imports std when testing: However, I get this error during testing: Allocating on the heap during testing does appear to work, so I'm assuming this is just a case of the warning still being emitted.\nI have the same issue. Any update?\nbuilds the crate both as a library (for doctests) and as a test executable. You only pull in std for the test executable, so the error message could be coming from building as a library.\nI have the same issue, error message seems to be spurious\nYeah, the error message is emitted when building the library. Funnily enough, it does not cause the build to fail. That is, still continues running and then exits with success (0). Sadly, there is currently no way to link in a default allocator (or for that matter) for doctests. There is the unstable feature that provides , but I don't see how to achieve something similar without relying on unstable features. I simply use until this is fixed.\nRelated:\nmodify labels: +T-rustdoc\nError: Parsing label command in failed: labels +T-rustdo... Please let know if you're having trouble with this bot.\nIf you don't put inside the doctest it will be linked against even when testing a crate, you can think of each doctest as a separate crate. If you do want a different allocator you can add a static like in a normal binary. Even though this error message is printed the doc tests should still be running.\nAlso see the error is basically spurious.", "commid": "rust_issue_54010", "tokennum": 341}], "negative_passages": []}
{"query_id": "q-en-rust-2185c11d719580ae6a96bf23adb79035c9d3125dbd763d73071a729c1a03be63", "query": "let crate_types = if options.proc_macro_crate { vec![config::CrateType::ProcMacro] } else { vec![config::CrateType::Dylib] vec![config::CrateType::Rlib] }; let sessopts = config::Options {", "positive_passages": [{"docid": "doc-en-rust-7cdf2149b8a9da64a8d63d2bcc06669ae9a3c4070061fcd35a8fe6bdff973a4e", "text": "I noticed this in the output running locally: and that didn't make tests fail. Cc:\nSame with panic_unwind:\nThis error message is printed when running , but before running any test. The code printing it is in . It looks like rustdoc is using that code in order to load the crate and find doctests in it. But since it\u2019s not actually compiling this crate, not having an allocator is not a problem. So I think there are two issues: rustdoc keeps doing its thing even though there are errors. It probably should call something like on its instance at some point. This error should not occur in the first place. One way to inhibit it would be to tell that we\u2019re \"compiling\" an rlib () rather than some other crate type. rlibs do not need (yet) to have an allocator defined. This is possibly this line: The first issue could in some other situation hide a real problem, but in this case it makes the second one mostly harmless. The only bad consequence is some noise in the output of a test run.\nRelated:\nmodify labels: +T-rustdoc\nError: Parsing label command in failed: labels +T-rustdo... Please let know if you're having trouble with this bot.", "commid": "rust_issue_52243", "tokennum": 271}], "negative_passages": []}
{"query_id": "q-en-rust-21c1a25f20443dc0f5f80d4b56059c6b2af3768650669a2eedf50375d0cb78a8", "query": "#![feature(ptr_offset_from)] #![feature(rustc_attrs)] #![feature(receiver_trait)] #![feature(slice_from_raw_parts)] #![feature(specialization)] #![feature(staged_api)] #![feature(std_internals)]", "positive_passages": [{"docid": "doc-en-rust-4039330e67d9c598488721995db16f5a294e1a397cf1c9ee14da67ab540d6a81", "text": "In stable Rust, the only way to get a with an arbitrary length is through . Unfortunately, that function returns a , which makes it very dubious to use with arbitrary raw pointers.\nGiven that isn't defined for , what would be the value of being able to create ?\nWhy would you want one, but also, this seems like it depends on (yet to be decided?) details of the memory model. Is the fleeting moment where a reference exists in enough to invoke UB if the pointer is invalid?\nIf the reference is , then this is insta-UB for sure.\nIs there anything holding [] from stabilizing? If not, I'd like to propose stabilization of these functions, as they are rather simple in concept and allow avoiding manifesting references during (slice) pointer manipulation. cc If I'm reading the various issue threads correctly, the validity invariant of pointer metadata is at max that of the metadata type. For slice pointers, the metadata is typed at . Context: I happen to currently be writing a library that cannot use the reference-based functions, because though the pointers are known to be non-null (and valid), it is not (and cannot be, with the current abstraction) known whether the pointer has unique or shared provenance (thus should use or to be sound). (Specifically, I'm now adding the bits required to handle erasing slice types. I can bifurcate my function into and , but so far, it works fine with one operating over , and it'd be sad to have the / split hanging around even after these functions stabilize (assuming they can)).\nI don't recall any reason that cannot be stabilized.\nThe implementation PR used this feature requested as a tracking issue, but this wasn\u2019t labelled properly. Doing so now.\nBy the way, would also cover this :)", "commid": "rust_issue_36925", "tokennum": 385}], "negative_passages": []}
{"query_id": "q-en-rust-21e613c3b1faf714a8b18ba641183acce7f8376d10a99067558b8cb537b55083", "query": "#[doc(keyword = \"struct\")] // /// The `struct` keyword. /// The keyword used to define structs. /// /// The `struct` keyword is used to define a struct type. /// Structs in Rust come in three flavours: Regular structs, tuple structs, /// and empty structs. /// /// Example: /// ```rust /// struct Regular { /// field1: f32, /// field2: String, /// pub field3: bool /// } /// /// struct Tuple(u32, String); /// /// struct Empty; /// ``` /// struct Foo { /// field1: u32, /// field2: String, /// /// Regular structs are the most commonly used. Each field defined within them has a name and a /// type, and once defined can be accessed using `example_struct.field` syntax. The fields of a /// struct share its mutability, so `foo.bar = 2;` would only be valid if `foo` was mutable. Adding /// `pub` to a field makes it visible to code in other modules, as well as allowing it to be /// directly accessed and modified. /// /// Tuple structs are similar to regular structs, but its fields have no names. They are used like /// tuples, with deconstruction possible via `let TupleStruct(x, y) = foo;` syntax. For accessing /// individual variables, the same syntax is used as with regular tuples, namely `foo.0`, `foo.1`, /// etc, starting at zero. /// /// Empty structs, or unit-like structs, are most commonly used as markers, for example /// [`PhantomData`]. Empty structs have a size of zero bytes, but unlike empty enums they can be /// instantiated, making them similar to the unit type `()`. Unit-like structs are useful when you /// need to implement a trait on something, but don't need to store any data inside it. /// /// # Instantiation /// /// Structs can be instantiated in a manner of different ways, each of which can be mixed and /// matched as needed. The most common way to make a new struct is via a constructor method such as /// `new()`, but when that isn't available (or you're writing the constructor itself), struct /// literal syntax is used: /// /// ```rust /// # struct Foo { field1: f32, field2: String, etc: bool } /// let example = Foo { /// field1: 42.0, /// field2: \"blah\".to_string(), /// etc: true, /// }; /// ``` /// /// It's only possible to directly instantiate a struct using struct literal syntax when all of its /// fields are visible to you. /// /// There are a handful of shortcuts provided to make writing constructors more convenient, most /// common of which is the Field Init shorthand. When there is a variable and a field of the same /// name, the assignment can be simplified from `field: field` into simply `field`. The following /// example of a hypothetical constructor demonstrates this: /// /// ```rust /// struct User { /// name: String, /// admin: bool, /// } /// /// impl User { /// pub fn new(name: String) -> Self { /// Self { /// name, /// admin: false, /// } /// } /// } /// ``` /// /// Another shortcut for struct instantiation is available, used when you need to make a new /// struct that has the same values as most of a previous struct of the same type, called struct /// update syntax: /// /// ```rust /// # struct Foo { field1: String, field2: () } /// # let thing = Foo { field1: \"\".to_string(), field2: () }; /// let updated_thing = Foo { /// field1: \"a new value\".to_string(), /// ..thing /// }; /// ``` /// /// There are different kinds of structs. For more information, take a look at the /// [Rust Book][book]. /// Tuple structs are instantiated in the same way as tuples themselves, except with the struct's /// name as a prefix: `Foo(123, false, 0.1)`. /// /// Empty structs are instantiated with just their name, and don't need anything else. `let thing = /// EmptyStruct;` /// /// # Style conventions /// /// Structs are always written in CamelCase, with few exceptions. While the trailing comma on a /// struct's list of fields can be omitted, it's usually kept for convenience in adding and /// removing fields down the line. /// /// For more information on structs, take a look at the [Rust Book][book] or the /// [Reference][reference]. /// /// [`PhantomData`]: marker/struct.PhantomData.html /// [book]: https://doc.rust-lang.org/book/second-edition/ch05-01-defining-structs.html /// [reference]: https://doc.rust-lang.org/reference/items/structs.html mod struct_keyword { }", "positive_passages": [{"docid": "doc-en-rust-73fde4a7a26b1d9bdfbab64cf4047251b44ae0e58f37cf04b7820b75da4958a9", "text": "Consider the following code (): It currently yields the following diagnostic messages: This line is what I object to: It has two problems: It uses the terminology when discussing building up an instance of the struct . It uses a tuple struct form in the example rewrite it provides; but our is a braced struct with named fields.\nIs GitHub suffering from some kind of cache-consistency problem!? (I guess so: they're investigating service unavailability.) I apparently-successfully opened PR to fix this, but then it wasn't showing up in the and the pull/ URL was 404ing, so then I thought that it might not have actually gone through, so then I tried to resubmit, and then that failed with an \"A pull request already exists\" flash message, and then I wanted to try submitting under a different branch name, and/or rebased so as to have a different SHA (on the theory that maybe the problem had something to do with the fact that I was reusing the branch name from the my PR of last year in which the \"variant of the expected type\" message was introduced, even though it would be really surprising if a site as old and usually-stable as GitHub didn't already handle that case), but then the \"Compare branches\" pages aren't showing the open-pull-request form that they usually do. Typically I wouldn't even bother commenting about this kind of glitch (trusting that our friends at GitHub will sort it out any mere availability issue soon enough), but the fact that other PR pages are loading fine for me makes me wonder if there's some kind of bad state associated with in particular?!\nIs GitHub suffering from some kind of cache-consistency problem!? (I guess so: they're investigating service unavailability.)", "commid": "rust_issue_55250", "tokennum": 393}], "negative_passages": []}
{"query_id": "q-en-rust-21e613c3b1faf714a8b18ba641183acce7f8376d10a99067558b8cb537b55083", "query": "#[doc(keyword = \"struct\")] // /// The `struct` keyword. /// The keyword used to define structs. /// /// The `struct` keyword is used to define a struct type. /// Structs in Rust come in three flavours: Regular structs, tuple structs, /// and empty structs. /// /// Example: /// ```rust /// struct Regular { /// field1: f32, /// field2: String, /// pub field3: bool /// } /// /// struct Tuple(u32, String); /// /// struct Empty; /// ``` /// struct Foo { /// field1: u32, /// field2: String, /// /// Regular structs are the most commonly used. Each field defined within them has a name and a /// type, and once defined can be accessed using `example_struct.field` syntax. The fields of a /// struct share its mutability, so `foo.bar = 2;` would only be valid if `foo` was mutable. Adding /// `pub` to a field makes it visible to code in other modules, as well as allowing it to be /// directly accessed and modified. /// /// Tuple structs are similar to regular structs, but its fields have no names. They are used like /// tuples, with deconstruction possible via `let TupleStruct(x, y) = foo;` syntax. For accessing /// individual variables, the same syntax is used as with regular tuples, namely `foo.0`, `foo.1`, /// etc, starting at zero. /// /// Empty structs, or unit-like structs, are most commonly used as markers, for example /// [`PhantomData`]. Empty structs have a size of zero bytes, but unlike empty enums they can be /// instantiated, making them similar to the unit type `()`. Unit-like structs are useful when you /// need to implement a trait on something, but don't need to store any data inside it. /// /// # Instantiation /// /// Structs can be instantiated in a manner of different ways, each of which can be mixed and /// matched as needed. The most common way to make a new struct is via a constructor method such as /// `new()`, but when that isn't available (or you're writing the constructor itself), struct /// literal syntax is used: /// /// ```rust /// # struct Foo { field1: f32, field2: String, etc: bool } /// let example = Foo { /// field1: 42.0, /// field2: \"blah\".to_string(), /// etc: true, /// }; /// ``` /// /// It's only possible to directly instantiate a struct using struct literal syntax when all of its /// fields are visible to you. /// /// There are a handful of shortcuts provided to make writing constructors more convenient, most /// common of which is the Field Init shorthand. When there is a variable and a field of the same /// name, the assignment can be simplified from `field: field` into simply `field`. The following /// example of a hypothetical constructor demonstrates this: /// /// ```rust /// struct User { /// name: String, /// admin: bool, /// } /// /// impl User { /// pub fn new(name: String) -> Self { /// Self { /// name, /// admin: false, /// } /// } /// } /// ``` /// /// Another shortcut for struct instantiation is available, used when you need to make a new /// struct that has the same values as most of a previous struct of the same type, called struct /// update syntax: /// /// ```rust /// # struct Foo { field1: String, field2: () } /// # let thing = Foo { field1: \"\".to_string(), field2: () }; /// let updated_thing = Foo { /// field1: \"a new value\".to_string(), /// ..thing /// }; /// ``` /// /// There are different kinds of structs. For more information, take a look at the /// [Rust Book][book]. /// Tuple structs are instantiated in the same way as tuples themselves, except with the struct's /// name as a prefix: `Foo(123, false, 0.1)`. /// /// Empty structs are instantiated with just their name, and don't need anything else. `let thing = /// EmptyStruct;` /// /// # Style conventions /// /// Structs are always written in CamelCase, with few exceptions. While the trailing comma on a /// struct's list of fields can be omitted, it's usually kept for convenience in adding and /// removing fields down the line. /// /// For more information on structs, take a look at the [Rust Book][book] or the /// [Reference][reference]. /// /// [`PhantomData`]: marker/struct.PhantomData.html /// [book]: https://doc.rust-lang.org/book/second-edition/ch05-01-defining-structs.html /// [reference]: https://doc.rust-lang.org/reference/items/structs.html mod struct_keyword { }", "positive_passages": [{"docid": "doc-en-rust-ecf7ef0c49afb28fbf67b2ee187ed04f8c03051908f10bb892e5fde29aa2c0e3", "text": "I apparently-successfully opened PR to fix this, but then it wasn't showing up in the and the pull/ URL was 404ing, so then I thought that it might not have actually gone through, so then I tried to resubmit, and then that failed with an \"A pull request already exists\" flash message, and then I wanted to try submitting under a different branch name, and/or rebased so as to have a different SHA (on the theory that maybe the problem had something to do with the fact that I was reusing the branch name from the my PR of last year in which the \"variant of the expected type\" message was introduced, even though it would be really surprising if a site as old and usually-stable as GitHub didn't already handle that case), but then the \"Compare branches\" pages aren't showing the open-pull-request form that they usually do. Typically I wouldn't even bother commenting about this kind of glitch (trusting that our friends at GitHub will sort it out any mere availability issue soon enough), but the fact that other PR pages are loading fine for me makes me wonder if there's some kind of bad state associated with in particular?!", "commid": "rust_issue_55250", "tokennum": 258}], "negative_passages": []}
{"query_id": "q-en-rust-21e613c3b1faf714a8b18ba641183acce7f8376d10a99067558b8cb537b55083", "query": "#[doc(keyword = \"struct\")] // /// The `struct` keyword. /// The keyword used to define structs. /// /// The `struct` keyword is used to define a struct type. /// Structs in Rust come in three flavours: Regular structs, tuple structs, /// and empty structs. /// /// Example: /// ```rust /// struct Regular { /// field1: f32, /// field2: String, /// pub field3: bool /// } /// /// struct Tuple(u32, String); /// /// struct Empty; /// ``` /// struct Foo { /// field1: u32, /// field2: String, /// /// Regular structs are the most commonly used. Each field defined within them has a name and a /// type, and once defined can be accessed using `example_struct.field` syntax. The fields of a /// struct share its mutability, so `foo.bar = 2;` would only be valid if `foo` was mutable. Adding /// `pub` to a field makes it visible to code in other modules, as well as allowing it to be /// directly accessed and modified. /// /// Tuple structs are similar to regular structs, but its fields have no names. They are used like /// tuples, with deconstruction possible via `let TupleStruct(x, y) = foo;` syntax. For accessing /// individual variables, the same syntax is used as with regular tuples, namely `foo.0`, `foo.1`, /// etc, starting at zero. /// /// Empty structs, or unit-like structs, are most commonly used as markers, for example /// [`PhantomData`]. Empty structs have a size of zero bytes, but unlike empty enums they can be /// instantiated, making them similar to the unit type `()`. Unit-like structs are useful when you /// need to implement a trait on something, but don't need to store any data inside it. /// /// # Instantiation /// /// Structs can be instantiated in a manner of different ways, each of which can be mixed and /// matched as needed. The most common way to make a new struct is via a constructor method such as /// `new()`, but when that isn't available (or you're writing the constructor itself), struct /// literal syntax is used: /// /// ```rust /// # struct Foo { field1: f32, field2: String, etc: bool } /// let example = Foo { /// field1: 42.0, /// field2: \"blah\".to_string(), /// etc: true, /// }; /// ``` /// /// It's only possible to directly instantiate a struct using struct literal syntax when all of its /// fields are visible to you. /// /// There are a handful of shortcuts provided to make writing constructors more convenient, most /// common of which is the Field Init shorthand. When there is a variable and a field of the same /// name, the assignment can be simplified from `field: field` into simply `field`. The following /// example of a hypothetical constructor demonstrates this: /// /// ```rust /// struct User { /// name: String, /// admin: bool, /// } /// /// impl User { /// pub fn new(name: String) -> Self { /// Self { /// name, /// admin: false, /// } /// } /// } /// ``` /// /// Another shortcut for struct instantiation is available, used when you need to make a new /// struct that has the same values as most of a previous struct of the same type, called struct /// update syntax: /// /// ```rust /// # struct Foo { field1: String, field2: () } /// # let thing = Foo { field1: \"\".to_string(), field2: () }; /// let updated_thing = Foo { /// field1: \"a new value\".to_string(), /// ..thing /// }; /// ``` /// /// There are different kinds of structs. For more information, take a look at the /// [Rust Book][book]. /// Tuple structs are instantiated in the same way as tuples themselves, except with the struct's /// name as a prefix: `Foo(123, false, 0.1)`. /// /// Empty structs are instantiated with just their name, and don't need anything else. `let thing = /// EmptyStruct;` /// /// # Style conventions /// /// Structs are always written in CamelCase, with few exceptions. While the trailing comma on a /// struct's list of fields can be omitted, it's usually kept for convenience in adding and /// removing fields down the line. /// /// For more information on structs, take a look at the [Rust Book][book] or the /// [Reference][reference]. /// /// [`PhantomData`]: marker/struct.PhantomData.html /// [book]: https://doc.rust-lang.org/book/second-edition/ch05-01-defining-structs.html /// [reference]: https://doc.rust-lang.org/reference/items/structs.html mod struct_keyword { }", "positive_passages": [{"docid": "doc-en-rust-b073521821c3ff445eaadcc19356a17838621304c748b656755659c747cd4626", "text": "This code snippet () results in the following lint output: The should contain the literal string , not the expanded macro that it repreesnts.\nAh, I think this is because we should be using (to get the code the user actually wrote) (to render the AST); I could PR this tonight.", "commid": "rust_issue_55109", "tokennum": 68}], "negative_passages": []}
{"query_id": "q-en-rust-21e613c3b1faf714a8b18ba641183acce7f8376d10a99067558b8cb537b55083", "query": "#[doc(keyword = \"struct\")] // /// The `struct` keyword. /// The keyword used to define structs. /// /// The `struct` keyword is used to define a struct type. /// Structs in Rust come in three flavours: Regular structs, tuple structs, /// and empty structs. /// /// Example: /// ```rust /// struct Regular { /// field1: f32, /// field2: String, /// pub field3: bool /// } /// /// struct Tuple(u32, String); /// /// struct Empty; /// ``` /// struct Foo { /// field1: u32, /// field2: String, /// /// Regular structs are the most commonly used. Each field defined within them has a name and a /// type, and once defined can be accessed using `example_struct.field` syntax. The fields of a /// struct share its mutability, so `foo.bar = 2;` would only be valid if `foo` was mutable. Adding /// `pub` to a field makes it visible to code in other modules, as well as allowing it to be /// directly accessed and modified. /// /// Tuple structs are similar to regular structs, but its fields have no names. They are used like /// tuples, with deconstruction possible via `let TupleStruct(x, y) = foo;` syntax. For accessing /// individual variables, the same syntax is used as with regular tuples, namely `foo.0`, `foo.1`, /// etc, starting at zero. /// /// Empty structs, or unit-like structs, are most commonly used as markers, for example /// [`PhantomData`]. Empty structs have a size of zero bytes, but unlike empty enums they can be /// instantiated, making them similar to the unit type `()`. Unit-like structs are useful when you /// need to implement a trait on something, but don't need to store any data inside it. /// /// # Instantiation /// /// Structs can be instantiated in a manner of different ways, each of which can be mixed and /// matched as needed. The most common way to make a new struct is via a constructor method such as /// `new()`, but when that isn't available (or you're writing the constructor itself), struct /// literal syntax is used: /// /// ```rust /// # struct Foo { field1: f32, field2: String, etc: bool } /// let example = Foo { /// field1: 42.0, /// field2: \"blah\".to_string(), /// etc: true, /// }; /// ``` /// /// It's only possible to directly instantiate a struct using struct literal syntax when all of its /// fields are visible to you. /// /// There are a handful of shortcuts provided to make writing constructors more convenient, most /// common of which is the Field Init shorthand. When there is a variable and a field of the same /// name, the assignment can be simplified from `field: field` into simply `field`. The following /// example of a hypothetical constructor demonstrates this: /// /// ```rust /// struct User { /// name: String, /// admin: bool, /// } /// /// impl User { /// pub fn new(name: String) -> Self { /// Self { /// name, /// admin: false, /// } /// } /// } /// ``` /// /// Another shortcut for struct instantiation is available, used when you need to make a new /// struct that has the same values as most of a previous struct of the same type, called struct /// update syntax: /// /// ```rust /// # struct Foo { field1: String, field2: () } /// # let thing = Foo { field1: \"\".to_string(), field2: () }; /// let updated_thing = Foo { /// field1: \"a new value\".to_string(), /// ..thing /// }; /// ``` /// /// There are different kinds of structs. For more information, take a look at the /// [Rust Book][book]. /// Tuple structs are instantiated in the same way as tuples themselves, except with the struct's /// name as a prefix: `Foo(123, false, 0.1)`. /// /// Empty structs are instantiated with just their name, and don't need anything else. `let thing = /// EmptyStruct;` /// /// # Style conventions /// /// Structs are always written in CamelCase, with few exceptions. While the trailing comma on a /// struct's list of fields can be omitted, it's usually kept for convenience in adding and /// removing fields down the line. /// /// For more information on structs, take a look at the [Rust Book][book] or the /// [Reference][reference]. /// /// [`PhantomData`]: marker/struct.PhantomData.html /// [book]: https://doc.rust-lang.org/book/second-edition/ch05-01-defining-structs.html /// [reference]: https://doc.rust-lang.org/reference/items/structs.html mod struct_keyword { }", "positive_passages": [{"docid": "doc-en-rust-86d66ea85279cef0b7fba4d8ef6e636387c69e50013a821010ad0174f5c6ee7f", "text": "ARC is beginning to infect more and more types, and they each must have a clone method, but there is no trait to implement.\nrelated\nAlong with this, we should provide a default implementation of Clonable for all copyable types.\nClosing this now that has been implemented. There are no doubt some types left that should have a implementation, but they can be dealt with on a case-by-case basis.", "commid": "rust_issue_3313", "tokennum": 85}], "negative_passages": []}
{"query_id": "q-en-rust-22b172c85ea0f880cac595f835737979c74284275326a223ff9b0da0810e1885", "query": "let mut _0: *const &u8; let mut _2: *const &u8; let mut _3: *const &u8; let mut _4: *const &u8; scope 1 (inlined generic_cast::<&u8, &u8>) { debug x => _3; let mut _4: *const &u8; debug x => _4; let mut _5: *const &u8; } bb0: { StorageLive(_2); StorageLive(_3); _3 = _1; StorageLive(_4); _4 = _3; - _2 = move _4 as *const &u8 (PtrToPtr); + _2 = move _4; _4 = _1; StorageLive(_5); _5 = _4; - _3 = move _5 as *const &u8 (PtrToPtr); + _3 = move _5; StorageDead(_5); StorageDead(_4); StorageDead(_3); - _2 = move _3 as *const &u8 (PtrToPtr); + _2 = move _3; _0 = _2; StorageDead(_3); StorageDead(_2); return; }", "positive_passages": [{"docid": "doc-en-rust-9b4ab92232153d0742c86ba450034f7e1e26346754a368047e2e8efb113687b6", "text": " $DIR/issue-52049.rs:16:10 | LL | foo(&unpromotable(5u32)); | ^^^^^^^^^^^^^^^^^^ - temporary value only lives until here | | | temporary value does not live long enough | = note: borrowed value must be valid for the static lifetime... error: aborting due to previous error For more information about this error, try `rustc --explain E0597`. ", "positive_passages": [{"docid": "doc-en-rust-cb642c3520b1a6a98785c95cb2d4c71b5240bc747600036763c64341d0734a29", "text": "suggests but still won't give us a lifetime. We should not emit the if the required lifetime is for the inside the source presume there's some code already checking for producing the \"borrowed value must be valid for the static lifetime\" message, find that code and bubble up the knowledge about that until you have it in the scope of the \"consider using a binding to increase its lifetime\" message 't emit the message in that case 'll already fail a bunch of tests, I don't think you need any new tests. Running should succeed and give you a bunch of changes to commit. Check that all changes make sense and just commit them.\ncan I take this on if nobody is working on this?\nAll yours!\nclosing it, as required code change has been merged.", "commid": "rust_issue_52049", "tokennum": 161}], "negative_passages": []}
{"query_id": "q-en-rust-2451b88c0cc752a6725a450675fa35cb2eef911c05c4b3a722e5d7a29d0e6ec9", "query": "id, expr_ty.repr(self.tcx()), def); match def { def::DefStruct(..) | def::DefVariant(..) => { def::DefStruct(..) | def::DefVariant(..) | def::DefFn(..) | def::DefStaticMethod(..) => { Ok(self.cat_rvalue_node(id, span, expr_ty)) } def::DefFn(..) | def::DefStaticMethod(..) | def::DefMod(_) | def::DefForeignMod(_) | def::DefStatic(_, false) | def::DefMod(_) | def::DefForeignMod(_) | def::DefStatic(_, false) | def::DefUse(_) | def::DefTrait(_) | def::DefTy(_) | def::DefPrimTy(_) | def::DefTyParam(..) | def::DefTyParamBinder(..) | def::DefRegion(_) | def::DefLabel(_) | def::DefSelfTy(..) | def::DefMethod(..) => {", "positive_passages": [{"docid": "doc-en-rust-d704b13970675994426a7cfe3c25930bc2a2f81d11f99f2cf4ddba91e47e9539", "text": "Hello! The following dumps core when run on my machine (Ubuntu 12.04 LTS, rust-nightly downloaded today (18th Apr)). Ziad Hatahet confirmed the same on a slightly older version of rust.\nThere's an extra layer of indirection in that struct definition. A is a pointer to a pointer to a function. A statement like expands to . That's obviously creating a dangling pointer onto the stack which is why it ends up crashing. Adjusting the struct definition to should make things work as you want. There's also a bug in rustc for even letting that program compile. I'm not sure if it's already been run into and filed.\ncc\nThis fixes it: But I didn't quite understand why.\nit probably happens to reset that part of the stack to the right value.\np.s. This is still crashing in . Thanks\nNominating, something fishy is going on here.\nHere's the simplest possible reduction I could make:\nIs the compiler mixing up the function pointer with the actual function code? That is, is like So writing is like , i.e. a non- reference to the function pointer.\nIt's just creating an alloca, storing the function pointer into it, borrowing that, and returning the borrowed pointer. For example, on the program I get this LLVM IR: Basically, the borrow checker doesn't seem to be in on the joke that is referring to a local alloca.\nThat is the behaviour I would expect if my statement were true. (The double in the LLVM signature indicates what I was talking about: a function value is already the pointer, and so the name doesn't have lifetime.)\n0 backcompat-lang\nThis is probably a mismatch between trans/mem-categorization. I expect mem-categorization is saying that the \"reference to the fn\" is a static item, but trans is translating it into an rvalue (and hence on the stack).", "commid": "rust_issue_13595", "tokennum": 428}], "negative_passages": []}
{"query_id": "q-en-rust-2473453dbc575b939318490d6f89d2b5eb5746cd74658826cc1b9404039f5e44", "query": " // 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 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. struct Foo; fn main() { || if let Foo::NotEvenReal() = Foo {}; //~ ERROR E0599 } ", "positive_passages": [{"docid": "doc-en-rust-407f1793860f1c2bb36fe3abf372c23cb046bee39d088f63364b588491394778", "text": "I was playing around with some code which can be found and is attached below. When I click on output I get the following output: I don't have a rust installation locally right now, so I cannot create the backtrace. I'll add it later today. The code which triggers this:\nStack trace: (There is no ICE with (nothing generated either due to type error). Perhaps playpen should use instead.)\nYou can get backtrace on playpen here: !\nLooks like this has been fixed recently", "commid": "rust_issue_41880", "tokennum": 108}], "negative_passages": []}
{"query_id": "q-en-rust-2473453dbc575b939318490d6f89d2b5eb5746cd74658826cc1b9404039f5e44", "query": " // 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 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. struct Foo; fn main() { || if let Foo::NotEvenReal() = Foo {}; //~ ERROR E0599 } ", "positive_passages": [{"docid": "doc-en-rust-c38d923b020368d079db9f321728ff9837ba4a024866c20148602f6d218bfa20", "text": "I was in the middle of making a big changes to some code when this panic occurred. I was expecting a lot of compiler errors but got a compiler panic instead! :fearful: I ran the build with and the panic still occurred. Run to get this. Here's the full output with : Since I was in the middle of editing, there's no commit to point to, so I just attached my source code as is so you have something to debug. When you download it and run , the compiler should panic. The repo is called . I don't know how to narrow this issue down, or else I would try to find a smaller example for you. Hope this is good enough.\nSome context for the change that caused this: Before this error happened, I changed the file . I split into two structs, and . I was relying on the compiler to find all the places where that change would effect things, and it seems that something went wrong in the compiler while trying to do that.\nOnce I fix that, everything works again. No more compiler panic. So it seems to have something to do with when I split up that struct. All the messed up pattern matches caused a panic. (Actually just fixing 2 broken pattern matches fixed the problem.)\nI've just encountered this myself. I managed to reduce it down: It looks like this happens when a closure's body is a single (non-block) expression, and a tuple struct pattern is used somewhere in the expression. A simple workaround (if anyone needs one for some reason), then, is to just make the closure body a block:", "commid": "rust_issue_41210", "tokennum": 340}], "negative_passages": []}
{"query_id": "q-en-rust-2473453dbc575b939318490d6f89d2b5eb5746cd74658826cc1b9404039f5e44", "query": " // 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 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. struct Foo; fn main() { || if let Foo::NotEvenReal() = Foo {}; //~ ERROR E0599 } ", "positive_passages": [{"docid": "doc-en-rust-626872c87b0dcaea8cbb0796f86125d4a5963d8a0e06e9f0d68c62a9b6286cc8", "text": "Related code: Compiler panic: Note that everything is fine if I annotate the lifetimes: I am running , the MSVC x64 version.\nI just ran into this. Managed to reduce the crash to Explicit lifetimes indeed fix it:\ndon't know if this helps, but I came up with minimal test case", "commid": "rust_issue_39872", "tokennum": 66}], "negative_passages": []}
{"query_id": "q-en-rust-2473453dbc575b939318490d6f89d2b5eb5746cd74658826cc1b9404039f5e44", "query": " // 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 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. struct Foo; fn main() { || if let Foo::NotEvenReal() = Foo {}; //~ ERROR E0599 } ", "positive_passages": [{"docid": "doc-en-rust-1f59f1864785c4d98be692767ee8babdcb88e848ad5101cfe6a2292fdb6a3d1c", "text": "Playground Output: Other example (possibly different bug): Output:\nI just got the same ICE on linux with both the and builds. My case is essentially the same. You create an iterator of references to sub-elements of some thing which has been passed in by reference. The compiler should figure out that the iterator can only live as long as the original object, but ICEs instead. ()", "commid": "rust_issue_39665", "tokennum": 84}], "negative_passages": []}
{"query_id": "q-en-rust-2473453dbc575b939318490d6f89d2b5eb5746cd74658826cc1b9404039f5e44", "query": " // 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 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. struct Foo; fn main() { || if let Foo::NotEvenReal() = Foo {}; //~ ERROR E0599 } ", "positive_passages": [{"docid": "doc-en-rust-68ba19070d931c53e5178771489d28092502d8d792d88d2c2e994038ddc952fe", "text": "Spawned off of There are still some cases where referencing an inaccessible item can cause the compiler to ICE. Here is one crafted example () but if 's module structure is revised then that example may fail to compile without ICE'ing for other reasons, so take care in understanding the issue: the change introduced by is skipping the requirement for stability attributes is slightly too narrow, in that it uses a local notion of pub/non-pub instead of overall accessibility. One simple solution to this may be to just follow the suggestion here and just remove the assertion entirely. (I did not want to adopt that solution for a PR to be backported to beta, but I think it is worth considering doing in nightly alone to resolve this low priority issue.)\nKeywords: for better search", "commid": "rust_issue_38857", "tokennum": 158}], "negative_passages": []}
{"query_id": "q-en-rust-2483d863943b6aa71d4fa027394680bd88fb2d6e978e117ae611e32d2f7eb360", "query": "#[diag(parse_use_eq_instead)] pub(crate) struct UseEqInstead { #[primary_span] #[suggestion(style = \"verbose\", applicability = \"machine-applicable\", code = \"=\")] pub span: Span, #[suggestion(style = \"verbose\", applicability = \"machine-applicable\", code = \"\")] pub suggestion: Span, } #[derive(Diagnostic)]", "positive_passages": [{"docid": "doc-en-rust-a7aaa3fd74686a30b6cfd7d26d89bdc2670056406cb578d376a945fbd70871b8", "text": " $DIR/typeck_type_placeholder_item.rs:199:14 --> $DIR/typeck_type_placeholder_item.rs:201:14 | LL | type A = _; | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:201:14 --> $DIR/typeck_type_placeholder_item.rs:203:14 | LL | type B = _; | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:203:14 --> $DIR/typeck_type_placeholder_item.rs:205:14 | LL | const C: _; | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:206:14 --> $DIR/typeck_type_placeholder_item.rs:208:14 | LL | const D: _ = 42; | ^", "positive_passages": [{"docid": "doc-en-rust-ec5ec337fdebda62ea6f5accc58590e1fbf1820463e97831c3b7b842a50e3a3f", "text": "First time filing a bug report, apologies if i missed anything or if this is a duplicate. Encountered this bug while writing some non-sensical associated function types. Searched around for any similar issues and the closest i found was , seems closely related? Minimal example: Playground link: The ICE happens on all channels it seems\nYes, I think so too. The snippet is rejected as expected on 1.42 but ICE occurs instead since 1.43.\nAssigning as and removing .", "commid": "rust_issue_74612", "tokennum": 99}], "negative_passages": []}
{"query_id": "q-en-rust-288de0beb712496a5ce473b849eb6e23b69a65e5183ee4df2ad17773e1743d87", "query": "pub fn is_file(&self) -> bool { self.0.is_file() } /// Test whether this file type represents a symbolic link. /// The result is mutually exclusive to the results of /// [`is_dir`] and [`is_file`]; only zero or one of these /// tests may pass. /// /// The underlying [`Metadata`] struct needs to be retrieved /// with the [`fs::symlink_metadata`] function and not the", "positive_passages": [{"docid": "doc-en-rust-841c374c26ec0bdd1a586472fd0ae2291029983d6d556f555f731cf4a1e9a2ad", "text": "should document that , , and are all mutually exclusive. (and that it may also be the case that none of them are true) Why? Because returns true for both files and symlinks to files, and this tends to make me paranoid that a will share similar characteristics and perhaps claim that both and . The only way to convince myself that FileType's behavior is indeed sane is to write a little test program---again. Surely I can't be alone in this.\nis calling not (and equivalent on Windows), so if the path is a symlink, then it returns the results based on what the symlink points to, not the symlink itself. So respects the same mutual exclusivity rules as . But yes, this ought to be documented, especially given that the mutually exclusive behavior may be surprising to Windows developers.\nSimilar goes for , which should document that these are always false for a obtained by calling on a symlink.\nWell you can always call on something that is not a symlink, in which case or could be true.", "commid": "rust_issue_48345", "tokennum": 223}], "negative_passages": []}
{"query_id": "q-en-rust-28ceae6a505a799cb0cdfda0ad0c5386fd09df6ae4ecf8fd1edc31793959f86b", "query": "f.write_str(\" \")?; if let Some(ref ty) = self.trait_ { match self.polarity { ty::ImplPolarity::Positive | ty::ImplPolarity::Reservation => {} ty::ImplPolarity::Negative => write!(f, \"!\")?, if self.is_negative_trait_impl() { write!(f, \"!\")?; } ty.print(cx).fmt(f)?; write!(f, \" for \")?;", "positive_passages": [{"docid": "doc-en-rust-b921a45413b1aa44aefde6a1e2f9495edf14e3237f659c8a40821edd680246c2", "text": "
use rustc_middle::ty::relate::{self, RelateResult, TypeRelation}; use rustc_middle::ty::{ self, error::TypeError, Binder, List, Region, Subst, Ty, TyCtxt, TypeFoldable, TypeSuperVisitable, TypeVisitable,", "positive_passages": [{"docid": "doc-en-rust-9ec80e44ebaabce20887dae6dd1463ae860ab91cdb87ad699e9909ad0d3cacdb", "text": "Sorry, this is not necessarily the smallest possible example. Please let me know if this is unhelpful and I'll come up with something more concise. Given the following code: The output in current stable (1.63.0) is: (Please note the \"expected closure with ... found closure with ...\" hint.) From 1.64 onwards, the expected/found hint is omitted: To me the 1.63 behaviour is preferable to that from 1.64+ as it can often be non-obvious where the differences lie.\nsearched nightlies: from nightly-2022-06-01 to nightly-2022-08-11 regressed nightly: nightly-2022-07-23 searched commit range: regressed commit: // FIXME(#99978) hide #[no_mangle] symbols for proc-macros let is_windows = self.sess.target.is_like_windows; let path = tmpdir.join(if is_windows { \"list.def\" } else { \"list\" });", "positive_passages": [{"docid": "doc-en-rust-54f4273d10d11d96b9f2f94f00732d5e546d1e058d700faf379e7d2aa39ca30f", "text": " $DIR/issue-40782.rs:12:10 | 12 | for i 0..2 { | ^ help: try adding `in` here error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-de6f996f7fb016e1fe843677824c262cbfed45eeaa2d574de621799108e91f44", "text": "Hello, with rustc 1.17.0-nightly ( 2017-03-22), the following code gives this error message: An improved error message could add a hint :\nCurrent output: 1) How would you want to improve upon this? Adding a suggestion? 2) To do so, we could use the same strategy as in : in , try to continue building the expression as if the keyword had been found. If we find further errors, we revert the state of the compiler to right after trying to continue and return the error from . Otherwise we cancel that one and create a new custom diagnostic: 3) or just modify the existing error with the proposed (so it looks like the 2 above). []:\nLooks like current output already is an improvement over the reported one, but eithwr 2 or 3 would make it even more obvious i guess. No strong opinions here\nSeems to me that the third error is the most clear (\"error: missing in loop\"); I suspect people using fancy pattern features will figure out what's going on.", "commid": "rust_issue_40782", "tokennum": 219}], "negative_passages": []}
{"query_id": "q-en-rust-2bb42eaaec1ddbf8e02820917a8769cd5e44f6e54a632fef193fc2bfd8ce0f79", "query": "if !types.is_empty() { write!(w, \"
\")?; for t in &types {", "positive_passages": [{"docid": "doc-en-rust-15d51eee6171597d0c54ba5ea8be63e7e03b40204325aef047fa5bb612f7b15e", "text": "A page like has many things that could be useful to link to. These should be possible to link to by clicking on: [x] The header [x] 's on a page. [x] at the top On it's hit or miss: [x] Examples [x] Associated Types [x] Required Methods [x] Implementors On [x] Provided Methods I don't have any big use cases but when I want to link to these for something like this bug I can't link to any specific line. I gotta say go to vec page, scroll 75% to bottom. Squint hard to see it.\nJust ran into this today; I'd really like to have links from the impls in the Implementors section to the source containing the impl.\nTriage: we always need more links....\nUpdate: Headers written in docs and (most) auto-generated headers are either fully hyperlinked or have a \"section marker\" symbol that shows up on hover. Major auto-generated page headers have links in the top of the sidebar of the page. Impl blocks do not have hyperlinks (yet); that's\nSince got merged and closed out , that was the last major request on this issue, so i'll close this out. If you think of something else that needs a hyperlinked header, feel free to open a new issue or reopen this one.", "commid": "rust_issue_24484", "tokennum": 302}], "negative_passages": []}
{"query_id": "q-en-rust-2bddce07701efe9faa35189b8bbed92ef2a7d209e8147aafd0a51d046a237502", "query": "|| found_assoc(tcx.types.u64) || found_assoc(tcx.types.u128) || found_assoc(tcx.types.f32) || found_assoc(tcx.types.f32); || found_assoc(tcx.types.f64); if found_candidate && actual.is_numeric() && !actual.has_concrete_skeleton()", "positive_passages": [{"docid": "doc-en-rust-7cf485ed15d633c74321c59073e4a77933817fd8d210147fa77cd0f61f139631", "text": "This line looks like a typo to me, should it be ? Originally posted by in Currently, it affects line 1684. $DIR/issue-63135.rs:3:16 | LL | fn i(n{...,f # | - - ^ | | | | | un-closed delimiter | un-closed delimiter error: expected field pattern, found `...` --> $DIR/issue-63135.rs:3:8 | LL | fn i(n{...,f # | ^^^ help: to omit remaining fields, use one fewer `.`: `..` error: expected `}`, found `,` --> $DIR/issue-63135.rs:3:11 | LL | fn i(n{...,f # | ---^ | | | | | expected `}` | `..` must be at the end and cannot have a trailing comma error: expected `[`, found `}` --> $DIR/issue-63135.rs:3:15 | LL | fn i(n{...,f # | ^ expected `[` error: expected `:`, found `)` --> $DIR/issue-63135.rs:3:15 | LL | fn i(n{...,f # | ^ expected `:` error: expected one of `->`, `where`, or `{`, found `` --> $DIR/issue-63135.rs:3:15 | LL | fn i(n{...,f # | ^ expected one of `->`, `where`, or `{` here error: aborting due to 6 previous errors ", "positive_passages": [{"docid": "doc-en-rust-0a7be5cf2cea72f18ba696f2cfce6d25c09ea6a0d25ee084f9f659dd6e191283", "text": "I'm seeing an internal compiler error on the following input (found by ): The error happens on stable, beta, and nightly.\nThe only early return I see that doesn't emit is here:\nApplying the most obvious patch, I get the following non-ICE output: The \"expected , found \" bit doesn't seem quite right. :slightlysmilingface:\nis an unfortunate side effect of the unmatched delimiter recovery logic not accounting for s. Submit a PR with this patch to fix this ICE as fixing the slightly misleading message will require a much larger (unrelated) change.\nI'll toss one up after I finish running the test suite. One thing: I'm not sure how to annotate the test. It looks like there's four errors that all point to EOF, but whatever I try to write, only one of them gets recognized as referring to that line.\nthis is what I did", "commid": "rust_issue_63135", "tokennum": 193}], "negative_passages": []}
{"query_id": "q-en-rust-2d04913175a532dae957de23db16c9bd7f12191fe26dda34a337a4d5fec64623", "query": " PRINT-BANG INPUT (DISPLAY): ; PRINT-BANG INPUT (DEBUG): TokenStream [ Group { delimiter: None, stream: TokenStream [ Punct { ch: ';', spacing: Alone, span: $DIR/issue-80760-empty-stmt.rs:25:17: 25:18 (#0), }, ], span: $DIR/issue-80760-empty-stmt.rs:13:21: 13:23 (#4), }, ] ", "positive_passages": [{"docid": "doc-en-rust-00a16e75b2da07497159a633bb6026bc5678ea714a8488545f2abb4a75530a50", "text": "This the the of a proc macro crate : And here is the of another crate: When building, this outputs: 49.0, 1.50.0-beta.5 rustc 1.51.0-nightly ( 2021-01-05) binary: rustc commit-hash: commit-date: 2021-01-05 host: x86_64-unknown-linux-gnu release: 1.51.0-nightly\ncc\ncc\nAssigning as discussed as part of the and removing .\nassigning to self to confirm if is the cause of the breakage, and if so, revert the PR until it can be revised to handle this case.\nThis is caused by us not handling properly - I'm working on a fix.\nOpened", "commid": "rust_issue_80760", "tokennum": 155}], "negative_passages": []}
{"query_id": "q-en-rust-2d0aac5e0c890bbeb51bcc0a7b007b54b2971632292fe79d509705da1723be7e", "query": " #![crate_type=\"lib\"] #[repr(i8)] pub enum Type { Type1 = 0, Type2 = 1 } // CHECK: define signext i8 @test() #[no_mangle] pub extern \"C\" fn test() -> Type { Type::Type1 } ", "positive_passages": [{"docid": "doc-en-rust-c135f8124ac2069f133445a3ae3e9d4045eb9b25bf71f08a805996b7f188c7fd", "text": " $DIR/issue-93093.rs:8:9 | LL | async fn bar(&self) { | ----- help: consider changing this to be a mutable reference: `&mut self` LL | LL | self.foo += 1; | ^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be written error: aborting due to previous error For more information about this error, try `rustc --explain E0594`. ", "positive_passages": [{"docid": "doc-en-rust-caccc86ea05c82b4784d4f33e0d69a34c707ad5dc92addab135eef6f05606b33", "text": "Given the following code: The current output is: $DIR/coherence-impl-trait-for-marker-trait-positive.rs:14:1 | LL | impl Marker1 for dyn Object + Marker2 { } //~ ERROR E0371 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker1` error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker2` --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:16:1 | LL | impl Marker2 for dyn Object + Marker2 { } //~ ERROR E0371 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker2` error[E0117]: only traits defined in the current crate can be implemented for arbitrary types --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:22:1 | LL | unsafe impl Send for dyn Marker2 {} //~ ERROR E0117 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate | = note: the impl does not reference only types defined in this crate = note: define and implement a trait or new type instead error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `(dyn Object + 'static)` --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:26:1 | LL | unsafe impl Send for dyn Object {} //~ ERROR E0321 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `(dyn Object + Marker2 + 'static)` --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:27:1 | LL | unsafe impl Send for dyn Object + Marker2 {} //~ ERROR E0321 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type error: aborting due to 5 previous errors Some errors occurred: E0117, E0321, E0371. For more information about an error, try `rustc --explain E0117`. ", "positive_passages": [{"docid": "doc-en-rust-3adfb6393ca18025566673bf3e326280a3becf37dd889014b110023469da691b", "text": "Code gives the same error as , giving (dyn Xyz + Abc + 'static)XyzCode passes coherence, but wfcheck fails because of the confusion:", "commid": "rust_issue_56934", "tokennum": 40}], "negative_passages": []}
{"query_id": "q-en-rust-2e3002a0c380ad61b6a4059336640e1e678c6901f22a1f0141ef00524a132b6e", "query": "E0696, // `continue` pointing to a labeled block // E0702, // replaced with a generic attribute input check E0703, // invalid ABI E0706, // `async fn` in trait // E0707, // multiple elided lifetimes used in arguments of `async fn` E0708, // `async` non-`move` closures with parameters are not currently // supported", "positive_passages": [{"docid": "doc-en-rust-20fe05308d0857ba5bb5c241ac5e9e4705de58a5184c32928f806542ec3d0b5b", "text": "we currently emit We should tell people that trait functions are not possible , and possibly point them to . $DIR/issue-102335-const.rs:4:17 | LL | type A: S = 34>; | ^^^^^^^^ associated type not allowed here error: aborting due to previous error For more information about this error, try `rustc --explain E0229`. ", "positive_passages": [{"docid": "doc-en-rust-242010517afb69b1e791421aa2d510d7720c198f4829b4c835dd1b7443b77273", "text": "I expect the following code to be rejected by the compiler but it is actually accepted and compiles successfully: The associated constant does not have any generic parameters / associated items (constants cannot have those anyways in the current version of Rust) and thus the argument list should be flagged as erroneous. Interestingly, if you remove the , the compiler correctly identifies this as an error: . I think is to be interpreted as a nested equality constraint (and not as a \u201cdefaulted\u201d parameter, i.e. a parameter with a default value). : label T-compiler requires-nightly (it now does) Hence, I am just going to mention its tracking issue: . CC $DIR/try-block-in-match.rs:6:11 | LL | match try { false } { _ => {} } | ----- ^^^ expected expression | | | while parsing this match expression error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-d03ab53e09be54af6f2060c02dede3b6c0e9e862953db046b716e90ff0e372f3", "text": "This produces a lint: But removing the parentheses produces an error. This bug was already mentioned in , but that issue is lost in feature-request purgatory since it asks for the version without parentheses to be allowed. I'm opening this issue to track the incorrect lint specifically. (Edit: Fixed the example.) $DIR/try-block-in-match.rs:6:11 | LL | match try { false } { _ => {} } | ----- ^^^ expected expression | | | while parsing this match expression error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-3ba5bb88027e7cecc79035147d0b62d98b80eadac1e1b9462a7357fbc041c450", "text": "The following code fails to compile (): The compiler error is: Adding parentheses or braces, it will compile fine: The same issue happens with other constructs such as:\ncc\nI believe the error is expected here, the same as with : Which also needs to be to compile. That said, the warning to remove the necessary parens is definitely wrong. EDIT: Hmm, I might be wrong, actually. The following compiles, which surprised me: as does this: So maybe the parser restriction is only for struct literals, not for keyword-introduced expressions.\nYeah I think is the better comparison here so it's probably a bug.\nThis is exactly what a thought. I didn't know that this:\nFor , hmmm... well, I can't come up with a truly devastating example, but eliminating the parentheses could hurt diagnostics.", "commid": "rust_issue_56828", "tokennum": 185}], "negative_passages": []}
{"query_id": "q-en-rust-2f3ce9e644cee8f1089f6fb80c7cf452641843904b4c4984ec22afe2c749d435", "query": "} #[test] #[cfg_attr(any(target_os = \"vxworks\", target_os = \"android\"), ignore)] #[cfg_attr(any(target_os = \"vxworks\"), ignore)] fn stdout_works() { if cfg!(target_os = \"windows\") { let mut cmd = Command::new(\"cmd\"); cmd.args(&[\"/C\", \"echo foobar\"]).stdout(Stdio::piped()); assert_eq!(run_output(cmd), \"foobarrn\"); } else { let mut cmd = Command::new(\"echo\"); cmd.arg(\"foobar\").stdout(Stdio::piped()); let mut cmd = shell_cmd(); cmd.arg(\"-c\").arg(\"echo foobar\").stdout(Stdio::piped()); assert_eq!(run_output(cmd), \"foobarn\"); } } #[test] #[cfg_attr(any(windows, target_os = \"android\", target_os = \"vxworks\"), ignore)] #[cfg_attr(any(windows, target_os = \"vxworks\"), ignore)] fn set_current_dir_works() { let mut cmd = Command::new(\"/bin/sh\"); let mut cmd = shell_cmd(); cmd.arg(\"-c\").arg(\"pwd\").current_dir(\"/\").stdout(Stdio::piped()); assert_eq!(run_output(cmd), \"/n\"); } #[test] #[cfg_attr(any(windows, target_os = \"android\", target_os = \"vxworks\"), ignore)] #[cfg_attr(any(windows, target_os = \"vxworks\"), ignore)] fn stdin_works() { let mut p = Command::new(\"/bin/sh\") let mut p = shell_cmd() .arg(\"-c\") .arg(\"read line; echo $line\") .stdin(Stdio::piped())", "positive_passages": [{"docid": "doc-en-rust-c2b5bb4cc8a2758cb2da845c98c56aa69b6ae72f2abf433dec53fb80eb5441a3", "text": "To enable test on android bot and test/run-pass/rtio- It looks to me RtioProcess does not work properly on android.\nlogs are\nHm this may be an FFI issue with libuv. I realized during my uv rewrite that libuv is giving us an int64t exit status and we think it's a cint. Once lands this may be fixed.\nHmm, this issue number has propagated to several more tests that are cfg-disabled on android. (Some of which are now failing when I mixed in a Boehm/BDW conservative GC into the runtime, in particular .)\nAlso, has landed, so it would be good to determine if these tests now work on Android.\nTriage: I have no idea how to test this, but a lot has changed in a year (especially the removal of green & libuv), so these may be magically fixed; if someone can check.\nTriage: is gone, but all these tests in are still ignored for android.\nI tried to run these tests with but they all failed with , which seems suspect (at least for the tests that invoke , , , etc.). Is there a better way to test? I have an android device available.", "commid": "rust_issue_10380", "tokennum": 267}], "negative_passages": []}
{"query_id": "q-en-rust-2f7d38fe58c2bfebf927d95a240b4815c6288769e4dd8c16c554f6603a91c6f6", "query": " // Regression test for #81899. // The `panic!()` below is important to trigger the fixed ICE. const _CONST: &[u8] = &f(&[], |_| {}); const fn f(_: &[u8], _: F) -> &[u8] where F: FnMut(&u8), { panic!() //~ ERROR: evaluation of constant value failed } fn main() {} ", "positive_passages": [{"docid": "doc-en-rust-05bc1c3fc1f6f5f6a91c0f75b9cb11e411f9692b9d3ff1ba748071875019444b", "text": "The following code causes compiler panics due to the first line without which the issue isn't reproducible. Calling the function outside of a constant context emits the right compiler errors. $DIR/issue-58094-missing-right-square-bracket.rs:4:4 | LL | #[\u0405 | - ^ | | | un-closed delimiter error: expected item after attributes --> $DIR/issue-58094-missing-right-square-bracket.rs:4:4 | LL | #[\u0405 | ^ error: aborting due to 2 previous errors ", "positive_passages": [{"docid": "doc-en-rust-9822b9c81be95fb5ecded752aa651bd0a7a9919b8a10c709893e3f89f7d1c822", "text": "Reproduction branch: When applying the change from the last commit I get a panic in my code during the call to . error: this file contains an un-closed delimiter --> $DIR/issue-58094-missing-right-square-bracket.rs:4:4 | LL | #[\u0405 | - ^ | | | un-closed delimiter error: expected item after attributes --> $DIR/issue-58094-missing-right-square-bracket.rs:4:4 | LL | #[\u0405 | ^ error: aborting due to 2 previous errors ", "positive_passages": [{"docid": "doc-en-rust-ac3dbfa281d32582226e878b0785bb55974db51b1cb751dfcd8608e64d3bd326", "text": "Bx::debugloc 11: rustccodegenssa::mir::codegenmir 12: rustccodegenssa::base::codegeninstance 13: rustccodegenssa::monoitem::MonoItemExt::define 14: rustccodegenllvm::base::compilecodegenunit::modulecodegen 15: rustc::depgraph::graph::DepGraph::withtask 16: rustccodegenllvm::base::compilecodegenunit 17: rustccodegenssa::base::codegencrate 18: error: this file contains an un-closed delimiter --> $DIR/issue-58094-missing-right-square-bracket.rs:4:4 | LL | #[\u0405 | - ^ | | | un-closed delimiter error: expected item after attributes --> $DIR/issue-58094-missing-right-square-bracket.rs:4:4 | LL | #[\u0405 | ^ error: aborting due to 2 previous errors ", "positive_passages": [{"docid": "doc-en-rust-3ec9e5e21694c83c332baa5dbe0997136c77e82bc74af3f6422b6f926b986d44", "text": "Has been fixed in\nis likely the part of the rollup fixing it.\nShouldn't a testcase be instead of closing this?\nA similar crash that still happens:", "commid": "rust_issue_58094", "tokennum": 34}], "negative_passages": []}
{"query_id": "q-en-rust-2fc051868684b25834e540738f2861a5bb14194bc80cdaaf24f1df977d27a5e6", "query": " error: this file contains an un-closed delimiter --> $DIR/issue-58094-missing-right-square-bracket.rs:4:4 | LL | #[\u0405 | - ^ | | | un-closed delimiter error: expected item after attributes --> $DIR/issue-58094-missing-right-square-bracket.rs:4:4 | LL | #[\u0405 | ^ error: aborting due to 2 previous errors ", "positive_passages": [{"docid": "doc-en-rust-ebea6140f1eb9c6aebe751a09f1aadf21a60bab3ba53df8d3812b6c41b56db38", "text": "I realize it's kinda nonsensical, but here:\nWhy didn't WF catch this?\nThat's because only checks statics/constants.\nStill reproducible with .\nThis ought to be a mostly easy fix. The problem is that the well formedness check, which ought to be rejected this code, is ignoring things in an : They fall through to this `` case: We would need to add support for the HIR item: which in turn has a number of items: which are defined here: presumably we want the to check that the types of are well-formed, roughly analogous to how we current check normal static items: (We probably want similar checks on foreign item fns, though?) One tricky part might be compatibility, we may need to turn this into a compatibility lint in case there is lots of broken code in the wild.\nI am trying to fix this bug, and need help moving forward. function is modified to accept a and a , yet it doesn't report any additional errors and the ICE prevails. Test file: Commit: Should I create a pull request or is it too early?\nLooks like suggestions are incomplete ( does not require ). Also, I left a comment on your commit about how you can avoid adding . I suspect the only reason regular s are required to be is they have an initializer (and that, not the type, requires ), i.e. for we have these errors:\nOddly, the PR that were previously posted to fix this (PR , following on PR ) was subsequently closed as inactive ... but the bug itself seems like it may have been resolved in the meantime?\nI'm going to assume this was fixed. Tagging as E-needstest, but if someone wants to take the time, it'd be even better to bisect to where this was fixed, and see if a regression test for this was at that time.\nCompiler no longer panics, tested with", "commid": "rust_issue_36122", "tokennum": 405}], "negative_passages": []}
{"query_id": "q-en-rust-2fcc33c22176acb9ff874f5e2f995045d842da2528b3d9e4fa823714fba5d71d", "query": "} } impl rustc_errors::IntoDiagnosticArg for PolyExistentialTraitRef<'_> { fn into_diagnostic_arg(self) -> rustc_errors::DiagnosticArgValue<'static> { self.to_string().into_diagnostic_arg() } } #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)] #[derive(HashStable)] pub enum BoundVariableKind {", "positive_passages": [{"docid": "doc-en-rust-fb31fb8cbe19cb730eefa7d9d8c5022d5e097cf6a7fffb14c1c0c46e713d90c7", "text": " $DIR/try-block-in-while.rs:6:11 error[E0277]: the trait bound `bool: std::ops::Try` is not satisfied --> $DIR/try-block-in-while.rs:6:15 | LL | while try { false } {} | ^^^ expected expression | ^^^^^^^^^ the trait `std::ops::Try` is not implemented for `bool` | = note: required by `std::ops::Try::from_ok` error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. ", "positive_passages": [{"docid": "doc-en-rust-d03ab53e09be54af6f2060c02dede3b6c0e9e862953db046b716e90ff0e372f3", "text": "This produces a lint: But removing the parentheses produces an error. This bug was already mentioned in , but that issue is lost in feature-request purgatory since it asks for the version without parentheses to be allowed. I'm opening this issue to track the incorrect lint specifically. (Edit: Fixed the example.) $DIR/try-block-in-while.rs:6:11 error[E0277]: the trait bound `bool: std::ops::Try` is not satisfied --> $DIR/try-block-in-while.rs:6:15 | LL | while try { false } {} | ^^^ expected expression | ^^^^^^^^^ the trait `std::ops::Try` is not implemented for `bool` | = note: required by `std::ops::Try::from_ok` error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. ", "positive_passages": [{"docid": "doc-en-rust-3ba5bb88027e7cecc79035147d0b62d98b80eadac1e1b9462a7357fbc041c450", "text": "The following code fails to compile (): The compiler error is: Adding parentheses or braces, it will compile fine: The same issue happens with other constructs such as:\ncc\nI believe the error is expected here, the same as with : Which also needs to be to compile. That said, the warning to remove the necessary parens is definitely wrong. EDIT: Hmm, I might be wrong, actually. The following compiles, which surprised me: as does this: So maybe the parser restriction is only for struct literals, not for keyword-introduced expressions.\nYeah I think is the better comparison here so it's probably a bug.\nThis is exactly what a thought. I didn't know that this:\nFor , hmmm... well, I can't come up with a truly devastating example, but eliminating the parentheses could hurt diagnostics.", "commid": "rust_issue_56828", "tokennum": 185}], "negative_passages": []}
{"query_id": "q-en-rust-30cc380df81c9d9df32374599ff62b4c8fc8de82cd4a3e78d5ade151dae91399", "query": ".iter() .enumerate() .filter(|x| x.1.hir_id == *hir_id) .map(|(i, _)| init_tup.get(i).unwrap()) .next() .find_map(|(i, _)| init_tup.get(i)) { self.note_type_is_not_clone_inner_expr(init) } else {", "positive_passages": [{"docid": "doc-en-rust-49f7f9434c8b6880119ba64b18ada18f4950029d6428478754d26bc34fb78e3e", "text": " $DIR/help-set-edition-ice-122130.rs:2:6 | LL | s#[c\"owned_box\"] | ^ expected one of `(`, `,`, `=`, `{`, or `}` | = note: you may be trying to write a c-string literal = note: c-string literals require Rust 2021 or later = help: pass `--edition 2021` to `rustc` = note: for more on editions, read https://doc.rust-lang.org/edition-guide error: expected item, found `\"owned_box\"` --> $DIR/help-set-edition-ice-122130.rs:2:9 | LL | s#[c\"owned_box\"] | ^^^^^^^^^^^ expected item | = note: for a full list of items that can appear in modules, see error: aborting due to 2 previous errors ", "positive_passages": [{"docid": "doc-en-rust-feabefe4a3dbfbf34d35a4b57f714f6e7d91da07198baf06d36a90fcb6238e4f", "text": " $DIR/issue-61963.rs:20:14 | LL | bar: Box, | ^^^ help: use `dyn`: `dyn Bar` | note: lint level defined here --> $DIR/issue-61963.rs:3:9 | LL | #![deny(bare_trait_objects)] | ^^^^^^^^^^^^^^^^^^ error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-20f696d3f868e72175817ce3cf0d73a0e5839e022980e8eebb0240818ac31c42", "text": "One of the many new (or newly enabled by default) warnings in Servo in today\u2019s Nightly: The suggestion is wrong, which means also fails and therefore does not apply fixes for (the many) other warnings where the suggestion is correct.\nTriage: Preliminarily assigning P-high before Felix reviews this.\nAlso cc since iirc you did some macro related work here.\nPossible solution: when a warning\u2019s span is exactly a macro invocation, don\u2019t emit a \u201csuggested fix\u201d that is likely wrong. (But still emit a warning.)\nWe have that check for most suggestions, but it might be missing for . Was this in latest nightly? I know a couple of these have been fixed in the past few weeks.\nThis is in rustc 1.37.0-nightly ( 2019-06-18). works around this and allows \u2019ing the rest of the warnings (namely old syntax for inclusive ranges) or warnings in other crates.\nOh. I just noticed the suggestion. I\u2019d missed it in that blob of text.\nApologies for the time this has taken - I've struggled to find time to dig in to this. So far, I've managed to make a smaller example (it still depends on , and ) that reproduces the issue, you can find it in (run in the directory).\nThanks to some help from I've now got a minimal test case w/out any dependencies that outputs the same tokens that the reduced example from servo did (you can see it in ). When inspecting the span that the lint is emitted for, it isn't marked as coming from a macro expansion, and it appears that it was created that way during the macro expansion. I'd appreciate any opinions on what the correct fix is here - is it a bug in / that they output what appears to be incorrect spans? Should rustc be able to handle this case? If so, where should I be looking to mark the span or what check should I be performing to identify it as a result of macro expansion?\ncc\nI believe this is a compiler bug, not something that needs a fix in syn or quote. is a call_site span. It is the span of tokens in macro output that are not attributable to any particular input token. Usually that will be most of the tokens in any macro output; diagnostics need to take this into account.", "commid": "rust_issue_61963", "tokennum": 505}], "negative_passages": []}
{"query_id": "q-en-rust-33beccab08511dcbaf85b08036652d487aeba0e3a4686e3ec8fcd0e16ea4717a", "query": " // Note: this test is paired with logo-class.rs. // @has logo_class_default/struct.SomeStruct.html '//*[@class=\"logo-container\"]/img[@class=\"rust-logo\"]' '' // @has logo_class_default/struct.SomeStruct.html '//*[@class=\"sub-logo-container\"]/img[@class=\"rust-logo\"]' '' pub struct SomeStruct; ", "positive_passages": [{"docid": "doc-en-rust-9e410d0c52842d5cac7cd514d0a48bc2e367ec3512a1a3670ab59e5c61ef2ff3", "text": "In RustCrypto crates we use which changes style depending on preferred theme using CSS rules. You can see the for an example which uses it. But the problem is how the logo gets rendered on dark themes: ! ! The reason for such horrible result is the white shadow filter applied to the logo. I understand why it was , but I think it's a wrong approach, especially for projects which aim to properly support dark themes in their media files.\nThere was a mention back when this was implemented about how it is not possible for a media query approach to work, when I look at the sha2 docs it looks like ! because I use a light theme generally in my browser, but have rustdoc explicitly set to a dark theme. I'm confused why the outline is being applied to these docs though, was meant to only apply it to the default rust logo, and I don't see any relevant newer PRs when searching for .\nI believe I broke this in In we are supposed to apply the class only when the logo is the default one. In I missed that distinction and now the always gets the rust-logo class, even when it's a custom logo. I'll fix.\nBy the way, to confirm what said: the media query embedded in the SVG isn't really right. That gets the browser's preferred light/dark mode, but the user may have overridden that in rustdoc settings. As a concrete example, I'm using Chrome on Linux, which doesn't have a light/dark mode setting. I can select a dark theme in rustdoc settings, which will get me this for the Rust Crypto logo (with applied): ! That's still an improvement over the status quo, and overall I think it's fine. But if we really wanted to support theme-sensitive logos perfectly, I think we'd need to offer separate configuration options for a light logo and a dark logo.\nI believe that the media query approach is a correct one in principle. But I agree that, unfortunately, the current state of browsers is far from ideal, e.g. it would be nice to have a way to switch preferred mode for a page using CSS or JS. I'm using Chrome on Linux, which doesn't have a light/dark mode setting Well, it kind of has. Try launching it with (I don't have Chrome installed, but I think it should work similarly).", "commid": "rust_issue_91653", "tokennum": 511}], "negative_passages": []}
{"query_id": "q-en-rust-33cdb08f334a71c0e69ab4f51e02f2e1c6a34120a8f8de9ac762efd8958a740f", "query": ".and_modify(|e| { *e = (e.0.clone(), Some(rhs.ty().unwrap().clone())) }) .or_insert((None, Some(rhs.ty().unwrap().clone()))); .or_insert(( PolyTrait { trait_: trait_.clone(), generic_params: Vec::new(), }, Some(rhs.ty().unwrap().clone()), )); continue; }", "positive_passages": [{"docid": "doc-en-rust-7d14553b985fdabc964c1c42351cefeda5dded8f0f8c342baa05cb27120b5584", "text": "No crash in stable 1.62.1, crashes with nightly 2022-07-24 and 2022-08-03 : $DIR/default-body-type-err.rs:7:22 | LL | fn lol(&self) -> impl Deref { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found struct `String` LL | LL | &1i32 | ----- return type was inferred to be `&i32` here error: aborting due to previous error For more information about this error, try `rustc --explain E0271`. ", "positive_passages": [{"docid": "doc-en-rust-e1838224373158e197cafaed141b1ad954292771dbb0c0a51169bcc3abc5a881", "text": "Here's a MVCE: I expected to see this happen: compilation fails because I'm clearly returning an instead of a Instead, this happened: bad codegen (\"async fn resumed after completion\") :\nThis is specifically a bug with default body in traits, this doesn't happen in s. I'll check it out, it's probably a very simple fix.", "commid": "rust_issue_103352", "tokennum": 82}], "negative_passages": []}
{"query_id": "q-en-rust-34788456920d71883b72f1bb371883b1f75aee5b2cfd184d07f33d6d2aefc516", "query": " trait Trait {} impl Trait for i32 {} // Since `Assoc` doesn't actually exist, it's \"stranded\", and won't show up in // the list of opaques that may be defined by the function. Make sure we don't // ICE in this case. fn produce() -> impl Trait { //~^ ERROR associated type `Assoc` not found for `Trait` 16 } fn main () {} ", "positive_passages": [{"docid": "doc-en-rust-7858393efb3f35da9a78c64fed45328547f35e6e34777b842cef248ed52b397a", "text": " $DIR/issue-28575.rs:8:5 | LL | FOO() | ^^^ use of extern static | = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior error: aborting due to previous error For more information about this error, try `rustc --explain E0133`. ", "positive_passages": [{"docid": "doc-en-rust-839672284c70e13ee9c8ea407d9e1e5d7bfc21822eb1ca668c42df05b32f7991", "text": "rustc+cargo 1.40.0 Debian testing packages report the following ICE (which does not go away after a cargo clean): It can be reproduced by trying to build against\nCan you try this on nightly?\nOnce the ICEBreakers-CleanupCrew is announced (which I think will be happening very soon), we should advertise this bug on it (at least the reduction to MCVE part of it); see\ntriage: P-high for initial investigation (i.e. identifying actual severity), removing nomination.\nping icebreakers-cleanup-crew\nHey Cleanup Crew ICE-breakers! This bug has been identified as a good \"Cleanup ICE-breaking candidate\". In case it's useful, here are some [instructions] for tackling these sorts of bugs. Maybe take a look? Thanks! <3 [instructions]: https://rust- cc\nNote that when I had a go at building on my Mac laptop, it failed with this message: This is due to in the source crate: So if you are on a Mac laptop, it may or may not be worth your effort to investigate this. (It is probably easy to work around, but I figure I'd let people know up front.)\nOops, right, you'll want to just drop that line. It shouldn't have any other effect, its only there due to (at least previously, based on my super-cursory read) libstd calling regular fsync() on OSX, which historically, well, didn't fsync.\nI looked at this a bit more. I see the ICE on stable and beta. I do not see the ICE on nightly.", "commid": "rust_issue_68813", "tokennum": 352}], "negative_passages": []}
{"query_id": "q-en-rust-347db88b9583cffb99f514a6abdc7080778fc486bcce9801ef67e394bb032380", "query": " error[E0133]: use of extern static is unsafe and requires unsafe function or block --> $DIR/issue-28575.rs:8:5 | LL | FOO() | ^^^ use of extern static | = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior error: aborting due to previous error For more information about this error, try `rustc --explain E0133`. ", "positive_passages": [{"docid": "doc-en-rust-bf11d175cac53e4311b91032fca7721e4ae07df1ae1c3d217747b76f2b780e23", "text": "On nightly, I instead get the following error: error[E0133]: use of extern static is unsafe and requires unsafe function or block --> $DIR/issue-28575.rs:8:5 | LL | FOO() | ^^^ use of extern static | = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior error: aborting due to previous error For more information about this error, try `rustc --explain E0133`. ", "positive_passages": [{"docid": "doc-en-rust-36393fc0942fda621374bc29f1fc43a3537108ec899e36d6b2125f94ffa7d3ea", "text": "Take the following code: Attempting to compile this results in the following: I think the compiler should fail with something along the lines of \"you attempted to use a complex type () where I expected an immediate\".\nedit: not sure if these symptoms are the same, but here's what I stumbled across. The following code generates a similar result for me: The and struct seem to be required, else the ICE is not triggered. Output\nNo longer reproduces:", "commid": "rust_issue_54067", "tokennum": 97}], "negative_passages": []}
{"query_id": "q-en-rust-347db88b9583cffb99f514a6abdc7080778fc486bcce9801ef67e394bb032380", "query": " error[E0133]: use of extern static is unsafe and requires unsafe function or block --> $DIR/issue-28575.rs:8:5 | LL | FOO() | ^^^ use of extern static | = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior error: aborting due to previous error For more information about this error, try `rustc --explain E0133`. ", "positive_passages": [{"docid": "doc-en-rust-8d64666f6e9f45f6aa33ef424d93b8d3217771e86d37cf1aec3cbc8f3c7478e9", "text": "We handle intrinsics in an odd way, we \"inline\" them in the current crate, and this might be a symptom of that twisted logic.\nintrinsic-ABI functions should probably be disallowed as function pointers. That is, you should only be allowed to call them. This is the current situation, as calls to intrinsics actually just generate code at the call site.\nThat's not the problem, really, I believe we already have code to generate the shims. The problem is that we don't resolve intrinsics sanely and we rely on the ABI in the type, instead of always dealing with the paths to them and whatnot.\nI don't think we have code for creating the shims, even. It's more that the ABI isn't actually defined anywhere, and we use an alternate callee to avoid generating an actual call.\nWe haven't had code for generating shims around intrinsics for a long time. As alludes to, this is because in almost all cases the actual function would be one or two instructions long. This is consistent with how C/C++ compilers handle intrinsics, generating code inline. Best I can tell, whether or not a given intrinsic can be used as a function in C is dependent on the intrinsic in question.\nNo longer ICEs ()\nIt requires now.\nAh, ok. Still no longer ICEs, but fails with a linker error (), if the distinction matters.\nI think this has been fixed -- marking as E-needstest. Did you mean to self-assign this?\nThis seems like it could be made into an easy issue for newcomers.\nThis is now caught by .", "commid": "rust_issue_28575", "tokennum": 351}], "negative_passages": []}
{"query_id": "q-en-rust-347db88b9583cffb99f514a6abdc7080778fc486bcce9801ef67e394bb032380", "query": " error[E0133]: use of extern static is unsafe and requires unsafe function or block --> $DIR/issue-28575.rs:8:5 | LL | FOO() | ^^^ use of extern static | = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior error: aborting due to previous error For more information about this error, try `rustc --explain E0133`. ", "positive_passages": [{"docid": "doc-en-rust-1c982a41aa5e5e03f17f9f5e9d5cf180407577a343c935f659fc76d760cb3e06", "text": "rustc just crashes with no useful errors. I guess you're not supposed to be able to do this anyway and it works if either are const instead of static but it shouldn't crash. Tested with latest nightly and 1.0.0-beta.2 on windows 64-bit.\nNo longer crashes:\nE-needstest.\nTriage: not aware of any tests being .\nIt seems that the E0394 error was removed in and the tests were moved from compile-fail and ui/error-codes to run-pass.", "commid": "rust_issue_24843", "tokennum": 113}], "negative_passages": []}
{"query_id": "q-en-rust-34856d4ceffe671d859ae3f2c9d41d45f5f5311c56f863e5a04717741bd4167c", "query": "// *in Rust code* may unwind. Foreign items like `extern \"C\" { // fn foo(); }` are assumed not to unwind **unless** they have // a `#[unwind]` attribute. } else if !cx.tcx.is_foreign_item(id) { } else if id.map(|id| !cx.tcx.is_foreign_item(id)).unwrap_or(false) { Some(true) } else { None", "positive_passages": [{"docid": "doc-en-rust-ad196fb6cb054541993f1275f9a4a2da8386c43f1992eaae7f583a58ec239fe0", "text": "and are both broken on s390x since Rust 1.28. When is built without debuginfo, the tests hang with their backtracing processes stuck in a loop. With debuginfo, it fails with output like: I believe the problem is this part of : where doesn't identify that is a 64-bit platform. See also alexcrichton/backtrace-rs. I plan to update that here when it's published, and make a similar fix in .\nfixes the backtrace when is built with debuginfo, but I'm still getting a hang without. In GDB, it looks like the unwinder gets to the that catches panics, then loops unwinding that same PC forever. This part of the regression is older -- happens on 1.27.2 as well, but 1.26.2 is fine. Binaries from the older version don't appear to have a distinct symbol at all, but maybe that's just inlined differently. I'm bisecting for that hang now.\nBisecting pointed me at (cc which attributes to all functions. For s390x the base features actually include a removal, . But it doesn't look like the features are applied to the synthesized (), and as a result it doesn't get inlined anymore since it has more features (w/ ) than the callee. We probably should apply target-features to as well. I don't know why the non-inlined can't be unwound -- maybe we need to force ? By default GDB backtrace stops at crate , but tries to go further: Maybe Rust's could have a similar defensive check, at least.\nNice find Definitely makes sense to me, and this should be fixed up (at least the business) in\nWith , , and , I believe we have this fixed.", "commid": "rust_issue_53372", "tokennum": 397}], "negative_passages": []}
{"query_id": "q-en-rust-34c1a30035a567b06342242ed6305a19e6f7ad8fe766c3e33e3f24db64428f03", "query": "Box::new(MaybeUninit::uninit()) } // FIXME: add a test for a bigger box. Currently broken, see // https://github.com/rust-lang/rust/issues/58201. // https://github.com/rust-lang/rust/issues/58201 #[no_mangle] pub fn box_uninitialized2() -> Box> { // CHECK-LABEL: @box_uninitialized2 // CHECK-NOT: store // CHECK-NOT: alloca // CHECK-NOT: memcpy // CHECK-NOT: memset Box::new(MaybeUninit::uninit()) } // Hide the LLVM 15+ `allocalign` attribute in the declaration of __rust_alloc // from the CHECK-NOT above. We don't check the attributes here because we can't rely", "positive_passages": [{"docid": "doc-en-rust-db5010fa07937cc8ec55da8581aa70488a1cc754c5c4362fdd4036fbd98c0e39", "text": "The following code generates some really awful LLVM IR: The same happens with . Cc who made me write these tests, and\nFeels like an LLVM limitation to me. It should be replacing the with a (or a of poison when that becomes available).\nFor reference: LLVM is capable of optimizing a memcpy of undef alloca away, this just runs into the usual limitation that all of memcpyopt doesn't work across BBs.\nThis is such a long-standing issue. Seems like it might be wise to have someone working on fixing this.\nSomeone has already worked on this, see It's a bit hard to track, but unfortunately this got reverted again (multiple times). I suspect that this is only going to get really resolved once memcpyopt moves to memssa -- which someone has also worked on in the past (), but which never really went anywhere.\nThe alloca and memcpy are no longer present on nightly, as a result of .\nThe FIXME in the test is still there, needs a test.", "commid": "rust_issue_58201", "tokennum": 227}], "negative_passages": []}
{"query_id": "q-en-rust-34e2179e87e44d531ab23142a444bbed8fb811809b8dc2e21b05fe43484e2f08", "query": "addClass(search, \"hidden\"); removeClass(main, \"hidden\"); document.title = titleBeforeSearch; // We also remove the query parameter from the URL. if (browserSupportsHistoryApi()) { history.replaceState(\"\", window.currentCrate + \" - Rust\", getNakedUrl() + window.location.hash); } } // used for special search precedence", "positive_passages": [{"docid": "doc-en-rust-642b78a825244eca8e5640e0bf04a7fc41aa2742603a9004fce63f980b2209e0", "text": "mdbook v4.6+ has a feature that pressing ESC removes query components from URLs (for example ). The feature was implemented in rust-lang/mdBook. It would be nice if rustdoc offers the same kind of that feature. This is, for example, an URL that contains query components in rustdoc: When users share URLs to an API, they don't have to remove the query manually.\ncould you share some thoughts about this feature request? If possible, could you mentor contributors how to implement this ?\nI think it's a good idea. Gonna take a look at how to do it.\nCan we reopen this issue ? I think only removes the query component when we remove keywords in search bar. This issue is about adding a keyboard shortcut.\nOh I see, my bad. Reopening!", "commid": "rust_issue_81330", "tokennum": 176}], "negative_passages": []}
{"query_id": "q-en-rust-34e6f1ffad1d627e106766e0f2d20d33c41289f2f1d297e5fa1a39981b03a7e6", "query": "self.parent_scope.module = old_module; } else { match &item.kind { ItemKind::Impl(box ast::Impl { of_trait: Some(..), .. }) => { ItemKind::Impl(box ast::Impl { of_trait: Some(trait_ref), .. }) => { if let Some(partial_res) = self.resolver.get_partial_res(trait_ref.ref_id) && let Some(res) = partial_res.full_res() && let Some(trait_def_id) = res.opt_def_id() && !trait_def_id.is_local() && self.visited_mods.insert(trait_def_id) { self.resolve_doc_links_extern_impl(trait_def_id, false); } self.all_trait_impls.push(self.resolver.local_def_id(item.id).to_def_id()); } ItemKind::MacroDef(macro_def) if macro_def.macro_rules => {", "positive_passages": [{"docid": "doc-en-rust-5e1457ed46dc36ef23bc76aece6678c1e267d2f600245cabe0830f3c83ccac57", "text": " $DIR/issue-36400.rs:15:12 | 14 | let x = Box::new(3); | - consider changing this to `mut x` 15 | f(&mut *x); | ^^ cannot borrow as mutable error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-e2d514b3ac5fe1a815810419f292fcdd5ece9db526736f98c2a35aaf6fe42ba6", "text": "This code: produces a helpful error message: But the analogous code using a : gives an error which doesn't point at the binding :\nThis is fixed today. I'm going to mark as E-needstest since it feels like the kind of thing that's easy to regress on -- a UI test would be best here.", "commid": "rust_issue_36400", "tokennum": 70}], "negative_passages": []}
{"query_id": "q-en-rust-3649528ba598b8a6e72900bdf35539f64d05e0caefdc9503310d3b63a77d1413", "query": " error[E0596]: cannot borrow immutable `Box` content `*x` as mutable --> $DIR/issue-36400.rs:15:12 | 14 | let x = Box::new(3); | - consider changing this to `mut x` 15 | f(&mut *x); | ^^ cannot borrow as mutable error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-3afc5bc072bb2b8771e7c4fe387cbbbfea5e57c6a0d97548517894d018c1b651", "text": "Before , this caused an LLVM error Afterwards, this causes an ICE (the rustc size is the correct one):\nI am now getting a segfault in LLVM, but I'm uncertain whether that's actually the case, or just a local build problem.\nLooks like called on a NULL pointer? Probably some missing check that something is indeed unsized, with actual metadata to go alongside it.\nAppears to be fixed today. E-needstest.\nIt seems that a better diagnostic output is needed:\nWhy? I believe it's implemented as a feature now (maybe it should be ?).\nit's unrelated to this issue, but rather to 's solution, merits at least a clarifying label pointing at the , as otherwise the compiler output makes you look at the following line exclusively, which isn't the cause for the . I know it definitely confused me_ :) Back to this issue, yes, the test in should be .", "commid": "rust_issue_33241", "tokennum": 199}], "negative_passages": []}
{"query_id": "q-en-rust-3649528ba598b8a6e72900bdf35539f64d05e0caefdc9503310d3b63a77d1413", "query": " error[E0596]: cannot borrow immutable `Box` content `*x` as mutable --> $DIR/issue-36400.rs:15:12 | 14 | let x = Box::new(3); | - consider changing this to `mut x` 15 | f(&mut *x); | ^^ cannot borrow as mutable error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-6e5c07cea71dc6905609748ea4340f7351f42d98781df48e66bff4af73010fc6", "text": "Triage: this no longer ICEs. version = \"0.4.0\" version = \"0.4.2\" source = \"registry+https://github.com/rust-lang/crates.io-index\" checksum = \"de11a9d32db3327f981143bdf699ade4d637c6887b13b97e6e91a9154666963c\" checksum = \"01667f6f40216b9a0b2945e05fed5f1ad0ab6470e69cb9378001e37b1c0668e4\" dependencies = [ \"object 0.36.2\", ]", "positive_passages": [{"docid": "doc-en-rust-1f673285a43136ad2090db8d847211c32d41543f164f0d850ed81f8ccbb8fee7", "text": " $DIR/issue-71546.rs:12:27 | LL | let csv_str: String = value | ___________________________^ LL | | .into_iter() LL | | .map(|elem| elem.to_string()) | |_____________________________________^ | = help: consider adding an explicit lifetime bound `<&'a V as IntoIterator>::Item: 'static`... = note: ...so that the type `<&'a V as IntoIterator>::Item` will meet its required lifetime bounds... note: ...that is required by this bound --> $DIR/issue-71546.rs:10:55 | LL | for<'a> <&'a V as IntoIterator>::Item: ToString + 'static, | ^^^^^^^ error: aborting due to previous error For more information about this error, try `rustc --explain E0310`. ", "positive_passages": [{"docid": "doc-en-rust-4b12459aa4160235b2bed24a8d87754192a57e3dfca47af4d7e16b90411a52fd", "text": "Playground: UPDATE: MCVE is here: Code: Crashes compiler with\nWould be nice to figure out if this is a regression or not and if it is when has this regressed. ping cleanup\nHey Cleanup Crew ICE-breakers! This bug has been identified as a good \"Cleanup ICE-breaking candidate\". In case it's useful, here are some [instructions] for tackling these sorts of bugs. Maybe take a look? Thanks! <3 [instructions]: https://rustc-dev- cc\nIt has been present since at least 2019-08-01 according to bisect-rustc\nSimplified code to remove dependencies This compiles for 1.20.0 and not for 1.30.0 (setting edition to 2015) I'll try and pinpoint at least the version where it causes the ICE\nFrom what I can tell the first time this ICE would happen is in 1.24.0\nAssigning\nEven simpler:\nTriage: This ICE has been fixed in the latest nightly, I assume it's fixed by . Marking as .\nWait, the original code and still triggers the ICE... glacier was tracking with but it seems the others encounter another roadblock. Dropping .\nNo longer ICEs since , likely from", "commid": "rust_issue_71546", "tokennum": 256}], "negative_passages": []}
{"query_id": "q-en-rust-37ef005a0d5e1ff2b5fd6b0287bd243ab156c4c8c78eeab282ac933d977dfd25", "query": "#![feature(cfg_target_has_atomic)] #![feature(cfg_target_thread_local)] #![feature(char_error_internals)] #![feature(char_internals)] #![feature(clamp)] #![feature(concat_idents)] #![feature(const_cstr_unchecked)]", "positive_passages": [{"docid": "doc-en-rust-e307da6e22effc6471fbe7ca95dec90cf767f43c91ce33946de3c12d7a31228b", "text": "The following program causes UB: Miri says: The problem is this code: This calls unless the new code point is in , but what about surrogates in ? This code is unchanged since its introduction in I am not sure what the intended safety contract of is. That method is not marked but clearly should be -- it calls . So my guess is the safety precondition is that must not be part of a surrogate pair, but the thing is, calls it without actually ensuring that condition. The condition it does ensure is that the codepoint is not in , but that does not help.\nis excluded from Unicode scalar values a.k.a. , but it\u2019s fine as a Unicode code point. I think this bug is not in the contract of (which is private anyway) but in its implementation, namely going through . The fix is to either duplicate the logic of into , or (to avoid duplication) move that logic to a new function in libcore that takes a parameter and that is called by both and . This function would need to be public because is in a different crate, but it should be prema-unstable and .\nI would classify the priority of this bug as low. Although this call to is UB, I expect Miri checking for it explicitly is the only case where that has any consequence in today\u2019s implementation: behaves as expected (for the purpose of WTF-8) in the surrogate range and does not exploit this UB The \"layout\" of in rustc excludes values beyond but not surrogates:\nBy the way, the docs at feel insufficient: Which values are invalid? Similarly, and say that represents Unicode Scalar values, but I couldn\u2019t find it documented anywhere that constructing an out of range is Undefined Behavior rather than \"merely\" a logic bug. Is this specified elsewhere? What is the closest we have to a written down normative resource that specifies what is or isn\u2019t UB in the the Rust language? (For APIs I assume this is the responsibility of their respective doc-comments.)\nI agree the impact is low, but it's not just Miri -- this blocks , which is how I discovered the problem. That would be\nBut then what is \"unchecked\" about it? Elsewhere in that file the code is careful not to construct a from a without checking for surrogates: That made me assume the author was aware that surrogates in are UB.", "commid": "rust_issue_72760", "tokennum": 512}], "negative_passages": []}
{"query_id": "q-en-rust-37ef005a0d5e1ff2b5fd6b0287bd243ab156c4c8c78eeab282ac933d977dfd25", "query": "#![feature(cfg_target_has_atomic)] #![feature(cfg_target_thread_local)] #![feature(char_error_internals)] #![feature(char_internals)] #![feature(clamp)] #![feature(concat_idents)] #![feature(const_cstr_unchecked)]", "positive_passages": [{"docid": "doc-en-rust-c4235d6c16bdd29f446d0eff1402f6bcc6fb5045667a71b53fdeccadc3bee59b", "text": "The type contains a (generalized-UTF-8-encoded) sequence of code point (including potentially surrogates) that doesn\u2019t form a surrogate pair. doesn\u2019t check for surrogate pairs. is a public method that is documented as returning a scalar value, therefore excluding all surrogates. Ok I looked into it, there are three different people involved. The original code in 2014 was YOLO Later in 2014, moved to duplicating logic instead. In 2015, PR which first imported WTF-8 support in libstd deduplicated that logic by adding a function that takes . (I knew that approach sounded familiar\u2026) In 2016, PR changed the signature of and in passing removed . It made use + instead, presumably in the middle of updating many callers other.\nOkay, so the fix would be to revert the part of that removed ?\nThat or copy into . I find them both not great, so meh.\nEven with that done, there's still UB in another testcase: This is converting something to a before calling -- so probably the same issue as the above, just for a different encoding.", "commid": "rust_issue_72760", "tokennum": 242}], "negative_passages": []}
{"query_id": "q-en-rust-381c86e22eede4c19910636a9560f397ec9c98b858eec22247df5ff4d3b74f0e", "query": "), .. }) => { let hir::Ty { span, .. } = inputs[local.index() - 1]; let hir::Ty { span, .. } = *inputs.get(local.index() - 1)?; Some(span) } _ => None,", "positive_passages": [{"docid": "doc-en-rust-4bf5f8d2ef5417a14a40f563aba63558639ebd746623d7c5fb08fb136da5bdff", "text": " $DIR/issue-89333.rs:6:5 | LL | test(&|| 0); | ^^^^ the trait `for<'a> Trait` is not implemented for `&'a _` | note: required by a bound in `test` --> $DIR/issue-89333.rs:11:55 | LL | fn test(arg: &impl Fn() -> T) where for<'a> &'a T: Trait {} | ^^^^^ required by this bound in `test` error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. ", "positive_passages": [{"docid": "doc-en-rust-5aa635099fb5d7fcf7fcbf30cf4a36069b9db82f788dacaa9aa3e205279b0665", "text": " $DIR/dont-record-adjustments-when-pointing-at-arg.rs:26:37 | LL | ns_window.setFrame_display_(0); | ----------------- ^ expected `()`, found integer | | | arguments to this method are incorrect | note: method defined here --> $DIR/dont-record-adjustments-when-pointing-at-arg.rs:5:8 | LL | fn setFrame_display_(self, display: ()) {} | ^^^^^^^^^^^^^^^^^ ----------- error: aborting due to previous error For more information about this error, try `rustc --explain E0308`. ", "positive_passages": [{"docid": "doc-en-rust-a8330ee981d0f9818c626d87a5e2d8ceda48b1300780bdd03ad7a226a0963b19", "text": " $DIR/moved-value-on-as-ref-arg.rs:27:16 | LL | let bar = Bar; | --- move occurs because `bar` has type `Bar`, which does not implement the `Copy` trait LL | foo(bar); | --- value moved here LL | let _baa = bar; | ^^^ value used here after move | help: borrow the value to avoid moving it | LL | foo(&bar); | + error[E0382]: use of moved value: `bar` --> $DIR/moved-value-on-as-ref-arg.rs:30:16 | LL | let mut bar = Bar; | ------- move occurs because `bar` has type `Bar`, which does not implement the `Copy` trait LL | qux(bar); | --- value moved here LL | let _baa = bar; | ^^^ value used here after move | note: if `Bar` implemented `Clone`, you could clone the value --> $DIR/moved-value-on-as-ref-arg.rs:5:1 | LL | struct Bar; | ^^^^^^^^^^ consider implementing `Clone` for this type ... LL | qux(bar); | --- you could clone this value help: borrow the value to avoid moving it | LL | qux(&mut bar); | ++++ error[E0382]: use of moved value: `bar` --> $DIR/moved-value-on-as-ref-arg.rs:33:16 | LL | let bar = Bar; | --- move occurs because `bar` has type `Bar`, which does not implement the `Copy` trait LL | bat(bar); | --- value moved here LL | let _baa = bar; | ^^^ value used here after move | help: borrow the value to avoid moving it | LL | bat(&bar); | + error[E0382]: use of moved value: `bar` --> $DIR/moved-value-on-as-ref-arg.rs:36:16 | LL | let mut bar = Bar; | ------- move occurs because `bar` has type `Bar`, which does not implement the `Copy` trait LL | baz(bar); | --- value moved here LL | let _baa = bar; | ^^^ value used here after move | note: if `Bar` implemented `Clone`, you could clone the value --> $DIR/moved-value-on-as-ref-arg.rs:5:1 | LL | struct Bar; | ^^^^^^^^^^ consider implementing `Clone` for this type ... LL | baz(bar); | --- you could clone this value help: borrow the value to avoid moving it | LL | baz(&mut bar); | ++++ error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0382`. ", "positive_passages": [{"docid": "doc-en-rust-f2c663719f9da5886e1d193c570fe8b8ac024e174dbe93e4c352c11b7859e5a3", "text": "... and trying to use afterwards, which triggers Example: currently yields I suggest that it should also contain\nAsRef is a library trait, so IMO we should not do that. Also to me \"value moved here\" is pretty much the \"you need to use this as reference\".\nWhile this might be obvious to us, I've had students struggling strongly with these errors. When I tell them \"just add an ampersand\", they're like \"Oh, that makes total sense\". I don't see that as reason not to do it. Could you elaborate?\nThis should also handle , , .\nand aren't as clear, since the object will be modified, so the user might also want to , but that can later be signalled through and/or multiple suggestions\nObvious way of doing this would involve making a language item or otherwise special in some other way. To me it is pretty clear that language and the standard library should be as independent as possible and IME a diagnostic is a pretty minor gain for the special casing involved. One could imagine a similar diagnostic independent of library traits (e.g. always suggest a reference for \"value moved here\" if there\u2019s a trait implementation for also), but then the problem of suggestion not being always correct kicks in. So, I will not oppose a change that implements this without making any more of the libstd/libcore special and is always correct, but I have no idea how anybody even begin approaching this problem.\nI fully agree that that is not desirable In clippy we have similar diagnostics which in this case would simply check for (see for all the paths that we resolve manually).\nTriage: this still produces the same error message. Given the concerns voiced above, should this issue stay open? I suppose we could leave this open should someone come up with a clever way to handle this without special casing , but that seems unlikely.\nWe have diagnostic items nowadays, so we can make a diagnostic item and detect in in these situations. Though I'm not sure how easy it is to detect. The error may get reported far too late\nCurrent :", "commid": "rust_issue_41708", "tokennum": 442}], "negative_passages": []}
{"query_id": "q-en-rust-3b82876b225192a9e4609e676aa7f1a4101f6f25a838030a4fe67414b8f28143", "query": " // compile-flags: -Z unstable-options --document-hidden-items // test for trait methods with `doc(hidden)` with `--document-hidden-items` passed. #![crate_name = \"foo\"] // @has foo/trait.Trait.html // @has - '//*[@id=\"associatedtype.Foo\"]' 'type Foo' // @has - '//*[@id=\"associatedtype.Bar\"]' 'type Bar' // @has - '//*[@id=\"tymethod.f\"]' 'fn f()' // @has - '//*[@id=\"tymethod.g\"]' 'fn g()' pub trait Trait { #[doc(hidden)] type Foo; type Bar; #[doc(hidden)] fn f(); fn g(); } // @has foo/struct.S.html // @has - '//*[@id=\"associatedtype.Foo\"]' 'type Foo' // @has - '//*[@id=\"associatedtype.Bar\"]' 'type Bar' // @has - '//*[@id=\"method.f\"]' 'fn f()' // @has - '//*[@id=\"method.g\"]' 'fn g()' pub struct S; impl Trait for S { type Foo = (); type Bar = (); fn f() {} fn g() {} } ", "positive_passages": [{"docid": "doc-en-rust-ae2f3809a3448ca28d0487a8bcd6acd7ef75776ebeb46486755709291f398dea", "text": " $DIR/universal_wrong_hrtb.rs:5:73 | LL | fn test_argument_position(x: impl for<'a> Trait<'a, Assoc = impl Copy + 'a>) {} | ^^ | note: lifetime declared here --> $DIR/universal_wrong_hrtb.rs:5:39 | LL | fn test_argument_position(x: impl for<'a> Trait<'a, Assoc = impl Copy + 'a>) {} | ^^ | -- lifetime declared here ^^ error: aborting due to previous error", "positive_passages": [{"docid": "doc-en-rust-06e6378ba44e05509101e46992e2d4c5728912b15a9ea7133d4ed50005836ad1", "text": " $DIR/issue-54779-anon-static-lifetime.rs:34:24 | LL | cx: &dyn DebugContext, | - let's call the lifetime of this reference `'1` ... LL | bar.debug_with(cx); | ^^ cast requires that `'1` must outlive `'static` error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-abe457d642bc3cd730379ed4ef796a16e86b4b5f753e548fb6bf69beefdfcadd", "text": "This example: gives this error: It took me some time to puzzle out what was happening here: expands to the default from the impl however is the impl method is accepted because it is more general than the trait definition but it fails to recursively invoke The error message without NLL, of course, is also not very illuminating.\nAssigning myself to bookmark.\nThis seems to be a persistent ergonomics wart where traits get evaluated to (happens as well with returning and others I can't remember now) where it isn't expected. It is a bit sad, and we can improve the diagnostic errors, but I'm worried we'll be unable to preempt all the cases from being caught by accurate diagnostics, pushing people away from deeply nested structures. Maybe that is for the best, though.\nI just want to note that the use of is, I think, a red herring in terms of the complaint about the diagnostic here. That is, I get the exact same diagnostic even if I add an explicit binder to the method, and then one can remove the . This is relevant because it means that if that feature is a red herring, then this bug may be relevant to the 2018 edition.\ndiscussed with . We agreed this is not a blocker for 2018 edition. Tagging with NLL-deferred so it does not clog up our triage process.\nI forgot to actual test how migration-mode (enabled for the 2018 edition) compares to . // Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. // forbid-output: &mut mut self struct Struct; impl Struct { fn foo(&mut self) { (&mut self).bar(); //~^ ERROR cannot borrow immutable argument `self` as mutable // ... and no SUGGESTION that suggests `&mut mut self` } // In this case we could keep the suggestion, but to distinguish the // two cases is pretty hard. It's an obscure case anyway. fn bar(self: &mut Self) { (&mut self).bar(); //~^ ERROR cannot borrow immutable argument `self` as mutable } } fn main () {} ", "positive_passages": [{"docid": "doc-en-rust-34d533c773e9c27212258668c1b2d3468ccd941ead0f348cd1d3398234442476", "text": "Output:\nThe argument is of type but it is, itself, immutable. You can't redefine to point at somebody else. The rest of the message is nonsensical because it fails to realize that is the specialest of special cases in terms of method signature parsing.", "commid": "rust_issue_31424", "tokennum": 61}], "negative_passages": []}
{"query_id": "q-en-rust-41f5ec1ee96e019f47ca44ccd464b5624d9530dcfdc6badadbd085e5dcd3d1f2", "query": ".map_or(false, |output| output.status.success()) } fn ensure_stage1_toolchain_placeholder_exists(stage_path: &str) -> bool { let pathbuf = PathBuf::from(stage_path); if fs::create_dir_all(pathbuf.join(\"lib\")).is_err() { return false; }; let pathbuf = pathbuf.join(\"bin\"); if fs::create_dir_all(&pathbuf).is_err() { return false; }; let pathbuf = pathbuf.join(format!(\"rustc{}\", EXE_SUFFIX)); if pathbuf.exists() { return true; } // Take care not to overwrite the file let result = File::options().append(true).create(true).open(&pathbuf); if result.is_err() { return false; } return true; } // Used to get the path for `Subcommand::Setup` pub fn interactive_path() -> io::Result { fn abbrev_all() -> impl Iterator {", "positive_passages": [{"docid": "doc-en-rust-9fb13d63f4889cc46a1e557e47bd93aa5e2cf5a7f89893a50a76fc76b3b3e0f4", "text": "I tried this code on a fresh git clone of rust-lang/rust: I expected to see this happen: setup works without errors. Instead, this happened: x.py gives an error: This feature was introduced in and worked at that time. do you have time to look into this? The original bug report was from Nazar Mokrynskyi , not sure their github username. $DIR/issue-72570.rs:7:18 --> $DIR/issue-72570.rs:9:18 | LL | asm!(\"\", in(\"invalid\") \"\".len()); | ^^^^^^^^^^^^^^^^^^^^^^", "positive_passages": [{"docid": "doc-en-rust-a8ec3c6f212b429c50a628f565c829a11972c67cd9c1c06a7502364d2537e5fd", "text": " $DIR/issue-72377.rs:8:11 | LL | match (x, y) { | ^^^^^^ patterns `(A, Some(A))`, `(A, Some(B))`, `(B, Some(B))` and 2 more not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms = note: the matched value is of type `(X, Option)` error: aborting due to previous error For more information about this error, try `rustc --explain E0004`. ", "positive_passages": [{"docid": "doc-en-rust-8c787253001859caaee3feb6b78e25b70abf420e6dfa01ecc9be4f5bd1ba3aa9", "text": "A small demo: . I expected to see this happen The usual error message indicating that patterns and are not covered. Instead, this happened Patterns and are detected as not covered. :\nIf you add the suggested arms, it will in fact detect the other ones as missing. It is expected that is detected as not covered since the match guard is not taken into account when checking exhaustiveness (and couldn't be, since it's an arbitrary expression).\nClosing as expected behavior.\nWouldn't you then expect that it mentions , , , and as not covered? Or is the number of outputs always restricted to two? In that case, I think it would be useful to indicate that some patterns might be missing, e.g.:\nYeah that's true", "commid": "rust_issue_72377", "tokennum": 155}], "negative_passages": []}
{"query_id": "q-en-rust-43e5286036b784140f68ab93146a1b58fc99c5718889507d26b2dc4b4f5862f8", "query": "#[test] #[cfg(unix)] #[cfg_attr(any(target_os = \"vxworks\", target_os = \"android\"), ignore)] #[cfg_attr(any(target_os = \"vxworks\"), ignore)] fn signal_reported_right() { use crate::os::unix::process::ExitStatusExt; let mut p = Command::new(\"/bin/sh\").arg(\"-c\").arg(\"read a\").stdin(Stdio::piped()).spawn().unwrap(); let mut p = shell_cmd().arg(\"-c\").arg(\"read a\").stdin(Stdio::piped()).spawn().unwrap(); p.kill().unwrap(); match p.wait().unwrap().signal() { Some(9) => {}", "positive_passages": [{"docid": "doc-en-rust-c2b5bb4cc8a2758cb2da845c98c56aa69b6ae72f2abf433dec53fb80eb5441a3", "text": "To enable test on android bot and test/run-pass/rtio- It looks to me RtioProcess does not work properly on android.\nlogs are\nHm this may be an FFI issue with libuv. I realized during my uv rewrite that libuv is giving us an int64t exit status and we think it's a cint. Once lands this may be fixed.\nHmm, this issue number has propagated to several more tests that are cfg-disabled on android. (Some of which are now failing when I mixed in a Boehm/BDW conservative GC into the runtime, in particular .)\nAlso, has landed, so it would be good to determine if these tests now work on Android.\nTriage: I have no idea how to test this, but a lot has changed in a year (especially the removal of green & libuv), so these may be magically fixed; if someone can check.\nTriage: is gone, but all these tests in are still ignored for android.\nI tried to run these tests with but they all failed with , which seems suspect (at least for the tests that invoke , , , etc.). Is there a better way to test? I have an android device available.", "commid": "rust_issue_10380", "tokennum": 267}], "negative_passages": []}
{"query_id": "q-en-rust-444fe71db728ebb039b3e5b0b24eb0bafe1cc054e6e81fb8c2879ffd0a88fd8e", "query": " // check-pass // https://github.com/rust-lang/rust/issues/113257 #![deny(trivial_casts)] // The casts here are not trivial. struct Foo<'a> { a: &'a () } fn extend_lifetime_very_very_safely<'a>(v: *const Foo<'a>) -> *const Foo<'static> { // This should pass because raw pointer casts can do anything they want. v as *const Foo<'static> } trait Trait {} fn assert_static<'a>(ptr: *mut (dyn Trait + 'a)) -> *mut (dyn Trait + 'static) { ptr as _ } fn main() { let unit = (); let foo = Foo { a: &unit }; let _long: *const Foo<'static> = extend_lifetime_very_very_safely(&foo); } ", "positive_passages": [{"docid": "doc-en-rust-9b4ab92232153d0742c86ba450034f7e1e26346754a368047e2e8efb113687b6", "text": " $DIR/issue-30904.rs:20:45 | LL | let _: for<'a> fn(&'a str) -> Str<'a> = Str; | ^^^ expected concrete lifetime, found bound lifetime parameter 'a | = note: expected type `for<'a> fn(&'a str) -> Str<'a>` found type `fn(&str) -> Str<'_> {Str::<'_>}` error[E0631]: type mismatch in function arguments --> $DIR/issue-30904.rs:26:10 | LL | fn test FnOnce<(&'x str,)>>(_: F) {} | ---- -------------------------- required by this bound in `test` ... LL | struct Str<'a>(&'a str); | ------------------------ found signature of `fn(&str) -> _` ... LL | test(Str); | ^^^ expected signature of `for<'x> fn(&'x str) -> _` error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0308`. ", "positive_passages": [{"docid": "doc-en-rust-9822b9c81be95fb5ecded752aa651bd0a7a9919b8a10c709893e3f89f7d1c822", "text": "Reproduction branch: When applying the change from the last commit I get a panic in my code during the call to . error[E0308]: mismatched types --> $DIR/issue-30904.rs:20:45 | LL | let _: for<'a> fn(&'a str) -> Str<'a> = Str; | ^^^ expected concrete lifetime, found bound lifetime parameter 'a | = note: expected type `for<'a> fn(&'a str) -> Str<'a>` found type `fn(&str) -> Str<'_> {Str::<'_>}` error[E0631]: type mismatch in function arguments --> $DIR/issue-30904.rs:26:10 | LL | fn test FnOnce<(&'x str,)>>(_: F) {} | ---- -------------------------- required by this bound in `test` ... LL | struct Str<'a>(&'a str); | ------------------------ found signature of `fn(&str) -> _` ... LL | test(Str); | ^^^ expected signature of `for<'x> fn(&'x str) -> _` error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0308`. ", "positive_passages": [{"docid": "doc-en-rust-ac3dbfa281d32582226e878b0785bb55974db51b1cb751dfcd8608e64d3bd326", "text": "Bx::debugloc 11: rustccodegenssa::mir::codegenmir 12: rustccodegenssa::base::codegeninstance 13: rustccodegenssa::monoitem::MonoItemExt::define 14: rustccodegenllvm::base::compilecodegenunit::modulecodegen 15: rustc::depgraph::graph::DepGraph::withtask 16: rustccodegenllvm::base::compilecodegenunit 17: rustccodegenssa::base::codegencrate 18: error[E0308]: mismatched types --> $DIR/issue-30904.rs:20:45 | LL | let _: for<'a> fn(&'a str) -> Str<'a> = Str; | ^^^ expected concrete lifetime, found bound lifetime parameter 'a | = note: expected type `for<'a> fn(&'a str) -> Str<'a>` found type `fn(&str) -> Str<'_> {Str::<'_>}` error[E0631]: type mismatch in function arguments --> $DIR/issue-30904.rs:26:10 | LL | fn test FnOnce<(&'x str,)>>(_: F) {} | ---- -------------------------- required by this bound in `test` ... LL | struct Str<'a>(&'a str); | ------------------------ found signature of `fn(&str) -> _` ... LL | test(Str); | ^^^ expected signature of `for<'x> fn(&'x str) -> _` error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0308`. ", "positive_passages": [{"docid": "doc-en-rust-3ec9e5e21694c83c332baa5dbe0997136c77e82bc74af3f6422b6f926b986d44", "text": "Has been fixed in\nis likely the part of the rollup fixing it.\nShouldn't a testcase be instead of closing this?\nA similar crash that still happens:", "commid": "rust_issue_58094", "tokennum": 34}], "negative_passages": []}
{"query_id": "q-en-rust-460406f8aedb72cf7fa98dd1ecf366988a5e89fc483c4488b4773d9b0e08da77", "query": " error[E0308]: mismatched types --> $DIR/issue-30904.rs:20:45 | LL | let _: for<'a> fn(&'a str) -> Str<'a> = Str; | ^^^ expected concrete lifetime, found bound lifetime parameter 'a | = note: expected type `for<'a> fn(&'a str) -> Str<'a>` found type `fn(&str) -> Str<'_> {Str::<'_>}` error[E0631]: type mismatch in function arguments --> $DIR/issue-30904.rs:26:10 | LL | fn test FnOnce<(&'x str,)>>(_: F) {} | ---- -------------------------- required by this bound in `test` ... LL | struct Str<'a>(&'a str); | ------------------------ found signature of `fn(&str) -> _` ... LL | test(Str); | ^^^ expected signature of `for<'x> fn(&'x str) -> _` error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0308`. ", "positive_passages": [{"docid": "doc-en-rust-ebea6140f1eb9c6aebe751a09f1aadf21a60bab3ba53df8d3812b6c41b56db38", "text": "I realize it's kinda nonsensical, but here:\nWhy didn't WF catch this?\nThat's because only checks statics/constants.\nStill reproducible with .\nThis ought to be a mostly easy fix. The problem is that the well formedness check, which ought to be rejected this code, is ignoring things in an : They fall through to this `` case: We would need to add support for the HIR item: which in turn has a number of items: which are defined here: presumably we want the to check that the types of are well-formed, roughly analogous to how we current check normal static items: (We probably want similar checks on foreign item fns, though?) One tricky part might be compatibility, we may need to turn this into a compatibility lint in case there is lots of broken code in the wild.\nI am trying to fix this bug, and need help moving forward. function is modified to accept a and a , yet it doesn't report any additional errors and the ICE prevails. Test file: Commit: Should I create a pull request or is it too early?\nLooks like suggestions are incomplete ( does not require ). Also, I left a comment on your commit about how you can avoid adding . I suspect the only reason regular s are required to be is they have an initializer (and that, not the type, requires ), i.e. for we have these errors:\nOddly, the PR that were previously posted to fix this (PR , following on PR ) was subsequently closed as inactive ... but the bug itself seems like it may have been resolved in the meantime?\nI'm going to assume this was fixed. Tagging as E-needstest, but if someone wants to take the time, it'd be even better to bisect to where this was fixed, and see if a regression test for this was at that time.\nCompiler no longer panics, tested with", "commid": "rust_issue_36122", "tokennum": 405}], "negative_passages": []}
{"query_id": "q-en-rust-460abba7299293c4c60b0a9bed6a278d2fd4f9d30413216aed4241d8ca606875", "query": " // aux-build:issue-99221-aux.rs // build-aux-docs // ignore-cross-compile #![crate_name = \"foo\"] #[macro_use] extern crate issue_99221_aux; pub use issue_99221_aux::*; // @count foo/index.html '//a[@class=\"macro\"]' 1 #[macro_export] macro_rules! print { () => () } ", "positive_passages": [{"docid": "doc-en-rust-08fef61b33cd316b87f51fefef6c09f30bede2a5f300f24306c1d3966f4d662c", "text": "I tried to create a minimum example from an issue we've seen in our project (). I tried running: On the following crate: : I expected to see this happen: The command should succeed. Instead, this happened: It crashed with an ICE $DIR/typeck_type_placeholder_item.rs:203:5 --> $DIR/typeck_type_placeholder_item.rs:205:5 | LL | const C: _; | ^^^^^^^^^^-", "positive_passages": [{"docid": "doc-en-rust-ec5ec337fdebda62ea6f5accc58590e1fbf1820463e97831c3b7b842a50e3a3f", "text": "First time filing a bug report, apologies if i missed anything or if this is a duplicate. Encountered this bug while writing some non-sensical associated function types. Searched around for any similar issues and the closest i found was , seems closely related? Minimal example: Playground link: The ICE happens on all channels it seems\nYes, I think so too. The snippet is rejected as expected on 1.42 but ICE occurs instead since 1.43.\nAssigning as and removing .", "commid": "rust_issue_74612", "tokennum": 99}], "negative_passages": []}
{"query_id": "q-en-rust-46385bdfdfc6713809a49e57556dd4ca22b367884ca82beafac27918284a7470", "query": "install_sh(builder, \"clippy\", self.compiler.stage, Some(self.target), &tarball); }; Miri, alias = \"miri\", Self::should_build(_config), only_hosts: true, { let tarball = builder .ensure(dist::Miri { compiler: self.compiler, target: self.target }) .expect(\"missing miri\"); install_sh(builder, \"miri\", self.compiler.stage, Some(self.target), &tarball); if let Some(tarball) = builder.ensure(dist::Miri { compiler: self.compiler, target: self.target }) { install_sh(builder, \"miri\", self.compiler.stage, Some(self.target), &tarball); } else { // Miri is only available on nightly builder.info( &format!(\"skipping Install miri stage{} ({})\", self.compiler.stage, self.target), ); } }; LlvmTools, alias = \"llvm-tools\", Self::should_build(_config), only_hosts: true, { let tarball = builder", "positive_passages": [{"docid": "doc-en-rust-de6cb3a22a1b089a71ebbc6ba3dfbd0807b299dcceef63b4cb23d6aed97e7789", "text": "On Solaris 11 x86_64, from scratch builds of 1.66.0 from git fails with: A build of the same tag completes successfully, as do and builds of 1.65.0.\nWas there an earlier (nonfatal) error? If miri failed to build there should hopefully be a reason mentioned. We turned miri on unconditionally, so builds require it to build successfully. Maybe we should disable that requirement for stable builds,but even so, stable builds should work just like nightly builds for miri\nIt doesn't even try to build , instead panics soon after its start: Dunno about Solaris build but MSYS2 hack quite a lot patches that theoretically could cause problems.\nFound the culprit: Should be easy enough to fix by making install not unwrap anymore. Looks like I was too eager\nGlad to see that this is indeed a real issue. Was tearing my hair out for hours wondering WHY x.py install kept failing with missing miri when is set with channel = \"stable\"\nWe are still seeing this with 1.66.1. [\u2026] Compiling thiserror v1.0.33 Finished release [optimized] target(s) in 38.48s warning: x.py has made several changes recently you may want to look at help: consider looking at the changes in note: to silence this warning, add at the top of note: this message was printed twice to make it more likely to be seen Build completed successfully in 0:28:41 python3 install Building rustbuild Finished dev [unoptimized] target(s) in 0.66s warning: x.py has made several changes recently you may want to look at help: consider looking at the changes in note: to silence this warning, add at the top of thread 'main' panicked at 'missing miri', note: run with environment variable to display a backtrace Build completed unsuccessfully in 0:00:01\nThe fix has been merged for the future 1.68 release.", "commid": "rust_issue_105816", "tokennum": 428}], "negative_passages": []}
{"query_id": "q-en-rust-465874c591121798bda7ed6e101f5fe43694be5c2bd7d5a505846f26b581ed1d", "query": " // Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. // Test that methods from shadowed traits cannot be used mod foo { pub trait T { fn f(&self) {} } impl T for () {} } mod bar { pub use foo::T; } fn main() { pub use bar::*; struct T; ().f() //~ ERROR no method } ", "positive_passages": [{"docid": "doc-en-rust-7f5edfab696a77c3b80b8adf17df9aad7e88ec6810550c4dd5caefb60e401509", "text": "This compiles: but this doesn't: More generally, a shadowed trait's methods are usable if it is shadowed by an item, but not if it is shadowed by an import. Should methods from shadowed traits be usable?\ncc\ncc\nNominating for discussion at meeting. Clearly we should be consistent. I'm inclined to think that they should not be available, ever.\nI'm of the same thoughts as A new \"thing\" with the same name as another outer \"thing\" should not inherit/infer/have/etc. any part of that outer thing. This is the case with , but\u2014according to the presented opinion\u2014it seems like it needs to be made consistent for trait bindings, right?\nIs there a reason to shadow traits by name? What happens here is that it must find a method named among the imported traits, and that name has not been shadowed in any way, so it should be callable.\nWell, that's the question, isn't it. Imagine then that did have an method -- would you prefer an ambiguity error here, or success?\nAmbiguity error if was implemented for in the example (and this error is already implemented). Otherwise it doesn't interfere in any way.\nAnother more challenging example might be: should the methods from be available, given that it is shadowed by ?\nMy feeling is that the simplest rule is to say that methods come from \"traits that are in scope\", and shadowed traits are not in scope. This interpretation is shadowing of items from prelude and globs, which seem like they should clearly not count towards method resolution.\nDiscussed in meeting and settled on \"methods from shadowed traits should be unavailable\". triage: P-medium\nWe also want methods from to be unavailable (from your more challenging example), right?", "commid": "rust_issue_31379", "tokennum": 371}], "negative_passages": []}
{"query_id": "q-en-rust-4665f46eb0b8ad421c119012ea1b0e351258193696747b9f304649d5ba5c2436", "query": " warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/nested-apit-mentioning-outer-bound-var.rs:1:12 | LL | #![feature(non_lifetime_binders)] | ^^^^^^^^^^^^^^^^^^^^ | = note: see issue #108185 for more information = note: `#[warn(incomplete_features)]` on by default error: `impl Trait` can only mention type parameters from an fn or impl --> $DIR/nested-apit-mentioning-outer-bound-var.rs:8:52 | LL | fn uwu(_: impl for Trait<(), Assoc = impl Trait>) {} | - type parameter declared here ^ error: aborting due to previous error; 1 warning emitted ", "positive_passages": [{"docid": "doc-en-rust-06e6378ba44e05509101e46992e2d4c5728912b15a9ea7133d4ed50005836ad1", "text": " $DIR/cyclic_type_ice.rs:3:7 | LL | f(f); | ^ cyclic type of infinite size | = note: closures cannot capture themselves or take themselves as argument; this error may be the result of a recent compiler bug-fix, see issue #46062 for more information error[E0057]: this function takes 2 arguments but 1 argument was supplied --> $DIR/cyclic_type_ice.rs:3:5 | LL | f(f); | ^--- an argument is missing | note: closure defined here --> $DIR/cyclic_type_ice.rs:2:13 | LL | let f = |_, _| (); | ^^^^^^ help: provide the argument | LL | f(/* */, /* */); | ~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors Some errors have detailed explanations: E0057, E0644. For more information about an error, try `rustc --explain E0057`. ", "positive_passages": [{"docid": "doc-en-rust-0ab00e6697948de69224a288d74abf2a92846a3f52e6fe76f0301be0cececa7b", "text": " $DIR/suggest-call-on-pat-mismatch.rs:7:12 | LL | if let E::One(var1, var2) = var { | ^^^^^^^^^^^^^^^^^^ --- this expression has type `fn(i32, i32) -> E {E::One}` | | | expected enum constructor, found `E` | = note: expected enum constructor `fn(i32, i32) -> E {E::One}` found enum `E` help: use parentheses to construct this tuple variant | LL | if let E::One(var1, var2) = var(/* i32 */, /* i32 */) { | ++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/suggest-call-on-pat-mismatch.rs:13:9 | LL | let Some(x) = Some; | ^^^^^^^ ---- this expression has type `fn(_) -> Option<_> {Option::<_>::Some}` | | | expected enum constructor, found `Option<_>` | = note: expected enum constructor `fn(_) -> Option<_> {Option::<_>::Some}` found enum `Option<_>` help: use parentheses to construct this tuple variant | LL | let Some(x) = Some(/* value */); | +++++++++++++ error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0308`. ", "positive_passages": [{"docid": "doc-en-rust-8364654c680aca994ac402f2bc837d515b8da5f2d6729d63bb2cffdb02b283ee", "text": " $DIR/repr-transparent-issue-87496.rs:8:18 | LL | fn good17(p: TransparentCustomZst); | ^^^^^^^^^^^^^^^^^^^^ not FFI-safe | = note: `#[warn(improper_ctypes)]` on by default = note: this struct contains only zero-sized fields note: the type is defined here --> $DIR/repr-transparent-issue-87496.rs:6:1 | LL | struct TransparentCustomZst(()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: 1 warning emitted ", "positive_passages": [{"docid": "doc-en-rust-f9b994a3e982aa62208d781704ba52f1835aec199318cfbc70468f8324047d67", "text": " $DIR/invalid_rustc_layout_scalar_valid_range.rs:3:1 | LL | #[rustc_layout_scalar_valid_range_start(u32::MAX)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: expected exactly one integer literal argument --> $DIR/invalid_rustc_layout_scalar_valid_range.rs:6:1 | LL | #[rustc_layout_scalar_valid_range_end(1, 2)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: expected exactly one integer literal argument --> $DIR/invalid_rustc_layout_scalar_valid_range.rs:9:1 | LL | #[rustc_layout_scalar_valid_range_end(a = \"a\")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: attribute should be applied to a struct --> $DIR/invalid_rustc_layout_scalar_valid_range.rs:12:1 | LL | #[rustc_layout_scalar_valid_range_end(1)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | / enum E { LL | | X = 1, LL | | Y = 14, LL | | } | |_- not a struct error: aborting due to 4 previous errors ", "positive_passages": [{"docid": "doc-en-rust-b99790954103bc9cb90e92c6f65b5e287c0e1cc2dfe7ab15d00c918e4016c240", "text": " $DIR/invalid_rustc_layout_scalar_valid_range.rs:3:1 | LL | #[rustc_layout_scalar_valid_range_start(u32::MAX)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: expected exactly one integer literal argument --> $DIR/invalid_rustc_layout_scalar_valid_range.rs:6:1 | LL | #[rustc_layout_scalar_valid_range_end(1, 2)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: expected exactly one integer literal argument --> $DIR/invalid_rustc_layout_scalar_valid_range.rs:9:1 | LL | #[rustc_layout_scalar_valid_range_end(a = \"a\")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: attribute should be applied to a struct --> $DIR/invalid_rustc_layout_scalar_valid_range.rs:12:1 | LL | #[rustc_layout_scalar_valid_range_end(1)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | / enum E { LL | | X = 1, LL | | Y = 14, LL | | } | |_- not a struct error: aborting due to 4 previous errors ", "positive_passages": [{"docid": "doc-en-rust-b0d3dd31a61fb113bd616c6788d76c9dd86c7d72d5555fc68ece4a6addccaeed", "text": "Gives:\ncc ICE-ing instead of user error on misuse seems somewhat okay given that it's an internal attribute, IMO.\nagreed. We don't protect against mis-use of rustc internal attributes beyond making sure that you can't trivially create buggy code. I don't think we should put any effort into making this nicer to use and instead create the const-generic based replacement.", "commid": "rust_issue_82251", "tokennum": 87}], "negative_passages": []}
{"query_id": "q-en-rust-49e076bd1cd7c5c04944ee451e71da8e50e7ec101f36c97681e925e0d7ac3e9a", "query": "pub(super) node_to_hir_id: IndexVec, macro_def_scopes: FxHashMap, expansions: FxHashMap, keys_created: FxHashSet, next_disambiguator: FxHashMap<(DefIndex, DefPathData), u32>, } // Unfortunately we have to provide a manual impl of Clone because of the", "positive_passages": [{"docid": "doc-en-rust-73686ba7f83cf3edf01e126f987221a62ccf7f84336d4bdd26ea44900baba7e0", "text": "In investigating I was generating some source code, and using the shell script listed in we can see: That's a lot of time to expand a crate that doesn't have any macros in it!\ncc you may be interested in this!\nA looks like almost all the time is spent in In which case, cc\nApparently most time is spent\ncalled ~38k times\nSince we need to build the module graph and resolve imports during expansion for macros 2.0, we must construct node ids and def ids throughout expansion (i.e. interleaved arbitrarily many times until we hit fix-point). Ideally we'd keep running totals of the time spent assigning node ids, assigning def ids, etc. for more accurate profiling information within the expansion step.\nin theory though isn't the fixed point for this crate the crate itself? (e.g. there's no macros here). Or are the def ids persisted for the rest of compilation, so \"blaming\" expansion isn't quite correct here?\nYeah, the def ids are persisted for the rest of compilation. We could move the \"first round\" of def id collection (in which we collect the raw, unexpanded source) outside of expansion, but that would introduce more code complexity and wouldn't count the time we spend collecting def ids for AST that comes from macro expansions.\nAh ok, nah it seems fine! I think there's a number of cases where is attributing time in the wrong place nowadays... Still it seems odd that 30-50k invocations of this function would take so long to execute?\nDo I understand this correctly that all DefIds generated are actually used, right? There are no \"temporary\" DefIds? Each of these invocations creates a Blake2 hasher. I'd be interested how the performance looks with other hashing algorithms. I'd like to switch to something faster anyway:\nAre you sure this isn't the other quadratic case fixed in ?\nIt may very well be! Feel free to close this w/ that PR landing, I'll verify to be sure but I'd imagine you're correct in that it's fixed by\ner, didn't mean to close just yet", "commid": "rust_issue_43573", "tokennum": 477}], "negative_passages": []}
{"query_id": "q-en-rust-49e076bd1cd7c5c04944ee451e71da8e50e7ec101f36c97681e925e0d7ac3e9a", "query": "pub(super) node_to_hir_id: IndexVec, macro_def_scopes: FxHashMap, expansions: FxHashMap, keys_created: FxHashSet, next_disambiguator: FxHashMap<(DefIndex, DefPathData), u32>, } // Unfortunately we have to provide a manual impl of Clone because of the", "positive_passages": [{"docid": "doc-en-rust-72fe2bafe2a1a21d0eaa6375acdb6769432ce8dc7f4c048341b2403d045d644c", "text": "A of Servo's crate shows a huge amount of time (46 seconds!) in name resolution. It turns out that is calling , specifically . That's a lot of unused imports! Sure enough if we create a synthetic file locally with this script: we find: That's a lot of time spent processing unused imports! The slowdown here isn't quite the same as the style crate, unfortunately. The style crate only has ~7k unused imports, which apparently takes it 48s in that profile. In any case the intent here is clear, lots of unused imports seem to slow down compilation, and the crate looks to have a lot of unused imports!\ncc\nWe could address this quickly by just emitting the first 10 unused imports warnings and then warning that there are more unused imports not shown.\nI can never deal with more than 10 lints at a time anyway myself, so seems like a reasonable solution to me!\nDumping out a ton of warnings is useful when you're hooked into an IDE and you can see them as e.g. green squiggles under the offending text as opposed to 10k lines on a terminal.\nI think the reason is slow is because it calls , which does this: I don't think we want to read source files multiple times like that.\nThank you for looking into Servo compile times Alex, and great find here! Could you CC me or someone from the Servo team for Servo-related issues? Thanks.\nCan do!\nIn general I've always wanted the lint system to avoid even running in blocks. Currently the lint system runs all lints in parallel on the tree. This is great since it means we only traverse it once, and the cost of the traversal is consolidated. We don't need to reduce that cost itself (which is nice because then we don't have to worry about inside ). Most lints do not maintain state. The lint framework has the capability to do so, and we use this a couple times in Clippy, but most lints are , so they won't notice if or whatever isn't called in a region of . The \"allowness\" of a lint is tied to where in the tree the lint traversal is, not the span emitted by the lint.", "commid": "rust_issue_43572", "tokennum": 475}], "negative_passages": []}
{"query_id": "q-en-rust-49e076bd1cd7c5c04944ee451e71da8e50e7ec101f36c97681e925e0d7ac3e9a", "query": "pub(super) node_to_hir_id: IndexVec, macro_def_scopes: FxHashMap, expansions: FxHashMap, keys_created: FxHashSet, next_disambiguator: FxHashMap<(DefIndex, DefPathData), u32>, } // Unfortunately we have to provide a manual impl of Clone because of the", "positive_passages": [{"docid": "doc-en-rust-b85c31e38a8b01d388b4e26ff1ac26d5cdc2ebfa33d6fb86517f39821452f2fc", "text": "It's perfectly possible to a block of code and have the lint still be emit there because a different block of code (where it is ) hit the lint but emitted a span it got from elsewhere. We've had trouble with this before in clipyp iirc. All of this enables this proposal: If we had a specialized trait for this, then when we have an we can turn off calling lint methods entirely, and when there's a turn it on again. It doesn't even have to be a trait, really, it could just be a defaulted fake-static method (until happens) on LateLintPass. I suspect this will get significant speedups for crates like Style. I may_ be able to take a crack at this if y'all think this is a good approach.\nIt occurs to me that a boolean check per lint each tree node might actually end up being more expensive? I'll have look at this code closer. Might be possible to make this fast by having a second array of trait objects which only contains the active lint passes.\nIt seems like we do a large enough amount of work that the whole \"vector of active lints\" stuff won't really be necessary. However, I just realized that this bug is not during the lint pass but during the resolution phase (which defers linting to the actual lint pass). This won't be able to help, though we can fix it by doing the spantosnippet in the actual lint and then making this optimization. So in that case I suspect this optimization is unnecessary. In general we've rarely had performance issues with lints in clippy (which has way more lints than rustc), and we've been pretty careful to measure impact there. Still, if folks think this optimization can help, let me know.", "commid": "rust_issue_43572", "tokennum": 384}], "negative_passages": []}
{"query_id": "q-en-rust-4a09586829fae00306099e0efc5d6d77679dd97d44900b73f10e4696299da462", "query": " // compile-pass #[deny(warnings)] enum Empty { } trait Bar {} impl Bar for () {} fn boo() -> impl Bar {} fn main() { boo(); } ", "positive_passages": [{"docid": "doc-en-rust-cc238fb102f31a667536e1fb25dfa64d12f7387a13f1a73115a9c198577ccf85", "text": "The following code gives \"warning: enum is never used: \": This regressed pretty recently. cc\n27.0 does not warn, 1.28.0 does.\ntriage: P-medium; This seems like a papercut that should be easy to work-around (at least if one isn't using ...).\nswitched to P-high after prompting from\nwhoops forgot to tag with T-compiler in time for the meeting...\nassigning to\nI'm grabbing this, I think I broke it and it should be easy to fix", "commid": "rust_issue_55124", "tokennum": 117}], "negative_passages": []}
{"query_id": "q-en-rust-4a33834612b65ba9d87ba685c83e0d74ef439439e65869d3e294680a84dc5244", "query": "} Some(BacktraceStyle::Off) => { if FIRST_PANIC.swap(false, Ordering::SeqCst) { if let Some(path) = path { let _ = writeln!( err, \"note: a backtrace for this error was stored at `{}`\", path.display(), ); } else { let _ = writeln!( err, \"note: run with `RUST_BACKTRACE=1` environment variable to display a let _ = writeln!( err, \"note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\" ); } ); } } // If backtraces aren't supported or are forced-off, do nothing.", "positive_passages": [{"docid": "doc-en-rust-527a8c59582e499a04b7590e8f7c8dc7a0df5539f372f59e5e35cf26ad6c1895", "text": "slightly increased default binary size (checked on x8664-pc-windows-msvc), the reason is now code unconditionally includes File::open (~ 2kb out of 130) and friends. can be tracked back by new imports of , for where is Originally posted by in\ncc\ncc -- I'm surprised that didn't include any libs review in the first place, having modified the default panic hook. Maybe ought to be registering its own panic hook instead?\nSize changed back to 123kb.", "commid": "rust_issue_115610", "tokennum": 110}], "negative_passages": []}
{"query_id": "q-en-rust-4a6d6dcd04fab12b59c427753beda3eabd4cea2ff9cb691f5b2161f124383963", "query": "\"x86_64-pc-windows-gnu\", ]; static TOOLSTATE: &str = \"https://raw.githubusercontent.com/rust-lang-nursery/rust-toolstate/master/history/linux.tsv\"; #[derive(Serialize)] #[serde(rename_all = \"kebab-case\")] struct Manifest {", "positive_passages": [{"docid": "doc-en-rust-0096f2a625f337b8a36c79fcb98e4288dc1989cf6d778df9ad1090bdbd118670", "text": "Seems like no nightly was released today. That might be related to Unfortunately I don't think I have access to the logs. Cc\nLogs are missing on the server, let me start a manual release...\nWell that is odd. You wouldn't know what commit is is using? ( file in the tarball, if I recall correctly.)\nIs there a way for me to download the \"dist\" artifacts for better testing? Right now I am manually grabbing a bunch of files from https://s3-us-west- (and we only get dir listing for alt builds there it seems so I am using those). That's not very convenient at all.\nApparently not all commits are pushed to toolstate ( vs ), for example the latest one () is missing in toolstate .\nReverting the cause in the meantime --\nAlternatively we could land which will just skip of the toolstate is not found. That installs a toolchain based on these artifacts, but I don't think it gives me access to the tarballs. FTR, for now I did So we are only committing when the toolstate changed? Ouch. That kills my entire approach :(\nIt should print the URLs it's downloading though, and you can use to avoid it actually downloading stuff.", "commid": "rust_issue_64540", "tokennum": 273}], "negative_passages": []}
{"query_id": "q-en-rust-4a880eb0d112a2c0f49c5be90738f6d9dd34a216547dcc6afebcf74f5198d143", "query": " # Rustdoc in-doc settings Rustdoc's HTML output includes a settings menu, and this chapter describes what each setting in this menu does. It can be accessed by clicking on the gear button () in the upper right. ## Changing displayed theme It is possible to change the theme. If you pick the \"system preference\", you will be able to see two new sub-menus: \"Preferred light theme\" and \"Preferred dark theme\". It means that if your system preference is set to \"light\", then rustdoc will use the theme you selected in \"Preferred light theme\". ## Auto-hide item contents for large items If the type definition contains more than 12 items, and this setting is enabled, it'll collapse them by default. You can see them by clicking on the `[+]` button to expand them. A good example of this setting in use can be seen in the [`Iterator`](https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html) doc page:  ## Auto-hide item methods' documentation If enabled, this setting will collapse all trait implementations blocks. It is convenient if you just want an overview of all the methods available. You can still see a method's documentation by expanding it. ## Auto-hide trait implementation documentation If enabled, this setting will collapse all trait implementations blocks (you can see them in the \"Trait Implementations\" section). It is convenient if you just want an overview of all the trait implemented on a type. You can still see a trait implementation's associated items by expanding it. Example:  ## Directly go to item in search if there is only one result If this setting is enabled, you will directly be taken to the result page if your search only returned one element. Useful if you know exactly what you're looking for and want to be taken there directly and not waste time selecting the only search result. ## Show line numbers on code examples If enabled, this setting will add line numbers to the code examples in the documentation. It provides a visual aide for the code reading. ## Disable keyboard shortcuts If this setting is enabled, the keyboard shortcuts will be disabled. It's useful in case some of these shortcuts are already used by a web extension you're using. To see the full list of the rustdoc keyboard shortcuts, you can open the help menu (the button with the question mark on the left of the setting menu button). ", "positive_passages": [{"docid": "doc-en-rust-e8529c1b62d5f94530ea7779c57d328ec6812db445f465b97e32eae97a9af0c5", "text": "Rustdoc has accumulated a handful of settings that users can toggle as they read docs, but we don't document them anywhere. It would be ideal if we had some documentation about these options in the Rustdoc Book that described their functionality better than the short descriptions shown on the settings page itself. !\nI don't mind picking this up, unless you want to do this yourself! I do however have some questions!: The Rustdoc book you mean is right? Do you suggest adding a new section to this book or would you include it in an already existing section? What do you believe is not clear / elaborated enough in the short descriptions? I do not know the specific details of each switch are there any side-effects that are not in the short description?\nTriage: no changes. The rustdoc book is that one, ! I am not a rustdoc maintainer these days (cc ) but I would probably make a new section. While the short description is good, I think it would make sense to show the options in slightly more detail, for example, maybe a before/after.\nBit of a late reply :) Do you have something to add to this? Otherwise I will follow what Steve said!", "commid": "rust_issue_55165", "tokennum": 253}], "negative_passages": []}
{"query_id": "q-en-rust-4ad029adda83cfde52717071d7e828ebbabf61aa0da01564474640954a265f35", "query": "env, ffi::{OsStr, OsString}, fs::{self, File}, io::{BufRead, BufReader, ErrorKind}, io::{self, BufRead, BufReader, ErrorKind}, path::{Path, PathBuf}, process::{Command, Stdio}, };", "positive_passages": [{"docid": "doc-en-rust-88a4065972b63f545a86177d37581ba6cb916f5e9f708be097e6d3b58f7b7b71", "text": "broke the rust-analyzer config we suggest in the dev-guide: https://rustc-dev- since now rustfmt is in instead of . Originally posted by in $DIR/issue-82156.rs:2:5 | LL | super(); | ^^^^^ there are too many leading `super` keywords error: aborting due to previous error For more information about this error, try `rustc --explain E0433`. ", "positive_passages": [{"docid": "doc-en-rust-be77427b5ff7c2ed740c28de1b76f9f4236cd70215ffd4d8355f0bbecedf7e44", "text": " $DIR/unused-parens-for-stmt-expr-attributes-issue-129833.rs:9:13 | LL | let _ = (#[inline] #[allow(dead_code)] || println!(\"Hello!\")); | ^ ^ | note: the lint level is defined here --> $DIR/unused-parens-for-stmt-expr-attributes-issue-129833.rs:6:9 | LL | #![deny(unused_parens)] | ^^^^^^^^^^^^^ help: remove these parentheses | LL - let _ = (#[inline] #[allow(dead_code)] || println!(\"Hello!\")); LL + let _ = #[inline] #[allow(dead_code)] || println!(\"Hello!\"); | error: unnecessary parentheses around block return value --> $DIR/unused-parens-for-stmt-expr-attributes-issue-129833.rs:10:5 | LL | (#[inline] #[allow(dead_code)] || println!(\"Hello!\")) | ^ ^ | help: remove these parentheses | LL - (#[inline] #[allow(dead_code)] || println!(\"Hello!\")) LL + #[inline] #[allow(dead_code)] || println!(\"Hello!\") | error: aborting due to 2 previous errors ", "positive_passages": [{"docid": "doc-en-rust-e7a320c98519d6fc4b2fd32e4b6eef4cdfa5f12d2bc2a3a5c7d0e5b9670e2657", "text": " $DIR/bad-const-generic-exprs.rs:16:17 | LL | let _: Wow<[]>; | ^ expected type | help: expressions must be enclosed in braces to be used as const generic arguments | LL | let _: Wow<{ [] }>; | + + error: expected type, found `12` --> $DIR/bad-const-generic-exprs.rs:19:17 | LL | let _: Wow<[12]>; | ^^ expected type error[E0747]: type provided when a constant was expected error: invalid const generic expression --> $DIR/bad-const-generic-exprs.rs:19:16 | LL | let _: Wow<[12]>; | ^^^^ | help: expressions must be enclosed in braces to be used as const generic arguments | LL | let _: Wow<{ [12] }>; | + + error: expected type, found `0` --> $DIR/bad-const-generic-exprs.rs:23:17 | LL | let _: Wow<[0, 1, 3]>; | ^ expected type | help: expressions must be enclosed in braces to be used as const generic arguments | LL | let _: Wow<{ [0, 1, 3] }>; | + + error: expected type, found `0xff` --> $DIR/bad-const-generic-exprs.rs:26:17 | LL | let _: Wow<[0xff; 8]>; | ^^^^ expected type error: invalid const generic expression --> $DIR/bad-const-generic-exprs.rs:26:16 | LL | let _: Wow<[0xff; 8]>; | ^^^^^^^^^ | help: expressions must be enclosed in braces to be used as const generic arguments | LL | let _: Wow<{ [0xff; 8] }>; | + + error: expected type, found `1` --> $DIR/bad-const-generic-exprs.rs:30:17 | LL | let _: Wow<[1, 2]>; // Regression test for issue #81698. | ^ expected type | help: expressions must be enclosed in braces to be used as const generic arguments | LL | let _: Wow<{ [1, 2] }>; // Regression test for issue #81698. | + + error: expected type, found `0` --> $DIR/bad-const-generic-exprs.rs:33:17 | LL | let _: Wow<&0>; | ^ expected type | help: expressions must be enclosed in braces to be used as const generic arguments | LL | let _: Wow<{ &0 }>; | + + error: expected type, found `\"\"` --> $DIR/bad-const-generic-exprs.rs:36:17 | LL | let _: Wow<(\"\", 0)>; | ^^ expected type | help: expressions must be enclosed in braces to be used as const generic arguments | LL | let _: Wow<{ (\"\", 0) }>; | + + error: expected type, found `1` --> $DIR/bad-const-generic-exprs.rs:39:17 | LL | let _: Wow<(1 + 2) * 3>; | ^ expected type | help: expressions must be enclosed in braces to be used as const generic arguments | LL | let _: Wow<{ (1 + 2) * 3 }>; | + + error: expected one of `,` or `>`, found `0` --> $DIR/bad-const-generic-exprs.rs:43:17 | LL | let _: Wow; | - ^ expected one of `,` or `>` | | | while parsing the type for `_` | help: you might have meant to end the type parameters here | LL | let _: Wow0>; | + error: aborting due to 6 previous errors error: aborting due to 15 previous errors For more information about this error, try `rustc --explain E0747`. ", "positive_passages": [{"docid": "doc-en-rust-052d31b16bdfbc0cc3fa717e0c452b82b80740b570049b3bffff789fa77dfda9", "text": " $DIR/hash-tyvid-regression-1.rs:9:5 | LL | <[T; N.get()]>::try_from(()) | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From<()>` is not implemented for `[T; _]` | = note: required because of the requirements on the impl of `Into<[T; _]>` for `()` = note: required because of the requirements on the impl of `TryFrom<()>` for `[T; _]` note: required by `try_from` --> $SRC_DIR/core/src/convert/mod.rs:LL:COL | LL | fn try_from(value: T) -> Result; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/hash-tyvid-regression-1.rs:9:5 | LL | <[T; N.get()]>::try_from(()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found enum `Result` | = note: expected unit type `()` found enum `Result<[T; _], Infallible>` help: consider using a semicolon here | LL | <[T; N.get()]>::try_from(()); | + help: try adding a return type | LL | -> Result<[T; _], Infallible> where | +++++++++++++++++++++++++++++ error: aborting due to 2 previous errors Some errors have detailed explanations: E0277, E0308. For more information about an error, try `rustc --explain E0277`. ", "positive_passages": [{"docid": "doc-en-rust-3d2230ccded0ff5952dbebfbbd96c9c301c1ac68e367c71bd716549b3b445522", "text": " $DIR/hash-tyvid-regression-1.rs:9:5 | LL | <[T; N.get()]>::try_from(()) | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From<()>` is not implemented for `[T; _]` | = note: required because of the requirements on the impl of `Into<[T; _]>` for `()` = note: required because of the requirements on the impl of `TryFrom<()>` for `[T; _]` note: required by `try_from` --> $SRC_DIR/core/src/convert/mod.rs:LL:COL | LL | fn try_from(value: T) -> Result; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/hash-tyvid-regression-1.rs:9:5 | LL | <[T; N.get()]>::try_from(()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found enum `Result` | = note: expected unit type `()` found enum `Result<[T; _], Infallible>` help: consider using a semicolon here | LL | <[T; N.get()]>::try_from(()); | + help: try adding a return type | LL | -> Result<[T; _], Infallible> where | +++++++++++++++++++++++++++++ error: aborting due to 2 previous errors Some errors have detailed explanations: E0277, E0308. For more information about an error, try `rustc --explain E0277`. ", "positive_passages": [{"docid": "doc-en-rust-1a3b49bd155e83a8f86240b49a187aef8e1c92419f3d78270ee3b5ee0b9101d7", "text": " $DIR/cannot-infer-type-for-const-param.rs:1:12 | LL | #![feature(const_generics)] | ^^^^^^^^^^^^^^ error[E0282]: type annotations needed --> $DIR/cannot-infer-type-for-const-param.rs:10:19 | LL | let _ = Foo::<3>([1, 2, 3]); | ^ cannot infer type for `{integer}` error: aborting due to previous error For more information about this error, try `rustc --explain E0282`. ", "positive_passages": [{"docid": "doc-en-rust-0430da44e5f0c0cd5ec3e6ab63520772d61c140d8254453f233ecda5e0243e82", "text": "Following code sample causes a compiler panic. should be .\nAlso happens on nightly. Likely due to const generics changes (cc\nMinimal reproduction:\nAnother case:", "commid": "rust_issue_60704", "tokennum": 32}], "negative_passages": []}
{"query_id": "q-en-rust-4e4b78164a89e4736cc3f6c7a95e7eec1330141d0252f0152d8354d9a1a108e0", "query": "/// # Examples /// /// ``` /// # #![feature(duration_as_u128)] /// use std::time::Duration; /// /// let duration = Duration::new(5, 730023852); /// assert_eq!(duration.as_micros(), 5730023); /// ``` #[unstable(feature = \"duration_as_u128\", issue = \"50202\")] #[stable(feature = \"duration_as_u128\", since = \"1.33.0\")] #[inline] pub const fn as_micros(&self) -> u128 { self.secs as u128 * MICROS_PER_SEC as u128 + (self.nanos / NANOS_PER_MICRO) as u128", "positive_passages": [{"docid": "doc-en-rust-d0d405cd384afbfb455884909005ac74412a9a114b24ca7fb559032aa28403a9", "text": "Duration has historically lacked a way to get the actual number of nanoseconds it contained as a normal Rust type because u64 was of insufficient range, and f64 of insufficient precision. The u128 type solves both issues, so I propose adding an as_nanos function to expose the capability. CC:\nI still don't understand why Duration is not allowed to be negative. It bugs me that the SystemTime difference returns a Result /// # #![feature(duration_as_u128)] /// use std::time::Duration; /// /// let duration = Duration::new(5, 730023852); /// assert_eq!(duration.as_micros(), 5730023); /// ``` #[unstable(feature = \"duration_as_u128\", issue = \"50202\")] #[stable(feature = \"duration_as_u128\", since = \"1.33.0\")] #[inline] pub const fn as_micros(&self) -> u128 { self.secs as u128 * MICROS_PER_SEC as u128 + (self.nanos / NANOS_PER_MICRO) as u128", "positive_passages": [{"docid": "doc-en-rust-8a84d18ebac539e2d31db276978d3a0be6115d029ceb9fb4c440b603a07cfd94", "text": "For my usecase, I probably don't need more than a , and I really only need millis (though the code I'm porting happens to use microseconds). I'd rather have a , but I'm just not sure what to do here for my code which I'm trying to keep as close to fully stable as possible (I want it to be as portable and safe as I can make it). I know (I think?) I can use , but I'd rather not lose the precision and I think I can always use for all my platforms.\nis there any reason not to move forward with stabilization on this? correctly observes that it has been unstable for quite a while\nThe stability of u128 was the blocker previously, but that's now no longer a problem. fcp merge\nTeam member has proposed to merge this. The next step is review by the rest of the tagged teams: [x] [x] [x] [x] [x] [ ] No concerns currently listed. Once a majority of reviewers approve (and none object), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See for info about what commands tagged team members can give me.\nI couldn\u2019t find all the details in this issue, grepping through the code shows that this tracking issue is for:\nThis may be a stupid question, but is available on all platforms that Rust supports?\n:bell: This is now entering its final comment period, as per the . :bell:\nYep, it should be available on all platforms.\nThe final comment period, with a disposition to merge, as per the , is now complete.\nNow that final comment period has ended, can these methods be stabilized?\nYes, the next step is a stabilization PR.\nAwesome! I've made a PR for stabilization here: Please let me know if it needs any adjustments. I can't wait for this to land! :tada:", "commid": "rust_issue_50202", "tokennum": 423}], "negative_passages": []}
{"query_id": "q-en-rust-4e51347dabb7653344b473d8c938549280f5972452ab1099dc55ffa185f7b071", "query": "use m::*; // The variant `Same` introduced by this import is not considered when resolving the prefix // `Same::` during import validation (issue #62767). use Same::Same; // The variant `Same` introduced by this import is also considered when resolving the prefix // `Same::` during import validation to avoid effects similar to time travel (#74556). use Same::Same; //~ ERROR unresolved import `Same` // Case from #74556. mod foo { pub mod bar { pub mod bar { pub fn foobar() {} } } } use foo::*; use bar::bar; //~ ERROR unresolved import `bar::bar` //~| ERROR inconsistent resolution for an import use bar::foobar; fn main() {}", "positive_passages": [{"docid": "doc-en-rust-1d02a865c5502101bb085f308bfca2de516f7657e2be303900cbd0433d86e5ee", "text": "I tried this code: I expected to see this happen: Compilation error. This shadows one (glob-imported) with another . As far as I know, this should be forbidden. Instead, this happened: this code successfully compiled. : c.c. c.c.\nShadowing a glob import with a specific item is allowed and will unambiguously resolve to the specific one. This is also how the prelude works. The following compiles fine as well: .\nTo clarify, the problem is not shadowing, but time travel. We shadow identifier which have been already used to resolve another import, so we end up with meaning two things at the same time in the same scope.\nThis is a change from Rust 1.44, in Rust 1.43 this is an ICE \"inconsistent resolution for an import\". Possibly a consequence of\nI'm not sure this is a bug. When resolving we are looking at all names in scope except for the names introduced by itself. Otherwise we'd have cycles even in trivial cases like where is a name from extern prelude. If you take this detail into consideration, then all paths seem to be resolved correctly.\ncc (somewhat related)\nI think, the difference with is that doesn't replace one resolution with another. We already have a name in the scope that is resolved to a particular extern crate. In my example, uses name from the scope, and then rebinds this name to another item. I can complicate my example a bit. What this program prints, \"111\" or \"222\"? It'd say, it depends on imports resolution order, but looks like it always prints \"111\".\nIt'd say, it depends on imports resolution order The intent for the resolution results is to never depend on internal resolution order. (cc , order-dependence can probably happen in practice due to the current not very principled implementation, but hopefully still can be eliminated in backward-compatible-in-practice way by rewriting the main resolution/expansion loop more carefully.) but looks like it always prints \"111\" That's what I'd expect. resolves to in resolves to (because non-globs shadow globs) first in resolves to (which the only in scope after excluding itself)\nI'd still be ok with replacing the former ICE with an error though, since that's a more conservative choice.", "commid": "rust_issue_74556", "tokennum": 501}], "negative_passages": []}
{"query_id": "q-en-rust-4e51347dabb7653344b473d8c938549280f5972452ab1099dc55ffa185f7b071", "query": "use m::*; // The variant `Same` introduced by this import is not considered when resolving the prefix // `Same::` during import validation (issue #62767). use Same::Same; // The variant `Same` introduced by this import is also considered when resolving the prefix // `Same::` during import validation to avoid effects similar to time travel (#74556). use Same::Same; //~ ERROR unresolved import `Same` // Case from #74556. mod foo { pub mod bar { pub mod bar { pub fn foobar() {} } } } use foo::*; use bar::bar; //~ ERROR unresolved import `bar::bar` //~| ERROR inconsistent resolution for an import use bar::foobar; fn main() {}", "positive_passages": [{"docid": "doc-en-rust-8fdf92c5d6f03ecf9b3b6d329271f343fdecdc4083704cecf95b320b51fd348f", "text": "Actually enabling the property \"name resolve to the same thing whether some items were excluded during its resolution to avoid cycles or not\" may be useful for using something like \"inference variables\" for unresolved imports and making import resolution more like unification in type inference. That's an idea I had for quite some, but I hadn't realized that merging went against it.\nSigh, the issue already affects three stable releases - from 1.44 to 1.46. I'll try to prioritize it.\nAddressed in\nAssigning so this isn't lost. See the .\nThe fix caused some regressions -\nThe code in the issue produce no errors using Rust 1.67.1. Should we re-open the issue or is it not considered a bug now?\nThe fix was reverted due to breakage () and the current behavior is considered by design since then.\n(Also it's not exactly a time travel - )", "commid": "rust_issue_74556", "tokennum": 190}], "negative_passages": []}
{"query_id": "q-en-rust-4e53670da9a0f0a014e09c0398f751227c28c5dc72c10ca318afe52ff69308c5", "query": "use std::collections::{HashMap, HashSet}; use std::env; use std::fs::{self, File}; use std::io; use std::io::ErrorKind; use std::path::{Path, PathBuf}; use std::process::{Command, Stdio};", "positive_passages": [{"docid": "doc-en-rust-88a4065972b63f545a86177d37581ba6cb916f5e9f708be097e6d3b58f7b7b71", "text": "broke the rust-analyzer config we suggest in the dev-guide: https://rustc-dev- since now rustfmt is in instead of . Originally posted by in $DIR/issue-81508.rs:11:20 | LL | let Baz: &str = \"\"; | --- help: `Baz` is defined here, but is not a type LL | LL | println!(\"{}\", Baz::Bar); | ^^^ use of undeclared type `Baz` error[E0433]: failed to resolve: use of undeclared type `Foo` --> $DIR/issue-81508.rs:20:24 | LL | use super::Foo; | ---------- help: `Foo` is defined here, but is not a type LL | fn function() { LL | println!(\"{}\", Foo::Bar); | ^^^ use of undeclared type `Foo` error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0433`. ", "positive_passages": [{"docid": "doc-en-rust-b938944c1214ae928865257ada4633ce6a6960bd753e4419e7dee27c7b8c9319", "text": "The following code... the following error and warning: The warning says that is not used but it clearly is, just not properly. This error is normally easier to spot when using the proper casing for constants, but that might not always be the case. Perhaps in this instance, we should look for other items with the exact same name and point out that the user is trying to use a constant as a type. $DIR/move-generic-to-trait-in-method-with-params.rs:14:7 | LL | 1.bar::(0); | ^^^ expected 0 generic arguments | note: associated function defined here, with 0 generic parameters --> $DIR/move-generic-to-trait-in-method-with-params.rs:4:8 | LL | fn bar(&self, _: T); | ^^^ help: consider moving this generic argument to the `Foo` trait, which takes up to 1 argument | LL | Foo::::bar(1, 0); | ~~~~~~~~~~~~~~~~~~~~~ help: remove these generics | LL - 1.bar::(0); LL + 1.bar(0); | error: aborting due to previous error For more information about this error, try `rustc --explain E0107`. ", "positive_passages": [{"docid": "doc-en-rust-ef349bda3e5399491202cffcb13e9bf27fd97ce21978676d4b5b302f64771b87", "text": "Repros on the /current nightly. But works (gives an error about mismatched number of generic arguments) on stable and beta. s/o to for the minimal example. : $DIR/ice-const-prop-unions-known-panics-lint-123710.rs:6:8 | LL | #[repr(packed)] | ^^^^^^ ... LL | / enum E { LL | | A, LL | | B, LL | | C, LL | | } | |_- not a struct or union error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union --> $DIR/ice-const-prop-unions-known-panics-lint-123710.rs:18:9 | LL | e: E, | ^^^^ | = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` help: wrap the field type in `ManuallyDrop<...>` | LL | e: std::mem::ManuallyDrop, | +++++++++++++++++++++++ + error: aborting due to 2 previous errors Some errors have detailed explanations: E0517, E0740. For more information about an error, try `rustc --explain E0517`. ", "positive_passages": [{"docid": "doc-en-rust-651822dde7f03b8b7642b7c8b849c3f5d11f6b55b60de92ad955f20d9df75cf4", "text": " $DIR/issue-76168-hr-outlives-3.rs:6:1 | LL | / async fn wrapper(f: F) LL | | LL | | LL | | LL | | where LL | | F:, LL | | for<'a> >::Output: Future