{"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, \"

Associated Types

Associated Types

\")?; 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: ![Collapsed long item](../images/collapsed-long-item.png) ## 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: ![Collapsed trait implementations](../images/collapsed-trait-impls.png) ## 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 + 'a, | |______________________________________________________________________________^ expected an `FnOnce<(&'a mut i32,)>` closure, found `i32` | = help: the trait `for<'a> FnOnce<(&'a mut i32,)>` is not implemented for `i32` error[E0277]: expected a `FnOnce<(&'a mut i32,)>` closure, found `i32` --> $DIR/issue-76168-hr-outlives-3.rs:6:10 | LL | async fn wrapper(f: F) | ^^^^^^^ expected an `FnOnce<(&'a mut i32,)>` closure, found `i32` | = help: the trait `for<'a> FnOnce<(&'a mut i32,)>` is not implemented for `i32` error[E0277]: expected a `FnOnce<(&'a mut i32,)>` closure, found `i32` --> $DIR/issue-76168-hr-outlives-3.rs:13:1 | LL | / { LL | | LL | | let mut i = 41; LL | | &mut i; LL | | } | |_^ expected an `FnOnce<(&'a mut i32,)>` closure, found `i32` | = help: the trait `for<'a> FnOnce<(&'a mut i32,)>` is not implemented for `i32` error[E0277]: expected a `FnOnce<(&'a mut i32,)>` closure, found `i32` --> $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 + 'a, | |______________________________________________________________________________^ expected an `FnOnce<(&'a mut i32,)>` closure, found `i32` | = help: the trait `for<'a> FnOnce<(&'a mut i32,)>` is not implemented for `i32` error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0277`. ", "positive_passages": [{"docid": "doc-en-rust-76825f15beefb2a3a86e9ecd78a0636de762d2753312696124b51f6978a4c8d1", "text": "File: auto-reduced (treereduce-rust): original: Version information ` Command: $DIR/issue-61525.rs:14:33 | LL | 1.query::(\"\") | ----- ^^ doesn't have a size known at compile-time | | | required by a bound introduced by this call | = help: the trait `Sized` is not implemented for `dyn ToString` note: required by a bound in `Example::query` --> $DIR/issue-61525.rs:2:14 | LL | fn query(self, q: Q); | ^ required by this bound in `Example::query` help: consider relaxing the implicit `Sized` restriction | LL | fn query(self, q: Q); | ++++++++ error[E0308]: mismatched types --> $DIR/issue-61525.rs:14:33 | LL | 1.query::(\"\") | --------------------- ^^ expected trait object `dyn ToString`, found `&str` | | | arguments to this function are incorrect | = note: expected trait object `dyn ToString` found reference `&'static str` note: associated function defined here --> $DIR/issue-61525.rs:2:8 | LL | fn query(self, q: Q); | ^^^^^ 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-c16ffc80e3a3c603e6c532b7f32ef5701e33d44873609f2de680f77e6970d3eb", "text": "Issues with this diagnostic: method is not being invoked on a trait object; it's invoked on the concrete value . note suggests importing the same trait that is already being reported about.\n/cc also looks relevant based on the title, but appears to have a different enough error message.\nIs the following output from enough?\nI don't feel like it's at the usual amazing quality . My points still appear to exist: In some magical world, I might hope for something like this (and I'm very flexible in that): I tried to address my points via the s.", "commid": "rust_issue_61525", "tokennum": 120}], "negative_passages": []} {"query_id": "q-en-rust-56f1b34cb9e1046b09c11c88d191e4a353f977a508c3e34a72d158e3428a6eaf", "query": "use serde::{Deserialize, Serialize}; /// rustdoc format-version. pub const FORMAT_VERSION: u32 = 19; pub const FORMAT_VERSION: u32 = 20; /// A `Crate` is the root of the emitted JSON blob. It contains all type/documentation information /// about the language items in the local crate, as well as info about external items to allow", "positive_passages": [{"docid": "doc-en-rust-391275bcc7fd56135dc48cca580fbec31af3bb7336ffb76edd332ec906ab494a", "text": "At some point their should also be a for , and probably a way to tell what position each of the non stripped items are, as currently each of these 3 variants are documented with the same inner. but HTML gets a good representation: The solution is probably to do what we do for structs, and store the , and a , such that each field of a varient gets an to hold the . We also should have a numfields, as even in that schema, you can't tell the difference between This also effects struct AFAIKT. I don't think this needs to be done now. I'll file an issue for it. Originally posted by in modify labels: +A-rustdoc-json +T-rustdoc\nRelated:", "commid": "rust_issue_100587", "tokennum": 161}], "negative_passages": []} {"query_id": "q-en-rust-571520cd07c95bf31cb5b874371740ae5030ece66556e91f74f1297955cf0253", "query": "opaque_type_key, self.fcx.infcx.tcx, true, decl.origin, ); self.typeck_results.concrete_opaque_types.insert(opaque_type_key.def_id, hidden_type);", "positive_passages": [{"docid": "doc-en-rust-fe873299a6560abcb51863096c00029337289a24d42450ef18a3b1805ae4fa41", "text": "Here is an example which uses a RPIT on a borrowed type in three different ways: IMO this is perfectly reasonable code and (EDIT: see below). On stable () we have the following: And on beta () and nightly () we get some additional errors: EDIT: On second thought, I guess the first error (on stable) is reasonable, since we are actually returning a in that case. If you either use in the body or in the return type then the error goes away. But the second error is still a regression. It most recently worked on: rustc 1.66.0 ( 2022-12-12) : modify labels: +regression-from-stable-to-beta -regression-untriaged\nThis is . Cc It is related to the invariance: Another case that doesn't rely on member constraints in the second function and yields a different error message: I also found a distantly related regression that doesn't require invariance. It looks like a missed subtyping opportunity:\nAnother version using TAIT: At this point there are two classes of regression: The first is related to the fact that and the the second requires more subtyping relations. label I-types-nominated T-types T-compiler\nWG-prioritization assigning priority (). label -I-prioritize +P-critical\nFrom beta crater: https://crater- https://crater- https://crater- https://crater- https://crater-\nunnominating as it will get fixed by which is approved again. Have to try to get this into beta though, only have 1 more day for that", "commid": "rust_issue_105826", "tokennum": 349}], "negative_passages": []} {"query_id": "q-en-rust-5735e746f1bfe1898f2eaf37fd50f88ec8140ce1762df589ae23497cabdd7818", "query": " {title} rel='stylesheet' type='text/css'> ", "positive_passages": [{"docid": "doc-en-rust-b3d8657d6a8e795205b127dc767644311d64f669b6ad03bba5dbf820d72d89a5", "text": "It's currently very bright and distracting (IMO). (Sorry :( ) Current scheme, for future triage/comparison purposes: !\nI think I should reconsider my career in graphic design.\nI'm looking at this.\n(The relevant file is , if you're lost. :) )\nBTW I was wondering, why not just use for src line numbering? Probably more optimized/idiomatic in the browser.\nAlso, it's pretty much impossible to have consistency between rustdoc and the old codemirror (tutorial) since both parsers behave very differently. would it be possible to pass the standalone documentation through rustdoc?\nDoesn't this mean every line is a new tag? Also, it possibly screws with copy-paste and making the formatting consistent. This bug is specifically about the colour scheme of rustdoc since it's so wild. Also, about using rustdoc for everything.\nMy preference for the highlighting scheme is bold for keywords, green for macros, red for strings (the current color is fine), gray for comments (would be nice if code within comments were highlighted). I'd also like to hear more suggestions before we change it.\nSomething I hacked up a few days ago: ! (The macro colour wasn't \"optimised\" at all.)\nNo, it would look like this: I think it would be better to use that since that's the browser native numberings. No it doesn't. The identifier of a list aren't inlined with the content. is an example.\nOh, awesome. It does seem like a good idea, if you can get that to work.\nAnother note: current rustdoc parsing could be improved, i.e. the \"ident\" class corresponds to variable names, function names, paths, parameters... could be more split if you ask me.\nThe highlighting is performed by just by the token types the lexer (with a little bit of extra logic for attributes, macros and $ non-terminals in macros) and so does not have that information.", "commid": "rust_issue_12648", "tokennum": 445}], "negative_passages": []} {"query_id": "q-en-rust-5742860fb2f0c83c20be2f9912588149d9a77b2d0a506350d86ec27f8b87c8ef", "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. trait Trait<'a> { type A; type B; } fn foo<'a, T: Trait<'a>>(value: T::A) { let new: T::B = unsafe { std::mem::transmute_copy(&value) }; } 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-5742860fb2f0c83c20be2f9912588149d9a77b2d0a506350d86ec27f8b87c8ef", "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. trait Trait<'a> { type A; type B; } fn foo<'a, T: Trait<'a>>(value: T::A) { let new: T::B = unsafe { std::mem::transmute_copy(&value) }; } 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-57de067e9ca54f40da2f44d0d961b89a7e6f50b27cf835b195cae6e76bda3582", "query": "Err(ManuallyDrop::into_inner(data.p)) }; // Compatibility wrapper around the try intrinsic for bootstrap #[inline] // Compatibility wrapper around the try intrinsic for bootstrap. // // We also need to mark it #[inline(never)] to work around a bug on MinGW // targets: the unwinding implementation was relying on UB, but this only // becomes a problem in practice if inlining is involved. #[cfg(not(bootstrap))] use intrinsics::r#try as do_try; #[cfg(bootstrap)] #[inline(never)] unsafe fn do_try(try_fn: fn(*mut u8), data: *mut u8, catch_fn: fn(*mut u8, *mut u8)) -> i32 { #[cfg(not(bootstrap))] { intrinsics::r#try(try_fn, data, catch_fn) } #[cfg(bootstrap)] { use crate::mem::MaybeUninit; use crate::mem::MaybeUninit; #[cfg(target_env = \"msvc\")] type TryPayload = [u64; 2]; #[cfg(not(target_env = \"msvc\"))] type TryPayload = *mut u8; let mut payload: MaybeUninit = MaybeUninit::uninit(); let payload_ptr = payload.as_mut_ptr() as *mut u8; let r = intrinsics::r#try(try_fn, data, payload_ptr); if r != 0 { #[cfg(target_env = \"msvc\")] type TryPayload = [u64; 2]; { catch_fn(data, payload_ptr) } #[cfg(not(target_env = \"msvc\"))] type TryPayload = *mut u8; let mut payload: MaybeUninit = MaybeUninit::uninit(); let payload_ptr = payload.as_mut_ptr() as *mut u8; let r = intrinsics::r#try(try_fn, data, payload_ptr); if r != 0 { #[cfg(target_env = \"msvc\")] { catch_fn(data, payload_ptr) } #[cfg(not(target_env = \"msvc\"))] { catch_fn(data, payload.assume_init()) } { catch_fn(data, payload.assume_init()) } r } r } // We consider unwinding to be rare, so mark this function as cold. However,", "positive_passages": [{"docid": "doc-en-rust-e9d8100ac7eb276e4aaab6f792a665bcceddca8e0a31f70ba27a80ba9df63391", "text": "This is a regression from the last couple of days. Looks like the compiler for something forever. Curiously, the run with completes successfully. I'll investigate in more detail. The list of tests: All of the tests are supposed to report errors.\nHere's the backtrace:\nLooks like this is caused by the recent unwinding changes. cc\nGCC toolchain version on which this reproduced:\nDoes this happen with stage 1 rustc or stage 2 rustc?\nStage 1, e.g. I'll check stage 2 now.\n( is confirmed to be the cause, removing .)\nI have a pretty good idea of what the problem might be. I'm traveling right now but I'll try to have a PR up by tonight.\nThe issue doesn't reproduce with a stage 2 compiler. That's great news long term, but broken stage 1 still makes any compiler work involving testing hard.\nI don't have a Windows machine to test on right now, but can you try marking and with in to see if that fixes the issue?\ncan you try marking and with in to see if that fixes the issue? It does! Thanks for a workaround.", "commid": "rust_issue_70001", "tokennum": 244}], "negative_passages": []} {"query_id": "q-en-rust-57ed291c409e1a25c7fad04cc6a9533bf4a65f660fbecc6e0231a6ea82b712d5", "query": "&exports, machine, !sess.target.is_like_msvc, /*comdat=*/ false, // Enable compatibility with MSVC's `/WHOLEARCHIVE` flag. // Without this flag a duplicate symbol error would be emitted // when linking a rust staticlib using `/WHOLEARCHIVE`. // See #129020 true, ) { sess.dcx() .emit_fatal(ErrorCreatingImportLibrary { lib_name, error: error.to_string() });", "positive_passages": [{"docid": "doc-en-rust-1f673285a43136ad2090db8d847211c32d41543f164f0d850ed81f8ccbb8fee7", "text": " $DIR/anon-struct-in-enum-issue-121446.rs:7:9 | LL | _ : struct { field: u8 }, | -^^^^^^^^^^^^^^^^^^^^^^^ | | | unnamed field declared here error: anonymous structs are not allowed outside of unnamed struct or union fields --> $DIR/anon-struct-in-enum-issue-121446.rs:7:13 | LL | _ : struct { field: u8 }, | ^^^^^^^^^^^^^^^^^^^^ anonymous struct declared here error: aborting due to 2 previous errors ", "positive_passages": [{"docid": "doc-en-rust-f80f22f5bb9c8c9c78515b12e85cfe91843d38e8c9feb5d708d2b1753ede9d46", "text": " $DIR/issue-114423.rs:7:51 | LL | let (r, alone_in_path, b): (f32, f32, f32) = (e.clone(), e.clone()); | ^ not found in this scope error[E0425]: cannot find value `e` in this scope --> $DIR/issue-114423.rs:7:62 | LL | let (r, alone_in_path, b): (f32, f32, f32) = (e.clone(), e.clone()); | ^ not found in this scope error[E0425]: cannot find value `g` in this scope --> $DIR/issue-114423.rs:11:22 | LL | let _ = RGB { r, g, b }; | ^ help: a local variable with a similar name exists: `b` error[E0308]: mismatched types --> $DIR/issue-114423.rs:7:50 | LL | let (r, alone_in_path, b): (f32, f32, f32) = (e.clone(), e.clone()); | --------------- ^^^^^^^^^^^^^^^^^^^^^^ expected a tuple with 3 elements, found one with 2 elements | | | expected due to this | = note: expected tuple `(f32, f32, f32)` found tuple `(f32, f32)` error[E0560]: struct `RGB` has no field named `r` --> $DIR/issue-114423.rs:11:19 | LL | let _ = RGB { r, g, b }; | ^ `RGB` does not have this field | = note: all struct fields are already assigned error[E0308]: mismatched types --> $DIR/issue-114423.rs:11:25 | LL | let _ = RGB { r, g, b }; | ^ expected `f64`, found `f32` | help: you can convert an `f32` to an `f64` | LL | let _ = RGB { r, g, b: b.into() }; | ++ +++++++ error: aborting due to 6 previous errors Some errors have detailed explanations: E0308, E0425, E0560. For more information about an error, try `rustc --explain E0308`. ", "positive_passages": [{"docid": "doc-en-rust-49f7f9434c8b6880119ba64b18ada18f4950029d6428478754d26bc34fb78e3e", "text": " $DIR/issue-87493.rs:8:22 | LL | T: MyTrait, | ^^ expected one of `,` or `>` | help: if you meant to use an associated type binding, replace `==` with `=` | LL | T: MyTrait, | ~ error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-87493.rs:8:8 | LL | T: MyTrait, | ^^^^^^^------------------- help: remove these generics | | | expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/issue-87493.rs:1:11 | LL | pub trait MyTrait { | ^^^^^^^ error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0107`. ", "positive_passages": [{"docid": "doc-en-rust-50307c3756b8989a9866045c26001d3649c684d8691c8cf012b49e48dbf1c105", "text": " $DIR/tabs-trimming.rs:9:16 | LL | ... v @ 1 | 2 | 3 => panic!(\"You gave me too little money {}\", v), // Long text here: TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT... | - ^ ^ pattern doesn't bind `v` | | | | | pattern doesn't bind `v` | variable not in all patterns error: aborting due to previous error For more information about this error, try `rustc --explain E0408`. ", "positive_passages": [{"docid": "doc-en-rust-64425a40f91c9452624f4b4e1343fbb293fe2a7c8a045f326b6f50b811e24bac", "text": "The code that truncates long lines doesn't take (hard) tabs into account, so the lines printed are off. Example code: Gives the following error: If you use four spaces instead of each tab it works as expected: cc and cc $DIR/hash-tyvid-regression-2.rs:12:16 | LL | self.0 == other | ^^ no implementation for `[B; _] == &&[A]` | = help: the trait `PartialEq<&&[A]>` is not implemented for `[B; _]` error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. ", "positive_passages": [{"docid": "doc-en-rust-3d2230ccded0ff5952dbebfbbd96c9c301c1ac68e367c71bd716549b3b445522", "text": " $DIR/hash-tyvid-regression-2.rs:12:16 | LL | self.0 == other | ^^ no implementation for `[B; _] == &&[A]` | = help: the trait `PartialEq<&&[A]>` is not implemented for `[B; _]` error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. ", "positive_passages": [{"docid": "doc-en-rust-1a3b49bd155e83a8f86240b49a187aef8e1c92419f3d78270ee3b5ee0b9101d7", "text": " $DIR/issue-109529.rs:4:14 | LL | for _ in 0..256 as u8 {} | ------^^^^^^ | | | help: use an inclusive range instead: `0..=255` | = note: `#[deny(overflowing_literals)]` on by default error: range endpoint is out of range for `u8` --> $DIR/issue-109529.rs:5:14 | LL | for _ in 0..(256 as u8) {} | ^^^^^^^^^^^^^^ | help: use an inclusive range instead | LL | for _ in 0..=(255 as u8) {} | + ~~~ error: aborting due to 2 previous errors ", "positive_passages": [{"docid": "doc-en-rust-4c24aedb050ae421ef19e0edb4462dd9b44b51c45102cda0baee816832bb9c71", "text": " $DIR/hash-tyvid-regression-4.rs:23:19 | LL | node.keys.push(k); | ^^^^ method not found in `SmallVec<_, { D * 2 }>` ... LL | struct SmallVec { | ---------------------------------- method `push` 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-4.rs:23:19 | LL | node.keys.push(k); | ^^^^ method not found in `SmallVec<_, { D * 2 }>` ... LL | struct SmallVec { | ---------------------------------- method `push` 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/dont-suggest-through-inner-const.rs:4:9 | LL | 0 | ^ expected `()`, found integer error[E0308]: mismatched types --> $DIR/dont-suggest-through-inner-const.rs:1:17 | LL | const fn f() -> usize { | - ^^^^^ expected `usize`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0308`. ", "positive_passages": [{"docid": "doc-en-rust-69e8ebdadaccb71e24a1f1056956d2bdc5df5472d6b42a806c036b01b72f3af5", "text": " $DIR/email-address-localhost.rs:3:18 | LL | //! Email me at . | ^^^^^ | note: the lint level is defined here --> $DIR/email-address-localhost.rs:1:9 | LL | #![deny(warnings)] | ^^^^^^^^ = note: `#[deny(rustdoc::broken_intra_doc_links)]` implied by `#[deny(warnings)]` error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-ed5c8be027b985e5f4fd9f9ab610f3363b642b43b281f6425d7359ea052dfdc3", "text": " $DIR/email-address-localhost.rs:3:18 | LL | //! Email me at . | ^^^^^ | note: the lint level is defined here --> $DIR/email-address-localhost.rs:1:9 | LL | #![deny(warnings)] | ^^^^^^^^ = note: `#[deny(rustdoc::broken_intra_doc_links)]` implied by `#[deny(warnings)]` error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-ec5c86d36e2ccf915fde06aa2abacec3469ee681fbc35d23134209ab13b462e6", "text": "Hmm, that seems useful, although I think it should be a separate issue. Maybe we could try resolving without a disambiguator and see if there are any results? That would need a pretty significant overhaul of how it works currently, right now all the errors are emitted eagerly which would end up with a lot more verbose output that might not be relevant. What would you expect to see if the link isn't valid even without the disambiguator?\nI think an extra to more docs on intradoc link disambiguators would be helpful per your previous comment. The idea to attempt to resolve items for all invalid disambiguators feels similar to the Ruby CLI and REPL's \"did you mean\" feature, which I find quite useful.\nThe PR improving the diagnostics is being reverted in , reopening the issue.\nI don't think this is still a regression; the diagnostics improvement was not part of the fix for the regression. (The regression was fixed in .)\nYeah, never had a tracking issue.\nwas relanded in", "commid": "rust_issue_83859", "tokennum": 225}], "negative_passages": []} {"query_id": "q-en-rust-66cd9fe95571bc5754b952dc8f04f5c3124779a464c5a12d111c3de21f30c5da", "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. // ignore-tidy-linelength #![deny(deprecated)] extern crate url; fn main() { let _ = url::Url::parse(\"http://example.com\"); //~^ ERROR use of deprecated item: This is being removed. Use rust-url instead. http://servo.github.io/rust-url/ } ", "positive_passages": [{"docid": "doc-en-rust-6c869a2cbace9b7640c821d2417335cc2c0b47eb4e792049d3fd0b2026b60232", "text": "The common fix for , , and is to rewrite the module based on the spec at and the tests at (Note: the tests assume the API, designed for JavaScript in web browsers. We do not necessarily want the same API for Rust outside of testing code.)\nI'm interested in this\nI have a work-in-progress implementation. I\u2019ll publish it later today so you can pick it up if you want.\nHere it is: Note that I\u2019m targeting Rust , the version used in Servo. (Though there is an upgrade being worked on.) IDNA and the actual URL parser are not there yet, but everything else (host/domain/ipv6, , percent encoding, test harness) is there. This should start being useful as soon as the URL parser is . The host parser returns an error on non-ASCII domains. This is good enough for now, IDNA support can be later. also made an in-progress implementation: It has some known bugs ( is incorrect with non-ASCII input, at least) but the parser code can probably be reused.\nAlso, be aware that the URL spec itself is still moving and has a number of open bugs:\nI Punycode encoding and decoding (with tests) to but not Nameprep, which is the other big part of IDNA.\nis now (IMHO) ready to replace . It is not \"done\" yet (some bugs remain, including in the spec!), but at this point it has more than feature-parity and is probably correct in more corner cases. Given the current tendency to move things out of , rust-url probably shouldn\u2019t move in. It could be distributed with rustc like the rest of the modules moving out of extra, but this has the downside of tying rust-url upgrades to compiler upgrades, and only weak advantages IMO. So, whenever the Rust team decides it\u2019s appropriate, I suggest removing and recommending rust-url as a replacement.\nI would generally be in favor of a in the distribution for now. This would certainly not be a package in long-term, but for now putting everything in this repo is the ad-hoc solution we have until we get a real package manager.\nIn that case, I\u2019d like to iterate a bit on rust-url (port rust-http and Servo to it, \u2026) before it moves into the distribution. Also, rust-url depends on rust-encoding, which I guess would have to move as well.", "commid": "rust_issue_10707", "tokennum": 536}], "negative_passages": []} {"query_id": "q-en-rust-66cd9fe95571bc5754b952dc8f04f5c3124779a464c5a12d111c3de21f30c5da", "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. // ignore-tidy-linelength #![deny(deprecated)] extern crate url; fn main() { let _ = url::Url::parse(\"http://example.com\"); //~^ ERROR use of deprecated item: This is being removed. Use rust-url instead. http://servo.github.io/rust-url/ } ", "positive_passages": [{"docid": "doc-en-rust-c6d46fb8c935676ed68e14ed1daa73769f5da4d7735333ff9fb7452a10a97b66", "text": "I\u2019d say rust-url is now in \"beta\" state. I have branches of rust-http and Servo using it: It builds with Cargo. It depends on rust-encoding (which also builds with Cargo), but for something non-essential that could be deactivated if avoiding the additional dependency helps. I\u2019d like people to start using it and give feedback. I think the best way to do that is to get rid of the old liburl. I\u2019ll go through the RFC process, but before that, what would you prefer? Replace liburl with snapshots[] of rust-url. You were in favor of this in February, but Cargo has reached alpha since then. Just remove liburl, and tell people to use rust-url through Cargo. Something else? [] In any case, I\u2019d like to keep a separate rust-url repository that I can update in Servo independently of language upgrades.\n+1 on removing liburl. Thanks\nPerhaps we can deprecate all of liburl for one release cycle.\nThis seems like a great place to let cargo shine.\nDeprecating sounds reasonable. That means emitting warnings by default, right?\nawesome work! I agree with and that I think this is where cargo shines, and we can probably just remove liburl entirely without re-adding rust-url. We can also try to grow more official support for it in terms of documentation and automation (not present currently). We can mark liburl as with a message to use instead which should ferry everyone along quickly.", "commid": "rust_issue_10707", "tokennum": 333}], "negative_passages": []} {"query_id": "q-en-rust-66cfd03b9f10f42560f5f491ba4b795ff727ca89f044a922054b29c21ee3a3f8", "query": "// @has - '//*[@class=\"sidebar-elems\"]//section//a' 'Output' // @has - '//div[@class=\"sidebar-elems\"]//h3/a[@href=\"#provided-associated-types\"]' 'Provided Associated Types' // @has - '//*[@class=\"sidebar-elems\"]//section//a' 'Extra' // @has - '//div[@class=\"sidebar-elems\"]//h3/a[@href=\"#object-safety\"]' 'Object Safety' pub trait Foo { const FOO: usize; const BAR: u32 = 0;", "positive_passages": [{"docid": "doc-en-rust-35c28d8ea440ebfcc681f2ae74cbdac9f7b1c7a84e16501bb7776e1556a8ce14", "text": "So that it is easy for user to recognize object-safe traits. $DIR/issue-111879-1.rs:12:1 | LL | fn main(_: for<'a> fn(Foo::Assoc)) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters | = note: expected fn pointer `fn()` found fn pointer `fn(for<'a> fn(Foo::Assoc))` error: aborting due to previous error For more information about this error, try `rustc --explain E0580`. ", "positive_passages": [{"docid": "doc-en-rust-cee077875e5d993b993a007e90fa0cfda7cd2684359386da511d80b45eb15eef", "text": " $DIR/issue-88577-check-fn-with-more-than-65535-arguments.rs:6:24 | LL | fn _f($($t: ()),*) {} | ________________________^ LL | | } LL | | } LL | | LL | | many_args!{[_]########## ######} | |____________^ error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-823f5923beec15ef48102c7a6a165e42a258a6c0a86ee9381c328ce25914cbf1", "text": "Obviously a corner case. This would never actually be used for anything, this is just testing the bounds of what the compiler is capable of. Running this Ruby method with numarguments or greater generates a Rust file which can be used to reproduce the output. (via ) : no_emit_shared: false, }, crate_name, output_format,", "positive_passages": [{"docid": "doc-en-rust-630fbdf6f4bad7544374a4cec0369fcfed806882bd299c49569ab1f0c09b2611", "text": " $DIR/issue-66286.rs:8:22 | LL | pub extern fn foo(_: Vec(u32)) -> u32 { | ^^^^^^^^ | | | only `Fn` traits may use parentheses | help: use angle brackets instead: `Vec` error: aborting due to previous error For more information about this error, try `rustc --explain E0214`. ", "positive_passages": [{"docid": "doc-en-rust-d4406a439fa5ef37eee61335d2d96c5ba0e3c87c5991da207243bae2675d1f8d", "text": "Follow up to and , as per Minimize a test that exercises the same codepath as\nAs already stated in the proc macro can be reduced to:\nHow do you write a UI test that depends on 3rd-party libraries?\nis an example of a test that relies on a procmacro, and we can use snippet for the necessary proc_macro being tested.", "commid": "rust_issue_66422", "tokennum": 77}], "negative_passages": []} {"query_id": "q-en-rust-696a6968dcf128204924de394a0d57f67d1ad11247a1138862771c24a3117238", "query": "} #[cfg(all( any(target_arch = \"aarch64\", target_arch = \"powerpc\", target_arch = \"x86_64\"), any( target_arch = \"aarch64\", target_arch = \"powerpc\", target_arch = \"s390x\", target_arch = \"x86_64\" ), any(not(target_arch = \"aarch64\"), not(any(target_os = \"macos\", target_os = \"ios\"))), not(target_family = \"wasm\"), not(target_arch = \"asmjs\"),", "positive_passages": [{"docid": "doc-en-rust-3b6d37b85b87809961d13b3aacfc8af720541aa3d2f65107747ed4cabb9e1826", "text": "fails this test on native : (This is not a new failure, but I am cleaning up issues from downstream Red Hat bugzilla.)\nWe started discussing this in , and looking at the clang implementation here: I tried that minimal step with , but it still gives the same \"Cannot select\" error. I don't see any lowering of in like other targets, only stuff implementing the calling convention. So I guess we do need custom support, or perhaps the clang bits could be moved down into the LLVM lowering?\nHi , I ran into the same problem and noticed you had already opened an issue. I've now submitted a PR to implement valist and vaarg for s390x to fix this.", "commid": "rust_issue_84628", "tokennum": 150}], "negative_passages": []} {"query_id": "q-en-rust-698ed1e0d75734afcca09b732dc4880d2f1953f48eaceef9547cf0cba15049e4", "query": " error: `extern` fn uses type `NotSafe`, which is not FFI-safe --> $DIR/lint-ctypes-113436-1.rs:22:22 | LL | extern \"C\" fn bar(x: Bar) -> Bar { | ^^^ not FFI-safe | = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct = note: this struct has unspecified layout note: the type is defined here --> $DIR/lint-ctypes-113436-1.rs:13:1 | LL | struct NotSafe(u32); | ^^^^^^^^^^^^^^ note: the lint level is defined here --> $DIR/lint-ctypes-113436-1.rs:1:9 | LL | #![deny(improper_ctypes_definitions)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `extern` fn uses type `NotSafe`, which is not FFI-safe --> $DIR/lint-ctypes-113436-1.rs:22:30 | LL | extern \"C\" fn bar(x: Bar) -> Bar { | ^^^ not FFI-safe | = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct = note: this struct has unspecified layout note: the type is defined here --> $DIR/lint-ctypes-113436-1.rs:13:1 | LL | struct NotSafe(u32); | ^^^^^^^^^^^^^^ error: aborting due to 2 previous errors ", "positive_passages": [{"docid": "doc-en-rust-8352c3ba10240db2f5ca27252eadfe2a73e84255e191404caefbde7ddd6a1eae", "text": "The function itself is considered FFI-safe and does not trigger the warning (). Its function pointer should also be allowed, to be consistent. Discovered on CI The original code has several more levels of indirection, but is also considered FFI-safe before. error: `extern` fn uses type `NotSafe`, which is not FFI-safe --> $DIR/lint-ctypes-113436-1.rs:22:22 | LL | extern \"C\" fn bar(x: Bar) -> Bar { | ^^^ not FFI-safe | = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct = note: this struct has unspecified layout note: the type is defined here --> $DIR/lint-ctypes-113436-1.rs:13:1 | LL | struct NotSafe(u32); | ^^^^^^^^^^^^^^ note: the lint level is defined here --> $DIR/lint-ctypes-113436-1.rs:1:9 | LL | #![deny(improper_ctypes_definitions)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `extern` fn uses type `NotSafe`, which is not FFI-safe --> $DIR/lint-ctypes-113436-1.rs:22:30 | LL | extern \"C\" fn bar(x: Bar) -> Bar { | ^^^ not FFI-safe | = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct = note: this struct has unspecified layout note: the type is defined here --> $DIR/lint-ctypes-113436-1.rs:13:1 | LL | struct NotSafe(u32); | ^^^^^^^^^^^^^^ error: aborting due to 2 previous errors ", "positive_passages": [{"docid": "doc-en-rust-635c3fdda76f51ba64072b3c9223f9ba0d80a26e5ad9a0c1cf36ece784b6125f", "text": "With and without my pull request, when you change this to , it doesn't lint.\nI'll nominate this issue so that it sees some discussion - see also and .\nI posted some more info on zulip but it may also worth mentioning here. ZST is still zero-sized under repr(C), rather than FFI-unsafe.\nThe issue now also exists in beta. I also found uitests which seems to expect ZST to be FFI-safe, but ends in to suppress the warning and tests nothing.\nWe discussed this in today's meeting. We didn't have consensus that this should warn; at least some people thought the code in the top comment should continue to compile without warnings. We did have consensus that changing that (to warn) would need an FCP. So, we felt that we'd like to see a fix removing the warning applied to beta and nightly, and then separately if someone wants to propose that we change this to warn, we could evaluate that and do an FCP on it. But at the moment the temperature of the team seems to be that we don't have consensus for such an FCP.\nWG-prioritization assigning priority (). label -I-prioritize +P-medium\nlabels -I-lang-nominated We rendered our opinion", "commid": "rust_issue_113436", "tokennum": 276}], "negative_passages": []} {"query_id": "q-en-rust-69936b11fb2c9a114bda6238e7d15aaf72819ab1cd163cc0873b199e41772056", "query": "pub fn foo(arg: Option<&Vec>) -> Option<&[i32]> { arg //~ ERROR 5:5: 5:8: mismatched types [E0308] } pub fn bar(arg: Option<&Vec>) -> &[i32] { arg.unwrap_or(&[]) //~ ERROR 9:19: 9:22: mismatched types [E0308] } pub fn barzz<'a>(arg: Option<&'a Vec>, v: &'a [i32]) -> &'a [i32] { arg.unwrap_or(v) //~ ERROR 13:19: 13:20: mismatched types [E0308] } pub fn convert_result(arg: Result<&Vec, ()>) -> &[i32] { arg.unwrap_or(&[]) //~ ERROR 17:19: 17:22: mismatched types [E0308] } ", "positive_passages": [{"docid": "doc-en-rust-6aadeb26bbb8604f903b369697d153cd0212a649272295ca6af26c79107f1998", "text": "Given : Current error, for the motivating use case above: It should be possible for rustc to suggest replacing this specific instantiation of with . Maybe similarly for some other common cases: . Originally posted by in label -T-rustdoc T-compiler", "commid": "rust_issue_127545", "tokennum": 54}], "negative_passages": []} {"query_id": "q-en-rust-69d876371a07dbc862162092dc8e57c9e5f3dd62e5f779def05c99a59f8d3c97", "query": " error[E0706]: trait fns cannot be declared `async` --> $DIR/async-trait-fn.rs:3:5 | LL | async fn foo() {} | ^^^^^^^^^^^^^^^^^ | = note: `async` trait functions are not currently supported = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait error[E0706]: trait fns cannot be declared `async` --> $DIR/async-trait-fn.rs:4:5 | LL | async fn bar(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^ | = note: `async` trait functions are not currently supported = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0706`. ", "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-107090.rs:4:9 | LL | Foo<'short, 'out, T>: Convert<'a, 'b>; | ^^^^^^ undeclared lifetime | = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html help: consider making the bound lifetime-generic with a new `'short` lifetime | LL | for<'short> Foo<'short, 'out, T>: Convert<'a, 'b>; | +++++++++++ help: consider introducing lifetime `'short` here | LL | struct Foo<'short, 'a, 'b, T>(PhantomData<(&'a (), &'b (), T)>) | +++++++ error[E0261]: use of undeclared lifetime name `'out` --> $DIR/issue-107090.rs:4:17 | LL | Foo<'short, 'out, T>: Convert<'a, 'b>; | ^^^^ undeclared lifetime | help: consider making the bound lifetime-generic with a new `'out` lifetime | LL | for<'out> Foo<'short, 'out, T>: Convert<'a, 'b>; | +++++++++ help: consider introducing lifetime `'out` here | LL | struct Foo<'out, 'a, 'b, T>(PhantomData<(&'a (), &'b (), T)>) | +++++ error[E0261]: use of undeclared lifetime name `'b` --> $DIR/issue-107090.rs:13:47 | LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { | - ^^ undeclared lifetime | | | help: consider introducing lifetime `'b` here: `'b,` error[E0261]: use of undeclared lifetime name `'out` --> $DIR/issue-107090.rs:13:67 | LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { | - help: consider introducing lifetime `'out` here: `'out,` ^^^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'out` --> $DIR/issue-107090.rs:17:49 | LL | fn cast(&'long self) -> &'short Foo<'short, 'out, T> { | ^^^^ undeclared lifetime | help: consider introducing lifetime `'out` here | LL | fn cast<'out>(&'long self) -> &'short Foo<'short, 'out, T> { | ++++++ help: consider introducing lifetime `'out` here | LL | impl<'out, 'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { | +++++ error[E0261]: use of undeclared lifetime name `'short` --> $DIR/issue-107090.rs:24:68 | LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T { | - ^^^^^^ undeclared lifetime | | | help: consider introducing lifetime `'short` here: `'short,` error[E0308]: mismatched types --> $DIR/issue-107090.rs:4:27 | LL | Foo<'short, 'out, T>: Convert<'a, 'b>; | ^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected trait `Convert<'static, 'static>` found trait `Convert<'a, 'b>` note: the lifetime `'a` as defined here... --> $DIR/issue-107090.rs:2:12 | LL | struct Foo<'a, 'b, T>(PhantomData<(&'a (), &'b (), T)>) | ^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types --> $DIR/issue-107090.rs:4:27 | LL | Foo<'short, 'out, T>: Convert<'a, 'b>; | ^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected trait `Convert<'static, 'static>` found trait `Convert<'a, 'b>` note: the lifetime `'b` as defined here... --> $DIR/issue-107090.rs:2:16 | LL | struct Foo<'a, 'b, T>(PhantomData<(&'a (), &'b (), T)>) | ^^ = note: ...does not necessarily outlive the static lifetime error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'long` due to conflicting requirements --> $DIR/issue-107090.rs:13:55 | LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { | ^^^^^^^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime `'short` as defined here... --> $DIR/issue-107090.rs:13:21 | LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { | ^^^^^^ = note: ...but the lifetime must also be valid for the static lifetime... note: ...so that the types are compatible --> $DIR/issue-107090.rs:13:55 | LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { | ^^^^^^^^^^^^^^^^^^^^ = note: expected `Convert<'short, 'static>` found `Convert<'_, 'static>` error: incompatible lifetime on type --> $DIR/issue-107090.rs:24:29 | LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T { | ^^^^^^^^^^^^^^^^^^ | note: because this has an unmet lifetime requirement --> $DIR/issue-107090.rs:4:27 | LL | Foo<'short, 'out, T>: Convert<'a, 'b>; | ^^^^^^^^^^^^^^^ introduces a `'static` lifetime requirement note: the lifetime `'out` as defined here... --> $DIR/issue-107090.rs:24:17 | LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T { | ^^^^ note: ...does not necessarily outlive the static lifetime introduced by the compatible `impl` --> $DIR/issue-107090.rs:13:1 | LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0759]: `x` has lifetime `'in_` but it needs to satisfy a `'static` lifetime requirement --> $DIR/issue-107090.rs:24:29 | LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T { | ^^^^^^^^^^^^^^^^^^ | | | this data with lifetime `'in_`... | ...is used and required to live as long as `'static` here error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'long` due to conflicting requirements --> $DIR/issue-107090.rs:17:13 | LL | fn cast(&'long self) -> &'short Foo<'short, 'out, T> { | ^^^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime `'short` as defined here... --> $DIR/issue-107090.rs:13:21 | LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { | ^^^^^^ = note: ...but the lifetime must also be valid for the static lifetime... note: ...so that the types are compatible --> $DIR/issue-107090.rs:17:13 | LL | fn cast(&'long self) -> &'short Foo<'short, 'out, T> { | ^^^^^^^^^^^ = note: expected `Convert<'short, 'static>` found `Convert<'_, 'static>` error: aborting due to 12 previous errors Some errors have detailed explanations: E0261, E0308, E0495, E0759. For more information about an error, try `rustc --explain E0261`. ", "positive_passages": [{"docid": "doc-en-rust-ddd42d40a8a9d852644f308d79d6aa49e0788ff4daf49dea65b1acf798fc9ce1", "text": "[ ] Previous Stable [ ] Current Stable [ ] Current Beta [X] Current Nightly No response $DIR/issue-84632-eager-expansion-recursion-limit.rs:8:28 | LL | (A, $($A:ident),*) => (concat!(\"\", a!($($A),*))) | ^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | a!(A, A, A, A, A, A, A, A, A, A, A); | ------------------------------------ in this macro invocation | = help: consider adding a `#![recursion_limit=\"30\"]` attribute to your crate (`issue_84632_eager_expansion_recursion_limit`) = note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-95cc04d8d34a149b89d1127a7422b35801db9367481f52bee49e06039811c959", "text": "I tried this code: I expected to see this happen: An error message about exceeding some recursion limit Instead, this happened: Tested on stable 1.51.0 + $DIR/check-builtin-attr-ice.rs:43:7 | LL | #[should_panic::skip] | ^^^^^^^^^^^^ use of undeclared crate or module `should_panic` error[E0433]: failed to resolve: use of undeclared crate or module `should_panic` --> $DIR/check-builtin-attr-ice.rs:47:7 | LL | #[should_panic::a::b::c] | ^^^^^^^^^^^^ use of undeclared crate or module `should_panic` error[E0433]: failed to resolve: use of undeclared crate or module `deny` --> $DIR/check-builtin-attr-ice.rs:55:7 | LL | #[deny::skip] | ^^^^ use of undeclared crate or module `deny` error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0433`. ", "positive_passages": [{"docid": "doc-en-rust-d564dd652645d1cc46d492d1a4a426cc59a6ed942f9b4470489c1e8cc379c4b8", "text": " $DIR/unusual-rib-combinations.rs:29:22", "positive_passages": [{"docid": "doc-en-rust-069d28633ae9d648b5bf2f905a638ad1e21fd30da30065bffd12366a26e281e8", "text": " $DIR/issue-102335-gat.rs:2:21 | LL | type A: S = ()>; | ^^^^^^^^ 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/lifetime-in-const-param.rs:5:23 | LL | struct S<'a, const N: S2>(&'a ()); | ^^ expected named lifetime parameter error: `S2<'_>` is forbidden as the type of a const generic parameter --> $DIR/lifetime-in-const-param.rs:5:23 | LL | struct S<'a, const N: S2>(&'a ()); | ^^ | = note: the only supported types are integers, `bool` and `char` = help: more complex types are supported with `#![feature(adt_const_params)]` error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0106`. ", "positive_passages": [{"docid": "doc-en-rust-069d28633ae9d648b5bf2f905a638ad1e21fd30da30065bffd12366a26e281e8", "text": " $DIR/issue-57597.rs:8:7 | LL | ($($($i:ident)?)+) => {}; | ^^^^^^^^^^^^^^ error: repetition matches empty token tree --> $DIR/issue-57597.rs:13:7 | LL | ($($($i:ident)?)*) => {}; | ^^^^^^^^^^^^^^ error: repetition matches empty token tree --> $DIR/issue-57597.rs:18:7 | LL | ($($($i:ident)?)?) => {}; | ^^^^^^^^^^^^^^ error: repetition matches empty token tree --> $DIR/issue-57597.rs:23:7 | LL | ($($($($i:ident)?)?)?) => {}; | ^^^^^^^^^^^^^^^^^^ error: repetition matches empty token tree --> $DIR/issue-57597.rs:28:7 | LL | ($($($($i:ident)*)?)?) => {}; | ^^^^^^^^^^^^^^^^^^ error: repetition matches empty token tree --> $DIR/issue-57597.rs:33:7 | LL | ($($($($i:ident)?)*)?) => {}; | ^^^^^^^^^^^^^^^^^^ error: repetition matches empty token tree --> $DIR/issue-57597.rs:38:7 | LL | ($($($($i:ident)?)?)*) => {}; | ^^^^^^^^^^^^^^^^^^ error: repetition matches empty token tree --> $DIR/issue-57597.rs:43:7 | LL | ($($($($i:ident)*)*)?) => {}; | ^^^^^^^^^^^^^^^^^^ error: repetition matches empty token tree --> $DIR/issue-57597.rs:48:7 | LL | ($($($($i:ident)?)*)*) => {}; | ^^^^^^^^^^^^^^^^^^ error: repetition matches empty token tree --> $DIR/issue-57597.rs:53:7 | LL | ($($($($i:ident)?)*)+) => {}; | ^^^^^^^^^^^^^^^^^^ error: repetition matches empty token tree --> $DIR/issue-57597.rs:58:7 | LL | ($($($($i:ident)+)?)*) => {}; | ^^^^^^^^^^^^^^^^^^ error: repetition matches empty token tree --> $DIR/issue-57597.rs:63:7 | LL | ($($($($i:ident)+)*)?) => {}; | ^^^^^^^^^^^^^^^^^^ error: aborting due to 12 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-6f6d06b0a0ad14364bb973838aa32f3a8f013da80a32488c893f1ac632b1312f", "query": "// Does the expected pattern type originate from an expression and what is the span? let (origin_expr, ty_span) = match (decl.ty, decl.init) { (Some(ty), _) => (false, Some(ty.span)), // Bias towards the explicit user type. (Some(ty), _) => (None, Some(ty.span)), // Bias towards the explicit user type. (_, Some(init)) => { (true, Some(init.span.find_ancestor_inside(decl.span).unwrap_or(init.span))) (Some(init), Some(init.span.find_ancestor_inside(decl.span).unwrap_or(init.span))) } // No explicit type; so use the scrutinee. _ => (false, None), // We have `let $pat;`, so the expected type is unconstrained. _ => (None, None), // We have `let $pat;`, so the expected type is unconstrained. }; // Type check the pattern. Override if necessary to avoid knock-on errors.", "positive_passages": [{"docid": "doc-en-rust-8364654c680aca994ac402f2bc837d515b8da5f2d6729d63bb2cffdb02b283ee", "text": " $DIR/opaque-and-lifetime-mismatch.rs:5:24 | LL | fn bar() -> Wrapper; | ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`, or if you will only have owned values | LL | fn bar() -> Wrapper<'static, impl Sized>; | ++++++++ error[E0412]: cannot find type `T` in this scope --> $DIR/opaque-and-lifetime-mismatch.rs:1:22 | LL | struct Wrapper<'rom>(T); | ^ not found in this scope | help: you might be missing a type parameter | LL | struct Wrapper<'rom, T>(T); | +++ error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied --> $DIR/opaque-and-lifetime-mismatch.rs:5:17 | LL | fn bar() -> Wrapper; | ^^^^^^^ ---------- help: remove this generic argument | | | expected 0 generic arguments | note: struct defined here, with 0 generic parameters --> $DIR/opaque-and-lifetime-mismatch.rs:1:8 | LL | struct Wrapper<'rom>(T); | ^^^^^^^ error[E0053]: method `bar` has an incompatible return type for trait --> $DIR/opaque-and-lifetime-mismatch.rs:11:17 | LL | fn bar() -> i32 { | ^^^ | | | expected `Wrapper<'static>`, found `i32` | return type in trait error[E0053]: method `bar` has an incompatible type for trait --> $DIR/opaque-and-lifetime-mismatch.rs:11:17 | LL | fn bar() -> i32 { | ^^^ | | | expected `Wrapper<'static>`, found `i32` | help: change the output type to match the trait: `Wrapper<'static>` | note: type in trait --> $DIR/opaque-and-lifetime-mismatch.rs:5:17 | LL | fn bar() -> Wrapper; | ^^^^^^^^^^^^^^^^^^^ = note: expected signature `fn() -> Wrapper<'static>` found signature `fn() -> i32` error: aborting due to 5 previous errors Some errors have detailed explanations: E0053, E0106, E0107, E0412. For more information about an error, try `rustc --explain E0053`. ", "positive_passages": [{"docid": "doc-en-rust-89f168dabbd0c420b05792e06df90b670c0c5c3f2ad290b5c27e6bb79193d744", "text": " $DIR/issue-91206.rs:13:5 | LL | let inner = client.get_inner_ref(); | ----- help: consider changing this to be a mutable reference: `&mut Vec` LL | LL | inner.clear(); | ^^^^^^^^^^^^^ `inner` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to previous error For more information about this error, try `rustc --explain E0596`. ", "positive_passages": [{"docid": "doc-en-rust-dd1d30cca1a2c7ea2c583eb50d75a96e64ad1f3c5c0de5e3bf31ef920ef82db7", "text": " $DIR/ice-bad-err-span-in-template-129503.rs:12:10 | LL | asm!(concat!(r#\"lJ\ud800\udfff\u00c6\ufffd.\ud800\udfff\ufffd\"#, \"r} {}\")); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unmatched `}` in asm template string | = note: if you intended to print `}`, you can escape it using `}}` = note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info) error: invalid asm template string: unmatched `}` found --> $DIR/ice-bad-err-span-in-template-129503.rs:18:10 | LL | asm!(concat!(\"abc\", \"r} {}\")); | ^^^^^^^^^^^^^^^^^^^^^^^ unmatched `}` in asm template string | = note: if you intended to print `}`, you can escape it using `}}` = note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info) error: invalid asm template string: unmatched `}` found --> $DIR/ice-bad-err-span-in-template-129503.rs:24:19 | LL | asm!(\"abc\", \"r} {}\"); | ^ unmatched `}` in asm template string | = note: if you intended to print `}`, you can escape it using `}}` error: aborting due to 3 previous errors ", "positive_passages": [{"docid": "doc-en-rust-b35ca9e67ed820a3fd2786dea91e49267f2741bc1ff3cb14a6f39e85a7bcadd4", "text": " $DIR/ice-wf-missing-span-in-error-130012.rs:9:28 | LL | trait MyTrait: for<'a> Fun {} | ^^^^^^^^^^^^^^ error[E0582]: binding for associated type `Assoc` references lifetime `'a`, which does not appear in the trait input types --> $DIR/ice-wf-missing-span-in-error-130012.rs:9:28 | LL | trait MyTrait: for<'a> Fun {} | ^^^^^^^^^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0582]: binding for associated type `Assoc` references lifetime `'a`, which does not appear in the trait input types --> $DIR/ice-wf-missing-span-in-error-130012.rs:9:28 | LL | trait MyTrait: for<'a> Fun {} | ^^^^^^^^^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0582]: binding for associated type `Assoc` references lifetime `'b`, which does not appear in the trait input types --> $DIR/ice-wf-missing-span-in-error-130012.rs:14:21 | LL | impl Fun> MyTrait for F {} | ^^^^^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/ice-wf-missing-span-in-error-130012.rs:14:50 | LL | impl Fun> MyTrait for F {} | ^ lifetime mismatch | = note: expected reference `&()` found reference `&'b ()` error: aborting due to 5 previous errors Some errors have detailed explanations: E0308, E0582. For more information about an error, try `rustc --explain E0308`. ", "positive_passages": [{"docid": "doc-en-rust-4f4191a9e2c8e3b06f1085b04822c60cd645d66e29b748b1a7d4a3151423534e", "text": ": current nightly #[test] fn bufreader_full_initialize() { struct OneByteReader; impl Read for OneByteReader { fn read(&mut self, buf: &mut [u8]) -> crate::io::Result { if buf.len() > 0 { buf[0] = 0; Ok(1) } else { Ok(0) } } } let mut reader = BufReader::new(OneByteReader); // Nothing is initialized yet. assert_eq!(reader.initialized(), 0); let buf = reader.fill_buf().unwrap(); // We read one byte... assert_eq!(buf.len(), 1); // But we initialized the whole buffer! assert_eq!(reader.initialized(), reader.capacity()); } ", "positive_passages": [{"docid": "doc-en-rust-5446e9d4754de4243f0e43a778f61f3abe98aa80b5dd5b260502a66b35a73a53", "text": "I tried this code: I expected to see this happen: Instead, this happened: The problem doesn't occur with optimization enabled. It most recently worked on: Also fails on: modify labels: +regression-from-stable-to-stable -regression-untriaged T must be Copy // Captures of variable the given id by a closure (span is the", "positive_passages": [{"docid": "doc-en-rust-cd05abfbd828719249c06e3e881d256200cd0a3ba0015f94126fbb769c26b16e", "text": "The following code causes an ICE: Removing the parameter or changing it to be a value instead of a reference stops the crash with an error saying I need to specify a lifetime, which makes me think this is a problem related to inferred lifetimes.\nIt isn't, you just have to specify a lifetime: ICE-s as well. Returning an unsized type should be a typeck error.\nhappens to work because it implies , i.e. would also work.", "commid": "rust_issue_18107", "tokennum": 98}], "negative_passages": []} {"query_id": "q-en-rust-788e077dbdc3706bbf0ce5308d1e30d749aec9065c84e347be7875bf8fe4cbc5", "query": "if let Categorization::Local(local_id) = err.cmt.cat { let span = self.tcx.map.span(local_id); if let Ok(snippet) = self.tcx.sess.codemap().span_to_snippet(span) { db.span_suggestion( span, &format!(\"to make the {} mutable, use `mut` as shown:\", self.cmt_to_string(&err.cmt)), format!(\"mut {}\", snippet)); if snippet != \"self\" { db.span_suggestion( span, &format!(\"to make the {} mutable, use `mut` as shown:\", self.cmt_to_string(&err.cmt)), format!(\"mut {}\", snippet)); } } } }", "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-78a48c269bab1d74336b91a800376f8c14b5f1d46e1a4404afb8df9ae9b44897", "query": "parent_item: Option, report_on: ReportOn, ) { fn get_parent_if_enum_variant<'tcx>( tcx: TyCtxt<'tcx>, may_variant: LocalDefId, ) -> LocalDefId { if let Node::Variant(_) = tcx.hir_node_by_def_id(may_variant) && let Some(enum_did) = tcx.opt_parent(may_variant.to_def_id()) && let Some(enum_local_id) = enum_did.as_local() && let Node::Item(item) = tcx.hir_node_by_def_id(enum_local_id) && let ItemKind::Enum(_, _) = item.kind { enum_local_id } else { may_variant } } let Some(&first_item) = dead_codes.first() else { return; };", "positive_passages": [{"docid": "doc-en-rust-7d1d43d98633b28498eaf0cdc11ca95ded9885adc883a1d8d2158b5d64532105", "text": " $DIR/dollar-crate-is-keyword.rs:9:9 | LL | use $crate; // OK LL | use $crate; | ^^^^^^^^^^^ ... LL | m!(); | ----- in this macro invocation | = note: `use $crate;` was erroneously allowed and will become a hard error in a future release warning: `$crate` may not be imported --> $DIR/dollar-crate-is-keyword.rs:11:9 error: `$crate` may not be imported --> $DIR/dollar-crate-is-keyword.rs:10:9 | LL | use $crate as $crate; | ^^^^^^^^^^^^^^^^^^^^^ ... LL | m!(); | ----- in this macro invocation | = note: `use $crate;` was erroneously allowed and will become a hard error in a future release error: aborting due to 2 previous errors error: aborting due to 4 previous errors ", "positive_passages": [{"docid": "doc-en-rust-b1119119317c0a4693a12f5e3eaa2d16f5cf978893f5d048e050a2ba1d77a229", "text": "The warning was introduced in to avoid breakage from .\nPresumably the next step is to make this an error by default.\nTriage: Digging through all the linked issues is tough, and it's not clear to me exactly what this warning is or does. can you maybe elaborate a little?\nThis needs to be turned into an error, i.e. behave like basically:\nRelevant code is here: Should be easy to turn that into and then do a crater run.", "commid": "rust_issue_37390", "tokennum": 95}], "negative_passages": []} {"query_id": "q-en-rust-79cac1470f473535a3844d271c6392c4b74bebd34375a2d1bd56d8e43b15c2bf", "query": "/// ``` #[macro_export] macro_rules! write { ($dst:expr, $($arg:tt)*) => ((&mut *$dst).write_fmt(format_args!($($arg)*))) ($dst:expr, $($arg:tt)*) => ($dst.write_fmt(format_args!($($arg)*))) } /// Equivalent to the `write!` macro, except that a newline is appended after", "positive_passages": [{"docid": "doc-en-rust-cddaa217d569a7fc3a76395aab6e857f0c94fa46cf6328ba162cc9a418bc35c8", "text": "For clarity, the second call to ends up using the impl on . cc I had concerns about this kind of thing when these impls were being introduced but I thought I convinced myself that this kind of thing couldn't happen. Did something change in the way we designed these impls since then?\nPossible solutions are to either remove the impl for or update to prevent it from invoking . Seems to me like the second is the better approach.\nI believe the reason for the was because it was considered a good thing to require callers to explicitly pass references. I think we've actually gone back and forth on that a few times. Are we committed now to allowing callers to just say ?", "commid": "rust_issue_23768", "tokennum": 142}], "negative_passages": []} {"query_id": "q-en-rust-79eb50ba043b4281a0ba3dd915cc26fa8c24b8998d940bdc8f4f3bf6feb7142f", "query": "use libc::{mmap, munmap}; use libc::{sigaction, sighandler_t, SA_ONSTACK, SA_SIGINFO, SIGBUS, SIG_DFL}; use libc::{sigaltstack, SIGSTKSZ, SS_DISABLE}; use libc::{MAP_ANON, MAP_PRIVATE, PROT_READ, PROT_WRITE, SIGSEGV}; use libc::{MAP_ANON, MAP_PRIVATE, PROT_NONE, PROT_READ, PROT_WRITE, SIGSEGV}; use crate::sys::unix::os::page_size; use crate::sys_common::thread_info; #[cfg(any(target_os = \"linux\", target_os = \"android\"))]", "positive_passages": [{"docid": "doc-en-rust-42efa3621d6fc0f3abba49939a097f860c13c6c3247bed092f54c43438ec2f41", "text": "Rust's runtime installs a signal handler to distinguish stack overflows from other faults. This requires using an alternate signal stack (), which we create with the default size . That's usually quite small, 8KB or so depending on the target, but it's still plenty for what the handler is doing. There's currently no guard page like we have on normal stacks. That alternate stack is shared by all signals for a thread, so if a user installs any other signal handler, and they opt in with the flag , they'll be limited to the same tiny stack. If their handler happens to be more involved and overflows that stack, it may silently clobber other memory. If we had a guard page on the signal stack, that would cause a process abort instead. This was reported to the Security Response WG with a reproducer in . However, after discussion we decided to treat this as a normal issue for a few reasons: Setting a custom signal handler requires code. Signal handlers already run in a quite constrained environment, e.g. . It's unusual to use for signals other than , and if you choose so, you also bear responsibility to make sure that stack suffices. Nevertheless, as a defensive measure, it's still a reasonable idea to map a guard page when Rust is creating its signal stack, so an unexpected overflow will abort rather than silently corrupting memory. For full protection, that would also depend on the guard page not being skipped, but not all targets have stack probes yet (). Thanks to for reporting this in accordance with our , even though we have decided not to treat this as a security issue at this time. cc\ncc This is another reason we perhaps shouldn't be registering the signal handler... cc", "commid": "rust_issue_69533", "tokennum": 372}], "negative_passages": []} {"query_id": "q-en-rust-7a2038ecbb2fe74aa3c3438c9f52e4de0a58982a6d75c712ff994f9b525eab40", "query": "let source = pprust::token_to_string(self); parse_stream_from_source_str(FileName::MacroExpansion, source, sess, Some(span)) }); // During early phases of the compiler the AST could get modified // directly (e.g. attributes added or removed) and the internal cache // of tokens my not be invalidated or updated. Consequently if the // \"lossless\" token stream disagrees with our actual stringification // (which has historically been much more battle-tested) then we go // with the lossy stream anyway (losing span information). // // Note that the comparison isn't `==` here to avoid comparing spans, // but it *also* is a \"probable\" equality which is a pretty weird // definition. We mostly want to catch actual changes to the AST // like a `#[cfg]` being processed or some weird `macro_rules!` // expansion. // // What we *don't* want to catch is the fact that a user-defined // literal like `0xf` is stringified as `15`, causing the cached token // stream to not be literal `==` token-wise (ignoring spans) to the // token stream we got from stringification. // // Instead the \"probably equal\" check here is \"does each token // recursively have the same discriminant?\" We basically don't look at // the token values here and assume that such fine grained modifications // of token streams doesn't happen. if let Some(tokens) = tokens { if tokens.eq_unspanned(&tokens_for_real) { if tokens.probably_equal_for_proc_macro(&tokens_for_real) { return tokens } } return tokens_for_real } // See comments in `interpolated_to_tokenstream` for why we care about // *probably* equal here rather than actual equality pub fn probably_equal_for_proc_macro(&self, other: &Token) -> bool { if mem::discriminant(self) != mem::discriminant(other) { return false } match (self, other) { (&Eq, &Eq) | (&Lt, &Lt) | (&Le, &Le) | (&EqEq, &EqEq) | (&Ne, &Ne) | (&Ge, &Ge) | (&Gt, &Gt) | (&AndAnd, &AndAnd) | (&OrOr, &OrOr) | (&Not, &Not) | (&Tilde, &Tilde) | (&At, &At) | (&Dot, &Dot) | (&DotDot, &DotDot) | (&DotDotDot, &DotDotDot) | (&DotDotEq, &DotDotEq) | (&DotEq, &DotEq) | (&Comma, &Comma) | (&Semi, &Semi) | (&Colon, &Colon) | (&ModSep, &ModSep) | (&RArrow, &RArrow) | (&LArrow, &LArrow) | (&FatArrow, &FatArrow) | (&Pound, &Pound) | (&Dollar, &Dollar) | (&Question, &Question) | (&Whitespace, &Whitespace) | (&Comment, &Comment) | (&Eof, &Eof) => true, (&BinOp(a), &BinOp(b)) | (&BinOpEq(a), &BinOpEq(b)) => a == b, (&OpenDelim(a), &OpenDelim(b)) | (&CloseDelim(a), &CloseDelim(b)) => a == b, (&DocComment(a), &DocComment(b)) | (&Shebang(a), &Shebang(b)) => a == b, (&Lifetime(a), &Lifetime(b)) => a.name == b.name, (&Ident(a, b), &Ident(c, d)) => a.name == c.name && b == d, (&Literal(ref a, b), &Literal(ref c, d)) => { b == d && a.probably_equal_for_proc_macro(c) } (&Interpolated(_), &Interpolated(_)) => false, _ => panic!(\"forgot to add a token?\"), } } } #[derive(Clone, RustcEncodable, RustcDecodable, Eq, Hash)]", "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-7a2038ecbb2fe74aa3c3438c9f52e4de0a58982a6d75c712ff994f9b525eab40", "query": "let source = pprust::token_to_string(self); parse_stream_from_source_str(FileName::MacroExpansion, source, sess, Some(span)) }); // During early phases of the compiler the AST could get modified // directly (e.g. attributes added or removed) and the internal cache // of tokens my not be invalidated or updated. Consequently if the // \"lossless\" token stream disagrees with our actual stringification // (which has historically been much more battle-tested) then we go // with the lossy stream anyway (losing span information). // // Note that the comparison isn't `==` here to avoid comparing spans, // but it *also* is a \"probable\" equality which is a pretty weird // definition. We mostly want to catch actual changes to the AST // like a `#[cfg]` being processed or some weird `macro_rules!` // expansion. // // What we *don't* want to catch is the fact that a user-defined // literal like `0xf` is stringified as `15`, causing the cached token // stream to not be literal `==` token-wise (ignoring spans) to the // token stream we got from stringification. // // Instead the \"probably equal\" check here is \"does each token // recursively have the same discriminant?\" We basically don't look at // the token values here and assume that such fine grained modifications // of token streams doesn't happen. if let Some(tokens) = tokens { if tokens.eq_unspanned(&tokens_for_real) { if tokens.probably_equal_for_proc_macro(&tokens_for_real) { return tokens } } return tokens_for_real } // See comments in `interpolated_to_tokenstream` for why we care about // *probably* equal here rather than actual equality pub fn probably_equal_for_proc_macro(&self, other: &Token) -> bool { if mem::discriminant(self) != mem::discriminant(other) { return false } match (self, other) { (&Eq, &Eq) | (&Lt, &Lt) | (&Le, &Le) | (&EqEq, &EqEq) | (&Ne, &Ne) | (&Ge, &Ge) | (&Gt, &Gt) | (&AndAnd, &AndAnd) | (&OrOr, &OrOr) | (&Not, &Not) | (&Tilde, &Tilde) | (&At, &At) | (&Dot, &Dot) | (&DotDot, &DotDot) | (&DotDotDot, &DotDotDot) | (&DotDotEq, &DotDotEq) | (&DotEq, &DotEq) | (&Comma, &Comma) | (&Semi, &Semi) | (&Colon, &Colon) | (&ModSep, &ModSep) | (&RArrow, &RArrow) | (&LArrow, &LArrow) | (&FatArrow, &FatArrow) | (&Pound, &Pound) | (&Dollar, &Dollar) | (&Question, &Question) | (&Whitespace, &Whitespace) | (&Comment, &Comment) | (&Eof, &Eof) => true, (&BinOp(a), &BinOp(b)) | (&BinOpEq(a), &BinOpEq(b)) => a == b, (&OpenDelim(a), &OpenDelim(b)) | (&CloseDelim(a), &CloseDelim(b)) => a == b, (&DocComment(a), &DocComment(b)) | (&Shebang(a), &Shebang(b)) => a == b, (&Lifetime(a), &Lifetime(b)) => a.name == b.name, (&Ident(a, b), &Ident(c, d)) => a.name == c.name && b == d, (&Literal(ref a, b), &Literal(ref c, d)) => { b == d && a.probably_equal_for_proc_macro(c) } (&Interpolated(_), &Interpolated(_)) => false, _ => panic!(\"forgot to add a token?\"), } } } #[derive(Clone, RustcEncodable, RustcDecodable, Eq, Hash)]", "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-7a274ab162ced45742c809ba7e2283191d97e0b42664a261e6527343c59facc2", "query": "// no-pretty-expanded FIXME #15189 // ignore-android FIXME #17520 // ignore-msvc FIXME #28133 // compile-flags:-g use std::env; use std::process::{Command, Stdio}; use std::str; use std::ops::{Drop, FnMut, FnOnce}; #[inline(never)] fn foo() {", "positive_passages": [{"docid": "doc-en-rust-ed2a157f8548e7f99da6bf94b373b5426bc4d1c4716e7901a3d6da58105c1343", "text": "Symbol names are not properly supported yet on msvc, so backtraces are generally unhelpful. As a result, is currently disabled. This issue can be closed when it's been reenabled.", "commid": "rust_issue_28133", "tokennum": 44}], "negative_passages": []} {"query_id": "q-en-rust-7a3e9beca7582a3f8fc783da56c050cb20a8424a67da6484af2d318bcfd08c24", "query": "types that do not implement `Drop` can still have drop glue, consider instead using `{$needs_drop}` to detect whether a type is trivially dropped lint_range_endpoint_out_of_range = range endpoint is out of range for `{$ty}` .suggestion = use an inclusive range instead lint_range_use_inclusive_range = use an inclusive range instead lint_overflowing_bin_hex = literal out of range for `{$ty}` .negative_note = the literal `{$lit}` (decimal `{$dec}`) does not fit into the type `{$ty}`", "positive_passages": [{"docid": "doc-en-rust-4c24aedb050ae421ef19e0edb4462dd9b44b51c45102cda0baee816832bb9c71", "text": " $DIR/allocator.rs:24:9 | LL | let x = Box::new_in(1i32, MyAllocatorWhichMustNotSuspend); | ^ LL | LL | suspend().await; | ----- the value is held across this suspend point | help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point --> $DIR/allocator.rs:24:9 | LL | let x = Box::new_in(1i32, MyAllocatorWhichMustNotSuspend); | ^ note: the lint level is defined here --> $DIR/allocator.rs:4:9 | LL | #![deny(must_not_suspend)] | ^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error ", "positive_passages": [{"docid": "doc-en-rust-81202eb06f4d2b512360f446dd3a07c6b132036af43d84cf2d2b903fe8703cc0", "text": "This code here has a potential issue: If the Box has a custom allocator, then that will not be checked at all. So whatever is used for, it ignores anything stored in custom allocators. It seems like this is just for a lint, so this is probably not critical, but I guess should still be fixed. Cc -- not sure whom else to ping for coroutine state machine transform things?\nCc (also a regular occurrence in this file's )\nLol sorry, I thought I had clicked enter on a comment but I must've not. Let me rewrite it. Yeah, this is approximately the level of urgency you determined. This code exists for an unstable lint, . I don't expect people to be writing , but technically they could.", "commid": "rust_issue_122643", "tokennum": 162}], "negative_passages": []} {"query_id": "q-en-rust-7e8a7919a8d758c766ac1c4bc02a1d04939e6aa1f2a5b5d6caabf18b718c6324", "query": "across a recover boundary\"] pub trait RecoverSafe {} /// A marker trait representing types which do not contain an `UnsafeCell` by /// value internally. /// A marker trait representing types where a shared reference is considered /// recover safe. /// /// This trait is namely not implemented by `UnsafeCell`, the root of all /// interior mutability. /// /// This is a \"helper marker trait\" used to provide impl blocks for the /// `RecoverSafe` trait, for more information see that documentation.", "positive_passages": [{"docid": "doc-en-rust-abe57cfb3503c7aa622e867784cbdde0b8aae22dbfad46b0299a928797cf1ee5", "text": "Test Case 1: Test Case 2: Both produce errors like this: CC\nHm, so the first case here should work (e.g. should subvert basically everything), although the second case is correct in yielding an error (albeit not a very good one)\nIs the second case not allowed then? 's documentation suggests that manually implementing it is okay to do: I figured only existed to wrap types which you couldn't yourself, but for which you can ensure their invariants are upheld across the boundary. And what about moving values into the closure? can't be unwrapped, at least not currently.\nOh wait sorry I misread your second example, I failed to notice the manual ! This is basically a case where closure captures are coming into play. The closures aren't annotated with , so outer variables are captured by-reference which means that the actual types being tested against the trait here are and . In the first case that should be handled by , but the second is legitimately indicating that it's not a recover-safe type (b/c the reference is different than the by-value). You should be able to get around this via either plus or via . Certainly an interesting interaction going on here though. One would likely expect that if isn't recover safe that would fix the problem but it's likely what you really need to do is due to the way closures largely work.\nThere's , why not ? Coherence?\nNah unfortunately that'd defeat the purpose of the distinction. The type is itself recover safe, it's just that's not (so the distinction need to be there)\nIt's unfortunate that fails due to coherence or something like that:\nHm interesting, I guess yeah you'll be forced to move the reference inside the wrapper rather than having a reference to the wrapper\nIs it possible to implement then? My use case can contain and friends but I'm guaranteeing that they're unobservable in user code after recovery because I immediately re-panic after escaping the FFI stack.\nI guess I can just use once it's fixed :stuckouttongue:. I see your PR has been accepted so I'll look forward to trying it on tonight's nightly. When do the buildbots fire?\nYeah currently you can implement (being renamed to ) I believe (although I can't say I've tried). For now though yeah I'd recommend just using plus closures.", "commid": "rust_issue_30510", "tokennum": 517}], "negative_passages": []} {"query_id": "q-en-rust-7e8a7919a8d758c766ac1c4bc02a1d04939e6aa1f2a5b5d6caabf18b718c6324", "query": "across a recover boundary\"] pub trait RecoverSafe {} /// A marker trait representing types which do not contain an `UnsafeCell` by /// value internally. /// A marker trait representing types where a shared reference is considered /// recover safe. /// /// This trait is namely not implemented by `UnsafeCell`, the root of all /// interior mutability. /// /// This is a \"helper marker trait\" used to provide impl blocks for the /// `RecoverSafe` trait, for more information see that documentation.", "positive_passages": [{"docid": "doc-en-rust-5f930fb09367aa911719c3220b88cc1dd726251a4231338dcf4980a127fca724", "text": "The PR is in but'll take a few hours at least to land.\nthe problem with moving at this point in time is that I call in different branches of a but I pass the same closed-over value to it; I can't do the branch in the closure because I need to do some FFI cleanup afterwards regardless of whether a panic happened or not (which also requires the closed-over value). It would help if derived and/or so I could reuse it without constructing a new value for each arm, but that would probably require some discussion because I don't know if it's safe or not. I'll probably just implement and fix the name after your PR drops. A quick check confirms that it works just fine. Thanks anyways!\nOh yeah we could totally add more traits like and to , there shouldn't be any safety concerns there.\nUpdating code to modern functions and traits in makes this compile, so I'm going to close.", "commid": "rust_issue_30510", "tokennum": 202}], "negative_passages": []} {"query_id": "q-en-rust-7e98df629249153e894f5cdb0a290c836cb7061af115f5956b630133b79f2eb6", "query": "// tokens like `<<` from `rustc_lexer`, and then add fancier error recovery to it, // as there will be less overall work to do this way. let token = unicode_chars::check_for_substitution(self, start, c, &mut err); if c == 'x00' { err.help(\"source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used\"); } err.emit(); token? }", "positive_passages": [{"docid": "doc-en-rust-0a37c29a4caf843c7997cf4d0f5ca438b8375b17cebd620023cdee2b8fc25ff3", "text": " $DIR/default-body-with-rpit.rs:10:28 | LL | async fn baz(&self) -> impl Debug { | ^^^^^^^^^^ cannot resolve opaque type | = note: these returned values have a concrete \"never\" type = help: this error will resolve once the item's body returns a concrete type error: aborting due to previous error For more information about this error, try `rustc --explain E0720`. ", "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-809fd0775a481122ec11e79ab2d21591082b0059af84d2a7e6be2dd917f2b9d1", "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. #![feature(rustc_attrs)] enum Abc { A(u8), B(i8), C, D, } #[rustc_mir] fn foo(x: Abc) -> i32 { match x { Abc::C => 3, Abc::D => 4, Abc::B(_) => 2, Abc::A(_) => 1, } } #[rustc_mir] fn foo2(x: Abc) -> bool { match x { Abc::D => true, _ => false } } fn main() { assert_eq!(1, foo(Abc::A(42))); assert_eq!(2, foo(Abc::B(-100))); assert_eq!(3, foo(Abc::C)); assert_eq!(4, foo(Abc::D)); assert_eq!(false, foo2(Abc::A(1))); assert_eq!(false, foo2(Abc::B(2))); assert_eq!(false, foo2(Abc::C)); assert_eq!(true, foo2(Abc::D)); } ", "positive_passages": [{"docid": "doc-en-rust-84e4f5cad8122f71b557f941ba671b806238437a1dd8f067af03c48b92c9060a", "text": "The Switch terminator, which is used in pattern matching, is currently unimplemented in MIR. This terminator should load the discriminant from an lvalue and branch to the appropriate basic block target based on what is found there. It has to integrate with the code.", "commid": "rust_issue_29574", "tokennum": 60}], "negative_passages": []} {"query_id": "q-en-rust-80b21ded77695030493ae0dc7ec3c1366bfb18cec15f43a994d333ee2be70fb5", "query": " // Regression test for . #![no_core] #![feature(no_core)] // @has \"$.index[*][?(@.name=='ParseError')]\" // @has \"$.index[*][?(@.name=='UnexpectedEndTag')]\" // @is \"$.index[*][?(@.name=='UnexpectedEndTag')].inner.variant_kind\" '\"tuple\"' // @is \"$.index[*][?(@.name=='UnexpectedEndTag')].inner.variant_inner\" [] pub enum ParseError { UnexpectedEndTag(#[doc(hidden)] u32), } ", "positive_passages": [{"docid": "doc-en-rust-391275bcc7fd56135dc48cca580fbec31af3bb7336ffb76edd332ec906ab494a", "text": "At some point their should also be a for , and probably a way to tell what position each of the non stripped items are, as currently each of these 3 variants are documented with the same inner. but HTML gets a good representation: The solution is probably to do what we do for structs, and store the , and a , such that each field of a varient gets an to hold the . We also should have a numfields, as even in that schema, you can't tell the difference between This also effects struct AFAIKT. I don't think this needs to be done now. I'll file an issue for it. Originally posted by in modify labels: +A-rustdoc-json +T-rustdoc\nRelated:", "commid": "rust_issue_100587", "tokennum": 161}], "negative_passages": []} {"query_id": "q-en-rust-80ed051665603204b1bb2cdcdfb8e45d9f31a4bb7151f8deb72ce7d0bef903da", "query": "Ok(result.callee) } pub fn lookup_method_for_diagnostic( &self, self_ty: Ty<'tcx>, segment: &hir::PathSegment<'_>, span: Span, call_expr: &'tcx hir::Expr<'tcx>, self_expr: &'tcx hir::Expr<'tcx>, ) -> Result, MethodError<'tcx>> { let pick = self.lookup_probe_for_diagnostic( segment.ident, self_ty, call_expr, ProbeScope::TraitsInScope, None, )?; Ok(self .confirm_method_for_diagnostic(span, self_expr, call_expr, self_ty, &pick, segment) .callee) } #[instrument(level = \"debug\", skip(self, call_expr))] pub fn lookup_probe( &self,", "positive_passages": [{"docid": "doc-en-rust-a8330ee981d0f9818c626d87a5e2d8ceda48b1300780bdd03ad7a226a0963b19", "text": " $DIR/unused-variant.rs:11:5 | LL | enum TupleVariant { | ------------ variant in this enum LL | Variant1(i32), | ^^^^^^^^ | = note: `TupleVariant` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis error: variant `Variant1` is never constructed --> $DIR/unused-variant.rs:17:5 | LL | enum StructVariant { | ------------- variant in this enum LL | Variant1 { id: i32 }, | ^^^^^^^^ | = note: `StructVariant` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis error: aborting due to 3 previous errors ", "positive_passages": [{"docid": "doc-en-rust-7d1d43d98633b28498eaf0cdc11ca95ded9885adc883a1d8d2158b5d64532105", "text": " $DIR/issue-101477-enum.rs:6:7", "positive_passages": [{"docid": "doc-en-rust-a7aaa3fd74686a30b6cfd7d26d89bdc2670056406cb578d376a945fbd70871b8", "text": " $DIR/issue-36122-accessing-externed-dst.rs:3:24 | LL | static symbol: [usize]; | ^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[usize]` = note: to learn more, visit error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. ", "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[E0277]: the size for values of type `[usize]` cannot be known at compilation time --> $DIR/issue-36122-accessing-externed-dst.rs:3:24 | LL | static symbol: [usize]; | ^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[usize]` = note: to learn more, visit error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. ", "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[E0277]: the size for values of type `[usize]` cannot be known at compilation time --> $DIR/issue-36122-accessing-externed-dst.rs:3:24 | LL | static symbol: [usize]; | ^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[usize]` = note: to learn more, visit error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. ", "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-82da87c69080c55809a5fbaa1b0c4da5194bf55964d33cd3e2a4a321f9d70dd1", "query": " error[E0277]: the size for values of type `[usize]` cannot be known at compilation time --> $DIR/issue-36122-accessing-externed-dst.rs:3:24 | LL | static symbol: [usize]; | ^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[usize]` = note: to learn more, visit error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. ", "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-82f77d7ec752e13c01534cffae8dec0e7abf2aecd0f344109954990002917b29", "query": "LL | arg.map(|v| &**v) | ++++++++++++++ error: aborting due to 1 previous error error[E0308]: mismatched types --> $DIR/transforming-option-ref-issue-127545.rs:9:19 | LL | arg.unwrap_or(&[]) | --------- ^^^ expected `&Vec`, found `&[_; 0]` | | | arguments to this method are incorrect | = note: expected reference `&Vec` found reference `&[_; 0]` help: the return type of this call is `&[_; 0]` due to the type of the argument passed --> $DIR/transforming-option-ref-issue-127545.rs:9:5 | LL | arg.unwrap_or(&[]) | ^^^^^^^^^^^^^^---^ | | | this argument influences the return type of `unwrap_or` note: method defined here --> $SRC_DIR/core/src/option.rs:LL:COL help: use `Option::map_or` to deref inner value of `Option` | LL | arg.map_or(&[], |v| v) | ~~~~~~ +++++++ error[E0308]: mismatched types --> $DIR/transforming-option-ref-issue-127545.rs:13:19 | LL | arg.unwrap_or(v) | --------- ^ expected `&Vec`, found `&[i32]` | | | arguments to this method are incorrect | = note: expected reference `&Vec` found reference `&'a [i32]` help: the return type of this call is `&'a [i32]` due to the type of the argument passed --> $DIR/transforming-option-ref-issue-127545.rs:13:5 | LL | arg.unwrap_or(v) | ^^^^^^^^^^^^^^-^ | | | this argument influences the return type of `unwrap_or` note: method defined here --> $SRC_DIR/core/src/option.rs:LL:COL help: use `Option::map_or` to deref inner value of `Option` | LL | arg.map_or(v, |v| v) | ~~~~~~ +++++++ error[E0308]: mismatched types --> $DIR/transforming-option-ref-issue-127545.rs:17:19 | LL | arg.unwrap_or(&[]) | --------- ^^^ expected `&Vec`, found `&[_; 0]` | | | arguments to this method are incorrect | = note: expected reference `&Vec` found reference `&[_; 0]` help: the return type of this call is `&[_; 0]` due to the type of the argument passed --> $DIR/transforming-option-ref-issue-127545.rs:17:5 | LL | arg.unwrap_or(&[]) | ^^^^^^^^^^^^^^---^ | | | this argument influences the return type of `unwrap_or` note: method defined here --> $SRC_DIR/core/src/result.rs:LL:COL help: use `Result::map_or` to deref inner value of `Result` | LL | arg.map_or(&[], |v| v) | ~~~~~~ +++++++ error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0308`.", "positive_passages": [{"docid": "doc-en-rust-6aadeb26bbb8604f903b369697d153cd0212a649272295ca6af26c79107f1998", "text": "Given : Current error, for the motivating use case above: It should be possible for rustc to suggest replacing this specific instantiation of with . Maybe similarly for some other common cases: . Originally posted by in label -T-rustdoc T-compiler", "commid": "rust_issue_127545", "tokennum": 54}], "negative_passages": []} {"query_id": "q-en-rust-8303ff161ab4e39c5bb600e265bd6a3c3a8c312958f2d105a7b433f5324397a8", "query": " // check-pass // compile-flags: -Z validate-mir #![feature(let_chains)] fn let_chains(entry: std::io::Result) { if let Ok(entry) = entry && let Some(s) = entry.file_name().to_str() && s.contains(\"\") {} } fn main() {} ", "positive_passages": [{"docid": "doc-en-rust-3ae3c9996baf6859e232444ceea049a7d1db70e003268714139829e93d8a8211", "text": " $DIR/issue-99625-enum-struct-mutually-exclusive.rs:3:5 | LL | pub enum struct Range { | ^^^^^^^^^^^ help: replace `enum struct` with: `enum` error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-5727839d9cec81600dba85d9727e7da6ae076d8e465123a20a5048c6e9ca8b91", "text": " $DIR/issue-98601-delimiter-error-unexpected-close.rs:5:17 | LL | fn main() { | - this opening brace... LL | todo!(); LL | } | - ...matches this closing brace LL | LL | fn other(_: i32)) {} | ^ unexpected closing delimiter error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-068f5993f15057b65031dbd32195c4000961b87cb41da17c4ae89c41efbd330c", "text": "See: This code: produces on latest stable (1.61.0).\nMaybe we could form a heuristic around tokens that we know should eventually be followed by -- , , , etc. If we see one of those, (then some random other tokens), then we see , then that would be a suspicious rbrace which we could point out later.. e.g. if we see that triggers the heuristic, but not\nThe problem is that the error happens in the lexer, not the parser. Ideally we'd rework the lexer to have a token stream mode of operation instead of a token tree mode of operation, only for code that is being passed to the parser (i.e., not coming from a macro).\nThis is particularly confusing when the points to a macro: gives on 1.65.0-nightly (2022-08-31 )\nthe output now changed to: Do you think the should be removed?\nThis is changed to: it seems more helpful now.\nLet's close this ticket after adding these two cases to the test suite then. I'm sure there are outstanding issues in this area, but we can hope that we'll get tickets for those more specific cases, while the tests keep us from regressing silently (hopefully, lets make sure the tests are fully annotated so its harder to do that by accident).", "commid": "rust_issue_98601", "tokennum": 293}], "negative_passages": []} {"query_id": "q-en-rust-83fb5a5595d8bfadc69a01c99749539609decb5baae9f56dc453df7052d4ef36", "query": "// Float => does not implement iterator. for i in 0f32..42f32 {} //~^ ERROR `core::iter::Iterator` is not implemented for the type `core::ops::Range` //~^^ ERROR //~^^^ ERROR // FIXME(#21528) not fulfilled obligation error should be reported once, not thrice //~^ ERROR the trait `core::num::Int` is not implemented for the type `f32` // Unsized type. let arr: &[_] = &[1us, 2, 3];", "positive_passages": [{"docid": "doc-en-rust-2319d3aeffef3df4afa4337194330c0b590ed7fc0449018f9bc4d667bd73cc0a", "text": "cc\nI think you have a PR that improves type inference in some cases where closures are involved (?), do you know if by chance that fixes this as well?\nThis is not closure specific:\nThis must be duo to . It seems to enforce the numeric fallback rule a bit too eagerly.\nAnother example from IRC is that type checked while didn't. Rather interesting.\nedwardw, not just that, type inference regressed slightly at the time of the range stabilization PR.\nalso related\nHave a partial fix by deferring numeric fallback, but it seems to hit now.\nOK, so I spent some time digging into this. I don't think that deferring numeric fallback is necessarily the solution. sorry if I kept disappearing on IRC, I had to put my head down and study the log to see what was happening. So what seems to happen is that we correctly come up with the constraint: However, we are unable to make the connection between and . The reason is that the new has separate impls for each of the numeric types, whereas the old had only impl for a type . When we process the projections, we first try to resolve (without considering the output type ), and we get ambiguity, because there are many impls that could apply. Unfortunately this all seems a bit right to me. Basically we're trying to infer the type of the range from the output type, which is the reverse direction inference is supposed to go. When we used a blanket impl, we were able to resolve this because there was only one impl for . Probably the best fix is to go back to that, actually, but this is an interesting quandry. I'll have to think about it a bit.\nTo be clear, the example I was digging into was\nAlso, to put it another way: having a single blanket impl allows us to draw the connection that when you iterate over , you get . With the current setup of many distinct impls, that is not known to be true.\nAfter some discussion with on RFC, I just wanted to clarify a few things (I myself was a touch confused too). the impl is probably the easiest way to fix this in the short term. , to some extent, this limitation is an artifact of how trait matching is implemented. That is, we intentionally do not take output bindings into account when selecting traits.", "commid": "rust_issue_21672", "tokennum": 496}], "negative_passages": []} {"query_id": "q-en-rust-83fb5a5595d8bfadc69a01c99749539609decb5baae9f56dc453df7052d4ef36", "query": "// Float => does not implement iterator. for i in 0f32..42f32 {} //~^ ERROR `core::iter::Iterator` is not implemented for the type `core::ops::Range` //~^^ ERROR //~^^^ ERROR // FIXME(#21528) not fulfilled obligation error should be reported once, not thrice //~^ ERROR the trait `core::num::Int` is not implemented for the type `f32` // Unsized type. let arr: &[_] = &[1us, 2, 3];", "positive_passages": [{"docid": "doc-en-rust-cd741434b6b2b72ac0e351e73f7c00f4bb567f323f992f1ddad96f5ea753d9c6", "text": "However, it doesn't have to be this way, but it'd take some work to massage the trait matching infrastructure, since impl selection doesn't presently have access to output binding information, that'd have to be propagated inward. It might be interesting to try and address this in a more wholistic way (i.e., something that accounts for the full set of facts that are registered). particular, the important constraint that we MUST maintain is that, during trans, given the input types, we can derive the output type. But it's permissible for us to use the output type to derive the input type during type checking, since once inference is done, we then have the input types to supply during trans so that we can rederive the output.\nThe fix is very simple then. Thanks for helping diagnose the problem and pointing to the right direction.", "commid": "rust_issue_21672", "tokennum": 184}], "negative_passages": []} {"query_id": "q-en-rust-83fb5a5595d8bfadc69a01c99749539609decb5baae9f56dc453df7052d4ef36", "query": "// Float => does not implement iterator. for i in 0f32..42f32 {} //~^ ERROR `core::iter::Iterator` is not implemented for the type `core::ops::Range` //~^^ ERROR //~^^^ ERROR // FIXME(#21528) not fulfilled obligation error should be reported once, not thrice //~^ ERROR the trait `core::num::Int` is not implemented for the type `f32` // Unsized type. let arr: &[_] = &[1us, 2, 3];", "positive_passages": [{"docid": "doc-en-rust-e78ecff5a2959681f3ada82545c65b70d3de6cee9632f3a27e67c4e8a7656c7e", "text": "This code compiled fine before 1.0.0-nightly ( 2015-01-23 16:08:14 +0000): But with that version, it now gives this error:\nchanging to should work, I stumbled upon the same thing and the doc seems to be updated: (see at the very bottom) EDIT: Maybe worth noting that these work:\nThat's just a workaround to a bug (not sure if that was implied). should fall back to being as per the existence of the integer fallback.\nI don't necessarily expect this to work. Fallback comes late in the process, once all constraints are known, but (like method dispatch) requires the type being cast to be known immediately.\nIt's plausible we could make it work since we know that the type is integral (I imagine that's how it ever worked, not sure what would have changed that, though it might have been something I did). It occurs to me though that this is somewhat forward-hostile to the idea of integer literals ever being used for anything other than plain ints (but enabling such a feature may well wind up requiring opt-in anyway).\n(Though really it's sort of silly that requires the type to be known immediately, so I guess fixing that would be another way to ease the forward compat fears.)\nI thought this was a feature because it's saying that it doesn't know if it's or for example. Would it assume it's signed only if it contains negative numbers in the range? EDIT3: what said makes sense: EDIT2: ignore the following, my bad But I might be missing something because this doesn't output anything from : EDIT: just realized -1u32 is too big so the following makes sense: There's no output from , unless using", "commid": "rust_issue_21595", "tokennum": 377}], "negative_passages": []} {"query_id": "q-en-rust-840a775eacf6eba96a10eadd30e82887dc901ea7fe96b648abd39ef50641f1db", "query": "/// [`Metadata`]: struct.Metadata.html /// [`fs::metadata`]: fn.metadata.html /// [`fs::symlink_metadata`]: fn.symlink_metadata.html /// [`is_dir`]: struct.FileType.html#method.is_dir /// [`is_file`]: struct.FileType.html#method.is_file /// [`is_symlink`]: struct.FileType.html#method.is_symlink /// /// # Examples", "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-842aeac0ee1ee04937e0063ef82af90ff3c57ebec0a99d582d8da7073ef6ea62", "query": "unsafe { Box::from_raw(Box::into_raw(v) as *mut str) } } /// Converts the bytes while the bytes are still ascii. /// Converts leading ascii bytes in `s` by calling the `convert` function. /// /// For better average performance, this happens in chunks of `2*size_of::()`. /// Returns a vec with the converted bytes. /// /// Returns a tuple of the converted prefix and the remainder starting from /// the first non-ascii character. /// /// This function is only public so that it can be verified in a codegen test, /// see `issue-123712-str-to-lower-autovectorization.rs`. #[unstable(feature = \"str_internals\", issue = \"none\")] #[doc(hidden)] #[inline] #[cfg(not(test))] #[cfg(not(no_global_oom_handling))] fn convert_while_ascii(b: &[u8], convert: fn(&u8) -> u8) -> Vec { let mut out = Vec::with_capacity(b.len()); pub fn convert_while_ascii(s: &str, convert: fn(&u8) -> u8) -> (String, &str) { // Process the input in chunks of 16 bytes to enable auto-vectorization. // Previously the chunk size depended on the size of `usize`, // but on 32-bit platforms with sse or neon is also the better choice. // The only downside on other platforms would be a bit more loop-unrolling. const N: usize = 16; let mut slice = s.as_bytes(); let mut out = Vec::with_capacity(slice.len()); let mut out_slice = out.spare_capacity_mut(); let mut ascii_prefix_len = 0_usize; let mut is_ascii = [false; N]; while slice.len() >= N { // SAFETY: checked in loop condition let chunk = unsafe { slice.get_unchecked(..N) }; // SAFETY: out_slice has at least same length as input slice and gets sliced with the same offsets let out_chunk = unsafe { out_slice.get_unchecked_mut(..N) }; for j in 0..N { is_ascii[j] = chunk[j] <= 127; } const USIZE_SIZE: usize = mem::size_of::(); const MAGIC_UNROLL: usize = 2; const N: usize = USIZE_SIZE * MAGIC_UNROLL; const NONASCII_MASK: usize = usize::from_ne_bytes([0x80; USIZE_SIZE]); // Auto-vectorization for this check is a bit fragile, sum and comparing against the chunk // size gives the best result, specifically a pmovmsk instruction on x86. // See https://github.com/llvm/llvm-project/issues/96395 for why llvm currently does not // currently recognize other similar idioms. if is_ascii.iter().map(|x| *x as u8).sum::() as usize != N { break; } let mut i = 0; unsafe { while i + N <= b.len() { // Safety: we have checks the sizes `b` and `out` to know that our let in_chunk = b.get_unchecked(i..i + N); let out_chunk = out.spare_capacity_mut().get_unchecked_mut(i..i + N); let mut bits = 0; for j in 0..MAGIC_UNROLL { // read the bytes 1 usize at a time (unaligned since we haven't checked the alignment) // safety: in_chunk is valid bytes in the range bits |= in_chunk.as_ptr().cast::().add(j).read_unaligned(); } // if our chunks aren't ascii, then return only the prior bytes as init if bits & NONASCII_MASK != 0 { break; } for j in 0..N { out_chunk[j] = MaybeUninit::new(convert(&chunk[j])); } // perform the case conversions on N bytes (gets heavily autovec'd) for j in 0..N { // safety: in_chunk and out_chunk is valid bytes in the range let out = out_chunk.get_unchecked_mut(j); out.write(convert(in_chunk.get_unchecked(j))); } ascii_prefix_len += N; slice = unsafe { slice.get_unchecked(N..) }; out_slice = unsafe { out_slice.get_unchecked_mut(N..) }; } // mark these bytes as initialised i += N; // handle the remainder as individual bytes while slice.len() > 0 { let byte = slice[0]; if byte > 127 { break; } // SAFETY: out_slice has at least same length as input slice unsafe { *out_slice.get_unchecked_mut(0) = MaybeUninit::new(convert(&byte)); } out.set_len(i); ascii_prefix_len += 1; slice = unsafe { slice.get_unchecked(1..) }; out_slice = unsafe { out_slice.get_unchecked_mut(1..) }; } out unsafe { // SAFETY: ascii_prefix_len bytes have been initialized above out.set_len(ascii_prefix_len); // SAFETY: We have written only valid ascii to the output vec let ascii_string = String::from_utf8_unchecked(out); // SAFETY: we know this is a valid char boundary // since we only skipped over leading ascii bytes let rest = core::str::from_utf8_unchecked(slice); (ascii_string, rest) } }", "positive_passages": [{"docid": "doc-en-rust-961790a25bd75ee2c479124a7f558092b5ec648a9746f05924ac71ad9641aadb", "text": "I'm looking into the performance of / on mostly ascii strings, using a small microbenchmark to . Using linux perf tooling I see that the hot part of the code is the following large loop, which despite heavy use of sse2 instructions only seems to process 32 bytes per iteration. I don't see an easy way to improve the autovectorization of this code, but it should be relatively easy to explicitly vectorize it using , and I would like to prepare such a PR if there are no objections. As far as I know, is already in use inside , for example by .\nThe way the loop ors the bits for the is-ascii check into a single usize doesn't seem ideal for vectorization. keeping the lanes independent should yield better autovectorization results.\nThanks for the suggestion. I already started with a simd implementation, but now checked again if the autovectorization could be improved. With the following main loop The assembly and performance is indeed better, but there is still some weird shuffling and shifting going on: The explicit simd version looks a bit better, mostly because the ascii check directly translates to a : Do you have a preference here between autovectorization and explicit simd?\nIf the SIMD impl results in reasonable code across architectures, including some without SIMD then that should be fine. I think it would be the first time where we use portable simd unconditionally, so it could use some additional scrutiny. If it's only meant to target x86 with SSE2 then that'd mean having multiple paths and in that case we'd still have to tweak the generic path anyway. At that point we might as well just optimize the latter further. You can probably get rid of those too by keeping multiple bools in a small array. That way the optimizer will more easily see that it can shove them into independent simd lanes. Increasing the unroll count might help too to fit better into simd registers. We do get pretty decent autovectorization in other places in the standard library by massaging things into a state that basically looks like arrays-instead-of-SIMD-types. E.g.\nIt seems llvm is too \"smart\" for this trick, on its own that generates the exact same code. The trick does work, although it seems a bit fragile.", "commid": "rust_issue_123712", "tokennum": 501}], "negative_passages": []} {"query_id": "q-en-rust-842aeac0ee1ee04937e0063ef82af90ff3c57ebec0a99d582d8da7073ef6ea62", "query": "unsafe { Box::from_raw(Box::into_raw(v) as *mut str) } } /// Converts the bytes while the bytes are still ascii. /// Converts leading ascii bytes in `s` by calling the `convert` function. /// /// For better average performance, this happens in chunks of `2*size_of::()`. /// Returns a vec with the converted bytes. /// /// Returns a tuple of the converted prefix and the remainder starting from /// the first non-ascii character. /// /// This function is only public so that it can be verified in a codegen test, /// see `issue-123712-str-to-lower-autovectorization.rs`. #[unstable(feature = \"str_internals\", issue = \"none\")] #[doc(hidden)] #[inline] #[cfg(not(test))] #[cfg(not(no_global_oom_handling))] fn convert_while_ascii(b: &[u8], convert: fn(&u8) -> u8) -> Vec { let mut out = Vec::with_capacity(b.len()); pub fn convert_while_ascii(s: &str, convert: fn(&u8) -> u8) -> (String, &str) { // Process the input in chunks of 16 bytes to enable auto-vectorization. // Previously the chunk size depended on the size of `usize`, // but on 32-bit platforms with sse or neon is also the better choice. // The only downside on other platforms would be a bit more loop-unrolling. const N: usize = 16; let mut slice = s.as_bytes(); let mut out = Vec::with_capacity(slice.len()); let mut out_slice = out.spare_capacity_mut(); let mut ascii_prefix_len = 0_usize; let mut is_ascii = [false; N]; while slice.len() >= N { // SAFETY: checked in loop condition let chunk = unsafe { slice.get_unchecked(..N) }; // SAFETY: out_slice has at least same length as input slice and gets sliced with the same offsets let out_chunk = unsafe { out_slice.get_unchecked_mut(..N) }; for j in 0..N { is_ascii[j] = chunk[j] <= 127; } const USIZE_SIZE: usize = mem::size_of::(); const MAGIC_UNROLL: usize = 2; const N: usize = USIZE_SIZE * MAGIC_UNROLL; const NONASCII_MASK: usize = usize::from_ne_bytes([0x80; USIZE_SIZE]); // Auto-vectorization for this check is a bit fragile, sum and comparing against the chunk // size gives the best result, specifically a pmovmsk instruction on x86. // See https://github.com/llvm/llvm-project/issues/96395 for why llvm currently does not // currently recognize other similar idioms. if is_ascii.iter().map(|x| *x as u8).sum::() as usize != N { break; } let mut i = 0; unsafe { while i + N <= b.len() { // Safety: we have checks the sizes `b` and `out` to know that our let in_chunk = b.get_unchecked(i..i + N); let out_chunk = out.spare_capacity_mut().get_unchecked_mut(i..i + N); let mut bits = 0; for j in 0..MAGIC_UNROLL { // read the bytes 1 usize at a time (unaligned since we haven't checked the alignment) // safety: in_chunk is valid bytes in the range bits |= in_chunk.as_ptr().cast::().add(j).read_unaligned(); } // if our chunks aren't ascii, then return only the prior bytes as init if bits & NONASCII_MASK != 0 { break; } for j in 0..N { out_chunk[j] = MaybeUninit::new(convert(&chunk[j])); } // perform the case conversions on N bytes (gets heavily autovec'd) for j in 0..N { // safety: in_chunk and out_chunk is valid bytes in the range let out = out_chunk.get_unchecked_mut(j); out.write(convert(in_chunk.get_unchecked(j))); } ascii_prefix_len += N; slice = unsafe { slice.get_unchecked(N..) }; out_slice = unsafe { out_slice.get_unchecked_mut(N..) }; } // mark these bytes as initialised i += N; // handle the remainder as individual bytes while slice.len() > 0 { let byte = slice[0]; if byte > 127 { break; } // SAFETY: out_slice has at least same length as input slice unsafe { *out_slice.get_unchecked_mut(0) = MaybeUninit::new(convert(&byte)); } out.set_len(i); ascii_prefix_len += 1; slice = unsafe { slice.get_unchecked(1..) }; out_slice = unsafe { out_slice.get_unchecked_mut(1..) }; } out unsafe { // SAFETY: ascii_prefix_len bytes have been initialized above out.set_len(ascii_prefix_len); // SAFETY: We have written only valid ascii to the output vec let ascii_string = String::from_utf8_unchecked(out); // SAFETY: we know this is a valid char boundary // since we only skipped over leading ascii bytes let rest = core::str::from_utf8_unchecked(slice); (ascii_string, rest) } }", "positive_passages": [{"docid": "doc-en-rust-83f4aa3053a0d5ed2f67bcdac0e3a87d344af80896820336b2eb9ec8791f3d2c", "text": "The following creates a instruction just like the simd version, but a slightly different alternative with a array and comparing against 0 does not. It only needs to be better than the autovectorized version on those platforms ;) My initial idea was to gate the simd code on either SSE2 or Neon (possibly also Altivec and RiscV). I'd also add a scalar loop for the non-multiple-of-N remainder, so all-ascii strings are fully handled by specialized code. Currently this remainder goes through the generic and code path. On other platforms, only the scalar loop would be used, since I assume the autovectorization would also generate suboptimal code. But I agree that if similar code quality can be achieved with autovectorization, that would be preferable. I'll open a PR after a little bit more polishing the code.", "commid": "rust_issue_123712", "tokennum": 188}], "negative_passages": []} {"query_id": "q-en-rust-844d325c0658c4f7fd9318bc3cdcf16a36a63bec6da3d6373d67af9c7e272bbd", "query": "let addr = builder.config.dist_upload_addr.as_ref().unwrap_or_else(|| { panic!(\"nnfailed to specify `dist.upload-addr` in `config.toml`nn\") }); let pass = if env::var(\"BUILD_MANIFEST_DISABLE_SIGNING\").is_err() { let file = builder.config.dist_gpg_password_file.as_ref().unwrap_or_else(|| { panic!(\"nnfailed to specify `dist.gpg-password-file` in `config.toml`nn\") }); t!(fs::read_to_string(&file)) } else { String::new() }; let file = builder.config.dist_gpg_password_file.as_ref().unwrap_or_else(|| { panic!(\"nnfailed to specify `dist.gpg-password-file` in `config.toml`nn\") }); let pass = t!(fs::read_to_string(&file)); let today = output(Command::new(\"date\").arg(\"+%Y-%m-%d\"));", "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-844f7078720c405b82e091caaab695dc949197751ce5cf6654a09682d0f02568", "query": " // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. /*! * High-level text containers. * * Ropes are a high-level representation of text that offers * much better performance than strings for common operations, * and generally reduce memory allocations and copies, while only * entailing a small degradation of less common operations. * * More precisely, where a string is represented as a memory buffer, * a rope is a tree structure whose leaves are slices of immutable * strings. Therefore, concatenation, appending, prepending, substrings, * etc. are operations that require only trivial tree manipulation, * generally without having to copy memory. In addition, the tree * structure of ropes makes them suitable as a form of index to speed-up * access to Unicode characters by index in long chunks of text. * * The following operations are algorithmically faster in ropes: * * * extracting a subrope is logarithmic (linear in strings); * * appending/prepending is near-constant time (linear in strings); * * concatenation is near-constant time (linear in strings); * * char length is constant-time (linear in strings); * * access to a character by index is logarithmic (linear in strings); */ #[allow(missing_doc)]; use std::uint; use std::vec; use std::str; /// The type of ropes. pub type Rope = node::Root; /* Section: Creating a rope */ /// Create an empty rope pub fn empty() -> Rope { return node::Empty; } /** * Adopt a string as a rope. * * # Arguments * * * str - A valid string. * * # Return value * * A rope representing the same string as `str`. Depending of the length * of `str`, this rope may be empty, flat or complex. * * # Performance notes * * * this operation does not copy the string; * * the function runs in linear time. */ pub fn of_str(str: @~str) -> Rope { return of_substr(str, 0u, str.len()); } /** * As `of_str` but for a substring. * * # Arguments * * byte_offset - The offset of `str` at which the rope starts. * * byte_len - The number of bytes of `str` to use. * * # Return value * * A rope representing the same string as `str.slice(byte_offset, * byte_offset + byte_len)`. Depending on `byte_len`, this rope may * be empty, flat or complex. * * # Performance note * * This operation does not copy the substring. * * # Safety notes * * * this function does _not_ check the validity of the substring; * * this function fails if `byte_offset` or `byte_len` do not match `str`. */ pub fn of_substr(str: @~str, byte_offset: uint, byte_len: uint) -> Rope { if byte_len == 0u { return node::Empty; } if byte_offset + byte_len > str.len() { fail!(); } return node::Content(node::of_substr(str, byte_offset, byte_len)); } /* Section: Adding things to a rope */ /** * Add one char to the end of the rope * * # Performance note * * * this function executes in near-constant time */ pub fn append_char(rope: Rope, char: char) -> Rope { return append_str(rope, @str::from_chars([char])); } /** * Add one string to the end of the rope * * # Performance note * * * this function executes in near-linear time */ pub fn append_str(rope: Rope, str: @~str) -> Rope { return append_rope(rope, of_str(str)) } /** * Add one char to the beginning of the rope * * # Performance note * * this function executes in near-constant time */ pub fn prepend_char(rope: Rope, char: char) -> Rope { return prepend_str(rope, @str::from_chars([char])); } /** * Add one string to the beginning of the rope * * # Performance note * * this function executes in near-linear time */ pub fn prepend_str(rope: Rope, str: @~str) -> Rope { return append_rope(of_str(str), rope) } /// Concatenate two ropes pub fn append_rope(left: Rope, right: Rope) -> Rope { match (left) { node::Empty => return right, node::Content(left_content) => { match (right) { node::Empty => return left, node::Content(right_content) => { return node::Content(node::concat2(left_content, right_content)); } } } } } /** * Concatenate many ropes. * * If the ropes are balanced initially and have the same height, the resulting * rope remains balanced. However, this function does not take any further * measure to ensure that the result is balanced. */ pub fn concat(v: ~[Rope]) -> Rope { //Copy `v` into a mut vector let mut len = v.len(); if len == 0u { return node::Empty; } let mut ropes = vec::from_elem(len, v[0]); for uint::range(1u, len) |i| { ropes[i] = v[i]; } //Merge progresively while len > 1u { for uint::range(0u, len/2u) |i| { ropes[i] = append_rope(ropes[2u*i], ropes[2u*i+1u]); } if len%2u != 0u { ropes[len/2u] = ropes[len - 1u]; len = len/2u + 1u; } else { len = len/2u; } } //Return final rope return ropes[0]; } /* Section: Keeping ropes healthy */ /** * Balance a rope. * * # Return value * * A copy of the rope in which small nodes have been grouped in memory, * and with a reduced height. * * If you perform numerous rope concatenations, it is generally a good idea * to rebalance your rope at some point, before using it for other purposes. */ pub fn bal(rope:Rope) -> Rope { match (rope) { node::Empty => return rope, node::Content(x) => match (node::bal(x)) { None => rope, Some(y) => node::Content(y) } } } /* Section: Transforming ropes */ /** * Extract a subrope from a rope. * * # Performance note * * * on a balanced rope, this operation takes algorithmic time; * * this operation does not involve any copying * * # Safety note * * * this function fails if char_offset/char_len do not represent * valid positions in rope */ pub fn sub_chars(rope: Rope, char_offset: uint, char_len: uint) -> Rope { if char_len == 0u { return node::Empty; } match (rope) { node::Empty => fail!(), node::Content(node) => if char_len > node::char_len(node) { fail!() } else { return node::Content(node::sub_chars(node, char_offset, char_len)) } } } /** * Extract a subrope from a rope. * * # Performance note * * * on a balanced rope, this operation takes algorithmic time; * * this operation does not involve any copying * * # Safety note * * * this function fails if byte_offset/byte_len do not represent * valid positions in rope */ pub fn sub_bytes(rope: Rope, byte_offset: uint, byte_len: uint) -> Rope { if byte_len == 0u { return node::Empty; } match (rope) { node::Empty => fail!(), node::Content(node) =>if byte_len > node::byte_len(node) { fail!() } else { return node::Content(node::sub_bytes(node, byte_offset, byte_len)) } } } /* Section: Comparing ropes */ /** * Compare two ropes by Unicode lexicographical order. * * This function compares only the contents of the rope, not their structure. * * # Return value * * A negative value if `left < right`, 0 if eq(left, right) or a positive * value if `left > right` */ pub fn cmp(left: Rope, right: Rope) -> int { match ((left, right)) { (node::Empty, node::Empty) => return 0, (node::Empty, _) => return -1, (_, node::Empty) => return 1, (node::Content(a), node::Content(b)) => { return node::cmp(a, b); } } } /** * Returns `true` if both ropes have the same content (regardless of * their structure), `false` otherwise */ pub fn eq(left: Rope, right: Rope) -> bool { return cmp(left, right) == 0; } /** * # Arguments * * * left - an arbitrary rope * * right - an arbitrary rope * * # Return value * * `true` if `left <= right` in lexicographical order (regardless of their * structure), `false` otherwise */ pub fn le(left: Rope, right: Rope) -> bool { return cmp(left, right) <= 0; } /** * # Arguments * * * left - an arbitrary rope * * right - an arbitrary rope * * # Return value * * `true` if `left < right` in lexicographical order (regardless of their * structure), `false` otherwise */ pub fn lt(left: Rope, right: Rope) -> bool { return cmp(left, right) < 0; } /** * # Arguments * * * left - an arbitrary rope * * right - an arbitrary rope * * # Return value * * `true` if `left >= right` in lexicographical order (regardless of their * structure), `false` otherwise */ pub fn ge(left: Rope, right: Rope) -> bool { return cmp(left, right) >= 0; } /** * # Arguments * * * left - an arbitrary rope * * right - an arbitrary rope * * # Return value * * `true` if `left > right` in lexicographical order (regardless of their * structure), `false` otherwise */ pub fn gt(left: Rope, right: Rope) -> bool { return cmp(left, right) > 0; } /* Section: Iterating */ /** * Loop through a rope, char by char * * While other mechanisms are available, this is generally the best manner * of looping through the contents of a rope char by char. If you prefer a * loop that iterates through the contents string by string (e.g. to print * the contents of the rope or output it to the system), however, * you should rather use `traverse_components`. * * # Arguments * * * rope - A rope to traverse. It may be empty. * * it - A block to execute with each consecutive character of the rope. * Return `true` to continue, `false` to stop. * * # Return value * * `true` If execution proceeded correctly, `false` if it was interrupted, * that is if `it` returned `false` at any point. */ pub fn loop_chars(rope: Rope, it: &fn(c: char) -> bool) -> bool { match (rope) { node::Empty => return true, node::Content(x) => return node::loop_chars(x, it) } } /** * Loop through a rope, char by char, until the end. * * # Arguments * * rope - A rope to traverse. It may be empty * * it - A block to execute with each consecutive character of the rope. */ pub fn iter_chars(rope: Rope, it: &fn(char)) { do loop_chars(rope) |x| { it(x); true }; } /** * Loop through a rope, string by string * * While other mechanisms are available, this is generally the best manner of * looping through the contents of a rope string by string, which may be * useful e.g. to print strings as you see them (without having to copy their * contents into a new string), to send them to then network, to write them to * a file, etc.. If you prefer a loop that iterates through the contents * char by char (e.g. to search for a char), however, you should rather * use `traverse`. * * # Arguments * * * rope - A rope to traverse. It may be empty * * it - A block to execute with each consecutive string component of the * rope. Return `true` to continue, `false` to stop * * # Return value * * `true` If execution proceeded correctly, `false` if it was interrupted, * that is if `it` returned `false` at any point. */ pub fn loop_leaves(rope: Rope, it: &fn(node::Leaf) -> bool) -> bool{ match (rope) { node::Empty => return true, node::Content(x) => return node::loop_leaves(x, it) } } pub mod iterator { pub mod leaf { use rope::{Rope, node}; pub fn start(rope: Rope) -> node::leaf_iterator::T { match (rope) { node::Empty => return node::leaf_iterator::empty(), node::Content(x) => return node::leaf_iterator::start(x) } } pub fn next(it: &mut node::leaf_iterator::T) -> Option { return node::leaf_iterator::next(it); } } pub mod char { use rope::{Rope, node}; pub fn start(rope: Rope) -> node::char_iterator::T { match (rope) { node::Empty => return node::char_iterator::empty(), node::Content(x) => return node::char_iterator::start(x) } } pub fn next(it: &mut node::char_iterator::T) -> Option { return node::char_iterator::next(it) } } } /* Section: Rope properties */ /** * Returns the height of the rope. * * The height of the rope is a bound on the number of operations which * must be performed during a character access before finding the leaf in * which a character is contained. * * # Performance note * * Constant time. */ pub fn height(rope: Rope) -> uint { match (rope) { node::Empty => return 0u, node::Content(x) => return node::height(x) } } /** * The number of character in the rope * * # Performance note * * Constant time. */ pub fn char_len(rope: Rope) -> uint { match (rope) { node::Empty => return 0u, node::Content(x) => return node::char_len(x) } } /** * The number of bytes in the rope * * # Performance note * * Constant time. */ pub fn byte_len(rope: Rope) -> uint { match (rope) { node::Empty => return 0u, node::Content(x) => return node::byte_len(x) } } /** * The character at position `pos` * * # Arguments * * * pos - A position in the rope * * # Safety notes * * The function will fail if `pos` is not a valid position in the rope. * * # Performance note * * This function executes in a time proportional to the height of the * rope + the (bounded) length of the largest leaf. */ pub fn char_at(rope: Rope, pos: uint) -> char { match (rope) { node::Empty => fail!(), node::Content(x) => return node::char_at(x, pos) } } /* Section: Implementation */ pub mod node { use rope::node; use std::cast; use std::uint; use std::vec; /// Implementation of type `rope` pub enum Root { /// An empty rope Empty, /// A non-empty rope Content(@Node), } /** * A text component in a rope. * * This is actually a slice in a rope, so as to ensure maximal sharing. * * # Fields * * * byte_offset = The number of bytes skipped in `content` * * byte_len - The number of bytes of `content` to use * * char_len - The number of chars in the leaf. * * content - Contents of the leaf. * * Note that we can have `char_len < content.char_len()`, if * this leaf is only a subset of the string. Also note that the * string can be shared between several ropes, e.g. for indexing * purposes. */ pub struct Leaf { byte_offset: uint, byte_len: uint, char_len: uint, content: @~str, } /** * A node obtained from the concatenation of two other nodes * * # Fields * * * left - The node containing the beginning of the text. * * right - The node containing the end of the text. * * char_len - The number of chars contained in all leaves of this node. * * byte_len - The number of bytes in the subrope. * * Used to pre-allocate the correct amount of storage for * serialization. * * * height - Height of the subrope. * * Used for rebalancing and to allocate stacks for traversals. */ pub struct Concat { //FIXME (#2744): Perhaps a `vec` instead of `left`/`right` left: @Node, right: @Node, char_len: uint, byte_len: uint, height: uint, } pub enum Node { /// A leaf consisting in a `str` Leaf(Leaf), /// The concatenation of two ropes Concat(Concat), } /** * The maximal number of chars that _should_ be permitted in a single node * * This is not a strict value */ pub static HINT_MAX_LEAF_CHAR_LEN: uint = 256u; /** * The maximal height that _should_ be permitted in a tree. * * This is not a strict value */ pub static HINT_MAX_NODE_HEIGHT: uint = 16u; /** * Adopt a string as a node. * * If the string is longer than `max_leaf_char_len`, it is * logically split between as many leaves as necessary. Regardless, * the string itself is not copied. * * Performance note: The complexity of this function is linear in * the length of `str`. */ pub fn of_str(str: @~str) -> @Node { return of_substr(str, 0u, str.len()); } /** * Adopt a slice of a string as a node. * * If the slice is longer than `max_leaf_char_len`, it is logically split * between as many leaves as necessary. Regardless, the string itself * is not copied * * # Arguments * * * byte_start - The byte offset where the slice of `str` starts. * * byte_len - The number of bytes from `str` to use. * * # Safety note * * Behavior is undefined if `byte_start` or `byte_len` do not represent * valid positions in `str` */ pub fn of_substr(str: @~str, byte_start: uint, byte_len: uint) -> @Node { return of_substr_unsafer(str, byte_start, byte_len, str.slice(byte_start, byte_start + byte_len).char_len()); } /** * Adopt a slice of a string as a node. * * If the slice is longer than `max_leaf_char_len`, it is logically split * between as many leaves as necessary. Regardless, the string itself * is not copied * * # Arguments * * * byte_start - The byte offset where the slice of `str` starts. * * byte_len - The number of bytes from `str` to use. * * char_len - The number of chars in `str` in the interval * [byte_start, byte_start+byte_len) * * # Safety notes * * * Behavior is undefined if `byte_start` or `byte_len` do not represent * valid positions in `str` * * Behavior is undefined if `char_len` does not accurately represent the * number of chars between byte_start and byte_start+byte_len */ pub fn of_substr_unsafer(str: @~str, byte_start: uint, byte_len: uint, char_len: uint) -> @Node { assert!((byte_start + byte_len <= str.len())); let candidate = @Leaf(Leaf { byte_offset: byte_start, byte_len: byte_len, char_len: char_len, content: str, }); if char_len <= HINT_MAX_LEAF_CHAR_LEN { return candidate; } else { //Firstly, split `str` in slices of HINT_MAX_LEAF_CHAR_LEN let mut leaves = uint::div_ceil(char_len, HINT_MAX_LEAF_CHAR_LEN); //Number of leaves let mut nodes = vec::from_elem(leaves, candidate); let mut i = 0u; let mut offset = byte_start; let first_leaf_char_len = if char_len%HINT_MAX_LEAF_CHAR_LEN == 0u { HINT_MAX_LEAF_CHAR_LEN } else { char_len%HINT_MAX_LEAF_CHAR_LEN }; while i < leaves { let chunk_char_len: uint = if i == 0u { first_leaf_char_len } else { HINT_MAX_LEAF_CHAR_LEN }; let chunk_byte_len = str.slice_from(offset).slice_chars(0, chunk_char_len).len(); nodes[i] = @Leaf(Leaf { byte_offset: offset, byte_len: chunk_byte_len, char_len: chunk_char_len, content: str, }); offset += chunk_byte_len; i += 1u; } //Then, build a tree from these slices by collapsing them while leaves > 1u { i = 0u; while i < leaves - 1u {//Concat nodes 0 with 1, 2 with 3 etc. nodes[i/2u] = concat2(nodes[i], nodes[i + 1u]); i += 2u; } if i == leaves - 1u { //And don't forget the last node if it is in even position nodes[i/2u] = nodes[i]; } leaves = uint::div_ceil(leaves, 2u); } return nodes[0u]; } } pub fn byte_len(node: @Node) -> uint { //FIXME (#2744): Could we do this without the pattern-matching? match (*node) { Leaf(y) => y.byte_len, Concat(ref y) => y.byte_len } } pub fn char_len(node: @Node) -> uint { match (*node) { Leaf(y) => y.char_len, Concat(ref y) => y.char_len } } /** * Concatenate a forest of nodes into one tree. * * # Arguments * * * forest - The forest. This vector is progressively rewritten during * execution and should be discarded as meaningless afterwards. */ pub fn tree_from_forest_destructive(forest: &mut [@Node]) -> @Node { let mut i; let mut len = forest.len(); while len > 1u { i = 0u; while i < len - 1u {//Concat nodes 0 with 1, 2 with 3 etc. let mut left = forest[i]; let mut right = forest[i+1u]; let left_len = char_len(left); let right_len= char_len(right); let mut left_height= height(left); let mut right_height=height(right); if left_len + right_len > HINT_MAX_LEAF_CHAR_LEN { if left_len <= HINT_MAX_LEAF_CHAR_LEN { left = flatten(left); left_height = height(left); } if right_len <= HINT_MAX_LEAF_CHAR_LEN { right = flatten(right); right_height = height(right); } } if left_height >= HINT_MAX_NODE_HEIGHT { left = of_substr_unsafer(@serialize_node(left), 0u,byte_len(left), left_len); } if right_height >= HINT_MAX_NODE_HEIGHT { right = of_substr_unsafer(@serialize_node(right), 0u,byte_len(right), right_len); } forest[i/2u] = concat2(left, right); i += 2u; } if i == len - 1u { //And don't forget the last node if it is in even position forest[i/2u] = forest[i]; } len = uint::div_ceil(len, 2u); } return forest[0]; } pub fn serialize_node(node: @Node) -> ~str { unsafe { let mut buf = vec::from_elem(byte_len(node), 0); let mut offset = 0u;//Current position in the buffer let mut it = leaf_iterator::start(node); loop { match leaf_iterator::next(&mut it) { None => break, Some(x) => { //FIXME (#2744): Replace with memcpy or something similar let local_buf: ~[u8] = cast::transmute(copy *x.content); let mut i = x.byte_offset; while i < x.byte_len { buf[offset] = local_buf[i]; offset += 1u; i += 1u; } cast::forget(local_buf); } } } return cast::transmute(buf); } } /** * Replace a subtree by a single leaf with the same contents. * * * Performance note * * This function executes in linear time. */ pub fn flatten(node: @Node) -> @Node { match (*node) { Leaf(_) => node, Concat(ref x) => { @Leaf(Leaf { byte_offset: 0u, byte_len: x.byte_len, char_len: x.char_len, content: @serialize_node(node), }) } } } /** * Balance a node. * * # Algorithm * * * if the node height is smaller than `HINT_MAX_NODE_HEIGHT`, do nothing * * otherwise, gather all leaves as a forest, rebuild a balanced node, * concatenating small leaves along the way * * # Return value * * * `None` if no transformation happened * * `Some(x)` otherwise, in which case `x` has the same contents * as `node` bot lower height and/or fragmentation. */ pub fn bal(node: @Node) -> Option<@Node> { if height(node) < HINT_MAX_NODE_HEIGHT { return None; } //1. Gather all leaves as a forest let mut forest = ~[]; let mut it = leaf_iterator::start(node); loop { match leaf_iterator::next(&mut it) { None => break, Some(x) => forest.push(@Leaf(x)) } } //2. Rebuild tree from forest let root = @*tree_from_forest_destructive(forest); return Some(root); } /** * Compute the subnode of a node. * * # Arguments * * * node - A node * * byte_offset - A byte offset in `node` * * byte_len - The number of bytes to return * * # Performance notes * * * this function performs no copying; * * this function executes in a time proportional to the height of `node` * * # Safety notes * * This function fails if `byte_offset` or `byte_len` do not represent * valid positions in `node`. */ pub fn sub_bytes(node: @Node, byte_offset: uint, byte_len: uint) -> @Node { let mut node = node; let mut byte_offset = byte_offset; loop { if byte_offset == 0u && byte_len == node::byte_len(node) { return node; } match (*node) { node::Leaf(x) => { let char_len = x.content.slice(byte_offset, byte_offset + byte_len).char_len(); return @Leaf(Leaf { byte_offset: byte_offset, byte_len: byte_len, char_len: char_len, content: x.content, }); } node::Concat(ref x) => { let left_len: uint = node::byte_len(x.left); if byte_offset <= left_len { if byte_offset + byte_len <= left_len { //Case 1: Everything fits in x.left, tail-call node = x.left; } else { //Case 2: A (non-empty, possibly full) suffix //of x.left and a (non-empty, possibly full) prefix //of x.right let left_result = sub_bytes(x.left, byte_offset, left_len); let right_result = sub_bytes(x.right, 0u, left_len - byte_offset); return concat2(left_result, right_result); } } else { //Case 3: Everything fits in x.right byte_offset -= left_len; node = x.right; } } } }; } /** * Compute the subnode of a node. * * # Arguments * * * node - A node * * char_offset - A char offset in `node` * * char_len - The number of chars to return * * # Performance notes * * * this function performs no copying; * * this function executes in a time proportional to the height of `node` * * # Safety notes * * This function fails if `char_offset` or `char_len` do not represent * valid positions in `node`. */ pub fn sub_chars(node: @Node, char_offset: uint, char_len: uint) -> @Node { let mut node = node; let mut char_offset = char_offset; loop { match (*node) { node::Leaf(x) => { if char_offset == 0u && char_len == x.char_len { return node; } let byte_offset = x.content.slice_chars(0, char_offset).len(); let byte_len = x.content.slice_from(byte_offset).slice_chars(0, char_len).len(); return @Leaf(Leaf { byte_offset: byte_offset, byte_len: byte_len, char_len: char_len, content: x.content, }); } node::Concat(ref x) => { if char_offset == 0u && char_len == x.char_len {return node;} let left_len : uint = node::char_len(x.left); if char_offset <= left_len { if char_offset + char_len <= left_len { //Case 1: Everything fits in x.left, tail call node = x.left; } else { //Case 2: A (non-empty, possibly full) suffix //of x.left and a (non-empty, possibly full) prefix //of x.right let left_result = sub_chars(x.left, char_offset, left_len); let right_result = sub_chars(x.right, 0u, left_len - char_offset); return concat2(left_result, right_result); } } else { //Case 3: Everything fits in x.right, tail call node = x.right; char_offset -= left_len; } } } }; } pub fn concat2(left: @Node, right: @Node) -> @Node { @Concat(Concat { left: left, right: right, char_len: char_len(left) + char_len(right), byte_len: byte_len(left) + byte_len(right), height: uint::max(height(left), height(right)) + 1u, }) } pub fn height(node: @Node) -> uint { match (*node) { Leaf(_) => 0u, Concat(ref x) => x.height, } } pub fn cmp(a: @Node, b: @Node) -> int { let mut ita = char_iterator::start(a); let mut itb = char_iterator::start(b); let mut result = 0; while result == 0 { match (char_iterator::next(&mut ita), char_iterator::next(&mut itb)) { (None, None) => break, (Some(chara), Some(charb)) => { result = chara.cmp(&charb) as int; } (Some(_), _) => { result = 1; } (_, Some(_)) => { result = -1; } } } return result; } pub fn loop_chars(node: @Node, it: &fn(c: char) -> bool) -> bool { return loop_leaves(node,|leaf| { leaf.content.slice(leaf.byte_offset, leaf.byte_len).iter().all(|c| it(c)) }); } /** * Loop through a node, leaf by leaf * * # Arguments * * * rope - A node to traverse. * * it - A block to execute with each consecutive leaf of the node. * Return `true` to continue, `false` to stop * * # Arguments * * `true` If execution proceeded correctly, `false` if it was interrupted, * that is if `it` returned `false` at any point. */ pub fn loop_leaves(node: @Node, it: &fn(Leaf) -> bool) -> bool{ let mut current = node; loop { match (*current) { Leaf(x) => return it(x), Concat(ref x) => if loop_leaves(x.left, |l| it(l)) { //non tail call current = x.right; //tail call } else { return false; } } }; } /** * # Arguments * * * pos - A position in the rope * * # Return value * * The character at position `pos` * * # Safety notes * * The function will fail if `pos` is not a valid position in the rope. * * Performance note: This function executes in a time * proportional to the height of the rope + the (bounded) * length of the largest leaf. */ pub fn char_at(mut node: @Node, mut pos: uint) -> char { loop { match *node { Leaf(x) => return x.content.char_at(pos), Concat(Concat {left, right, _}) => { let left_len = char_len(left); node = if left_len > pos { left } else { pos -= left_len; right }; } } }; } pub mod leaf_iterator { use rope::node::{Concat, Leaf, Node, height}; use std::vec; pub struct T { stack: ~[@Node], stackpos: int, } pub fn empty() -> T { let stack : ~[@Node] = ~[]; T { stack: stack, stackpos: -1 } } pub fn start(node: @Node) -> T { let stack = vec::from_elem(height(node)+1u, node); T { stack: stack, stackpos: 0, } } pub fn next(it: &mut T) -> Option { if it.stackpos < 0 { return None; } loop { let current = it.stack[it.stackpos]; it.stackpos -= 1; match (*current) { Concat(ref x) => { it.stackpos += 1; it.stack[it.stackpos] = x.right; it.stackpos += 1; it.stack[it.stackpos] = x.left; } Leaf(x) => return Some(x) } }; } } pub mod char_iterator { use rope::node::{Leaf, Node}; use rope::node::leaf_iterator; pub struct T { leaf_iterator: leaf_iterator::T, leaf: Option, leaf_byte_pos: uint, } pub fn start(node: @Node) -> T { T { leaf_iterator: leaf_iterator::start(node), leaf: None, leaf_byte_pos: 0u, } } pub fn empty() -> T { T { leaf_iterator: leaf_iterator::empty(), leaf: None, leaf_byte_pos: 0u, } } pub fn next(it: &mut T) -> Option { loop { match get_current_or_next_leaf(it) { None => return None, Some(_) => { let next_char = get_next_char_in_leaf(it); match next_char { None => loop, Some(_) => return next_char } } } }; } pub fn get_current_or_next_leaf(it: &mut T) -> Option { match it.leaf { Some(_) => return it.leaf, None => { let next = leaf_iterator::next(&mut it.leaf_iterator); match next { None => return None, Some(_) => { it.leaf = next; it.leaf_byte_pos = 0u; return next; } } } } } pub fn get_next_char_in_leaf(it: &mut T) -> Option { match copy it.leaf { None => return None, Some(aleaf) => { if it.leaf_byte_pos >= aleaf.byte_len { //We are actually past the end of the leaf it.leaf = None; return None } else { let range = aleaf.content.char_range_at((*it).leaf_byte_pos + aleaf.byte_offset); let ch = range.ch; let next = range.next; (*it).leaf_byte_pos = next - aleaf.byte_offset; return Some(ch) } } } } } } #[cfg(test)] mod tests { use rope::*; use std::uint; use std::vec; //Utility function, used for sanity check fn rope_to_string(r: Rope) -> ~str { match (r) { node::Empty => return ~\"\", node::Content(x) => { let mut str = ~\"\"; fn aux(str: &mut ~str, node: @node::Node) { match (*node) { node::Leaf(x) => { str.push_str(x.content.slice(x.byte_offset, x.byte_offset + x.byte_len)); } node::Concat(ref x) => { aux(str, x.left); aux(str, x.right); } } } aux(&mut str, x); return str } } } #[test] fn trivial() { assert_eq!(char_len(empty()), 0u); assert_eq!(byte_len(empty()), 0u); } #[test] fn of_string1() { let sample = @~\"0123456789ABCDE\"; let r = of_str(sample); assert_eq!(char_len(r), sample.char_len()); assert!(rope_to_string(r) == *sample); } #[test] fn of_string2() { let buf = @ mut ~\"1234567890\"; let mut i = 0; while i < 10 { let a = copy *buf; let b = copy *buf; *buf = a + b; i+=1; } let sample = @copy *buf; let r = of_str(sample); assert_eq!(char_len(r), sample.char_len()); assert!(rope_to_string(r) == *sample); let mut string_iter = 0u; let string_len = sample.len(); let mut rope_iter = iterator::char::start(r); let mut equal = true; while equal { match (node::char_iterator::next(&mut rope_iter)) { None => { if string_iter < string_len { equal = false; } break; } Some(c) => { let range = sample.char_range_at(string_iter); string_iter = range.next; if range.ch != c { equal = false; break; } } } } assert!(equal); } #[test] fn iter1() { let buf = @ mut ~\"1234567890\"; let mut i = 0; while i < 10 { let a = copy *buf; let b = copy *buf; *buf = a + b; i+=1; } let sample = @copy *buf; let r = of_str(sample); let mut len = 0u; let mut it = iterator::char::start(r); loop { match (node::char_iterator::next(&mut it)) { None => break, Some(_) => len += 1u } } assert_eq!(len, sample.char_len()); } #[test] fn bal1() { let init = @~\"1234567890\"; let buf = @mut copy *init; let mut i = 0; while i < 8 { let a = copy *buf; let b = copy *buf; *buf = a + b; i+=1; } let sample = @copy *buf; let r1 = of_str(sample); let mut r2 = of_str(init); i = 0; while i < 8 { r2 = append_rope(r2, r2); i+= 1;} assert!(eq(r1, r2)); let r3 = bal(r2); assert_eq!(char_len(r1), char_len(r3)); assert!(eq(r1, r3)); } #[test] #[ignore] fn char_at1() { //Generate a large rope let mut r = of_str(@~\"123456789\"); for uint::range(0u, 10u) |_i| { r = append_rope(r, r); } //Copy it in the slowest possible way let mut r2 = empty(); for uint::range(0u, char_len(r)) |i| { r2 = append_char(r2, char_at(r, i)); } assert!(eq(r, r2)); let mut r3 = empty(); for uint::range(0u, char_len(r)) |i| { r3 = prepend_char(r3, char_at(r, char_len(r) - i - 1u)); } assert!(eq(r, r3)); //Additional sanity checks let balr = bal(r); let bal2 = bal(r2); let bal3 = bal(r3); assert!(eq(r, balr)); assert!(eq(r, bal2)); assert!(eq(r, bal3)); assert!(eq(r2, r3)); assert!(eq(bal2, bal3)); } #[test] fn concat1() { //Generate a reasonable rope let chunk = of_str(@~\"123456789\"); let mut r = empty(); for uint::range(0u, 10u) |_i| { r = append_rope(r, chunk); } //Same rope, obtained with rope::concat let r2 = concat(vec::from_elem(10u, chunk)); assert!(eq(r, r2)); } } ", "positive_passages": [{"docid": "doc-en-rust-12ccea9c839f192cafb63dda170135d519441281a2f227e808be0921dba14e94", "text": "In commit I had to disable one of the rope tests. The purpose of that commit was to fix up a bug in the way operator [] works on strings. In particular it used to let you index up to and including the trailing null; now it considers access to the null byte an index overrun and fails. I tried to figure out exactly what was going on in the rope code for quite a while, and tried adjusting a number of obvious-looking things, but to no avail. I'm not really good with boundary-case arithmetic (are any of us?) and the rope module is a maze of such arithmetic. Sharper minds requested to find the bug. Meanwhile I marked the rope test in question () as ignored. The others seem to work.\nPaging\nI'll take a look.\nThere is some discussion on IRC that maybe we should just pitch the rope code as it exists now.\nagreed. The code is pretty outdated and the work required to modernize it would probably be similar to the work needed to just re-write it. When I was looking through it, it seemed to be doing some very strange things that I don't think are even close to being safe, so there's that too.", "commid": "rust_issue_2236", "tokennum": 252}], "negative_passages": []} {"query_id": "q-en-rust-846de1da8d0f214ff9982585b3b66606c34aefbcbcc5b950f181c1aa35198b96", "query": "} else { match self.try_coercion_cast(fcx) { Ok(()) => { self.trivial_cast_lint(fcx); debug!(\" -> CoercionCast\"); fcx.typeck_results.borrow_mut().set_coercion_cast(self.expr.hir_id.local_id); if self.expr_ty.is_unsafe_ptr() && self.cast_ty.is_unsafe_ptr() { // When casting a raw pointer to another raw pointer, we cannot convert the cast into // a coercion because the pointee types might only differ in regions, which HIR typeck // cannot distinguish. This would cause us to erroneously discard a cast which will // lead to a borrowck error like #113257. // We still did a coercion above to unify inference variables for `ptr as _` casts. // This does cause us to miss some trivial casts in the trival cast lint. debug!(\" -> PointerCast\"); } else { self.trivial_cast_lint(fcx); debug!(\" -> CoercionCast\"); fcx.typeck_results .borrow_mut() .set_coercion_cast(self.expr.hir_id.local_id); } } Err(_) => { match self.do_check(fcx) {", "positive_passages": [{"docid": "doc-en-rust-9b4ab92232153d0742c86ba450034f7e1e26346754a368047e2e8efb113687b6", "text": " $DIR/issue-79690.rs:29:1 | LL | const G: Fat = unsafe { Transmute { t: FOO }.u }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered read of part of a pointer at .1..size.foo | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. error: aborting due to previous error For more information about this error, try `rustc --explain E0080`. ", "positive_passages": [{"docid": "doc-en-rust-8e28ca4d870b79f039449351b9b68aca524711f6032126a336759abe61e173d6", "text": " $DIR/issue-79690.rs:29:1 | LL | const G: Fat = unsafe { Transmute { t: FOO }.u }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered read of part of a pointer at .1..size.foo | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. error: aborting due to previous error For more information about this error, try `rustc --explain E0080`. ", "positive_passages": [{"docid": "doc-en-rust-df4b399bfa381a2d7b813fd531697e37ca240fea3b77af4604c4107245a62f39", "text": "Maybe we should not have any automatic way to bubble up errors and require all sites to use ?\nI think we should wrap it but put the wrapped thing into a helper function sow e can also use it for the other places. So basically, you want to use a different error type for validation, one that excludes all the other errors? I am open to refactorings here.\nLet's start out with wrapping, and then I can experiment with the refactoring so we can have a look at the usability effect of it Instructions: wrap the call at in a macro invocation and capture the error. Emit a validation message about the fact that reading parts of a pointer is not possible during CTFE. Don't forget to add a test (the failing example from this issue works great as a test) and run the test with\nThere are quite a few calls in that will all have this problem, so ideally they should all be treated this way. To avoid code duplication, it will probably make sense to move this into a helper function.\nReopening this to track that is still called unguarded a few times in , so e.g. the issue can still arise with .", "commid": "rust_issue_79690", "tokennum": 249}], "negative_passages": []} {"query_id": "q-en-rust-858ab9a8c56eb62b8dc9a32af5b15cb0b017c552a8b355e5ab847d74dea4d38f", "query": "&format!(\"comparison of `{}`\", cx.ty_to_string(rhs_t))[], StrEqFnLangItem); callee::trans_lang_call(cx, did, &[lhs, rhs], None, debug_loc) let t = ty::mk_str_slice(cx.tcx(), cx.tcx().mk_region(ty::ReStatic), ast::MutImmutable); // The comparison function gets the slices by value, so we have to make copies here. Even // if the function doesn't write through the pointer, things like lifetime intrinsics // require that we do this properly let lhs_arg = alloc_ty(cx, t, \"lhs\"); let rhs_arg = alloc_ty(cx, t, \"rhs\"); memcpy_ty(cx, lhs_arg, lhs, t); memcpy_ty(cx, rhs_arg, rhs, t); let res = callee::trans_lang_call(cx, did, &[lhs_arg, rhs_arg], None, debug_loc); call_lifetime_end(res.bcx, lhs_arg); call_lifetime_end(res.bcx, rhs_arg); res } let _icx = push_ctxt(\"compare_values\");", "positive_passages": [{"docid": "doc-en-rust-8aec3299c16a48e5601be96f0028e32c6b1830ffef756613c5ce95cb83c8cc59", "text": "Hi, The rust optimiser or some other component is not behaving correctly resulting in wrong results. I have produced a small example here : This was reproduced on Mac yosemite: cargo 0.0.1-pre-nightly ( 2015-01-30 02:47:30 +0000) rustc 1.0.0-nightly ( 2015-02-03 14:56:32 +0000) and centos7 x64, rustc 1.0.0-nightly ( 2015-02-05 23:14:28 +0000) Please let me know if you need any more details.\nReduced test case: This segfaults with = 2 (on Linux x86-64, )\nThis goes back to at least 0.12 - though it prints garbage values instead of segfaulting. 0.11 seems unaffected.\nI've done some hacky . I'm not seeing the original data in the IR. cc Is this another memcpy metadata bug? Or a lifetime intrinsic issue. EDIT: turns out , which is used here, calls on its arguments, as if it was certain they were temporaries that didn't outlive the call (which is wrong, in this case). Not sure if needs to create a temporary for the value it's trying to compare with a constant, or the lifetime intrinsic calls shouldn't be emitted for .\nThis has two parts. When I extended rustc to emit lifetime intrinsics, I chose to put a call to at the end of functions to mark arguments as dead that are passed by value on the stack. This allows LLVM to remove dead stores at the end of functions that it normally can't remove. This works because normally, the caller makes a copy of the value it passes in. Now, the call that match generates to compare the strings is to , which accepts two slices by-value, and slices are large enough to be passed on the stack. Thus, calls to are emitted. But, the call the match generates does not actually make copies of the slices, but passes in pointers to the original slices. That means that the call marks the original alloca as dead, and then things fall apart. Question: Do we want to drop the call for by-value on-stack arguments, or fix the call to eqslice to make copies? cc\njust-a-bug; P-high, not 1.0 milestone.", "commid": "rust_issue_22008", "tokennum": 508}], "negative_passages": []} {"query_id": "q-en-rust-858eeb413ee6531d124aef6be6803d56f545bbb932dc89195fd9303ee3e70cbf", "query": " // Regression test for ICE #130012 // Checks that we do not ICE while reporting // lifetime mistmatch error trait Fun { type Assoc; } trait MyTrait: for<'a> Fun {} //~^ ERROR binding for associated type `Assoc` references lifetime `'a`, which does not appear in the trait input types //~| ERROR binding for associated type `Assoc` references lifetime `'a`, which does not appear in the trait input types //~| ERROR binding for associated type `Assoc` references lifetime `'a`, which does not appear in the trait input types impl Fun> MyTrait for F {} //~^ ERROR binding for associated type `Assoc` references lifetime `'b`, which does not appear in the trait input types //~| ERROR mismatched types fn main() {} ", "positive_passages": [{"docid": "doc-en-rust-4f4191a9e2c8e3b06f1085b04822c60cd645d66e29b748b1a7d4a3151423534e", "text": ": current nightly #![allow(unused)] fn main() { let _foo = b'hello0'; //~^ ERROR character literal may only contain one codepoint //~| HELP if you meant to write a byte string literal, use double quotes let _bar = 'hello'; //~^ ERROR character literal may only contain one codepoint //~| HELP if you meant to write a `str` literal, use double quotes } ", "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-85f9b9de051d7a01a4043ebd9994421fbabf1df09c9c8d431412c5ecc713c609", "query": "pub fn prepend(&mut self, line: usize, string: &str, style: Style) { self.ensure_lines(line); let string_len = string.len(); let string_len = string.chars().count(); // Push the old content over to make room for new content for _ in 0..string_len {", "positive_passages": [{"docid": "doc-en-rust-945a3173766e28b9b8b532ece9833c83b4b9c8aed5c1bdbb10ff1e25546c7959", "text": "Consider the following rust source (in ): It is obvious that it has syntax error. It also seems obvious that the generated error shouldn't depend on name of file except noting the name of file. However, it doesn't happen in practice: Note extra spaces after . Rust version (although it is not strictly relevant, see below): The core issue lies in the . The idea of the code is to make enough space in the beginning of line (filled with spaces) and then overwrite it character by character. However, in order to estimate the required space, which is wrong since in Rust can contain non-ASCII which require more than one byte for storage and keeps lines in s. It means that this isuue reveals itself only when a non-ASCII string is passed as an argument \u2014 and that's exactly what's happening in under very specific circumstances: when processing a primary file, when is set (i. e. ) and when_ name of the primary file happens to have a non-ASCII name. The errorneous code for was introduced in . This bug landed in stable . The obvious fix is to change the line in into cc\nI want to raise a question: is it really an issue worth fixing? It fires under very specific circumstances and the fix makes slower for every case, not only these specific ones.\nI believe so.", "commid": "rust_issue_65119", "tokennum": 283}], "negative_passages": []} {"query_id": "q-en-rust-860be5024f128249db2a293b06a0296c5bce78297672f94e545126287530b12e", "query": "return None; } } Some(i) if lines.is_empty() { None } else { Some(lines[0][..i].into()) } } let data_s = data.as_str();", "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-8625e996f442ab991ca0899c8de61e9e4d8960706185d124aa28ee87b72cb757", "query": " #![feature(prelude_import)] #![no_std] //@ check-pass //@ aux-build: another-proc-macro.rs //@ compile-flags: -Zunpretty=expanded #![feature(derive_smart_pointer)] #[prelude_import] use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; #[macro_use] extern crate another_proc_macro; use another_proc_macro::{pointee, AnotherMacro}; #[repr(transparent)] pub struct Ptr<'a, #[pointee] T: ?Sized> { data: &'a mut T, } #[automatically_derived] impl<'a, T: ?Sized + ::core::marker::Unsize<__S>, __S: ?Sized> ::core::ops::DispatchFromDyn> for Ptr<'a, T> { } #[automatically_derived] impl<'a, T: ?Sized + ::core::marker::Unsize<__S>, __S: ?Sized> ::core::ops::CoerceUnsized> for Ptr<'a, T> { } const _: () = { const POINTEE_MACRO_ATTR_DERIVED: () = (); }; #[pointee] struct MyStruct; const _: () = { const ANOTHER_MACRO_DERIVED: () = (); }; fn main() {} ", "positive_passages": [{"docid": "doc-en-rust-d61cdeb622caf24c2dea9c9758666b900ee80c0d240b6359a702fd116a1bec4e", "text": "https://crater- https://crater- cc $DIR/fn-traits.rs:24:10 | LL | fn call(f: impl Fn()) { | ---- required by this bound in `call` ... LL | call(foo); | ^^^ expected an `Fn<()>` closure, found `fn() {foo}` | = help: the trait `std::ops::Fn<()>` is not implemented for `fn() {foo}` = note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ } = note: `#[target_feature]` functions do not implement the `Fn` traits error[E0277]: expected a `std::ops::FnMut<()>` closure, found `fn() {foo}` --> $DIR/fn-traits.rs:25:14 | LL | fn call_mut(f: impl FnMut()) { | ------- required by this bound in `call_mut` ... LL | call_mut(foo); | ^^^ expected an `FnMut<()>` closure, found `fn() {foo}` | = help: the trait `std::ops::FnMut<()>` is not implemented for `fn() {foo}` = note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ } = note: `#[target_feature]` functions do not implement the `Fn` traits error[E0277]: expected a `std::ops::FnOnce<()>` closure, found `fn() {foo}` --> $DIR/fn-traits.rs:26:15 | LL | fn call_once(f: impl FnOnce()) { | -------- required by this bound in `call_once` ... LL | call_once(foo); | ^^^ expected an `FnOnce<()>` closure, found `fn() {foo}` | = help: the trait `std::ops::FnOnce<()>` is not implemented for `fn() {foo}` = note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ } = note: `#[target_feature]` functions do not implement the `Fn` traits error[E0277]: expected a `std::ops::Fn<()>` closure, found `unsafe fn() {foo_unsafe}` --> $DIR/fn-traits.rs:28:10 | LL | fn call(f: impl Fn()) { | ---- required by this bound in `call` ... LL | call(foo_unsafe); | ^^^^^^^^^^ expected an `Fn<()>` closure, found `unsafe fn() {foo_unsafe}` | = help: the trait `std::ops::Fn<()>` is not implemented for `unsafe fn() {foo_unsafe}` = note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ } = note: `#[target_feature]` functions do not implement the `Fn` traits error[E0277]: expected a `std::ops::FnMut<()>` closure, found `unsafe fn() {foo_unsafe}` --> $DIR/fn-traits.rs:30:14 | LL | fn call_mut(f: impl FnMut()) { | ------- required by this bound in `call_mut` ... LL | call_mut(foo_unsafe); | ^^^^^^^^^^ expected an `FnMut<()>` closure, found `unsafe fn() {foo_unsafe}` | = help: the trait `std::ops::FnMut<()>` is not implemented for `unsafe fn() {foo_unsafe}` = note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ } = note: `#[target_feature]` functions do not implement the `Fn` traits error[E0277]: expected a `std::ops::FnOnce<()>` closure, found `unsafe fn() {foo_unsafe}` --> $DIR/fn-traits.rs:32:15 | LL | fn call_once(f: impl FnOnce()) { | -------- required by this bound in `call_once` ... LL | call_once(foo_unsafe); | ^^^^^^^^^^ expected an `FnOnce<()>` closure, found `unsafe fn() {foo_unsafe}` | = help: the trait `std::ops::FnOnce<()>` is not implemented for `unsafe fn() {foo_unsafe}` = note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ } = note: `#[target_feature]` functions do not implement the `Fn` traits error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0277`. ", "positive_passages": [{"docid": "doc-en-rust-7aa395d7fc5503d3520cf8f9dcdb8df442e7c4a7d43ea7e95ff35e103b88efed", "text": "(Moved from with an PoC.) The following program () demonstrates how current implementation of allows using a targetfeature from safe code without ensuring it's actually available: This is unsound because it allows executing (e.g.) AVX instructions on CPUs that do not implement them, which is UB. It only works because \"safe fns with targetfeatures\" are erroneously considered to implement the FnOnce/FnMut/Fn traits.\nProposed resolution: It would probably be better to add the to functions implicitly during lowering to HIR. Implicit is already to functions in blocks in the same way. That would make the unsafety checker the only place (besides AST lowering) where they would be treated specially. Like, \"yes, the function is unsafe, but we know that it's safe to call in this specific context, so the unsafe block can be omitted\". The special coercion checks would no longer be necessary in that case.\nOr perhaps the RFC should be revised to still require writing and only unsafety checker need to be enhanced to allow calling unsafe functions without unsafe blocks in the situations known to be safe. That would be even less magic, which is good, IMO. The ergonomic regression would be minor because would still be not required at call sites.\nGood catch. Another option is that referencing, not calling, a target-feature function is unsafe, but I guess that is a bit inconsistent given that this already compiles (): In other words, accessing a safe target feature 1.1 function would be unsafe (unless the target feature is in scope), not just calling it. I think that this is what I would expect somehow, but I would expect it to apply uniformly to both safe and unsafe target feature functions (and that's not an option). The downside of this approach is that we don't know why the function was declared unsafe, not really -- was it only because of the target feature? Or were there additional requirements that would have made it unsafe?\nFor example, a whole bunch of functions take raw pointers and use them to access memory, so they need to be unsafe even if the respective target feature is enabled in the calling context.\nThe downside of this approach is that we don't know why the function was declared unsafe, not really -- was it only because of the target feature? Or were there additional requirements that would have made it unsafe? Ah, right, that's a good argument.", "commid": "rust_issue_72012", "tokennum": 522}], "negative_passages": []} {"query_id": "q-en-rust-863bd6bf9b16b28d4f30ead53f254b9c42b6de1da254f9fdcca627eaad3d46ba", "query": " error[E0277]: expected a `std::ops::Fn<()>` closure, found `fn() {foo}` --> $DIR/fn-traits.rs:24:10 | LL | fn call(f: impl Fn()) { | ---- required by this bound in `call` ... LL | call(foo); | ^^^ expected an `Fn<()>` closure, found `fn() {foo}` | = help: the trait `std::ops::Fn<()>` is not implemented for `fn() {foo}` = note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ } = note: `#[target_feature]` functions do not implement the `Fn` traits error[E0277]: expected a `std::ops::FnMut<()>` closure, found `fn() {foo}` --> $DIR/fn-traits.rs:25:14 | LL | fn call_mut(f: impl FnMut()) { | ------- required by this bound in `call_mut` ... LL | call_mut(foo); | ^^^ expected an `FnMut<()>` closure, found `fn() {foo}` | = help: the trait `std::ops::FnMut<()>` is not implemented for `fn() {foo}` = note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ } = note: `#[target_feature]` functions do not implement the `Fn` traits error[E0277]: expected a `std::ops::FnOnce<()>` closure, found `fn() {foo}` --> $DIR/fn-traits.rs:26:15 | LL | fn call_once(f: impl FnOnce()) { | -------- required by this bound in `call_once` ... LL | call_once(foo); | ^^^ expected an `FnOnce<()>` closure, found `fn() {foo}` | = help: the trait `std::ops::FnOnce<()>` is not implemented for `fn() {foo}` = note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ } = note: `#[target_feature]` functions do not implement the `Fn` traits error[E0277]: expected a `std::ops::Fn<()>` closure, found `unsafe fn() {foo_unsafe}` --> $DIR/fn-traits.rs:28:10 | LL | fn call(f: impl Fn()) { | ---- required by this bound in `call` ... LL | call(foo_unsafe); | ^^^^^^^^^^ expected an `Fn<()>` closure, found `unsafe fn() {foo_unsafe}` | = help: the trait `std::ops::Fn<()>` is not implemented for `unsafe fn() {foo_unsafe}` = note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ } = note: `#[target_feature]` functions do not implement the `Fn` traits error[E0277]: expected a `std::ops::FnMut<()>` closure, found `unsafe fn() {foo_unsafe}` --> $DIR/fn-traits.rs:30:14 | LL | fn call_mut(f: impl FnMut()) { | ------- required by this bound in `call_mut` ... LL | call_mut(foo_unsafe); | ^^^^^^^^^^ expected an `FnMut<()>` closure, found `unsafe fn() {foo_unsafe}` | = help: the trait `std::ops::FnMut<()>` is not implemented for `unsafe fn() {foo_unsafe}` = note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ } = note: `#[target_feature]` functions do not implement the `Fn` traits error[E0277]: expected a `std::ops::FnOnce<()>` closure, found `unsafe fn() {foo_unsafe}` --> $DIR/fn-traits.rs:32:15 | LL | fn call_once(f: impl FnOnce()) { | -------- required by this bound in `call_once` ... LL | call_once(foo_unsafe); | ^^^^^^^^^^ expected an `FnOnce<()>` closure, found `unsafe fn() {foo_unsafe}` | = help: the trait `std::ops::FnOnce<()>` is not implemented for `unsafe fn() {foo_unsafe}` = note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ } = note: `#[target_feature]` functions do not implement the `Fn` traits error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0277`. ", "positive_passages": [{"docid": "doc-en-rust-7d812864b8b2677957a15314a2c38a8194c65e0449cb841acb524448379a0963", "text": "The \"unsafety checker enhancement\" should only affect unsafe functions that are made unsafe through , but not other means (explicit or block).\nI'm new to the compiler, but it seemed non-trivial to change functions to unsafe when lowering to HIR. It looks to me like you'd end up with just as many exceptions (ignoring the unsafe in some scenarios), in addition tracking the origin of the . On the other hand it was pretty trivial to not implement the Fn traits instead. I'll open a PR with my fix, but please close it if the other method is preferred.\nSo there are sort of two questions here. One of them is what user-visible behavior is permitted, and the other is how precisely that is implemented in the compiler. I think the latter only concerns the team in-so-far as it represents the impact on the language spec and on the \"mental model\" that users must keep in mind. Nominating for the lang-team meeting to discuss solution, which is simply to make \"target-feature\" functions not implement the traits (just as functions do not implement the traits, along with functions with non-Rust ABIs etc).\nI think I was tagged by mistake :wink:\nApologies! Fixed. Github autocompleted that for me. Here I was feeling so grateful to it.\nWe discussed this in . The conclusion was that the fix that proposed is good for right now. It's already the case that many items do not implement the function trait (e.g., those with custom ABIs or which are unsafe), so this would be \"yet another\" case (admittedly a somewhat different one in that this case doesn't show up in the type of function pointers, for better or worse). We uncovered a few other interesting observations: pointed out that their ideal preference would be to have something like \" only implements \" within an unsafe block, but of course the trait system has no precedent for that. It would be sort of like a attached to the impl block (i.e., the impl is usable in some context where unsafe code is allowed). Another possibility might be \" only implements within a fn that has a suitable target feature in scope\". This is an interesting idea because, although the pointer could escape in the form of a , the idea is that once you enter , you've already demonstrated that you possess the target feature, so it's ok if the value escapes.", "commid": "rust_issue_72012", "tokennum": 511}], "negative_passages": []} {"query_id": "q-en-rust-863bd6bf9b16b28d4f30ead53f254b9c42b6de1da254f9fdcca627eaad3d46ba", "query": " error[E0277]: expected a `std::ops::Fn<()>` closure, found `fn() {foo}` --> $DIR/fn-traits.rs:24:10 | LL | fn call(f: impl Fn()) { | ---- required by this bound in `call` ... LL | call(foo); | ^^^ expected an `Fn<()>` closure, found `fn() {foo}` | = help: the trait `std::ops::Fn<()>` is not implemented for `fn() {foo}` = note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ } = note: `#[target_feature]` functions do not implement the `Fn` traits error[E0277]: expected a `std::ops::FnMut<()>` closure, found `fn() {foo}` --> $DIR/fn-traits.rs:25:14 | LL | fn call_mut(f: impl FnMut()) { | ------- required by this bound in `call_mut` ... LL | call_mut(foo); | ^^^ expected an `FnMut<()>` closure, found `fn() {foo}` | = help: the trait `std::ops::FnMut<()>` is not implemented for `fn() {foo}` = note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ } = note: `#[target_feature]` functions do not implement the `Fn` traits error[E0277]: expected a `std::ops::FnOnce<()>` closure, found `fn() {foo}` --> $DIR/fn-traits.rs:26:15 | LL | fn call_once(f: impl FnOnce()) { | -------- required by this bound in `call_once` ... LL | call_once(foo); | ^^^ expected an `FnOnce<()>` closure, found `fn() {foo}` | = help: the trait `std::ops::FnOnce<()>` is not implemented for `fn() {foo}` = note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ } = note: `#[target_feature]` functions do not implement the `Fn` traits error[E0277]: expected a `std::ops::Fn<()>` closure, found `unsafe fn() {foo_unsafe}` --> $DIR/fn-traits.rs:28:10 | LL | fn call(f: impl Fn()) { | ---- required by this bound in `call` ... LL | call(foo_unsafe); | ^^^^^^^^^^ expected an `Fn<()>` closure, found `unsafe fn() {foo_unsafe}` | = help: the trait `std::ops::Fn<()>` is not implemented for `unsafe fn() {foo_unsafe}` = note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ } = note: `#[target_feature]` functions do not implement the `Fn` traits error[E0277]: expected a `std::ops::FnMut<()>` closure, found `unsafe fn() {foo_unsafe}` --> $DIR/fn-traits.rs:30:14 | LL | fn call_mut(f: impl FnMut()) { | ------- required by this bound in `call_mut` ... LL | call_mut(foo_unsafe); | ^^^^^^^^^^ expected an `FnMut<()>` closure, found `unsafe fn() {foo_unsafe}` | = help: the trait `std::ops::FnMut<()>` is not implemented for `unsafe fn() {foo_unsafe}` = note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ } = note: `#[target_feature]` functions do not implement the `Fn` traits error[E0277]: expected a `std::ops::FnOnce<()>` closure, found `unsafe fn() {foo_unsafe}` --> $DIR/fn-traits.rs:32:15 | LL | fn call_once(f: impl FnOnce()) { | -------- required by this bound in `call_once` ... LL | call_once(foo_unsafe); | ^^^^^^^^^^ expected an `FnOnce<()>` closure, found `unsafe fn() {foo_unsafe}` | = help: the trait `std::ops::FnOnce<()>` is not implemented for `unsafe fn() {foo_unsafe}` = note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ } = note: `#[target_feature]` functions do not implement the `Fn` traits error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0277`. ", "positive_passages": [{"docid": "doc-en-rust-4e58451561051feb9eee27bfa8ab55f47b4db170572b7b1f7a81ca818eb807fe", "text": "(This would be like a clause.) To that end, I was thinking that you could model this last point using closures, but I found that it doesn't work. In particular, gives an error, even if it appears inside of a function annotated with . This seems like something we should discuss, but it's a separate issue. We did discuss briefly whether target features should be part of the type of function pointers but I think the conclusion was 'well maybe but there is already stable code out there that lets you coerce, and it seems rather niche'. We also discussed whether we should permit one to annotate closures with target-feature annotations. In any case, those are things we can address separately from this issue, but the point is that adopting more accepting solutions can be done in the future.\nI'm going to move the question of whether closures should \"inherit\" target features to the main tracking issue -- I'm not sure if that is something that was discussed as part of the original RFC discussion?\nOpened to discuss closures.", "commid": "rust_issue_72012", "tokennum": 224}], "negative_passages": []} {"query_id": "q-en-rust-86461fb65ffc3fe3a7e36ddd6c5558c54845116b5652bb5588ef2ef8924fc36b", "query": "} alloc0 (static: FOO, size: 8, align: 8) { \u257e\u2500\u2500\u2500\u2500\u2500\u2500\u2500alloc3\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u257c \u2502 \u257e\u2500\u2500\u2500\u2500\u2500\u2500\u257c \u257e\u2500\u2500\u2500\u2500\u2500\u2500\u2500alloc9\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u257c \u2502 \u257e\u2500\u2500\u2500\u2500\u2500\u2500\u257c } alloc3 (size: 180, align: 1) { alloc9 (size: 180, align: 1) { 0x00 \u2502 ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab \u2502 ................ 0x10 \u2502 ab ab ab ab ab ab ab ab ab ab ab ab \u257e\u2500\u2500alloc4\u2500\u2500 \u2502 ............\u257e\u2500\u2500\u2500 0x20 \u2502 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u257c 01 ef cd ab 00 00 00 00 00 00 00 00 \u2502 \u2500\u2500\u2500\u257c............", "positive_passages": [{"docid": "doc-en-rust-b520ada3e756375b6a9e17f40d71e9d8386987872daac48bdfd5a185c43bfd4c", "text": "This little matrix processing code shows miscompilation if compiled with: But it compiles correctly with: With:\nHmm, on first glance the replacement it performs looks correct: It replaces local () with the return place . Previously the return place was only used in the block by a copy statement, so this transformation should be correct. Maybe this part of the diff causes a problem? We're using our return place as the return destination for the inner call. It's possible that there's an undocumented (and maybe unintended) assumption that the return place is not reused like this, either in other MIR optimizations or in codegen. Haven't looked too deeply yet though.\nAh, there's this bad call in LLVM IR: It passes a reference to as both the return pointer, and the second (immutable) argument.\nwe have this corresponding MIR, where we already incorrectly pass a reference to as an argument, while also assigning the call result to it: The destination propagation pass already has code that prevents merging a call destination with one of the arguments, but here we pass a reference instead. Curiously, the was produced by merging with , which is not really something the pass should be doing since a reference is taken to , and we avoid touching any local that has its address taken.\nThe propagation is disabled only if both locals have their address taken. Changing that to be more conservative does fix this issue. Minimized:\nOof, this should have been an , not an\nThanks\nOpened with a fix", "commid": "rust_issue_77002", "tokennum": 316}], "negative_passages": []} {"query_id": "q-en-rust-866f02704766a0bfc9886e4a49d6a5115e41c37fd4260a36a574539810e2dd44", "query": " use crate::spec::{LinkerFlavor, PanicStrategy, Target, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { let mut base = super::windows_uwp_msvc_base::opts(); base.max_atomic_width = Some(64); base.has_elf_tls = true; // FIXME: this shouldn't be panic=abort, it should be panic=unwind base.panic_strategy = PanicStrategy::Abort; Ok(Target { llvm_target: \"aarch64-pc-windows-msvc\".to_string(), target_endian: \"little\".to_string(),", "positive_passages": [{"docid": "doc-en-rust-3257bef8ef01f009f8b665ba3460381149022df8e0ce60a65db9d415813e3b70", "text": "The and targets force panic=abort. said : This looks related to , which points at these now-merged LLVM changes: It's possible that we do not need to force panic=abort anymore for arm64 Windows as a result. What's the best way to determine if this is still required?\nTheoretically the way to fix this issue is: First Next, run the build Finally, run the tests If that all passes, then the change can land! The tests may be able to be skipped, and some tests may fail, so it may be possible to switch the defaults and we can fixup bugs later. I don't personally have hardware to test these changes on myself, though.\nI occasionally have access to a Windows arm64 laptop, so I'll try and get a rustc build going on it at some point.", "commid": "rust_issue_65313", "tokennum": 175}], "negative_passages": []} {"query_id": "q-en-rust-86704df67fbee7a75598b4ec01e5e5e9edae516161ee71f94318a14fe2ec230c", "query": "COPY host-x86_64/dist-x86_64-linux/build-binutils.sh /tmp/ RUN ./build-binutils.sh # libssh2 (a dependency of Cargo) requires cmake 2.8.11 or higher but CentOS # only has 2.6.4, so build our own COPY host-x86_64/dist-x86_64-linux/build-cmake.sh /tmp/ RUN ./build-cmake.sh # Need a newer version of gcc than centos has to compile LLVM nowadays # Need at least GCC 5.1 to compile LLVM nowadays COPY host-x86_64/dist-x86_64-linux/build-gcc.sh /tmp/ RUN ./build-gcc.sh RUN ./build-gcc.sh && apt-get remove -y gcc g++ # CentOS 5.5 has Python 2.4 by default, but LLVM needs 2.7+ # Debian 6 has Python 2.6 by default, but LLVM needs 2.7+ COPY host-x86_64/dist-x86_64-linux/build-python.sh /tmp/ RUN ./build-python.sh # Now build LLVM+Clang 7, afterwards configuring further compilations to use the # LLVM needs cmake 3.4.3 or higher, and is planning to raise to 3.13.4. COPY host-x86_64/dist-x86_64-linux/build-cmake.sh /tmp/ RUN ./build-cmake.sh # Now build LLVM+Clang, afterwards configuring further compilations to use the # clang/clang++ compilers. COPY host-x86_64/dist-x86_64-linux/build-clang.sh host-x86_64/dist-x86_64-linux/llvm-project-centos.patch /tmp/ COPY host-x86_64/dist-x86_64-linux/build-clang.sh /tmp/ RUN ./build-clang.sh ENV CC=clang CXX=clang++ # Apparently CentOS 5.5 desn't have `git` in yum, but we're gonna need it for # cloning, so download and build it here. COPY host-x86_64/dist-x86_64-linux/build-git.sh /tmp/ RUN ./build-git.sh # for sanitizers, we need kernel headers files newer than the ones CentOS ships # with so we install newer ones here COPY host-x86_64/dist-x86_64-linux/build-headers.sh /tmp/ RUN ./build-headers.sh # OpenSSL requires a more recent version of perl # with so we install newer ones here COPY host-x86_64/dist-x86_64-linux/build-perl.sh /tmp/ RUN ./build-perl.sh COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh", "positive_passages": [{"docid": "doc-en-rust-f4ed9e3f1d2d7ae852d8255d7e891270d3b1745dcfd72417e2a2b98bdaa449dd", "text": "The docs currently claim that the minimum Linux kernel version for is 2.6.18 (released September 20th, 2006). This is because RHEL 5 used that kernel version. However, RHEL 5 entered ELS on March 31, 2017. Should we continue to support RHEL 5 for , or should we increase the minimum Linux Kernel version to 2.6.27 (2nd LTS) or 2.6.32 (RHEL 6, 3rd LTS)? . Even bumping the min-version to 2.6.27 would allow us to remove most of the Linux-specific hacks in . Example: .\nGiven that RHEL is the only reason we keep comically old kernel versions around, I would propose that Rust only support RHEL until Maintenance Support ends. This is (essentially) what we already did for RHEL 4. Rust never supported RHEL 4, and back when RHEL 5 still had maintenance support. It would be nice to get someone from Red Hat or a RHEL customer to comment. This policy would allow us to increment the minimum kernel from 2.6.18 to 2.6.32 (and remove a lot of Linux-specific hacks). Note that RHEL has a weird (and very long) support system for RHEL 4, 5, and 6 (sources: and ). It has 5 major steps: Full Support Normal support of the OS Maintenance Support 1 Bug/Security fixes Limited hardware refresh Maintenance Support 2 Bug/Security fixes The end of this phase is considered \"Product retirement\" Extended Life Cycle Support (ELS) Additional paid product from Red Hat Gives updates for a longer period of time No additional releases/images Extended Life Phase (ELP) No more updates Limited Technical Support End date not given by Red Hat Current status of RHEL versions: RHEL 4 Not supported by Rust Currently in ELP (no end date specified) ELS ended March 31, 2017 RHEL 5 Supported by Rust Currently in ELS Maintenance Support ended March 31, 2017 ELS ends November 30, 2020 RHEL 6 Supported by Rust Currently in Maintenance Support 2 Maintenance Support ends November 30, 2020\ncc which I think they could be related.", "commid": "rust_issue_62516", "tokennum": 449}], "negative_passages": []} {"query_id": "q-en-rust-86704df67fbee7a75598b4ec01e5e5e9edae516161ee71f94318a14fe2ec230c", "query": "COPY host-x86_64/dist-x86_64-linux/build-binutils.sh /tmp/ RUN ./build-binutils.sh # libssh2 (a dependency of Cargo) requires cmake 2.8.11 or higher but CentOS # only has 2.6.4, so build our own COPY host-x86_64/dist-x86_64-linux/build-cmake.sh /tmp/ RUN ./build-cmake.sh # Need a newer version of gcc than centos has to compile LLVM nowadays # Need at least GCC 5.1 to compile LLVM nowadays COPY host-x86_64/dist-x86_64-linux/build-gcc.sh /tmp/ RUN ./build-gcc.sh RUN ./build-gcc.sh && apt-get remove -y gcc g++ # CentOS 5.5 has Python 2.4 by default, but LLVM needs 2.7+ # Debian 6 has Python 2.6 by default, but LLVM needs 2.7+ COPY host-x86_64/dist-x86_64-linux/build-python.sh /tmp/ RUN ./build-python.sh # Now build LLVM+Clang 7, afterwards configuring further compilations to use the # LLVM needs cmake 3.4.3 or higher, and is planning to raise to 3.13.4. COPY host-x86_64/dist-x86_64-linux/build-cmake.sh /tmp/ RUN ./build-cmake.sh # Now build LLVM+Clang, afterwards configuring further compilations to use the # clang/clang++ compilers. COPY host-x86_64/dist-x86_64-linux/build-clang.sh host-x86_64/dist-x86_64-linux/llvm-project-centos.patch /tmp/ COPY host-x86_64/dist-x86_64-linux/build-clang.sh /tmp/ RUN ./build-clang.sh ENV CC=clang CXX=clang++ # Apparently CentOS 5.5 desn't have `git` in yum, but we're gonna need it for # cloning, so download and build it here. COPY host-x86_64/dist-x86_64-linux/build-git.sh /tmp/ RUN ./build-git.sh # for sanitizers, we need kernel headers files newer than the ones CentOS ships # with so we install newer ones here COPY host-x86_64/dist-x86_64-linux/build-headers.sh /tmp/ RUN ./build-headers.sh # OpenSSL requires a more recent version of perl # with so we install newer ones here COPY host-x86_64/dist-x86_64-linux/build-perl.sh /tmp/ RUN ./build-perl.sh COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh", "positive_passages": [{"docid": "doc-en-rust-c658707ba1f511004a82a078aaea5dda93c2219b3ffe958dfb8644db8e29ef0c", "text": "It also may be worth to drop support of Windows XP and Vista (especially considering that panics are broken on XP since June 2016, see: ). Previously it was discussed . cc\nBesides , which other things would we be able to clean up?\nGood question! There are 6 workarounds in for older Linux versions (that I could find). Increasing the minimum version to 2.6.32 (aka 3rd Kernel LTS, aka RHEL 6) would fix 5 of them. Code links are inline: (mentioned above, in 2.6.23) ( in 2.6.24, there is also the mention of a bug occuring on \"some linux kernel at some point\") to atomically set the flag on the pipe fds ( in 2.6.27) ( in 2.6.27) to permit use of ( in 2.6.28) ( in 4.5, not fixed by this proposal) As you can see, the workarounds fixed by this proposal all have a similar flavor.\nI am Red Hat's maintainer for Rust on RHEL -- thanks for the cc. I try to keep an eye on new issues, but this one slipped past me. Red Hat only ships the Rust toolchain to customers for RHEL 7 and RHEL 8. If our customers would like to use Rust on older RHEL, they can do so via , and we'll support them in the same way we would for any other third-party software. Internally we do also build and use on RHEL 6, mostly because it's needed to ship Firefox updates. This is where it gets a little hairy, because each RHEL N is bootstrapped on RHEL N-1 and often kept that way -- meaning a lot of our RHEL 6 builders are still running on a RHEL 5 kernel. I would have to apply local workarounds if upstream Rust loses the ability to run on 2.6.18 kernels. We prefer to keep fixes upstream as much as possible, both for open sharing and to avoid bitrot. Is there much of a benefit to removing the current workarounds? I agree all of that code is annoying and cumbersome, but it's already written, and as far as I know it hasn't been a maintenance burden. Do you see otherwise?", "commid": "rust_issue_62516", "tokennum": 486}], "negative_passages": []} {"query_id": "q-en-rust-86704df67fbee7a75598b4ec01e5e5e9edae516161ee71f94318a14fe2ec230c", "query": "COPY host-x86_64/dist-x86_64-linux/build-binutils.sh /tmp/ RUN ./build-binutils.sh # libssh2 (a dependency of Cargo) requires cmake 2.8.11 or higher but CentOS # only has 2.6.4, so build our own COPY host-x86_64/dist-x86_64-linux/build-cmake.sh /tmp/ RUN ./build-cmake.sh # Need a newer version of gcc than centos has to compile LLVM nowadays # Need at least GCC 5.1 to compile LLVM nowadays COPY host-x86_64/dist-x86_64-linux/build-gcc.sh /tmp/ RUN ./build-gcc.sh RUN ./build-gcc.sh && apt-get remove -y gcc g++ # CentOS 5.5 has Python 2.4 by default, but LLVM needs 2.7+ # Debian 6 has Python 2.6 by default, but LLVM needs 2.7+ COPY host-x86_64/dist-x86_64-linux/build-python.sh /tmp/ RUN ./build-python.sh # Now build LLVM+Clang 7, afterwards configuring further compilations to use the # LLVM needs cmake 3.4.3 or higher, and is planning to raise to 3.13.4. COPY host-x86_64/dist-x86_64-linux/build-cmake.sh /tmp/ RUN ./build-cmake.sh # Now build LLVM+Clang, afterwards configuring further compilations to use the # clang/clang++ compilers. COPY host-x86_64/dist-x86_64-linux/build-clang.sh host-x86_64/dist-x86_64-linux/llvm-project-centos.patch /tmp/ COPY host-x86_64/dist-x86_64-linux/build-clang.sh /tmp/ RUN ./build-clang.sh ENV CC=clang CXX=clang++ # Apparently CentOS 5.5 desn't have `git` in yum, but we're gonna need it for # cloning, so download and build it here. COPY host-x86_64/dist-x86_64-linux/build-git.sh /tmp/ RUN ./build-git.sh # for sanitizers, we need kernel headers files newer than the ones CentOS ships # with so we install newer ones here COPY host-x86_64/dist-x86_64-linux/build-headers.sh /tmp/ RUN ./build-headers.sh # OpenSSL requires a more recent version of perl # with so we install newer ones here COPY host-x86_64/dist-x86_64-linux/build-perl.sh /tmp/ RUN ./build-perl.sh COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh", "positive_passages": [{"docid": "doc-en-rust-af4898c3fb7c61e2eba3dec9f4b6ba76545c9cefd16e60e4bb5d1131f91cb434", "text": "If there are any known issues with such Linux compatibility code, I am definitely willing to take assignment for fixing them.\n(Not a Rust maintainer, but I'm a Rust user and maintain a lot of other OSS software so I have well-developed feelings around supporting Very Old Software :-)) Do you have any sense of on what timeline Rust would be able to drop support for 2.6.18 kernels without causing you pain? In general I don't think people mind supporting configurations that have users and are painful to work around, but needing to support them for forever is a bitter pill to swallow! Particularly as they get harder and harder to test over time (already I have no idea how to test on really old kernels besides building it myself). So if there was an estimate \"we'd like to be able to support this until Q2 2020\", even if it's not set in stone, I think that would be very helpful!\nThe other benefit would be that Rust wouldn't have to use CentOS 5 for CI, which means we don't have to patch LLVM (and Emscripten LLVM) to compile on those systems. Of course that's also fairly limited in scope.\nAs soon as we stop shipping Firefox and Thunderbird updates on RHEL 6, I won't need Rust there anymore. AFAIK this does correspond to the end of Maintenance Support, November 30, 2020. Then I'll be on to RHEL 7 builders as my minimum, probably still with some RHEL 6 2.6.32 kernels involved. It should be fine for me if we update CI to CentOS 6. This is mostly concerned with how the release binaries are linked to GLIBC symbol versions, which is all in userspace. It's a broader community question whether any other Rust users still care about running on RHEL or CentOS 5. (Small caveat - glibc support for a symbol can still return , .)\nI noticed that Red Hat also has Extended Life Cycle Support (ELS) for RHEL 6 until June 30, 2024. Will you need RHEL 5 to work during this time? I don't know how ELS works with Firefox updates. Also, is there any reason RHEL 4 support wasn't an issue prior to March 31, 2017 (while RHEL 5 was still normally supported)?", "commid": "rust_issue_62516", "tokennum": 500}], "negative_passages": []} {"query_id": "q-en-rust-86704df67fbee7a75598b4ec01e5e5e9edae516161ee71f94318a14fe2ec230c", "query": "COPY host-x86_64/dist-x86_64-linux/build-binutils.sh /tmp/ RUN ./build-binutils.sh # libssh2 (a dependency of Cargo) requires cmake 2.8.11 or higher but CentOS # only has 2.6.4, so build our own COPY host-x86_64/dist-x86_64-linux/build-cmake.sh /tmp/ RUN ./build-cmake.sh # Need a newer version of gcc than centos has to compile LLVM nowadays # Need at least GCC 5.1 to compile LLVM nowadays COPY host-x86_64/dist-x86_64-linux/build-gcc.sh /tmp/ RUN ./build-gcc.sh RUN ./build-gcc.sh && apt-get remove -y gcc g++ # CentOS 5.5 has Python 2.4 by default, but LLVM needs 2.7+ # Debian 6 has Python 2.6 by default, but LLVM needs 2.7+ COPY host-x86_64/dist-x86_64-linux/build-python.sh /tmp/ RUN ./build-python.sh # Now build LLVM+Clang 7, afterwards configuring further compilations to use the # LLVM needs cmake 3.4.3 or higher, and is planning to raise to 3.13.4. COPY host-x86_64/dist-x86_64-linux/build-cmake.sh /tmp/ RUN ./build-cmake.sh # Now build LLVM+Clang, afterwards configuring further compilations to use the # clang/clang++ compilers. COPY host-x86_64/dist-x86_64-linux/build-clang.sh host-x86_64/dist-x86_64-linux/llvm-project-centos.patch /tmp/ COPY host-x86_64/dist-x86_64-linux/build-clang.sh /tmp/ RUN ./build-clang.sh ENV CC=clang CXX=clang++ # Apparently CentOS 5.5 desn't have `git` in yum, but we're gonna need it for # cloning, so download and build it here. COPY host-x86_64/dist-x86_64-linux/build-git.sh /tmp/ RUN ./build-git.sh # for sanitizers, we need kernel headers files newer than the ones CentOS ships # with so we install newer ones here COPY host-x86_64/dist-x86_64-linux/build-headers.sh /tmp/ RUN ./build-headers.sh # OpenSSL requires a more recent version of perl # with so we install newer ones here COPY host-x86_64/dist-x86_64-linux/build-perl.sh /tmp/ RUN ./build-perl.sh COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh", "positive_passages": [{"docid": "doc-en-rust-934ec82e8629c1a4b0aa4c30514ddf0d4797bd4b016aa76dfff917479da3a145", "text": "This issue came up for me when dealing with opening files in , see for more info. No single RHEL 5 issue is that bad, it's mainly just the sum of a bunch of tiny issues.\nI'm not on that team, but AFAIK we don't ship Firefox updates for ELS. The last build I see for RHEL 5 was . Maybe there could be an exception for a severe security issue, but I really doubt we'd rebase to newer Firefox for that, which means Rust requirements won't change. New Firefox ESR versions do require a newer Rust toolchain too, which is generally why we have to keep up. Otherwise we could just freeze some older compat rustc while upstream moves on. Rust wasn't required until Firefox 52.\nthat makes perfect sense to me, thanks for clarifying. So the proposed policy would be: Support RHEL until RHEL is retired (i.e. ends normal support). This would mean: Supporting RHEL 5 (v2.6.18) until November 30, 2020 Supporting RHEL 6 (v2.6.32) until June 30, 2024 Supporting RHEL 7 (v3.10) until May, 2029 This is a much longer support tail than any other Linux distros (that I know of), so it would also be the effective minimum kernel version of , , and their dependencies. How does that sound to people? EDIT: The alternative to this would be Support RHEL until it is retired, taking the table above and incrementing the RHEL versions by 1. It would also mean being able to drop RHEL 5 support now.\nSure, that's ideal for me. :smile: As mentioned, is just needed for kernel support, as far as I'm concerned. Userspace concerns like GLIBC symbol versions can stick to currently supported for my needs.\nRed Hat should backport the features we need (CLOEXEC and getrandom, in particular) to whatever kernels that it wants Rust to support. I don't know any good reason why they don't do so, other than it's cheaper to convince the whole world to keep supporting older kernel versions than it is to do the backports. We should change that dynamic.", "commid": "rust_issue_62516", "tokennum": 482}], "negative_passages": []} {"query_id": "q-en-rust-86704df67fbee7a75598b4ec01e5e5e9edae516161ee71f94318a14fe2ec230c", "query": "COPY host-x86_64/dist-x86_64-linux/build-binutils.sh /tmp/ RUN ./build-binutils.sh # libssh2 (a dependency of Cargo) requires cmake 2.8.11 or higher but CentOS # only has 2.6.4, so build our own COPY host-x86_64/dist-x86_64-linux/build-cmake.sh /tmp/ RUN ./build-cmake.sh # Need a newer version of gcc than centos has to compile LLVM nowadays # Need at least GCC 5.1 to compile LLVM nowadays COPY host-x86_64/dist-x86_64-linux/build-gcc.sh /tmp/ RUN ./build-gcc.sh RUN ./build-gcc.sh && apt-get remove -y gcc g++ # CentOS 5.5 has Python 2.4 by default, but LLVM needs 2.7+ # Debian 6 has Python 2.6 by default, but LLVM needs 2.7+ COPY host-x86_64/dist-x86_64-linux/build-python.sh /tmp/ RUN ./build-python.sh # Now build LLVM+Clang 7, afterwards configuring further compilations to use the # LLVM needs cmake 3.4.3 or higher, and is planning to raise to 3.13.4. COPY host-x86_64/dist-x86_64-linux/build-cmake.sh /tmp/ RUN ./build-cmake.sh # Now build LLVM+Clang, afterwards configuring further compilations to use the # clang/clang++ compilers. COPY host-x86_64/dist-x86_64-linux/build-clang.sh host-x86_64/dist-x86_64-linux/llvm-project-centos.patch /tmp/ COPY host-x86_64/dist-x86_64-linux/build-clang.sh /tmp/ RUN ./build-clang.sh ENV CC=clang CXX=clang++ # Apparently CentOS 5.5 desn't have `git` in yum, but we're gonna need it for # cloning, so download and build it here. COPY host-x86_64/dist-x86_64-linux/build-git.sh /tmp/ RUN ./build-git.sh # for sanitizers, we need kernel headers files newer than the ones CentOS ships # with so we install newer ones here COPY host-x86_64/dist-x86_64-linux/build-headers.sh /tmp/ RUN ./build-headers.sh # OpenSSL requires a more recent version of perl # with so we install newer ones here COPY host-x86_64/dist-x86_64-linux/build-perl.sh /tmp/ RUN ./build-perl.sh COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh", "positive_passages": [{"docid": "doc-en-rust-eeb84d19a31c33242b4b2207158242f97ffc0b5ae779e20d04d3166e3dda00c1", "text": "The alternative to this would be Support RHEL N until it is retired I think we should not officially support retired OS versions (well, maybe with some grace period), so I prefer this option. Supporting 14 year old kernels seems a bit too much to me. each RHEL N is bootstrapped on RHEL N-1 and often kept that way -- meaning a lot of our RHEL 6 builders are still running on a RHEL 5 kernel Is it possible to apply kernel patches to those builders to add support for functionality like CLOEXEC? Or build Firefox separately on RHEL 6?\nI think it won't be fruitful for us to debate the merits of stable enterprise kernels, but no, this is not a possibility. An alternative take is \"Red Hat should be responsible for the work in Rust to maintain the support they want\" -- here I am, ready and willing. I definitely can't change those kernels. The ones that are stuck on N-1 are precisely to avoid rocking the boat, and backporting features is a big change. Some of our arches do eventually update the builders to their matching N kernel, but some don't, and I don't know all the reasons. If the workarounds are removed, then I will have to reapply them in our own builds. This assumes I keep using only our own binaries -- if I ever have to re-bootstrap from upstream binaries for stage0, I would also have to use some interception (like ) to hack in the workarounds. This is all possible, but much worse than the status quo of maintaining support here.\nI think this sounds reasonable. We aren't going to be able to update these kernels, it's just a question of when we would drop support for these OSes. Especially given that we wont need RHEL 5 CI support, I think that leaving things as they are is fine. I opened this issue to verify two things: 1) That we weren't intending on supporting RHEL 5 \"forever\", and had a clear date when to drop support. 2) That someone from Red Hat actively cared about supporting these older kernels. It looks like both these things are true. We should remove RHEL 5 workarounds after November 30, 2020. This issue can be postponed until then.", "commid": "rust_issue_62516", "tokennum": 488}], "negative_passages": []} {"query_id": "q-en-rust-86704df67fbee7a75598b4ec01e5e5e9edae516161ee71f94318a14fe2ec230c", "query": "COPY host-x86_64/dist-x86_64-linux/build-binutils.sh /tmp/ RUN ./build-binutils.sh # libssh2 (a dependency of Cargo) requires cmake 2.8.11 or higher but CentOS # only has 2.6.4, so build our own COPY host-x86_64/dist-x86_64-linux/build-cmake.sh /tmp/ RUN ./build-cmake.sh # Need a newer version of gcc than centos has to compile LLVM nowadays # Need at least GCC 5.1 to compile LLVM nowadays COPY host-x86_64/dist-x86_64-linux/build-gcc.sh /tmp/ RUN ./build-gcc.sh RUN ./build-gcc.sh && apt-get remove -y gcc g++ # CentOS 5.5 has Python 2.4 by default, but LLVM needs 2.7+ # Debian 6 has Python 2.6 by default, but LLVM needs 2.7+ COPY host-x86_64/dist-x86_64-linux/build-python.sh /tmp/ RUN ./build-python.sh # Now build LLVM+Clang 7, afterwards configuring further compilations to use the # LLVM needs cmake 3.4.3 or higher, and is planning to raise to 3.13.4. COPY host-x86_64/dist-x86_64-linux/build-cmake.sh /tmp/ RUN ./build-cmake.sh # Now build LLVM+Clang, afterwards configuring further compilations to use the # clang/clang++ compilers. COPY host-x86_64/dist-x86_64-linux/build-clang.sh host-x86_64/dist-x86_64-linux/llvm-project-centos.patch /tmp/ COPY host-x86_64/dist-x86_64-linux/build-clang.sh /tmp/ RUN ./build-clang.sh ENV CC=clang CXX=clang++ # Apparently CentOS 5.5 desn't have `git` in yum, but we're gonna need it for # cloning, so download and build it here. COPY host-x86_64/dist-x86_64-linux/build-git.sh /tmp/ RUN ./build-git.sh # for sanitizers, we need kernel headers files newer than the ones CentOS ships # with so we install newer ones here COPY host-x86_64/dist-x86_64-linux/build-headers.sh /tmp/ RUN ./build-headers.sh # OpenSSL requires a more recent version of perl # with so we install newer ones here COPY host-x86_64/dist-x86_64-linux/build-perl.sh /tmp/ RUN ./build-perl.sh COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh", "positive_passages": [{"docid": "doc-en-rust-98814f154707157dfd52e3b214f0d6bd01f03740b261398ed8ea1f98921871ca", "text": "EDIT: For our use case in , we were able to add compatibility for RHEL 5 .\nSee for a recent case where supporting such ancient kernels required extra manual work ( to the 2 lines mentioned by above). I am not sure how often that comes up, but probably the hardest part is to even notice that it happens -- and even then those codepaths will likely linger untested.\nYes, but this will still be true in general. If the CI kernel is newer than whatever kernel baseline we choose, it will be possible for newer syscalls to pass undetected. I don't know if we have any control over that -- can we choose a particular VM image? So that leaves us with a stated policy of support. The more that developers are aware of such issues, the better, but I'm the one most likely to notice when my build actually fails. If I come back with a fix, I at least need the project to be receptive. I haven't been in the habit of building nightly on our RHEL6 builders, but maybe I should! Catching this early is better for everyone involved...\nThat seems reasonable. How quick is the Rust related bootstrapping? Could it be run automatically (or more frequently)? This is an interesting point. If I hadn't made that change, would have kept working on RHEL 5, it just would have leaked an FD. I'm not sure how we would even test for this sort of thing. This isn't a RHEL 5 specific concern, I just don't know how Rust tests these types of resource leak issues in general.\nAbout 2 hours. Automation is harder, since I believe our build system needs my credentials, but I'll look into what is possible here. Yeah, that's a lot more subtle than an !", "commid": "rust_issue_62516", "tokennum": 381}], "negative_passages": []} {"query_id": "q-en-rust-8675003435a03df635cef3e05cc60dac199418165d8f0dbdbcedb0177f7520d2", "query": "LL | fn test_many_bounds_where(x: X) where X: Sized, X: Sized, X: Debug { | ^^^^^^^^^^ error: aborting due to 6 previous errors error[E0277]: the size for values of type `Self` cannot be known at compilation time --> $DIR/bound-suggestions.rs:44:46 | LL | const SIZE: usize = core::mem::size_of::(); | ^^^^ doesn't have a size known at compile-time | ::: $SRC_DIR/core/src/mem/mod.rs:LL:COL | LL | pub const fn size_of() -> usize { | - required by this bound in `std::mem::size_of` | help: consider further restricting `Self` | LL | trait Foo: Sized { | ^^^^^^^ error[E0277]: the size for values of type `Self` cannot be known at compilation time --> $DIR/bound-suggestions.rs:49:46 | LL | const SIZE: usize = core::mem::size_of::(); | ^^^^ doesn't have a size known at compile-time | ::: $SRC_DIR/core/src/mem/mod.rs:LL:COL | LL | pub const fn size_of() -> usize { | - required by this bound in `std::mem::size_of` | help: consider further restricting `Self` | LL | trait Bar: std::fmt::Display + Sized { | ^^^^^^^ error[E0277]: the size for values of type `Self` cannot be known at compilation time --> $DIR/bound-suggestions.rs:54:46 | LL | const SIZE: usize = core::mem::size_of::(); | ^^^^ doesn't have a size known at compile-time | ::: $SRC_DIR/core/src/mem/mod.rs:LL:COL | LL | pub const fn size_of() -> usize { | - required by this bound in `std::mem::size_of` | help: consider further restricting `Self` | LL | trait Baz: Sized where Self: std::fmt::Display { | ^^^^^^^ error[E0277]: the size for values of type `Self` cannot be known at compilation time --> $DIR/bound-suggestions.rs:59:46 | LL | const SIZE: usize = core::mem::size_of::(); | ^^^^ doesn't have a size known at compile-time | ::: $SRC_DIR/core/src/mem/mod.rs:LL:COL | LL | pub const fn size_of() -> usize { | - required by this bound in `std::mem::size_of` | help: consider further restricting `Self` | LL | trait Qux: Sized where Self: std::fmt::Display { | ^^^^^^^ error[E0277]: the size for values of type `Self` cannot be known at compilation time --> $DIR/bound-suggestions.rs:64:46 | LL | const SIZE: usize = core::mem::size_of::(); | ^^^^ doesn't have a size known at compile-time | ::: $SRC_DIR/core/src/mem/mod.rs:LL:COL | LL | pub const fn size_of() -> usize { | - required by this bound in `std::mem::size_of` | help: consider further restricting `Self` | LL | trait Bat: std::fmt::Display + Sized { | ^^^^^^^ error: aborting due to 11 previous errors For more information about this error, try `rustc --explain E0277`.", "positive_passages": [{"docid": "doc-en-rust-d63928979d5904d2065b93b4a136821de3ffe5f7a94c54cab4ca68fb930ed7ea", "text": "The following code errors, and the error contains a suggestion how to fix the error: The error message states: Obviously, writing is invalid syntax.\nIt seems the issue is that it's inserting the suggestion after the trait name and before the generics, rather than after the generics.\nNo-nightly-features code that exhibits the same problem: label -requires-nightly (should the F-labels go as well?)", "commid": "rust_issue_81175", "tokennum": 87}], "negative_passages": []} {"query_id": "q-en-rust-86b2f2ef9bec4ccd7dd017bd2ff8a42e344810c7618a96bfdf42a439f7e9b60f", "query": "// EMIT_MIR casts.roundtrip.InstSimplify.diff pub fn roundtrip(x: *const u8) -> *const u8 { // CHECK-LABEL: fn roundtrip( // CHECK: _3 = _1; // CHECK: _2 = move _3 as *mut u8 (PtrToPtr); // CHECK: _0 = move _2 as *const u8 (PointerCoercion(MutToConstPointer)); // CHECK: _4 = _1; // CHECK: _3 = move _4 as *mut u8 (PtrToPtr); // CHECK: _2 = move _3 as *const u8 (PointerCoercion(MutToConstPointer)); x as *mut u8 as *const u8 }", "positive_passages": [{"docid": "doc-en-rust-9b4ab92232153d0742c86ba450034f7e1e26346754a368047e2e8efb113687b6", "text": " $DIR/invalid-literal.rs:1:1 | LL | #[deprecated = b\"test\"] //~ ERROR attribute must be of the form | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error ", "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-870c43376f58283e70686d84c0cc24e0b9e63263472539b8c6be44193b072c72", "query": "} #[test] #[allow(deprecated)] fn stream_smoke_test_ip6() { let server_ip = next_test_ip6(); let client_ip = next_test_ip6();", "positive_passages": [{"docid": "doc-en-rust-4fd7762e51d720a30de6256cf0910fe9844fb1a4f2217e6c52aacc03855a75cd", "text": "change this to something more appropriate. This was introduced in commit when still returned . This should either block until a message from the correct sender arrives or return an error.", "commid": "rust_issue_18111", "tokennum": 34}], "negative_passages": []} {"query_id": "q-en-rust-870ce879593ae7623d6d809035fa451d5e992662fe7f2ab00037adadee677021", "query": "use rustc_ast as ast; use rustc_attr as attr; use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap}; use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap, FxIndexSet}; use rustc_data_structures::intern::{Interned, WithStableHash}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::tagged_ptr::CopyTaggedPtr;", "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/array-literal-index-oob.rs:2:7 | LL | &{[1, 2, 3][4]}; | ^^^^^^^^^^^^ | = note: #[deny(const_err)] on by default error: this expression will panic at runtime --> $DIR/array-literal-index-oob.rs:2:5 | LL | &{[1, 2, 3][4]}; | ^^^^^^^^^^^^^^^ index out of bounds: the len is 3 but the index is 4 error: reaching this expression at runtime will panic or abort --> $DIR/array-literal-index-oob.rs:2:7 | LL | &{[1, 2, 3][4]}; | --^^^^^^^^^^^^- | | | index out of bounds: the len is 3 but the index is 4 error: aborting due to 3 previous errors ", "positive_passages": [{"docid": "doc-en-rust-fee75364bbd0c1218e06047c2929d9ca0924afc9983ae46366f2a059b77adfa7", "text": "Originally stumbled upon through the eval IRC bot: Here's the smallest reproduction I could get, Removing either the block or the borrow displays only a normal compiler error (not an ICE) trace\ntriage: P-high, assigned to ; removing I-nominated label", "commid": "rust_issue_61595", "tokennum": 55}], "negative_passages": []} {"query_id": "q-en-rust-881b4d918cfa43b9b2e3174db03f17f99e9741b626b99d333659c9a80680879d", "query": "crate_lint: CrateLint, ) -> PartialRes { tracing::debug!( \"smart_resolve_path_fragment(id={:?},qself={:?},path={:?}\", \"smart_resolve_path_fragment(id={:?}, qself={:?}, path={:?})\", id, qself, path", "positive_passages": [{"docid": "doc-en-rust-be77427b5ff7c2ed740c28de1b76f9f4236cd70215ffd4d8355f0bbecedf7e44", "text": " $DIR/issue-117794.rs:5:14 | LL | self.b(|| 0) | ^ help: there is a method with a similar name: `a` error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0599`. ", "positive_passages": [{"docid": "doc-en-rust-d11936bcd6a6597f24f33b71174c06776fb26c0b0f3ec671ccadcce3be9312b4", "text": " $DIR/issue-117794.rs:5:14 | LL | self.b(|| 0) | ^ help: there is a method with a similar name: `a` error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0599`. ", "positive_passages": [{"docid": "doc-en-rust-3582f34b3b2635cb5da9295e9097c9133e9b00b50f2f5432ab709d5093f855a9", "text": " $DIR/issue-117794.rs:5:14 | LL | self.b(|| 0) | ^ help: there is a method with a similar name: `a` error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0599`. ", "positive_passages": [{"docid": "doc-en-rust-8755079cd08cd2f82e65d828fff11f413145f741d167dba2860642a9db1406dd", "text": " $DIR/escaping_bound_vars.rs:11:35 | LL | (): Test<{ 1 + (<() as Elide(&())>::call) }>, | -^ | | | lifetime defined here error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-e556405fe5a8865793bf339122f016f9c11b17865e682627dddb3e39e00ae238", "text": " $DIR/issue-73553-misinterp-range-literal.rs:12:10 | LL | demo(tell(1)..tell(10)); | ^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::Range` | help: consider borrowing here: `&(tell(1)..tell(10))` | = note: expected reference `&std::ops::Range` found struct `std::ops::Range` error[E0308]: mismatched types --> $DIR/issue-73553-misinterp-range-literal.rs:14:10 | LL | demo(1..10); | ^^^^^ | | | expected reference, found struct `std::ops::Range` | help: consider borrowing here: `&(1..10)` | = note: expected reference `&std::ops::Range` found struct `std::ops::Range<{integer}>` error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0308`. ", "positive_passages": [{"docid": "doc-en-rust-8ce10f6811cf7c026171e20e92284c0a28179748c1b3ff5e6481b07a479e3b83", "text": "Hi there! With this code (here's a ) The compiler reports this error message with a hint but the hint is incorrect due to missing parantheses in this case. The correct answer would be It works correctly when the second line in main is executed, where the range is provided directly. : $DIR/ensure-overriding-bindings-in-pattern-with-ty-err-doesnt-ice.rs:2:31 | LL | let str::<{fn str() { let str::T>>::as_bytes; }}, T>::as_bytes; | ^^^^^^^^^^^^^^^^^^ arbitrary expressions are not allowed in patterns error[E0412]: cannot find type `T` in this scope --> $DIR/ensure-overriding-bindings-in-pattern-with-ty-err-doesnt-ice.rs:2:55 | LL | let str::<{fn str() { let str::T>>::as_bytes; }}, T>::as_bytes; | ^ not found in this scope error[E0109]: type and const arguments are not allowed on builtin type `str` --> $DIR/ensure-overriding-bindings-in-pattern-with-ty-err-doesnt-ice.rs:2:15 | LL | let str::<{fn str() { let str::T>>::as_bytes; }}, T>::as_bytes; | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ type and const arguments not allowed | | | not allowed on builtin type `str` | help: primitive type `str` doesn't have generic parameters | LL - let str::<{fn str() { let str::T>>::as_bytes; }}, T>::as_bytes; LL + let str::as_bytes; | error[E0533]: expected unit struct, unit variant or constant, found associated function `str<, T>::as_bytes` --> $DIR/ensure-overriding-bindings-in-pattern-with-ty-err-doesnt-ice.rs:2:9 | LL | let str::<{fn str() { let str::T>>::as_bytes; }}, T>::as_bytes; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a unit struct, unit variant or constant error: aborting due to 4 previous errors Some errors have detailed explanations: E0109, E0412, E0533. For more information about an error, try `rustc --explain E0109`. ", "positive_passages": [{"docid": "doc-en-rust-3107a3df464aecec6021315f3fd8cf1c2c1b0097818c5877dba79a2700415494", "text": " $DIR/issue-54505-no-literals.rs:16:16 | LL | take_range(std::ops::Range { start: 0, end: 1 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::Range` | help: consider borrowing here: `&std::ops::Range { start: 0, end: 1 }` | = note: expected type `&_` found type `std::ops::Range<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:21:16 | LL | take_range(::std::ops::Range { start: 0, end: 1 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::Range` | help: consider borrowing here: `&::std::ops::Range { start: 0, end: 1 }` | = note: expected type `&_` found type `std::ops::Range<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:26:16 | LL | take_range(std::ops::RangeFrom { start: 1 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeFrom` | help: consider borrowing here: `&std::ops::RangeFrom { start: 1 }` | = note: expected type `&_` found type `std::ops::RangeFrom<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:31:16 | LL | take_range(::std::ops::RangeFrom { start: 1 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeFrom` | help: consider borrowing here: `&::std::ops::RangeFrom { start: 1 }` | = note: expected type `&_` found type `std::ops::RangeFrom<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:36:16 | LL | take_range(std::ops::RangeFull {}); | ^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeFull` | help: consider borrowing here: `&std::ops::RangeFull {}` | = note: expected type `&_` found type `std::ops::RangeFull` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:41:16 | LL | take_range(::std::ops::RangeFull {}); | ^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeFull` | help: consider borrowing here: `&::std::ops::RangeFull {}` | = note: expected type `&_` found type `std::ops::RangeFull` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:46:16 | LL | take_range(std::ops::RangeInclusive::new(0, 1)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeInclusive` | help: consider borrowing here: `&std::ops::RangeInclusive::new(0, 1)` | = note: expected type `&_` found type `std::ops::RangeInclusive<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:51:16 | LL | take_range(::std::ops::RangeInclusive::new(0, 1)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeInclusive` | help: consider borrowing here: `&::std::ops::RangeInclusive::new(0, 1)` | = note: expected type `&_` found type `std::ops::RangeInclusive<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:56:16 | LL | take_range(std::ops::RangeTo { end: 5 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeTo` | help: consider borrowing here: `&std::ops::RangeTo { end: 5 }` | = note: expected type `&_` found type `std::ops::RangeTo<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:61:16 | LL | take_range(::std::ops::RangeTo { end: 5 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeTo` | help: consider borrowing here: `&::std::ops::RangeTo { end: 5 }` | = note: expected type `&_` found type `std::ops::RangeTo<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:66:16 | LL | take_range(std::ops::RangeToInclusive { end: 5 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeToInclusive` | help: consider borrowing here: `&std::ops::RangeToInclusive { end: 5 }` | = note: expected type `&_` found type `std::ops::RangeToInclusive<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:71:16 | LL | take_range(::std::ops::RangeToInclusive { end: 5 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeToInclusive` | help: consider borrowing here: `&::std::ops::RangeToInclusive { end: 5 }` | = note: expected type `&_` found type `std::ops::RangeToInclusive<{integer}>` error: aborting due to 12 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-91aa829566a5df7a09c8791c153248e9d3fbd45e1b398560fdad1754e8b5f6f6", "query": " error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:16:16 | LL | take_range(std::ops::Range { start: 0, end: 1 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::Range` | help: consider borrowing here: `&std::ops::Range { start: 0, end: 1 }` | = note: expected type `&_` found type `std::ops::Range<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:21:16 | LL | take_range(::std::ops::Range { start: 0, end: 1 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::Range` | help: consider borrowing here: `&::std::ops::Range { start: 0, end: 1 }` | = note: expected type `&_` found type `std::ops::Range<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:26:16 | LL | take_range(std::ops::RangeFrom { start: 1 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeFrom` | help: consider borrowing here: `&std::ops::RangeFrom { start: 1 }` | = note: expected type `&_` found type `std::ops::RangeFrom<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:31:16 | LL | take_range(::std::ops::RangeFrom { start: 1 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeFrom` | help: consider borrowing here: `&::std::ops::RangeFrom { start: 1 }` | = note: expected type `&_` found type `std::ops::RangeFrom<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:36:16 | LL | take_range(std::ops::RangeFull {}); | ^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeFull` | help: consider borrowing here: `&std::ops::RangeFull {}` | = note: expected type `&_` found type `std::ops::RangeFull` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:41:16 | LL | take_range(::std::ops::RangeFull {}); | ^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeFull` | help: consider borrowing here: `&::std::ops::RangeFull {}` | = note: expected type `&_` found type `std::ops::RangeFull` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:46:16 | LL | take_range(std::ops::RangeInclusive::new(0, 1)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeInclusive` | help: consider borrowing here: `&std::ops::RangeInclusive::new(0, 1)` | = note: expected type `&_` found type `std::ops::RangeInclusive<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:51:16 | LL | take_range(::std::ops::RangeInclusive::new(0, 1)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeInclusive` | help: consider borrowing here: `&::std::ops::RangeInclusive::new(0, 1)` | = note: expected type `&_` found type `std::ops::RangeInclusive<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:56:16 | LL | take_range(std::ops::RangeTo { end: 5 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeTo` | help: consider borrowing here: `&std::ops::RangeTo { end: 5 }` | = note: expected type `&_` found type `std::ops::RangeTo<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:61:16 | LL | take_range(::std::ops::RangeTo { end: 5 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeTo` | help: consider borrowing here: `&::std::ops::RangeTo { end: 5 }` | = note: expected type `&_` found type `std::ops::RangeTo<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:66:16 | LL | take_range(std::ops::RangeToInclusive { end: 5 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeToInclusive` | help: consider borrowing here: `&std::ops::RangeToInclusive { end: 5 }` | = note: expected type `&_` found type `std::ops::RangeToInclusive<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:71:16 | LL | take_range(::std::ops::RangeToInclusive { end: 5 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeToInclusive` | help: consider borrowing here: `&::std::ops::RangeToInclusive { end: 5 }` | = note: expected type `&_` found type `std::ops::RangeToInclusive<{integer}>` error: aborting due to 12 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-91aa829566a5df7a09c8791c153248e9d3fbd45e1b398560fdad1754e8b5f6f6", "query": " error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:16:16 | LL | take_range(std::ops::Range { start: 0, end: 1 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::Range` | help: consider borrowing here: `&std::ops::Range { start: 0, end: 1 }` | = note: expected type `&_` found type `std::ops::Range<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:21:16 | LL | take_range(::std::ops::Range { start: 0, end: 1 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::Range` | help: consider borrowing here: `&::std::ops::Range { start: 0, end: 1 }` | = note: expected type `&_` found type `std::ops::Range<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:26:16 | LL | take_range(std::ops::RangeFrom { start: 1 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeFrom` | help: consider borrowing here: `&std::ops::RangeFrom { start: 1 }` | = note: expected type `&_` found type `std::ops::RangeFrom<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:31:16 | LL | take_range(::std::ops::RangeFrom { start: 1 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeFrom` | help: consider borrowing here: `&::std::ops::RangeFrom { start: 1 }` | = note: expected type `&_` found type `std::ops::RangeFrom<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:36:16 | LL | take_range(std::ops::RangeFull {}); | ^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeFull` | help: consider borrowing here: `&std::ops::RangeFull {}` | = note: expected type `&_` found type `std::ops::RangeFull` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:41:16 | LL | take_range(::std::ops::RangeFull {}); | ^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeFull` | help: consider borrowing here: `&::std::ops::RangeFull {}` | = note: expected type `&_` found type `std::ops::RangeFull` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:46:16 | LL | take_range(std::ops::RangeInclusive::new(0, 1)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeInclusive` | help: consider borrowing here: `&std::ops::RangeInclusive::new(0, 1)` | = note: expected type `&_` found type `std::ops::RangeInclusive<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:51:16 | LL | take_range(::std::ops::RangeInclusive::new(0, 1)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeInclusive` | help: consider borrowing here: `&::std::ops::RangeInclusive::new(0, 1)` | = note: expected type `&_` found type `std::ops::RangeInclusive<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:56:16 | LL | take_range(std::ops::RangeTo { end: 5 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeTo` | help: consider borrowing here: `&std::ops::RangeTo { end: 5 }` | = note: expected type `&_` found type `std::ops::RangeTo<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:61:16 | LL | take_range(::std::ops::RangeTo { end: 5 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeTo` | help: consider borrowing here: `&::std::ops::RangeTo { end: 5 }` | = note: expected type `&_` found type `std::ops::RangeTo<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:66:16 | LL | take_range(std::ops::RangeToInclusive { end: 5 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeToInclusive` | help: consider borrowing here: `&std::ops::RangeToInclusive { end: 5 }` | = note: expected type `&_` found type `std::ops::RangeToInclusive<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:71:16 | LL | take_range(::std::ops::RangeToInclusive { end: 5 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeToInclusive` | help: consider borrowing here: `&::std::ops::RangeToInclusive { end: 5 }` | = note: expected type `&_` found type `std::ops::RangeToInclusive<{integer}>` error: aborting due to 12 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-91aa829566a5df7a09c8791c153248e9d3fbd45e1b398560fdad1754e8b5f6f6", "query": " error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:16:16 | LL | take_range(std::ops::Range { start: 0, end: 1 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::Range` | help: consider borrowing here: `&std::ops::Range { start: 0, end: 1 }` | = note: expected type `&_` found type `std::ops::Range<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:21:16 | LL | take_range(::std::ops::Range { start: 0, end: 1 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::Range` | help: consider borrowing here: `&::std::ops::Range { start: 0, end: 1 }` | = note: expected type `&_` found type `std::ops::Range<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:26:16 | LL | take_range(std::ops::RangeFrom { start: 1 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeFrom` | help: consider borrowing here: `&std::ops::RangeFrom { start: 1 }` | = note: expected type `&_` found type `std::ops::RangeFrom<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:31:16 | LL | take_range(::std::ops::RangeFrom { start: 1 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeFrom` | help: consider borrowing here: `&::std::ops::RangeFrom { start: 1 }` | = note: expected type `&_` found type `std::ops::RangeFrom<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:36:16 | LL | take_range(std::ops::RangeFull {}); | ^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeFull` | help: consider borrowing here: `&std::ops::RangeFull {}` | = note: expected type `&_` found type `std::ops::RangeFull` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:41:16 | LL | take_range(::std::ops::RangeFull {}); | ^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeFull` | help: consider borrowing here: `&::std::ops::RangeFull {}` | = note: expected type `&_` found type `std::ops::RangeFull` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:46:16 | LL | take_range(std::ops::RangeInclusive::new(0, 1)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeInclusive` | help: consider borrowing here: `&std::ops::RangeInclusive::new(0, 1)` | = note: expected type `&_` found type `std::ops::RangeInclusive<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:51:16 | LL | take_range(::std::ops::RangeInclusive::new(0, 1)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeInclusive` | help: consider borrowing here: `&::std::ops::RangeInclusive::new(0, 1)` | = note: expected type `&_` found type `std::ops::RangeInclusive<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:56:16 | LL | take_range(std::ops::RangeTo { end: 5 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeTo` | help: consider borrowing here: `&std::ops::RangeTo { end: 5 }` | = note: expected type `&_` found type `std::ops::RangeTo<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:61:16 | LL | take_range(::std::ops::RangeTo { end: 5 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeTo` | help: consider borrowing here: `&::std::ops::RangeTo { end: 5 }` | = note: expected type `&_` found type `std::ops::RangeTo<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:66:16 | LL | take_range(std::ops::RangeToInclusive { end: 5 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeToInclusive` | help: consider borrowing here: `&std::ops::RangeToInclusive { end: 5 }` | = note: expected type `&_` found type `std::ops::RangeToInclusive<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:71:16 | LL | take_range(::std::ops::RangeToInclusive { end: 5 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected reference, found struct `std::ops::RangeToInclusive` | help: consider borrowing here: `&::std::ops::RangeToInclusive { end: 5 }` | = note: expected type `&_` found type `std::ops::RangeToInclusive<{integer}>` error: aborting due to 12 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-91ba0238ac8f072352cbcf02e572b73514c3e418a877465ebb5fd35022beea27", "query": "// integer literal, push to vector expression ast::LitIntUnsuffixed(v) => { if v > 0xFF { cx.span_err(expr.span, \"too large integer literal in bytes!\") cx.span_err(expr.span, \"too large integer literal in bytes!\"); err = true; } else if v < 0 { cx.span_err(expr.span, \"negative integer literal in bytes!\") cx.span_err(expr.span, \"negative integer literal in bytes!\"); err = true; } else { bytes.push(cx.expr_u8(expr.span, v as u8)); }", "positive_passages": [{"docid": "doc-en-rust-e642ac159a69de10d3b0a6ba42d5ac2a7a78c6f62769cbcf28b388c06bd59f8d", "text": "With landed, the lifetime of is now problematic. Specifically, the following used to work and now fails: The lifetime of is now limited to that branch of the match, so it doesn't live long enough to be assigned to . I'm not sure if this means lifetimes need to change. The other option is that needs to return a . Unfortunately, the only way to do that right now is to make it equivalent to , which makes it no longer usable as the value of a constant (e.g. ). I'm thinking the right solution is to make it legal for me to say . I can type that right now, but the lifetime seems to be wholly ignored, as I get the exact same error with the following as I do with the example above: If becomes a valid expression with the lifetime, then could start evaluating to that and everything should work as expected. Furthermore, it would be nice (but perhaps not required) if , where all elements are compile-time constants, would implicitly be given the lifetime.\n/cc\nYeah, this is kind of annoying. I worked around it in one specific case by having bytes! expand as follows: I certainly think one should be allowed to write a concrete lifetime as part of a slice or borrow expression, and ought to be legal -- we'll obviously have to impose more stringent constant-related rules. In the short term, we could adjust to expand in the pattern I showed above. What was unclear to me was whether this is sufficient workaround, or whether we'll want something more general. Interestingly, even if we used full inference, the expression you gave above would be illegal unless we introduce a special case for static byte strings, because it generates a conditional temporary (only on one arm of the match) and we can't handle the cleanup for such a case without zeroing, which we plan to remove (well, I guess we could also have a special case for temporary types [like ) that do not require drop glue, but I'd rather not).\nPerhaps the simplest fix for now is to adjust the macro itself to expand to a static item as I showed. I should probably have done that more generally but I was ready to land that expletive branch already.\nWon't that prevent from being able to expand to a static?\nI already adjusted like that and is correct, it prevents , which is definitely already used in our codebase.\nAh, unfortunate.", "commid": "rust_issue_11641", "tokennum": 503}], "negative_passages": []} {"query_id": "q-en-rust-91ba0238ac8f072352cbcf02e572b73514c3e418a877465ebb5fd35022beea27", "query": "// integer literal, push to vector expression ast::LitIntUnsuffixed(v) => { if v > 0xFF { cx.span_err(expr.span, \"too large integer literal in bytes!\") cx.span_err(expr.span, \"too large integer literal in bytes!\"); err = true; } else if v < 0 { cx.span_err(expr.span, \"negative integer literal in bytes!\") cx.span_err(expr.span, \"negative integer literal in bytes!\"); err = true; } else { bytes.push(cx.expr_u8(expr.span, v as u8)); }", "positive_passages": [{"docid": "doc-en-rust-780e36a0375361995054b8b4bf9ea85ff24fac4cdeaa8770698d8cf14535f4eb", "text": "(I actually think we should allow statics to include nested blocks with other statics, but I guess that's a separate bug) Well, I'm not sure what's the easiest fix in that case, I guess just to fix the semantics of so that it guarantees static data. I'm not 100% sure what's implied by such a fix: it doesn't seem too hard ;)\ncc", "commid": "rust_issue_11641", "tokennum": 87}], "negative_passages": []} {"query_id": "q-en-rust-91d43e519bb70232a9c66e0f10be65340214e8f71313aca1acb7af02afd76973", "query": " #![feature(const_generics)] #![allow(incomplete_features)] struct Test(); fn pass() { println!(\"Hello, world!\"); } impl Test { pub fn call_me(&self) { self.test::(); } fn test(&self) { //~^ ERROR: using function pointers as const generic parameters is forbidden FN(); } } fn main() { let x = Test(); x.call_me() } ", "positive_passages": [{"docid": "doc-en-rust-a975a546d53264829fbcc437898c1ae3226bbbd3547a5a7709fc6837f8ad5556", "text": "I've tried reducing this but wasn't really able to so far. I might try again some other time. The code below currently ICEs on Nightly (). When trying to reproduce locally for the backtrace, I had an older Nightly first () where this actually didn't crash the compiler, so it's apparently a regression. #![feature(const_generics)] #![allow(incomplete_features)] struct Test(); fn pass() { println!(\"Hello, world!\"); } impl Test { pub fn call_me(&self) { self.test::(); } fn test(&self) { //~^ ERROR: using function pointers as const generic parameters is forbidden FN(); } } fn main() { let x = Test(); x.call_me() } ", "positive_passages": [{"docid": "doc-en-rust-a37ceb899c17630c43d86268d2c334b49b32d8976e739ff8c5d02feada9c138d", "text": "produces: #![feature(const_generics)] #![allow(incomplete_features)] struct Test(); fn pass() { println!(\"Hello, world!\"); } impl Test { pub fn call_me(&self) { self.test::(); } fn test(&self) { //~^ ERROR: using function pointers as const generic parameters is forbidden FN(); } } fn main() { let x = Test(); x.call_me() } ", "positive_passages": [{"docid": "doc-en-rust-0083199d2d30907886ae35c5244f2ed3a9c47d95ba1b1870716f3c7161cbdaa4", "text": " $DIR/issue-30906.rs:15:5 | LL | test(Compose(f, |_| {})); | ^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error ", "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: higher-ranked subtype error --> $DIR/issue-30906.rs:15:5 | LL | test(Compose(f, |_| {})); | ^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error ", "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: higher-ranked subtype error --> $DIR/issue-30906.rs:15:5 | LL | test(Compose(f, |_| {})); | ^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error ", "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-91fafe4d8cc460d6251b6cce7170730fc39973b496dcfc2f2c9fb51358485859", "query": " error: higher-ranked subtype error --> $DIR/issue-30906.rs:15:5 | LL | test(Compose(f, |_| {})); | ^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error ", "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-9209545df817adc4498e8d770b3c1796f12288c85bdc59535fa948369a0073fb", "query": "fn expect_aborted(status: ExitStatus) { dbg!(status); let signal = status.signal().expect(\"expected child process to die of signal\"); #[cfg(not(target_os = \"android\"))] assert!(signal == libc::SIGABRT || signal == libc::SIGILL || signal == libc::SIGTRAP); #[cfg(target_os = \"android\")] { // Android signals an abort() call with SIGSEGV at address 0xdeadbaad // See e.g. https://groups.google.com/g/android-ndk/c/laW1CJc7Icc assert!(signal == libc::SIGSEGV); // Additional checks performed: // 1. Find last tombstone (similar to coredump but in text format) from the // same executable (path) as we are (must be because of usage of fork): // This ensures that we look into the correct tombstone. // 2. Cause of crash is a SIGSEGV with address 0xdeadbaad. // 3. libc::abort call is in one of top two functions on callstack. // The last two steps distinguish between a normal SIGSEGV and one caused // by libc::abort. let this_exe = std::env::current_exe().unwrap().into_os_string().into_string().unwrap(); let exe_string = format!(\">>> {this_exe} <<<\"); let tombstone = (0..100) .map(|n| format!(\"/data/tombstones/tombstone_{n:02}\")) .filter(|f| std::path::Path::new(&f).exists()) .map(|f| std::fs::read_to_string(&f).expect(\"Cannot read tombstone file\")) .filter(|f| f.contains(&exe_string)) .last() .expect(\"no tombstone found\"); println!(\"Content of tombstone:n{tombstone}\"); assert!( tombstone.contains(\"signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad\") ); let abort_on_top = tombstone .lines() .skip_while(|l| !l.contains(\"backtrace:\")) .skip(1) .take_while(|l| l.starts_with(\" #\")) .take(2) .any(|f| f.contains(\"/system/lib/libc.so (abort\")); assert!(abort_on_top); } } fn main() {", "positive_passages": [{"docid": "doc-en-rust-a61bc9acde35d215dd7da4308b3b2641c1b9cd2893b91e2d83f7f3b178a2321e", "text": " $DIR/issue-80816.rs:49:38 | LL | let guard: Guard> = s.load(); | ^^^^ | note: multiple `impl`s satisfying `ArcSwapAny>: Access<_>` found --> $DIR/issue-80816.rs:35:1 | LL | impl Access for ArcSwapAny { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | impl Access for ArcSwapAny> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: required for `Arc>>` to implement `Access<_>` --> $DIR/issue-80816.rs:31:45 | LL | impl, P: Deref> Access for P { | ^^^^^^^^^ ^ help: try using a fully qualified path to specify the expected types | LL | let guard: Guard> = >> as Access>::load(&s); | ++++++++++++++++++++++++++++++++++++++++++++++++++ ~ error: aborting due to previous error For more information about this error, try `rustc --explain E0283`. ", "positive_passages": [{"docid": "doc-en-rust-02fc59af843eda601d85d434d1c943cc23d5ebd07ab0da471f77b1ab20221892", "text": "A code attached below used to compile with rustc 1.48 (stable) and stopped to work with 1.49 (stable). Two thing help to make the code compile: 1) comment out 2) explicitly deref . To compile code below one need to add to dependencies. Maybe this is due to some conflict between ArcSwap instance method and Access load method? I tried this code: I expected to see this happen: It should compile properly (it worked with rustc version 1.48 and earlier versions as well). Instead, this happened: I got compilation error It most recently worked on: Rust 1.48 :\nsearched nightlies: from nightly-2020-10-01 to nightly-2020-11-14 regressed nightly: nightly-2020-10-07 searched commits: from to regressed commit: () #[unstable(feature = \"stdio_locked\", issue = \"none\")] pub use self::stdio::{stderr_locked, stdin_locked, stdout_locked}; #[stable(feature = \"rust1\", since = \"1.0.0\")] pub use self::stdio::{StderrLock, StdinLock, StdoutLock}; #[unstable(feature = \"print_internals\", issue = \"none\")]", "positive_passages": [{"docid": "doc-en-rust-919d7291578a330e3e57e57f37bdaf8fcccfea3acb4ecf407d589ee210776dc0", "text": "Given the following code: The current output is: I think it's typical for a newcomer to want to get a iterator by chaining method calls like . There's no obvious reason why that shouldn't work. The examples in the documentation do typically show being assigned to a variable prior to calling its method, but don't explain why that's necessary. I think the \"borrow\" terminology is misleading, but there might not be a concise way to describe what's actually going on to the user. The \"temporary value is freed at the end of this statement\" is probably correct. The \"creates a temporary which is freed while still in use\" is probably more correctly \"creates a temporary that is required to outlive (or live exactly as long as) the result of...\", followed by a pointer to the method invocation, with text of \" method call\". Maybe it should also point out the lifetime argument in the return type. I tried and failed to find a satisfactory explanation of what exactly was borrowing from the temporary value produced by . When I looked through the library source code, the only references in were those created by locking a , and the in question is static. I'm guessing the existence of a borrow is assumed rather than inferred from analyzing the function body of . The assumption might be the result of the anonymous lifetime argument on the output type from , which imposes a requirement that the doesn't outlive (or has the same lifetime as?) the value that is the receiver of . The correct fix might be to change the locked stdin handles to all use lifetimes, but I will probably file that as a separate issue.\nlabel +A-borrow-checker +A-lifetimes +D-confusing +D-incorrect +D-newcomer-roadblock\nIMO the intent is clear here. Without changing the API, why exactly is Rust unable to lift 'a &'static X to 'static & 'static X, if X also contains only 'static lifetimes? I don't think raw references have a meaningful dropper; borrowck is able to freely resolve any derived lifetimes on impls that don't depend on anything else to 'static; I'm pretty sure under current rules we should be able to substitute latter for earlier and get exactly the same behaviour.\nThis is due to .", "commid": "rust_issue_85383", "tokennum": 488}], "negative_passages": []} {"query_id": "q-en-rust-9294330d50e9d6071d31e5854cd8c09886aadc0a98a24b9ac4692f47f2be3769", "query": "pub use self::stdio::set_output_capture; #[stable(feature = \"rust1\", since = \"1.0.0\")] pub use self::stdio::{stderr, stdin, stdout, Stderr, Stdin, Stdout}; #[unstable(feature = \"stdio_locked\", issue = \"none\")] pub use self::stdio::{stderr_locked, stdin_locked, stdout_locked}; #[stable(feature = \"rust1\", since = \"1.0.0\")] pub use self::stdio::{StderrLock, StdinLock, StdoutLock}; #[unstable(feature = \"print_internals\", issue = \"none\")]", "positive_passages": [{"docid": "doc-en-rust-92ed7d0e7c15657a2bf272a28dd35b3151d7e2967f2e812a66ceafd943af7cb2", "text": "is declared as follows: Because there is only one input lifetime (the elided lifetime of ), it is assigned to the output lifetime , which is why the lock can live at most as long as the temporary.\nThanks. I think this might be a bug in libstd (using instead of as the return type), but I'll file that separately. What I think is a diagnostic inaccuracy is that the error message refers to a borrow, when, by inspection of the library source code, no borrow is taking place in . (Unless I'm missing something?) What I think is happening is that the compiler is enforcing that lives no longer than the temporary produced by , and is misleadingly calling that a borrow in the error message.\nAs a simplified example: The error message refers to a borrow even when the output type of does not refer to at all!\nthat's because of the elision rules: on the declaration you're implicitly telling the compiler that the lifetime of the borrow matches the lifetime of the type. .\nThanks. I think the error messages could use a little more detail about how something that the borrow checker sees as a borrow may be an artifact of lifetime constraints in a function signature rather than an actual borrow in the function body. It certainly surprised me the first time I ran into it. (Maybe only in the explanatory text in the compiler error index. It looks like E0597 could also benefit from that detail, because it's a similar case, and an example in E0716 produces E0597.)\nShorter example, probably better suited for an example in the compiler error index:", "commid": "rust_issue_85383", "tokennum": 341}], "negative_passages": []} {"query_id": "q-en-rust-92bd9ec64ed9cf0d974a62463fd8b79eb4a5f99402ea96a3633f0d0f02979804", "query": "} } } hir::ItemKind::Macro(ref macro_def) => { self.update_reachability_from_macro(item.def_id, macro_def); } // Visit everything, but foreign items have their own levels. hir::ItemKind::ForeignMod { items, .. } => { for foreign_item in items {", "positive_passages": [{"docid": "doc-en-rust-12986e5abee77ce3b20a0cf776214e22d4434ee35686f35e800971b37babe538", "text": "EDIT (ehuss) Reproduction: Clone $DIR/issue_114151.rs:17:5 | LL | foo::<_, L>([(); L + 1 + L]); | ^^^^^^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 6 previous errors Some errors have detailed explanations: E0107, E0308. For more information about an error, try `rustc --explain E0107`.", "positive_passages": [{"docid": "doc-en-rust-d5576f8d7976b1c3d2afa688f8e793694cfa801b3df656c8cabdd73b517ddb80", "text": "we should change the following function to use a instead of Using a walker causes the control-flow to be a lot more complicated and given that this code is soundness-critical, we should make sure it's as easy to understand as possible $DIR/select-param-env-instead-of-blanket.rs:42:5 | LL | let mut x: >::Item = bar::(); | ---------- in this inlined function call ... LL | 0usize | ^^^^^^ | = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:128:36 thread 'rustc' panicked ", "positive_passages": [{"docid": "doc-en-rust-71b0b3759ab65d55872300b2e31707587c6b35ae4ebfcbc7b4efe6636becb2c5", "text": " $DIR/select-param-env-instead-of-blanket.rs:42:5 | LL | let mut x: >::Item = bar::(); | ---------- in this inlined function call ... LL | 0usize | ^^^^^^ | = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:128:36 thread 'rustc' panicked ", "positive_passages": [{"docid": "doc-en-rust-a8b029a36602d18e3fb8ab0b41dc038be269fc325df3a806dbc2e3afd13dda42", "text": "Trying to emulate trivial bounds via generics & associated types panics on stable, beta and nightly. $DIR/unifying-placeholders-in-query-response-2.rs:5:12 | LL | #![feature(non_lifetime_binders)] | ^^^^^^^^^^^^^^^^^^^^ | = note: see issue #108185 for more information = note: `#[warn(incomplete_features)]` on by default warning: 1 warning emitted ", "positive_passages": [{"docid": "doc-en-rust-f5c636b611929ec75d7a05ab22a7bfded1c97c281d9da839db84e3da33564860", "text": " $DIR/argument_number_mismatch_ice.rs:8:5 | LL | fn example(val: ()); | -------------------- trait method declared without `&self` ... LL | fn example(&self, input: &i32) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&self` used in impl error[E0594]: cannot assign to `*input`, which is behind a `&` reference --> $DIR/argument_number_mismatch_ice.rs:10:9 | LL | *input = self.0; | ^^^^^^^^^^^^^^^ `input` is a `&` reference, so the data it refers to cannot be written error: aborting due to 2 previous errors Some errors have detailed explanations: E0185, E0594. For more information about an error, try `rustc --explain E0185`. ", "positive_passages": [{"docid": "doc-en-rust-4bf5f8d2ef5417a14a40f563aba63558639ebd746623d7c5fb08fb136da5bdff", "text": " $DIR/test-compile-fail2.rs:3:1 | 3 | fail | ^^^^ expected one of `!` or `::` error: aborting due to previous error ", "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-a0351748c9cbf73d77aeccbb984243628302e70247d814c6850fe281764deec1", "query": " error: expected one of `!` or `::`, found `` --> $DIR/test-compile-fail2.rs:3:1 | 3 | fail | ^^^^ expected one of `!` or `::` error: aborting due to previous error ", "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-a04376a1f97b3f4d17a60a41d76f50be034dedd773e47ee7a991ac377c13ff07", "query": "assert_eq!(nread, 1); assert_eq!(buf[0], 99); } Err(..) => fail!() Err(..) => fail!(), } } Err(..) => fail!()", "positive_passages": [{"docid": "doc-en-rust-4fd7762e51d720a30de6256cf0910fe9844fb1a4f2217e6c52aacc03855a75cd", "text": "change this to something more appropriate. This was introduced in commit when still returned . This should either block until a message from the correct sender arrives or return an error.", "commid": "rust_issue_18111", "tokennum": 34}], "negative_passages": []} {"query_id": "q-en-rust-a062f7ce3b2b9a7bdac0fb4fef749dd2202138acbf0eade4624a3641b8e67b4c", "query": "false } } fn ignore_llvm(config: &Config, line: &str) -> bool { if let Some(ref actual_version) = config.llvm_version { if line.contains(\"min-llvm-version\") { let min_version = line.trim() .split(' ') .last() .expect(\"Malformed llvm version directive\"); // Ignore if actual version is smaller the minimum required // version &actual_version[..] < min_version } else { false } } else { false } } } }", "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-a091d78f815bb06de57744cdfa326e57cfaf6f8c8a33a01a5707afbaea99d807", "query": "// resolve Self::Foo, at the moment we can't resolve the former because // we don't have the trait information around, which is just sad. if !base_segments.is_empty() { let id_node = tcx.map.as_local_node_id(id).unwrap(); span_err!(tcx.sess, span, E0247, \"found module name used as a type: {}\", tcx.map.node_to_user_string(id_node)); return this.tcx().types.err; } assert!(base_segments.is_empty()); opt_self_ty.expect(\"missing T in ::a::b::c\") }", "positive_passages": [{"docid": "doc-en-rust-8b39ad656a607f3b3bd21f65530e4e486279bb1e38914d8a859cfe66b5c33a86", "text": "rustc crashes when compiling the following source code. I expect this to compile or report error. Instead the compiler crashed.\nReduced testcase:\nThis also causes an ICE with the latest nightly:\nAny update on the issue. Please let me know if you need more information. Thanks", "commid": "rust_issue_30535", "tokennum": 56}], "negative_passages": []} {"query_id": "q-en-rust-a0df95f6c0155d1f330f444e6806b5c0ea06795206b068bd61f0d3707a12ce86", "query": "use back::svh::Svh; use session::{config, Session}; use session::search_paths::PathKind; use metadata::common::rustc_version; use metadata::cstore; use metadata::cstore::{CStore, CrateSource, MetadataBlob}; use metadata::decoder;", "positive_passages": [{"docid": "doc-en-rust-165546cc6d1664a37fe24db06bf255ae7f919e8684ae20907812cf93b20914b9", "text": "When trying to update uutils/coreutils to HEAD, I got this ICE: Version: code:\napparently, this happens as a side effect of the build process. i had built with stable, then tried to build with nightly, giving incorrect metadata", "commid": "rust_issue_28700", "tokennum": 52}], "negative_passages": []} {"query_id": "q-en-rust-a0e58996ffd8f8577fa88f608132d77e514da3cb89e702eccb49e1446ebad497", "query": "curl -L https://github.com/llvm/llvm-project/archive/$LLVM.tar.gz | tar xzf - --strip-components=1 yum install -y patch patch -Np1 < ../llvm-project-centos.patch mkdir clang-build cd clang-build", "positive_passages": [{"docid": "doc-en-rust-f4ed9e3f1d2d7ae852d8255d7e891270d3b1745dcfd72417e2a2b98bdaa449dd", "text": "The docs currently claim that the minimum Linux kernel version for is 2.6.18 (released September 20th, 2006). This is because RHEL 5 used that kernel version. However, RHEL 5 entered ELS on March 31, 2017. Should we continue to support RHEL 5 for , or should we increase the minimum Linux Kernel version to 2.6.27 (2nd LTS) or 2.6.32 (RHEL 6, 3rd LTS)? . Even bumping the min-version to 2.6.27 would allow us to remove most of the Linux-specific hacks in . Example: .\nGiven that RHEL is the only reason we keep comically old kernel versions around, I would propose that Rust only support RHEL until Maintenance Support ends. This is (essentially) what we already did for RHEL 4. Rust never supported RHEL 4, and back when RHEL 5 still had maintenance support. It would be nice to get someone from Red Hat or a RHEL customer to comment. This policy would allow us to increment the minimum kernel from 2.6.18 to 2.6.32 (and remove a lot of Linux-specific hacks). Note that RHEL has a weird (and very long) support system for RHEL 4, 5, and 6 (sources: and ). It has 5 major steps: Full Support Normal support of the OS Maintenance Support 1 Bug/Security fixes Limited hardware refresh Maintenance Support 2 Bug/Security fixes The end of this phase is considered \"Product retirement\" Extended Life Cycle Support (ELS) Additional paid product from Red Hat Gives updates for a longer period of time No additional releases/images Extended Life Phase (ELP) No more updates Limited Technical Support End date not given by Red Hat Current status of RHEL versions: RHEL 4 Not supported by Rust Currently in ELP (no end date specified) ELS ended March 31, 2017 RHEL 5 Supported by Rust Currently in ELS Maintenance Support ended March 31, 2017 ELS ends November 30, 2020 RHEL 6 Supported by Rust Currently in Maintenance Support 2 Maintenance Support ends November 30, 2020\ncc which I think they could be related.", "commid": "rust_issue_62516", "tokennum": 449}], "negative_passages": []} {"query_id": "q-en-rust-a0e58996ffd8f8577fa88f608132d77e514da3cb89e702eccb49e1446ebad497", "query": "curl -L https://github.com/llvm/llvm-project/archive/$LLVM.tar.gz | tar xzf - --strip-components=1 yum install -y patch patch -Np1 < ../llvm-project-centos.patch mkdir clang-build cd clang-build", "positive_passages": [{"docid": "doc-en-rust-c658707ba1f511004a82a078aaea5dda93c2219b3ffe958dfb8644db8e29ef0c", "text": "It also may be worth to drop support of Windows XP and Vista (especially considering that panics are broken on XP since June 2016, see: ). Previously it was discussed . cc\nBesides , which other things would we be able to clean up?\nGood question! There are 6 workarounds in for older Linux versions (that I could find). Increasing the minimum version to 2.6.32 (aka 3rd Kernel LTS, aka RHEL 6) would fix 5 of them. Code links are inline: (mentioned above, in 2.6.23) ( in 2.6.24, there is also the mention of a bug occuring on \"some linux kernel at some point\") to atomically set the flag on the pipe fds ( in 2.6.27) ( in 2.6.27) to permit use of ( in 2.6.28) ( in 4.5, not fixed by this proposal) As you can see, the workarounds fixed by this proposal all have a similar flavor.\nI am Red Hat's maintainer for Rust on RHEL -- thanks for the cc. I try to keep an eye on new issues, but this one slipped past me. Red Hat only ships the Rust toolchain to customers for RHEL 7 and RHEL 8. If our customers would like to use Rust on older RHEL, they can do so via , and we'll support them in the same way we would for any other third-party software. Internally we do also build and use on RHEL 6, mostly because it's needed to ship Firefox updates. This is where it gets a little hairy, because each RHEL N is bootstrapped on RHEL N-1 and often kept that way -- meaning a lot of our RHEL 6 builders are still running on a RHEL 5 kernel. I would have to apply local workarounds if upstream Rust loses the ability to run on 2.6.18 kernels. We prefer to keep fixes upstream as much as possible, both for open sharing and to avoid bitrot. Is there much of a benefit to removing the current workarounds? I agree all of that code is annoying and cumbersome, but it's already written, and as far as I know it hasn't been a maintenance burden. Do you see otherwise?", "commid": "rust_issue_62516", "tokennum": 486}], "negative_passages": []} {"query_id": "q-en-rust-a0e58996ffd8f8577fa88f608132d77e514da3cb89e702eccb49e1446ebad497", "query": "curl -L https://github.com/llvm/llvm-project/archive/$LLVM.tar.gz | tar xzf - --strip-components=1 yum install -y patch patch -Np1 < ../llvm-project-centos.patch mkdir clang-build cd clang-build", "positive_passages": [{"docid": "doc-en-rust-af4898c3fb7c61e2eba3dec9f4b6ba76545c9cefd16e60e4bb5d1131f91cb434", "text": "If there are any known issues with such Linux compatibility code, I am definitely willing to take assignment for fixing them.\n(Not a Rust maintainer, but I'm a Rust user and maintain a lot of other OSS software so I have well-developed feelings around supporting Very Old Software :-)) Do you have any sense of on what timeline Rust would be able to drop support for 2.6.18 kernels without causing you pain? In general I don't think people mind supporting configurations that have users and are painful to work around, but needing to support them for forever is a bitter pill to swallow! Particularly as they get harder and harder to test over time (already I have no idea how to test on really old kernels besides building it myself). So if there was an estimate \"we'd like to be able to support this until Q2 2020\", even if it's not set in stone, I think that would be very helpful!\nThe other benefit would be that Rust wouldn't have to use CentOS 5 for CI, which means we don't have to patch LLVM (and Emscripten LLVM) to compile on those systems. Of course that's also fairly limited in scope.\nAs soon as we stop shipping Firefox and Thunderbird updates on RHEL 6, I won't need Rust there anymore. AFAIK this does correspond to the end of Maintenance Support, November 30, 2020. Then I'll be on to RHEL 7 builders as my minimum, probably still with some RHEL 6 2.6.32 kernels involved. It should be fine for me if we update CI to CentOS 6. This is mostly concerned with how the release binaries are linked to GLIBC symbol versions, which is all in userspace. It's a broader community question whether any other Rust users still care about running on RHEL or CentOS 5. (Small caveat - glibc support for a symbol can still return , .)\nI noticed that Red Hat also has Extended Life Cycle Support (ELS) for RHEL 6 until June 30, 2024. Will you need RHEL 5 to work during this time? I don't know how ELS works with Firefox updates. Also, is there any reason RHEL 4 support wasn't an issue prior to March 31, 2017 (while RHEL 5 was still normally supported)?", "commid": "rust_issue_62516", "tokennum": 500}], "negative_passages": []} {"query_id": "q-en-rust-a0e58996ffd8f8577fa88f608132d77e514da3cb89e702eccb49e1446ebad497", "query": "curl -L https://github.com/llvm/llvm-project/archive/$LLVM.tar.gz | tar xzf - --strip-components=1 yum install -y patch patch -Np1 < ../llvm-project-centos.patch mkdir clang-build cd clang-build", "positive_passages": [{"docid": "doc-en-rust-934ec82e8629c1a4b0aa4c30514ddf0d4797bd4b016aa76dfff917479da3a145", "text": "This issue came up for me when dealing with opening files in , see for more info. No single RHEL 5 issue is that bad, it's mainly just the sum of a bunch of tiny issues.\nI'm not on that team, but AFAIK we don't ship Firefox updates for ELS. The last build I see for RHEL 5 was . Maybe there could be an exception for a severe security issue, but I really doubt we'd rebase to newer Firefox for that, which means Rust requirements won't change. New Firefox ESR versions do require a newer Rust toolchain too, which is generally why we have to keep up. Otherwise we could just freeze some older compat rustc while upstream moves on. Rust wasn't required until Firefox 52.\nthat makes perfect sense to me, thanks for clarifying. So the proposed policy would be: Support RHEL until RHEL is retired (i.e. ends normal support). This would mean: Supporting RHEL 5 (v2.6.18) until November 30, 2020 Supporting RHEL 6 (v2.6.32) until June 30, 2024 Supporting RHEL 7 (v3.10) until May, 2029 This is a much longer support tail than any other Linux distros (that I know of), so it would also be the effective minimum kernel version of , , and their dependencies. How does that sound to people? EDIT: The alternative to this would be Support RHEL until it is retired, taking the table above and incrementing the RHEL versions by 1. It would also mean being able to drop RHEL 5 support now.\nSure, that's ideal for me. :smile: As mentioned, is just needed for kernel support, as far as I'm concerned. Userspace concerns like GLIBC symbol versions can stick to currently supported for my needs.\nRed Hat should backport the features we need (CLOEXEC and getrandom, in particular) to whatever kernels that it wants Rust to support. I don't know any good reason why they don't do so, other than it's cheaper to convince the whole world to keep supporting older kernel versions than it is to do the backports. We should change that dynamic.", "commid": "rust_issue_62516", "tokennum": 482}], "negative_passages": []} {"query_id": "q-en-rust-a0e58996ffd8f8577fa88f608132d77e514da3cb89e702eccb49e1446ebad497", "query": "curl -L https://github.com/llvm/llvm-project/archive/$LLVM.tar.gz | tar xzf - --strip-components=1 yum install -y patch patch -Np1 < ../llvm-project-centos.patch mkdir clang-build cd clang-build", "positive_passages": [{"docid": "doc-en-rust-eeb84d19a31c33242b4b2207158242f97ffc0b5ae779e20d04d3166e3dda00c1", "text": "The alternative to this would be Support RHEL N until it is retired I think we should not officially support retired OS versions (well, maybe with some grace period), so I prefer this option. Supporting 14 year old kernels seems a bit too much to me. each RHEL N is bootstrapped on RHEL N-1 and often kept that way -- meaning a lot of our RHEL 6 builders are still running on a RHEL 5 kernel Is it possible to apply kernel patches to those builders to add support for functionality like CLOEXEC? Or build Firefox separately on RHEL 6?\nI think it won't be fruitful for us to debate the merits of stable enterprise kernels, but no, this is not a possibility. An alternative take is \"Red Hat should be responsible for the work in Rust to maintain the support they want\" -- here I am, ready and willing. I definitely can't change those kernels. The ones that are stuck on N-1 are precisely to avoid rocking the boat, and backporting features is a big change. Some of our arches do eventually update the builders to their matching N kernel, but some don't, and I don't know all the reasons. If the workarounds are removed, then I will have to reapply them in our own builds. This assumes I keep using only our own binaries -- if I ever have to re-bootstrap from upstream binaries for stage0, I would also have to use some interception (like ) to hack in the workarounds. This is all possible, but much worse than the status quo of maintaining support here.\nI think this sounds reasonable. We aren't going to be able to update these kernels, it's just a question of when we would drop support for these OSes. Especially given that we wont need RHEL 5 CI support, I think that leaving things as they are is fine. I opened this issue to verify two things: 1) That we weren't intending on supporting RHEL 5 \"forever\", and had a clear date when to drop support. 2) That someone from Red Hat actively cared about supporting these older kernels. It looks like both these things are true. We should remove RHEL 5 workarounds after November 30, 2020. This issue can be postponed until then.", "commid": "rust_issue_62516", "tokennum": 488}], "negative_passages": []} {"query_id": "q-en-rust-a0e58996ffd8f8577fa88f608132d77e514da3cb89e702eccb49e1446ebad497", "query": "curl -L https://github.com/llvm/llvm-project/archive/$LLVM.tar.gz | tar xzf - --strip-components=1 yum install -y patch patch -Np1 < ../llvm-project-centos.patch mkdir clang-build cd clang-build", "positive_passages": [{"docid": "doc-en-rust-98814f154707157dfd52e3b214f0d6bd01f03740b261398ed8ea1f98921871ca", "text": "EDIT: For our use case in , we were able to add compatibility for RHEL 5 .\nSee for a recent case where supporting such ancient kernels required extra manual work ( to the 2 lines mentioned by above). I am not sure how often that comes up, but probably the hardest part is to even notice that it happens -- and even then those codepaths will likely linger untested.\nYes, but this will still be true in general. If the CI kernel is newer than whatever kernel baseline we choose, it will be possible for newer syscalls to pass undetected. I don't know if we have any control over that -- can we choose a particular VM image? So that leaves us with a stated policy of support. The more that developers are aware of such issues, the better, but I'm the one most likely to notice when my build actually fails. If I come back with a fix, I at least need the project to be receptive. I haven't been in the habit of building nightly on our RHEL6 builders, but maybe I should! Catching this early is better for everyone involved...\nThat seems reasonable. How quick is the Rust related bootstrapping? Could it be run automatically (or more frequently)? This is an interesting point. If I hadn't made that change, would have kept working on RHEL 5, it just would have leaked an FD. I'm not sure how we would even test for this sort of thing. This isn't a RHEL 5 specific concern, I just don't know how Rust tests these types of resource leak issues in general.\nAbout 2 hours. Automation is harder, since I believe our build system needs my credentials, but I'll look into what is possible here. Yeah, that's a lot more subtle than an !", "commid": "rust_issue_62516", "tokennum": 381}], "negative_passages": []} {"query_id": "q-en-rust-a1362e96a8a083fc5b3f54b71abc29c89f21f7fc4965bf129e6fec78aecbe612", "query": "/// # } /// ``` #[stable(feature = \"rust1\", since = \"1.0.0\")] #[inline] pub fn from_raw_os_error(code: i32) -> Error { Error { repr: Repr::Os(code) } }", "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-a156ca6ee613c9794abd139882a75ae03bd140a97d632d595ecbbbc440ccdd60", "query": "LitKind::Int(_, LitIntType::Unsuffixed) => \"\", _ => bug!(), }; cx.emit_spanned_lint( OVERFLOWING_LITERALS, struct_expr.span, RangeEndpointOutOfRange { ty, suggestion: struct_expr.span, let sub_sugg = if expr.span.lo() == lit_span.lo() { let Ok(start) = cx.sess().source_map().span_to_snippet(eps[0].span) else { return false }; UseInclusiveRange::WithoutParen { sugg: struct_expr.span.shrink_to_lo().to(lit_span.shrink_to_hi()), start, literal: lit_val - 1, suffix, }, } } else { UseInclusiveRange::WithParen { eq_sugg: expr.span.shrink_to_lo(), lit_sugg: lit_span, literal: lit_val - 1, suffix, } }; cx.emit_spanned_lint( OVERFLOWING_LITERALS, struct_expr.span, RangeEndpointOutOfRange { ty, sub: sub_sugg }, ); // We've just emitted a lint, special cased for `(...)..MAX+1` ranges,", "positive_passages": [{"docid": "doc-en-rust-4c24aedb050ae421ef19e0edb4462dd9b44b51c45102cda0baee816832bb9c71", "text": " $DIR/unstable-const-fn-in-libcore.rs:24:26 | LL | Opt::None => f(), | ^^^ error[E0493]: destructors cannot be evaluated at compile-time --> $DIR/unstable-const-fn-in-libcore.rs:19:53 | LL | const fn unwrap_or_else T>(self, f: F) -> T { | ^ constant functions cannot evaluate destructors error[E0493]: destructors cannot be evaluated at compile-time --> $DIR/unstable-const-fn-in-libcore.rs:19:47 | LL | const fn unwrap_or_else T>(self, f: F) -> T { | ^^^^ constant functions cannot evaluate destructors error: aborting due to 3 previous errors Some errors have detailed explanations: E0015, E0493. For more information about an error, try `rustc --explain E0015`. ", "positive_passages": [{"docid": "doc-en-rust-de3ae2071838e8f5737a690e93daa4ee53dc8da8ed3faec76cee25cfaab68316", "text": "As shown in const-qualification can ignore some s, in the context of libcore / rustc crates: This should not compile without \"miri unleashed\"; const-qualification does not see this function as const since the unstable feature is not enabled, and thus does not check it. It outside of libcore, nor . cc More discussion is also available . I have a fix and will post a PR shortly. There are a couple of existing cases in where this matters (for and ), and I'll fix those at the same time.", "commid": "rust_issue_67053", "tokennum": 117}], "negative_passages": []} {"query_id": "q-en-rust-a24efe13733f807c953f2ae13733f92aa4a5c44a888fbec83cdf3ad2346b5982", "query": "return noop_visit_attribute(at, self); } let filename = self.cx.resolve_path(&*file.as_str(), it.span()); let filename = match self.cx.resolve_path(&*file.as_str(), it.span()) { Ok(filename) => filename, Err(mut err) => { err.emit(); continue; } }; match self.cx.source_map().load_file(&filename) { Ok(source_file) => { let src = source_file.src.as_ref()", "positive_passages": [{"docid": "doc-en-rust-7d55fb70b8009b8de8ea12222703e0d94d680b032e2e0acaa08d0943ac596b14", "text": "to reproduce the fault this can be used: will result in this ICE: thread 'rustc' panicked at 'cannot resolve relative path in non-file source ', note: Run with RUSTBACKTRACE=1 environment variable to display a backtrace. error: internal compiler error: unexpected panic note: the compiler unexpectedly panicked. this is a bug. note: we would appreciate a bug report: note: rustc 1.36.0 ( 2019-07-03) running on x86_64-unknown-linux-gnu the question is what is the path that shall be used when the code is from stdin maybe some temp file name in the currrent working dir.\nThis ICE also occurs when using and , which makes sense as they use the same mechanism under the hood (, , meaning it also .\nWhile poking at this I also noticed that items are silently ignored, and filed .", "commid": "rust_issue_63900", "tokennum": 185}], "negative_passages": []} {"query_id": "q-en-rust-a25e8ba0316bf14b24c0f114cd5cddfe4a2a25708fc2210c9c4c2820a4ff6279", "query": "14 | println!(\"Hello, World!\"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: expands to `println! { \"Hello, World!\" }` = note: expands to `print! { concat ! ( \"Hello, World!\" , \"/n\" ) }` = note: expanding `println! { \"Hello, World!\" }` = note: to `print ! ( concat ! ( \"Hello, World!\" , \"/n\" ) )` = note: expanding `print! { concat ! ( \"Hello, World!\" , \"/n\" ) }` = note: to `$crate :: io :: _print ( format_args ! ( concat ! ( \"Hello, World!\" , \"/n\" ) ) )` ", "positive_passages": [{"docid": "doc-en-rust-75f50205aabf961ca45227448ef519b9d88f08a935f245674bab03a5981cbe45", "text": "Output is: The first message here is inaccurate. The macro-use does not expand to that macro-use. shows the input to macros, not the output. So instead of \"expands to:\", it should say \"expanding:\". But changing the behavior to match what the message says would be even better. ;) This is a regression because the error messages are new. used to just dump token streams to stdout (lol).\nIntroduced in .\nClosing -- I believe fixed this.", "commid": "rust_issue_42072", "tokennum": 105}], "negative_passages": []} {"query_id": "q-en-rust-a2758b9b1e22620c729fe6690090f83f342f595604fa09e3d46d6773f68ed07e", "query": "ulimit -c unlimited fi # There was a bad interaction between \"old\" 32-bit binaries on current 64-bit # kernels with selinux enabled, where ASLR mmap would sometimes choose a low # address and then block it for being below `vm.mmap_min_addr` -> `EACCES`. # This is probably a kernel bug, but setting `ulimit -Hs` works around it. # See also `dist-i686-linux` where this setting is enabled. if [ \"$SET_HARD_RLIMIT_STACK\" = \"1\" ]; then rlimit_stack=$(ulimit -Ss) if [ \"$rlimit_stack\" != \"\" ]; then ulimit -Hs \"$rlimit_stack\" fi fi ci_dir=`cd $(dirname $0) && pwd` source \"$ci_dir/shared.sh\"", "positive_passages": [{"docid": "doc-en-rust-f4ed9e3f1d2d7ae852d8255d7e891270d3b1745dcfd72417e2a2b98bdaa449dd", "text": "The docs currently claim that the minimum Linux kernel version for is 2.6.18 (released September 20th, 2006). This is because RHEL 5 used that kernel version. However, RHEL 5 entered ELS on March 31, 2017. Should we continue to support RHEL 5 for , or should we increase the minimum Linux Kernel version to 2.6.27 (2nd LTS) or 2.6.32 (RHEL 6, 3rd LTS)? . Even bumping the min-version to 2.6.27 would allow us to remove most of the Linux-specific hacks in . Example: .\nGiven that RHEL is the only reason we keep comically old kernel versions around, I would propose that Rust only support RHEL until Maintenance Support ends. This is (essentially) what we already did for RHEL 4. Rust never supported RHEL 4, and back when RHEL 5 still had maintenance support. It would be nice to get someone from Red Hat or a RHEL customer to comment. This policy would allow us to increment the minimum kernel from 2.6.18 to 2.6.32 (and remove a lot of Linux-specific hacks). Note that RHEL has a weird (and very long) support system for RHEL 4, 5, and 6 (sources: and ). It has 5 major steps: Full Support Normal support of the OS Maintenance Support 1 Bug/Security fixes Limited hardware refresh Maintenance Support 2 Bug/Security fixes The end of this phase is considered \"Product retirement\" Extended Life Cycle Support (ELS) Additional paid product from Red Hat Gives updates for a longer period of time No additional releases/images Extended Life Phase (ELP) No more updates Limited Technical Support End date not given by Red Hat Current status of RHEL versions: RHEL 4 Not supported by Rust Currently in ELP (no end date specified) ELS ended March 31, 2017 RHEL 5 Supported by Rust Currently in ELS Maintenance Support ended March 31, 2017 ELS ends November 30, 2020 RHEL 6 Supported by Rust Currently in Maintenance Support 2 Maintenance Support ends November 30, 2020\ncc which I think they could be related.", "commid": "rust_issue_62516", "tokennum": 449}], "negative_passages": []} {"query_id": "q-en-rust-a2758b9b1e22620c729fe6690090f83f342f595604fa09e3d46d6773f68ed07e", "query": "ulimit -c unlimited fi # There was a bad interaction between \"old\" 32-bit binaries on current 64-bit # kernels with selinux enabled, where ASLR mmap would sometimes choose a low # address and then block it for being below `vm.mmap_min_addr` -> `EACCES`. # This is probably a kernel bug, but setting `ulimit -Hs` works around it. # See also `dist-i686-linux` where this setting is enabled. if [ \"$SET_HARD_RLIMIT_STACK\" = \"1\" ]; then rlimit_stack=$(ulimit -Ss) if [ \"$rlimit_stack\" != \"\" ]; then ulimit -Hs \"$rlimit_stack\" fi fi ci_dir=`cd $(dirname $0) && pwd` source \"$ci_dir/shared.sh\"", "positive_passages": [{"docid": "doc-en-rust-c658707ba1f511004a82a078aaea5dda93c2219b3ffe958dfb8644db8e29ef0c", "text": "It also may be worth to drop support of Windows XP and Vista (especially considering that panics are broken on XP since June 2016, see: ). Previously it was discussed . cc\nBesides , which other things would we be able to clean up?\nGood question! There are 6 workarounds in for older Linux versions (that I could find). Increasing the minimum version to 2.6.32 (aka 3rd Kernel LTS, aka RHEL 6) would fix 5 of them. Code links are inline: (mentioned above, in 2.6.23) ( in 2.6.24, there is also the mention of a bug occuring on \"some linux kernel at some point\") to atomically set the flag on the pipe fds ( in 2.6.27) ( in 2.6.27) to permit use of ( in 2.6.28) ( in 4.5, not fixed by this proposal) As you can see, the workarounds fixed by this proposal all have a similar flavor.\nI am Red Hat's maintainer for Rust on RHEL -- thanks for the cc. I try to keep an eye on new issues, but this one slipped past me. Red Hat only ships the Rust toolchain to customers for RHEL 7 and RHEL 8. If our customers would like to use Rust on older RHEL, they can do so via , and we'll support them in the same way we would for any other third-party software. Internally we do also build and use on RHEL 6, mostly because it's needed to ship Firefox updates. This is where it gets a little hairy, because each RHEL N is bootstrapped on RHEL N-1 and often kept that way -- meaning a lot of our RHEL 6 builders are still running on a RHEL 5 kernel. I would have to apply local workarounds if upstream Rust loses the ability to run on 2.6.18 kernels. We prefer to keep fixes upstream as much as possible, both for open sharing and to avoid bitrot. Is there much of a benefit to removing the current workarounds? I agree all of that code is annoying and cumbersome, but it's already written, and as far as I know it hasn't been a maintenance burden. Do you see otherwise?", "commid": "rust_issue_62516", "tokennum": 486}], "negative_passages": []} {"query_id": "q-en-rust-a2758b9b1e22620c729fe6690090f83f342f595604fa09e3d46d6773f68ed07e", "query": "ulimit -c unlimited fi # There was a bad interaction between \"old\" 32-bit binaries on current 64-bit # kernels with selinux enabled, where ASLR mmap would sometimes choose a low # address and then block it for being below `vm.mmap_min_addr` -> `EACCES`. # This is probably a kernel bug, but setting `ulimit -Hs` works around it. # See also `dist-i686-linux` where this setting is enabled. if [ \"$SET_HARD_RLIMIT_STACK\" = \"1\" ]; then rlimit_stack=$(ulimit -Ss) if [ \"$rlimit_stack\" != \"\" ]; then ulimit -Hs \"$rlimit_stack\" fi fi ci_dir=`cd $(dirname $0) && pwd` source \"$ci_dir/shared.sh\"", "positive_passages": [{"docid": "doc-en-rust-af4898c3fb7c61e2eba3dec9f4b6ba76545c9cefd16e60e4bb5d1131f91cb434", "text": "If there are any known issues with such Linux compatibility code, I am definitely willing to take assignment for fixing them.\n(Not a Rust maintainer, but I'm a Rust user and maintain a lot of other OSS software so I have well-developed feelings around supporting Very Old Software :-)) Do you have any sense of on what timeline Rust would be able to drop support for 2.6.18 kernels without causing you pain? In general I don't think people mind supporting configurations that have users and are painful to work around, but needing to support them for forever is a bitter pill to swallow! Particularly as they get harder and harder to test over time (already I have no idea how to test on really old kernels besides building it myself). So if there was an estimate \"we'd like to be able to support this until Q2 2020\", even if it's not set in stone, I think that would be very helpful!\nThe other benefit would be that Rust wouldn't have to use CentOS 5 for CI, which means we don't have to patch LLVM (and Emscripten LLVM) to compile on those systems. Of course that's also fairly limited in scope.\nAs soon as we stop shipping Firefox and Thunderbird updates on RHEL 6, I won't need Rust there anymore. AFAIK this does correspond to the end of Maintenance Support, November 30, 2020. Then I'll be on to RHEL 7 builders as my minimum, probably still with some RHEL 6 2.6.32 kernels involved. It should be fine for me if we update CI to CentOS 6. This is mostly concerned with how the release binaries are linked to GLIBC symbol versions, which is all in userspace. It's a broader community question whether any other Rust users still care about running on RHEL or CentOS 5. (Small caveat - glibc support for a symbol can still return , .)\nI noticed that Red Hat also has Extended Life Cycle Support (ELS) for RHEL 6 until June 30, 2024. Will you need RHEL 5 to work during this time? I don't know how ELS works with Firefox updates. Also, is there any reason RHEL 4 support wasn't an issue prior to March 31, 2017 (while RHEL 5 was still normally supported)?", "commid": "rust_issue_62516", "tokennum": 500}], "negative_passages": []} {"query_id": "q-en-rust-a2758b9b1e22620c729fe6690090f83f342f595604fa09e3d46d6773f68ed07e", "query": "ulimit -c unlimited fi # There was a bad interaction between \"old\" 32-bit binaries on current 64-bit # kernels with selinux enabled, where ASLR mmap would sometimes choose a low # address and then block it for being below `vm.mmap_min_addr` -> `EACCES`. # This is probably a kernel bug, but setting `ulimit -Hs` works around it. # See also `dist-i686-linux` where this setting is enabled. if [ \"$SET_HARD_RLIMIT_STACK\" = \"1\" ]; then rlimit_stack=$(ulimit -Ss) if [ \"$rlimit_stack\" != \"\" ]; then ulimit -Hs \"$rlimit_stack\" fi fi ci_dir=`cd $(dirname $0) && pwd` source \"$ci_dir/shared.sh\"", "positive_passages": [{"docid": "doc-en-rust-934ec82e8629c1a4b0aa4c30514ddf0d4797bd4b016aa76dfff917479da3a145", "text": "This issue came up for me when dealing with opening files in , see for more info. No single RHEL 5 issue is that bad, it's mainly just the sum of a bunch of tiny issues.\nI'm not on that team, but AFAIK we don't ship Firefox updates for ELS. The last build I see for RHEL 5 was . Maybe there could be an exception for a severe security issue, but I really doubt we'd rebase to newer Firefox for that, which means Rust requirements won't change. New Firefox ESR versions do require a newer Rust toolchain too, which is generally why we have to keep up. Otherwise we could just freeze some older compat rustc while upstream moves on. Rust wasn't required until Firefox 52.\nthat makes perfect sense to me, thanks for clarifying. So the proposed policy would be: Support RHEL until RHEL is retired (i.e. ends normal support). This would mean: Supporting RHEL 5 (v2.6.18) until November 30, 2020 Supporting RHEL 6 (v2.6.32) until June 30, 2024 Supporting RHEL 7 (v3.10) until May, 2029 This is a much longer support tail than any other Linux distros (that I know of), so it would also be the effective minimum kernel version of , , and their dependencies. How does that sound to people? EDIT: The alternative to this would be Support RHEL until it is retired, taking the table above and incrementing the RHEL versions by 1. It would also mean being able to drop RHEL 5 support now.\nSure, that's ideal for me. :smile: As mentioned, is just needed for kernel support, as far as I'm concerned. Userspace concerns like GLIBC symbol versions can stick to currently supported for my needs.\nRed Hat should backport the features we need (CLOEXEC and getrandom, in particular) to whatever kernels that it wants Rust to support. I don't know any good reason why they don't do so, other than it's cheaper to convince the whole world to keep supporting older kernel versions than it is to do the backports. We should change that dynamic.", "commid": "rust_issue_62516", "tokennum": 482}], "negative_passages": []} {"query_id": "q-en-rust-a2758b9b1e22620c729fe6690090f83f342f595604fa09e3d46d6773f68ed07e", "query": "ulimit -c unlimited fi # There was a bad interaction between \"old\" 32-bit binaries on current 64-bit # kernels with selinux enabled, where ASLR mmap would sometimes choose a low # address and then block it for being below `vm.mmap_min_addr` -> `EACCES`. # This is probably a kernel bug, but setting `ulimit -Hs` works around it. # See also `dist-i686-linux` where this setting is enabled. if [ \"$SET_HARD_RLIMIT_STACK\" = \"1\" ]; then rlimit_stack=$(ulimit -Ss) if [ \"$rlimit_stack\" != \"\" ]; then ulimit -Hs \"$rlimit_stack\" fi fi ci_dir=`cd $(dirname $0) && pwd` source \"$ci_dir/shared.sh\"", "positive_passages": [{"docid": "doc-en-rust-eeb84d19a31c33242b4b2207158242f97ffc0b5ae779e20d04d3166e3dda00c1", "text": "The alternative to this would be Support RHEL N until it is retired I think we should not officially support retired OS versions (well, maybe with some grace period), so I prefer this option. Supporting 14 year old kernels seems a bit too much to me. each RHEL N is bootstrapped on RHEL N-1 and often kept that way -- meaning a lot of our RHEL 6 builders are still running on a RHEL 5 kernel Is it possible to apply kernel patches to those builders to add support for functionality like CLOEXEC? Or build Firefox separately on RHEL 6?\nI think it won't be fruitful for us to debate the merits of stable enterprise kernels, but no, this is not a possibility. An alternative take is \"Red Hat should be responsible for the work in Rust to maintain the support they want\" -- here I am, ready and willing. I definitely can't change those kernels. The ones that are stuck on N-1 are precisely to avoid rocking the boat, and backporting features is a big change. Some of our arches do eventually update the builders to their matching N kernel, but some don't, and I don't know all the reasons. If the workarounds are removed, then I will have to reapply them in our own builds. This assumes I keep using only our own binaries -- if I ever have to re-bootstrap from upstream binaries for stage0, I would also have to use some interception (like ) to hack in the workarounds. This is all possible, but much worse than the status quo of maintaining support here.\nI think this sounds reasonable. We aren't going to be able to update these kernels, it's just a question of when we would drop support for these OSes. Especially given that we wont need RHEL 5 CI support, I think that leaving things as they are is fine. I opened this issue to verify two things: 1) That we weren't intending on supporting RHEL 5 \"forever\", and had a clear date when to drop support. 2) That someone from Red Hat actively cared about supporting these older kernels. It looks like both these things are true. We should remove RHEL 5 workarounds after November 30, 2020. This issue can be postponed until then.", "commid": "rust_issue_62516", "tokennum": 488}], "negative_passages": []} {"query_id": "q-en-rust-a2758b9b1e22620c729fe6690090f83f342f595604fa09e3d46d6773f68ed07e", "query": "ulimit -c unlimited fi # There was a bad interaction between \"old\" 32-bit binaries on current 64-bit # kernels with selinux enabled, where ASLR mmap would sometimes choose a low # address and then block it for being below `vm.mmap_min_addr` -> `EACCES`. # This is probably a kernel bug, but setting `ulimit -Hs` works around it. # See also `dist-i686-linux` where this setting is enabled. if [ \"$SET_HARD_RLIMIT_STACK\" = \"1\" ]; then rlimit_stack=$(ulimit -Ss) if [ \"$rlimit_stack\" != \"\" ]; then ulimit -Hs \"$rlimit_stack\" fi fi ci_dir=`cd $(dirname $0) && pwd` source \"$ci_dir/shared.sh\"", "positive_passages": [{"docid": "doc-en-rust-98814f154707157dfd52e3b214f0d6bd01f03740b261398ed8ea1f98921871ca", "text": "EDIT: For our use case in , we were able to add compatibility for RHEL 5 .\nSee for a recent case where supporting such ancient kernels required extra manual work ( to the 2 lines mentioned by above). I am not sure how often that comes up, but probably the hardest part is to even notice that it happens -- and even then those codepaths will likely linger untested.\nYes, but this will still be true in general. If the CI kernel is newer than whatever kernel baseline we choose, it will be possible for newer syscalls to pass undetected. I don't know if we have any control over that -- can we choose a particular VM image? So that leaves us with a stated policy of support. The more that developers are aware of such issues, the better, but I'm the one most likely to notice when my build actually fails. If I come back with a fix, I at least need the project to be receptive. I haven't been in the habit of building nightly on our RHEL6 builders, but maybe I should! Catching this early is better for everyone involved...\nThat seems reasonable. How quick is the Rust related bootstrapping? Could it be run automatically (or more frequently)? This is an interesting point. If I hadn't made that change, would have kept working on RHEL 5, it just would have leaked an FD. I'm not sure how we would even test for this sort of thing. This isn't a RHEL 5 specific concern, I just don't know how Rust tests these types of resource leak issues in general.\nAbout 2 hours. Automation is harder, since I believe our build system needs my credentials, but I'll look into what is possible here. Yeah, that's a lot more subtle than an !", "commid": "rust_issue_62516", "tokennum": 381}], "negative_passages": []} {"query_id": "q-en-rust-a2d8a07a286c14fc71dae175038c828db4b391b45d3cb9a878cfe685114c7d2e", "query": "checksum = \"d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd\" [[package]] name = \"semver\" version = \"1.0.17\" source = \"registry+https://github.com/rust-lang/crates.io-index\" checksum = \"bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed\" [[package]] name = \"serde\" version = \"1.0.137\" source = \"registry+https://github.com/rust-lang/crates.io-index\"", "positive_passages": [{"docid": "doc-en-rust-b0ce9f73889fb41768327ef0012858de2070cffaeff1e19a7c5b317ca9b71c2e", "text": "I'm trying to build Rust on a Tier 3 platform (; actually it's that's listed in Tier 3, but I don't think that affects the problem). Since there are no snapshots for this platform, I installed rustc from the distro's package manager (apk) and created a file to force using the pre-installed rustc rather than downloading snapshots: And the output of : I ran ; when it got as far as building the core library, I got a series of errors that were very hard to make sense of until I realized that it's because core library code depends on unstable features and I was using a stable rustc to compile it: There were many more errors, but I think they all relate to unstable features. It took me ages to figure out that (for example) the first error is due to the feature being disabled in stable. I understand that the stable compiler won't allow using unstable features even with , but is it possible for the parser to recognize this code even so and reject it with something like \"feature is not enabled\" instead of the much more generic \"expected identifier\" error?\nHuh, usually Rust gets around this by setting , and usually when we bootstrap it's with a beta compiler, which does need that set by , and that would allow all the features. I wonder if wasn't set?\nIt's set, but the command that's actually failing (it took some effort to figure out which executable was actually failing) is: And what's installed for me in is a stable compiler. I realized after the fact that I can't use it to bootstrap, but with a different error message I might have noticed that sooner.\nForwards compatibility in diagnostics seems extremely hard. I think a much simpler and more helpful fix is to check the output of in bootstrap and give a hard error if it's not either the current version or N-1.\nNote that the problem here is that you were trying to use 1.68 to build 1.70; it's unrelated to stable vs beta, the problem is that it was two versions behind instead of only one.\nMentoring instructions: in , if is set, run that process with . Compare that output to the contents of using the crate; if the minor versions aren't either the same or 1 apart, give a hard error. Note that this should also disallow e.g.", "commid": "rust_issue_110067", "tokennum": 514}], "negative_passages": []} {"query_id": "q-en-rust-a2d8a07a286c14fc71dae175038c828db4b391b45d3cb9a878cfe685114c7d2e", "query": "checksum = \"d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd\" [[package]] name = \"semver\" version = \"1.0.17\" source = \"registry+https://github.com/rust-lang/crates.io-index\" checksum = \"bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed\" [[package]] name = \"serde\" version = \"1.0.137\" source = \"registry+https://github.com/rust-lang/crates.io-index\"", "positive_passages": [{"docid": "doc-en-rust-cb864ca747ed3164bf447cc2573dfcf2a0f8ad3b68ed7b7a37fcb4b4656d8418", "text": "building 1.68 with 1.69; we use deny-warnings in most cases and have no guarantees that unstable features will be the same between releases. Only building 1.68 with 1.67 or 1.68 should be allowed.\nbtw I've noticed you running into a few different bootstrap bugs the past few days \u2014 reading through https://rustc-dev- may or may not make it easier to diagnose these issues without having to spend ages interpreting the diagnostics. I'm also happy to chat about \"how should this work\" sorts of things .\nYes, I've read that. Thanks!\nThe error message could be improved though. Maybe one could make the to put into libcore/bootstrap's\nI don't think rust-version is a good way to solve this, no - that won't give a warning or error if you use a future version to compile an older version. Also it won't be able to catch local-rebuild issues where the nightly version of the bootstrap compiler is too old. See my suggestion in\nHmm, I'm afraid I might have said something unclear. I'm not asking for forward compatibility in diagnostics. The feature was in version 1.68.0, according to , and I was using rustc version 1.68.2. So it should \"know\" about that feature, but my understanding is that when I was invoking rustc it was with flags that prevent unstable features from being used.\nhmm, in that case something strange is going on because playground gives a much more reasonable error than the one you saw:\nwhat commit of rustc were you trying to build when you got this error? I'm going to see if I can replicate it locally.\nI was trying to build .\nAh ok, it was related to the context of the closure: If you look at the same gist with beta, the error message is much better: So I think this particular diagnostic issue has already been fixed. I still want to keep this issue open to track checking the version of the bootstrap compiler, though.", "commid": "rust_issue_110067", "tokennum": 437}], "negative_passages": []} {"query_id": "q-en-rust-a311852b364fe2dac282a4d1f8036a3fcda72dbef374dd374ab3caa364470496", "query": " error[E0026]: variant `A::A` does not have a field named `fob` --> $DIR/issue-52717.rs:19:12 | LL | A::A { fob } => { println!(\"{}\", fob); } | ^^^ | | | variant `A::A` does not have this field | help: did you mean: `foo` error: aborting due to previous error For more information about this error, try `rustc --explain E0026`. ", "positive_passages": [{"docid": "doc-en-rust-065b1609592312bc44293dae2015cebcd327e0d286ff073b36a58da689c9b13e", "text": "With a single typo in a match arm, we generate three separate errors: We should collect all these errors into a single diagnostic:\ncould you share sample code to exactly reproduce above diagnostic?\nI will raise another PR to address the case where we are unnecessarily throwing .", "commid": "rust_issue_52717", "tokennum": 57}], "negative_passages": []} {"query_id": "q-en-rust-a336b5a22fcac3c36893dfabf8f6280f322a414d3b5d00078fe562a5f3f5d818", "query": "} }; let yielded = opt_expr.as_ref().map(|x| self.lower_expr(x)).unwrap_or_else(|| self.expr_unit(span)); if is_async_gen { // `yield $expr` is transformed into `task_context = yield async_gen_ready($expr)`. // This ensures that we store our resumed `ResumeContext` correctly, and also that", "positive_passages": [{"docid": "doc-en-rust-63425775d3100ff4499dfa2d540ed9035498323f4387c679988f9a1d8f73b054", "text": " $DIR/issue-117669.rs:2:20 | LL | let abs: i32 = 3i32.checked_abs(); | --- ^^^^^^^^^^^^^^^^^^ expected `i32`, found `Option` | | | expected due to this | = note: expected type `i32` found enum `Option` help: consider using `Option::expect` to unwrap the `Option` value, panicking if the value is an `Option::None` | LL | let abs: i32 = 3i32.checked_abs().expect(\"REASON\"); | +++++++++++++++++ error: aborting due to previous error For more information about this error, try `rustc --explain E0308`. ", "positive_passages": [{"docid": "doc-en-rust-2a67732fca7f3db536e9aa3c6cf4bab223f23ef1fc6c10f5617aeebc9c384568", "text": "in Dec '22 introduced a cool new feature to suggest removing the last method call if it would alleviate a type mismatch error. This is particularly using for people wrestling with issues. in Oct '23 introduced another useful feature to suggest to users that they might consider ing an or type in order to solve a type mismatch. Also very cool, and conveniently by the same author Unfortunately, in cases where a method is called, the previous check takes precedence, and the compiler suggests removing that trailing method to get the code to compile. This isn't generally that useful as the expect suggestion, and I can't think of an example where it's a better one. If you can think of one though, please put it below for me to test! surfaced this with but it's more easily demonstrated with ints. I can see two ways to fix this: the trailing method check first, but ignore and types the checks so the option type is checked first. Note that the method check has to be high in the chain as the motive is to quickly suggest removing a call, before adding a whole load of new ones. This means the check has to be one of the first I am going to work on solving it via method 2, as it feels cleaner that the method check doesn't have to know about the and check. If anyone has strong feelings on this, please let me know! Playground No response No response $DIR/issue-117669.rs:2:20 | LL | let abs: i32 = 3i32.checked_abs(); | --- ^^^^^^^^^^^^^^^^^^ expected `i32`, found `Option` | | | expected due to this | = note: expected type `i32` found enum `Option` help: consider using `Option::expect` to unwrap the `Option` value, panicking if the value is an `Option::None` | LL | let abs: i32 = 3i32.checked_abs().expect(\"REASON\"); | +++++++++++++++++ error: aborting due to previous error For more information about this error, try `rustc --explain E0308`. ", "positive_passages": [{"docid": "doc-en-rust-4c48e7384319282a865ae5050b0e0de8d6cbffff91bc4223b1c74756520da20a", "text": "it should run I'll focus on the latter here, but if you have examples where removing the method call doesn't make sense we can aggregate them and see if there is a holistic solution?", "commid": "rust_issue_117669", "tokennum": 41}], "negative_passages": []} {"query_id": "q-en-rust-a47ad4e589120bd32b7bd3f7ddb0980ee482ec66ef6a1652390f2bad3f4fb853", "query": "/// # Examples /// /// ```no_run /// # #![feature(bufreader_buffer)] /// use std::io::{BufReader, BufRead}; /// use std::fs::File; ///", "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-a47ad4e589120bd32b7bd3f7ddb0980ee482ec66ef6a1652390f2bad3f4fb853", "query": "/// # Examples /// /// ```no_run /// # #![feature(bufreader_buffer)] /// use std::io::{BufReader, BufRead}; /// use std::fs::File; ///", "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-a47ad4e589120bd32b7bd3f7ddb0980ee482ec66ef6a1652390f2bad3f4fb853", "query": "/// # Examples /// /// ```no_run /// # #![feature(bufreader_buffer)] /// use std::io::{BufReader, BufRead}; /// use std::fs::File; ///", "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-a497242f111f376b5d82038348f459aebf21277bb68683b74471fbaaff1e129a", "query": "traits::RepeatVec => { tcx.sess.span_note( obligation.cause.span, format!( \"the `Copy` trait is required because the repeated element will be copied\").as_slice()); \"the `Copy` trait is required because the repeated element will be copied\"); } traits::VariableType(_) => { tcx.sess.span_note( obligation.cause.span, \"all local variables must have a statically known size\"); } traits::ReturnType => { tcx.sess.span_note( obligation.cause.span, \"the return type of a function must have a statically known size\"); } traits::AssignmentLhsSized => { tcx.sess.span_note( obligation.cause.span,", "positive_passages": [{"docid": "doc-en-rust-cd05abfbd828719249c06e3e881d256200cd0a3ba0015f94126fbb769c26b16e", "text": "The following code causes an ICE: Removing the parameter or changing it to be a value instead of a reference stops the crash with an error saying I need to specify a lifetime, which makes me think this is a problem related to inferred lifetimes.\nIt isn't, you just have to specify a lifetime: ICE-s as well. Returning an unsized type should be a typeck error.\nhappens to work because it implies , i.e. would also work.", "commid": "rust_issue_18107", "tokennum": 98}], "negative_passages": []} {"query_id": "q-en-rust-a4b62f2358e76a720fb1dd618135492f69bd3e5c06065130b921396d7c45c8f9", "query": "let f1: f32 = FromStrRadix::from_str_radix(\"1p-123\", 16).unwrap(); let f2: f32 = FromStrRadix::from_str_radix(\"1p-111\", 16).unwrap(); let f3: f32 = FromStrRadix::from_str_radix(\"1.Cp-12\", 16).unwrap(); assert_eq!(Float::ldexp(1f32, -123), f1); assert_eq!(Float::ldexp(1f32, -111), f2); assert_eq!(1f32.ldexp(-123), f1); assert_eq!(1f32.ldexp(-111), f2); assert_eq!(Float::ldexp(1.75f32, -12), f3); assert_eq!(Float::ldexp(0f32, -123), 0f32);", "positive_passages": [{"docid": "doc-en-rust-a8428518f58889c453ca1290dddadd0e3e28c9b7077914cbfb5ede869ab2b772", "text": "has an unusual format: it takes as it's first parameter where everything else in the trait takes . It should take as it's first parameter for consistency with everything else. It is located in \n+1. There are a few different things to consider here, though: does not operate on any FP number per se like most other operations do, but rather constructs a new FP number from two arguments one of which happens to be FP number. This function\u2019s signature is consistent with most other methods that construct some kind of FP number (e.g. ). We might want to consider whether methods such as shouldn\u2019t just go ahead and take instead. can\u2019t currently be chained, but I see literally 0 cases where anybody would chain this function. cc\nOkay, but from a consistency standpoint, it's like 1/80 for vs . It it keeps the same format, it and it's similar functions would probably be better to go at the end or beginning of the function list where they won't be so unusual.\nNominating for 1.0-beta P-backcompat-libs\nOne should be able to call this thing as a method, one way or another. We need to make sure that is resolved.\n0 beta, P-backcompat-libs\nI started to fix this.", "commid": "rust_issue_22098", "tokennum": 277}], "negative_passages": []} {"query_id": "q-en-rust-a4e8dc88c78e407d670fe28e937b4afb373df6532700562b27f721282c08b0b7", "query": " error: an inner attribute is not permitted in this context --> $DIR/issue-89971-outer-attr-following-inner-attr-ice.rs:11:1 | LL | #![deny(missing_docs)] | ^^^^^^^^^^^^^^^^^^^^^^ ... LL | struct Mew(); | ------------- the inner attribute doesn't annotate this struct | = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files help: to annotate the struct, change the attribute from inner to outer style | LL - #![deny(missing_docs)] LL + #[deny(missing_docs)] | error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-27c231f161e5b0e90caf267be78168c96a08f80e611682933af7a2d0eb404e20", "text": " $DIR/name-same-as-generic-type-issue-128249.rs:4:30 | LL | fn one(&self, val: impl Trait); | ^^^^^ expected 1 generic argument | note: trait defined here, with 1 generic parameter: `Type` --> $DIR/name-same-as-generic-type-issue-128249.rs:1:7 | LL | trait Trait { | ^^^^^ ---- help: add missing generic argument | LL | fn one(&self, val: impl Trait); | +++++ error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied --> $DIR/name-same-as-generic-type-issue-128249.rs:7:15 | LL | fn two>(&self) -> T; | ^^^^^ expected 1 generic argument | note: trait defined here, with 1 generic parameter: `Type` --> $DIR/name-same-as-generic-type-issue-128249.rs:1:7 | LL | trait Trait { | ^^^^^ ---- help: add missing generic argument | LL | fn two>(&self) -> T; | +++++ error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied --> $DIR/name-same-as-generic-type-issue-128249.rs:11:12 | LL | T: Trait,; | ^^^^^ expected 1 generic argument | note: trait defined here, with 1 generic parameter: `Type` --> $DIR/name-same-as-generic-type-issue-128249.rs:1:7 | LL | trait Trait { | ^^^^^ ---- help: add missing generic argument | LL | T: Trait,; | +++++ error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0107`. ", "positive_passages": [{"docid": "doc-en-rust-68f8b75692d8f63eed2d856cfd70368bbc658284b057437402f6bbaeda60ca39", "text": " $DIR/coherence-impl-trait-for-marker-trait-negative.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-negative.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-negative.rs:22:1 | LL | 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-negative.rs:26:1 | LL | 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-negative.rs:27:1 | LL | 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-a7c5c149d4abfd8cc06e29e0493f1564eb52271e79596d5b850db0501195c316", "query": "let prefix = default_path(&builder.config.prefix, \"/usr/local\"); let sysconfdir = prefix.join(default_path(&builder.config.sysconfdir, \"/etc\")); let destdir_env = env::var_os(\"DESTDIR\").map(PathBuf::from); // Sanity check for the user write access on prefix and sysconfdir assert!( is_dir_writable_for_user(&prefix), \"User doesn't have write access on `install.prefix` path in the `config.toml`.\", ); assert!( is_dir_writable_for_user(&sysconfdir), \"User doesn't have write access on `install.sysconfdir` path in `config.toml`.\" ); // Sanity checks on the write access of user. // // When the `DESTDIR` environment variable is present, there is no point to // check write access for `prefix` and `sysconfdir` individually, as they // are combined with the path from the `DESTDIR` environment variable. In // this case, we only need to check the `DESTDIR` path, disregarding the // `prefix` and `sysconfdir` paths. if let Some(destdir) = &destdir_env { assert!(is_dir_writable_for_user(destdir), \"User doesn't have write access on DESTDIR.\"); } else { assert!( is_dir_writable_for_user(&prefix), \"User doesn't have write access on `install.prefix` path in the `config.toml`.\", ); assert!( is_dir_writable_for_user(&sysconfdir), \"User doesn't have write access on `install.sysconfdir` path in `config.toml`.\" ); } let datadir = prefix.join(default_path(&builder.config.datadir, \"share\")); let docdir = prefix.join(default_path(&builder.config.docdir, \"share/doc/rust\"));", "positive_passages": [{"docid": "doc-en-rust-82f40639fc96b55ed3f895c44b3a60af9f27b741b68ea540334a4f9a37b1216c", "text": "hey everyone, I get this message from when is executed: It seems there are some backports still missing for beta, since I can fix this by reverting locally, and there are some subsequent fixes in nightly who seemed to have fixed the issue for good. So, is there somewhere a list of the nightly backports needed to fix this problem? Thanks.\ncan I ping you on this? Beta is not compiling on gentoo, I assume at least one patch from nightly still needs to be backported to beta.\nThere is that should have fixed that and it's .\nHi, I'm on latest beta from last week. If I apply locally and compile, I get access denied error:\nLogs says you don't have permission to put files into path from your build configuration. Without you would still get permission error.\nI believe this is a sandbox error, so x.py install tries to write to / instead of it's prefix, and this is caused either by or it was already introduced by the older If I revert them both locally, I get a working x.py install\nInteresting :thinking: Can you share your build configuration?\nit basically does this: which translates to: and the patch seems to make x.py ignore the DESTDIR=\"\" command In the rust context, the build config you asked me to share is the Have it attached for you, please feel free to ask for any additional information. also I can provide you with the full build log:\nDid you wait for whole process(x.py install) to be finished? I don't understand how mkdir gets you into access denied error for path while you can actually create dirs/files in it..\nMaybe there is some confusion about relative and absolute path? The access denied error is valid, as x.py never should mess with /usr/lib/ in install, but use /var/tmp/portage/dev-lang/rust-1.74.0_beta/image/ as it's prefix, if you want to name it like that.\nTrue, there is a confusion between prefix and DESTDIR right now. I will fix it today.\nThank you, I'm happy to test any patch before you commit it to master.\nYou can test\nyes this works for me, please also beta nominate\nhas this been beta-nominated? I'm new to this process, it's just I can't see a rollup pullrequest anywhere and the release of 1.74.0 is coming closer every day.", "commid": "rust_issue_117203", "tokennum": 538}], "negative_passages": []} {"query_id": "q-en-rust-a7c5c149d4abfd8cc06e29e0493f1564eb52271e79596d5b850db0501195c316", "query": "let prefix = default_path(&builder.config.prefix, \"/usr/local\"); let sysconfdir = prefix.join(default_path(&builder.config.sysconfdir, \"/etc\")); let destdir_env = env::var_os(\"DESTDIR\").map(PathBuf::from); // Sanity check for the user write access on prefix and sysconfdir assert!( is_dir_writable_for_user(&prefix), \"User doesn't have write access on `install.prefix` path in the `config.toml`.\", ); assert!( is_dir_writable_for_user(&sysconfdir), \"User doesn't have write access on `install.sysconfdir` path in `config.toml`.\" ); // Sanity checks on the write access of user. // // When the `DESTDIR` environment variable is present, there is no point to // check write access for `prefix` and `sysconfdir` individually, as they // are combined with the path from the `DESTDIR` environment variable. In // this case, we only need to check the `DESTDIR` path, disregarding the // `prefix` and `sysconfdir` paths. if let Some(destdir) = &destdir_env { assert!(is_dir_writable_for_user(destdir), \"User doesn't have write access on DESTDIR.\"); } else { assert!( is_dir_writable_for_user(&prefix), \"User doesn't have write access on `install.prefix` path in the `config.toml`.\", ); assert!( is_dir_writable_for_user(&sysconfdir), \"User doesn't have write access on `install.sysconfdir` path in `config.toml`.\" ); } let datadir = prefix.join(default_path(&builder.config.datadir, \"share\")); let docdir = prefix.join(default_path(&builder.config.docdir, \"share/doc/rust\"));", "positive_passages": [{"docid": "doc-en-rust-20c1021a8e1a03951388b1be0ee97e187f2d3c4dbf211e5a577f810dca78d644", "text": "It is cc\nfor backport, the PR's responsible team (T-bootstrap) also needs to label it beta-accepted. Once it has both labels, the release team will handle the actual backport.", "commid": "rust_issue_117203", "tokennum": 45}], "negative_passages": []} {"query_id": "q-en-rust-a7d302e34dae77f0621458222fc96c8a97e5e25c0a01273f05673f5775cc27ea", "query": "issued_borrow.borrowed_place, &issued_spans, ); self.explain_iterator_advancement_in_for_loop_if_applicable( &mut err, span, &issued_spans, ); err }", "positive_passages": [{"docid": "doc-en-rust-faa7b127efdfcd7a977a481c780c5217512eb271e499d4de9c03d90a0f57739d", "text": " $DIR/issue-100690.rs:37:23 | LL | real_dispatch(f) | ------------- ^ expected an `FnOnce<(&mut UIView<'_, T>,)>` closure, found `F` | | | required by a bound introduced by this call | = note: expected a closure with arguments `(&mut UIView<'a, T>,)` found a closure with arguments `(&mut UIView<'_, T>,)` note: required by a bound in `real_dispatch` --> $DIR/issue-100690.rs:9:8 | LL | fn real_dispatch(f: F) -> Result<(), io::Error> | ------------- required by a bound in this ... LL | F: FnOnce(&mut UIView) -> Result<(), io::Error> + Send + 'static, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `real_dispatch` error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. ", "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: error: unexpected closing delimiter: `}` --> $DIR/issue-98601-delimiter-error-1.rs:7:1 | LL | fn foo() { | - this delimiter might not be properly closed... LL | match 0 { LL | _ => {} | -- block is empty, you might have not meant to close it ... LL | } | - ...as it matches this but it has different indentation LL | } | ^ unexpected closing delimiter error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-068f5993f15057b65031dbd32195c4000961b87cb41da17c4ae89c41efbd330c", "text": "See: This code: produces on latest stable (1.61.0).\nMaybe we could form a heuristic around tokens that we know should eventually be followed by -- , , , etc. If we see one of those, (then some random other tokens), then we see , then that would be a suspicious rbrace which we could point out later.. e.g. if we see that triggers the heuristic, but not\nThe problem is that the error happens in the lexer, not the parser. Ideally we'd rework the lexer to have a token stream mode of operation instead of a token tree mode of operation, only for code that is being passed to the parser (i.e., not coming from a macro).\nThis is particularly confusing when the points to a macro: gives on 1.65.0-nightly (2022-08-31 )\nthe output now changed to: Do you think the should be removed?\nThis is changed to: it seems more helpful now.\nLet's close this ticket after adding these two cases to the test suite then. I'm sure there are outstanding issues in this area, but we can hope that we'll get tickets for those more specific cases, while the tests keep us from regressing silently (hopefully, lets make sure the tests are fully annotated so its harder to do that by accident).", "commid": "rust_issue_98601", "tokennum": 293}], "negative_passages": []} {"query_id": "q-en-rust-a95916736b6952835bc751d521231c339e1fa221b89acc9e5a687e459b5e4370", "query": "// compile-flags: -O // min-llvm-version: 15.0 #![crate_type=\"lib\"] #![crate_type = \"lib\"] use std::mem::MaybeUninit;", "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-a9a535b96910ace0612d9b3f3be766525dbc2257295de46d1b159ef3ea79a83f", "query": "println!(\"`x.py` will now use the configuration at {}\", include_path.display()); let build = TargetSelection::from_user(&env!(\"BUILD_TRIPLE\")); let stage_path = [\"build\", build.rustc_target_arg(), \"stage1\"].join(\"/\"); let stage_path = [\"build\", build.rustc_target_arg(), \"stage1\"].join(&MAIN_SEPARATOR.to_string()); println!();", "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-71381.rs:13:61 | LL | pub fn call_me(&self) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: using function pointers as const generic parameters is forbidden --> $DIR/issue-71381.rs:21:19 | LL | const FN: unsafe extern \"C\" fn(Args), | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors ", "positive_passages": [{"docid": "doc-en-rust-a975a546d53264829fbcc437898c1ae3226bbbd3547a5a7709fc6837f8ad5556", "text": "I've tried reducing this but wasn't really able to so far. I might try again some other time. The code below currently ICEs on Nightly (). When trying to reproduce locally for the backtrace, I had an older Nightly first () where this actually didn't crash the compiler, so it's apparently a regression. error: using function pointers as const generic parameters is forbidden --> $DIR/issue-71381.rs:13:61 | LL | pub fn call_me(&self) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: using function pointers as const generic parameters is forbidden --> $DIR/issue-71381.rs:21:19 | LL | const FN: unsafe extern \"C\" fn(Args), | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors ", "positive_passages": [{"docid": "doc-en-rust-a37ceb899c17630c43d86268d2c334b49b32d8976e739ff8c5d02feada9c138d", "text": "produces: error: using function pointers as const generic parameters is forbidden --> $DIR/issue-71381.rs:13:61 | LL | pub fn call_me(&self) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: using function pointers as const generic parameters is forbidden --> $DIR/issue-71381.rs:21:19 | LL | const FN: unsafe extern \"C\" fn(Args), | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors ", "positive_passages": [{"docid": "doc-en-rust-0083199d2d30907886ae35c5244f2ed3a9c47d95ba1b1870716f3c7161cbdaa4", "text": " $DIR/issue-71381.rs:13:61 | LL | pub fn call_me(&self) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: using function pointers as const generic parameters is forbidden --> $DIR/issue-71381.rs:21:19 | LL | const FN: unsafe extern \"C\" fn(Args), | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors ", "positive_passages": [{"docid": "doc-en-rust-0a83cfc50ccc7a7796089f355f5c7e9d5f34f5a9518ef005b13e27e8abd3782e", "text": " $DIR/issue-101623.rs:21:21 | LL | Trait::do_stuff({ fun(&mut *inner) }); | --------------- ^^----------------^^ | | | | | the trait `Trait<'_>` is not implemented for `*mut ()` | required by a bound introduced by this call | = help: the trait `Trait<'a>` is implemented for `()` error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. ", "positive_passages": [{"docid": "doc-en-rust-cab520f2b7bd70866d60cc44010cff24c957ee6577c579fbfe3015edfcd3a0a7", "text": "I tried this code: searched nightlies: from nightly-2022-08-18 to nightly-2022-09-09 regressed nightly: nightly-2022-08-23 searched commit range: regressed commit: { if item_level.is_some() { self.reach(item.def_id, item_level).generics().predicates(); } let enum_level = self.get(item.def_id); for variant in def.variants { let variant_level = self.update_with_hir_id(variant.id, enum_level); let variant_level = self.get(self.tcx.hir().local_def_id(variant.id)); if variant_level.is_some() { if let Some(ctor_id) = variant.data.ctor_hir_id() { self.update_with_hir_id(ctor_id, variant_level); } for field in variant.data.fields() { self.reach(self.tcx.hir().local_def_id(field.hir_id), variant_level) .ty();", "positive_passages": [{"docid": "doc-en-rust-12986e5abee77ce3b20a0cf776214e22d4434ee35686f35e800971b37babe538", "text": "EDIT (ehuss) Reproduction: Clone $DIR/issue-88476.rs:20:13 | LL | let x = #[rustc_capture_analysis] move || { | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #15701 for more information = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable error[E0658]: attributes on expressions are experimental --> $DIR/issue-88476.rs:47:13 | LL | let c = #[rustc_capture_analysis] move || { | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #15701 for more information = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable error: First Pass analysis includes: --> $DIR/issue-88476.rs:20:39 | LL | let x = #[rustc_capture_analysis] move || { | _______________________________________^ LL | | LL | | LL | | ... | LL | | LL | | }; | |_____^ | note: Capturing f[(0, 0)] -> ImmBorrow --> $DIR/issue-88476.rs:25:26 | LL | println!(\"{:?}\", f.0); | ^^^ error: Min Capture analysis includes: --> $DIR/issue-88476.rs:20:39 | LL | let x = #[rustc_capture_analysis] move || { | _______________________________________^ LL | | LL | | LL | | ... | LL | | LL | | }; | |_____^ | note: Min Capture f[] -> ByValue --> $DIR/issue-88476.rs:25:26 | LL | println!(\"{:?}\", f.0); | ^^^ error: First Pass analysis includes: --> $DIR/issue-88476.rs:47:39 | LL | let c = #[rustc_capture_analysis] move || { | _______________________________________^ LL | | LL | | LL | | ... | LL | | LL | | }; | |_____^ | note: Capturing character[(0, 0)] -> ImmBorrow --> $DIR/issue-88476.rs:52:24 | LL | println!(\"{}\", character.hp) | ^^^^^^^^^^^^ error: Min Capture analysis includes: --> $DIR/issue-88476.rs:47:39 | LL | let c = #[rustc_capture_analysis] move || { | _______________________________________^ LL | | LL | | LL | | ... | LL | | LL | | }; | |_____^ | note: Min Capture character[(0, 0)] -> ByValue --> $DIR/issue-88476.rs:52:24 | LL | println!(\"{}\", character.hp) | ^^^^^^^^^^^^ error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0658`. ", "positive_passages": [{"docid": "doc-en-rust-96d6f288edf43fd4bc0fd3535f1a81314fbc0607095567381cf30b7450a69bf5", "text": "I tried this code: This does not issue a warning for , however it fails to compile with enabled: I would expect to give a suggestion to add . Found in the 2021 crater run for: I'm uncertain if this is a duplicate of or , they seem very similar, but this case is specific to implementing Drop. : cc $DIR/stranded-opaque.rs:8:31 | LL | fn produce() -> impl Trait { | ^^^^^ associated type `Assoc` not found error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0220`. ", "positive_passages": [{"docid": "doc-en-rust-7858393efb3f35da9a78c64fed45328547f35e6e34777b842cef248ed52b397a", "text": " $DIR/constrain-trait.rs:15:31 | LL | println!(\"{:?}\", self.get_a()); | ^^^^^ method not found in `&Self` | = help: items from traits can only be used if the type parameter is bounded by the trait help: the following trait defines an item `get_a`, perhaps you need to add another supertrait for it: | LL | trait UseString: std::fmt::Debug + GetString { | ^^^^^^^^^^^ error[E0599]: no method named `get_a` found for type `&Self` in the current scope --> $DIR/constrain-trait.rs:21:31 | LL | println!(\"{:?}\", self.get_a()); | ^^^^^ method not found in `&Self` | = help: items from traits can only be used if the type parameter is bounded by the trait help: the following trait defines an item `get_a`, perhaps you need to add a supertrait for it: | LL | trait UseString2: GetString { | ^^^^^^^^^^^ error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0599`. ", "positive_passages": [{"docid": "doc-en-rust-535353bdfb3d3e5ccefea87e0d54068dc3ecfb7c686a60b3a012fad9cbb5afa0", "text": "The following example code yields an error: It's unclear from this error message how to proceed - I'm not sure of the syntax, location, or where I should be putting the \"GetString\" trait bound. It should be shown with a better example or link when this error is presented, as the current message is not sufficient for a resolution to be arrived at.\ncc\nFixing in . To fix your code write:\nThanks!", "commid": "rust_issue_65044", "tokennum": 89}], "negative_passages": []} {"query_id": "q-en-rust-b515c02e0c21649634dca1c429cc679eb8b0a21f36445a4430611250cf409122", "query": "//~^ ERROR doesn't implement } pub fn main() { } trait Foo: Sized { const SIZE: usize = core::mem::size_of::(); //~^ ERROR the size for values of type `Self` cannot be known at compilation time } trait Bar: std::fmt::Display + Sized { const SIZE: usize = core::mem::size_of::(); //~^ ERROR the size for values of type `Self` cannot be known at compilation time } trait Baz: Sized where Self: std::fmt::Display { const SIZE: usize = core::mem::size_of::(); //~^ ERROR the size for values of type `Self` cannot be known at compilation time } trait Qux: Sized where Self: std::fmt::Display { const SIZE: usize = core::mem::size_of::(); //~^ ERROR the size for values of type `Self` cannot be known at compilation time } trait Bat: std::fmt::Display + Sized { const SIZE: usize = core::mem::size_of::(); //~^ ERROR the size for values of type `Self` cannot be known at compilation time } fn main() { } ", "positive_passages": [{"docid": "doc-en-rust-d63928979d5904d2065b93b4a136821de3ffe5f7a94c54cab4ca68fb930ed7ea", "text": "The following code errors, and the error contains a suggestion how to fix the error: The error message states: Obviously, writing is invalid syntax.\nIt seems the issue is that it's inserting the suggestion after the trait name and before the generics, rather than after the generics.\nNo-nightly-features code that exhibits the same problem: label -requires-nightly (should the F-labels go as well?)", "commid": "rust_issue_81175", "tokennum": 87}], "negative_passages": []} {"query_id": "q-en-rust-b529e72e51888cdba1bde58fb4733e0b83a8c83302b02c5e7dde86792b882207", "query": "fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/issue-73223.rs:1:11: 1:11 let _1: i32; // in scope 0 at $DIR/issue-73223.rs:2:9: 2:14 let mut _2: std::option::Option; // in scope 0 at $DIR/issue-73223.rs:2:23: 2:30 let mut _1: std::option::Option; // in scope 0 at $DIR/issue-73223.rs:2:23: 2:30 let _2: i32; // in scope 0 at $DIR/issue-73223.rs:3:14: 3:15 let mut _4: (&i32, &i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _5: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _6: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _7: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _8: &std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL let _9: std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL let mut _10: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL let _11: [std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL let mut _12: (&&i32, &&i32); // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL let _13: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _14: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _7: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _8: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _9: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _10: &std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL let _11: std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL let mut _12: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL let _13: [std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL let mut _14: (&&i32, &&i32); // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL let _15: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _16: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL let mut _16: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _17: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL let mut _18: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL scope 1 { debug split => _1; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14 debug split => _2; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14 let _3: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14 scope 3 { debug _prev => _3; // in scope 3 at $DIR/issue-73223.rs:7:9: 7:14 let _5: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let _6: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 4 { debug left_val => _13; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL debug right_val => _15; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL debug left_val => _5; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL debug right_val => _6; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 5 { debug arg0 => _20; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL debug arg1 => _23; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL debug arg0 => _21; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL debug arg1 => _24; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 6 { debug x => _20; // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL debug f => _19; // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL let mut _18: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL let mut _19: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL let mut _20: &&i32; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL debug x => _21; // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL debug f => _20; // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL let mut _19: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL let mut _20: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL let mut _21: &&i32; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL } scope 8 { debug x => _23; // in scope 8 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL debug f => _22; // in scope 8 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL let mut _21: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL let mut _22: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL let mut _23: &&i32; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL debug x => _24; // in scope 8 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL debug f => _23; // in scope 8 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL let mut _22: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL let mut _23: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL let mut _24: &&i32; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL } } scope 10 { debug pieces => (_9.0: &[&str]); // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL debug args => _25; // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL let mut _24: std::option::Option<&[std::fmt::rt::v1::Argument]>; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL let mut _25: &[std::fmt::ArgumentV1]; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL debug pieces => _25; // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL debug args => _27; // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL let mut _25: &[&str]; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL let mut _26: std::option::Option<&[std::fmt::rt::v1::Argument]>; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL let mut _27: &[std::fmt::ArgumentV1]; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL } } } } scope 2 { debug v => _1; // in scope 2 at $DIR/issue-73223.rs:3:14: 3:15 debug v => _2; // in scope 2 at $DIR/issue-73223.rs:3:14: 3:15 } scope 7 { }", "positive_passages": [{"docid": "doc-en-rust-b520ada3e756375b6a9e17f40d71e9d8386987872daac48bdfd5a185c43bfd4c", "text": "This little matrix processing code shows miscompilation if compiled with: But it compiles correctly with: With:\nHmm, on first glance the replacement it performs looks correct: It replaces local () with the return place . Previously the return place was only used in the block by a copy statement, so this transformation should be correct. Maybe this part of the diff causes a problem? We're using our return place as the return destination for the inner call. It's possible that there's an undocumented (and maybe unintended) assumption that the return place is not reused like this, either in other MIR optimizations or in codegen. Haven't looked too deeply yet though.\nAh, there's this bad call in LLVM IR: It passes a reference to as both the return pointer, and the second (immutable) argument.\nwe have this corresponding MIR, where we already incorrectly pass a reference to as an argument, while also assigning the call result to it: The destination propagation pass already has code that prevents merging a call destination with one of the arguments, but here we pass a reference instead. Curiously, the was produced by merging with , which is not really something the pass should be doing since a reference is taken to , and we avoid touching any local that has its address taken.\nThe propagation is disabled only if both locals have their address taken. Changing that to be more conservative does fix this issue. Minimized:\nOof, this should have been an , not an\nThanks\nOpened with a fix", "commid": "rust_issue_77002", "tokennum": 316}], "negative_passages": []} {"query_id": "q-en-rust-b52ab248b9770183be2509cf43fbb0fdde4e445c7e0d5757673ccb25d97dc5ed", "query": "visibilities: FxHashMap, has_pub_restricted: bool, used_imports: FxHashSet, maybe_unused_trait_imports: FxHashSet, maybe_unused_trait_imports: FxIndexSet, maybe_unused_extern_crates: Vec<(LocalDefId, Span)>, /// Privacy errors are delayed until the end in order to deduplicate them.", "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/invalid-const-arg-for-type-param.rs:6:34 | LL | let _: u32 = 5i32.try_into::<32>().unwrap(); | ^^ unexpected const argument error[E0599]: no method named `f` found for type `S` in the current scope --> $DIR/invalid-const-arg-for-type-param.rs:7:7 | LL | struct S; | --------- method `f` not found for this ... LL | S.f::<0>(); | ^ error[E0107]: wrong number of const arguments: expected 0, found 1 --> $DIR/invalid-const-arg-for-type-param.rs:8:9 | LL | S::<0>; | ^ unexpected const argument error: aborting due to 3 previous errors Some errors have detailed explanations: E0107, E0599. For more information about an error, try `rustc --explain E0107`. ", "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-b90bfe035b2ae94704e798a041572266c6c938d00de789c043d7bdfef5ba3a93", "query": " pub trait Example { fn query(self, q: Q); } impl Example for i32 { fn query(self, _: Q) { unimplemented!() } } mod nested { use super::Example; fn example() { 1.query::(\"\") //~^ ERROR the size for values of type `dyn ToString` cannot be known at compilation time //~| ERROR mismatched types } } fn main() {} ", "positive_passages": [{"docid": "doc-en-rust-c16ffc80e3a3c603e6c532b7f32ef5701e33d44873609f2de680f77e6970d3eb", "text": "Issues with this diagnostic: method is not being invoked on a trait object; it's invoked on the concrete value . note suggests importing the same trait that is already being reported about.\n/cc also looks relevant based on the title, but appears to have a different enough error message.\nIs the following output from enough?\nI don't feel like it's at the usual amazing quality . My points still appear to exist: In some magical world, I might hope for something like this (and I'm very flexible in that): I tried to address my points via the s.", "commid": "rust_issue_61525", "tokennum": 120}], "negative_passages": []} {"query_id": "q-en-rust-b90cf12bbd99790609490042295a5cf2b4520351d4f53dafded22becd57d491f", "query": "host: opt_str2(matches.opt_str(\"host\")), gdb_version: extract_gdb_version(matches.opt_str(\"gdb-version\")), lldb_version: extract_lldb_version(matches.opt_str(\"lldb-version\")), llvm_version: matches.opt_str(\"llvm-version\"), android_cross_path: opt_path(matches, \"android-cross-path\"), adb_path: opt_str2(matches.opt_str(\"adb-path\")), adb_test_dir: format!(\"{}/{}\",", "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-b9308d8a4413aef52a36d30fb4d3eb1e218d5a2f1dc896dfe11e0b3251d0b250", "query": ".as_ref() .cloned() .map(|version| (version, true)) .unwrap_or_default(); // `is_present` defaults to `false` here. .unwrap_or_default(); // Miri is nightly-only; never ship it for other trains. // miri needs to build std with xargo, which doesn't allow stable/beta: // if pkgname == \"miri-preview\" && self.rust_release != \"nightly\" { is_present = false; // Pretend the component is entirely missing. is_present = false; // ignore it } let targets = targets.iter().map(|name| { if is_present { // The component generally exists, but it might still be missing for this target. let filename = self.filename(pkgname, name); let digest = match self.digests.remove(&filename) { Some(digest) => digest, // This component does not exist for this target -- skip it. None => return (name.to_string(), Target::unavailable()), }; let xz_filename = filename.replace(\".tar.gz\", \".tar.xz\");", "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-b96b11af50469483682e685ed522643bc8b7683fff6a2cf50e2e07962e666688", "query": "/// [arc]: ../../std/sync/struct.Arc.html /// [ub]: ../../reference/behavior-considered-undefined.html #[stable(feature = \"rust1\", since = \"1.0.0\")] #[cfg_attr(not(test), rustc_diagnostic_item = \"Send\")] #[cfg_attr(all(not(test), bootstrap), rustc_diagnostic_item = \"send_trait\")] #[cfg_attr(all(not(test), not(bootstrap)), rustc_diagnostic_item = \"Send\")] #[rustc_on_unimplemented( message = \"`{Self}` cannot be sent between threads safely\", label = \"`{Self}` cannot be sent between threads safely\"", "positive_passages": [{"docid": "doc-en-rust-cfaca39d58db30574d3a3dbb810a3969303e010eab669341df86cd920d66f197", "text": "I came across this while working on . Sadly I wasn't really able to minimize this. this branch: and go to (but other commits will likely work too). to and paste in the following:\nSee also\nSlightly minimized: place in Then run: will produce the ICE.\nCaused by , cc That PR renames a lot of diagnostic items, but didn't use to gate the name change, so causes breakage when compiling stage 0 std or stage 1 compiler.\nOops, sorry!", "commid": "rust_issue_89775", "tokennum": 104}], "negative_passages": []} {"query_id": "q-en-rust-b9846b3be461196589b859457964674cc0a8b962842d8d4509ec11ad3a6b0319", "query": " error: lifetime must precede `mut` --> $DIR/issue-73568-lifetime-after-mut.rs:2:13 | LL | fn x<'a>(x: &mut 'a i32){} | ^^^^^^^ help: place the lifetime before `mut`: `&'a mut` error[E0178]: expected a path on the left-hand side of `+`, not `&mut 'a` --> $DIR/issue-73568-lifetime-after-mut.rs:14:13 | LL | fn y<'a>(y: &mut 'a + Send) { | ^^^^^^^^^^^^^^ help: try adding parentheses: `&mut ('a + Send)` error: lifetime must precede `mut` --> $DIR/issue-73568-lifetime-after-mut.rs:6:22 | LL | fn w<$lt>(w: &mut $lt i32) {} | ^^^^^^^^ help: place the lifetime before `mut`: `&$lt mut` ... LL | mac!('a); | --------- in this macro invocation | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error[E0423]: expected value, found trait `Send` --> $DIR/issue-73568-lifetime-after-mut.rs:18:28 | LL | let z = y as &mut 'a + Send; | ^^^^ not a value warning: trait objects without an explicit `dyn` are deprecated --> $DIR/issue-73568-lifetime-after-mut.rs:14:18 | LL | fn y<'a>(y: &mut 'a + Send) { | ^^ help: use `dyn`: `dyn 'a` | = note: `#[warn(bare_trait_objects)]` on by default warning: trait objects without an explicit `dyn` are deprecated --> $DIR/issue-73568-lifetime-after-mut.rs:18:23 | LL | let z = y as &mut 'a + Send; | ^^ help: use `dyn`: `dyn 'a` error[E0224]: at least one trait is required for an object type --> $DIR/issue-73568-lifetime-after-mut.rs:14:18 | LL | fn y<'a>(y: &mut 'a + Send) { | ^^ error: aborting due to 5 previous errors; 2 warnings emitted Some errors have detailed explanations: E0178, E0224, E0423. For more information about an error, try `rustc --explain E0178`. ", "positive_passages": [{"docid": "doc-en-rust-5921a7c6dd484fc9e6fdcf6e2ec2469c0b57cfdc1601e76c91294f3f68b13c6b", "text": "Expected result: a diagnostic suggests placing before Actual diagnostic output: { if v > 0xFF { cx.span_err(expr.span, \"too large u8 literal in bytes!\") cx.span_err(expr.span, \"too large u8 literal in bytes!\"); err = true; } else { bytes.push(cx.expr_u8(expr.span, v as u8)); }", "positive_passages": [{"docid": "doc-en-rust-e642ac159a69de10d3b0a6ba42d5ac2a7a78c6f62769cbcf28b388c06bd59f8d", "text": "With landed, the lifetime of is now problematic. Specifically, the following used to work and now fails: The lifetime of is now limited to that branch of the match, so it doesn't live long enough to be assigned to . I'm not sure if this means lifetimes need to change. The other option is that needs to return a . Unfortunately, the only way to do that right now is to make it equivalent to , which makes it no longer usable as the value of a constant (e.g. ). I'm thinking the right solution is to make it legal for me to say . I can type that right now, but the lifetime seems to be wholly ignored, as I get the exact same error with the following as I do with the example above: If becomes a valid expression with the lifetime, then could start evaluating to that and everything should work as expected. Furthermore, it would be nice (but perhaps not required) if , where all elements are compile-time constants, would implicitly be given the lifetime.\n/cc\nYeah, this is kind of annoying. I worked around it in one specific case by having bytes! expand as follows: I certainly think one should be allowed to write a concrete lifetime as part of a slice or borrow expression, and ought to be legal -- we'll obviously have to impose more stringent constant-related rules. In the short term, we could adjust to expand in the pattern I showed above. What was unclear to me was whether this is sufficient workaround, or whether we'll want something more general. Interestingly, even if we used full inference, the expression you gave above would be illegal unless we introduce a special case for static byte strings, because it generates a conditional temporary (only on one arm of the match) and we can't handle the cleanup for such a case without zeroing, which we plan to remove (well, I guess we could also have a special case for temporary types [like ) that do not require drop glue, but I'd rather not).\nPerhaps the simplest fix for now is to adjust the macro itself to expand to a static item as I showed. I should probably have done that more generally but I was ready to land that expletive branch already.\nWon't that prevent from being able to expand to a static?\nI already adjusted like that and is correct, it prevents , which is definitely already used in our codebase.\nAh, unfortunate.", "commid": "rust_issue_11641", "tokennum": 503}], "negative_passages": []} {"query_id": "q-en-rust-b9add3cc034cdb44be3c81a98c6307ce13767f418ed9ac601c11159431c3d108", "query": "// u8 literal, push to vector expression ast::LitUint(v, ast::TyU8) => { if v > 0xFF { cx.span_err(expr.span, \"too large u8 literal in bytes!\") cx.span_err(expr.span, \"too large u8 literal in bytes!\"); err = true; } else { bytes.push(cx.expr_u8(expr.span, v as u8)); }", "positive_passages": [{"docid": "doc-en-rust-780e36a0375361995054b8b4bf9ea85ff24fac4cdeaa8770698d8cf14535f4eb", "text": "(I actually think we should allow statics to include nested blocks with other statics, but I guess that's a separate bug) Well, I'm not sure what's the easiest fix in that case, I guess just to fix the semantics of so that it guarantees static data. I'm not 100% sure what's implied by such a fix: it doesn't seem too hard ;)\ncc", "commid": "rust_issue_11641", "tokennum": 87}], "negative_passages": []} {"query_id": "q-en-rust-b9f62ef6b102e7241e179ecdfff0abebe352f4adbee17201d66b2d3bcae6f61b", "query": " // Test for issues/115517 which is fixed by pull/115486 // This should not ice trait Test {} trait Elide { fn call(); } pub fn test() where (): Test<{ 1 + (<() as Elide(&())>::call) }>, //~^ ERROR cannot capture late-bound lifetime in constant { } fn main() {} ", "positive_passages": [{"docid": "doc-en-rust-e556405fe5a8865793bf339122f016f9c11b17865e682627dddb3e39e00ae238", "text": " $DIR/private-from-crate-level.rs:3:6 | LL | //! [my_module] | ^^^^^^^^^ this item is private | = note: `#[warn(rustdoc::private_intra_doc_links)]` on by default = note: this link will resolve properly if you pass `--document-private-items` warning: 1 warning emitted ", "positive_passages": [{"docid": "doc-en-rust-81020ac5f05e0b544486c0f8dab35120a695e4210ee61eb6cb652a7ed3a24c3d", "text": "It should say instead.\nRelevant code: I think the fix is to use the crate name instead of .\nAlso, I would be curious to see if you can remove altogether by using : That might break renamed modules maybe? I don't remember how modules interact with re-exports.", "commid": "rust_issue_83365", "tokennum": 57}], "negative_passages": []} {"query_id": "q-en-rust-ba4b2dbf8ea9d297c9b68a4c4c21c11ee69a5c9084e433f66014880fe471f8c9", "query": "use crate::flags::{Color, Flags, Warnings}; use crate::util::{exe, output, t}; use once_cell::sync::OnceCell; use semver::Version; use serde::{Deserialize, Deserializer}; use serde_derive::Deserialize;", "positive_passages": [{"docid": "doc-en-rust-b0ce9f73889fb41768327ef0012858de2070cffaeff1e19a7c5b317ca9b71c2e", "text": "I'm trying to build Rust on a Tier 3 platform (; actually it's that's listed in Tier 3, but I don't think that affects the problem). Since there are no snapshots for this platform, I installed rustc from the distro's package manager (apk) and created a file to force using the pre-installed rustc rather than downloading snapshots: And the output of : I ran ; when it got as far as building the core library, I got a series of errors that were very hard to make sense of until I realized that it's because core library code depends on unstable features and I was using a stable rustc to compile it: There were many more errors, but I think they all relate to unstable features. It took me ages to figure out that (for example) the first error is due to the feature being disabled in stable. I understand that the stable compiler won't allow using unstable features even with , but is it possible for the parser to recognize this code even so and reject it with something like \"feature is not enabled\" instead of the much more generic \"expected identifier\" error?\nHuh, usually Rust gets around this by setting , and usually when we bootstrap it's with a beta compiler, which does need that set by , and that would allow all the features. I wonder if wasn't set?\nIt's set, but the command that's actually failing (it took some effort to figure out which executable was actually failing) is: And what's installed for me in is a stable compiler. I realized after the fact that I can't use it to bootstrap, but with a different error message I might have noticed that sooner.\nForwards compatibility in diagnostics seems extremely hard. I think a much simpler and more helpful fix is to check the output of in bootstrap and give a hard error if it's not either the current version or N-1.\nNote that the problem here is that you were trying to use 1.68 to build 1.70; it's unrelated to stable vs beta, the problem is that it was two versions behind instead of only one.\nMentoring instructions: in , if is set, run that process with . Compare that output to the contents of using the crate; if the minor versions aren't either the same or 1 apart, give a hard error. Note that this should also disallow e.g.", "commid": "rust_issue_110067", "tokennum": 514}], "negative_passages": []} {"query_id": "q-en-rust-ba4b2dbf8ea9d297c9b68a4c4c21c11ee69a5c9084e433f66014880fe471f8c9", "query": "use crate::flags::{Color, Flags, Warnings}; use crate::util::{exe, output, t}; use once_cell::sync::OnceCell; use semver::Version; use serde::{Deserialize, Deserializer}; use serde_derive::Deserialize;", "positive_passages": [{"docid": "doc-en-rust-cb864ca747ed3164bf447cc2573dfcf2a0f8ad3b68ed7b7a37fcb4b4656d8418", "text": "building 1.68 with 1.69; we use deny-warnings in most cases and have no guarantees that unstable features will be the same between releases. Only building 1.68 with 1.67 or 1.68 should be allowed.\nbtw I've noticed you running into a few different bootstrap bugs the past few days \u2014 reading through https://rustc-dev- may or may not make it easier to diagnose these issues without having to spend ages interpreting the diagnostics. I'm also happy to chat about \"how should this work\" sorts of things .\nYes, I've read that. Thanks!\nThe error message could be improved though. Maybe one could make the to put into libcore/bootstrap's\nI don't think rust-version is a good way to solve this, no - that won't give a warning or error if you use a future version to compile an older version. Also it won't be able to catch local-rebuild issues where the nightly version of the bootstrap compiler is too old. See my suggestion in\nHmm, I'm afraid I might have said something unclear. I'm not asking for forward compatibility in diagnostics. The feature was in version 1.68.0, according to , and I was using rustc version 1.68.2. So it should \"know\" about that feature, but my understanding is that when I was invoking rustc it was with flags that prevent unstable features from being used.\nhmm, in that case something strange is going on because playground gives a much more reasonable error than the one you saw:\nwhat commit of rustc were you trying to build when you got this error? I'm going to see if I can replicate it locally.\nI was trying to build .\nAh ok, it was related to the context of the closure: If you look at the same gist with beta, the error message is much better: So I think this particular diagnostic issue has already been fixed. I still want to keep this issue open to track checking the version of the bootstrap compiler, though.", "commid": "rust_issue_110067", "tokennum": 437}], "negative_passages": []} {"query_id": "q-en-rust-ba58b088c1166613d856c2cbb058085702d56478783a39c9dab77400a8be5fe5", "query": " // Regression test for . #![no_core] #![feature(no_core)] // @has \"$.index[*][?(@.name=='ParseError')]\" // @has \"$.index[*][?(@.name=='UnexpectedEndTag')]\" // @is \"$.index[*][?(@.name=='UnexpectedEndTag')].inner.variant_kind\" '\"tuple\"' // @is \"$.index[*][?(@.name=='UnexpectedEndTag')].inner.variant_inner\" [null] pub enum ParseError { UnexpectedEndTag(#[doc(hidden)] u32), } ", "positive_passages": [{"docid": "doc-en-rust-391275bcc7fd56135dc48cca580fbec31af3bb7336ffb76edd332ec906ab494a", "text": "At some point their should also be a for , and probably a way to tell what position each of the non stripped items are, as currently each of these 3 variants are documented with the same inner. but HTML gets a good representation: The solution is probably to do what we do for structs, and store the , and a , such that each field of a varient gets an to hold the . We also should have a numfields, as even in that schema, you can't tell the difference between This also effects struct AFAIKT. I don't think this needs to be done now. I'll file an issue for it. Originally posted by in modify labels: +A-rustdoc-json +T-rustdoc\nRelated:", "commid": "rust_issue_100587", "tokennum": 161}], "negative_passages": []} {"query_id": "q-en-rust-ba5c13c45ab8b7896a804ffffb7419dcb51d1aedbb76acfa223c9789b3fbcf27", "query": "let f1: f64 = FromStrRadix::from_str_radix(\"1p-123\", 16).unwrap(); let f2: f64 = FromStrRadix::from_str_radix(\"1p-111\", 16).unwrap(); let f3: f64 = FromStrRadix::from_str_radix(\"1.Cp-12\", 16).unwrap(); assert_eq!(Float::ldexp(1f64, -123), f1); assert_eq!(Float::ldexp(1f64, -111), f2); assert_eq!(1f64.ldexp(-123), f1); assert_eq!(1f64.ldexp(-111), f2); assert_eq!(Float::ldexp(1.75f64, -12), f3); assert_eq!(Float::ldexp(0f64, -123), 0f64);", "positive_passages": [{"docid": "doc-en-rust-a8428518f58889c453ca1290dddadd0e3e28c9b7077914cbfb5ede869ab2b772", "text": "has an unusual format: it takes as it's first parameter where everything else in the trait takes . It should take as it's first parameter for consistency with everything else. It is located in \n+1. There are a few different things to consider here, though: does not operate on any FP number per se like most other operations do, but rather constructs a new FP number from two arguments one of which happens to be FP number. This function\u2019s signature is consistent with most other methods that construct some kind of FP number (e.g. ). We might want to consider whether methods such as shouldn\u2019t just go ahead and take instead. can\u2019t currently be chained, but I see literally 0 cases where anybody would chain this function. cc\nOkay, but from a consistency standpoint, it's like 1/80 for vs . It it keeps the same format, it and it's similar functions would probably be better to go at the end or beginning of the function list where they won't be so unusual.\nNominating for 1.0-beta P-backcompat-libs\nOne should be able to call this thing as a method, one way or another. We need to make sure that is resolved.\n0 beta, P-backcompat-libs\nI started to fix this.", "commid": "rust_issue_22098", "tokennum": 277}], "negative_passages": []} {"query_id": "q-en-rust-ba7fae723f17a78362c8199f34d4f530588fed140a192d452d0b919e44db4d5f", "query": "} if !provided.is_empty() { write!(w, \"

Provided Methods

Provided Methods

\")?; for m in &provided {", "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-ba833a948cf08c1014b53d2988926f7e3123fbcad7da37bfa8eed7cedc447342", "query": "} else { \"traits define\" }, action = if let Some(param) = param_type { format!(\"restrict type parameter `{}` with\", param) } else { \"implement\".to_string() }, action = action, one_of_them = if candidates.len() == 1 { \"it\" } else {", "positive_passages": [{"docid": "doc-en-rust-535353bdfb3d3e5ccefea87e0d54068dc3ecfb7c686a60b3a012fad9cbb5afa0", "text": "The following example code yields an error: It's unclear from this error message how to proceed - I'm not sure of the syntax, location, or where I should be putting the \"GetString\" trait bound. It should be shown with a better example or link when this error is presented, as the current message is not sufficient for a resolution to be arrived at.\ncc\nFixing in . To fix your code write:\nThanks!", "commid": "rust_issue_65044", "tokennum": 89}], "negative_passages": []} {"query_id": "q-en-rust-baa10aab70912d058eeb8e8263b9f873cc0e76c1c3c07411335b833a3e3af257", "query": " // run-pass #![feature(or_patterns)] fn main() { assert!(f(\"\", 0)); assert!(f(\"a\", 1)); assert!(f(\"b\", 1)); assert!(!f(\"\", 1)); assert!(!f(\"a\", 0)); assert!(!f(\"b\", 0)); assert!(!f(\"asdf\", 32)); //// assert!(!g(true, true, true)); assert!(!g(false, true, true)); assert!(!g(true, false, true)); assert!(!g(false, false, true)); assert!(!g(true, true, false)); assert!(g(false, true, false)); assert!(g(true, false, false)); assert!(g(false, false, false)); //// assert!(!h(true, true, true)); assert!(!h(false, true, true)); assert!(!h(true, false, true)); assert!(!h(false, false, true)); assert!(!h(true, true, false)); assert!(h(false, true, false)); assert!(h(true, false, false)); assert!(h(false, false, false)); } fn f(s: &str, num: usize) -> bool { match (s, num) { (\"\", 0) | (\"a\" | \"b\", 1) => true, _ => false, } } fn g(x: bool, y: bool, z: bool) -> bool { match (x, y, x, z) { (true | false, false, true, false) => true, (false, true | false, true | false, false) => true, (true | false, true | false, true | false, true) => false, (true, true | false, true | false, false) => false, } } fn h(x: bool, y: bool, z: bool) -> bool { match (x, (y, (x, (z,)))) { (true | false, (false, (true, (false,)))) => true, (false, (true | false, (true | false, (false,)))) => true, (true | false, (true | false, (true | false, (true,)))) => false, (true, (true | false, (true | false, (false,)))) => false, } } ", "positive_passages": [{"docid": "doc-en-rust-00ed6046d6460c53338f5479c0d9e6c21b89dda4070501d4a4e29c8ac9f59775", "text": "When using the feature, attempting to match on a tuple creates a compiler panic. The following code causes the panic. (Also available at the ) This occurs both on the playground and on my local machine on a previous version (details below). Rust version from the playground: Local version: Playground backtrace: Local backtrace: EDIT: Added local machine backtrace too\nIt looks like the problem is here in . The call to seems to rely on the invariant that the match pairs have been fully simplified at this point, but are a special case and can still show up here.\nReproducible with recent nightlies too: : Triggered by more than 3 pattern condition with this compiler version.\nI would have assumed that the implementation merely desugars into a bunch of top-level or-patterns. Is that not the case? Why are tuples special cased? If it isn't too involved, I could take a crack at this with some guidance... very much want to see this over the finish line.", "commid": "rust_issue_72680", "tokennum": 210}], "negative_passages": []} {"query_id": "q-en-rust-baa2502cdf6d39f365aba4b73251991ec79f1fc87d118d581a2a0a4fc82530c9", "query": " Subproject commit d9e7d2696e41983b6b5a0b4fac604b4e548a84d3 Subproject commit c7a16bd57c2a9c643a52f0cebecdaf0b6a996da1 ", "positive_passages": [{"docid": "doc-en-rust-2d8db29441fd3de139df7d18a731cc7263283de0404428de8779d93e4d4510ef", "text": "Was looking at the printout of llvm passes when I noticed that the functions that was inlined everywhere, and due to this was dead code, was optimized more after inlining. So as a test I at the line and this reduces the compile time of release build in racer by an average of 23%. I do not know if this is a good place to add this extra pass but maybe someone that knows how llvm works can use this information to speedup the compilation of release builds. was also wondering how this works in MIR I see that there is an inline pass but I can not find any dead code elimination\nthe stage1 compilation of rustc went from 828.89 to 691.75 secs with this fix on my computer but that is only a 15% improvement\n15% is pretty significant.\nWow, great work!\nThat's some nice improvements! If you feel up to it, go ahead an submit a pull request with your suggested changes. That way someone with experience with LLVM is guaranteed to look at the patch and it won't get lost.\nI believe the PR should be targeted at\n:+1: If you want to push through this patch the general process works like this: Submit the patch against the currently active branch of (which is at the moment) Wait for it to get reviewed & merged Submit a pull request against which updates the submodule. If you have any questions about the process or want someone else to do this, just mention it here or contact me or someone else on one of the .\ncc\ncc\nIdeally, the process should include discussion with upstream LLVM too.\nUnfortunately it looks like we were a bit too eager to close this in :(\nFrom what I have learned from the llvm maintainers I think that we have received the improvement that can be expected. The to good to be true improvements I measured was probably due to less optimizations was possible and resulted in less optimized code.", "commid": "rust_issue_44655", "tokennum": 404}], "negative_passages": []} {"query_id": "q-en-rust-baa3974c1aafa6eed2bf52d0fffbcc14b6bdf3d4e33fe53ef344d4b0954956d3", "query": "/// # Example /// /// ```rust /// # #![allow(deprecated)] /// use url::get_scheme; /// /// let scheme = match get_scheme(\"https://example.com/\") {", "positive_passages": [{"docid": "doc-en-rust-6c869a2cbace9b7640c821d2417335cc2c0b47eb4e792049d3fd0b2026b60232", "text": "The common fix for , , and is to rewrite the module based on the spec at and the tests at (Note: the tests assume the API, designed for JavaScript in web browsers. We do not necessarily want the same API for Rust outside of testing code.)\nI'm interested in this\nI have a work-in-progress implementation. I\u2019ll publish it later today so you can pick it up if you want.\nHere it is: Note that I\u2019m targeting Rust , the version used in Servo. (Though there is an upgrade being worked on.) IDNA and the actual URL parser are not there yet, but everything else (host/domain/ipv6, , percent encoding, test harness) is there. This should start being useful as soon as the URL parser is . The host parser returns an error on non-ASCII domains. This is good enough for now, IDNA support can be later. also made an in-progress implementation: It has some known bugs ( is incorrect with non-ASCII input, at least) but the parser code can probably be reused.\nAlso, be aware that the URL spec itself is still moving and has a number of open bugs:\nI Punycode encoding and decoding (with tests) to but not Nameprep, which is the other big part of IDNA.\nis now (IMHO) ready to replace . It is not \"done\" yet (some bugs remain, including in the spec!), but at this point it has more than feature-parity and is probably correct in more corner cases. Given the current tendency to move things out of , rust-url probably shouldn\u2019t move in. It could be distributed with rustc like the rest of the modules moving out of extra, but this has the downside of tying rust-url upgrades to compiler upgrades, and only weak advantages IMO. So, whenever the Rust team decides it\u2019s appropriate, I suggest removing and recommending rust-url as a replacement.\nI would generally be in favor of a in the distribution for now. This would certainly not be a package in long-term, but for now putting everything in this repo is the ad-hoc solution we have until we get a real package manager.\nIn that case, I\u2019d like to iterate a bit on rust-url (port rust-http and Servo to it, \u2026) before it moves into the distribution. Also, rust-url depends on rust-encoding, which I guess would have to move as well.", "commid": "rust_issue_10707", "tokennum": 536}], "negative_passages": []} {"query_id": "q-en-rust-baa3974c1aafa6eed2bf52d0fffbcc14b6bdf3d4e33fe53ef344d4b0954956d3", "query": "/// # Example /// /// ```rust /// # #![allow(deprecated)] /// use url::get_scheme; /// /// let scheme = match get_scheme(\"https://example.com/\") {", "positive_passages": [{"docid": "doc-en-rust-c6d46fb8c935676ed68e14ed1daa73769f5da4d7735333ff9fb7452a10a97b66", "text": "I\u2019d say rust-url is now in \"beta\" state. I have branches of rust-http and Servo using it: It builds with Cargo. It depends on rust-encoding (which also builds with Cargo), but for something non-essential that could be deactivated if avoiding the additional dependency helps. I\u2019d like people to start using it and give feedback. I think the best way to do that is to get rid of the old liburl. I\u2019ll go through the RFC process, but before that, what would you prefer? Replace liburl with snapshots[] of rust-url. You were in favor of this in February, but Cargo has reached alpha since then. Just remove liburl, and tell people to use rust-url through Cargo. Something else? [] In any case, I\u2019d like to keep a separate rust-url repository that I can update in Servo independently of language upgrades.\n+1 on removing liburl. Thanks\nPerhaps we can deprecate all of liburl for one release cycle.\nThis seems like a great place to let cargo shine.\nDeprecating sounds reasonable. That means emitting warnings by default, right?\nawesome work! I agree with and that I think this is where cargo shines, and we can probably just remove liburl entirely without re-adding rust-url. We can also try to grow more official support for it in terms of documentation and automation (not present currently). We can mark liburl as with a message to use instead which should ferry everyone along quickly.", "commid": "rust_issue_10707", "tokennum": 333}], "negative_passages": []} {"query_id": "q-en-rust-bad162fec8d1bf113f1d275ed9f38061be25a4c09e846e5f1ecb6598d3b08f4b", "query": " // check-pass trait Identity { type T; } impl Identity for T { type T = T; } trait Holds { type Q; } struct S; struct X(S); struct XHelper; impl Holds for X { type Q = XHelper; } impl Clone for X where >::T: Clone, X: Holds, { fn clone(&self) -> Self { Self(self.0.clone()) } } fn main() {} ", "positive_passages": [{"docid": "doc-en-rust-71b0b3759ab65d55872300b2e31707587c6b35ae4ebfcbc7b4efe6636becb2c5", "text": " $DIR/issue-17800.rs:18:28 | LL | MyOption::MySome { x: 42 } => (), | ^^^^^ variant `MyOption::MySome` does not have this field | ^^^^^ | | | variant `MyOption::MySome` does not have this field | help: did you mean: `0` error[E0027]: pattern does not mention field `0` --> $DIR/issue-17800.rs:18:9 | LL | MyOption::MySome { x: 42 } => (), | ^^^^^^^^^^^^^^^^^^^^^^^^^^ missing field `0` | = note: trying to match a tuple variant with a struct variant pattern error: aborting due to 2 previous errors error: aborting due to previous error Some errors occurred: E0026, E0027. For more information about an error, try `rustc --explain E0026`. For more information about this error, try `rustc --explain E0026`. ", "positive_passages": [{"docid": "doc-en-rust-065b1609592312bc44293dae2015cebcd327e0d286ff073b36a58da689c9b13e", "text": "With a single typo in a match arm, we generate three separate errors: We should collect all these errors into a single diagnostic:\ncould you share sample code to exactly reproduce above diagnostic?\nI will raise another PR to address the case where we are unnecessarily throwing .", "commid": "rust_issue_52717", "tokennum": 57}], "negative_passages": []} {"query_id": "q-en-rust-bc0c0779bcffc258c753d58e476493aa64cdc784bb91cf964d616e2cd16b30c8", "query": "``` \"##, //NB: not currently reachable E0247: r##\" This error indicates an attempt to use a module name where a type is expected. For example: ``` mod MyMod { mod MySubMod { } } fn do_something(x: MyMod::MySubMod) { } ``` In this example, we're attempting to take a parameter of type `MyMod::MySubMod` in the do_something function. This is not legal: `MyMod::MySubMod` is a module name, not a type. \"##, E0248: r##\" This error indicates an attempt to use a value where a type is expected. For example:", "positive_passages": [{"docid": "doc-en-rust-8b39ad656a607f3b3bd21f65530e4e486279bb1e38914d8a859cfe66b5c33a86", "text": "rustc crashes when compiling the following source code. I expect this to compile or report error. Instead the compiler crashed.\nReduced testcase:\nThis also causes an ICE with the latest nightly:\nAny update on the issue. Please let me know if you need more information. Thanks", "commid": "rust_issue_30535", "tokennum": 56}], "negative_passages": []} {"query_id": "q-en-rust-bc3cac2d7f11834ddeefc7f32313e26d6f3f67befbdde5aa8f2f0b2436a86821", "query": "return; } let self_contained_linker = sess.opts.cg.link_self_contained.linker(); // FIXME: some targets default to using `lld`, but users can only override the linker on the CLI // and cannot yet select the precise linker flavor to opt out of that. See for example issue // #113597 for the `thumbv6m-none-eabi` target: a driver is used, and its default linker // conflicts with the target's flavor, causing unexpected arguments being passed. // // Until the new `LinkerFlavor`-like CLI options are stabilized, we only adopt MCP510's behavior // if its dedicated unstable CLI flags are used, to keep the current sub-optimal stable // behavior. let using_mcp510 = self_contained_linker || sess.opts.cg.linker_flavor.is_some_and(|f| f.is_unstable()); if !using_mcp510 && !unstable_use_lld { return; } // 1. Implement the \"self-contained\" part of this feature by adding rustc distribution // directories to the tool's search path. let self_contained_linker = sess.opts.cg.link_self_contained.linker() || unstable_use_lld; if self_contained_linker { if self_contained_linker || unstable_use_lld { for path in sess.get_tools_search_paths(false) { cmd.arg({ let mut arg = OsString::from(\"-B\");", "positive_passages": [{"docid": "doc-en-rust-58f74fdbee1b8b192507a472e58efa65c0bb00ebfc7d79b9f4e2ab6c69a64cc5", "text": "The CI tests building with all our supported linkers: Rust's provided , ARM GCC's , and ARM GCC's . It recently encountered an error when using in nightly builds since . The most likely culprit is that the failing version has started to the linker arguments, which was not present in previous working versions. I wonder if we're meant to be adding some other argument to disable adding ? The error occurs with the cortex-m-rt CI and can be reproduced like so: Or viewed in CI . The error is: nightly-2023-07-02 nightly-2023-07-03 bisected to from PR modify labels: +regression-from-stable-to-nightly -regression-untriaged\nshows that the default for the target is rust-lld. i wonder if the new code uses the default instead of the linker in -C linker for some reason?\nYou were not meant to do anything, sorry about that. I'll fix it.\nI can't build a toolchain locally, via , which would be complete enough for this test to build. There are issues about missing core/std. I tried on a example, and can also reproduce the issue and investigate more there, and that and work. The code I in is asked to add CLI arguments for a flavor: this asks to link using via a c/c++ compiler, and why is . I assume that flavor is incorrect when using ? (I don't know who the target maintainers are, so I'll also ping the other 2 people involved in : and still work because they result in a non- request, and we don't do anything there as expected. For my own understanding: does use by default maybe ? And if so, I'd expect that explicitly specifying the linker would also fix the issue, \u00e0 la which seems to work for me ? I'll look into why this surprising flavor is used in this situation, as it seems to be the pre-existing issue here uncovered by the PR, and report back. It could be an issue in the flavor inference, or some information missing in the targets' definitions, and so on.\nTechnically, the target builds. As a tier 2 target, we would strongly prefer it to not require additional antics to build. There was but I have taken lqd's remarks that this may be just exposed preexisting problems as a reason to set it slightly lower.", "commid": "rust_issue_113597", "tokennum": 513}], "negative_passages": []} {"query_id": "q-en-rust-bc3cac2d7f11834ddeefc7f32313e26d6f3f67befbdde5aa8f2f0b2436a86821", "query": "return; } let self_contained_linker = sess.opts.cg.link_self_contained.linker(); // FIXME: some targets default to using `lld`, but users can only override the linker on the CLI // and cannot yet select the precise linker flavor to opt out of that. See for example issue // #113597 for the `thumbv6m-none-eabi` target: a driver is used, and its default linker // conflicts with the target's flavor, causing unexpected arguments being passed. // // Until the new `LinkerFlavor`-like CLI options are stabilized, we only adopt MCP510's behavior // if its dedicated unstable CLI flags are used, to keep the current sub-optimal stable // behavior. let using_mcp510 = self_contained_linker || sess.opts.cg.linker_flavor.is_some_and(|f| f.is_unstable()); if !using_mcp510 && !unstable_use_lld { return; } // 1. Implement the \"self-contained\" part of this feature by adding rustc distribution // directories to the tool's search path. let self_contained_linker = sess.opts.cg.link_self_contained.linker() || unstable_use_lld; if self_contained_linker { if self_contained_linker || unstable_use_lld { for path in sess.get_tools_search_paths(false) { cmd.arg({ let mut arg = OsString::from(\"-B\");", "positive_passages": [{"docid": "doc-en-rust-1fc6af5ad7bb2234e40638e9d8b93e4c20464b340bd58127f4d5d700fcf92cb9", "text": "The linker flavor used is a mix between what can be inferred from the CLI () and the target's default linker flavor: there is no linker flavor on the CLI (and that also offers another workaround on nightly: ), so it will have to be inferred to . in infers a cc hint, and no hint about lld. the target's is combined in with these hints. We have our , but there is no hint about lld, . It's . so we now have our flavor is the linker people are expected to use on supposed to be some ? Is the default linker and flavor in correct ? In the meantime, I'll see to change this so that the lld flags are only when the unstable MCP510 options are used, to keep this stable and unfortunate behavior unchanged when the CLI and target conflict instead of compose.\nThanks for looking into this quickly! Most people building for will use the default linker today. It works fine for (I believe) all Rust-only projects. However, it's not uncommon to use , maybe to use specific GCC linker script directives, or just when hunting down linker-related bugs. For both of those use cases there's no problem with nightly, and I think the default in thumb_base is therefore fine. Some people do need to use when linking with pre-compiled C libraries - I understand that using gcc pulls in a target specific libc, and a lot of pre-compiled C libraries will be trying to link against symbols it exports which Rust doesn't. I believe does delegate to . Passing either or does work to get a build without errors, though I don't have a test case handy to check it's actually getting what people need out of . I'll try and dig around a bit more for the specific use cases where it's required over .\nMy main recollection is that gcc requires you to put in front of your linker arguments and using ld directly you don't But I think and friends are gcc options not ld options so maybe ld won't bring in libc and the C startup automatically. I'll test it out shortly.\nmain.c: Compile object code: Link with GCC: Link with ld: This does imply that for trivial invocations will include both the default start code (which provides ) and newlib (the C library), whilst will not.", "commid": "rust_issue_113597", "tokennum": 512}], "negative_passages": []} {"query_id": "q-en-rust-bc3cac2d7f11834ddeefc7f32313e26d6f3f67befbdde5aa8f2f0b2436a86821", "query": "return; } let self_contained_linker = sess.opts.cg.link_self_contained.linker(); // FIXME: some targets default to using `lld`, but users can only override the linker on the CLI // and cannot yet select the precise linker flavor to opt out of that. See for example issue // #113597 for the `thumbv6m-none-eabi` target: a driver is used, and its default linker // conflicts with the target's flavor, causing unexpected arguments being passed. // // Until the new `LinkerFlavor`-like CLI options are stabilized, we only adopt MCP510's behavior // if its dedicated unstable CLI flags are used, to keep the current sub-optimal stable // behavior. let using_mcp510 = self_contained_linker || sess.opts.cg.linker_flavor.is_some_and(|f| f.is_unstable()); if !using_mcp510 && !unstable_use_lld { return; } // 1. Implement the \"self-contained\" part of this feature by adding rustc distribution // directories to the tool's search path. let self_contained_linker = sess.opts.cg.link_self_contained.linker() || unstable_use_lld; if self_contained_linker { if self_contained_linker || unstable_use_lld { for path in sess.get_tools_search_paths(false) { cmd.arg({ let mut arg = OsString::from(\"-B\");", "positive_passages": [{"docid": "doc-en-rust-f6f49b9a448a051b68e840e0ce8da7daaf5904a8e0d4f7433589511459c150ef", "text": "See also , where I set the default target for bare-metal SPARC to be gcc, precisely because the default libraries it links in are so useful - they include not only the start-up code (no idea how that works, didn't need to find out) but also a C library for talking to the stdout of a popular SPARC CPU emulator. So, yeah, GCC is a really useful linker driver in some scenarios and we don't want to stop that from working.\nThanks for the information, it's very helpful. The good news is that using GCC as a linker is still working . In the future where we switch to lld, maybe rustc will also need an explicit linker flavor here, to make sure the flavor it guesses actually matches your expectations. But that's a topic for another day/stabilization: in the more immediate future, things will return to normal for the target and 's tests in a day or two.\nThank you! Just to come back to this point: I was under the impression that Arm Ltd were maintaining the targets. However, they don't appear to have the platform-support documentation that is required for more recently targets. Maybe that could be addressed.\nThis is now on beta, reopening to track backport.\nPursuant to your concern I have opened to summarize the issue that affects indeed all our tier 2 targets.\nThe backport of has landed on beta in We can close this issue as fixed.", "commid": "rust_issue_113597", "tokennum": 309}], "negative_passages": []} {"query_id": "q-en-rust-bc70cf0e446be054b6b319509f0da9558c102e6e99eabca9b1d7d311b3818576", "query": ".next() .map_or(false, |c| c.is_ascii_uppercase()) { (format!(\"use of undeclared type `{}`\", ident), None) // Check whether the name refers to an item in the value namespace. let suggestion = if ribs.is_some() { let match_span = match self.resolve_ident_in_lexical_scope( ident, ValueNS, parent_scope, None, path_span, &ribs.unwrap()[ValueNS], ) { // Name matches a local variable. For example: // ``` // fn f() { // let Foo: &str = \"\"; // println!(\"{}\", Foo::Bar); // Name refers to local // // variable `Foo`. // } // ``` Some(LexicalScopeBinding::Res(Res::Local(id))) => { Some(*self.pat_span_map.get(&id).unwrap()) } // Name matches item from a local name binding // created by `use` declaration. For example: // ``` // pub Foo: &str = \"\"; // // mod submod { // use super::Foo; // println!(\"{}\", Foo::Bar); // Name refers to local // // binding `Foo`. // } // ``` Some(LexicalScopeBinding::Item(name_binding)) => { Some(name_binding.span) } _ => None, }; if let Some(span) = match_span { Some(( vec![(span, String::from(\"\"))], format!(\"`{}` is defined here, but is not a type\", ident), Applicability::MaybeIncorrect, )) } else { None } } else { None }; (format!(\"use of undeclared type `{}`\", ident), suggestion) } else { (format!(\"use of undeclared crate or module `{}`\", ident), None) }", "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/alias-bounds-when-not-wf.rs:3:12 | LL | #![feature(lazy_type_alias)] | ^^^^^^^^^^^^^^^ | = note: see issue #112792 for more information = note: `#[warn(incomplete_features)]` on by default error: the type `W>` is not well-formed --> $DIR/alias-bounds-when-not-wf.rs:16:13 | LL | fn hello(_: W>) {} | ^^^^^^^^^^^ error: aborting due to 1 previous error; 1 warning emitted ", "positive_passages": [{"docid": "doc-en-rust-528d884974dbbb21b0681156f6ad2cfef17bb8e29ead73a20d200411cda18e55", "text": " $DIR/test-compile-fail1.rs:8:1 | 6 | pub fn f() {} | ---------- previous definition of the value `f` here 7 | 8 | pub fn f() {} | ^^^^^^^^^^ `f` redefined here | = note: `f` must be defined only once in the value namespace of this module error: aborting due to previous error For more information about this error, try `rustc --explain E0428`. ", "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-bd8314732989e38719c888c03ebe6b03e87ad1ef2f90c26583ed3be69bc29d23", "query": " error[E0428]: the name `f` is defined multiple times --> $DIR/test-compile-fail1.rs:8:1 | 6 | pub fn f() {} | ---------- previous definition of the value `f` here 7 | 8 | pub fn f() {} | ^^^^^^^^^^ `f` redefined here | = note: `f` must be defined only once in the value namespace of this module error: aborting due to previous error For more information about this error, try `rustc --explain E0428`. ", "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-be2028a0f941b5069dccdee8075680466fd801a87355908eb013616b00878dd7", "query": "target_val!(data_layout); target_option_val!(is_builtin); target_option_val!(endian, \"target_endian\"); target_option_val!(c_int_width, \"target_c_int_width\"); target_option_val!(endian, \"target-endian\"); target_option_val!(c_int_width, \"target-c-int-width\"); target_option_val!(os); target_option_val!(env); target_option_val!(vendor);", "positive_passages": [{"docid": "doc-en-rust-0ac35f07241d5c8d57b57a971703b047ddc49ae8dfe9c6f9135f10ede69778ce", "text": "Hello everyone, this is my first Issue on the Rust project, let me know if I'm doing anthing wrong ! I am in the process of building a library/runtime for the Wii fully written in Rust. To acheive this goal, I need to cross-compile my library to a custom target I named . The json file contains and along other lines to define the architecture. Normally, the build completes without an issue. On the latest nighlty, the compiler fails and return: Of course, is set to in the file, so this shouldn't happen. It most recently worked on: : It fails on this nightly, currently latest at the time of writing: : I can provide any file or other precision if necessary ! Thanks for reading my report !\nI was also having the some issue and tracked it to this: That commit broke the equivalence between \"target_endian\" and \"target-endian\" by adding a case to the macro without the replace line for it.\ncc\nI'll fix this today.\nFixed in\nI hope this gets merged asap :-)\n(Reopening because isn't merged yet.)", "commid": "rust_issue_78981", "tokennum": 237}], "negative_passages": []} {"query_id": "q-en-rust-be23100b70bdf2a64c990b56670b2ede3a6cf4a2692045baa70e8cfe251dbe1f", "query": "infer::IfExpression(_) => { format!(\"if and else have compatible types\") } infer::IfExpressionWithNoElse(_) => { format!(\"if may be missing an else clause\") } }; match self.values_str(&trace.values) {", "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-be57cf6c4dc1f782cb0d63e0edee6551c0d64dada93dbe8c5867f0119c3519c3", "query": "-include ../tools.mk # This test makes sure that indirect call promotion is performed. The test # programs calls the same function a thousand times through a function pointer. # Only PGO data provides the information that it actually always is the same # function. We verify that the indirect call promotion pass inserts a check # whether it can make a direct call instead of the indirect call. # LLVM doesn't support instrumenting binaries that use SEH: # https://github.com/rust-lang/rust/issues/61002 # # Things work fine with -Cpanic=abort though. ifdef IS_MSVC COMMON_FLAGS=-Cpanic=abort endif all: # We don't compile `opaque` with either optimizations or instrumentation. # We don't compile `opaque` with either optimizations or instrumentation.", "positive_passages": [{"docid": "doc-en-rust-06c52e151a7bd517a82a705457b19a4a0c0dcbd3002858a1b249f55728f37234", "text": "LLVM's \"IR-level\" instrumentation, which is used by to generate PGO instrumented binaries, does not yet work with exception handling on Windows MSVC. The problem has been reported to LLVM for C++ here: This also affects Rust programs built with for Windows MSVC. As long as LLVM does not support exception handling there, it is a known limitation that PGO can only be used with on this platform.\nPGO does not yet work on for other reasons (see ). Once it does, we should check if this problem is specific to MSVC.\nI have working x86_64 windows-gnu (64 bit builds use SEH) build with PGO I'll open PR once is merged. I can do testing in meantime. FWIW simple hello world example works fine after going through PGO.\nif you test, be sure to compile your LLVM with assertions: Thanks for looking into it!\nI'll recompile it with assertions today later. Should the test case be using any specific code like ?\nThe following test case runs into the problem with MSVC: See for how the file is compiled.\nIt does not reproduce with gnu toolchain with Rust and LLVM assertions enabled, I'll try to remember about fixing along with gnu profiler.\nCool!\nI just confirmed that (for me locally) PGO seems to work on Windows GNU. That is, I built with instrumentation, ran it, and rebuilt it with the profiling data collected. It worked just fine, no crashes. So I updated the original issue text to just mention MSVC instead of Windows in general.\nIt looks like is a bit too aggressive with its error reporting. For example when invoking rustc, but not compiling in our Firefox build we can the following : I'm not sure the best solution while mw is away; perhaps we should revert for now.\nMaybe we can just convert the error to a warning?\nNot the best long-term solution but seems ok\nIt looks like the was marked fixed a year ago. What's the status of this issue in rustc?", "commid": "rust_issue_61002", "tokennum": 444}], "negative_passages": []} {"query_id": "q-en-rust-beb9e940b0cce4a1f23ffdc4bfe00d9e83668da50c0783d94833d1c49f52f598", "query": "_marker: PhantomData<&'f mut &'f c_void>, } /// s390x ABI implementation of a `va_list`. #[cfg(target_arch = \"s390x\")] #[repr(C)] #[derive(Debug)] #[unstable( feature = \"c_variadic\", reason = \"the `c_variadic` feature has not been properly tested on all supported platforms\", issue = \"44930\" )] #[lang = \"va_list\"] pub struct VaListImpl<'f> { gpr: i64, fpr: i64, overflow_arg_area: *mut c_void, reg_save_area: *mut c_void, _marker: PhantomData<&'f mut &'f c_void>, } /// x86_64 ABI implementation of a `va_list`. #[cfg(all(target_arch = \"x86_64\", not(target_os = \"uefi\"), not(windows)))] #[repr(C)]", "positive_passages": [{"docid": "doc-en-rust-3b6d37b85b87809961d13b3aacfc8af720541aa3d2f65107747ed4cabb9e1826", "text": "fails this test on native : (This is not a new failure, but I am cleaning up issues from downstream Red Hat bugzilla.)\nWe started discussing this in , and looking at the clang implementation here: I tried that minimal step with , but it still gives the same \"Cannot select\" error. I don't see any lowering of in like other targets, only stuff implementing the calling convention. So I guess we do need custom support, or perhaps the clang bits could be moved down into the LLVM lowering?\nHi , I ran into the same problem and noticed you had already opened an issue. I've now submitted a PR to implement valist and vaarg for s390x to fix this.", "commid": "rust_issue_84628", "tokennum": 150}], "negative_passages": []} {"query_id": "q-en-rust-beed7f2c50eb90b6312c836d9fda65bf413d73b669e2e1b1490edc5a28ba2e49", "query": "// memmove back untouched tail, update to new length let start = source_vec.len(); let tail = self.tail_start; let src = source_vec.as_ptr().offset(tail as isize); let dst = source_vec.as_mut_ptr().offset(start as isize); ptr::copy(src, dst, self.tail_len); if tail != start { let src = source_vec.as_ptr().offset(tail as isize); let dst = source_vec.as_mut_ptr().offset(start as isize); ptr::copy(src, dst, self.tail_len); } source_vec.set_len(start + self.tail_len); } }", "positive_passages": [{"docid": "doc-en-rust-7737264e687a1342a776c1bdbc210df16565a148e5f2fb547a08a4b641438929", "text": "The build time of html5ever has gone up by more than 70% for debug builds recently: There are quite a few candidates for introducing this regression in the changeset: Would anybody from or care to bisect further?\nThe \"tuple stress\" benchmark is affected even more while most of the other things have improved. Maybe that gives a hint?\nMy first guess would be quadratic or exponential blowup. Maybe someone can do a ?\nYes, good idea!\nBisection for tuple-stress points to (cc Before that PR took ~4s and afterwards I killed it after 2m as I didn't want to wait for it to finish\nThat may also be the source of the html5ever regression. takes 10s before that commit (the entire time) and 21s afterwards.\nThanks, cc also &\nCould you post instructions for replicating the slow down? Neither or I could reproduce it -- despite running perf on the appropriate commit range locally.\nSo should we revert that PR's commits?\nsure yeah, using I did the equivalent of:\nWe should probably only run the disaggregation pass if the opt level is 1. That's what's done for the copy prop pass already\nassuming and can reproduce I think yeah we'll probably want to start off by reverting and possibly doing what suggests in a follow-up\nI cannot reproduce, which is odd, since I can't tell what the difference could be that would make this much of a difference...\nNo repro on macOS, although the c116 version is consistently slower than a272. let src = source_vec.as_ptr().offset(tail as isize); let dst = source_vec.as_mut_ptr().offset(start as isize); ptr::copy(src, dst, self.tail_len); if tail != start { let src = source_vec.as_ptr().offset(tail as isize); let dst = source_vec.as_mut_ptr().offset(start as isize); ptr::copy(src, dst, self.tail_len); } source_vec.set_len(start + self.tail_len); } }", "positive_passages": [{"docid": "doc-en-rust-a6671135809fc4b0ac137c214a94ffd1aeb4cae68c5a4ea4d07c935983263438", "text": " let src = source_vec.as_ptr().offset(tail as isize); let dst = source_vec.as_mut_ptr().offset(start as isize); ptr::copy(src, dst, self.tail_len); if tail != start { let src = source_vec.as_ptr().offset(tail as isize); let dst = source_vec.as_mut_ptr().offset(start as isize); ptr::copy(src, dst, self.tail_len); } source_vec.set_len(start + self.tail_len); } }", "positive_passages": [{"docid": "doc-en-rust-c0253d40dba39be9f541c68d6f0b969fc74f4cd00365e069215ef8af7e0afac7", "text": "I've posted what I believe is a fix to\ntriage: P-high Has pending fix.", "commid": "rust_issue_50496", "tokennum": 21}], "negative_passages": []} {"query_id": "q-en-rust-befadc9d8ae18c2bd54af358547081737beef636f0fd03bf2167214e048233bf", "query": "// if a test does not crash, consider it an error if proc_res.status.success() || matches!(proc_res.status.code(), Some(1 | 0)) { self.fatal(&format!( \"crashtest no longer crashes/triggers ICE, horray! Please give it a meaningful name, add a doc-comment to the start of the test explaining why it exists and move it to tests/ui or wherever you see fit. Adding 'Fixes #' to your PR description ensures that the corresponding ticket is auto-closed upon merge.\" \"crashtest no longer crashes/triggers ICE, horray! Please give it a meaningful name, add a doc-comment to the start of the test explaining why it exists and move it to tests/ui or wherever you see fit. Adding 'Fixes #' to your PR description ensures that the corresponding ticket is auto-closed upon merge. If you want to see verbose output, set `COMPILETEST_VERBOSE_CRASHES=1`.\" )); } }", "positive_passages": [{"docid": "doc-en-rust-3f837a6a30c6eb2a500173f5a951f43ce9083ca9254c8347134e4460887f18bc", "text": "E.g. if a test doesn't have a fn it can prevent the test from ICEing because ICEing codepath might not yet be reached before compilation is aborted. In this case, the stderr should be printed to help the person figure out that \"I forgor to annotate crate type\" is the cause.\nyou can set env var which should print stdout, stderr and exit code\nOh right, good point, I forgor this existed. We should (I'll do this later unless you want to work on it): Mention this env var in the panic message for when the crashes test no longer crash. () Mention this env var in rustc-dev-guide. () EDIT: ended up duplicating some description of ` in because I would not have thought to look there for docs specifically.", "commid": "rust_issue_130776", "tokennum": 182}], "negative_passages": []} {"query_id": "q-en-rust-bf104cfc17c57ec2ea712e14b54a28e6038c24f8d28a4e6d7a4b3e136bae3605", "query": "// not covered via the Shared impl above b/c the inner contents use // Cell/AtomicUsize, but the usage here is recover safe so we can lift the // impl up one level to Arc/Rc itself impl RecoverSafe for Rc {} impl RecoverSafe for Arc {} impl RecoverSafe for Rc {} impl RecoverSafe for Arc {} // Pretty simple implementations for the `NoUnsafeCell` marker trait, basically // just saying that this is a marker trait and `UnsafeCell` is the only thing // which doesn't implement it (which then transitively applies to everything // else. impl NoUnsafeCell for .. {} impl !NoUnsafeCell for UnsafeCell {} // Pretty simple implementations for the `RefRecoverSafe` marker trait, // basically just saying that this is a marker trait and `UnsafeCell` is the // only thing which doesn't implement it (which then transitively applies to // everything else. impl RefRecoverSafe for .. {} impl !RefRecoverSafe for UnsafeCell {} impl RefRecoverSafe for AssertRecoverSafe {} impl AssertRecoverSafe { /// Creates a new `AssertRecoverSafe` wrapper around the provided type.", "positive_passages": [{"docid": "doc-en-rust-abe57cfb3503c7aa622e867784cbdde0b8aae22dbfad46b0299a928797cf1ee5", "text": "Test Case 1: Test Case 2: Both produce errors like this: CC\nHm, so the first case here should work (e.g. should subvert basically everything), although the second case is correct in yielding an error (albeit not a very good one)\nIs the second case not allowed then? 's documentation suggests that manually implementing it is okay to do: I figured only existed to wrap types which you couldn't yourself, but for which you can ensure their invariants are upheld across the boundary. And what about moving values into the closure? can't be unwrapped, at least not currently.\nOh wait sorry I misread your second example, I failed to notice the manual ! This is basically a case where closure captures are coming into play. The closures aren't annotated with , so outer variables are captured by-reference which means that the actual types being tested against the trait here are and . In the first case that should be handled by , but the second is legitimately indicating that it's not a recover-safe type (b/c the reference is different than the by-value). You should be able to get around this via either plus or via . Certainly an interesting interaction going on here though. One would likely expect that if isn't recover safe that would fix the problem but it's likely what you really need to do is due to the way closures largely work.\nThere's , why not ? Coherence?\nNah unfortunately that'd defeat the purpose of the distinction. The type is itself recover safe, it's just that's not (so the distinction need to be there)\nIt's unfortunate that fails due to coherence or something like that:\nHm interesting, I guess yeah you'll be forced to move the reference inside the wrapper rather than having a reference to the wrapper\nIs it possible to implement then? My use case can contain and friends but I'm guaranteeing that they're unobservable in user code after recovery because I immediately re-panic after escaping the FFI stack.\nI guess I can just use once it's fixed :stuckouttongue:. I see your PR has been accepted so I'll look forward to trying it on tonight's nightly. When do the buildbots fire?\nYeah currently you can implement (being renamed to ) I believe (although I can't say I've tried). For now though yeah I'd recommend just using plus closures.", "commid": "rust_issue_30510", "tokennum": 517}], "negative_passages": []} {"query_id": "q-en-rust-bf104cfc17c57ec2ea712e14b54a28e6038c24f8d28a4e6d7a4b3e136bae3605", "query": "// not covered via the Shared impl above b/c the inner contents use // Cell/AtomicUsize, but the usage here is recover safe so we can lift the // impl up one level to Arc/Rc itself impl RecoverSafe for Rc {} impl RecoverSafe for Arc {} impl RecoverSafe for Rc {} impl RecoverSafe for Arc {} // Pretty simple implementations for the `NoUnsafeCell` marker trait, basically // just saying that this is a marker trait and `UnsafeCell` is the only thing // which doesn't implement it (which then transitively applies to everything // else. impl NoUnsafeCell for .. {} impl !NoUnsafeCell for UnsafeCell {} // Pretty simple implementations for the `RefRecoverSafe` marker trait, // basically just saying that this is a marker trait and `UnsafeCell` is the // only thing which doesn't implement it (which then transitively applies to // everything else. impl RefRecoverSafe for .. {} impl !RefRecoverSafe for UnsafeCell {} impl RefRecoverSafe for AssertRecoverSafe {} impl AssertRecoverSafe { /// Creates a new `AssertRecoverSafe` wrapper around the provided type.", "positive_passages": [{"docid": "doc-en-rust-5f930fb09367aa911719c3220b88cc1dd726251a4231338dcf4980a127fca724", "text": "The PR is in but'll take a few hours at least to land.\nthe problem with moving at this point in time is that I call in different branches of a but I pass the same closed-over value to it; I can't do the branch in the closure because I need to do some FFI cleanup afterwards regardless of whether a panic happened or not (which also requires the closed-over value). It would help if derived and/or so I could reuse it without constructing a new value for each arm, but that would probably require some discussion because I don't know if it's safe or not. I'll probably just implement and fix the name after your PR drops. A quick check confirms that it works just fine. Thanks anyways!\nOh yeah we could totally add more traits like and to , there shouldn't be any safety concerns there.\nUpdating code to modern functions and traits in makes this compile, so I'm going to close.", "commid": "rust_issue_30510", "tokennum": 202}], "negative_passages": []} {"query_id": "q-en-rust-bf1101ceb1ddf45ab26f8e059cdf09376668596f12112884cc470c5cad629585", "query": "builder.install(&exe, &dst_bindir, 0o755); } // Copy libLLVM.so to the target lib dir as well, so the RPATH like // `$ORIGIN/../lib` can find it. It may also be used as a dependency // of `rustc-dev` to support the inherited `-lLLVM` when using the // compiler libraries. maybe_install_llvm_target(builder, target, &image); // Prepare the overlay let overlay = tmp.join(\"llvm-tools-overlay\"); drop(fs::remove_dir_all(&overlay));", "positive_passages": [{"docid": "doc-en-rust-9df990abeab53784faf20b5fa2c410f38818aea4f668efa53e809f334a923dd8", "text": "Since , has been distributed in the component in two locations: (presumably as a runtime dependency of ) (not sure, maybe for linking custom drivers?) likely belongs in the component, if the duplication can't be avoided
// Copy libLLVM.so to the target lib dir as well, so the RPATH like // `$ORIGIN/../lib` can find it. It may also be used as a dependency // of `rustc-dev` to support the inherited `-lLLVM` when using the // compiler libraries. maybe_install_llvm_target(builder, target, &image); // Prepare the overlay let overlay = tmp.join(\"llvm-tools-overlay\"); drop(fs::remove_dir_all(&overlay));", "positive_passages": [{"docid": "doc-en-rust-2f0b501f7fd021ba4d145f4e8cacc691f0a04693d98d324e534119840f2a1840", "text": "Like running the cross-compiled on a host without anything more than the component?\nHmm, I can't actually get cross-builds to work with . I this to : ... so it would pick that up from the sysroot. Trying to cross-compile i686, I get: I do have both i686 and x8664 builds of in the sysroot. I suspect the error is because the i686 build has different metadata than my host build, so it can't find the one it wants for the host. That may mean that is really tied to being used on the same host. It works if I just compile native x86_64 though. Then I tried removing the , and it gets essentially the same error as : AFAICS, building normal crates still works fine with that extra removed though. In short: Cross-compiling with seems broken -- maybe it should be shipped native-only. The only difference would be in the manifest created for rustup. Linking to crates will inherit , so that needs to be in the library path.\nAh, fascinating. What happens if you build such an executable and then remove the component entirely? Can it pick up the dylibs outside or does it hardcode the paths inside?\nThe final executable still isn't actually linked to LLVM, since it didn't need any of those symbols: I can run this with , which set , or even if I set that path myself. But doesn't work if we've removed that library, since needs itself.\nOkay, it being dependent on makes sense. Overall, probably the safe thing to do would be to move the duplicate to , oh well.\nOh, also needs LLVM, and those binaries are installed in with RUNPATH . I guess they might be able to find the LLVM in anyway?", "commid": "rust_issue_70838", "tokennum": 388}], "negative_passages": []} {"query_id": "q-en-rust-bf65d8f786022eb8ff2e57a10678a6ae438940d11f0398aec501893a42319930", "query": "COMPILE_FLAGS=-O -Ccodegen-units=1 -Cprofile-generate=\"$(TMPDIR)\" # LLVM doesn't yet support instrumenting binaries that use unwinding on MSVC: # https://github.com/rust-lang/rust/issues/61002 # # Things work fine with -Cpanic=abort though. ifdef IS_MSVC COMPILE_FLAGS+= -Cpanic=abort endif all: $(RUSTC) $(COMPILE_FLAGS) --emit=llvm-ir test.rs # We expect symbols starting with \"__llvm_profile_\".", "positive_passages": [{"docid": "doc-en-rust-06c52e151a7bd517a82a705457b19a4a0c0dcbd3002858a1b249f55728f37234", "text": "LLVM's \"IR-level\" instrumentation, which is used by to generate PGO instrumented binaries, does not yet work with exception handling on Windows MSVC. The problem has been reported to LLVM for C++ here: This also affects Rust programs built with for Windows MSVC. As long as LLVM does not support exception handling there, it is a known limitation that PGO can only be used with on this platform.\nPGO does not yet work on for other reasons (see ). Once it does, we should check if this problem is specific to MSVC.\nI have working x86_64 windows-gnu (64 bit builds use SEH) build with PGO I'll open PR once is merged. I can do testing in meantime. FWIW simple hello world example works fine after going through PGO.\nif you test, be sure to compile your LLVM with assertions: Thanks for looking into it!\nI'll recompile it with assertions today later. Should the test case be using any specific code like ?\nThe following test case runs into the problem with MSVC: See for how the file is compiled.\nIt does not reproduce with gnu toolchain with Rust and LLVM assertions enabled, I'll try to remember about fixing along with gnu profiler.\nCool!\nI just confirmed that (for me locally) PGO seems to work on Windows GNU. That is, I built with instrumentation, ran it, and rebuilt it with the profiling data collected. It worked just fine, no crashes. So I updated the original issue text to just mention MSVC instead of Windows in general.\nIt looks like is a bit too aggressive with its error reporting. For example when invoking rustc, but not compiling in our Firefox build we can the following : I'm not sure the best solution while mw is away; perhaps we should revert for now.\nMaybe we can just convert the error to a warning?\nNot the best long-term solution but seems ok\nIt looks like the was marked fixed a year ago. What's the status of this issue in rustc?", "commid": "rust_issue_61002", "tokennum": 444}], "negative_passages": []} {"query_id": "q-en-rust-bf7ca1f0c1e88827da3c18b328c46b3fafdd045dac3fef888180b03107d1078e", "query": "} }; bfs_queue.push_back(DefId { krate: cnum, index: CRATE_DEF_INDEX }); while let Some(def) = bfs_queue.pop_front() { for child in tcx.item_children(def).iter() { add_child(bfs_queue, child, def);", "positive_passages": [{"docid": "doc-en-rust-e49ba4185dde71f94119aa215224792dda43967d38bcf7e66304f8cab1d0d912", "text": "On nightly rustc (cargo) I get misleading expected type errors. If a crate has the same(?) type it is displayed instead of the std type. I tried this code: I expected to see this happen: (stable rust) Instead, this happened: (nightly) :\nConfirming - broken on nightly (1.23), good on beta.\nbisected across nightlys: bug was injected between and\nSkimming output from , there are a number of different potential culprits. Rather than guess and \"point fingers\" right now, I'll just continue bisecting within that commit range.\nThis is recent enough that we should be able to run bisect-rust on it (cc\nit is cc .\nI'm a little surprised that this would be caused by that PR. I can push a revert but would like to first test locally to make sure that revert that PR will fix this.\nI have misread 's statement. Your PR is not at fault, sorry. I'm doing another search further back to find the causing PR.\nI tried it locally in the meantime and I can confirm it is not :)\nOkay so the bug dates as far back as from September 2nd which is as close to the limit as I dare to go. So to the people in control, please, prolong the limit :).\nsuggests that the bug was introduced much more recently (11-08 to 11-09). Maybe the bisection script was wrong?\nI should probably have read the original issue more closely :). sorry for pinging you! It seems to be cc\nIn particular, I have bisected it down to the commit: I have been trying to further dissect that commit to figure out why it causes the change we observe here. My current hypothesis (that I have not yet managed to confirm) is that it has to do with how we seed the hashmap's hashers with randomized state. (This commit changes our behavior in certain scenarios.) If this hypothesis is actually true, though, then I would think that this represents either a bug in hashmap itself, or a bug in how the compiler is using the hashmap...\nHmm. Its something more subtle than a hashmap-related bug.", "commid": "rust_issue_46112", "tokennum": 470}], "negative_passages": []} {"query_id": "q-en-rust-bf7ca1f0c1e88827da3c18b328c46b3fafdd045dac3fef888180b03107d1078e", "query": "} }; bfs_queue.push_back(DefId { krate: cnum, index: CRATE_DEF_INDEX }); while let Some(def) = bfs_queue.pop_front() { for child in tcx.item_children(def).iter() { add_child(bfs_queue, child, def);", "positive_passages": [{"docid": "doc-en-rust-38a2e9b0141ca54f9b5e892f9ac66edbc891b9e1bb584b071524d88c3d6f124f", "text": "In particular, I can reproduce the old behavior on master by just linking in the old crate into (in addtion to linking in the one from ; doing this requires changing the name of the old ), without making any actual calls into the old crate. That, to me, seems very strange. I'm now trying to reduce down the size of the crate that I am linking in (while still causing this delta in behavior).\ntriage: P-high\nI still get a non std types in erros when the path has the same length. That would be okay if it is somehow deterministic, but I get different type errors within the same file for the same types.\nis that a regression from the stable channel? While I absolutely agree that a deterministic result would be better (and better stilll, a deterministic result that favored minimal-length paths rooted at ), I want to triage this appropriately.\nHmm I guess since is the person who filed the original ticket then it is reasonable to infer that they are indeed seeing the described regression compared to the stable channel.\ngives me: seems to work now: Maybe this was some sort of partial compile cache issue? I haven't found a way to reproduce these mixed errors yet.\nThis looks like a duplicate of . That issue has some repro cases that affect the 1.22.1 stable compiler but not 1.21.0.\nWhen I bisected the nightlies by hand on I ended up with a range (...) that does not include the commit identified here. Is it possible that the nondeterministic nature of the bug is also messing with our attempts to bisect? I wonder whether merely linking affects in the same way as it affected this issue.\nAny evidence of this problem existing with the newest nightly?\nAll the cases I tried seem to have been fixed by and . Nicely done! I reported one follow-up in .", "commid": "rust_issue_46112", "tokennum": 396}], "negative_passages": []} {"query_id": "q-en-rust-bfc28a305ee721270c22ae4b7469d955b4f5063240b5e0d7c1bfa1d596958916", "query": " // This is a non-regression test for issue #127052 where unreferenced `#[used]` statics couldn't be // removed by the MSVC linker, causing linking errors. //@ build-pass: needs linking //@ only-msvc #[used] static FOO: u32 = 0; fn main() {} ", "positive_passages": [{"docid": "doc-en-rust-57d958d3026ac5c747d96281c84e6d868dc627aad8ed82a29ed610bcb5598ffb", "text": "I tried this code: I expected to see this happen: Compiles successfully. Instead, this happened: Fails with this error: nightly-2024-06-26 and earlier. nightly-2024-06-27 and later, starting with . See for a discussion of the issue. : cc\nTo elaborate, the difference is in symbols.o. Here's a dump of symbols.o before the change: And here's after: Spot the difference. Spoiler: is now present.\nSo is that right or wrong? The static is \"used\" so marking it exported to ensure it does not get optimized away seems to make sense? I don't understand why this is a problem only on Windows.\nWell that's not a problem per se but if we want to do that then we have to do it properly. is defined as a in (on my machine). This is linked directly and not in a lib file. So it's already being included. There's no reason for to include it. The only issue is that is being emitted as a comdat, meaning the linker is still allowed to remove it. We could just not do that (or add a linker directive). But that's a pre-existing issue.\nI don't understand any part of that.^^ Should my PR get reverted or is there a better way to fix this regression? If there is a better way, I am afraid I lack the knowledge to implement and test it. I don't understand symbol handling on Linux, let alone on Windows.\nI don't know enough about the Rust compiler to say. My complete guess would be that was silently broken before but now it's nosily broken.\nHm, who would understand our Windows linking story? ?\nAfter CGU partitioning, we try to internalize symbols when possible. What is surprising to me is that this process only looks at export level, ignoring used attribute (in the contrast to say the internalization during fat LTO). Consequently we have a situation where synthetic object file references a symbol that is no longer exported (on Linux that does not result in a linking error, even though reference is unresolved). Anyway, if the consequence of would be to export those symbols for no reason, that seems rather counter productive to me.", "commid": "rust_issue_127052", "tokennum": 480}], "negative_passages": []} {"query_id": "q-en-rust-bfc28a305ee721270c22ae4b7469d955b4f5063240b5e0d7c1bfa1d596958916", "query": " // This is a non-regression test for issue #127052 where unreferenced `#[used]` statics couldn't be // removed by the MSVC linker, causing linking errors. //@ build-pass: needs linking //@ only-msvc #[used] static FOO: u32 = 0; fn main() {} ", "positive_passages": [{"docid": "doc-en-rust-1a416a54828d47fa306c818b2e92ac31c36a43babb961a8c072d14e48bf1b571", "text": "Ah, the behaviour was working to spec before: So I think I'd agree that is the wrong approach and should be reverted because this currently ends up conflating different things. Maybe changes elsewhere would fix this but I don't want to speculate.\nthe separate issue you pointed out earlier in is presumably still relevant for ?\nCould this explain recent CI flakiness? The failure at and a couple other failed merges (linked on that thread, also the retries) have been msvc linker errors.\nThat's unfortunate. :/ Our reachable symbol code is such a spaghetti mess... I guess I'll just have to copy-paste more things into Miri then. :shrug: I am traveling right now, I'd appreciate if someone else could do the revert.\nThe following patch should fix the incorrect internalization I mentioned earlier: As for the question whether those symbols should be exported in the first place, it might be necessary for COFF and . The following code suggests that would not have the desired effect otherwise I don't have access to windows environment at the moment to verify that, so I don't plan to work on this myself.\nOoh this is also the stuff that also broke several ci-runs already ...\nLooks like this did not fully fix the ci failures :melting_face:\nMakes sense: some CI failures look non-deterministic, while we'd expect this error not to be.\nAlternative approach for Miri:", "commid": "rust_issue_127052", "tokennum": 305}], "negative_passages": []} {"query_id": "q-en-rust-bfc79663c193f87547d99a925ba3817537c5b5a8e0e9163679b5c0d1cc7952b8", "query": " warning: function cannot return without recursing --> $DIR/issue-87450.rs:5:1 | LL | fn foo() -> impl Fn() { | ^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing ... LL | wrap(wrap(wrap(wrap(wrap(wrap(wrap(foo()))))))) | ----- recursive call site | = note: `#[warn(unconditional_recursion)]` on by default = help: a `loop` may express intention better if this is on purpose error[E0720]: cannot resolve opaque type --> $DIR/issue-87450.rs:5:13 | LL | fn foo() -> impl Fn() { | ^^^^^^^^^ recursive opaque type ... LL | wrap(wrap(wrap(wrap(wrap(wrap(wrap(foo()))))))) | ----------------------------------------------- returning here with type `impl Fn<()>` ... LL | fn wrap(f: impl Fn()) -> impl Fn() { | --------- returning this opaque type `impl Fn<()>` error: aborting due to previous error; 1 warning emitted For more information about this error, try `rustc --explain E0720`. ", "positive_passages": [{"docid": "doc-en-rust-182339936e026a6dff1de1a23525fc9fbff8c46480a388c8af14eaa8b846095f", "text": "I tried this code: I expected running to produce an error like: It does, but takes time exponential in the number of calls, although doesn't appear to use any extra memory. In the time take looks like: I believe it's also exponential in the number of calls in . The reason I had code like this was because I was using nom's parser combinators which results in lots of nested closures. I spotted it because this caused rust-analyzer to hang because cargo clippy hung (it looks like check was the issue), I had to kill clippy to fix it. I bisected this (with cargo-bisect-rustc) to find the regression in , which contained the following bors commits: merge of - Centril:rollup-rzvry15, r=Centril merge of - tmandry:rollup-0k6jiik, r=tmandry merge of - Manishearth:clippyup, r=Manishearth merge of - tanriol:explain_borrow-use-context-dominators, r=nagisa merge of - ehuss:update-cargo-books, r=alexcrichton modify labels: +regression-from-stable-to-stable -regression-untriaged\nwhat version of rust are you using? Is this also present on nightly?\nGood question! This repros on the latest nightly () and on stable (1.53.0 2021-06-17).\nRegression means that it was linear, or exponential, but smaller?\nI didn't looks to still be exponential just much quicker, and with a smaller base (~2 vs ~14):\nlooks related\nBisected to innocent-looking commit . Removing the caching from in master does indeed fix the issue. I haven't looked at the how or why or where that causes (other) problems though. cc\nHmm, the only thing that looks expensive there is the hashing - I wonder if it's hashing over and over again without ever getting a cache hit? Hashing has a fixed cost, but can be an arbitrary length:\ncuts down on time for this testcase and others with invalid recursive opaque types by bailing out early if a recursion is found.", "commid": "rust_issue_87450", "tokennum": 479}], "negative_passages": []} {"query_id": "q-en-rust-bfc79663c193f87547d99a925ba3817537c5b5a8e0e9163679b5c0d1cc7952b8", "query": " warning: function cannot return without recursing --> $DIR/issue-87450.rs:5:1 | LL | fn foo() -> impl Fn() { | ^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing ... LL | wrap(wrap(wrap(wrap(wrap(wrap(wrap(foo()))))))) | ----- recursive call site | = note: `#[warn(unconditional_recursion)]` on by default = help: a `loop` may express intention better if this is on purpose error[E0720]: cannot resolve opaque type --> $DIR/issue-87450.rs:5:13 | LL | fn foo() -> impl Fn() { | ^^^^^^^^^ recursive opaque type ... LL | wrap(wrap(wrap(wrap(wrap(wrap(wrap(foo()))))))) | ----------------------------------------------- returning here with type `impl Fn<()>` ... LL | fn wrap(f: impl Fn()) -> impl Fn() { | --------- returning this opaque type `impl Fn<()>` error: aborting due to previous error; 1 warning emitted For more information about this error, try `rustc --explain E0720`. ", "positive_passages": [{"docid": "doc-en-rust-adc6c0af1c8a92aff24ab125ca41d46c9fd3b1b0e503725cadf326ebadea5f29", "text": "This fixes the regression but the check time is still exponential in the recursion: #wraps|time (s) ---|--- 23|9.2 24|18.3 25|36.6 Not sure if that matters in practice though.\nAssigning priority as discussed in the of the Prioritization Working Group. label -I-prioritize +P-high\nThat's the same as before the regression, right? I definitely think that's a change worth making :) I expect the doubling will have a completely different cause.\nYes, same ballpark.", "commid": "rust_issue_87450", "tokennum": 123}], "negative_passages": []} {"query_id": "q-en-rust-bffe00b9e318981316cfe93959aac0ad27be17cff3c97f65344c0b0430ef1f4c", "query": " use std::{ptr::NonNull, task::Poll}; struct TaskRef; struct Header { vtable: &'static Vtable, } struct Vtable { poll: unsafe fn(TaskRef) -> Poll<()>, deallocate: unsafe fn(NonNull
), } // in the \"Header\" type, which is a private type in maitake impl Header { pub(crate) const fn new_stub() -> Self { unsafe fn nop(_ptr: TaskRef) -> Poll<()> { Poll::Pending } unsafe fn nop_deallocate(ptr: NonNull
) { unreachable!(\"stub task ({ptr:p}) should never be deallocated!\"); } Self { vtable: &Vtable { poll: nop, deallocate: nop_deallocate } } } } // This is a public type in `maitake` #[repr(transparent)] #[cfg_attr(loom, allow(dead_code))] pub struct TaskStub { hdr: Header, } impl TaskStub { /// Create a new unique stub [`Task`]. pub const fn new() -> Self { Self { hdr: Header::new_stub() } } } ", "positive_passages": [{"docid": "doc-en-rust-db7c962c5b0c0d87fb91bc88c08084a20c058b3db9403668701b99d4e07d6ed7", "text": " $DIR/unifying-placeholders-in-query-response.rs:5:12 | LL | #![feature(non_lifetime_binders)] | ^^^^^^^^^^^^^^^^^^^^ | = note: see issue #108185 for more information = note: `#[warn(incomplete_features)]` on by default warning: 1 warning emitted ", "positive_passages": [{"docid": "doc-en-rust-f5c636b611929ec75d7a05ab22a7bfded1c97c281d9da839db84e3da33564860", "text": " $DIR/tainted-body.rs:9:9 | LL | used_fn(); | ^^^^^^^ 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/tainted-body.rs:9:9 | LL | used_fn(); | ^^^^^^^ 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-111879-0.rs:11:25 | LL | pub type Focus = &'a mut User; | ^^^^^^^^^^^^ error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-cee077875e5d993b993a007e90fa0cfda7cd2684359386da511d80b45eb15eef", "text": " $DIR/issue-103143.rs:2:13 | LL | x::<#[a]y::> | ^^^^^^ | help: expressions must be enclosed in braces to be used as const generic arguments | LL | x::<#[a]{ y:: }> | + + error[E0425]: cannot find value `x` in this scope --> $DIR/issue-103143.rs:2:5 | LL | x::<#[a]y::> | ^ not found in this scope error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0425`. ", "positive_passages": [{"docid": "doc-en-rust-dae920bd5c0e74ff84e072e461d6bb5b36e59e85136f33f121b71f36125809bb", "text": "Found with The attribute applies to The was initially lexed as part of a token This seems to be exactly the case described by the : // Maybe add libLLVM.so to the lib-dir. It will only have been built if // LLVM tools are linked dynamically. // // We add this to both the libdir of the rustc binary itself (for it to load at // runtime) and also to the target directory so it can find it at link-time. // // Note: This function does no yet support Windows but we also don't support // linking LLVM tools dynamically on Windows yet. pub fn maybe_install_llvm_dylib(builder: &Builder<'_>, target: Interned, sysroot: &Path) { /// Maybe add libLLVM.so to the given destination lib-dir. It will only have /// been built if LLVM tools are linked dynamically. /// /// Note: This function does not yet support Windows, but we also don't support /// linking LLVM tools dynamically on Windows yet. fn maybe_install_llvm(builder: &Builder<'_>, target: Interned, dst_libdir: &Path) { let src_libdir = builder.llvm_out(target).join(\"lib\"); let dst_libdir1 = sysroot.join(\"lib/rustlib\").join(&*target).join(\"lib\"); let dst_libdir2 = sysroot.join(builder.sysroot_libdir_relative(Compiler { stage: 1, host: target })); t!(fs::create_dir_all(&dst_libdir1)); t!(fs::create_dir_all(&dst_libdir2)); if target.contains(\"apple-darwin\") { let llvm_dylib_path = src_libdir.join(\"libLLVM.dylib\"); if llvm_dylib_path.exists() { builder.install(&llvm_dylib_path, &dst_libdir1, 0o644); builder.install(&llvm_dylib_path, &dst_libdir2, 0o644); builder.install(&llvm_dylib_path, dst_libdir, 0o644); } return; }", "positive_passages": [{"docid": "doc-en-rust-9df990abeab53784faf20b5fa2c410f38818aea4f668efa53e809f334a923dd8", "text": "Since , has been distributed in the component in two locations: (presumably as a runtime dependency of ) (not sure, maybe for linking custom drivers?) likely belongs in the component, if the duplication can't be avoided
// Maybe add libLLVM.so to the lib-dir. It will only have been built if // LLVM tools are linked dynamically. // // We add this to both the libdir of the rustc binary itself (for it to load at // runtime) and also to the target directory so it can find it at link-time. // // Note: This function does no yet support Windows but we also don't support // linking LLVM tools dynamically on Windows yet. pub fn maybe_install_llvm_dylib(builder: &Builder<'_>, target: Interned, sysroot: &Path) { /// Maybe add libLLVM.so to the given destination lib-dir. It will only have /// been built if LLVM tools are linked dynamically. /// /// Note: This function does not yet support Windows, but we also don't support /// linking LLVM tools dynamically on Windows yet. fn maybe_install_llvm(builder: &Builder<'_>, target: Interned, dst_libdir: &Path) { let src_libdir = builder.llvm_out(target).join(\"lib\"); let dst_libdir1 = sysroot.join(\"lib/rustlib\").join(&*target).join(\"lib\"); let dst_libdir2 = sysroot.join(builder.sysroot_libdir_relative(Compiler { stage: 1, host: target })); t!(fs::create_dir_all(&dst_libdir1)); t!(fs::create_dir_all(&dst_libdir2)); if target.contains(\"apple-darwin\") { let llvm_dylib_path = src_libdir.join(\"libLLVM.dylib\"); if llvm_dylib_path.exists() { builder.install(&llvm_dylib_path, &dst_libdir1, 0o644); builder.install(&llvm_dylib_path, &dst_libdir2, 0o644); builder.install(&llvm_dylib_path, dst_libdir, 0o644); } return; }", "positive_passages": [{"docid": "doc-en-rust-2f0b501f7fd021ba4d145f4e8cacc691f0a04693d98d324e534119840f2a1840", "text": "Like running the cross-compiled on a host without anything more than the component?\nHmm, I can't actually get cross-builds to work with . I this to : ... so it would pick that up from the sysroot. Trying to cross-compile i686, I get: I do have both i686 and x8664 builds of in the sysroot. I suspect the error is because the i686 build has different metadata than my host build, so it can't find the one it wants for the host. That may mean that is really tied to being used on the same host. It works if I just compile native x86_64 though. Then I tried removing the , and it gets essentially the same error as : AFAICS, building normal crates still works fine with that extra removed though. In short: Cross-compiling with seems broken -- maybe it should be shipped native-only. The only difference would be in the manifest created for rustup. Linking to crates will inherit , so that needs to be in the library path.\nAh, fascinating. What happens if you build such an executable and then remove the component entirely? Can it pick up the dylibs outside or does it hardcode the paths inside?\nThe final executable still isn't actually linked to LLVM, since it didn't need any of those symbols: I can run this with , which set , or even if I set that path myself. But doesn't work if we've removed that library, since needs itself.\nOkay, it being dependent on makes sense. Overall, probably the safe thing to do would be to move the duplicate to , oh well.\nOh, also needs LLVM, and those binaries are installed in with RUNPATH . I guess they might be able to find the LLVM in anyway?", "commid": "rust_issue_70838", "tokennum": 388}], "negative_passages": []} {"query_id": "q-en-rust-c613c67566ca31167d66a00878e411e62852494580c2e66f17bed7b457bcaa46", "query": "} impl<'self> Writer for BufWriter<'self> { fn write(&mut self, _buf: &[u8]) { fail!() } fn write(&mut self, buf: &[u8]) { // raises a condition if the entire write does not fit in the buffer let max_size = self.buf.len(); if self.pos >= max_size || (self.pos + buf.len()) > max_size { io_error::cond.raise(IoError { kind: OtherIoError, desc: \"Trying to write past end of buffer\", detail: None }); return; } fn flush(&mut self) { fail!() } vec::bytes::copy_memory(self.buf.mut_slice_from(self.pos), buf, buf.len()); self.pos += buf.len(); } } // FIXME(#10432) impl<'self> Seek for BufWriter<'self> { fn tell(&self) -> u64 { fail!() } fn tell(&self) -> u64 { self.pos as u64 } fn seek(&mut self, _pos: i64, _style: SeekStyle) { fail!() } fn seek(&mut self, pos: i64, style: SeekStyle) { // compute offset as signed and clamp to prevent overflow let offset = match style { SeekSet => { 0 } SeekEnd => { self.buf.len() } SeekCur => { self.pos } } as i64; self.pos = max(0, offset+pos) as uint; } }", "positive_passages": [{"docid": "doc-en-rust-9be5a1c11e6a03a00e799efc086f9abf6c0c19f1bf525256ccf0fce909442a6d", "text": "Currently all of its functions immediately . We need to either remove this or implement it. I vote for implementing it.", "commid": "rust_issue_10433", "tokennum": 23}], "negative_passages": []} {"query_id": "q-en-rust-c61482f51b7f2c50266abeaad63ecf0f5b5bdfcab3678f3a3654c7b4e5d10029", "query": "assert_eq!(copy(&mut r as &mut dyn Read, &mut w as &mut dyn Write).unwrap(), 1 << 17); } struct ShortReader { cap: usize, read_size: usize, observed_buffer: usize, } impl Read for ShortReader { fn read(&mut self, buf: &mut [u8]) -> Result { let bytes = min(self.cap, self.read_size); self.cap -= bytes; self.observed_buffer = max(self.observed_buffer, buf.len()); Ok(bytes) } } struct WriteObserver { observed_buffer: usize, } impl Write for WriteObserver { fn write(&mut self, buf: &[u8]) -> Result { self.observed_buffer = max(self.observed_buffer, buf.len()); Ok(buf.len()) } fn flush(&mut self) -> Result<()> { Ok(()) } } #[test] fn copy_specializes_bufwriter() { let cap = 117 * 1024; let buf_sz = 16 * 1024; let mut r = ShortReader { cap, observed_buffer: 0, read_size: 1337 }; let mut w = BufWriter::with_capacity(buf_sz, WriteObserver { observed_buffer: 0 }); assert_eq!( copy(&mut r, &mut w).unwrap(), cap as u64, \"expected the whole capacity to be copied\" ); assert_eq!(r.observed_buffer, buf_sz, \"expected a large buffer to be provided to the reader\"); assert!(w.get_mut().observed_buffer > DEFAULT_BUF_SIZE, \"expected coalesced writes\"); } #[test] fn sink_sinks() { let mut s = sink();", "positive_passages": [{"docid": "doc-en-rust-71a329e9c6af3be03e461b3e814f6e837d7ba5897159313d0660fda2e15ec8be", "text": "I was using std::io::copy from an SSD to memory using , which reported an eye-raising 30 MB/s. Wrapping it in a BufReader (either as the outer or middle layer) made no real difference. So I googled around a bit and found the recommended size was 64KB according to some random Microsoft article, so I decided to copy-paste the std::io::copy implementation and increase the buffer size. This got up to 600 MB/s at about 256KB which sounded a lot more it continued going upwards from there past the point of believability (unless the files were being pulled from RAM as a consequence of my repeated accesses). With a 10MB Vec, I got 228.36 GB/s . Unrealistic values aside, has anybody checked the buffer value to make sure there isn't some huge low-hanging fruit for std::io::copy speeds?\nYou mention windows. This may be platform-specific behavior. On unix systems I would fadvise on the input file for copying. Googling tells me that the windows equivalent is . Have you tried that?\nAfter a coarse overview, my intuition is that there is some funny business going on with the length determined by and the subsequent calls on the , that could explain the unrealistic results.\nIt\u2019s possible. The actual times did increase dramatically from the std::io::copy default though - my suspicion is that there is probably some caching to RAM going on or something as cold runs were generally slower than hot runs. This was for some work code that I\u2019m no longer actively developing. I\u2019ll leave this email marked as unread for awhile in case I have some spare time to write a benchmark. I don\u2019t think the other flag that was mentioned is accessible with the default open file api, but in any case it at least appears there\u2019s some low hanging fruit wrt to std::io::copy perf\nI tried benchmarking on Windoze before and after changing to (instead of the original ) and the results were slightly worse (up to ~3%) with the modified setup, both on HDD and SSD. However, I'm not sure if my benchmarks were good enough - I was having a hard time tweaking them so that I could see any difference between results for different file sizes.", "commid": "rust_issue_49921", "tokennum": 505}], "negative_passages": []} {"query_id": "q-en-rust-c61482f51b7f2c50266abeaad63ecf0f5b5bdfcab3678f3a3654c7b4e5d10029", "query": "assert_eq!(copy(&mut r as &mut dyn Read, &mut w as &mut dyn Write).unwrap(), 1 << 17); } struct ShortReader { cap: usize, read_size: usize, observed_buffer: usize, } impl Read for ShortReader { fn read(&mut self, buf: &mut [u8]) -> Result { let bytes = min(self.cap, self.read_size); self.cap -= bytes; self.observed_buffer = max(self.observed_buffer, buf.len()); Ok(bytes) } } struct WriteObserver { observed_buffer: usize, } impl Write for WriteObserver { fn write(&mut self, buf: &[u8]) -> Result { self.observed_buffer = max(self.observed_buffer, buf.len()); Ok(buf.len()) } fn flush(&mut self) -> Result<()> { Ok(()) } } #[test] fn copy_specializes_bufwriter() { let cap = 117 * 1024; let buf_sz = 16 * 1024; let mut r = ShortReader { cap, observed_buffer: 0, read_size: 1337 }; let mut w = BufWriter::with_capacity(buf_sz, WriteObserver { observed_buffer: 0 }); assert_eq!( copy(&mut r, &mut w).unwrap(), cap as u64, \"expected the whole capacity to be copied\" ); assert_eq!(r.observed_buffer, buf_sz, \"expected a large buffer to be provided to the reader\"); assert!(w.get_mut().observed_buffer > DEFAULT_BUF_SIZE, \"expected coalesced writes\"); } #[test] fn sink_sinks() { let mut s = sink();", "positive_passages": [{"docid": "doc-en-rust-9b195586e3dc90faa253519b79c470aca689d75c8b9e27b0355a734299cb4c74", "text": "FWIW, I'm providing the benchmark code below; it can easily be expanded to different file sizes:\n4MB isn\u2019t a whole lot. That\u2019s well within the size of hard drive caches or possibly an OS memory-based cache. I was noticing the difference with files several gigabytes in size. As a sanity check, maybe look to see what the actual time is, not just the % difference between timings with different buffer sizes. The actual time may be wildly different than the actual steady state performance of the disk if it\u2019s reading the data from a cache. It may also be possible at a low level to pass a flag to encourage the OS to disable or flush the cache, but I don\u2019t know if there\u2019s any way to instruct the hard drive to do the same.\nI only pasted the benchmark for 4MB as a reference - I tested files from 4KB up to 16MB. I'm not an expert with low-level hard drive stuff, just hoping my attempt can help someone else.\nIdeally you would test with a file approximately twice as big as you have RAM, so if you have 8GB of RAM you would want to test with a 16GB file.\nextended open flags are accessible via FWIW lots of bennchmarks exist showing synchronous IO calls improve when matching IO operations to the underlying block size (e.g. 4MB for modern SSD's) across multiple OS's, so its very likely that there are improvements to gain here. However, 4MB is stack-breaking size by default, and heap allocations will destroy potential improvements (and further, if we're optimising, we probably want overlapped IO and a ring of buffers rather than just one buffer which will always leave one device idle).... so its complex;)\nheap allocations will destroy potential improvements How come? would allocate once at the beginning. Heap memory isn't inherently slower and one memory allocation is basically free compared to the heavy IO that's happening afterwards.\nBut we also don't want to be allocating 4MB every time we do as someone might be doing a bunch of small copies.", "commid": "rust_issue_49921", "tokennum": 457}], "negative_passages": []} {"query_id": "q-en-rust-c61482f51b7f2c50266abeaad63ecf0f5b5bdfcab3678f3a3654c7b4e5d10029", "query": "assert_eq!(copy(&mut r as &mut dyn Read, &mut w as &mut dyn Write).unwrap(), 1 << 17); } struct ShortReader { cap: usize, read_size: usize, observed_buffer: usize, } impl Read for ShortReader { fn read(&mut self, buf: &mut [u8]) -> Result { let bytes = min(self.cap, self.read_size); self.cap -= bytes; self.observed_buffer = max(self.observed_buffer, buf.len()); Ok(bytes) } } struct WriteObserver { observed_buffer: usize, } impl Write for WriteObserver { fn write(&mut self, buf: &[u8]) -> Result { self.observed_buffer = max(self.observed_buffer, buf.len()); Ok(buf.len()) } fn flush(&mut self) -> Result<()> { Ok(()) } } #[test] fn copy_specializes_bufwriter() { let cap = 117 * 1024; let buf_sz = 16 * 1024; let mut r = ShortReader { cap, observed_buffer: 0, read_size: 1337 }; let mut w = BufWriter::with_capacity(buf_sz, WriteObserver { observed_buffer: 0 }); assert_eq!( copy(&mut r, &mut w).unwrap(), cap as u64, \"expected the whole capacity to be copied\" ); assert_eq!(r.observed_buffer, buf_sz, \"expected a large buffer to be provided to the reader\"); assert!(w.get_mut().observed_buffer > DEFAULT_BUF_SIZE, \"expected coalesced writes\"); } #[test] fn sink_sinks() { let mut s = sink();", "positive_passages": [{"docid": "doc-en-rust-933a68049c4c627fa1eb9b8926d159a9dfdf8102096145822efc09e6e0a16bd9", "text": "possible approaches: thread local buffers or a buffer pool stat the input before deciding on the buffer size (this is what gnu cp does I think) heap-allocate a bigger buffer after a few iterations of the copy loop with an on-stack buffer specialize copy operations from file to memory to directly into the already allocated target, thus skipping the need for a buffer\nspecialize copy operations from file to memory to directly into the already allocated target, thus skipping the need for a buffer I think some kind of specialization for sources would be ideal. Because in this case, should not buffer at all and simply use the reader's buffer. Effectively this also gives you a customizable buffer size by wrapping your in a with whatever size you want. As of today, if your source is then is always the wrong answer. I got a substantial performance improvement using a simple loop instead:\na single heap allocation is entirely reasonable for a single invocation of copy of a lot of data. For many copies of a small amount of data, one ends up with a lot of allocations again (consider for instance copying data out of a tar, where we have views on the data and there's no actual synchronous IO etc happening. I like some of the suggested possibilities with specialisation.\nIt's a nice general optimization, but not necesarily ideal if you use a as . Adding a on the reader size does let you control the buffer size but it still introduces an unnecessary memcopy compared to . Perhaps a writer-side optimization would be more flexible. Then you can specialize either for or\nThat sounds rather uncommon to me though. After all, is provided by the trait so it's always available. The only case I can see where you would invoke with a as destination is some generic interfaces that takes any . But IMO such interfaces are ill-designed, as they could simply implement instead and offer a much more flexible API.\nyes, generic code taking a write was the concern. E.g. tar-rs has a tar archive which takes a and is fed with items. I'm not saying that creating an in-memory archive would be a good idea, just pointing out that these patterns do exist.\nI had same kind of issue but with different library (). The copy rate was around 70 MB/s (inside single NVMe SSD). The problem was actually with running the debug version of my program.", "commid": "rust_issue_49921", "tokennum": 503}], "negative_passages": []} {"query_id": "q-en-rust-c61482f51b7f2c50266abeaad63ecf0f5b5bdfcab3678f3a3654c7b4e5d10029", "query": "assert_eq!(copy(&mut r as &mut dyn Read, &mut w as &mut dyn Write).unwrap(), 1 << 17); } struct ShortReader { cap: usize, read_size: usize, observed_buffer: usize, } impl Read for ShortReader { fn read(&mut self, buf: &mut [u8]) -> Result { let bytes = min(self.cap, self.read_size); self.cap -= bytes; self.observed_buffer = max(self.observed_buffer, buf.len()); Ok(bytes) } } struct WriteObserver { observed_buffer: usize, } impl Write for WriteObserver { fn write(&mut self, buf: &[u8]) -> Result { self.observed_buffer = max(self.observed_buffer, buf.len()); Ok(buf.len()) } fn flush(&mut self) -> Result<()> { Ok(()) } } #[test] fn copy_specializes_bufwriter() { let cap = 117 * 1024; let buf_sz = 16 * 1024; let mut r = ShortReader { cap, observed_buffer: 0, read_size: 1337 }; let mut w = BufWriter::with_capacity(buf_sz, WriteObserver { observed_buffer: 0 }); assert_eq!( copy(&mut r, &mut w).unwrap(), cap as u64, \"expected the whole capacity to be copied\" ); assert_eq!(r.observed_buffer, buf_sz, \"expected a large buffer to be provided to the reader\"); assert!(w.get_mut().observed_buffer > DEFAULT_BUF_SIZE, \"expected coalesced writes\"); } #[test] fn sink_sinks() { let mut s = sink();", "positive_passages": [{"docid": "doc-en-rust-46e182949ff1c44a86ec272d1f183e8a8b20b1ad9dcf1c49c6b58d7ded4f219d", "text": "When I built and ran the release version, the speed jumped to over 1 GB/s.\nWith merged you can now (on next nightly) use to control the chunk size of . Since this relies on specialization it only works if you pass a directly, any other wrapper around it would disable this optimization.", "commid": "rust_issue_49921", "tokennum": 63}], "negative_passages": []} {"query_id": "q-en-rust-c61b85bd4adc373348e74c89c61cacdf024728268d106fff1e0123b1bd103fb8", "query": " #[macro_export] macro_rules! a{ () => {}} #[macro_export] macro_rules! b{ () => {}} ", "positive_passages": [{"docid": "doc-en-rust-4b2730b158a6b938aa8da7a1307117384aa2b34c409ba615509c848a4eab42d7", "text": "Hey! Ran into what appears to be a bug - crate's exported macros each appear twice in the left sidebar: ! Toolchain versions (per log): rustc 1.60.0-nightly ( 2022-02-09), docsrs 0.6.0 ( 2022-02-01) Please let me know if I can provide additional info.\nThank you for the report! This is definitely not an issue with itself, but with rustdoc. is this known? Should a rustdoc issue be created?\nNot known afaik. Please do file an issue (or transfer this one)!\nSeems similar to\nThanks for transferring the issue. One difference between this and - both macros are exported using a wildcard in crate root (not rename):\nWell, just another reexport issue. It's common around here. :laughing: I'll try to take a look in the next days.\nThis is what I have on currently nightly: ! So I guess it's fixed?\nTrying locally with the latest nightly (, more current than that of issue open) I get the same initial landing page for but if I click on one of the macros listed (e.g. \"drill down\") duplicates still appear on the sidebar: ! So the tiny bug is still there, just deeper/hidden on the latest nightly?\nAh indeed! I can also reproduce it now. Will take another look tomorrow then.", "commid": "rust_issue_93912", "tokennum": 305}], "negative_passages": []} {"query_id": "q-en-rust-c663ce485d77561dce657f16c400b4cd10a69aead98e297568f49a0e11e04424", "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. fn f(_: F) where F: Fn() -> R { } fn main() { f(|| -> ! { () }); //~^ ERROR: computation may converge in a function marked as diverging [E0270] } ", "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-c663ce485d77561dce657f16c400b4cd10a69aead98e297568f49a0e11e04424", "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. fn f(_: F) where F: Fn() -> R { } fn main() { f(|| -> ! { () }); //~^ ERROR: computation may converge in a function marked as diverging [E0270] } ", "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-c667f3cd2eb161b7804784bcafcd0db885e3af6d88b52c65c526045569a7c27d", "query": "id: ast::NodeId, span: syntax_pos::Span, name: ast::Name, node_type: &str) { node_type: &str, participle: &str) { if !name.as_str().starts_with(\"_\") { self.tcx .lint_node(lint::builtin::DEAD_CODE, id, span, &format!(\"{} is never used: `{}`\", node_type, name)); &format!(\"{} is never {}: `{}`\", node_type, participle, name)); } } }", "positive_passages": [{"docid": "doc-en-rust-b4355082b0d49e683553157c7734083cdc9275df7ea13883c67cc73d3332a1e0", "text": "I was changing some code from integer constants to a proper enum and was greeted by the following warning: The warning sounded weird to me because I was pattern-matching on that damn variant in various places of the code; but I was pointed out to the fact that I wasn't actually creating that value. Maybe the warning should be rewritten to explicitly mention value creation? Cc\ncc that looks like your thing\nduplicate of\nYup! Closing in favor of that.", "commid": "rust_issue_44565", "tokennum": 94}], "negative_passages": []} {"query_id": "q-en-rust-c692dc78eef0123fed56ba8ca318d6be30d9fb58b3626fdbd949100d65b90ac2", "query": "[submodule \"src/llvm-project\"] path = src/llvm-project url = https://github.com/rust-lang/llvm-project.git branch = rustc/17.0-2023-07-29 branch = rustc/17.0-2023-09-19 shallow = true [submodule \"src/doc/embedded-book\"] path = src/doc/embedded-book", "positive_passages": [{"docid": "doc-en-rust-0f0d2cad0cda4c22515c54705ab3fc7ba9a532a95abd3dcc21645af8344ff916", "text": "Minimized from : This issue was introduced in the build, and so it is likely to be a result of the upgrade to LLVM 17 ().\nI have bisected the LLVM pass to the pass on main. I'm trying to get a diff of before/after so I can start tracking down the exact location of the incorrect optimization.\nThe optimization transforms this switch lookup which appears to correspond to the : with only the calculation of and changing from: to: with the rest of the IR remaining unchanged. The transform of appears to be okay ( by 64 -by 6). The transform of introduces the issue because although the instruction is marked as , is equal to which is negative in the signed representation and so subtracting 128 does cause signed underflow.\nThe IR output from rustc without any optimization passes outputs is: Which appears correct to me. This suggests that the is being introduced in a later optimization pass. I'll continue bisecting when I get a chance.\nLooks like this instruction is being generated by a pass that's run before the pass. Before : Which is correct. So the real errant pass is , it just doesn't cause incorrect x86 to be emitted until a later pass.\nLooks like this issue is known and a fix is in progress upstream at", "commid": "rust_issue_115681", "tokennum": 268}], "negative_passages": []} {"query_id": "q-en-rust-c6a1a7c18fc7daa1b2fd0fb72d7dbc83cbf139c5fd175e0a2d36a837c97938a8", "query": "#![allow(non_upper_case_globals)] use attributes; use intrinsics::{self, Intrinsic}; use llvm::{self, TypeKind}; use abi::{Abi, FnType, LlvmType, PassMode};", "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-c6d37609080ed01aa382e18532048947735ab7c069f088308a4746692743ad50", "query": "// option. This file may not be copied, modified, or distributed // except according to those terms. #![feature(globs)] #![feature(globs, lang_items)] #![no_std] // makes debugging this test *a lot* easier (during resolve) #[lang = \"sized\"] pub trait Sized for Sized? {} // Test to make sure that private items imported through globs remain private // when they're used.", "positive_passages": [{"docid": "doc-en-rust-cd05abfbd828719249c06e3e881d256200cd0a3ba0015f94126fbb769c26b16e", "text": "The following code causes an ICE: Removing the parameter or changing it to be a value instead of a reference stops the crash with an error saying I need to specify a lifetime, which makes me think this is a problem related to inferred lifetimes.\nIt isn't, you just have to specify a lifetime: ICE-s as well. Returning an unsized type should be a typeck error.\nhappens to work because it implies , i.e. would also work.", "commid": "rust_issue_18107", "tokennum": 98}], "negative_passages": []} {"query_id": "q-en-rust-c6dadb5ef56592fc4032b296f90f31832569128a65787342d91d4c06f060a997", "query": " error: unterminated double quote string --> $DIR/test-compile-fail3.rs:3:1 | 3 | \"fail | ^^^^^^ error: aborting due to previous error ", "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-c6dadb5ef56592fc4032b296f90f31832569128a65787342d91d4c06f060a997", "query": " error: unterminated double quote string --> $DIR/test-compile-fail3.rs:3:1 | 3 | \"fail | ^^^^^^ error: aborting due to previous error ", "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-c70c61db5e9da4571b1e639badafd453f8a77b508d9c7f0a20bd5aa1cec20d8d", "query": "panic_unwind = { path = \"../panic_unwind\", optional = true } panic_abort = { path = \"../panic_abort\" } core = { path = \"../core\", public = true } compiler_builtins = { version = \"0.1.114\" } compiler_builtins = { version = \"0.1.117\" } profiler_builtins = { path = \"../profiler_builtins\", optional = true } unwind = { path = \"../unwind\" } hashbrown = { version = \"0.14\", default-features = false, features = [", "positive_passages": [{"docid": "doc-en-rust-bc7caaf3d07037a9ab18a7094d74f939adcb73a67cc53bbdda0f3061ed32cb62", "text": "I do not have minimised code. This was a sudden CI build failure on nightly for aarch64-unknown-linux-musl () Note that this is a cross compile using cross-rs. It fails on rust version 1.82.0-nightly ( 2024-07-29) but works on 1.82.0-nightly ( 2024-07-28). Needless to say it also works perfectly fine on stable. The error is reproducible on rebuild and locally with cross-rs. It is not reproducible with cargo-zigbuild interestingly enough. I also checked that the version of cross-rs didn't change between the successful and failing builds (no new releases of that project since february). The only change between the successful and failing CI runs were a typo fix to an unrelated CI pipeline (the release one, so it didn't even run yet). As such I'm forced to conclude that the blame lies with Rustc. Steps to reproduce: I expected to see this happen: Compilation successful (as it is with stable for same target, or with -gnu and nightly) Instead, this happened () It most recently worked on: 1.82.0-nightly ( 2024-07-28) (or stable 1.80.0 or beta 1.81.0, take your pick for triaging) :\ncc (of cross-rs fame) in case he has any insight on this regression\nI have hit the same issue in a similar situation. Cross compiling to aarch64-unknown-linux-musl from x86_64 linux in a Github CI pipeline using cross-rs. Link to pipeline failing logs:\nSeems rune isn't needed based on the comment by Updated the title.\nThis is probably\nWG-prioritization assigning priority (). label -I-prioritize +P-high\nYeah that's probably it. We used to build the C version of those symbols but switched to Rust versions with the compiler builtins update. Unfortunately we can't enable them on all platforms because LLVM has crashes, and the logic that would allow optional configuration is apparently not working.", "commid": "rust_issue_128401", "tokennum": 456}], "negative_passages": []} {"query_id": "q-en-rust-c70c61db5e9da4571b1e639badafd453f8a77b508d9c7f0a20bd5aa1cec20d8d", "query": "panic_unwind = { path = \"../panic_unwind\", optional = true } panic_abort = { path = \"../panic_abort\" } core = { path = \"../core\", public = true } compiler_builtins = { version = \"0.1.114\" } compiler_builtins = { version = \"0.1.117\" } profiler_builtins = { path = \"../profiler_builtins\", optional = true } unwind = { path = \"../unwind\" } hashbrown = { version = \"0.14\", default-features = false, features = [", "positive_passages": [{"docid": "doc-en-rust-cb346456f7fca100b620930099e9e34780cb3c176b3f1f7283f5bdc095bcefb4", "text": "After that part is fixed, we will need to enable the symbols on all platforms where is f128 (which includes aarch64), since these errors probably come from here I think anyone who needs a quick workaround can add to their dependencies to get the symbols directly, as described near the top of Note that this requires nightly.\nIs it possible to add a dependency conditionally based on if it is nightly? (In a specific range of dates even?) I cannot and will not depend on nightly, but I do test my code on nightly in CI (in order to find breakages like this early). For now I just disabled that nightly build on aarch64 musl.\nSame for me. Not using cross-rs though. Logs are here:\nSame for me, both using as host toolchain and cross compiling.\nLooks like it is happening now too for x86_64.\nNot for my projects, so you should probably provide a reproducer on x86-64 GNU if possible, since that is a tier 1 platform (unlike Aarch64 on Musl). Or is this about some other x8664 variation that is also tier 2?\nWoops, sorry, the x86_64 build failed too, but then i looked at the aarch64 build logs :) which still fail.", "commid": "rust_issue_128401", "tokennum": 269}], "negative_passages": []} {"query_id": "q-en-rust-c7402a8d2c6e45fc7f595422a72bb379b7f98daa44f6bc9257da075f3e44fcb6", "query": " #![feature(auto_traits)] auto trait AutoTrait {} // You cannot impl your own `dyn AutoTrait`. impl dyn AutoTrait {} //~ERROR E0785 // You cannot impl someone else's `dyn AutoTrait` impl dyn Unpin {} //~ERROR E0785 fn main() {} ", "positive_passages": [{"docid": "doc-en-rust-98fff49fb40e70119e4c2cd4a7204d534b64789980adb7fe38b3f771d737a394", "text": "Given the following code (): The current output is: This is rather confusing. It's not immediately clear what the difference between and this working code is (): Since is accepted, the user might be confused why would be considered a nominal type when isn't. The real reason why is an error is because it is an block for . Ideally the output should look like:\nIt seems like this only happens with auto traits. Regular traits already emit E0116 in this case (): Note that this still happens with auto traits in the same crate, but in this case wouldn't be applicable (): The diagnostic is still confusing in this case and could be rewritten to explicitly point out that is not allowed. modify labels: +D-confusing +F-auto_traits", "commid": "rust_issue_85026", "tokennum": 162}], "negative_passages": []} {"query_id": "q-en-rust-c7522578981f21afa0b6cbbdae564ee69130469533eec03f880817a45b22cfdd", "query": ".push(PathSegment { name: last_segment.name, args: new_params }); bounds.insert(GenericBound::TraitBound( PolyTrait { trait_: new_path, generic_params: poly_trait.generic_params }, PolyTrait { trait_: new_path, generic_params: poly_trait.generic_params.clone(), }, hir::TraitBoundModifier::None, )); }", "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/variance-computation-requires-equality.rs:3:12 | LL | #![feature(inherent_associated_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #8995 for more information = note: `#[warn(incomplete_features)]` on by default warning: 1 warning emitted ", "positive_passages": [{"docid": "doc-en-rust-984bd2cc5e2a7acbf009902bd7c274f0ba42a4999bd245893cbf466bf1db45e4", "text": " $DIR/variance-computation-requires-equality.rs:3:12 | LL | #![feature(inherent_associated_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #8995 for more information = note: `#[warn(incomplete_features)]` on by default warning: 1 warning emitted ", "positive_passages": [{"docid": "doc-en-rust-1d87e55c50b89875187d68c4d0f1175fc508e61becd3ee4c2a808292006063f1", "text": "Regression in nightly-2023-02-21 found 9 bors merge commits in the specified range commit[0] 2023-02-19: Auto merge of - cjgillot:codegen-overflow-check, r=tmiasko commit[1] 2023-02-19: Auto merge of - clubby789:builtin-derived-attr, r=jackh726 commit[2] 2023-02-20: Auto merge of - fmease:iat-type-directed-probing, r=jackh726 commit[3] 2023-02-20: Auto merge of - tmiasko:read-buf, r=the8472 commit[4] 2023-02-20: Auto merge of - camelid:rustdoc-all-only-stable, r=GuillaumeGomez commit[5] 2023-02-20: Auto merge of - b-naber:proj-relate-variance, r=lcnr commit[6] 2023-02-20: Auto merge of - megakorre:issue_105700, r=petrochenkov commit[7] 2023-02-20: Auto merge of - matthiaskrgr:rollup-4tdvnx6, r=matthiaskrgr commit[8] 2023-02-20: Auto merge of - lnicola:rust-analyzer-2023-02-20, r=lnicola ERROR: no CI builds available between and within last 167 days I guess ?\nSeems this has been fixed on the latest nightly, marked as E-needs-test. labels: +E-needs-test\nthis regressed again in", "commid": "rust_issue_110106", "tokennum": 363}], "negative_passages": []} {"query_id": "q-en-rust-c98c96d6b8f56c4e19d2c126be9e83f90956a752d0a0ba4582b58d551f4b11f6", "query": "} #[cfg(not(target_vendor = \"win7\"))] #[link(name = \"synchronization\")] // Use raw-dylib to import synchronization functions to workaround issues with the older mingw import library. #[cfg_attr( target_arch = \"x86\", link( name = \"api-ms-win-core-synch-l1-2-0\", kind = \"raw-dylib\", import_name_type = \"undecorated\" ) )] #[cfg_attr( not(target_arch = \"x86\"), link(name = \"api-ms-win-core-synch-l1-2-0\", kind = \"raw-dylib\") )] extern \"system\" { pub fn WaitOnAddress( address: *const c_void,", "positive_passages": [{"docid": "doc-en-rust-4b8b0433e3535dfcfd4321f143f8eb8bfbdef2afb4f34195df567fa3cf15c4a7", "text": "The following GitHub action fails with nightly-2024-02-27 but passes with nightly-2024-02-26 for (I believe) any project with a file: The error I got is the following: This only affects x8664-pc-windows-gnu (not MVSC), and switching from to fixes the issue. I have reproduced the issue in I may end up deleting that repo in the future, so for posterity, I've included all the code below: #[link(name = \"synchronization\")] // Use raw-dylib to import synchronization functions to workaround issues with the older mingw import library. #[cfg_attr( target_arch = \"x86\", link( name = \"api-ms-win-core-synch-l1-2-0\", kind = \"raw-dylib\", import_name_type = \"undecorated\" ) )] #[cfg_attr( not(target_arch = \"x86\"), link(name = \"api-ms-win-core-synch-l1-2-0\", kind = \"raw-dylib\") )] extern \"system\" { pub fn WaitOnAddress( address: *const c_void,", "positive_passages": [{"docid": "doc-en-rust-7831ce026fdbd93839aa396f975901d854ba1bf06810944c2dd1650a0159ea9d", "text": "Based on , my first impression is that mingw-w64 isn't preinstalled on the image. Unless Windows Subsystem for Linux is relevant, I assume that the mingw-w64 toolchain is installed as part of the run of .\nVarious tools like Perl might come with GCC. Could you determine location of and ?\nI'm not sure. I've only been able to reproduce this via a GitHub action, not on my own machine, although I might be able to use something like to explore around. Alternatively, I could just run a fixed list of commands. If there's a set of commands I can run to answer any questions you have, please let me know. I'm not sure how the Rust toolchain determines which version of to run when building Rust code, but that seems like something you might know. EDIT: Based on your question, I might need to just run with the two applications you asked about. EDIT2: and are both in according to .\nHere are the versions of based on running :\nThanks, apparently there was a bug in mingw-w64 fixed in 2020: IIRC this toolchain is older than that so it's indeed a bug in mingw-w64 shipped with this .\nOh, weird. also comes shipped with so this image generally has up-to-date packages. I also didn't see mingw or mingw-w64 mentioned anywhere in its README, so now I'm wondering if there's a bug in the image itself. I expect this means that no action will be needed for this particular issue unless we want to be more robust to bad environments like this. EDIT: It looks like it's defined here: EDIT2: It was documented after all. I had to search for \"gcc\", not \"mingw\".\nI was rather confused because states that the latest version from the 8.x series is 8.0.2, but the version installed of in the the Windows 2019 image is 8.1.0, which seems like it shouldn't exist. However, based on the releases of , the number after the is probably what's important, which means that we're on version 6.0.0, which is indeed before the fix. I might ask in the project to see if it's worth updating mingw64 for this reason.", "commid": "rust_issue_123999", "tokennum": 498}], "negative_passages": []} {"query_id": "q-en-rust-c98c96d6b8f56c4e19d2c126be9e83f90956a752d0a0ba4582b58d551f4b11f6", "query": "} #[cfg(not(target_vendor = \"win7\"))] #[link(name = \"synchronization\")] // Use raw-dylib to import synchronization functions to workaround issues with the older mingw import library. #[cfg_attr( target_arch = \"x86\", link( name = \"api-ms-win-core-synch-l1-2-0\", kind = \"raw-dylib\", import_name_type = \"undecorated\" ) )] #[cfg_attr( not(target_arch = \"x86\"), link(name = \"api-ms-win-core-synch-l1-2-0\", kind = \"raw-dylib\") )] extern \"system\" { pub fn WaitOnAddress( address: *const c_void,", "positive_passages": [{"docid": "doc-en-rust-5e6328b9e7eec4be17230054a0f6c807c9c959d1ff7528d082d8c6df79eb367b", "text": "EDIT: Filed Depending on their response, if they decide not to update, it's possible could be fixed instead to stop trying to install Rust over an incompatible version of MinGW.\nFor some reason, my original issue description code snippet mentioned instead of . I think that's because I copy/pasted the wrong version, when I was seeing whether the workaround worked (which I believe it did). I apologize if that caused any confusion. I've now edited the description to fix this mistake.\nGiven that seems to be in progress and would close this issue, I mentioned that in for extra transparency.\nThank you for all your help on this! It's awesome that all this happened in only 4 days. I can confirm on my end that this issue is now fully resolved on the latest nightly release of Rust (2024-04-19).", "commid": "rust_issue_123999", "tokennum": 177}], "negative_passages": []} {"query_id": "q-en-rust-c9a380c64829090e781c55c961af623367f254238beb557b4825022d0df8d5f5", "query": ") -> FfiResult<'tcx> { use FfiResult::*; let transparent_safety = def.repr().transparent().then(|| { // Can assume that at most one field is not a ZST, so only check // that field's type for FFI-safety. let transparent_with_all_zst_fields = if def.repr().transparent() { if let Some(field) = transparent_newtype_field(self.cx.tcx, variant) { return self.check_field_type_for_ffi(cache, field, args); // Transparent newtypes have at most one non-ZST field which needs to be checked.. match self.check_field_type_for_ffi(cache, field, args) { FfiUnsafe { ty, .. } if ty.is_unit() => (), r => return r, } false } else { // All fields are ZSTs; this means that the type should behave // like (), which is FFI-unsafe... except if all fields are PhantomData, // which is tested for below FfiUnsafe { ty, reason: fluent::lint_improper_ctypes_struct_zst, help: None } // ..or have only ZST fields, which is FFI-unsafe (unless those fields are all // `PhantomData`). true } }); // We can't completely trust repr(C) markings; make sure the fields are // actually safe. } else { false }; // We can't completely trust `repr(C)` markings, so make sure the fields are actually safe. let mut all_phantom = !variant.fields.is_empty(); for field in &variant.fields { match self.check_field_type_for_ffi(cache, &field, args) { FfiSafe => { all_phantom = false; } FfiPhantom(..) if !def.repr().transparent() && def.is_enum() => { return FfiUnsafe { ty, reason: fluent::lint_improper_ctypes_enum_phantomdata, help: None, }; } FfiPhantom(..) => {} r => return transparent_safety.unwrap_or(r), all_phantom &= match self.check_field_type_for_ffi(cache, &field, args) { FfiSafe => false, // `()` fields are FFI-safe! FfiUnsafe { ty, .. } if ty.is_unit() => false, FfiPhantom(..) => true, r @ FfiUnsafe { .. } => return r, } } if all_phantom { FfiPhantom(ty) } else { transparent_safety.unwrap_or(FfiSafe) } if all_phantom { FfiPhantom(ty) } else if transparent_with_all_zst_fields { FfiUnsafe { ty, reason: fluent::lint_improper_ctypes_struct_zst, help: None } } else { FfiSafe } } /// Checks if the given type is \"ffi-safe\" (has a stable, well-defined", "positive_passages": [{"docid": "doc-en-rust-8352c3ba10240db2f5ca27252eadfe2a73e84255e191404caefbde7ddd6a1eae", "text": "The function itself is considered FFI-safe and does not trigger the warning (). Its function pointer should also be allowed, to be consistent. Discovered on CI The original code has several more levels of indirection, but is also considered FFI-safe before. FfiResult<'tcx> { use FfiResult::*; let transparent_safety = def.repr().transparent().then(|| { // Can assume that at most one field is not a ZST, so only check // that field's type for FFI-safety. let transparent_with_all_zst_fields = if def.repr().transparent() { if let Some(field) = transparent_newtype_field(self.cx.tcx, variant) { return self.check_field_type_for_ffi(cache, field, args); // Transparent newtypes have at most one non-ZST field which needs to be checked.. match self.check_field_type_for_ffi(cache, field, args) { FfiUnsafe { ty, .. } if ty.is_unit() => (), r => return r, } false } else { // All fields are ZSTs; this means that the type should behave // like (), which is FFI-unsafe... except if all fields are PhantomData, // which is tested for below FfiUnsafe { ty, reason: fluent::lint_improper_ctypes_struct_zst, help: None } // ..or have only ZST fields, which is FFI-unsafe (unless those fields are all // `PhantomData`). true } }); // We can't completely trust repr(C) markings; make sure the fields are // actually safe. } else { false }; // We can't completely trust `repr(C)` markings, so make sure the fields are actually safe. let mut all_phantom = !variant.fields.is_empty(); for field in &variant.fields { match self.check_field_type_for_ffi(cache, &field, args) { FfiSafe => { all_phantom = false; } FfiPhantom(..) if !def.repr().transparent() && def.is_enum() => { return FfiUnsafe { ty, reason: fluent::lint_improper_ctypes_enum_phantomdata, help: None, }; } FfiPhantom(..) => {} r => return transparent_safety.unwrap_or(r), all_phantom &= match self.check_field_type_for_ffi(cache, &field, args) { FfiSafe => false, // `()` fields are FFI-safe! FfiUnsafe { ty, .. } if ty.is_unit() => false, FfiPhantom(..) => true, r @ FfiUnsafe { .. } => return r, } } if all_phantom { FfiPhantom(ty) } else { transparent_safety.unwrap_or(FfiSafe) } if all_phantom { FfiPhantom(ty) } else if transparent_with_all_zst_fields { FfiUnsafe { ty, reason: fluent::lint_improper_ctypes_struct_zst, help: None } } else { FfiSafe } } /// Checks if the given type is \"ffi-safe\" (has a stable, well-defined", "positive_passages": [{"docid": "doc-en-rust-635c3fdda76f51ba64072b3c9223f9ba0d80a26e5ad9a0c1cf36ece784b6125f", "text": "With and without my pull request, when you change this to , it doesn't lint.\nI'll nominate this issue so that it sees some discussion - see also and .\nI posted some more info on zulip but it may also worth mentioning here. ZST is still zero-sized under repr(C), rather than FFI-unsafe.\nThe issue now also exists in beta. I also found uitests which seems to expect ZST to be FFI-safe, but ends in to suppress the warning and tests nothing.\nWe discussed this in today's meeting. We didn't have consensus that this should warn; at least some people thought the code in the top comment should continue to compile without warnings. We did have consensus that changing that (to warn) would need an FCP. So, we felt that we'd like to see a fix removing the warning applied to beta and nightly, and then separately if someone wants to propose that we change this to warn, we could evaluate that and do an FCP on it. But at the moment the temperature of the team seems to be that we don't have consensus for such an FCP.\nWG-prioritization assigning priority (). label -I-prioritize +P-medium\nlabels -I-lang-nominated We rendered our opinion", "commid": "rust_issue_113436", "tokennum": 276}], "negative_passages": []} {"query_id": "q-en-rust-c9c66cf5de7ff195badda3614ee938ddde4ab0c0f2630ec9876d5153df7b9dd4", "query": "self.pos } // This is only used by a test which asserts that the initialization-tracking is correct. #[cfg(test)] pub fn initialized(&self) -> usize { self.initialized } #[inline] pub fn discard_buffer(&mut self) { self.pos = 0;", "positive_passages": [{"docid": "doc-en-rust-5446e9d4754de4243f0e43a778f61f3abe98aa80b5dd5b260502a66b35a73a53", "text": "I tried this code: I expected to see this happen: Instead, this happened: The problem doesn't occur with optimization enabled. It most recently worked on: Also fails on: modify labels: +regression-from-stable-to-stable -regression-untriaged $DIR/macro-match-nonterminal.rs:2:8 --> $DIR/macro-match-nonterminal.rs:2:6 | LL | ($a, $b) => { | ^ | ^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #40107 ", "positive_passages": [{"docid": "doc-en-rust-bff0c7909d922d8fe06c64d242fffaf2b64c896504e040cc849f6f7a4c5dc8d4", "text": "Here's some code incorrectly defining a macro, because it's missing a fragment specifier. Here's the error message rustc gives me: It's potentially confusing that the error points to the source after the name with the missing fragment specifier. Especially in a complicated macro, it would be better if it pointed to the item which was actually missing the fragment specifier. $DIR/issue-62767.rs:24:5 | LL | use bar::bar; | ^^^^^^^^ error[E0432]: unresolved import `Same` --> $DIR/issue-62767.rs:12:5 | LL | use Same::Same; | ^^^^ `Same` is a variant, not a module error[E0432]: unresolved import `bar::bar` --> $DIR/issue-62767.rs:24:5 | LL | use bar::bar; | ^^^^^^^^ no `bar` in `foo::bar::bar` error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0432`. ", "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-cc0050c07d5211ff9a9d8ec2388f1bee03a69a2790961eceee30809d274e1b01", "query": " error: inconsistent resolution for an import --> $DIR/issue-62767.rs:24:5 | LL | use bar::bar; | ^^^^^^^^ error[E0432]: unresolved import `Same` --> $DIR/issue-62767.rs:12:5 | LL | use Same::Same; | ^^^^ `Same` is a variant, not a module error[E0432]: unresolved import `bar::bar` --> $DIR/issue-62767.rs:24:5 | LL | use bar::bar; | ^^^^^^^^ no `bar` in `foo::bar::bar` error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0432`. ", "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-cc3fef8e4b47ffa895586562a8ced151a36b83b6c39c90291dd721945410d67b", "query": "hashbrown = { version = \"0.4.0\", features = ['rustc-dep-of-std'] } [dependencies.backtrace] version = \"0.3.25\" version = \"0.3.29\" default-features = false # don't use coresymbolication on OSX features = [ \"rustc-dep-of-std\", # enable build support for integrating into libstd", "positive_passages": [{"docid": "doc-en-rust-2688030b981eccadaa1eb7ac0e376efdad0871270b07cf84b46b2c00f0dceed4", "text": "Every since a recent nightly update, both distributed nightlies and locally built produce backtraces where every level of the stack is represented only by their memory address and the label : Sadly I don't have a more specific repro case, but I can consistently reproduce locally. Older distributed nightlies do not present this behavior.\nThis happens consistently for me as well (also macOS).\nI've been seeing this on Linux too, though it's been at least a week. (It also may have been fixed in a rustc newer than the one servo uses)\nWe should have tests for backtraces, so they don't regress again in the future.\nthis is certainly happening on master, and it's been happening for a while, but I assumed it was my env.\nIt just occurred to me that this might be related to the new symbol mangling (although I doubt it).\nI've been experiencing this for about a week now (also on macOS). It definitely started prior to being merged. I also have the following in my :\nhas absolutely no changes if you don't use the flag, so it's not from there.\nIt's definitely , I tried before and after. It works if you enable the \"coresymbolication\" feature, though that's obviously not an option for distribution. I tried the latest master of , but it didn't help.\nTo confirm, is everyone only experiencing problems on OSX for rustc itself? Are there problems with other projects on OSX? can you please confirm or deny your experience from Linux? Throwing in a new platform here changes this quite a lot\nOk I believe I've found the issue for OSX, but if other platforms are still an issue that would be good to know\nI've only experienced this with rustc itself on OSX. Things it builds seem ok, and linux/windows seem to be ok.\nNo, it's still happening on Linux as of yesterday (I can try again today). I also assumed it was my env.\nI think the Linux issue is separate since it's been happening much longer than the OSX one\nHey, this seems to an issue on nightly for Windows (msvc) as well: This uses backtrace via :\nif that's only using the crate and not using libstd, can you open an issue on the repository? The OSX issue should be fixed in , which I'd like to finish testing and then I'll send an update to libstd.", "commid": "rust_issue_61416", "tokennum": 526}], "negative_passages": []} {"query_id": "q-en-rust-cc3fef8e4b47ffa895586562a8ced151a36b83b6c39c90291dd721945410d67b", "query": "hashbrown = { version = \"0.4.0\", features = ['rustc-dep-of-std'] } [dependencies.backtrace] version = \"0.3.25\" version = \"0.3.29\" default-features = false # don't use coresymbolication on OSX features = [ \"rustc-dep-of-std\", # enable build support for integrating into libstd", "positive_passages": [{"docid": "doc-en-rust-2219382cf0eebf4d9af62519759f24c450ee1863a7021afe4f63530ec24433fd", "text": "That could affect Linux as well but I doubt it, so if there are persisting Linux/Windows issues please feel free to let me know. If you can create an isolated problem which uses the crate rather than libstd that's even better!\nDone: rust-lang/backtrace-rs", "commid": "rust_issue_61416", "tokennum": 63}], "negative_passages": []} {"query_id": "q-en-rust-cc62024b1d408addf1cbad821c581c705a820289e6df7fac635253df1efa1830", "query": " error: using function pointers as const generic parameters is forbidden --> $DIR/issue-71611.rs:4:21 | LL | fn func(outer: A) { | ^^^^^^^^^^^^ error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-a975a546d53264829fbcc437898c1ae3226bbbd3547a5a7709fc6837f8ad5556", "text": "I've tried reducing this but wasn't really able to so far. I might try again some other time. The code below currently ICEs on Nightly (). When trying to reproduce locally for the backtrace, I had an older Nightly first () where this actually didn't crash the compiler, so it's apparently a regression. error: using function pointers as const generic parameters is forbidden --> $DIR/issue-71611.rs:4:21 | LL | fn func(outer: A) { | ^^^^^^^^^^^^ error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-a37ceb899c17630c43d86268d2c334b49b32d8976e739ff8c5d02feada9c138d", "text": "produces: error: using function pointers as const generic parameters is forbidden --> $DIR/issue-71611.rs:4:21 | LL | fn func(outer: A) { | ^^^^^^^^^^^^ error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-0083199d2d30907886ae35c5244f2ed3a9c47d95ba1b1870716f3c7161cbdaa4", "text": " $DIR/issue-71611.rs:4:21 | LL | fn func(outer: A) { | ^^^^^^^^^^^^ error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-0a83cfc50ccc7a7796089f355f5c7e9d5f34f5a9518ef005b13e27e8abd3782e", "text": " $DIR/issue-88434-removal-index-should-be-less.rs:10:5 | LL | const _CONST: &[u8] = &f(&[], |_| {}); | -------------- inside `_CONST` at $DIR/issue-88434-removal-index-should-be-less.rs:4:24 ... LL | panic!() | ^^^^^^^^ | | | the evaluated program panicked at 'explicit panic', $DIR/issue-88434-removal-index-should-be-less.rs:10:5 | inside `f::<[closure@$DIR/issue-88434-removal-index-should-be-less.rs:4:31: 4:37]>` at $SRC_DIR/std/src/panic.rs:LL:COL | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error For more information about this error, try `rustc --explain E0080`. ", "positive_passages": [{"docid": "doc-en-rust-37d93b4c9b3a299d62091982ee8d88e0ba959b6cc8732f094c430715f25c2f49", "text": " $DIR/issue-30906.rs:15:5 | LL | test(Compose(f, |_| {})); | ^^^^ one type is more general than the other | = note: expected type `std::ops::FnOnce<(&'x str,)>` found type `std::ops::FnOnce<(&str,)>` error: aborting due to previous error 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-30906.rs:15:5 | LL | test(Compose(f, |_| {})); | ^^^^ one type is more general than the other | = note: expected type `std::ops::FnOnce<(&'x str,)>` found type `std::ops::FnOnce<(&str,)>` error: aborting due to previous error 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-30906.rs:15:5 | LL | test(Compose(f, |_| {})); | ^^^^ one type is more general than the other | = note: expected type `std::ops::FnOnce<(&'x str,)>` found type `std::ops::FnOnce<(&str,)>` error: aborting due to previous error 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-cd7e631e2c9bd7c112d17af0c71221021b06ef7c96b2e88db1a6ea6b79567a83", "query": " error[E0308]: mismatched types --> $DIR/issue-30906.rs:15:5 | LL | test(Compose(f, |_| {})); | ^^^^ one type is more general than the other | = note: expected type `std::ops::FnOnce<(&'x str,)>` found type `std::ops::FnOnce<(&str,)>` error: aborting due to previous error 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-cd83d34d5c66c8bcd39950fb68a4011968f3cbdbf70c71ff42da2ca4db09e24d", "query": "} types::ItemEnum::Method(_) | types::ItemEnum::Module(_) | types::ItemEnum::AssocConst { .. } | types::ItemEnum::AssocType { .. } | types::ItemEnum::PrimitiveType(_) => true, types::ItemEnum::Module(_) | types::ItemEnum::ExternCrate { .. } types::ItemEnum::ExternCrate { .. } | types::ItemEnum::Import(_) | types::ItemEnum::StructField(_) | types::ItemEnum::Variant(_)", "positive_passages": [{"docid": "doc-en-rust-b6360ab68201f972c6a6afa6bde2ed26d67514facdaa6f4315c4f774fe144ab3", "text": "Found via and seems like a different issue than with rustdoc JSON is built labels +A-rustdoc-json +T-rustdoc +I-ICE +requires-nightly +E-needs-mcve\nMCVE: ` modify labels: -E-needs-mcve", "commid": "rust_issue_100531", "tokennum": 62}], "negative_passages": []} {"query_id": "q-en-rust-cd89cc1adf9c0e9f27efff85542efd50e1eb92995a7abf93f5c2f571a34f3b1e", "query": "create_default_session_globals_then(|| { let comment = \"n let a: *i32;n *a = 5;n\"; let stripped = beautify_doc_string(Symbol::intern(comment), CommentKind::Block); assert_eq!(stripped.as_str(), \" let a: *i32;n *a = 5;\"); assert_eq!(stripped.as_str(), \"let a: *i32;n*a = 5;\"); }) }", "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-cdaeff96fcf314b236cf65909b2927dc388ffacbe8bee31a405e3ffdab3673fe", "query": "LL | for _ in &self.h { | + error: aborting due to 2 previous errors error[E0507]: cannot move out of a shared reference --> $DIR/for-i-in-vec.rs:21:19 | LL | for loader in *LOADERS { | ^^^^^^^^ move occurs because value has type `Vec<&u8>`, which does not implement the `Copy` trait | help: consider iterating over a slice of the `Vec<&u8>`'s content | LL | for loader in &*LOADERS { | + error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0507`.", "positive_passages": [{"docid": "doc-en-rust-b346af9554c475d8c4b8eddf0001a891b15b4ea50640138905bb5471ae9d0dd2", "text": " $DIR/for-i-in-vec.rs:21:19 | LL | for loader in *LOADERS { | ^^^^^^^^ move occurs because value has type `Vec<&u8>`, which does not implement the `Copy` trait | help: consider iterating over a slice of the `Vec<&u8>`'s content | LL | for loader in &*LOADERS { | + error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0507`.", "positive_passages": [{"docid": "doc-en-rust-8c76e461f588cbb926c27571748fa732ab09222280c98f1a20fa50b14669dca7", "text": " $DIR/ice-unexpected-inference-var-122549.rs:5:70 | LL | fn const_chunks_exact(&self) -> ConstChunksExact<'a, T, { N }>; | ^^ undeclared lifetime | help: consider introducing lifetime `'a` here | LL | fn const_chunks_exact<'a, const N: usize>(&self) -> ConstChunksExact<'a, T, { N }>; | +++ help: consider introducing lifetime `'a` here | LL | trait ConstChunksExactTrait<'a, T> { | +++ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/ice-unexpected-inference-var-122549.rs:11:34 | LL | struct ConstChunksExact<'rem, T: 'a, const N: usize> {} | - ^^ undeclared lifetime | | | help: consider introducing lifetime `'a` here: `'a,` error[E0046]: not all trait items implemented, missing: `const_chunks_exact` --> $DIR/ice-unexpected-inference-var-122549.rs:9:1 | LL | fn const_chunks_exact(&self) -> ConstChunksExact<'a, T, { N }>; | ------------------------------------------------------------------------------- `const_chunks_exact` from trait ... LL | impl ConstChunksExactTrait for [T] {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `const_chunks_exact` in implementation error[E0392]: lifetime parameter `'rem` is never used --> $DIR/ice-unexpected-inference-var-122549.rs:11:25 | LL | struct ConstChunksExact<'rem, T: 'a, const N: usize> {} | ^^^^ unused lifetime parameter | = help: consider removing `'rem`, referring to it in a field, or using a marker such as `PhantomData` error[E0392]: type parameter `T` is never used --> $DIR/ice-unexpected-inference-var-122549.rs:11:31 | LL | struct ConstChunksExact<'rem, T: 'a, const N: usize> {} | ^ unused type parameter | = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates --> $DIR/ice-unexpected-inference-var-122549.rs:15:13 | LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> { | ^^^^^^^^^^^^^^ unconstrained const parameter | = note: expressions using a const parameter must map each value to a distinct output value = note: proving the result of expressions other than the parameter are unique is not supported error[E0308]: mismatched types --> $DIR/ice-unexpected-inference-var-122549.rs:15:66 | LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> { | ^^ expected `usize`, found `()` error: aborting due to 7 previous errors Some errors have detailed explanations: E0046, E0207, E0261, E0308, E0392. For more information about an error, try `rustc --explain E0046`. ", "positive_passages": [{"docid": "doc-en-rust-c4d321839e011bb53484bb49fe00a523dcc12703786a25dab4e393c9129aabab", "text": " $DIR/ice-unexpected-inference-var-122549.rs:5:70 | LL | fn const_chunks_exact(&self) -> ConstChunksExact<'a, T, { N }>; | ^^ undeclared lifetime | help: consider introducing lifetime `'a` here | LL | fn const_chunks_exact<'a, const N: usize>(&self) -> ConstChunksExact<'a, T, { N }>; | +++ help: consider introducing lifetime `'a` here | LL | trait ConstChunksExactTrait<'a, T> { | +++ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/ice-unexpected-inference-var-122549.rs:11:34 | LL | struct ConstChunksExact<'rem, T: 'a, const N: usize> {} | - ^^ undeclared lifetime | | | help: consider introducing lifetime `'a` here: `'a,` error[E0046]: not all trait items implemented, missing: `const_chunks_exact` --> $DIR/ice-unexpected-inference-var-122549.rs:9:1 | LL | fn const_chunks_exact(&self) -> ConstChunksExact<'a, T, { N }>; | ------------------------------------------------------------------------------- `const_chunks_exact` from trait ... LL | impl ConstChunksExactTrait for [T] {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `const_chunks_exact` in implementation error[E0392]: lifetime parameter `'rem` is never used --> $DIR/ice-unexpected-inference-var-122549.rs:11:25 | LL | struct ConstChunksExact<'rem, T: 'a, const N: usize> {} | ^^^^ unused lifetime parameter | = help: consider removing `'rem`, referring to it in a field, or using a marker such as `PhantomData` error[E0392]: type parameter `T` is never used --> $DIR/ice-unexpected-inference-var-122549.rs:11:31 | LL | struct ConstChunksExact<'rem, T: 'a, const N: usize> {} | ^ unused type parameter | = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates --> $DIR/ice-unexpected-inference-var-122549.rs:15:13 | LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> { | ^^^^^^^^^^^^^^ unconstrained const parameter | = note: expressions using a const parameter must map each value to a distinct output value = note: proving the result of expressions other than the parameter are unique is not supported error[E0308]: mismatched types --> $DIR/ice-unexpected-inference-var-122549.rs:15:66 | LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> { | ^^ expected `usize`, found `()` error: aborting due to 7 previous errors Some errors have detailed explanations: E0046, E0207, E0261, E0308, E0392. For more information about an error, try `rustc --explain E0046`. ", "positive_passages": [{"docid": "doc-en-rust-233244f491af059c761d45817e5d56dfa5fbe6dc00970c3bb2258765bdf1948b", "text": "const N: usizeIterator for ConstChunksExact<'a, T, {}{ | ^^^^^^^^^^^^^^ unconstrained const parameter | = note: expressions using a const parameter must map each value to a distinct output value = note: proving the result of expressions other than the parameter are unique is not supported error[E0308]: mismatched types -- | 9 | impl<'a, T, const N: usizeIterator for ConstChunksExact<'a, T, {}{ | ^^ expected , found thread 'rustc' panicked at unexpected inference var std::option::Option<&'?16 [i32;", "commid": "rust_issue_122549", "tokennum": 166}], "negative_passages": []} {"query_id": "q-en-rust-cdfb570ac931b72983691bad651d137cc924fb54eb51e74aac830ad3a355526b", "query": " error[E0261]: use of undeclared lifetime name `'a` --> $DIR/ice-unexpected-inference-var-122549.rs:5:70 | LL | fn const_chunks_exact(&self) -> ConstChunksExact<'a, T, { N }>; | ^^ undeclared lifetime | help: consider introducing lifetime `'a` here | LL | fn const_chunks_exact<'a, const N: usize>(&self) -> ConstChunksExact<'a, T, { N }>; | +++ help: consider introducing lifetime `'a` here | LL | trait ConstChunksExactTrait<'a, T> { | +++ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/ice-unexpected-inference-var-122549.rs:11:34 | LL | struct ConstChunksExact<'rem, T: 'a, const N: usize> {} | - ^^ undeclared lifetime | | | help: consider introducing lifetime `'a` here: `'a,` error[E0046]: not all trait items implemented, missing: `const_chunks_exact` --> $DIR/ice-unexpected-inference-var-122549.rs:9:1 | LL | fn const_chunks_exact(&self) -> ConstChunksExact<'a, T, { N }>; | ------------------------------------------------------------------------------- `const_chunks_exact` from trait ... LL | impl ConstChunksExactTrait for [T] {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `const_chunks_exact` in implementation error[E0392]: lifetime parameter `'rem` is never used --> $DIR/ice-unexpected-inference-var-122549.rs:11:25 | LL | struct ConstChunksExact<'rem, T: 'a, const N: usize> {} | ^^^^ unused lifetime parameter | = help: consider removing `'rem`, referring to it in a field, or using a marker such as `PhantomData` error[E0392]: type parameter `T` is never used --> $DIR/ice-unexpected-inference-var-122549.rs:11:31 | LL | struct ConstChunksExact<'rem, T: 'a, const N: usize> {} | ^ unused type parameter | = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates --> $DIR/ice-unexpected-inference-var-122549.rs:15:13 | LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> { | ^^^^^^^^^^^^^^ unconstrained const parameter | = note: expressions using a const parameter must map each value to a distinct output value = note: proving the result of expressions other than the parameter are unique is not supported error[E0308]: mismatched types --> $DIR/ice-unexpected-inference-var-122549.rs:15:66 | LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> { | ^^ expected `usize`, found `()` error: aborting due to 7 previous errors Some errors have detailed explanations: E0046, E0207, E0261, E0308, E0392. For more information about an error, try `rustc --explain E0046`. ", "positive_passages": [{"docid": "doc-en-rust-f2f311d69c1d956879f42ba15b1dbf735dae2cfdd294bffea692893fe08f5260", "text": "?0c: usize]stack backtrace: 0: 0x7ff8073a4912 - std::backtracers::backtrace::libunwind::trace::h2da6c6ec1776ed1b at 1: 0x7ff8073a4912 - std::backtracers::backtrace::traceunsynchronized::h0cb696e9cf0107ba at 2: 0x7ff8073a4912 - std::syscommon::backtrace::printfmt::hfb11ed7a7d38a028 at 3: 0x7ff8073a4912 - error[E0261]: use of undeclared lifetime name `'a` --> $DIR/ice-unexpected-inference-var-122549.rs:5:70 | LL | fn const_chunks_exact(&self) -> ConstChunksExact<'a, T, { N }>; | ^^ undeclared lifetime | help: consider introducing lifetime `'a` here | LL | fn const_chunks_exact<'a, const N: usize>(&self) -> ConstChunksExact<'a, T, { N }>; | +++ help: consider introducing lifetime `'a` here | LL | trait ConstChunksExactTrait<'a, T> { | +++ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/ice-unexpected-inference-var-122549.rs:11:34 | LL | struct ConstChunksExact<'rem, T: 'a, const N: usize> {} | - ^^ undeclared lifetime | | | help: consider introducing lifetime `'a` here: `'a,` error[E0046]: not all trait items implemented, missing: `const_chunks_exact` --> $DIR/ice-unexpected-inference-var-122549.rs:9:1 | LL | fn const_chunks_exact(&self) -> ConstChunksExact<'a, T, { N }>; | ------------------------------------------------------------------------------- `const_chunks_exact` from trait ... LL | impl ConstChunksExactTrait for [T] {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `const_chunks_exact` in implementation error[E0392]: lifetime parameter `'rem` is never used --> $DIR/ice-unexpected-inference-var-122549.rs:11:25 | LL | struct ConstChunksExact<'rem, T: 'a, const N: usize> {} | ^^^^ unused lifetime parameter | = help: consider removing `'rem`, referring to it in a field, or using a marker such as `PhantomData` error[E0392]: type parameter `T` is never used --> $DIR/ice-unexpected-inference-var-122549.rs:11:31 | LL | struct ConstChunksExact<'rem, T: 'a, const N: usize> {} | ^ unused type parameter | = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates --> $DIR/ice-unexpected-inference-var-122549.rs:15:13 | LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> { | ^^^^^^^^^^^^^^ unconstrained const parameter | = note: expressions using a const parameter must map each value to a distinct output value = note: proving the result of expressions other than the parameter are unique is not supported error[E0308]: mismatched types --> $DIR/ice-unexpected-inference-var-122549.rs:15:66 | LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> { | ^^ expected `usize`, found `()` error: aborting due to 7 previous errors Some errors have detailed explanations: E0046, E0207, E0261, E0308, E0392. For more information about an error, try `rustc --explain E0046`. ", "positive_passages": [{"docid": "doc-en-rust-8ab20ec649416a55fcb0c7e841f83aeea76636bf1430923471fa2144a13d3c74", "text": "Aas core::ops::function::Fn error[E0261]: use of undeclared lifetime name `'a` --> $DIR/ice-unexpected-inference-var-122549.rs:5:70 | LL | fn const_chunks_exact(&self) -> ConstChunksExact<'a, T, { N }>; | ^^ undeclared lifetime | help: consider introducing lifetime `'a` here | LL | fn const_chunks_exact<'a, const N: usize>(&self) -> ConstChunksExact<'a, T, { N }>; | +++ help: consider introducing lifetime `'a` here | LL | trait ConstChunksExactTrait<'a, T> { | +++ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/ice-unexpected-inference-var-122549.rs:11:34 | LL | struct ConstChunksExact<'rem, T: 'a, const N: usize> {} | - ^^ undeclared lifetime | | | help: consider introducing lifetime `'a` here: `'a,` error[E0046]: not all trait items implemented, missing: `const_chunks_exact` --> $DIR/ice-unexpected-inference-var-122549.rs:9:1 | LL | fn const_chunks_exact(&self) -> ConstChunksExact<'a, T, { N }>; | ------------------------------------------------------------------------------- `const_chunks_exact` from trait ... LL | impl ConstChunksExactTrait for [T] {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `const_chunks_exact` in implementation error[E0392]: lifetime parameter `'rem` is never used --> $DIR/ice-unexpected-inference-var-122549.rs:11:25 | LL | struct ConstChunksExact<'rem, T: 'a, const N: usize> {} | ^^^^ unused lifetime parameter | = help: consider removing `'rem`, referring to it in a field, or using a marker such as `PhantomData` error[E0392]: type parameter `T` is never used --> $DIR/ice-unexpected-inference-var-122549.rs:11:31 | LL | struct ConstChunksExact<'rem, T: 'a, const N: usize> {} | ^ unused type parameter | = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates --> $DIR/ice-unexpected-inference-var-122549.rs:15:13 | LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> { | ^^^^^^^^^^^^^^ unconstrained const parameter | = note: expressions using a const parameter must map each value to a distinct output value = note: proving the result of expressions other than the parameter are unique is not supported error[E0308]: mismatched types --> $DIR/ice-unexpected-inference-var-122549.rs:15:66 | LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> { | ^^ expected `usize`, found `()` error: aborting due to 7 previous errors Some errors have detailed explanations: E0046, E0207, E0261, E0308, E0392. For more information about an error, try `rustc --explain E0046`. ", "positive_passages": [{"docid": "doc-en-rust-3770ce604e307ecf87bb0de5aa5dca377f9e30a2962d0976f04f348794073b3c", "text": "rustcmiddle[]::query::erase::Erased<[u8; 8usize], false, false, false, rustcqueryimpl[]::plumbing::QueryCtxt, false26: 0x7ff80540fa4c - rustcqueryimpl[]::queryimpl::mirborrowck::getquerynonincr::rustendshortbacktrace 27: 0x7ff80599919e - rustcinterface[]::passes::analysis 28: 0x7ff805998425 - rustcqueryimpl[]::plumbing::rustbeginshortbacktrace:: error[E0261]: use of undeclared lifetime name `'a` --> $DIR/ice-unexpected-inference-var-122549.rs:5:70 | LL | fn const_chunks_exact(&self) -> ConstChunksExact<'a, T, { N }>; | ^^ undeclared lifetime | help: consider introducing lifetime `'a` here | LL | fn const_chunks_exact<'a, const N: usize>(&self) -> ConstChunksExact<'a, T, { N }>; | +++ help: consider introducing lifetime `'a` here | LL | trait ConstChunksExactTrait<'a, T> { | +++ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/ice-unexpected-inference-var-122549.rs:11:34 | LL | struct ConstChunksExact<'rem, T: 'a, const N: usize> {} | - ^^ undeclared lifetime | | | help: consider introducing lifetime `'a` here: `'a,` error[E0046]: not all trait items implemented, missing: `const_chunks_exact` --> $DIR/ice-unexpected-inference-var-122549.rs:9:1 | LL | fn const_chunks_exact(&self) -> ConstChunksExact<'a, T, { N }>; | ------------------------------------------------------------------------------- `const_chunks_exact` from trait ... LL | impl ConstChunksExactTrait for [T] {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `const_chunks_exact` in implementation error[E0392]: lifetime parameter `'rem` is never used --> $DIR/ice-unexpected-inference-var-122549.rs:11:25 | LL | struct ConstChunksExact<'rem, T: 'a, const N: usize> {} | ^^^^ unused lifetime parameter | = help: consider removing `'rem`, referring to it in a field, or using a marker such as `PhantomData` error[E0392]: type parameter `T` is never used --> $DIR/ice-unexpected-inference-var-122549.rs:11:31 | LL | struct ConstChunksExact<'rem, T: 'a, const N: usize> {} | ^ unused type parameter | = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates --> $DIR/ice-unexpected-inference-var-122549.rs:15:13 | LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> { | ^^^^^^^^^^^^^^ unconstrained const parameter | = note: expressions using a const parameter must map each value to a distinct output value = note: proving the result of expressions other than the parameter are unique is not supported error[E0308]: mismatched types --> $DIR/ice-unexpected-inference-var-122549.rs:15:66 | LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> { | ^^ expected `usize`, found `()` error: aborting due to 7 previous errors Some errors have detailed explanations: E0046, E0207, E0261, E0308, E0392. For more information about an error, try `rustc --explain E0046`. ", "positive_passages": [{"docid": "doc-en-rust-752c68491e72c169d988ee5ffb1b727f81116b59f9588fd3af9c72dfe40e4067", "text": "rustcspan[]::ErrorGuaranteed33: 0x7ff806223632 - < error[E0261]: use of undeclared lifetime name `'a` --> $DIR/ice-unexpected-inference-var-122549.rs:5:70 | LL | fn const_chunks_exact(&self) -> ConstChunksExact<'a, T, { N }>; | ^^ undeclared lifetime | help: consider introducing lifetime `'a` here | LL | fn const_chunks_exact<'a, const N: usize>(&self) -> ConstChunksExact<'a, T, { N }>; | +++ help: consider introducing lifetime `'a` here | LL | trait ConstChunksExactTrait<'a, T> { | +++ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/ice-unexpected-inference-var-122549.rs:11:34 | LL | struct ConstChunksExact<'rem, T: 'a, const N: usize> {} | - ^^ undeclared lifetime | | | help: consider introducing lifetime `'a` here: `'a,` error[E0046]: not all trait items implemented, missing: `const_chunks_exact` --> $DIR/ice-unexpected-inference-var-122549.rs:9:1 | LL | fn const_chunks_exact(&self) -> ConstChunksExact<'a, T, { N }>; | ------------------------------------------------------------------------------- `const_chunks_exact` from trait ... LL | impl ConstChunksExactTrait for [T] {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `const_chunks_exact` in implementation error[E0392]: lifetime parameter `'rem` is never used --> $DIR/ice-unexpected-inference-var-122549.rs:11:25 | LL | struct ConstChunksExact<'rem, T: 'a, const N: usize> {} | ^^^^ unused lifetime parameter | = help: consider removing `'rem`, referring to it in a field, or using a marker such as `PhantomData` error[E0392]: type parameter `T` is never used --> $DIR/ice-unexpected-inference-var-122549.rs:11:31 | LL | struct ConstChunksExact<'rem, T: 'a, const N: usize> {} | ^ unused type parameter | = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates --> $DIR/ice-unexpected-inference-var-122549.rs:15:13 | LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> { | ^^^^^^^^^^^^^^ unconstrained const parameter | = note: expressions using a const parameter must map each value to a distinct output value = note: proving the result of expressions other than the parameter are unique is not supported error[E0308]: mismatched types --> $DIR/ice-unexpected-inference-var-122549.rs:15:66 | LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> { | ^^ expected `usize`, found `()` error: aborting due to 7 previous errors Some errors have detailed explanations: E0046, E0207, E0261, E0308, E0392. For more information about an error, try `rustc --explain E0046`. ", "positive_passages": [{"docid": "doc-en-rust-e36977c220787aab142908ee942bdb8083ee1a8f21f3cbd4b367402bfddc8d23", "text": " // 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. pub struct Foo; macro_rules! reexport { () => { use Foo as Bar; } } reexport!(); fn main() { use Bar; fn f(_: Bar) {} } ", "positive_passages": [{"docid": "doc-en-rust-4ed5f3e7c30d006b8ae0c302db35d34fe51083573d195853cd1ee7b312610a81", "text": "Test case: Compiles successfully on , causes an ICE on . Diff contains only , CC Found while trying to minimize , but filed separately since the error message is different and this one has a small test case.\nDo you have a backtrace?\nYes of course. Sorry I forgot to include it: rust error: internal compiler error: attempted .defid() on invalid def: Err note: the compiler unexpectedly panicked. this is a bug. note: we would appreciate a bug report: note: run with for a backtrace thread 'rustc' panicked at 'Box // 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. pub struct Foo; macro_rules! reexport { () => { use Foo as Bar; } } reexport!(); fn main() { use Bar; fn f(_: Bar) {} } ", "positive_passages": [{"docid": "doc-en-rust-3f869bf683cb92c6efb9ce17b241b3b98e038dc619b56d732044c1c7dca7a4e4", "text": "stack backtrace: 1: 0x7fc35e73fdf3 - std::sys::imp::backtrace::tracing::imp::write::hdfa3e34b856f69a3 2: 0x7fc35e74e5dd - std::panicking::defaulthook::{{closure}}::h20f8c1082e0ce86e 3: 0x7fc35e74e17b - std::panicking::defaulthook::hd31552ac08c2a241 4: 0x7fc35e74ea68 - std::panicking::rustpanicwithhook::h73969d230a072c1a 5: 0x7fc357eda667 - std::panicking::beginpanic::hb89a2261f4776ce3 6: 0x7fc357eef99f - rustcerrors::Handler::bug::h13b3b29154320abd 7: 0x7fc35bab053a - rustc::session::optspanbugfmt::{{closure}}::hfea18dd68f59976d 8: 0x7fc35baafff7 - rustc::session::optspanbugfmt::h7d370a0810dbdbbd 9: 0x7fc35baafce2 - rustc::session::bugfmt::hcde5f50c54004a4f 10: 0x7fc35b984552 - rustc::hir::def::Def::defid::h728c22aafbe84efc 11: 0x7fc35c6ddb3a - rustcprivacy::ObsoleteVisiblePrivateTypesVisitor::pathisprivatetype::h24756a49a68d1da9 12: 0x7fc35c6d53db - rustc::hir::intravisit::walkty::h64b13c0c45b7a09a 13: 0x7fc35c6d49ba - rustc::hir::intravisit::Visitor::visitfn::ha8ad665c42b1d643 14: 0x7fc35c6de7cf - // 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. pub struct Foo; macro_rules! reexport { () => { use Foo as Bar; } } reexport!(); fn main() { use Bar; fn f(_: Bar) {} } ", "positive_passages": [{"docid": "doc-en-rust-0a78a87238a58388b51c76d2bce695b62363f13eccd958d34e0a663a759e63e8", "text": "'tcxas rustc::hir::intravisit::Visitor<'tcx::visititem::hae9f32c7942ccca1 15: 0x7fc35c6deab5 - // 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. pub struct Foo; macro_rules! reexport { () => { use Foo as Bar; } } reexport!(); fn main() { use Bar; fn f(_: Bar) {} } ", "positive_passages": [{"docid": "doc-en-rust-defdddb9cdf7bf66a32ef96af302c518d28a13d6e129ba3b683eb5cd289dac5b", "text": "Servo compiles with rustc 2016-12-18, but not with 2016-12-21. Diff: The crate fails to build with: The method being called here is: Its return type is which is . This call is in another impl of the same method of the same trait: Adding an explicit type annotation works around this error, but only to uncover another very similar one, then another. The third one was in code generated by serde\u2019s , so I gave up that approach. So far I haven\u2019t managed to reduce a test case smaller than \"most of Servo\", sorry. I\u2019m suspicious of (which is part of ) because it\u2019s commit message mentions inference. I\u2019m not building a compiler to confirm.\nCC\nAlso fails in , so is not to blame. New diff: I don\u2019t have another guess, and doing a full bisect would take a very long time\u2026\nI can't find the cause in that range, at least nothing changed in the compiler AFAICT. Can you try (the commit before larger rollup)?\nExpanding the macro: (Even simplifying it, this is not using ) gives:\nAlright, that matches what I've seen from What about a couple more steps of bisecting? Or maybe compiling this crate with the \"servo\" feature off (which, AFAICT, turns off all the macros 1.1 - they might be responsible).\nSwapping the order of the two arms: Changing the pattern to : Hacking to not use the stable version of the compiler (so effectively disabling the feature and enabling the one) also gives the same error.\nNew range, based on manual bisect: good, bad. Diff: , which leaves only in-between. CC Also found more clues. More context for the code where the error happens: is a module generated by a macro, that contains re-exports of other modules: If I add a similar not in a macro: or if I change the original code to use the real path without going through a , this seems to work around this issue completely. \u2026 only to uncover another one:\nFound another ICE, I don\u2019t know if it\u2019s related: .", "commid": "rust_issue_38535", "tokennum": 464}], "negative_passages": []} {"query_id": "q-en-rust-cdfefbc968bc8d7edb153aae4c5d9950acb5e3bbf7b070f79d823d4a1f577827", "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. pub struct Foo; macro_rules! reexport { () => { use Foo as Bar; } } reexport!(); fn main() { use Bar; fn f(_: Bar) {} } ", "positive_passages": [{"docid": "doc-en-rust-7543a40f27d74d4342aa32483a19220d09b16dcaa29a6b78153e0b862500dc47", "text": "Found a smaller test case for the inference issue: rust fn main() {} pub mod a { pub struct FontFamily; impl FontFamily { pub fn tocss(&self) -::std::fmt::Result { Ok(()) } } } macrorules! reexport { () ={ mod b { pub use a; } } } reexport!(); pub mod c { use b::a::FontFamily; struct FontFace { family: FontFamily } impl FontFace { pub fn tocss(&self) -::std::fmt::Result { try!(()); Ok(()) } } }\nThat \"other ICE\" is actually a direct observation of the bug, whereas this inference issue is some weird side-effect of the way we handle errors that don't stop compilation.\nnever mind, apparently it fails locally\ntriage: P-high Seems bad. Assigning to based on bisection.\nDoes this affect beta ()?\nAt the moment the latest successful nightly build is 3 days old. I don\u2019t know how often playpen\u2019s nigthly is updated. merged 2 days ago. (This is the rollup PR that merged , which introduced this issue if I did my manual bisecting correctly.) As far as I can tell no, is not reachable from and so beta is not affected.\nFixed in .", "commid": "rust_issue_38535", "tokennum": 321}], "negative_passages": []} {"query_id": "q-en-rust-ce07d56957d0340bdfbbb03814deaec4728314a0fbc292b9d7450e71e1c0bb04", "query": "#[deprecated(since(b), note = \"a\")] //~ ERROR incorrect meta item fn f6() { } #[deprecated(note = b\"test\")] //~ ERROR literal in `deprecated` value must be a string fn f7() { } #[deprecated(\"test\")] //~ ERROR item in `deprecated` must be a key/value pair fn f8() { } } #[deprecated(since = \"a\", note = \"b\")]", "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-ce11a43c257a54d3525a93d16fec336a8125f3c01347ae17e81d99f0964206ae", "query": "let a_kind = &a.kind; let b_kind = &b.kind; let compare_layouts = |a, b| -> bool { let a_layout = &cx.layout_of(a).unwrap().layout.abi; let b_layout = &cx.layout_of(b).unwrap().layout.abi; debug!(\"{:?} == {:?} = {}\", a_layout, b_layout, a_layout == b_layout); a_layout == b_layout let compare_layouts = |a, b| -> Result> { debug!(\"compare_layouts({:?}, {:?})\", a, b); let a_layout = &cx.layout_of(a)?.layout.abi; let b_layout = &cx.layout_of(b)?.layout.abi; debug!( \"comparing layouts: {:?} == {:?} = {}\", a_layout, b_layout, a_layout == b_layout ); Ok(a_layout == b_layout) }; #[allow(rustc::usage_of_ty_tykind)]", "positive_passages": [{"docid": "doc-en-rust-468ccd4a38d1e749c9367703e6939501eaa8024bf1f448615f67f00a9dc33f35", "text": " $DIR/auxiliary/dummy_lib.rs:2:1 | 2 + #[derive(Debug)] 3 | #[path = \"auxiliary/dummy_lib.rs\"] 3 | pub struct Dummy; | error: aborting due to previous error", "positive_passages": [{"docid": "doc-en-rust-079e4e301e696092c4c1bf8efc2e463f423426f42a3424141c00cab99ef183bd", "text": " $DIR/default-body-type-err-2.rs:8:9 | LL | 42 | ^^- help: try using a conversion method: `.to_string()` | | | expected struct `String`, found integer error: aborting due to previous error For more information about this error, try `rustc --explain E0308`. ", "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-d0ed0502d973c5c5ac281c14ba70374301efb6c3fc68c394b3093634a06df006", "query": " // check-pass // This is a valid macro. Commit 4 in #95159 broke things such that it failed // with a \"missing tokens in macro arguments\" error, as reported in #95267. macro_rules! f { ( /// ab ) => {}; } fn main() { f!(); } ", "positive_passages": [{"docid": "doc-en-rust-7bb990a61a002c5c5d41b60cbda1cfbfedaa6a354fe905c8867f7ba8e7e3b045", "text": "Cross post from Works fine on stable Rust.\nThat post is written by me. I've opened a PR , and made some comments there. I'm not an expert on Rust, actually I'm an amateur programmer, and this is what I can do for now.\n61.0-nightly ( 2022-03-22) works so this is a very recent nightly regression.\nI see that too when compiling\nsame issue on ubuntu20\nMaybe related to this issue. Here is a snippet of macro with on the match side: Pass with rustc 1.61.0-nightly ( 2022-03-22), you can try this snippet via Failed with rustc 1.61.0-nightly ( 2022-03-23), you can try this snippet via , the code can be expanded on playground with: Expand macros in code using the nightly compiler. 61.0-nightly (2022-03-19 )\nThe piece of code looks surprising, but bisection lead to\nOk, I found it :smile:\nThanks for the report. Should be an easy fix, I will get to it on Monday.\nI think is right to some extent. Even in previous Rust version, stuff in the matcher is not so useful and will be ignored like normal comments : With rustc 1.61.0-nightly ( 2022-03-22) or other versions before, the result is: With rustc 1.61.0-nightly ( 2022-03-23), the result is:\nNote that the playground's nightly is a few days old and cannot be upgraded because of how this issue affects ring ;-)\nAssigning priority as discussed in the of the Prioritization Working Group. label -I-prioritize +P-critical\nThat's an interesting observation! But I'm not a language expert and I never intended to change behaviour in , so I will fix this problem by going back to the old behaviour.", "commid": "rust_issue_95267", "tokennum": 412}], "negative_passages": []} {"query_id": "q-en-rust-d101bb23941436185146489355abaa6d40ff3d35640a086f7b7199a8b2572243", "query": "make_test!(split_space_str, s, s.split(\" \").count()); make_test!(split_ad_str, s, s.split(\"ad\").count()); make_test!(to_lowercase, s, s.to_lowercase()); ", "positive_passages": [{"docid": "doc-en-rust-961790a25bd75ee2c479124a7f558092b5ec648a9746f05924ac71ad9641aadb", "text": "I'm looking into the performance of / on mostly ascii strings, using a small microbenchmark to . Using linux perf tooling I see that the hot part of the code is the following large loop, which despite heavy use of sse2 instructions only seems to process 32 bytes per iteration. I don't see an easy way to improve the autovectorization of this code, but it should be relatively easy to explicitly vectorize it using , and I would like to prepare such a PR if there are no objections. As far as I know, is already in use inside , for example by .\nThe way the loop ors the bits for the is-ascii check into a single usize doesn't seem ideal for vectorization. keeping the lanes independent should yield better autovectorization results.\nThanks for the suggestion. I already started with a simd implementation, but now checked again if the autovectorization could be improved. With the following main loop The assembly and performance is indeed better, but there is still some weird shuffling and shifting going on: The explicit simd version looks a bit better, mostly because the ascii check directly translates to a : Do you have a preference here between autovectorization and explicit simd?\nIf the SIMD impl results in reasonable code across architectures, including some without SIMD then that should be fine. I think it would be the first time where we use portable simd unconditionally, so it could use some additional scrutiny. If it's only meant to target x86 with SSE2 then that'd mean having multiple paths and in that case we'd still have to tweak the generic path anyway. At that point we might as well just optimize the latter further. You can probably get rid of those too by keeping multiple bools in a small array. That way the optimizer will more easily see that it can shove them into independent simd lanes. Increasing the unroll count might help too to fit better into simd registers. We do get pretty decent autovectorization in other places in the standard library by massaging things into a state that basically looks like arrays-instead-of-SIMD-types. E.g.\nIt seems llvm is too \"smart\" for this trick, on its own that generates the exact same code. The trick does work, although it seems a bit fragile.", "commid": "rust_issue_123712", "tokennum": 501}], "negative_passages": []} {"query_id": "q-en-rust-d101bb23941436185146489355abaa6d40ff3d35640a086f7b7199a8b2572243", "query": "make_test!(split_space_str, s, s.split(\" \").count()); make_test!(split_ad_str, s, s.split(\"ad\").count()); make_test!(to_lowercase, s, s.to_lowercase()); ", "positive_passages": [{"docid": "doc-en-rust-83f4aa3053a0d5ed2f67bcdac0e3a87d344af80896820336b2eb9ec8791f3d2c", "text": "The following creates a instruction just like the simd version, but a slightly different alternative with a array and comparing against 0 does not. It only needs to be better than the autovectorized version on those platforms ;) My initial idea was to gate the simd code on either SSE2 or Neon (possibly also Altivec and RiscV). I'd also add a scalar loop for the non-multiple-of-N remainder, so all-ascii strings are fully handled by specialized code. Currently this remainder goes through the generic and code path. On other platforms, only the scalar loop would be used, since I assume the autovectorization would also generate suboptimal code. But I agree that if similar code quality can be achieved with autovectorization, that would be preferable. I'll open a PR after a little bit more polishing the code.", "commid": "rust_issue_123712", "tokennum": 188}], "negative_passages": []} {"query_id": "q-en-rust-d167f43369e4076f39e3448c2575744086ceefc98f835f95c089059fae2fa969", "query": "should_continue = suggest(err, false, span, message, sugg); } } LifetimeRibKind::Item => break, LifetimeRibKind::Item | LifetimeRibKind::ConstParamTy => break, _ => {} } if !should_continue {", "positive_passages": [{"docid": "doc-en-rust-069d28633ae9d648b5bf2f905a638ad1e21fd30da30065bffd12366a26e281e8", "text": " $DIR/issue-60075.rs:6:10 | LL | }); | ^ expected one of `.`, `;`, `?`, `else`, or an operator here error: expected one of `async`, `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found `;` --> $DIR/issue-60075.rs:6:11 | LL | fn qux() -> Option { | - unclosed delimiter LL | let _ = if true { LL | }); | ^ | | | help: `}` may belong here error: expected identifier, found `;` --> $DIR/issue-60075.rs:6:11 | LL | }); | ^ expected identifier error: missing `fn`, `type`, or `const` for trait-item declaration --> $DIR/issue-60075.rs:6:12 | LL | }); | ____________^ LL | | LL | | LL | | LL | | LL | | Some(4) | |________^ missing `fn`, `type`, or `const` error: aborting due to 4 previous errors ", "positive_passages": [{"docid": "doc-en-rust-68fe9b0c8367f76418ff4f464e904197240b90ec5b8899ffe67dbf2985d59d33", "text": "I got an internal compiler error while compiling some code with a syntax error. The error is in the final line of the match statement in the function parse. () Errors:\ntriage: P-high. (Unnominating since there doesn't seem to be much else to discuss)\nAssigning myself to look into and fix.\n:\nthis ICE only happens for already broken code, I don't believe this is P-high.", "commid": "rust_issue_60075", "tokennum": 90}], "negative_passages": []} {"query_id": "q-en-rust-d2a9b468c3c9b5bdeee7425e371e920aa59fe5bb857ffc5d0876eb6f4eb5b1ca", "query": "_ => (), } } FnKind::ItemFn(name, ..) => { FnKind::ItemFn(name, _, _, _, abi, _, attrs) => { // Skip foreign-ABI #[no_mangle] functions (Issue #31924) if abi != Abi::Rust && attr::find_by_name(attrs, \"no_mangle\").is_some() { return; } self.check_snake_case(cx, \"function\", &name.as_str(), Some(span)) } FnKind::Closure(_) => (),", "positive_passages": [{"docid": "doc-en-rust-b3d36a73cd8a2b13c34f447603ba9bab4555ef181421ca124208db0c3a183fbb", "text": "Since the function is tagged the exact name presumably has to exactly match something that another system is expecting, which may not be snake case. For example, JNI bindings will look something like\nModifying lints requires an RFC now, as it can impact a LOT of code.\n(By modifying I mean \"major changes\" not bugfixes)\nHm, while I think new lints definitely want an RFC, modifications to existing ones can probably go through the lang team's nomination process, leading to either an immediate decision or request for RFC.\nI'm fine with that, just following (what I thought was) procedure. :smile:", "commid": "rust_issue_31924", "tokennum": 129}], "negative_passages": []} {"query_id": "q-en-rust-d2baf51afa680e692110c2f9336890b60d9496d1b5a96a3a583d69845792ed1c", "query": "- [What is rustdoc?](what-is-rustdoc.md) - [Command-line arguments](command-line-arguments.md) - [How to read rustdoc output](how-to-read-rustdoc.md) - [In-doc settings](read-documentation/in-doc-settings.md) - [How to write documentation](how-to-write-documentation.md) - [What to include (and exclude)](write-documentation/what-to-include.md) - [The `#[doc]` attribute](write-documentation/the-doc-attribute.md)", "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-d2cd7944dd4fc761ea8fbb83ff854778494ca8d3e534e1629a1c9af008a0215b", "query": "// Each call to `fill_buf` sets `filled` to indicate how many bytes at the start of `buf` are // initialized with bytes from a read. filled: usize, // This is the max number of bytes returned across all `fill_buf` calls. We track this so that we // can accurately tell `read_buf` how many bytes of buf are initialized, to bypass as much of its // defensive initialization as possible. Note that while this often the same as `filled`, it // doesn't need to be. Calls to `fill_buf` are not required to actually fill the buffer, and // omitting this is a huge perf regression for `Read` impls that do not. initialized: usize, } impl Buffer { #[inline] pub fn with_capacity(capacity: usize) -> Self { let buf = Box::new_uninit_slice(capacity); Self { buf, pos: 0, filled: 0 } Self { buf, pos: 0, filled: 0, initialized: 0 } } #[inline]", "positive_passages": [{"docid": "doc-en-rust-5446e9d4754de4243f0e43a778f61f3abe98aa80b5dd5b260502a66b35a73a53", "text": "I tried this code: I expected to see this happen: Instead, this happened: The problem doesn't occur with optimization enabled. It most recently worked on: Also fails on: modify labels: +regression-from-stable-to-stable -regression-untriaged $DIR/issue-102335-ty.rs:2:17 | LL | type A: S = ()>; | ^^^^^^^^^ 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/issue-67123.rs:2:13 | LL | fn foo(t: T) { | - help: consider restricting this bound: `T: Copy` LL | || { t; t; }; | - ^ value used here after move | | | value moved here | = note: move occurs because `t` has type `T`, which does not implement the `Copy` trait error: aborting due to previous error For more information about this error, try `rustc --explain E0382`. ", "positive_passages": [{"docid": "doc-en-rust-56146b5b7eac9a94155e29b4d10354611c8e903a97b513d9a2c8ba6214ddef7c", "text": "I encounter an ICE: with rustc 1.41.0-nightly ( 2019-12-06) running on x86_64-pc-windows-msvc when compiling The Stable compiler outputs But Nightly crashed.\nConfirmed on Linux too. Some(pat.span), PatKind::Ident(.., Some(ref sub)) if sub.is_rest() => { // The `HirValidator` is merciless; add a `_` pattern to avoid ICEs. after.push(self.pat_wild_with_node_id_of(pat)); PatKind::Ident(ref bm, ident, Some(ref sub)) if sub.is_rest() => { // #69103: Lower into `binding @ _` as above to avoid ICEs. after.push(lower_rest_sub(self, pat, bm, ident, sub)); Some(sub.span) } _ => None,", "positive_passages": [{"docid": "doc-en-rust-0489f46ff12c4bce4972c67faff50e0b64c6a4338130f902673bc284c1641a7d", "text": "The ICE only occurs when is used. $DIR/issue-71382.rs:15:23 | LL | fn test(&self) { | ^^^^ error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-a975a546d53264829fbcc437898c1ae3226bbbd3547a5a7709fc6837f8ad5556", "text": "I've tried reducing this but wasn't really able to so far. I might try again some other time. The code below currently ICEs on Nightly (). When trying to reproduce locally for the backtrace, I had an older Nightly first () where this actually didn't crash the compiler, so it's apparently a regression. error: using function pointers as const generic parameters is forbidden --> $DIR/issue-71382.rs:15:23 | LL | fn test(&self) { | ^^^^ error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-a37ceb899c17630c43d86268d2c334b49b32d8976e739ff8c5d02feada9c138d", "text": "produces: error: using function pointers as const generic parameters is forbidden --> $DIR/issue-71382.rs:15:23 | LL | fn test(&self) { | ^^^^ error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-0083199d2d30907886ae35c5244f2ed3a9c47d95ba1b1870716f3c7161cbdaa4", "text": " $DIR/issue-71382.rs:15:23 | LL | fn test(&self) { | ^^^^ error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-0a83cfc50ccc7a7796089f355f5c7e9d5f34f5a9518ef005b13e27e8abd3782e", "text": " $DIR/issue-90315.rs:4:28 | LL | for _i in 0..arr.len().rev() { | ^^^ can't call method `rev` on type `usize` | help: you must surround the range in parentheses to call its `rev` function | LL | for _i in (0..arr.len()).rev() { | + + error[E0689]: can't call method `rev` on type `{integer}` --> $DIR/issue-90315.rs:12:20 | LL | for i in 1..11.rev() { | ^^^ can't call method `rev` on type `{integer}` | help: you must surround the range in parentheses to call its `rev` function | LL | for i in (1..11).rev() { | + + error[E0689]: can't call method `rev` on type `usize` --> $DIR/issue-90315.rs:18:21 | LL | for i in 1..end.rev() { | ^^^ can't call method `rev` on type `usize` | help: you must surround the range in parentheses to call its `rev` function | LL | for i in (1..end).rev() { | + + error[E0689]: can't call method `rev` on type `usize` --> $DIR/issue-90315.rs:23:27 | LL | for i in 1..(end + 1).rev() { | ^^^ can't call method `rev` on type `usize` | help: you must surround the range in parentheses to call its `rev` function | LL | for i in (1..(end + 1)).rev() { | + + error[E0689]: can't call method `is_empty` on type `usize` --> $DIR/issue-90315.rs:28:21 | LL | if 1..(end + 1).is_empty() { | ^^^^^^^^ can't call method `is_empty` on type `usize` | help: you must surround the range in parentheses to call its `is_empty` function | LL | if (1..(end + 1)).is_empty() { | + + error[E0308]: mismatched types --> $DIR/issue-90315.rs:28:8 | LL | if 1..(end + 1).is_empty() { | ^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range` | = note: expected type `bool` found struct `std::ops::Range<{integer}>` error[E0689]: can't call method `is_sorted` on type `usize` --> $DIR/issue-90315.rs:34:21 | LL | if 1..(end + 1).is_sorted() { | ^^^^^^^^^ can't call method `is_sorted` on type `usize` | help: you must surround the range in parentheses to call its `is_sorted` function | LL | if (1..(end + 1)).is_sorted() { | + + error[E0308]: mismatched types --> $DIR/issue-90315.rs:34:8 | LL | if 1..(end + 1).is_sorted() { | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range` | = note: expected type `bool` found struct `std::ops::Range<{integer}>` error[E0689]: can't call method `take` on type `{integer}` --> $DIR/issue-90315.rs:40:26 | LL | let _res: i32 = 3..6.take(2).sum(); | ^^^^ can't call method `take` on type `{integer}` | help: you must surround the range in parentheses to call its `take` function | LL | let _res: i32 = (3..6).take(2).sum(); | + + error[E0308]: mismatched types --> $DIR/issue-90315.rs:40:21 | LL | let _res: i32 = 3..6.take(2).sum(); | --- ^^^^^^^^^^^^^^^^^^ expected `i32`, found struct `std::ops::Range` | | | expected due to this | = note: expected type `i32` found struct `std::ops::Range<{integer}>` error[E0689]: can't call method `sum` on type `{integer}` --> $DIR/issue-90315.rs:45:26 | LL | let _sum: i32 = 3..6.sum(); | ^^^ can't call method `sum` on type `{integer}` | help: you must surround the range in parentheses to call its `sum` function | LL | let _sum: i32 = (3..6).sum(); | + + error[E0308]: mismatched types --> $DIR/issue-90315.rs:45:21 | LL | let _sum: i32 = 3..6.sum(); | --- ^^^^^^^^^^ expected `i32`, found struct `std::ops::Range` | | | expected due to this | = note: expected type `i32` found struct `std::ops::Range<{integer}>` error[E0689]: can't call method `rev` on type `usize` --> $DIR/issue-90315.rs:53:21 | LL | for _a in a..=b.rev() { | ^^^ can't call method `rev` on type `usize` | help: you must surround the range in parentheses to call its `rev` function | LL | for _a in (a..=b).rev() { | + + error[E0689]: can't call method `contains` on type `{integer}` --> $DIR/issue-90315.rs:58:21 | LL | let _res = ..10.contains(3); | ^^^^^^^^ can't call method `contains` on type `{integer}` | help: you must surround the range in parentheses to call its `contains` function | LL | let _res = (..10).contains(3); | + + error[E0599]: no method named `error_method` found for type `usize` in the current scope --> $DIR/issue-90315.rs:62:15 | LL | if 1..end.error_method() { | ^^^^^^^^^^^^ method not found in `usize` error[E0308]: mismatched types --> $DIR/issue-90315.rs:62:8 | LL | if 1..end.error_method() { | ^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range` | = note: expected type `bool` found struct `std::ops::Range<{integer}>` error[E0599]: `usize` is not an iterator --> $DIR/issue-90315.rs:3:26 --> $DIR/issue-90315.rs:68:18 | LL | for _i in 0..arr.len().rev() { | ^^^ `usize` is not an iterator LL | let _res = b.take(1)..a; | ^^^^ `usize` is not an iterator | = note: the following trait bounds were not satisfied: `usize: Iterator` which is required by `&mut usize: Iterator` error: aborting due to previous error error[E0689]: can't call method `take` on ambiguous numeric type `{integer}` --> $DIR/issue-90315.rs:71:25 | LL | let _res: i32 = ..6.take(2).sum(); | ^^^^ | help: you must specify a concrete type for this numeric value, like `i32` | LL | let _res: i32 = ..6_i32.take(2).sum(); | ~~~~~ error[E0308]: mismatched types --> $DIR/issue-90315.rs:71:21 | LL | let _res: i32 = ..6.take(2).sum(); | --- ^^^^^^^^^^^^^^^^^ expected `i32`, found struct `RangeTo` | | | expected due to this | = note: expected type `i32` found struct `RangeTo<_>` error: aborting due to 19 previous errors For more information about this error, try `rustc --explain E0599`. Some errors have detailed explanations: E0308, E0599, E0689. For more information about an error, try `rustc --explain E0308`. ", "positive_passages": [{"docid": "doc-en-rust-682b7adbbd3dc42a8b59a89b440ba231f3722b0b55b7bc589e66c4fa4d30f269", "text": " $DIR/issue-85026.rs:5:6 | LL | impl dyn AutoTrait {} | ^^^^^^^^^^^^^ impl requires at least one non-auto trait | = note: define and implement a new trait or type instead error[E0785]: cannot define inherent `impl` for a dyn auto trait --> $DIR/issue-85026.rs:8:6 | LL | impl dyn Unpin {} | ^^^^^^^^^ impl requires at least one non-auto trait | = note: define and implement a new trait or type instead error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0785`. ", "positive_passages": [{"docid": "doc-en-rust-98fff49fb40e70119e4c2cd4a7204d534b64789980adb7fe38b3f771d737a394", "text": "Given the following code (): The current output is: This is rather confusing. It's not immediately clear what the difference between and this working code is (): Since is accepted, the user might be confused why would be considered a nominal type when isn't. The real reason why is an error is because it is an block for . Ideally the output should look like:\nIt seems like this only happens with auto traits. Regular traits already emit E0116 in this case (): Note that this still happens with auto traits in the same crate, but in this case wouldn't be applicable (): The diagnostic is still confusing in this case and could be rewritten to explicitly point out that is not allowed. modify labels: +D-confusing +F-auto_traits", "commid": "rust_issue_85026", "tokennum": 162}], "negative_passages": []} {"query_id": "q-en-rust-d6a1ebdcac4c734354e97175b054180735f878ec695c181820f5026ef4ecbc5c", "query": " error[E0277]: the trait bound `&'static mut (): Clone` is not satisfied --> $DIR/issue-93008.rs:5:5 | LL | &'static mut (): Clone, | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `&'static mut ()` | = help: see issue #48214 = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. ", "positive_passages": [{"docid": "doc-en-rust-71b0b3759ab65d55872300b2e31707587c6b35ae4ebfcbc7b4efe6636becb2c5", "text": " $DIR/issue-93008.rs:5:5 | LL | &'static mut (): Clone, | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `&'static mut ()` | = help: see issue #48214 = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. ", "positive_passages": [{"docid": "doc-en-rust-a8b029a36602d18e3fb8ab0b41dc038be269fc325df3a806dbc2e3afd13dda42", "text": "Trying to emulate trivial bounds via generics & associated types panics on stable, beta and nightly. $DIR/async-outside-of-await-issue-121096.rs:7:7 | LL | fn main() { | ---- this is not `async` ... LL | }.await | ^^^^^ only allowed inside `async` functions and blocks error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0728`. ", "positive_passages": [{"docid": "doc-en-rust-63425775d3100ff4499dfa2d540ed9035498323f4387c679988f9a1d8f73b054", "text": " $DIR/doc-alias-assoc-const.rs:11:11 | LL | #[doc(alias = \"CONST_BAZ\")] | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error ", "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-d83ff6bebabce62b6f19ddf7d7d80425f810fcee1d4f1c009680bef6f8e641e7", "query": " // run-rustfix // Regression test for #54505 - range borrowing suggestion had // incorrect syntax (missing parentheses). use std::ops::RangeBounds; // take a reference to any built-in range fn take_range(_r: &impl RangeBounds) {} fn main() { take_range(&(0..1)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(0..1) take_range(&(1..)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(1..) take_range(&(..)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(..) take_range(&(0..=1)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(0..=1) take_range(&(..5)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(..5) take_range(&(..=42)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(..=42) } ", "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-d83ff6bebabce62b6f19ddf7d7d80425f810fcee1d4f1c009680bef6f8e641e7", "query": " // run-rustfix // Regression test for #54505 - range borrowing suggestion had // incorrect syntax (missing parentheses). use std::ops::RangeBounds; // take a reference to any built-in range fn take_range(_r: &impl RangeBounds) {} fn main() { take_range(&(0..1)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(0..1) take_range(&(1..)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(1..) take_range(&(..)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(..) take_range(&(0..=1)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(0..=1) take_range(&(..5)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(..5) take_range(&(..=42)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(..=42) } ", "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-d83ff6bebabce62b6f19ddf7d7d80425f810fcee1d4f1c009680bef6f8e641e7", "query": " // run-rustfix // Regression test for #54505 - range borrowing suggestion had // incorrect syntax (missing parentheses). use std::ops::RangeBounds; // take a reference to any built-in range fn take_range(_r: &impl RangeBounds) {} fn main() { take_range(&(0..1)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(0..1) take_range(&(1..)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(1..) take_range(&(..)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(..) take_range(&(0..=1)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(0..=1) take_range(&(..5)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(..5) take_range(&(..=42)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(..=42) } ", "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-d83ff6bebabce62b6f19ddf7d7d80425f810fcee1d4f1c009680bef6f8e641e7", "query": " // run-rustfix // Regression test for #54505 - range borrowing suggestion had // incorrect syntax (missing parentheses). use std::ops::RangeBounds; // take a reference to any built-in range fn take_range(_r: &impl RangeBounds) {} fn main() { take_range(&(0..1)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(0..1) take_range(&(1..)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(1..) take_range(&(..)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(..) take_range(&(0..=1)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(0..=1) take_range(&(..5)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(..5) take_range(&(..=42)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(..=42) } ", "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-d845f28c0e6fb3aafbf9b0cc8d6338405098b18e9e3365bca1f066397dd6837c", "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. struct X(int); enum Enum { Variant1, Variant2 } impl Drop for X { fn drop(&mut self) {} } impl Drop for Enum { fn drop(&mut self) {} } fn main() { let foo = X(1i); drop(foo); match foo { //~ ERROR use of moved value X(1i) => (), _ => unreachable!() } let e = Variant2; drop(e); match e { //~ ERROR use of moved value Variant1 => unreachable!(), Variant2 => () } } ", "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-d88a207f0a052351c29c10b68b39fe3eca6dbe645720d5e25fe040bb0e01a6de", "query": "} } /// Check if node is an impl block. pub fn is_impl_block(&self) -> bool { matches!(self, OwnerNode::Item(Item { kind: ItemKind::Impl(_), .. })) } expect_methods_self! { expect_item, &'hir Item<'hir>, OwnerNode::Item(n), n; expect_foreign_item, &'hir ForeignItem<'hir>, OwnerNode::ForeignItem(n), n;", "positive_passages": [{"docid": "doc-en-rust-68f8b75692d8f63eed2d856cfd70368bbc658284b057437402f6bbaeda60ca39", "text": " $DIR/import-crate-var.rs:7:5 error: `$crate` may not be imported --> $DIR/import-crate-var.rs:6:5 | LL | m!(); | ^^^^^ | = note: `use $crate;` was erroneously allowed and will become a hard error in a future release = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-b1119119317c0a4693a12f5e3eaa2d16f5cf978893f5d048e050a2ba1d77a229", "text": "The warning was introduced in to avoid breakage from .\nPresumably the next step is to make this an error by default.\nTriage: Digging through all the linked issues is tough, and it's not clear to me exactly what this warning is or does. can you maybe elaborate a little?\nThis needs to be turned into an error, i.e. behave like basically:\nRelevant code is here: Should be easy to turn that into and then do a crater run.", "commid": "rust_issue_37390", "tokennum": 95}], "negative_passages": []} {"query_id": "q-en-rust-d94f6ca173d968bcb8e60addd0fd5636f9ffa07b8d2274080f327841e1336c47", "query": "//@ aux-build:issue-76736-1.rs //@ aux-build:issue-76736-2.rs // https://github.com/rust-lang/rust/issues/124635 #![crate_name = \"foo\"] #![feature(rustc_private)]", "positive_passages": [{"docid": "doc-en-rust-212ca0b4ab1c891f507cd6d377a598c6871d3dce8f46a7115430a4e32d18741d", "text": "for example lists implementations of in , which aren't visible anyway and the links are also broken.\nNot present in the docs for 1.77.2, regression?\ncc getting multiple reports of this:\nI believe this regressed in (\nThis was closed but it's still happening on current stable docs, in various traits, Debug being the one that seems the worst: ! !\nWhat page are you looking at? I do not see those implementations on\nstable docs, not nightly I understand this was reported the day 1.78.0 was released and 1.79.0 isn't due for a few weeks more, but I feel it should be possible to apply the fix to the current stable docs at least as published on rust- in the meantime\nThe stable docs are tied to the release, so we would have to make a new release to update them. The fix for this is in 1.80, and will reach stable on July 25.\nThere's no way to backport it internally? That's unfortunate. I was hoping it would land for 1.79.0 at least\nClosing then.\nThis can in fact be beta backported.\nAnd it was in\nGood to know, thank you", "commid": "rust_issue_124635", "tokennum": 252}], "negative_passages": []} {"query_id": "q-en-rust-d966f462e46c5827741a805cbeaf94ebc0725a5b80e9cdd4c91f3e330a474951", "query": "use crate::cgu_reuse_tracker::CguReuseTracker; use crate::code_stats::CodeStats; pub use crate::code_stats::{DataTypeKind, FieldInfo, SizeKind, VariantInfo}; use crate::config::{self, CrateType, OutputType, PrintRequest, SwitchWithOptPath}; use crate::config::{self, CrateType, OutputType, SwitchWithOptPath}; use crate::filesearch; use crate::lint::{self, LintId}; use crate::parse::ParseSess;", "positive_passages": [{"docid": "doc-en-rust-06c52e151a7bd517a82a705457b19a4a0c0dcbd3002858a1b249f55728f37234", "text": "LLVM's \"IR-level\" instrumentation, which is used by to generate PGO instrumented binaries, does not yet work with exception handling on Windows MSVC. The problem has been reported to LLVM for C++ here: This also affects Rust programs built with for Windows MSVC. As long as LLVM does not support exception handling there, it is a known limitation that PGO can only be used with on this platform.\nPGO does not yet work on for other reasons (see ). Once it does, we should check if this problem is specific to MSVC.\nI have working x86_64 windows-gnu (64 bit builds use SEH) build with PGO I'll open PR once is merged. I can do testing in meantime. FWIW simple hello world example works fine after going through PGO.\nif you test, be sure to compile your LLVM with assertions: Thanks for looking into it!\nI'll recompile it with assertions today later. Should the test case be using any specific code like ?\nThe following test case runs into the problem with MSVC: See for how the file is compiled.\nIt does not reproduce with gnu toolchain with Rust and LLVM assertions enabled, I'll try to remember about fixing along with gnu profiler.\nCool!\nI just confirmed that (for me locally) PGO seems to work on Windows GNU. That is, I built with instrumentation, ran it, and rebuilt it with the profiling data collected. It worked just fine, no crashes. So I updated the original issue text to just mention MSVC instead of Windows in general.\nIt looks like is a bit too aggressive with its error reporting. For example when invoking rustc, but not compiling in our Firefox build we can the following : I'm not sure the best solution while mw is away; perhaps we should revert for now.\nMaybe we can just convert the error to a warning?\nNot the best long-term solution but seems ok\nIt looks like the was marked fixed a year ago. What's the status of this issue in rustc?", "commid": "rust_issue_61002", "tokennum": 444}], "negative_passages": []} {"query_id": "q-en-rust-d97b71d354fcffe5403a28a2a983df05e94ccb5dd379a40d9daf191abfaf9f5c", "query": "ty::Alias(kind @ (ty::Projection | ty::Opaque), alias_ty) => (kind, alias_ty), ty::Alias(ty::Inherent | ty::Weak, _) => { unreachable!(\"Weak and Inherent aliases should have been normalized away already\") self.tcx().sess.dcx().span_delayed_bug( DUMMY_SP, format!(\"could not normalize {self_ty}, it is not WF\"), ); return; } };", "positive_passages": [{"docid": "doc-en-rust-528d884974dbbb21b0681156f6ad2cfef17bb8e29ead73a20d200411cda18e55", "text": " $DIR/issue-36836.rs:13:17 | LL | impl Foo for Bar {} | ^^^ not found in this scope error: aborting due to previous error For more information about this error, try `rustc --explain E0412`. ", "positive_passages": [{"docid": "doc-en-rust-dc06fa8863a8ce55bff8872e1c336bee49531b4e17d4b996af8d982939c35869", "text": "The second error in this snippet is \"nonsense\" because it says the type parameter is not constrained, while the real error was already reported \u2014 the actual type could not be imported. Found in: rustc 1.13.0-nightly ( 2016-09-26)\n.", "commid": "rust_issue_36836", "tokennum": 58}], "negative_passages": []} {"query_id": "q-en-rust-d9ad791ca2bcd1c5b70a70069ed6f11ee4500fbb6c86e16d1ab6f6c9714f8182", "query": "//! A copy of the `Qualif` trait in `qualify_consts.rs` that is suitable for the new validator. use rustc::hir::def_id::DefId; use rustc::mir::*; use rustc::ty::{self, Ty}; use syntax_pos::DUMMY_SP;", "positive_passages": [{"docid": "doc-en-rust-86643861c54cb62adad667cc42f8a74a34d20e823f04e9fcd90a048959a3a1f2", "text": "root: gb2260-0.1.1: v. root: imperative - 3 (1 gh, 2 ) detected crates which regressed due to this assert!(plan.iter().any(|s| s.name.contains(\"-ui\"))); assert!(plan.iter().any(|s| s.name.contains(\"cfail\"))); assert!(!plan.iter().any(|s| s.name.contains(\"-ui\"))); assert!(plan.iter().any(|s| s.name.contains(\"cfail\"))); assert!(!plan.iter().any(|s| s.name.contains(\"cfail-full\"))); assert!(plan.iter().any(|s| s.name.contains(\"codegen-units\")));", "positive_passages": [{"docid": "doc-en-rust-6db7bee2129b6b17807b6034331f8a7c9c6c43926271e0d899d4faf4b4a88659", "text": "Inlined from Another issue. If a struct has two different custom derives on it and the second one panics, the error span will point to the first one, not the one which panicked. Reproduction Script\nwas \"Reproduction Script\" supposed to be a link? I'm spinning this off from as I don't think it's going to block stabilization and/or closing that issue.\nReproduction script there is a summary tag\n BinaryHeap { BinaryHeap::new() } } #[stable(feature = \"binaryheap_debug\", since = \"1.4.0\")] impl fmt::Debug for BinaryHeap { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_list().entries(self.iter()).finish() } } impl BinaryHeap { /// Creates an empty `BinaryHeap` as a max-heap. ///", "positive_passages": [{"docid": "doc-en-rust-40ed9c67a83597579a0caa9f3eeae78ddba6aa53473b5c231dce69dbd03b5394", "text": "If I run the following code : I get the following error : I don't see any reason for the trait Debug not to be implemented for BinaryHeap. If seeing the nodes of it is a problem, at least a could be enough.\nShould be fine to display the elements -- probably an oversight?\nProbably an oversight. Implementing the solution shouldn't take more than a line (few at most) and it is annoying that you can't easily implement debug for struct owning one BinaryHeap.", "commid": "rust_issue_28154", "tokennum": 109}], "negative_passages": []} {"query_id": "q-en-rust-d9eab52588a71f894f18e3423d84d2c8b35b4d01aeaf5a1cff5234bf03c86957", "query": "TyUint(uty) => (Integer::from_attr(tcx, UnsignedInt(uty)), false), _ => bug!(\"non integer discriminant\"), }; let bit_size = int.size().bits(); let amt = 128 - bit_size; if signed { let (min, max) = match int { Integer::I8 => (i8::min_value() as i128, i8::max_value() as i128), Integer::I16 => (i16::min_value() as i128, i16::max_value() as i128), Integer::I32 => (i32::min_value() as i128, i32::max_value() as i128), Integer::I64 => (i64::min_value() as i128, i64::max_value() as i128), Integer::I128 => (i128::min_value(), i128::max_value()), let sext = |u| { let i = u as i128; (i << amt) >> amt }; let val = self.val as i128; let min = sext(1_u128 << (bit_size - 1)); let max = i128::max_value() >> amt; let val = sext(self.val); assert!(n < (i128::max_value() as u128)); let n = n as i128; let oflo = val > max - n; let val = if oflo {", "positive_passages": [{"docid": "doc-en-rust-01e0f300cd17994677786672909bb07fe3480e7b6d51eb9265106228c03e1439", "text": "I was trying to build which pulls in pango 0.1.3 as dependency . While building pango, rustc segfaults meta: Crash happens in So apparently const eval produces a discriminant that doesn't match any variant's discriminant. more concretely, it happens during a match on which is the only discriminant with as its value.\nweird, I am still getting the panic with todays nightly :(\nSame backtrace? We do have a regression test for this exact issue\nYeah, backtrace is identical except for the rustc version string in the ICE notes. :/\nFix confirmed, thanks!", "commid": "rust_issue_49181", "tokennum": 138}], "negative_passages": []} {"query_id": "q-en-rust-da15db96439d95c1e4a8c8ba71840d7a10ad9b521bfdd9e96c10036186996337", "query": " #![feature(non_lifetime_binders)] //~^ WARN the feature `non_lifetime_binders` is incomplete trait Trait { type Assoc; } fn uwu(_: impl for Trait<(), Assoc = impl Trait>) {} //~^ ERROR `impl Trait` can only mention type parameters from an fn or impl fn main() {} ", "positive_passages": [{"docid": "doc-en-rust-06e6378ba44e05509101e46992e2d4c5728912b15a9ea7133d4ed50005836ad1", "text": " $DIR/issue-116781.rs:4:16 | LL | field: fn(($),), | ^ expected pattern error: expected pattern, found `$` --> $DIR/issue-116781.rs:4:16 | LL | field: fn(($),), | ^ expected pattern | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 2 previous errors ", "positive_passages": [{"docid": "doc-en-rust-1bd493e9377663935672203a53ef0aa23698c7d862c10706d21aad60ec37c99d", "text": "File: auto-reduced (treereduce-rust): original: Version information ` Command: $DIR/suggest-trait-alias-instead-of-type.rs:10:18 | LL | struct Struct(S); | ^^^^^^^ type aliases cannot be used as traits | help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias | LL | trait Strings = Iterator; | error: aborting due to previous error For more information about this error, try `rustc --explain E0404`. ", "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-dc80a042d832d5b09a24c77c7bfc6636ce76394547a49ad05e8b69ea8b3722b8", "query": "extra_args.push(\"--disable-minification\"); } doc_std(builder, self.format, stage, target, &out, &extra_args, &self.crates); doc_std(builder, self.format, stage, target, &out, &extra_args, &crates); // Don't open if the format is json if let DocumentationFormat::Json = self.format {", "positive_passages": [{"docid": "doc-en-rust-53c3afd47926276059918bdbab4b9113b37abe27ea6f6e5de087f6e9b910b043", "text": "I have pinned down the regression to a specific commit, thanks to recommending me . searched nightlies: from nightly-2024-07-28 to nightly-2024-07-30 regressed nightly: nightly-2024-07-30 searched commit range: regressed commit: trait T { type A: S = ()>; //~^ ERROR associated type bindings are not allowed here } trait Q {} trait S { type C: Q; } fn main() {} ", "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/dollar-crate-is-keyword.rs:11:23 --> $DIR/dollar-crate-is-keyword.rs:10:23 | LL | use $crate as $crate; | ^^^^^^ expected identifier, found reserved identifier", "positive_passages": [{"docid": "doc-en-rust-b1119119317c0a4693a12f5e3eaa2d16f5cf978893f5d048e050a2ba1d77a229", "text": "The warning was introduced in to avoid breakage from .\nPresumably the next step is to make this an error by default.\nTriage: Digging through all the linked issues is tough, and it's not clear to me exactly what this warning is or does. can you maybe elaborate a little?\nThis needs to be turned into an error, i.e. behave like basically:\nRelevant code is here: Should be easy to turn that into and then do a crater run.", "commid": "rust_issue_37390", "tokennum": 95}], "negative_passages": []} {"query_id": "q-en-rust-de601cffc451d2e6a5ef8f582312f7fa2b61b66c41ab468f5f4cd2baeafda707", "query": "= help: add `#![feature(never_type)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error: aborting due to 5 previous errors error[E0658]: the `!` type is experimental --> $DIR/feature-gate-never_type.rs:16:43 | LL | fn look_ma_no_feature_gate !>() {} | ^ | = note: see issue #35121 for more information = help: add `#![feature(never_type)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the `!` type is experimental --> $DIR/feature-gate-never_type.rs:17:26 | LL | fn tadam(f: &dyn Fn() -> !) {} | ^ | = note: see issue #35121 for more information = help: add `#![feature(never_type)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the `!` type is experimental --> $DIR/feature-gate-never_type.rs:21:30 | LL | fn toudoum() -> impl Fn() -> ! { | ^ | = note: see issue #35121 for more information = help: add `#![feature(never_type)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error: aborting due to 8 previous errors For more information about this error, try `rustc --explain E0658`.", "positive_passages": [{"docid": "doc-en-rust-b1c7c8b19830daf1e58b9cc37965beb83e89400ff6f7a9e278ebeb73199f3e1e", "text": "I tried this code: I expected to see this happen: \u201cerror[E0658]: the type is experimental\u201d Instead, this happened: Successful compilation, as long as I'm using a nightly compiler, but the error when on stable 1.75. This is incorrect because nightly features should always require attributes on nightly (until they're stabilized, which hasn't happened yet for ). $DIR/issue-54505.rs:14:16 | LL | take_range(0..1); | ^^^^ | | | expected reference, found struct `std::ops::Range` | help: consider borrowing here: `&(0..1)` | = note: expected type `&_` found type `std::ops::Range<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505.rs:19:16 | LL | take_range(1..); | ^^^ | | | expected reference, found struct `std::ops::RangeFrom` | help: consider borrowing here: `&(1..)` | = note: expected type `&_` found type `std::ops::RangeFrom<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505.rs:24:16 | LL | take_range(..); | ^^ | | | expected reference, found struct `std::ops::RangeFull` | help: consider borrowing here: `&(..)` | = note: expected type `&_` found type `std::ops::RangeFull` error[E0308]: mismatched types --> $DIR/issue-54505.rs:29:16 | LL | take_range(0..=1); | ^^^^^ | | | expected reference, found struct `std::ops::RangeInclusive` | help: consider borrowing here: `&(0..=1)` | = note: expected type `&_` found type `std::ops::RangeInclusive<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505.rs:34:16 | LL | take_range(..5); | ^^^ | | | expected reference, found struct `std::ops::RangeTo` | help: consider borrowing here: `&(..5)` | = note: expected type `&_` found type `std::ops::RangeTo<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505.rs:39:16 | LL | take_range(..=42); | ^^^^^ | | | expected reference, found struct `std::ops::RangeToInclusive` | help: consider borrowing here: `&(..=42)` | = note: expected type `&_` found type `std::ops::RangeToInclusive<{integer}>` error: aborting due to 6 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-deefe676370d584647586c621f1a526d83a84e2c7c25a2c6360858c1953fe721", "query": " error[E0308]: mismatched types --> $DIR/issue-54505.rs:14:16 | LL | take_range(0..1); | ^^^^ | | | expected reference, found struct `std::ops::Range` | help: consider borrowing here: `&(0..1)` | = note: expected type `&_` found type `std::ops::Range<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505.rs:19:16 | LL | take_range(1..); | ^^^ | | | expected reference, found struct `std::ops::RangeFrom` | help: consider borrowing here: `&(1..)` | = note: expected type `&_` found type `std::ops::RangeFrom<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505.rs:24:16 | LL | take_range(..); | ^^ | | | expected reference, found struct `std::ops::RangeFull` | help: consider borrowing here: `&(..)` | = note: expected type `&_` found type `std::ops::RangeFull` error[E0308]: mismatched types --> $DIR/issue-54505.rs:29:16 | LL | take_range(0..=1); | ^^^^^ | | | expected reference, found struct `std::ops::RangeInclusive` | help: consider borrowing here: `&(0..=1)` | = note: expected type `&_` found type `std::ops::RangeInclusive<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505.rs:34:16 | LL | take_range(..5); | ^^^ | | | expected reference, found struct `std::ops::RangeTo` | help: consider borrowing here: `&(..5)` | = note: expected type `&_` found type `std::ops::RangeTo<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505.rs:39:16 | LL | take_range(..=42); | ^^^^^ | | | expected reference, found struct `std::ops::RangeToInclusive` | help: consider borrowing here: `&(..=42)` | = note: expected type `&_` found type `std::ops::RangeToInclusive<{integer}>` error: aborting due to 6 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-deefe676370d584647586c621f1a526d83a84e2c7c25a2c6360858c1953fe721", "query": " error[E0308]: mismatched types --> $DIR/issue-54505.rs:14:16 | LL | take_range(0..1); | ^^^^ | | | expected reference, found struct `std::ops::Range` | help: consider borrowing here: `&(0..1)` | = note: expected type `&_` found type `std::ops::Range<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505.rs:19:16 | LL | take_range(1..); | ^^^ | | | expected reference, found struct `std::ops::RangeFrom` | help: consider borrowing here: `&(1..)` | = note: expected type `&_` found type `std::ops::RangeFrom<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505.rs:24:16 | LL | take_range(..); | ^^ | | | expected reference, found struct `std::ops::RangeFull` | help: consider borrowing here: `&(..)` | = note: expected type `&_` found type `std::ops::RangeFull` error[E0308]: mismatched types --> $DIR/issue-54505.rs:29:16 | LL | take_range(0..=1); | ^^^^^ | | | expected reference, found struct `std::ops::RangeInclusive` | help: consider borrowing here: `&(0..=1)` | = note: expected type `&_` found type `std::ops::RangeInclusive<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505.rs:34:16 | LL | take_range(..5); | ^^^ | | | expected reference, found struct `std::ops::RangeTo` | help: consider borrowing here: `&(..5)` | = note: expected type `&_` found type `std::ops::RangeTo<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505.rs:39:16 | LL | take_range(..=42); | ^^^^^ | | | expected reference, found struct `std::ops::RangeToInclusive` | help: consider borrowing here: `&(..=42)` | = note: expected type `&_` found type `std::ops::RangeToInclusive<{integer}>` error: aborting due to 6 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-deefe676370d584647586c621f1a526d83a84e2c7c25a2c6360858c1953fe721", "query": " error[E0308]: mismatched types --> $DIR/issue-54505.rs:14:16 | LL | take_range(0..1); | ^^^^ | | | expected reference, found struct `std::ops::Range` | help: consider borrowing here: `&(0..1)` | = note: expected type `&_` found type `std::ops::Range<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505.rs:19:16 | LL | take_range(1..); | ^^^ | | | expected reference, found struct `std::ops::RangeFrom` | help: consider borrowing here: `&(1..)` | = note: expected type `&_` found type `std::ops::RangeFrom<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505.rs:24:16 | LL | take_range(..); | ^^ | | | expected reference, found struct `std::ops::RangeFull` | help: consider borrowing here: `&(..)` | = note: expected type `&_` found type `std::ops::RangeFull` error[E0308]: mismatched types --> $DIR/issue-54505.rs:29:16 | LL | take_range(0..=1); | ^^^^^ | | | expected reference, found struct `std::ops::RangeInclusive` | help: consider borrowing here: `&(0..=1)` | = note: expected type `&_` found type `std::ops::RangeInclusive<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505.rs:34:16 | LL | take_range(..5); | ^^^ | | | expected reference, found struct `std::ops::RangeTo` | help: consider borrowing here: `&(..5)` | = note: expected type `&_` found type `std::ops::RangeTo<{integer}>` error[E0308]: mismatched types --> $DIR/issue-54505.rs:39:16 | LL | take_range(..=42); | ^^^^^ | | | expected reference, found struct `std::ops::RangeToInclusive` | help: consider borrowing here: `&(..=42)` | = note: expected type `&_` found type `std::ops::RangeToInclusive<{integer}>` error: aborting due to 6 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-df2ee66cf497187837fcb76c1d42ba1347d1fa3ab194870795c191e76591568d", "query": "pub type ExternType; } pub trait T { fn test(&self) {} } pub trait G { fn g(&self, n: N) {} } impl ExternType { pub fn f(&self) { pub fn f(&self) {} } } impl T for ExternType { fn test(&self) {} } impl G for ExternType { fn g(&self, n: usize) {} } // @has 'extern_type/foreigntype.ExternType.html' // @has 'extern_type/fn.links_to_extern_type.html' // 'href=\"foreigntype.ExternType.html#method.f\"' // @has 'extern_type/fn.links_to_extern_type.html' // 'href=\"foreigntype.ExternType.html#method.test\"' // @has 'extern_type/fn.links_to_extern_type.html' // 'href=\"foreigntype.ExternType.html#method.g\"' /// See also [ExternType::f] /// See also [ExternType::test] /// See also [ExternType::g] pub fn links_to_extern_type() {}", "positive_passages": [{"docid": "doc-en-rust-f9235ca5dbde0236958be627c9b1ca6b5cad5505f52a5a282d4ad5fe0d24c88d", "text": " $DIR/option-content-move2.rs:9:9 | LL | let mut var = None; | ------- captured outer variable ... LL | move || { | ^^^^^^^ move out of `var` occurs here LL | LL | var = Some(NotCopyable); | --- | | | move occurs because `var` has type `std::option::Option`, which does not implement the `Copy` trait | move occurs due to use in closure error: aborting due to previous error For more information about this error, try `rustc --explain E0507`. ", "positive_passages": [{"docid": "doc-en-rust-95fae3194d2641a2c0e11d953c3145b7ba9cfa019894d4e91cb790e50efdcac1", "text": "gives the error: Error0507 gives a wrong suggestion here:\nError: Label D-invalid-suggestion can only be set by Rust team members Please let know if you're having trouble with this bot.\nmodify labels: A-suggestion-diagnostics C-bug T-compiler", "commid": "rust_issue_67190", "tokennum": 58}], "negative_passages": []} {"query_id": "q-en-rust-df457e71e8e922d2452fc2b0201d8f673895c90b04d5ab6d3b0e431d912891f9", "query": " Subproject commit 130721d6f4e6cba3b910ccdf5e0aa62b9dffc95f Subproject commit 027e428197f3702599cfbb632883768175f49173 ", "positive_passages": [{"docid": "doc-en-rust-3257bef8ef01f009f8b665ba3460381149022df8e0ce60a65db9d415813e3b70", "text": "The and targets force panic=abort. said : This looks related to , which points at these now-merged LLVM changes: It's possible that we do not need to force panic=abort anymore for arm64 Windows as a result. What's the best way to determine if this is still required?\nTheoretically the way to fix this issue is: First Next, run the build Finally, run the tests If that all passes, then the change can land! The tests may be able to be skipped, and some tests may fail, so it may be possible to switch the defaults and we can fixup bugs later. I don't personally have hardware to test these changes on myself, though.\nI occasionally have access to a Windows arm64 laptop, so I'll try and get a rustc build going on it at some point.", "commid": "rust_issue_65313", "tokennum": 175}], "negative_passages": []} {"query_id": "q-en-rust-df70fb20dc8e30beb1669f009f0f872023d56005d496ec1ac96107ef1ec33e5c", "query": " error: unknown start of token: u{2a75} --> $DIR/unicode-double-equals-recovery.rs:1:16 | LL | const A: usize \u2a75 2; | ^ | help: Unicode character '\u2a75' (Two Consecutive Equals Signs) looks like '==' (Double Equals Sign), but it is not | LL | const A: usize == 2; | ~~ error: unexpected `==` --> $DIR/unicode-double-equals-recovery.rs:1:16 | LL | const A: usize \u2a75 2; | ^ | help: try using `=` instead | LL | const A: usize = 2; | ~ error: aborting due to 2 previous errors ", "positive_passages": [{"docid": "doc-en-rust-a7aaa3fd74686a30b6cfd7d26d89bdc2670056406cb578d376a945fbd70871b8", "text": " $DIR/issue-101421.rs:10:8 | LL | ().f::<()>(()); | ^------ help: remove these generics | | | expected 0 generic arguments | note: associated function defined here, with 0 generic parameters --> $DIR/issue-101421.rs:2:8 | LL | fn f(&self, _: ()); | ^ 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/issue-46112.rs:19:21 | 19 | fn main() { test(Ok(())); } | ^^ | | | expected enum `std::option::Option`, found () | help: try using a variant of the expected type: `Some(())` | = note: expected type `std::option::Option<()>` found type `()` error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-e49ba4185dde71f94119aa215224792dda43967d38bcf7e66304f8cab1d0d912", "text": "On nightly rustc (cargo) I get misleading expected type errors. If a crate has the same(?) type it is displayed instead of the std type. I tried this code: I expected to see this happen: (stable rust) Instead, this happened: (nightly) :\nConfirming - broken on nightly (1.23), good on beta.\nbisected across nightlys: bug was injected between and\nSkimming output from , there are a number of different potential culprits. Rather than guess and \"point fingers\" right now, I'll just continue bisecting within that commit range.\nThis is recent enough that we should be able to run bisect-rust on it (cc\nit is cc .\nI'm a little surprised that this would be caused by that PR. I can push a revert but would like to first test locally to make sure that revert that PR will fix this.\nI have misread 's statement. Your PR is not at fault, sorry. I'm doing another search further back to find the causing PR.\nI tried it locally in the meantime and I can confirm it is not :)\nOkay so the bug dates as far back as from September 2nd which is as close to the limit as I dare to go. So to the people in control, please, prolong the limit :).\nsuggests that the bug was introduced much more recently (11-08 to 11-09). Maybe the bisection script was wrong?\nI should probably have read the original issue more closely :). sorry for pinging you! It seems to be cc\nIn particular, I have bisected it down to the commit: I have been trying to further dissect that commit to figure out why it causes the change we observe here. My current hypothesis (that I have not yet managed to confirm) is that it has to do with how we seed the hashmap's hashers with randomized state. (This commit changes our behavior in certain scenarios.) If this hypothesis is actually true, though, then I would think that this represents either a bug in hashmap itself, or a bug in how the compiler is using the hashmap...\nHmm. Its something more subtle than a hashmap-related bug.", "commid": "rust_issue_46112", "tokennum": 470}], "negative_passages": []} {"query_id": "q-en-rust-e5c30c95894f9fd5bf49e6caf9737ee67e3021499cb140ce676043503d1ab38c", "query": " error[E0308]: mismatched types --> $DIR/issue-46112.rs:19:21 | 19 | fn main() { test(Ok(())); } | ^^ | | | expected enum `std::option::Option`, found () | help: try using a variant of the expected type: `Some(())` | = note: expected type `std::option::Option<()>` found type `()` error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-38a2e9b0141ca54f9b5e892f9ac66edbc891b9e1bb584b071524d88c3d6f124f", "text": "In particular, I can reproduce the old behavior on master by just linking in the old crate into (in addtion to linking in the one from ; doing this requires changing the name of the old ), without making any actual calls into the old crate. That, to me, seems very strange. I'm now trying to reduce down the size of the crate that I am linking in (while still causing this delta in behavior).\ntriage: P-high\nI still get a non std types in erros when the path has the same length. That would be okay if it is somehow deterministic, but I get different type errors within the same file for the same types.\nis that a regression from the stable channel? While I absolutely agree that a deterministic result would be better (and better stilll, a deterministic result that favored minimal-length paths rooted at ), I want to triage this appropriately.\nHmm I guess since is the person who filed the original ticket then it is reasonable to infer that they are indeed seeing the described regression compared to the stable channel.\ngives me: seems to work now: Maybe this was some sort of partial compile cache issue? I haven't found a way to reproduce these mixed errors yet.\nThis looks like a duplicate of . That issue has some repro cases that affect the 1.22.1 stable compiler but not 1.21.0.\nWhen I bisected the nightlies by hand on I ended up with a range (...) that does not include the commit identified here. Is it possible that the nondeterministic nature of the bug is also messing with our attempts to bisect? I wonder whether merely linking affects in the same way as it affected this issue.\nAny evidence of this problem existing with the newest nightly?\nAll the cases I tried seem to have been fixed by and . Nicely done! I reported one follow-up in .", "commid": "rust_issue_46112", "tokennum": 396}], "negative_passages": []} {"query_id": "q-en-rust-e5da9f5a08ff9533dbf90aed07e7842aad9a625847faf0ce1285812f4ff9ac38", "query": "options: TargetOptions { // Info about features at https://wiki.debian.org/ArmHardFloatPort features: \"+v7,+vfp3,+d16,+thumb2\".to_string(), features: \"+v7,+vfp3,+d16,+thumb2,-neon\".to_string(), cpu: \"generic\".to_string(), max_atomic_width: 64, .. base", "positive_passages": [{"docid": "doc-en-rust-41552bf2479772acec5e356e176a67f1362b62a3e8fe1f3e23e8026bdfb3e58d", "text": "I was just investigating a that Fedora's rust binaries for armv7hl use NEON, but they should not per , supposedly fixed in . (Fedora's build is 1.11, but I applied that patch.) I can see the exact same issue in the latest official , whose version file says . In particular, they flagged that as a problem. I'm no ARM expert, but from it appears the registers are NEON-only. I believe those instructions using are also a problem, because with VFP3-D16 we should only have to .\nHm looks like it's definitely still there:\n( TIL of ! :open_mouth: )\nJust to confirm: No . This doesn't explicitly mention vs. though. I ran on all binaries in . I see no mention of NEON registers. I see uses of -, but no higher, so I think is OK too. I'll know better if someone with a limited armv7 actually tries to run this, but LGTM!\nThanks for the confirmation", "commid": "rust_issue_36913", "tokennum": 216}], "negative_passages": []} {"query_id": "q-en-rust-e5f0f286a6044cd03fb2a2515ecf70804946a3cf79394990387079810ffd1680", "query": "OverloadedOperator, ClosureInvocation, ForLoop, MatchDiscriminant } #[deriving(PartialEq,Show)]", "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-e60224b86af59e98bb9448aa255f6c76c83aa290d776ba0c4fe5a4ee17c0e1ad", "query": "key!(limit_rdylib_exports, bool); key!(override_export_symbols, opt_list); key!(merge_functions, MergeFunctions)?; key!(mcount = \"target_mcount\"); key!(mcount = \"target-mcount\"); key!(llvm_abiname); key!(relax_elf_relocations, bool); key!(llvm_args, list);", "positive_passages": [{"docid": "doc-en-rust-0ac35f07241d5c8d57b57a971703b047ddc49ae8dfe9c6f9135f10ede69778ce", "text": "Hello everyone, this is my first Issue on the Rust project, let me know if I'm doing anthing wrong ! I am in the process of building a library/runtime for the Wii fully written in Rust. To acheive this goal, I need to cross-compile my library to a custom target I named . The json file contains and along other lines to define the architecture. Normally, the build completes without an issue. On the latest nighlty, the compiler fails and return: Of course, is set to in the file, so this shouldn't happen. It most recently worked on: : It fails on this nightly, currently latest at the time of writing: : I can provide any file or other precision if necessary ! Thanks for reading my report !\nI was also having the some issue and tracked it to this: That commit broke the equivalence between \"target_endian\" and \"target-endian\" by adding a case to the macro without the replace line for it.\ncc\nI'll fix this today.\nFixed in\nI hope this gets merged asap :-)\n(Reopening because isn't merged yet.)", "commid": "rust_issue_78981", "tokennum": 237}], "negative_passages": []} {"query_id": "q-en-rust-e63e1c32b102d2e28d7dab949542051bc833987fc3bff690d2689ffe152be868", "query": "id: fld.new_id(a.id), } } //used in noop_fold_expr, and possibly elsewhere in the future fn fold_mac_(m: &mac, fld: @ast_fold) -> mac { spanned { node: match m.node { mac_invoc_tt(*) => copy m.node }, span: fld.new_span(m.span), node: match m.node { mac_invoc_tt(p,ref tts) => mac_invoc_tt(fld.fold_path(p), fold_tts(*tts,fld)) }, span: fld.new_span(m.span) } } fn fold_tts(tts : &[token_tree], fld: @ast_fold) -> ~[token_tree] { do tts.map |tt| { match *tt { tt_tok(span, ref tok) => tt_tok(span,maybe_fold_ident(tok,fld)), tt_delim(ref tts) => tt_delim(fold_tts(*tts,fld)), tt_seq(span, ref pattern, ref sep, is_optional) => tt_seq(span, fold_tts(*pattern,fld), sep.map(|tok|maybe_fold_ident(tok,fld)), is_optional), tt_nonterminal(sp,ref ident) => tt_nonterminal(sp,fld.fold_ident(*ident)) } } } // apply ident folder if it's an ident, otherwise leave it alone fn maybe_fold_ident(t : &token::Token, fld: @ast_fold) -> token::Token { match *t { token::IDENT(id,followed_by_colons) => token::IDENT(fld.fold_ident(id),followed_by_colons), _ => copy *t } }", "positive_passages": [{"docid": "doc-en-rust-9612a28095f140081db8fb4051e0ee2996b587a802278c0d2ead402b57e19417", "text": "See the case in .\nNot critical for 0.6; de-milestoning\n-- does it make sense for the AST fold to visit macros? Or is the current code correct?\nFrom my perspective: yes, definitely. In particular, I'm going to want ident-folds to hit the idents inside of macro invocations. Could it break code to add this traversal? Well, the only place you're going to see unexpanded macro invocations is prior to expansion, and the only thing inside of macro invocations is tokens, so it seems very unlikely. To summarize: yes, this fold should visit macro invocations.\nIn that case, nominating for milestone 5, production-ready\naccepted for production-ready milestone\nI've implemented this in a local branch, I expect to push it soon (next two days)\ndone, now. FIXME removed downstream.", "commid": "rust_issue_2888", "tokennum": 192}], "negative_passages": []} {"query_id": "q-en-rust-e655a953cec881ce0981db3e177e6ceff64963f1658f281fca523fac8974b0d8", "query": "self.fields.infcx.tcx } fn relate_item_args( &mut self, item_def_id: rustc_hir::def_id::DefId, a_arg: ty::GenericArgsRef<'tcx>, b_arg: ty::GenericArgsRef<'tcx>, ) -> RelateResult<'tcx, ty::GenericArgsRef<'tcx>> { if self.ambient_variance == ty::Variance::Invariant { // Avoid fetching the variance if we are in an invariant // context; no need, and it can induce dependency cycles // (e.g., #41849). relate_args_invariantly(self, a_arg, b_arg) } else { let tcx = self.tcx(); let opt_variances = tcx.variances_of(item_def_id); relate_args_with_variances(self, item_def_id, opt_variances, a_arg, b_arg, false) } } fn relate_with_variance>( &mut self, variance: ty::Variance,", "positive_passages": [{"docid": "doc-en-rust-984bd2cc5e2a7acbf009902bd7c274f0ba42a4999bd245893cbf466bf1db45e4", "text": " $DIR/issue-5035.rs:2:1 | LL | type K = dyn I; | ^^^^^^^^^^^^^^^ LL | trait K = dyn I; | help: a trait with a similar name exists | LL | impl I for isize {} | ^ error: aborting due to 2 previous errors", "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-e7e30fcc88f83d2a7cdcb9218850682b3085a30b6fce1906a96806e51a010e32", "query": " #[deprecated = b\"test\"] //~ ERROR attribute must be of the form fn foo() {} fn main() {} ", "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-e7fe37d9160bad7c20229d5991206be587df3119995679a12280e5831b97762c", "query": "F: FnOnce(&T) -> R { unsafe { let ptr = self.inner.get(); let ptr = (self.inner)().get(); assert!(!ptr.is_null(), \"cannot access a scoped thread local variable without calling `set` first\"); cb(&*ptr)", "positive_passages": [{"docid": "doc-en-rust-d3a17fcf595df93d7fdaf206641cbf31210b9f934d732a7321918aeba82a835a", "text": "There is an in the scoped TLS module, which allows for sharing of data that wasn't meant to be shared. An unqualified should only_ be used when provides some sort of threadsafe locking mechanism. and do not. This lets us, for example, clone an or between threads, in safe code: Here, we have clones from different threads being interleaved, which can cause unsafety if there's a race on the refcount. We could also cause unsafety with a , or any other non-Sync type. basically lets us share across threads even if . I put the sleeps in there because somehow without them the routines are run serially. Note that this is not a problem with the API. I'm using here because to exploit one needs to be able to share across threads, and has an additional bound which doesn't satisfy. Any usable API will probably have to make the assumption that . Nor is this a problem with , since it can be done with , too. Solution: Make it ... I think. I'm not familiar with this API, and I'm not sure why it's even in the first place.\ncc\ncc This seems concerning: this is designed to be thread-local, so that e.g. storing a works (which would be safe, if it were guaranteed to stay on one thread). However currently requires unconditionally, hence this overly-accepting impl.\nQualifying the impl with breaks scoped TLS for (see the associated PR); because becomes no longer and thus can't be stuffed inside a static.\nI believe the only way statics can be safe is by requiring the absence of Sync. That may sound odd, but consider the following: - sending thread-local references across threads is memory unsafe even with no interior mutability a static with no interior mutability is almost entirely useless, certainly not a common case non- containers offering interior mutabilities are cheaper and preferred to ones, where they can be used The main issue is actually within the libstd TLS implementation: is a wrapper for getters so it's unaffected by it, but may live in a static or a global one, depending on whether the platform natively supports TLS or not. -ing a across threads is actually safe on the architectures which do not have native TLS support. However, allowing it on some architectures and not on others is undesirable. Should use an accessor model like ?", "commid": "rust_issue_25894", "tokennum": 518}], "negative_passages": []} {"query_id": "q-en-rust-e7fe37d9160bad7c20229d5991206be587df3119995679a12280e5831b97762c", "query": "F: FnOnce(&T) -> R { unsafe { let ptr = self.inner.get(); let ptr = (self.inner)().get(); assert!(!ptr.is_null(), \"cannot access a scoped thread local variable without calling `set` first\"); cb(&*ptr)", "positive_passages": [{"docid": "doc-en-rust-eb09aa6d966476cbafd4b671dbcb173035b3da9b4f948b04309d3ad104f359cd", "text": "Then the actual borrow of a static is an implementation detail and happens on the thread where the key is used, not where it was itself borrowed.\n\"I believe the only way #[threadlocal] statics can be safe is by requiring the absence of .\" This is wrong, I think. For example, one might use thread local data for intrusive linked lists of hazard pointers. They would be thread local but might still be (one can guarantee existence with scoped threads or in certain circumstances where threads are bound to cores). That said you can obviously come up with other representations. In any case, I've mostly come around to believing that we need a separate lifetime (not just for this, but for things like ensuring that can't catch an error in a thread that changes thread local data, violating exception safety).\nBased on what wrote, it seems like the TLS interface requires a that only allows non- data and is still accessible like one. One idea I had of how to enable this in todays Rust is to make generate a unit like struct instead of a . That struct would be and have a impl: According to this could also help with , but I'm not familiar enough with the TLS API in general to really reason about this.\nI was expecting the impl to target an intermediary type, not the contents themselves. and have their own APIs to deal with. You would still be about to use the TLS API provided by libstd with thread-safe data, it's just the low-level which would have the requirement. Ideas of thread-local lifetimes predate the removal of from , and I'm not sure how relevant they are anymore. I'm also conflating thread-safe data access and thread lifetime... but how long does a thread live? What would unify with? Actually, there's an... easy solution for this. Somehow we were blinded by language semantics, but their details are fluid. It is trivial to make borrows of behave like borrows of an arbitrary rvalue, allowing the resulting reference to be passed down, but not returned. That would ensure that the the thread is just as alive for such borrows as it is for stack ones. would still require a like has, because it may not be when native TLS is supported. But both their APIs are compatible with such a change.\nWouldn't that limit the usability of thread locals in some cases, though?", "commid": "rust_issue_25894", "tokennum": 520}], "negative_passages": []} {"query_id": "q-en-rust-e7fe37d9160bad7c20229d5991206be587df3119995679a12280e5831b97762c", "query": "F: FnOnce(&T) -> R { unsafe { let ptr = self.inner.get(); let ptr = (self.inner)().get(); assert!(!ptr.is_null(), \"cannot access a scoped thread local variable without calling `set` first\"); cb(&*ptr)", "positive_passages": [{"docid": "doc-en-rust-e507448f1c44a111a4174d9c986b25d1e7629e2226af3597169fc832e063390c", "text": "e.g., wouldn't that make it difficult to have a thread local point to another thread local? Maybe I just have to think about it. (BTW, I'm aware we're just talking about the low-level API :)).\nin a , borrows are , I didn't even think of that. First off, a global static shouldn't be allowed to borrow a static. And in general, having borrows in a is going to be difficult to support, except for non- data, because they would be right now. We could disallow borrows or we could give some kind of scope to those borrows. Which makes me think, as a compromise between a lifetime and , there could be a pseudo-(rvalue)-scope. Combined with the ability to leave out in globals' type (or not having a type at all), the scope should bubble up into users of those statics. They would behave as if they were borrowed before everything else in the function where they're used, but still not (and they can't be returned from functions).\nThere's a few intertwined issues here at play, so I just want to quickly summarize the way I see things: This does not affect as it which has an , which while sound should be fixed, allowing removal of the block for . A borrow of a static should not yield something with the lifetime, as that is clearly not sound. I'm not sure I follow why we might require the types in a are not , I haven't quite followed that. Due the cross-platform requirements of std, however, I believe the best solution here is to use the same strategy as with an indirect accessor to ensure the semantics are the same across platforms that have and those that don't (where a normal is used).\ntriage: P-medium This is an unstable API so it's not super-high priority to fix, but we should defnitely fix!\nrequiring that a is not is an easy way to ensure that a borrow of it, while , cannot escape the current thread. I've changed my mind and prefer an rvalue borrow semantic for , but it still is the case that and use non- statics (ignoring the workarounds for ). If was supported everywhere, having rvalue borrow semantics wouldn't hurt the std TLS API (aside from stability issues with ), as the access patterns are already through anonymous lifetimes (references passed to closures).", "commid": "rust_issue_25894", "tokennum": 527}], "negative_passages": []} {"query_id": "q-en-rust-e7fe37d9160bad7c20229d5991206be587df3119995679a12280e5831b97762c", "query": "F: FnOnce(&T) -> R { unsafe { let ptr = self.inner.get(); let ptr = (self.inner)().get(); assert!(!ptr.is_null(), \"cannot access a scoped thread local variable without calling `set` first\"); cb(&*ptr)", "positive_passages": [{"docid": "doc-en-rust-4548a816287d774f6fb27b361f8237086982cfaebdd3d79b1d17d2f843586f99", "text": "Maybe a combined strategy, where borrows of statics are iff the data is not (and rvalue-like otherwise), might work better and would require fewer changes to the std TLS implementation.\nRight, but returning a borrow with a lifetime for a global is unsafe for other reasons (the lifetime of the thread is not ).\nhow can it be abused without sending it to a different thread?\nThe actual values themselves do not have a lifetime, so it can be a source of unsafety to advertise otherwise. For example you could stick a into a TLS value with a destructor, but when the destructor runs that pointer could be invalid.", "commid": "rust_issue_25894", "tokennum": 139}], "negative_passages": []} {"query_id": "q-en-rust-e80445eceb6393b669dcfc76a30590b97d754880cdea65f75d2ad5f12ef4356e", "query": "strings.insert(\"setab\".to_string(), b\"x1B[4%p1%dm\".to_vec()); let mut numbers = HashMap::new(); numbers.insert(\"colors\".to_string(), 8u16); numbers.insert(\"colors\".to_string(), 8); TermInfo { names: vec![\"cygwin\".to_string()], // msys is a fork of an older cygwin version", "positive_passages": [{"docid": "doc-en-rust-0be52d7134628483e752a84539527b57b233b22c838598ac315debc47fada5ee", "text": "does not emit color output when running under a tmux session with set correctly to (supported by the latest versions of ncurses) even with when is set to . On the machine in question (macOS) the term file for is installed and returns the following: Per cargo should be invoking rustc with the flag, and indeed, returns 'Option color given more than once. Executing also does not produce color output, but does.\nI have a similar bug on Archlinux. I used to get colored output on this system, but that recently stopped working for rustc. (Cargo is still fine for me.) If I add in and run in , I get Result::unwrap()Err/lib/terminfo/x/xterm-256colorncursesNEWS file does mention a new (incompatible) file format with a different magic number: Could rustc switch to whatever Cargo uses for colored terminal output?\nA work-around for my machine was temporarily downgrading the packages, and copying the old file to .\nYes rustc should be able to switch at any time\nThanks for the workaround!\nChanging from to also seems to work as a temporary workaround. (note: this may affect other terminal applications)\nAnother work-around if you're using sh: This sets to a possibly incorrect value, but limits its impact to only the output of a command.\nThat worked for me as well. I had no colour with . I downgraded to , which was what I had in , and now I have colour again.\nI have a similar issue: In my regular terminal emulator (not tmux), there are no colors from rustc (as executed with ), colors from cargo itself are working fine. The default setting for there is: . The problem is fixed by setting to . Inside tmux however, colors work just fine, there seems to be by default.\nColors are fixed in the latest nightly (thanks to o/)\nThis is fixed for me in today\u2019s nigthly, presumably by\nWith the current nightly I still have no colors with and have to use as a work around. What might still be broken?\nTerminal colors are still broken with . however, does use colors, so there's clearly still a discrepancy between how and use termcolor\nIt works fine for me with ncurses 6.1, even rustup has colors again since the last version .", "commid": "rust_issue_45728", "tokennum": 507}], "negative_passages": []} {"query_id": "q-en-rust-e80445eceb6393b669dcfc76a30590b97d754880cdea65f75d2ad5f12ef4356e", "query": "strings.insert(\"setab\".to_string(), b\"x1B[4%p1%dm\".to_vec()); let mut numbers = HashMap::new(); numbers.insert(\"colors\".to_string(), 8u16); numbers.insert(\"colors\".to_string(), 8); TermInfo { names: vec![\"cygwin\".to_string()], // msys is a fork of an older cygwin version", "positive_passages": [{"docid": "doc-en-rust-d3eb4c194fc2ffc0547da3226480cf4aa358cabf97db13fbb77559a956dc658d", "text": "I\u2019d like to note though that things like destroy this for some reason (even if is set). It took me some time to figure that out\nI'm using ncurses 6.1 on Fedora 28 and everything appears to be working fine except for test colors. In mentioned that a bit tricky due to how the build works, but we can always tackle that later. What is the barrier to migrating libtest from to ? For now, it's leaving my test output looking like this. !\nI have an in-progress patch for libtest but I ran into I'm guessing that's the build issue that is referring to. I don't know how linking libtest works, but I'm happy to try to fix the build if someone can point me in the right direction.", "commid": "rust_issue_45728", "tokennum": 168}], "negative_passages": []} {"query_id": "q-en-rust-e8384d71584dd881dffccf7a2eab3638b5d2c8bf3180c5fbe4138ec529da46fd", "query": " // force-host // no-prefer-dynamic #![crate_type=\"lib\"] // Issue 111888: this crate (1.) is imported by a proc-macro crate and (2.) // exports a no_mangle function; that combination of acts was broken for some // period of time. See further discussion in the test file that imports this // crate. #[no_mangle] pub fn some_no_mangle_function() { } ", "positive_passages": [{"docid": "doc-en-rust-54f4273d10d11d96b9f2f94f00732d5e546d1e058d700faf379e7d2aa39ca30f", "text": " $DIR/issue-81804.rs:9:11 | LL | fn p([=(} | -- ^ | || | |unclosed delimiter | unclosed delimiter error: this file contains an unclosed delimiter --> $DIR/issue-81804.rs:9:11 | LL | fn p([=(} | -- ^ | || | |unclosed delimiter | unclosed delimiter error: expected pattern, found `=` --> $DIR/issue-81804.rs:9:7 | LL | fn p([=(} | ^ expected pattern error: expected one of `)`, `,`, `->`, `where`, or `{`, found `]` --> $DIR/issue-81804.rs:9:8 | LL | fn p([=(} | ^ -^ | | | | | help: `)` may belong here | unclosed delimiter error: expected item, found `]` --> $DIR/issue-81804.rs:9:11 | LL | fn p([=(} | ^ expected item error: aborting due to 5 previous errors ", "positive_passages": [{"docid": "doc-en-rust-0fecb79afe5e0b749f84e20a492912957a5383ad6e8d8c92d9cc2ec902bed7b7", "text": " $DIR/const-external-macro-const-err.rs:12:5 | LL | static_assert!(2 + 2 == 5); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the len is 1 but the index is 1 | = note: `#[deny(const_err)]` on by default = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-5be1efaa4f15f736953485bbeb706f66be8457f51cfb342311e639baa402759a", "text": "The following does not error locally / on the playground If I copy paste the macro into the same file, it errors as expected Checking other macros, error as expected.\nThis feels like it's related to a similar issue () I created a while back.\ncc\nThis is probably because the \"error\" is just a lint. And we appear to silence it in external macros. We shouldn't do that. IIRC this is just a flag that needs to be set for the lint macro\nYes, we need to set reportinexternal_macro param on the lint I believe\nAh, that makes sense! Building locally with the parameter set to confirm. it does ^^ will check the samples in there too.", "commid": "rust_issue_65300", "tokennum": 151}], "negative_passages": []} {"query_id": "q-en-rust-ec4b1fed5f3b6214eb32da02fd3c2f54318c4f28ff73ee30b9df5ec6c7172b8c", "query": " // Non-regression test for issue #122674: a change in the format args visitor missed nested awaits. //@ edition: 2021 //@ check-pass pub fn f1() -> impl std::future::Future> + Send { async { should_work().await?; Ok(()) } } async fn should_work() -> Result { let x = 1; Err(format!(\"test: {}: {}\", x, inner().await?)) } async fn inner() -> Result { Ok(\"test\".to_string()) } fn main() {} ", "positive_passages": [{"docid": "doc-en-rust-d74640b87445b0882b6c08ef9dc3c2dcb086644b22cee0da21cd545a9c0292b4", "text": "searched nightlies: from nightly-2024-03-07 to nightly-2024-03-10 regressed nightly: nightly-2024-03-09 searched commit range: regressed commit: \"backtrace 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)\", \"backtrace 0.3.29 (registry+https://github.com/rust-lang/crates.io-index)\", ] [[package]]", "positive_passages": [{"docid": "doc-en-rust-2688030b981eccadaa1eb7ac0e376efdad0871270b07cf84b46b2c00f0dceed4", "text": "Every since a recent nightly update, both distributed nightlies and locally built produce backtraces where every level of the stack is represented only by their memory address and the label : Sadly I don't have a more specific repro case, but I can consistently reproduce locally. Older distributed nightlies do not present this behavior.\nThis happens consistently for me as well (also macOS).\nI've been seeing this on Linux too, though it's been at least a week. (It also may have been fixed in a rustc newer than the one servo uses)\nWe should have tests for backtraces, so they don't regress again in the future.\nthis is certainly happening on master, and it's been happening for a while, but I assumed it was my env.\nIt just occurred to me that this might be related to the new symbol mangling (although I doubt it).\nI've been experiencing this for about a week now (also on macOS). It definitely started prior to being merged. I also have the following in my :\nhas absolutely no changes if you don't use the flag, so it's not from there.\nIt's definitely , I tried before and after. It works if you enable the \"coresymbolication\" feature, though that's obviously not an option for distribution. I tried the latest master of , but it didn't help.\nTo confirm, is everyone only experiencing problems on OSX for rustc itself? Are there problems with other projects on OSX? can you please confirm or deny your experience from Linux? Throwing in a new platform here changes this quite a lot\nOk I believe I've found the issue for OSX, but if other platforms are still an issue that would be good to know\nI've only experienced this with rustc itself on OSX. Things it builds seem ok, and linux/windows seem to be ok.\nNo, it's still happening on Linux as of yesterday (I can try again today). I also assumed it was my env.\nI think the Linux issue is separate since it's been happening much longer than the OSX one\nHey, this seems to an issue on nightly for Windows (msvc) as well: This uses backtrace via :\nif that's only using the crate and not using libstd, can you open an issue on the repository? The OSX issue should be fixed in , which I'd like to finish testing and then I'll send an update to libstd.", "commid": "rust_issue_61416", "tokennum": 526}], "negative_passages": []} {"query_id": "q-en-rust-ec54b91e74fcc747f01aac666879fa712d294db5418a3f4120bc70eeebfec899", "query": "version = \"0.12.0\" source = \"registry+https://github.com/rust-lang/crates.io-index\" dependencies = [ \"backtrace 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)\", \"backtrace 0.3.29 (registry+https://github.com/rust-lang/crates.io-index)\", ] [[package]]", "positive_passages": [{"docid": "doc-en-rust-2219382cf0eebf4d9af62519759f24c450ee1863a7021afe4f63530ec24433fd", "text": "That could affect Linux as well but I doubt it, so if there are persisting Linux/Windows issues please feel free to let me know. If you can create an isolated problem which uses the crate rather than libstd that's even better!\nDone: rust-lang/backtrace-rs", "commid": "rust_issue_61416", "tokennum": 63}], "negative_passages": []} {"query_id": "q-en-rust-ec8396aa9eb33bff560af6f0cd7cd12545c3926cea4c2cecd36a0398b92f5650", "query": "Adjust, Adjustment, AutoBorrow, AutoBorrowMutability, PointerCast, }; use rustc_middle::ty::subst::{InternalSubsts, SubstsRef}; use rustc_middle::ty::{self, AdtKind, Ty}; use rustc_middle::ty::{self, AdtKind, Ty, TypeFoldable}; use rustc_span::Span; impl<'tcx> Mirror<'tcx> for &'tcx hir::Expr<'tcx> {", "positive_passages": [{"docid": "doc-en-rust-f93c91d9866ef3a47065d5d1275709e29cedb005edb0674dec9a8b61f45edc93", "text": "The following ICE's on stable, beta and nightly: (notice the was NOT closed) const LOADERS: &Vec<&'static u8> = &Vec::new(); pub fn break_code() -> Option<&'static u8> { for loader in *LOADERS { //~ ERROR cannot move out of a shared reference return Some(loader); } None } fn main() {}", "positive_passages": [{"docid": "doc-en-rust-b346af9554c475d8c4b8eddf0001a891b15b4ea50640138905bb5471ae9d0dd2", "text": " $DIR/issue-36935.rs:17:15 | 17 | #[derive(Foo, Bar)] | ^^^ | = help: message: lolnope ", "positive_passages": [{"docid": "doc-en-rust-6db7bee2129b6b17807b6034331f8a7c9c6c43926271e0d899d4faf4b4a88659", "text": "Inlined from Another issue. If a struct has two different custom derives on it and the second one panics, the error span will point to the first one, not the one which panicked. Reproduction Script\nwas \"Reproduction Script\" supposed to be a link? I'm spinning this off from as I don't think it's going to block stabilization and/or closing that issue.\nReproduction script there is a summary tag\n warning: unused variable: `Mod` --> $DIR/lint-non-snake-case-identifiers-suggestion-reserved.rs:12:9 | LL | let Mod: usize = 0; | ^^^ help: if this is intentional, prefix it with an underscore: `_Mod` | note: the lint level is defined here --> $DIR/lint-non-snake-case-identifiers-suggestion-reserved.rs:1:9 | LL | #![warn(unused)] | ^^^^^^ = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]` warning: unused variable: `Super` --> $DIR/lint-non-snake-case-identifiers-suggestion-reserved.rs:16:9 | LL | let Super: usize = 0; | ^^^^^ help: if this is intentional, prefix it with an underscore: `_Super` error: module `Impl` should have a snake case name --> $DIR/lint-non-snake-case-identifiers-suggestion-reserved.rs:5:5 | LL | mod Impl {} | ^^^^ | note: the lint level is defined here --> $DIR/lint-non-snake-case-identifiers-suggestion-reserved.rs:3:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ help: rename the identifier or convert it to a snake case raw identifier | LL | mod r#impl {} | ^^^^^^ error: function `While` should have a snake case name --> $DIR/lint-non-snake-case-identifiers-suggestion-reserved.rs:8:4 | LL | fn While() {} | ^^^^^ | help: rename the identifier or convert it to a snake case raw identifier | LL | fn r#while() {} | ^^^^^^^ error: variable `Mod` should have a snake case name --> $DIR/lint-non-snake-case-identifiers-suggestion-reserved.rs:12:9 | LL | let Mod: usize = 0; | ^^^ | help: rename the identifier or convert it to a snake case raw identifier | LL | let r#mod: usize = 0; | ^^^^^ error: variable `Super` should have a snake case name --> $DIR/lint-non-snake-case-identifiers-suggestion-reserved.rs:16:9 | LL | let Super: usize = 0; | ^^^^^ help: rename the identifier | = note: `super` cannot be used as a raw identifier error: aborting due to 4 previous errors; 2 warnings emitted ", "positive_passages": [{"docid": "doc-en-rust-65e2f53ee81f8a664977437d82a2bf7f20b4da7e87ff115287568c31bbede52f", "text": "When you write a mod with a capital name of a keyword, we suggest changing it to the lowercase version of the keyword, which is, well, a keyword and not going to work. We should suggest converting the identifier to snake case and making it a raw identifier, or maybe suggest switching to an altogether separate name? $DIR/issue-88434-minimal-example.rs:10:5 | LL | const _CONST: &() = &f(&|_| {}); | ---------- inside `_CONST` at $DIR/issue-88434-minimal-example.rs:4:22 ... LL | panic!() | ^^^^^^^^ | | | the evaluated program panicked at 'explicit panic', $DIR/issue-88434-minimal-example.rs:10:5 | inside `f::<[closure@$DIR/issue-88434-minimal-example.rs:4:25: 4:31]>` at $SRC_DIR/std/src/panic.rs:LL:COL | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error For more information about this error, try `rustc --explain E0080`. ", "positive_passages": [{"docid": "doc-en-rust-37d93b4c9b3a299d62091982ee8d88e0ba959b6cc8732f094c430715f25c2f49", "text": " $DIR/macro-match-nonterminal.rs:2:8 --> $DIR/macro-match-nonterminal.rs:2:6 | LL | ($a, $b) => { | ^ | ^^ error: missing fragment specifier --> $DIR/macro-match-nonterminal.rs:2:8 --> $DIR/macro-match-nonterminal.rs:2:6 | LL | ($a, $b) => { | ^ | ^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #40107 ", "positive_passages": [{"docid": "doc-en-rust-bff0c7909d922d8fe06c64d242fffaf2b64c896504e040cc849f6f7a4c5dc8d4", "text": "Here's some code incorrectly defining a macro, because it's missing a fragment specifier. Here's the error message rustc gives me: It's potentially confusing that the error points to the source after the name with the missing fragment specifier. Especially in a complicated macro, it would be better if it pointed to the item which was actually missing the fragment specifier. $DIR/feature-gate-derive-smart-pointer.rs:5:22 | LL | struct MyPointer<'a, #[pointee] T: ?Sized> { | ^^^^^^^^^^ | = note: see issue #123430 for more information = help: add `#![feature(derive_smart_pointer)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: use of unstable library feature 'derive_smart_pointer' --> $DIR/feature-gate-derive-smart-pointer.rs:1:5 |", "positive_passages": [{"docid": "doc-en-rust-d61cdeb622caf24c2dea9c9758666b900ee80c0d240b6359a702fd116a1bec4e", "text": "https://crater- https://crater- cc $DIR/write-only-field.rs:28:9 | LL | y: bool, | ^^^^^^^ error: field is never read: `u` --> $DIR/write-only-field.rs:58:9 | LL | u: u32, | ^^^^^^ error: field is never read: `v` --> $DIR/write-only-field.rs:59:9 | LL | v: u32, | ^^^^^^ error: aborting due to 6 previous errors ", "positive_passages": [{"docid": "doc-en-rust-db5c478f07e2f89dc89998a01b44110c28e3b2f7971b7759ea2795fd64e02aa9", "text": " $DIR/format-args-capture-issue-102057.rs:2:18 | LL | format!(\"x7Ba}\"); | ^ not found in this scope error[E0425]: cannot find value `a` in this scope --> $DIR/format-args-capture-issue-102057.rs:4:18 | LL | format!(\"x7Bax7D\"); | ^ not found in this scope error[E0425]: cannot find value `b` in this scope --> $DIR/format-args-capture-issue-102057.rs:9:22 | LL | format!(\"x7Ba} {b}\"); | ^ help: a local variable with a similar name exists: `a` error[E0425]: cannot find value `b` in this scope --> $DIR/format-args-capture-issue-102057.rs:11:25 | LL | format!(\"x7Bax7D {b}\"); | ^ help: a local variable with a similar name exists: `a` error[E0425]: cannot find value `b` in this scope --> $DIR/format-args-capture-issue-102057.rs:13:25 | LL | format!(\"x7Ba} x7Bb}\"); | ^ help: a local variable with a similar name exists: `a` error[E0425]: cannot find value `b` in this scope --> $DIR/format-args-capture-issue-102057.rs:15:28 | LL | format!(\"x7Bax7D x7Bb}\"); | ^ help: a local variable with a similar name exists: `a` error[E0425]: cannot find value `b` in this scope --> $DIR/format-args-capture-issue-102057.rs:17:28 | LL | format!(\"x7Bax7D x7Bbx7D\"); | ^ help: a local variable with a similar name exists: `a` error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0425`. ", "positive_passages": [{"docid": "doc-en-rust-19262eb59cca467f20352d53df0adcb17e1576d12fba8992e5558e9735f92440", "text": "I tried this code: I expected to see this happen: a \"no value found\" error pointing at the token Instead, this happened: a \"no value found\" error pointing at the : $DIR/const-trait-bounds-trait-objects.rs:9:17 | LL | let _: &dyn ~const Trait; | ^^^^^^ | = note: trait objects cannot have `~const` trait bounds error: const trait bounds are not allowed in trait object types --> $DIR/const-trait-bounds-trait-objects.rs:14:25 | LL | const fn handle(_: &dyn const NonConst) {} | ^^^^^^^^^^^^^^ error: `~const` is not allowed here --> $DIR/const-trait-bounds-trait-objects.rs:16:23 | LL | const fn take(_: &dyn ~const NonConst) {} | ^^^^^^ | = note: trait objects cannot have `~const` trait bounds error: aborting due to 4 previous errors ", "positive_passages": [{"docid": "doc-en-rust-2a69cb1bb8022be05034cbaa5c583ed4520e0245972f235d359f6f6a14f96262", "text": " $DIR/issue-72352.rs:6:42 | LL | unsafe fn unsafely_do_the_thing usize>(ptr: *const i8) -> usize { | ^^^^^^^^^^^^^^^^^^ error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-a975a546d53264829fbcc437898c1ae3226bbbd3547a5a7709fc6837f8ad5556", "text": "I've tried reducing this but wasn't really able to so far. I might try again some other time. The code below currently ICEs on Nightly (). When trying to reproduce locally for the backtrace, I had an older Nightly first () where this actually didn't crash the compiler, so it's apparently a regression. error: using function pointers as const generic parameters is forbidden --> $DIR/issue-72352.rs:6:42 | LL | unsafe fn unsafely_do_the_thing usize>(ptr: *const i8) -> usize { | ^^^^^^^^^^^^^^^^^^ error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-a37ceb899c17630c43d86268d2c334b49b32d8976e739ff8c5d02feada9c138d", "text": "produces: error: using function pointers as const generic parameters is forbidden --> $DIR/issue-72352.rs:6:42 | LL | unsafe fn unsafely_do_the_thing usize>(ptr: *const i8) -> usize { | ^^^^^^^^^^^^^^^^^^ error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-0083199d2d30907886ae35c5244f2ed3a9c47d95ba1b1870716f3c7161cbdaa4", "text": " $DIR/issue-72352.rs:6:42 | LL | unsafe fn unsafely_do_the_thing usize>(ptr: *const i8) -> usize { | ^^^^^^^^^^^^^^^^^^ error: aborting due to previous error ", "positive_passages": [{"docid": "doc-en-rust-0a83cfc50ccc7a7796089f355f5c7e9d5f34f5a9518ef005b13e27e8abd3782e", "text": " $DIR/unboxed-closure-sugar-nonexistent-trait.rs:4:1 | LL | type Typedef = isize; | ^^^^^^^^^^^^^^^^^^^^^ LL | trait Typedef = isize; | error: aborting due to 2 previous errors", "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-fb9ba0b75909fb8e6e8e66ace7dca07a5ccba2a00a1c71ddaf4ccec2f41540df", "query": "fn resolve_module_prefix(&mut self, module_path: &[Ident], span: Option) -> ResolveResult> { if &*module_path[0].name.as_str() == \"$crate\" { let mut ctxt = module_path[0].ctxt; while ctxt.source().0 != SyntaxContext::empty() { ctxt = ctxt.source().0; } let module = self.invocations[&ctxt.source().1].module.get(); let crate_root = if module.def_id().unwrap().is_local() { self.graph_root } else { module }; return Success(PrefixFound(crate_root, 1)) return Success(PrefixFound(self.resolve_crate_var(module_path[0].ctxt), 1)); } // Start at the current module if we see `self` or `super`, or at the", "positive_passages": [{"docid": "doc-en-rust-bd8c126ea1a5c4bd933b770b26f55e94ed95c0e79fca9247847350eb07c8a874", "text": "When on latest rust nightly , you get an ICE when compiling .\nIts a pretty recent regression, it can't be reproduced with .\nOkay, managed to minimize it: Looks like a regression of . cc any ideas on this?\nYeah, this was caused by an oversight in -- fixed in .", "commid": "rust_issue_37357", "tokennum": 60}], "negative_passages": []} {"query_id": "q-en-rust-fbcba05500c96dbed1592f44d037d4d1565f258612b253b532af72260077c02c", "query": " // Copyright 2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. #![feature(specialization)] trait Iterate<'a> { type Ty: Valid; fn iterate(self); } impl<'a, T> Iterate<'a> for T where T: Check { default type Ty = (); default fn iterate(self) {} } trait Check {} impl<'a, T> Check for T where >::Ty: Valid {} trait Valid {} fn main() { Iterate::iterate(0); } ", "positive_passages": [{"docid": "doc-en-rust-d1204383a03362f240382c671393e831f5cbc5737f2d65e48debb3cff09f04ae", "text": "Code works cc\nBug triage: on current nightly (), this no longer is an ICE, but yields the following error:", "commid": "rust_issue_39687", "tokennum": 26}], "negative_passages": []} {"query_id": "q-en-rust-fc09eab11a1b6be20355e489ae2f307b01b9ed4d8003aac0361cbf38e0025f42", "query": "} ast::ExprMatch(ref discr, ref arms) => { // treatment of the discriminant is handled while // walking the arms: self.walk_expr(&**discr); let discr_cmt = return_if_err!(self.mc.cat_expr(&**discr)); self.borrow_expr(&**discr, ty::ReEmpty, ty::ImmBorrow, MatchDiscriminant); // treatment of the discriminant is handled while walking the arms. for arm in arms.iter() { self.walk_arm(discr_cmt.clone(), arm); }", "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-fc13f4f93e907d9027f0778f0fb01df63d70c00c99c3f064defea4113be98ca9", "query": "inner: VaListImpl<'f>, #[cfg(all( any(target_arch = \"aarch64\", target_arch = \"powerpc\", target_arch = \"x86_64\"), any( target_arch = \"aarch64\", target_arch = \"powerpc\", target_arch = \"s390x\", target_arch = \"x86_64\" ), any(not(target_arch = \"aarch64\"), not(any(target_os = \"macos\", target_os = \"ios\"))), not(target_family = \"wasm\"), not(target_arch = \"asmjs\"),", "positive_passages": [{"docid": "doc-en-rust-3b6d37b85b87809961d13b3aacfc8af720541aa3d2f65107747ed4cabb9e1826", "text": "fails this test on native : (This is not a new failure, but I am cleaning up issues from downstream Red Hat bugzilla.)\nWe started discussing this in , and looking at the clang implementation here: I tried that minimal step with , but it still gives the same \"Cannot select\" error. I don't see any lowering of in like other targets, only stuff implementing the calling convention. So I guess we do need custom support, or perhaps the clang bits could be moved down into the LLVM lowering?\nHi , I ran into the same problem and noticed you had already opened an issue. I've now submitted a PR to implement valist and vaarg for s390x to fix this.", "commid": "rust_issue_84628", "tokennum": 150}], "negative_passages": []} {"query_id": "q-en-rust-fc169b896d9a6ccf440cc77c132d4c3b65b9c24e3477dcdcaf5a18bbfc914ac6", "query": "llvm::LLVMRustAddAnalysisPasses(tm, pm, llmod); llvm::LLVMRustAddPass(pm, \"verify0\".as_ptr() as *const _); let opt = sess.opts.cg.opt_level.unwrap_or(0) as libc::c_uint; let opt = match sess.opts.optimize { config::No => 0, config::Less => 1, config::Default => 2, config::Aggressive => 3, }; let builder = llvm::LLVMPassManagerBuilderCreate(); llvm::LLVMPassManagerBuilderSetOptLevel(builder, opt);", "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-fc21002b979b33d414ecc9822de3278014775c532a302d265ac6c83b15bb7586", "query": "emit_ptr_va_arg(bx, addr, target_ty, false, Align::from_bytes(8).unwrap(), true) } \"aarch64\" => emit_aapcs_va_arg(bx, addr, target_ty), \"s390x\" => emit_s390x_va_arg(bx, addr, target_ty), // Windows x86_64 \"x86_64\" if target.is_like_windows => { let target_ty_size = bx.cx.size_of(target_ty).bytes();", "positive_passages": [{"docid": "doc-en-rust-3b6d37b85b87809961d13b3aacfc8af720541aa3d2f65107747ed4cabb9e1826", "text": "fails this test on native : (This is not a new failure, but I am cleaning up issues from downstream Red Hat bugzilla.)\nWe started discussing this in , and looking at the clang implementation here: I tried that minimal step with , but it still gives the same \"Cannot select\" error. I don't see any lowering of in like other targets, only stuff implementing the calling convention. So I guess we do need custom support, or perhaps the clang bits could be moved down into the LLVM lowering?\nHi , I ran into the same problem and noticed you had already opened an issue. I've now submitted a PR to implement valist and vaarg for s390x to fix this.", "commid": "rust_issue_84628", "tokennum": 150}], "negative_passages": []} {"query_id": "q-en-rust-fc2dfd2ffd3ab4ffc4f7a1d73c3713135c125dd26bac259946e72c25ecd99ca5", "query": "false } /// Suggest possible range with adding parentheses, for example: /// when encountering `0..1.map(|i| i + 1)` suggest `(0..1).map(|i| i + 1)`. fn suggest_wrapping_range_with_parens( &self, tcx: TyCtxt<'tcx>, actual: Ty<'tcx>, source: SelfSource<'tcx>, span: Span, item_name: Ident, ty_str: &str, ) -> bool { if let SelfSource::MethodCall(expr) = source { for (_, parent) in tcx.hir().parent_iter(expr.hir_id).take(5) { if let Node::Expr(parent_expr) = parent { let lang_item = match parent_expr.kind { ExprKind::Struct(ref qpath, _, _) => match **qpath { QPath::LangItem(LangItem::Range, ..) => Some(LangItem::Range), QPath::LangItem(LangItem::RangeTo, ..) => Some(LangItem::RangeTo), QPath::LangItem(LangItem::RangeToInclusive, ..) => { Some(LangItem::RangeToInclusive) } _ => None, }, ExprKind::Call(ref func, _) => match func.kind { // `..=` desugars into `::std::ops::RangeInclusive::new(...)`. ExprKind::Path(QPath::LangItem(LangItem::RangeInclusiveNew, ..)) => { Some(LangItem::RangeInclusiveStruct) } _ => None, }, _ => None, }; if lang_item.is_none() { continue; } let span_included = match parent_expr.kind { hir::ExprKind::Struct(_, eps, _) => { eps.len() > 0 && eps.last().map_or(false, |ep| ep.span.contains(span)) } // `..=` desugars into `::std::ops::RangeInclusive::new(...)`. hir::ExprKind::Call(ref func, ..) => func.span.contains(span), _ => false, }; if !span_included { continue; } let range_def_id = self.tcx.require_lang_item(lang_item.unwrap(), None); let range_ty = self.tcx.bound_type_of(range_def_id).subst(self.tcx, &[actual.into()]); let pick = self.probe_for_name( span, Mode::MethodCall, item_name, IsSuggestion(true), range_ty, expr.hir_id, ProbeScope::AllTraits, ); if pick.is_ok() { let range_span = parent_expr.span.with_hi(expr.span.hi()); tcx.sess.emit_err(errors::MissingParentheseInRange { span, ty_str: ty_str.to_string(), method_name: item_name.as_str().to_string(), add_missing_parentheses: Some(errors::AddMissingParenthesesInRange { func_name: item_name.name.as_str().to_string(), left: range_span.shrink_to_lo(), right: range_span.shrink_to_hi(), }), }); return true; } } } } false } fn suggest_constraining_numerical_ty( &self, tcx: TyCtxt<'tcx>,", "positive_passages": [{"docid": "doc-en-rust-682b7adbbd3dc42a8b59a89b440ba231f3722b0b55b7bc589e66c4fa4d30f269", "text": " $DIR/use_instead_of_import.rs:9:1 | LL | require std::time::Duration; | ^^^^^^^ help: items are imported using the `use` keyword error: expected item, found `include` --> $DIR/use_instead_of_import.rs:12:1 | LL | include std::time::Instant; | ^^^^^^^ help: items are imported using the `use` keyword error: expected item, found `using` --> $DIR/use_instead_of_import.rs:9:5 --> $DIR/use_instead_of_import.rs:15:5 | LL | pub using std::io; | ^^^^^ help: items are imported using the `use` keyword error: aborting due to 2 previous errors error: aborting due to 4 previous errors ", "positive_passages": [{"docid": "doc-en-rust-60e0371694df40ceef41dd020298e41d7b7d957227a0df16c72ebd6a2d878467", "text": "I was looking at namely issue when I thought about this. If work is being put into improving error messages when somebody uses a keyword that defines a function in another language, there should also be improved error messages if someone uses the incorrect directive to bring something into the scope of their module or namespace/ Given the following code: The current output is: The error message should preferably suggest the user to use the directive to bring something into scope of their module. $DIR/issue-50900.rs:15:11 | LL | pub struct Tag(pub Context, pub u16); | ------------------------------------- `Tag` defined here ... LL | match Tag::ExifIFDPointer { | ^^^^^^^^^^^^^^^^^^^ pattern `Tag(Exif, _)` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error For more information about this error, try `rustc --explain E0004`. ", "positive_passages": [{"docid": "doc-en-rust-1814c291375802cc6d1ab2fa586a763dd8174cec11732e045dac5f868820c446", "text": "I hope this is not already known, but my searching has not turned up anything. Compiling a rust binary with the dependency panices in nightly. How to reproduce: a new rust binary. to dependencies in This gives the following output It compiles on stable and beta. Edit: Just running in gives the same result.\nTried a few different nightlies. And it looks like it broke sometime between and\nI have managed to get a much smaller example. Compiling this on nightly gives the above panic:\nLooks like it's fixed in the newest nightly ()\nBisecting between ... gives as the regression PR.", "commid": "rust_issue_50900", "tokennum": 126}], "negative_passages": []} {"query_id": "q-en-rust-fdbe901f98241e04eeee8b0e8d516c29aa11423fede7057e4fcd5ba3d685ec74", "query": " #![feature(const_generics)] #![allow(incomplete_features)] fn func(outer: A) { //~^ ERROR: using function pointers as const generic parameters is forbidden F(outer); } fn main() {} ", "positive_passages": [{"docid": "doc-en-rust-a975a546d53264829fbcc437898c1ae3226bbbd3547a5a7709fc6837f8ad5556", "text": "I've tried reducing this but wasn't really able to so far. I might try again some other time. The code below currently ICEs on Nightly (). When trying to reproduce locally for the backtrace, I had an older Nightly first () where this actually didn't crash the compiler, so it's apparently a regression. #![feature(const_generics)] #![allow(incomplete_features)] fn func(outer: A) { //~^ ERROR: using function pointers as const generic parameters is forbidden F(outer); } fn main() {} ", "positive_passages": [{"docid": "doc-en-rust-a37ceb899c17630c43d86268d2c334b49b32d8976e739ff8c5d02feada9c138d", "text": "produces: #![feature(const_generics)] #![allow(incomplete_features)] fn func(outer: A) { //~^ ERROR: using function pointers as const generic parameters is forbidden F(outer); } fn main() {} ", "positive_passages": [{"docid": "doc-en-rust-0083199d2d30907886ae35c5244f2ed3a9c47d95ba1b1870716f3c7161cbdaa4", "text": " $DIR/issue-81899.rs:10:5 | LL | const _CONST: &[u8] = &f(&[], |_| {}); | -------------- inside `_CONST` at $DIR/issue-81899.rs:4:24 ... LL | panic!() | ^^^^^^^^ | | | the evaluated program panicked at 'explicit panic', $DIR/issue-81899.rs:10:5 | inside `f::<[closure@$DIR/issue-81899.rs:4:31: 4:37]>` at $SRC_DIR/std/src/panic.rs:LL:COL | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error For more information about this error, try `rustc --explain E0080`. ", "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.