profile
viewpoint

dtolnay/serde-yaml 313

Strongly typed YAML library for Rust

http-rs/async-h1 115

Asynchronous HTTP/1.1 in Rust

oli-obk/camera_capture 29

Crate for capturing images from a webcam

christianpoveda/sire 18

A symbolic evaluator for MIR

embed-rs/embedded-rs 15

Rust embed crate

mbr/mealy-rs 1

Worlds smallest crate.

oli-obk/bareboard 1

Ada source code and complete sample GNAT projects for selected bare-board platforms supported by GNAT.

Lireer/ricochet-robot-solver 0

Solver for ricochet robots written in rust

Manishearth/rfcs 0

RFCs for changes to Rust

pull request commentrust-lang/rust

Overhaul const-checking diagnostics

Sure, I have no problem with that being done immediately in this PR, I just didn't want to make it a requirement for getting merged

ecstatic-morse

comment created time in 2 hours

issue commentrust-lang/rust

Compilation succeeds on stable, but not on nightly

Yea this was never intended to get stabilized and since it's only possible in code that doesn't actually do anything, this is unlikely to occur in practice. I don't see a reasonable way to allow this. Note the same effect is possible with std::mem::forget.

DutchGhost

comment created time in 2 hours

Pull request review commentrust-lang/rust

Overhaul const-checking diagnostics

 impl NonConstOp for FnPtrCast { #[derive(Debug)] pub struct Generator; impl NonConstOp for Generator {-    fn status_in_item(&self, ccx: &ConstCx<'_, '_>) -> Status {-        // FIXME: This means generator-only MIR is only forbidden in const fn. This is for-        // compatibility with the old code. Such MIR should be forbidden everywhere.-        mcf_status_in_item(ccx)+    fn status_in_item(&self, _: &ConstCx<'_, '_>) -> Status {+        Status::Forbidden     }      fn emit_error(&self, ccx: &ConstCx<'_, '_>, span: Span) {-        mcf_emit_error(ccx, span, "const fn generators are unstable");+        ccx.tcx.sess.struct_span_err(span, "Generators and `async` functions cannot be `const`").emit();

You invoke delay_as_bug instead of emit: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/struct.DiagnosticBuilder.html#method.delay_as_bug

ecstatic-morse

comment created time in 2 hours

PullRequestReviewEvent

Pull request review commentrust-lang/rust

Overhaul const-checking diagnostics

 because the expression's value must be known at compile-time. Erroneous code example:  ```compile_fail,E0019

you remove all mentions of it from the source. There's no "unused old codes" list like with lints

ecstatic-morse

comment created time in 2 hours

PullRequestReviewEvent

issue commentrust-lang/rustc-dev-guide

Update logging for `tracing`

We are not using spans or #[instrument] yet. There are no differences in usage yet. Before we can start using awesome tracing features we'll need to benchmark them and agree on a span rendering strategy. https://github.com/rust-lang/rust/pull/75143 explores span rendering, please look at it and leave opinions.

But yea, some minimal updating of the logging section would be a good thing. I'll try to find some time, but won't complain if someone grabs it

ehuss

comment created time in 3 hours

pull request commentrust-lang/rust

Liveness analysis for everybody

@bors r+

I was expecting some sort of perf hit on assoc const heavy code, but this is a bugfix, so let's roll with it

tmiasko

comment created time in 8 hours

Pull request review commentrust-lang/rust

Liveness analysis for everybody

 impl<'tcx> Visitor<'tcx> for IrMaps<'tcx> {         NestedVisitorMap::OnlyBodies(self.tcx.hir())     } -    fn visit_fn(-        &mut self,-        fk: FnKind<'tcx>,-        decl: &'tcx hir::FnDecl<'tcx>,-        body_id: hir::BodyId,-        sp: Span,-        id: HirId,-    ) {-        debug!("visit_fn {:?}", id);+    fn visit_body(&mut self, body: &'tcx hir::Body<'tcx>) {+        debug!("visit_body {:?}", body.id()); -        // swap in a new set of IR maps for this function body:-        let def_id = self.tcx.hir().local_def_id(id);-        let mut fn_maps = IrMaps::new(self.tcx);+        // swap in a new set of IR maps for this body+        let mut maps = IrMaps::new(self.tcx);+        let hir_id = maps.tcx.hir().body_owner(body.id());+        let def_id = maps.tcx.hir().local_def_id(hir_id);          // Don't run unused pass for #[derive()]-        if let FnKind::Method(..) = fk {-            let parent = self.tcx.hir().get_parent_item(id);+        if let Node::ImplItem(..) = self.tcx.hir().get(hir_id) {+            let parent = self.tcx.hir().get_parent_item(hir_id);             if let Some(Node::Item(i)) = self.tcx.hir().find(parent) {                 if i.attrs.iter().any(|a| self.tcx.sess.check_name(a, sym::automatically_derived)) {                     return;                 }             }         }

oh :/ that's not great. Yea let's go with a non-panicking version for now

tmiasko

comment created time in 8 hours

PullRequestReviewEvent

Pull request review commentrust-lang/rust

MIR-OPT: Less conservative `EarlyOtherwiseBranch`

 impl<'a, 'tcx> Helper<'a, 'tcx> {         if is_switch(terminator) {             let this_bb_discr_info = self.find_switch_discriminant_info(bb, terminator)?; -            // the types of the two adts matched on have to be equalfor this optimization to apply-            if discr_info.type_adt_matched_on != this_bb_discr_info.type_adt_matched_on {-                trace!(-                    "NO: types do not match. LHS: {:?}, RHS: {:?}",-                    discr_info.type_adt_matched_on,-                    this_bb_discr_info.type_adt_matched_on-                );+            // The layouts of the two ADTs have to be equal for this optimization to apply

so... to recap. If the discriminants of the two variants being checked are the same and a very specific value, then we apply the optimization. This sounds to me like we can generalize the optimization even further, since almost the same thing happens with

if x == 42 && y == 42 {
    99
} else {
    69
}

I wasn't able to produce the same MIR as we get with the match, but if we can come up with user-code that produces the same code without using a match, then we should think about generalizing it.

Anyway, back to this PR. Yea, we need neither the redundant value check nor the type/layout equality check, as these don't actually prevent miscompilations as far as I can tell

simonvandel

comment created time in 9 hours

PullRequestReviewEvent

Pull request review commentrust-lang/rust

Overhaul const-checking diagnostics

 because the expression's value must be known at compile-time. Erroneous code example:  ```compile_fail,E0019

I guess we can nix this error code and use E0015 for asm, too

ecstatic-morse

comment created time in 9 hours

PullRequestReviewEvent

Pull request review commentrust-lang/rust

Overhaul const-checking diagnostics

 impl NonConstOp for MutDeref {     fn status_in_item(&self, _: &ConstCx<'_, '_>) -> Status {         Status::Unstable(sym::const_mut_refs)     }++    fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> DiagnosticBuilder<'tcx> {

nevermind, you do that later

ecstatic-morse

comment created time in 9 hours

PullRequestReviewEvent

Pull request review commentrust-lang/rust

Overhaul const-checking diagnostics

 impl Validator<'mir, 'tcx> {          let mut err = op.build_error(self.ccx, span);         assert!(err.is_error());-        err.emit();++        match op.importance() {

Hmm... I just noticed that emit does not return Option<ErrorReported>.. sorry I thought we already had done all that. Let's carry on with this PR then and fix that together with making emit create instances of ErrorReported

ecstatic-morse

comment created time in 9 hours

PullRequestReviewEvent

Pull request review commentrust-lang/rust

Overhaul const-checking diagnostics

 impl Validator<'mir, 'tcx> {          let mut err = op.build_error(self.ccx, span);         assert!(err.is_error());-        err.emit();++        match op.importance() {

As mentioned elsewhere, I think build_error should return a Result<ErrorReported, DiagnosticBuilder<'tcx>>. Additionally the error_emitted field could then be an Option<ErrorReported>

ecstatic-morse

comment created time in 9 hours

PullRequestReviewEvent

Pull request review commentrust-lang/rust

Overhaul const-checking diagnostics

 pub fn non_const<O: NonConstOp>(ccx: &ConstCx<'_, '_>, op: O, span: Span) -> boo         return false;     } -    op.emit_error(ccx, span);+    let mut err = op.build_error(ccx, span);

Ah, nevermind, this is for the primary/secondary system. One possibility would be not to have the importance function, but instead return anResult<ErrorReported, DiagnosticBuilder<'tcx>>frombuild_error`. Then this could internally decide whether to immediately report or whether to return the builder for later use.

ecstatic-morse

comment created time in 9 hours

PullRequestReviewEvent

Pull request review commentrust-lang/rust

Overhaul const-checking diagnostics

 impl NonConstOp for MutDeref {     fn status_in_item(&self, _: &ConstCx<'_, '_>) -> Status {         Status::Unstable(sym::const_mut_refs)     }++    fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> DiagnosticBuilder<'tcx> {

maybe we should stop having a default implementation of this function ^^

ecstatic-morse

comment created time in 9 hours

PullRequestReviewEvent

Pull request review commentrust-lang/rust

Overhaul const-checking diagnostics

 pub fn non_const<O: NonConstOp>(ccx: &ConstCx<'_, '_>, op: O, span: Span) -> boo                         concat!(r#"#[rustc_const_unstable(feature = "...", issue = "...")]"#, '\n').to_owned(),                         Applicability::HasPlaceholders,                     )-                    .note("otherwise `#[allow_internal_unstable]` can be used to bypass stability checks")+                    .span_suggestion(+                        ccx.body.span,

this should only be ccx.body.span.lo() I think? Or we may even the `ccx.tcx.def_span(ccx.def_id.to_def_id()) so it's inserted before the item and not as part of the body.

ecstatic-morse

comment created time in 9 hours

PullRequestReviewEvent

Pull request review commentrust-lang/rust

Overhaul const-checking diagnostics

 pub fn non_const<O: NonConstOp>(ccx: &ConstCx<'_, '_>, op: O, span: Span) -> boo         return false;     } -    op.emit_error(ccx, span);+    let mut err = op.build_error(ccx, span);

The "usual" way we do this is to return an ErrorReported instance

ecstatic-morse

comment created time in 9 hours

PullRequestReviewEvent

Pull request review commentrust-lang/rust

Overhaul const-checking diagnostics

 impl NonConstOp for FnPtrCast { #[derive(Debug)] pub struct Generator; impl NonConstOp for Generator {-    fn status_in_item(&self, ccx: &ConstCx<'_, '_>) -> Status {-        // FIXME: This means generator-only MIR is only forbidden in const fn. This is for-        // compatibility with the old code. Such MIR should be forbidden everywhere.-        mcf_status_in_item(ccx)+    fn status_in_item(&self, _: &ConstCx<'_, '_>) -> Status {+        Status::Forbidden     }      fn emit_error(&self, ccx: &ConstCx<'_, '_>, span: Span) {-        mcf_emit_error(ccx, span, "const fn generators are unstable");+        ccx.tcx.sess.struct_span_err(span, "Generators and `async` functions cannot be `const`").emit();

Since this is already checked in the syntax based checks, couldn't this also be a delay_span_bug?

ecstatic-morse

comment created time in 9 hours

PullRequestReviewEvent

pull request commentrust-lang/rust

Overhaul const-checking diagnostics

cc @rust-lang/wg-diagnostics

ecstatic-morse

comment created time in 9 hours

pull request commentrust-lang/rust

Refactorings in preparation for const value trees

I'm working on finding this out. It's multiple things. One thing is that we encode a u128 as a [u8; 16] and apparently the latter uses up more time in serialization. The other thing is probably lots of conversions between the integer representation and the ty::Const representation in check_match

oli-obk

comment created time in 10 hours

PR opened rust-lang/rust

References to ZSTs may be at arbitrary aligned addresses

fixes #77320

r? @RalfJung

+14 -5

0 comment

2 changed files

pr created time in 10 hours

create barncholi-obk/rust

branch : zst_const_pat_regression

created branch time in 10 hours

push eventoli-obk/fixmeh

Oliver Scherer

commit sha 1bdc894a6114d3828a0471d2322eded9cdefb41b

Deploy to GitHub pages [ci skip]

view details

push time in 18 hours

Pull request review commentrust-lang/rust

Implement const expressions and patterns (RFC 2920)

 // This file was auto-generated using 'src/etc/generate-keyword-tests.py const' -fn main() {-    let const = "foo"; //~ error: expected identifier, found keyword `const`

can you check whether your latest changes make the orginal test work again?

spastorino

comment created time in a day

Pull request review commentrust-lang/rust

Implement const expressions and patterns (RFC 2920)

 impl<'a> Parser<'a> {      /// Parses constness: `const` or nothing.     fn parse_constness(&mut self) -> Const {-        if self.eat_keyword(kw::Const) {+        if self.look_ahead(1, |t| t != &token::OpenDelim(DelimToken::Brace))

leave a comment stating that this is to prevent const blocks from being parsed as a const item and then causing a parsing error

spastorino

comment created time in a day

PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commentrust-lang/rust

Liveness analysis for everybody

 impl<'tcx> Visitor<'tcx> for IrMaps<'tcx> {         NestedVisitorMap::OnlyBodies(self.tcx.hir())     } -    fn visit_fn(-        &mut self,-        fk: FnKind<'tcx>,-        decl: &'tcx hir::FnDecl<'tcx>,-        body_id: hir::BodyId,-        sp: Span,-        id: HirId,-    ) {-        debug!("visit_fn {:?}", id);+    fn visit_body(&mut self, body: &'tcx hir::Body<'tcx>) {+        debug!("visit_body {:?}", body.id()); -        // swap in a new set of IR maps for this function body:-        let def_id = self.tcx.hir().local_def_id(id);-        let mut fn_maps = IrMaps::new(self.tcx);+        // swap in a new set of IR maps for this body+        let mut maps = IrMaps::new(self.tcx);+        let hir_id = maps.tcx.hir().body_owner(body.id());+        let def_id = maps.tcx.hir().local_def_id(hir_id);          // Don't run unused pass for #[derive()]-        if let FnKind::Method(..) = fk {-            let parent = self.tcx.hir().get_parent_item(id);+        if let Node::ImplItem(..) = self.tcx.hir().get(hir_id) {+            let parent = self.tcx.hir().get_parent_item(hir_id);             if let Some(Node::Item(i)) = self.tcx.hir().find(parent) {                 if i.attrs.iter().any(|a| self.tcx.sess.check_name(a, sym::automatically_derived)) {                     return;                 }             }         }

I think we should prevent such uses via other means, but you can also add an assert_eq!(self.tcx.def_kind(parent), DefKind::Impl) before the return to make sure.

tmiasko

comment created time in a day

PullRequestReviewEvent

pull request commentrust-lang/rust

ICEs should print the top of the query stack

@hosseind75 try git rebase -i upstream/master (where upstream is your remote name for github.com/rust-lang/rust) and remove all commits that are not yours. You can also use this to squash all of your commits into a single commit.

hosseind75

comment created time in a day

Pull request review commentrust-lang/rust

const evaluatable: improve `TooGeneric` handling

 impl<'a, 'b, 'tcx> FulfillProcessor<'a, 'b, 'tcx> {                         obligation.cause.span,                     ) {                         Ok(()) => ProcessResult::Changed(vec![]),+                        Err(ErrorHandled::TooGeneric) => {

I don't know anything about this part of the compiler...

lcnr

comment created time in a day

PullRequestReviewEvent

Pull request review commentrust-lang/rust

const evaluatable: improve `TooGeneric` handling

 pub(super) fn try_unify_abstract_consts<'tcx>(     // on `ErrorReported`. } +fn walk_abstract_const<'tcx, F>(tcx: TyCtxt<'tcx>, ct: AbstractConst<'tcx>, mut f: F)+where+    F: FnMut(Node<'tcx>),+{+    recurse(tcx, ct, &mut f);+    fn recurse<'tcx>(tcx: TyCtxt<'tcx>, ct: AbstractConst<'tcx>, f: &mut dyn FnMut(Node<'tcx>)) {

It may occur in generated code somewhere, and if the rest of the compiler code is already recursion depth resistant we can hit this here. Once this is merged and in nightly I'll try to build a test that hits this.

lcnr

comment created time in a day

PullRequestReviewEvent

push eventoli-obk/fixmeh

Oliver Scherer

commit sha db8c9f020a5b99aafc48d472ad866df3b87b57f2

Deploy to GitHub pages [ci skip]

view details

push time in 2 days

Pull request review commentrust-lang/rust

const evaluatable: improve `TooGeneric` handling

 pub(super) fn try_unify_abstract_consts<'tcx>(     // on `ErrorReported`. } +fn walk_abstract_const<'tcx, F>(tcx: TyCtxt<'tcx>, ct: AbstractConst<'tcx>, mut f: F)+where+    F: FnMut(Node<'tcx>),+{+    recurse(tcx, ct, &mut f);+    fn recurse<'tcx>(tcx: TyCtxt<'tcx>, ct: AbstractConst<'tcx>, f: &mut dyn FnMut(Node<'tcx>)) {

any kind of recursion should probably use ensure_sufficient_stack

lcnr

comment created time in 2 days

PullRequestReviewEvent

Pull request review commentrust-lang/rust

const evaluatable: improve `TooGeneric` handling

 pub(super) fn try_unify_abstract_consts<'tcx>(     // on `ErrorReported`. } +fn walk_abstract_const<'tcx, F>(tcx: TyCtxt<'tcx>, ct: AbstractConst<'tcx>, mut f: F)

is there any particular reason we need to walk this in tree order and not just visit all nodes?

lcnr

comment created time in 2 days

PullRequestReviewEvent

Pull request review commentrust-lang/rust

const evaluatable: improve `TooGeneric` handling

 pub fn is_const_evaluatable<'cx, 'tcx>( ) -> Result<(), ErrorHandled> {     debug!("is_const_evaluatable({:?}, {:?})", def, substs);     if infcx.tcx.features().const_evaluatable_checked {-        if let Some(ct) = AbstractConst::new(infcx.tcx, def, substs)? {-            for pred in param_env.caller_bounds() {-                match pred.skip_binders() {-                    ty::PredicateAtom::ConstEvaluatable(b_def, b_substs) => {-                        debug!("is_const_evaluatable: caller_bound={:?}, {:?}", b_def, b_substs);-                        if b_def == def && b_substs == substs {-                            debug!("is_const_evaluatable: caller_bound ~~> ok");-                            return Ok(());-                        } else if AbstractConst::new(infcx.tcx, b_def, b_substs)?-                            .map_or(false, |b_ct| try_unify(infcx.tcx, ct, b_ct))-                        {-                            debug!("is_const_evaluatable: abstract_const ~~> ok");-                            return Ok(());+        let tcx = infcx.tcx;+        match AbstractConst::new(tcx, def, substs)? {+            // We are looking at a generic abstract constant.+            Some(ct) => {+                for pred in param_env.caller_bounds() {+                    match pred.skip_binders() {+                        ty::PredicateAtom::ConstEvaluatable(b_def, b_substs) => {+                            debug!(+                                "is_const_evaluatable: caller_bound={:?}, {:?}",+                                b_def, b_substs+                            );+                            if b_def == def && b_substs == substs {+                                debug!("is_const_evaluatable: caller_bound ~~> ok");+                                return Ok(());+                            } else if AbstractConst::new(tcx, b_def, b_substs)?+                                .map_or(false, |b_ct| try_unify(tcx, ct, b_ct))+                            {+                                debug!("is_const_evaluatable: abstract_const ~~> ok");+                                return Ok(());+                            }                         }+                        _ => {} // don't care                     }-                    _ => {} // don't care                 }++                // We were unable to unify the abstract constant with+                // a constant found in the caller bounds, there are+                // now three possible cases here.+                //+                // - The substs are concrete enough that we can simply+                //   try and evaluate the given constant.+                // - The abstract const still references an inference+                //   variable, in this case we return `TooGeneric`.+                // - The abstract const references a generic parameter,+                //   this means that we emit an error here.+                #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]+                enum FailureKind {+                    MentionsInfer,+                    MentionsParam,+                    Concrete,+                }+                let mut failure_kind = FailureKind::Concrete;+                walk_abstract_const(tcx, ct, |node| match node {

Does Node implement TypeFoldable? If not, should it? If it would, you could just invoke has_infer_types_or_const directly. Though we should not invoke that direclty on ct as that would allocate needlessly

lcnr

comment created time in 2 days

PullRequestReviewEvent

push eventoli-obk/rust

Oliver Scherer

commit sha 43c181bac4d88dbe7bdd762688dcf18313f01093

Use `tracing` spans to trace the entire MIR interp stack

view details

push time in 2 days

pull request commentrust-lang/rust

Use `tracing` spans to trace the entire MIR interp stack

New output (modulo the PAUSING, that is gone in the latest push)

Screenshot from 2020-09-28 19-55-27

oli-obk

comment created time in 2 days

push eventoli-obk/rust

Manish Goregaokar

commit sha f072e4a7322e8e2b16410e3225e1afc15d132e36

Mention URL fragments

view details

Manish Goregaokar

commit sha 2a98409634ec38547d03512898192b5bdce15f3d

Fill out docs on intra-doc resolution failure lint

view details

Manish Goregaokar

commit sha 4e0eb0b73ba2defaf0f3c2152e9daa5c18d1603f

Update src/doc/rustdoc/src/linking-to-items-by-name.md Co-authored-by: Joshua Nelson <joshua@yottadb.com>

view details

Manish Goregaokar

commit sha 175e30539d5ee9364a26f89f8a03a60b53690684

Update src/doc/rustdoc/src/linking-to-items-by-name.md Co-authored-by: Joshua Nelson <joshua@yottadb.com>

view details

Manish Goregaokar

commit sha 51c1351f7b9366a295dce5d63c2fd387170d5c34

Resolve some conflicts

view details

Manish Goregaokar

commit sha 6f1fa2b16376f586285453045788519df527a1b2

Fix lint name in docs

view details

Joshua Nelson

commit sha f7983cae7008b8f86d927ddcd83a0b4785307b24

Don't use `link.span` yet This shows the span of the _whole_ link, including the brackets. But rustdoc only wants to warn about the link text.

view details

Joshua Nelson

commit sha 6f2e1c65933702186cc681a3772862afa77dd632

Use `.as_str()` instead of `CowStr::Borrowed`

view details

bors

commit sha 0b65a3d0a6a3ae8d1f35d95f18210f894a1d6c98

Auto merge of #76123 - tmiasko:inline-args-storage, r=wesleywiser inliner: Emit storage markers for introduced arg temporaries When introducing argument temporaries during inlining, emit storage marker statements just before the assignment and in the beginning of the return block. This ensures that such temporaries will not be considered live across yield points after inlining inside a generator. Fixes #71793.

view details

bors

commit sha 56d8a933b3a344aa8980a17e2dbf338c177178fc

Auto merge of #76195 - lcnr:const-Self, r=varkor allow concrete self types in consts This is quite a bad hack to fix #75486. There might be a better way to check if the self type depends on generic parameters, but I wasn't able to come up with one. r? `@varkor` cc `@petrochenkov`

view details

Michael Wright

commit sha d1f0f04a488d027fdf91e08cdf25df00fb677205

New lint: `manual-strip` Add a new lint, `manual-strip`, that suggests using the `str::strip_prefix` and `str::strip_suffix` methods introduced in Rust 1.45 when the same functionality is performed 'manually'. Closes #5734

view details

Michael Wright

commit sha 15244a88df5cfd475df010ad945474c658749192

Fix `manual-strip` dogfood errors

view details

iximeow

commit sha 0eac38b7a65c29734f4b2d34f35ee0aa9cb00a74

fix syntax error in suggesting generic constraint in trait parameter suggest `where T: Foo` for the first bound on a trait, then suggest `, T: Foo` when the suggested bound would add to an existing set of `where` clauses. `where T: Foo` may be the first bound if `T` has a default, because we'd rather suggest ``` trait A<T=()> where T: Copy ``` than ``` trait A<T: Copy=()> ``` for legibility reasons.

view details

bors

commit sha b5f55b7e1562286798358730e06b0ba13b4c0ea6

Auto merge of #76549 - ehuss:lints-comments, r=wesleywiser Auto-generate lint documentation. This adds a tool which will generate the lint documentation in the rustc book automatically. This is motivated by keeping the documentation up-to-date, and consistently formatted. It also ensures the examples are correct and that they actually generate the expected lint. The lint groups table is also auto-generated. See https://github.com/rust-lang/compiler-team/issues/349 for the original proposal. An outline of how this works: - The `declare_lint!` macro now accepts a doc comment where the documentation is written. This is inspired by how clippy works. - A new tool `src/tools/lint-docs` scrapes the documentation and adds it to the rustc book during the build. - It runs each example and verifies its output and embeds the output in the book. - It does a few formatting checks. - It verifies that every lint is documented. - Groups are collected from `rustc -W help`. I updated the documentation for all the missing lints. I have also added an "Explanation" section to each lint providing a reason for the lint and suggestions on how to resolve it. This can lead towards a future enhancement of possibly showing these docs via the `--explain` flag to make them easily accessible and discoverable.

view details

Bastian Kauschke

commit sha dd57275c3e4d52b443090d0d75a9a3443bc5ce5c

shrink const infer error

view details

Bastian Kauschke

commit sha 035f8791668406bc49fc315253835cbdec247549

improve const infer err

view details

bors

commit sha 356d8ad1a310a2265e05d5c193d41704030d70d3

Auto merge of #76571 - lzutao:rustdoc-private-traits, r=jyn514 Ignore rustc_private items from std docs By ignoring rustc_private items for non local impl block, this may fix #74672 and fix #75588 . This might suppress #76529 if it is simple enough for backport.

view details

Guillaume Gomez

commit sha d069c7e928ab2ac95e3f524ea4d56de518aa2329

Stabilize doc_alias feature

view details

Mark Rousskov

commit sha 5bc8b181954e3a4cbce91466e44027600d4c94ef

Make bootstrap build on stable This is generally a good idea, and will help with being able to build bootstrap without Python over time as it means we can "just" build with cargo +beta build rather than needing the user to set environment variables. This is a minor step, but a necessary one on that road.

view details

Joe Ellis

commit sha ed20eff92be7bcd29ddc74f6bfa603f6698c9504

Implementation of peer credentials for Unix sockets The code in `ucred.rs` is based on the work done in PR 13 in the tokio-uds repository on GitHub. Link below for reference: https://github.com/tokio-rs/tokio-uds/pull/13 Credit to Martin Habovštiak (GitHub username Kixunil) and contributors for this work!

view details

push time in 2 days

issue commentdavidbarsky/tracing-tree

Better indicate which log entries are repeated

note that PAUSING here doesn't mean that the span is exited temporarily. We're still in the span, we just additionally opened a new span nested within the outer span.

RalfJung

comment created time in 2 days

delete branch oli-obk/tracing-tree

delete branch : visual_redundancy

delete time in 2 days

pull request commentrust-lang/rust

Use `tracing` spans to trace the entire MIR interp stack

No worries! Thanks for taking care of it now.

oli-obk

comment created time in 2 days

Pull request review commentrust-lang/rust

Liveness analysis for everybody

 impl<'tcx> Visitor<'tcx> for IrMaps<'tcx> {         NestedVisitorMap::OnlyBodies(self.tcx.hir())     } -    fn visit_fn(-        &mut self,-        fk: FnKind<'tcx>,-        decl: &'tcx hir::FnDecl<'tcx>,-        body_id: hir::BodyId,-        sp: Span,-        id: HirId,-    ) {-        debug!("visit_fn {:?}", id);+    fn visit_body(&mut self, body: &'tcx hir::Body<'tcx>) {+        debug!("visit_body {:?}", body.id()); -        // swap in a new set of IR maps for this function body:-        let def_id = self.tcx.hir().local_def_id(id);-        let mut fn_maps = IrMaps::new(self.tcx);+        // swap in a new set of IR maps for this body+        let mut maps = IrMaps::new(self.tcx);+        let hir_id = maps.tcx.hir().body_owner(body.id());+        let def_id = maps.tcx.hir().local_def_id(hir_id);          // Don't run unused pass for #[derive()]-        if let FnKind::Method(..) = fk {-            let parent = self.tcx.hir().get_parent_item(id);+        if let Node::ImplItem(..) = self.tcx.hir().get(hir_id) {+            let parent = self.tcx.hir().get_parent_item(hir_id);             if let Some(Node::Item(i)) = self.tcx.hir().find(parent) {                 if i.attrs.iter().any(|a| self.tcx.sess.check_name(a, sym::automatically_derived)) {                     return;                 }             }         }

Not sure if the parent relation in the DefId space is set up like this, but can you try whether

if let Some(parent) = self.tcx.parent(def_id) {
    if self.tcx.has_attr(parent, sym::automatically_derived) {
        return;
    }
}

also works? If so, please use that

tmiasko

comment created time in 2 days

PullRequestReviewEvent

pull request commentrust-lang/rust

Liveness analysis for everybody

@bors try @rust-timer queue

I don't care whether this has a perf impact, but I'd like to know before merging so we make a concious decision about it

tmiasko

comment created time in 2 days

delete branch oli-obk/rust

delete branch : const_generic_array_serializer

delete time in 2 days

issue commentrust-lang/rust

Create a RunCompiler builder to replace the run_compiler function

I'll be happy to mentor, but we should wait for #76474 to get merged, because any change you do will conflict with that PR. Though you can start by basing your change on top of that PR.

You will need to modify each place that is modified in that PR, so keep it bookmarked and look at it whenever you end up wondering what you may need to touch.

The root change to do is to make https://github.com/rust-lang/rust/blob/6369a98ebdee8ce01510f5d4307ddb771c8cb0e5/compiler/rustc_driver/src/lib.rs#L139 private and add a new struct right next to it. That new struct should have a field for every parameter of the function and an inherent method (run) that just forwards all these fields to run_compiler. You'll need a new method that takes only the non-Option fields as parameters and creates a new instance of your builder struct with those fileds initialized and the rest set to None. Then you'll need a method for each Option field to be able to set it. After adjusting all the run_compiler callsites and everything compiles again, you should make a commit and put all follow-up changes in separate commits.

As a follow up change you can make run_compiler take the struct as an argument instead of all the fields individually. You can then destructure the struct in the body of run_compiler to get all the fields out.

There may be other things that you may notice while implementing this change that could be optimized, idk, but we can close this issue after the above changes.

bjorn3

comment created time in 2 days

issue commentrust-lang/rust

Perform validation in const_eval_raw, return valtree from const_eval and decouple MIR-embedded consts from the rest

Since this will only be used for constants in the type system, I don't see what could regress this. We don't have any constants but usize in the type system right now (modulo const generics), and const generics other than usize aren't stable or perf tested.

RalfJung

comment created time in 2 days

pull request commentrust-lang/rust

Use `tracing` spans to trace the entire MIR interp stack

Ideally with an extra marker for whenever basic::server is repeated, indicating that this is not a new thing but a repetition of old data.

The extra marker is ;)

If you come up with better symbols, I'm very open to other things, but I'd rather get something merged and bikeshed symbols in the tracing-tree bugtracker

oli-obk

comment created time in 2 days

pull request commentrust-lang/rust

Add option to pass a custom codegen backend from a driver

@bors rollup

bjorn3

comment created time in 2 days

pull request commentrust-lang/rust

Add option to pass a custom codegen backend from a driver

@bors r+

bjorn3

comment created time in 2 days

issue commentrust-lang/rust

Refactor handling of statics

do you mean parts of the compiler that matched on places?

I meant this.

StatementKind nowadays seems to only use Place behind a Box, so their size is decoupled. But Place itself of course would still grow when a DefId is added.

Rvalue doesn't box Places, and uses them everywhere (mostly within Operand).

There are other optimizations we can do to all of this (e.g. using PlaceIds or even OperandIds everywhere and indexing into a table of Places or Operands stored in the mir::Body. This would allow us to cheaply encode statics as places again.

RalfJung

comment created time in 2 days

pull request commentrust-lang/rust

Deduplicate and generalize some (de/)serializer impls

github reviewer suggestions say

r? @matthewjasper

oli-obk

comment created time in 2 days

PullRequestEvent

pull request commentrust-lang/rust

Add option to pass a custom codegen backend from a driver

r? @oli-obk

bjorn3

comment created time in 2 days

Pull request review commentrust-lang/rust

Add option to pass a custom codegen backend from a driver

 pub fn run_compiler(     callbacks: &mut (dyn Callbacks + Send),     file_loader: Option<Box<dyn FileLoader + Send + Sync>>,     emitter: Option<Box<dyn Write + Send>>,+    make_codegen_backend: Option<

This argument list is slowly getting out of hand. Maybe we should create a RunCompiler builder pattern struct that doesn't require most calls to use None, None, None?

Anyway, pre-existing, if you rather open an issue about it than fix it here, I'm fine with merging this PR

bjorn3

comment created time in 2 days

PullRequestReviewEvent

Pull request review commentrust-lang/rust

MIR-OPT: Less conservative `EarlyOtherwiseBranch`

 impl<'a, 'tcx> Helper<'a, 'tcx> {         if is_switch(terminator) {             let this_bb_discr_info = self.find_switch_discriminant_info(bb, terminator)?; -            // the types of the two adts matched on have to be equalfor this optimization to apply-            if discr_info.type_adt_matched_on != this_bb_discr_info.type_adt_matched_on {-                trace!(-                    "NO: types do not match. LHS: {:?}, RHS: {:?}",-                    discr_info.type_adt_matched_on,-                    this_bb_discr_info.type_adt_matched_on-                );+            // The layouts of the two ADTs have to be equal for this optimization to apply

I don't think you need to check anything in the layout, you can check each type for the discriminant values directly: https://github.com/rust-lang/rust/blob/c2bc344eb23d8c1d18e803b3f1e631cf99926fbb/compiler/rustc_mir/src/interpret/operand.rs#L657-L666

If you do this, please deduplicate your logic with the logic in const eval

simonvandel

comment created time in 2 days

PullRequestReviewEvent

pull request commentrust-lang/rust

Use `tracing` spans to trace the entire MIR interp stack

I also still think we should repeat the function name in all of these markers, including PAUSING.

this is solved :stuck_out_tongue: The opening and closing of an event will now display the span information (see the example in https://github.com/davidbarsky/tracing-tree/blob/main/examples/basic.stdout), so we don't need to manually do that via events

This is now just waiting on https://github.com/davidbarsky/tracing-tree/pull/19 getting merged and @davidbarsky publishing a new version after that

oli-obk

comment created time in 2 days

issue commentrust-lang/rust

Perform validation in const_eval_raw, return valtree from const_eval and decouple MIR-embedded consts from the rest

Ugh yea, I forgot about the equality part. I guess let's go with full expansion at first and then check whether doing an optimization like that actually has any benefits

RalfJung

comment created time in 2 days

issue commentrust-lang/rust

Refactor handling of statics

one thing was the size of mir::StatementKind. Since places were used everywhere, this had quite an impact on memory usage, but iirc also an impact on perf. This also made a lot match patterns simpler. Generally this was part of the plan of mir 2.0

RalfJung

comment created time in 2 days

pull request commentrust-lang/rust

Better sso structures

The only thing I can come up with is that this is not a regression in this PR, but this PR is just a symptom of a regression from the beta (bootstrap) compiler to master. So master doesn't optimize your changes as well as they were optimized on beta. Can you try this out by rebasing onto the master branch from just when the mini maps were introduced and rerunning perf on stage 2? Or is that not long enough ago to make a difference?

cc @rust-lang/wg-compiler-performance @rust-lang/wg-codegen any ideas what's going on? do we have any perf regressions maybe due to an llvm upgrade or something?

VFLashM

comment created time in 2 days

push eventoli-obk/fixmeh

Oliver Scherer

commit sha 0e915b57e2224e3a7c896b82d5f913b3c345fb57

Deploy to GitHub pages [ci skip]

view details

push time in 3 days

issue commentrust-lang/miri

miri does not support syscall ID 202

we don't support network connections yet at all. We should look into supporting parking_lot though, that seems like a good first step

ralpha

comment created time in 3 days

pull request commentrust-lang/rust

Refactorings in preparation for const value trees

I think there's two regressions, one for serializing data, one for check_match, so I'm testing just the first part in https://github.com/rust-lang/rust/pull/77261

oli-obk

comment created time in 3 days

pull request commentrust-lang/rust

Deduplicate and generalize some (de/)serializer impls

@bors try @rust-timer queue

oli-obk

comment created time in 3 days

PR opened rust-lang/rust

Deduplicate and generalize some (de/)serializer impls

r? @ghost

+12 -23

0 comment

2 changed files

pr created time in 3 days

create barncholi-obk/rust

branch : const_generic_array_serializer

created branch time in 3 days

delete branch oli-obk/rust

delete branch : clippy_const_fn

delete time in 3 days

pull request commentrust-lang/rust

Better sso structures

@bors try @rust-timer queue

VFLashM

comment created time in 3 days

push eventoli-obk/fixmeh

Oliver Scherer

commit sha 879baa4d7590a7b30cbc76d669d1a1c5840b5f2a

Deploy to GitHub pages [ci skip]

view details

push time in 4 days

pull request commentrust-lang/rust

Refactorings in preparation for const value trees

@bors try @rust-timer queue

oli-obk

comment created time in 4 days

pull request commentrust-lang/rust

Check for missing const-stability attributes in `rustc_passes`

@bors r+

ecstatic-morse

comment created time in 4 days

push eventoli-obk/rust

Oliver Scherer

commit sha 4a76f0c2e42d903fa47034b0e38409189c4aab56

NEVERMIND. Ralf is right, this `size` field business is a good thing. I'm still not sold on the fact that it also exists in builds without debug assertions

view details

push time in 4 days

pull request commentrust-lang/rust

Better sso structures

I can't tell from the code changes (where the map/set is used) how this could affect incremental cache loading times. I'm guessing it's all spurious. So, let's go with: rebase, change the set impl to just forward to the map impl, run perf again. Does that sound reasonable to you?

VFLashM

comment created time in 4 days

issue commentrust-lang/rust

Perform validation in const_eval_raw, return valtree from const_eval and decouple MIR-embedded consts from the rest

I'm wondering whether we should also have LitBytes ([u8; N]) and LitSlice (&[u8] or &str) variants on ValTree, as I'm considering it very likely that we'll want to use strings in const generics. While we could encode them as aggregates, that would be very inefficient (storage wise), and probably annoying to handle. That said, we can start out with encoding them as aggregates and seeing how it goes. If anyone starts putting huge strings in their types, we may just give up (or set a configurable limit like with the recursion depth checks).

RalfJung

comment created time in 4 days

pull request commentrust-lang/rust

Refactorings in preparation for const value trees

@bors try @rust-timer queue

oli-obk

comment created time in 4 days

push eventoli-obk/rust

Oliver Scherer

commit sha 80ba12b12c3223608dd35bf0f6ab637f4107c397

Split the "raw integer bytes" part out of `Scalar`

view details

push time in 4 days

PR opened rust-lang/rust

Move helper function for `missing_const_for_fn` out of rustc to clippy

cc @rust-lang/clippy @ecstatic-morse #76618

r? @Manishearth

I also removed all support for suggesting a function could be const fn when that would require feature gates to actually work.

This means we'll now have to maintain this ourselves in clippy, but that's how most lints work anyway, so...

+32 -103

0 comment

5 changed files

pr created time in 4 days

create barncholi-obk/rust

branch : clippy_const_fn

created branch time in 4 days

more