profile
viewpoint
Mazdak Farrokhzad Centril Sweden http://centril.me Compiler engineer and former Rust Language and Release team member.

AltSysrq/proptest 586

Hypothesis-like property testing for Rust

Centril/dbg 5

Implementation of https://github.com/rust-lang/rfcs/pull/2173 in stable rust

Centril/firefox-line 4

Rewrite of Mozilla Labs Prospector Oneliner 2 with Addons SDK

Centril/aTetria 2

Initial push of Framework + Model + input processors.

Centril/android-numberpicker 1

A backport of the Android 4.2 NumberPicker

Centril/bin-util 1

small utility scripts, mostly git related.

Centril/consensusbot 1

Next gen rfcbot

Centril/firefox-movable-titlebar 1

Movable Titlebar Buttons allows you to move the titlebar buttons on Windows 10.

Centril/android-project-template 0

template project for android.

create barnchCentril/rust

branch : lintlevel-aside

created branch time in a month

delete branch Centril/rust

delete branch : rollup-jzg6ykc

delete time in a month

pull request commentrust-lang/rust

submodules: update clippy from af5940b7 to d236b30a

@bors retry

matthiaskrgr

comment created time in a month

pull request commentrust-lang/rust

Rollup of 3 pull requests

@bors r+ p=3 rollup=never

Centril

comment created time in a month

PR opened rust-lang/rust

Rollup of 3 pull requests

Successful merges:

  • #71070 (rustbuild: Remove stage 0 LLD flavor workaround for MSVC)
  • #71102 (Update compiler_builtins to 0.1.27)
  • #71159 (Bump rustfmt and rls)

Failed merges:

r? @ghost

+50 -66

0 comment

5 changed files

pr created time in a month

push eventCentril/rust

topecongiro

commit sha 84c4514849180867f8444af33d8b343cb98593f5

Bump rustfmt and rls

view details

Mazdak Farrokhzad

commit sha 128d622ed4bbdff08c4d9a7bd7125053ea2b4f22

Rollup merge of #71159 - topecongiro:rustfmt-1.4.14, r=Dylan-DPC Bump rustfmt and rls Close #71076. Close #71077. r? @Xanewok

view details

push time in a month

push eventCentril/rust

Tomasz Miąsko

commit sha 09633062b692edd9a7534488c0d04e5de5497ed1

Update compiler_builtins to 0.1.27 * aarch64: Exclude FP intrinsics on +nofp or +nosimd * Place intrinsics in individual object files

view details

Mazdak Farrokhzad

commit sha 99c1e5c76aa37831bc7ad564c7dfe42fce521cd0

Rollup merge of #71102 - tmiasko:compiler-builtins, r=Mark-Simulacrum Update compiler_builtins to 0.1.27 * aarch64: Exclude FP intrinsics on +nofp or +nosimd * Place intrinsics in individual object files https://github.com/rust-lang/compiler-builtins/compare/0.1.25...0.1.27

view details

push time in a month

push eventCentril/rust

Vadim Petrochenkov

commit sha 8771319dfa545611452e23ae0f41b1b5f133514a

rustbuild: Remove LLD flavor workaround for MSVC

view details

Mazdak Farrokhzad

commit sha ea6cc7c56e7a72797b4a22dcb71ebd8f1c8b6319

Rollup merge of #71070 - petrochenkov:nolldaround, r=Mark-Simulacrum rustbuild: Remove stage 0 LLD flavor workaround for MSVC

view details

push time in a month

create barnchCentril/rust

branch : rollup-1kviyji

created branch time in a month

delete branch Centril/rust

delete branch : rollup-gwmdp9u

delete time in a month

PR closed rust-lang/rust

Rollup of 5 pull requests S-waiting-on-bors rollup

Successful merges:

  • #69903 (Do not ICE in the face of invalid enum discriminant)
  • #70891 (unit rvalue, use constant () instead of tuple)
  • #71030 (rustc_target: Refactor target specifications related to Windows and UEFI)
  • #71100 (Miri: expand frame hooks)
  • #71116 (Entirely remove DUMMY_HIR_ID)

Failed merges:

r? @ghost

+1436 -568

5 comments

155 changed files

Centril

pr closed time in a month

pull request commentrust-lang/rust

Rollup of 5 pull requests

@bors r- retry

Centril

comment created time in a month

pull request commentrust-lang/rust

Rollup of 4 pull requests

@bors r+ p=4 rollup=never

Centril

comment created time in a month

pull request commentrust-lang/rust

Do not ICE in the face of invalid enum discriminant

Failed in https://github.com/rust-lang/rust/pull/71161#issuecomment-613815393, @bors r-

estebank

comment created time in a month

push eventCentril/rust

Vadim Petrochenkov

commit sha 3ad8c8858e93020416edef421d489c15e46a0365

rustc_target: Make sure lld-link is treated as link.exe by default The differences if they are discovered will need to be explicitly documented

view details

Vadim Petrochenkov

commit sha 7a4f059add44699af6d24abdcfd39f429dd54084

rustc_target: Move tests into a separate unconfigured file as much as possible.

view details

Vadim Petrochenkov

commit sha cfe90ebfe3599bebf301dbac3e74ed557f7ecf24

linker: Pass `/NODEFAULTLIB` in a more regular way

view details

Vadim Petrochenkov

commit sha 6580ceb9e1d8c0afcb0a53677c6b633c43a7068d

rustc_target: `windows(_uwp)_base` -> `windows(_uwp)_gnu_base` The old naming is from ancient times when there was no MSVC support. Also `uefi_base` -> `uefi_msvc_base`. It will inherit from `msvc_base` in a future commit, plus a GNU UEFI target is also potentially possible.

view details

Vadim Petrochenkov

commit sha 9c9db3ab4b5fcb3349ec744c4f168dd3e753d57b

rustc_target: Remove some useless imports

view details

Vadim Petrochenkov

commit sha fd0e2987eda697cfa1ec754021477f54a46645aa

rustc_target: Inherit `windows_uwp_msvc_base` from `windows_msvc_base`

view details

Vadim Petrochenkov

commit sha 88c480279b9da4487aa779c26f0445aaaf268834

rustc_target: Inherit `windows_uwp_gnu_base` from `windows_gnu_base`

view details

Vadim Petrochenkov

commit sha 57870ea2ca2f9795e875d55d60df57d47e4a3eba

rustc_target: Introduce `msvc_base` and inherit both `windows_msvc_base` and `uefi_msvc_base` from it.

view details

Vadim Petrochenkov

commit sha 8392e477e73c12566803411396b0ff18a0864c81

Address review comments

view details

Mazdak Farrokhzad

commit sha ffafd1528094cc9355e751d4b0595a89a11a9a8e

Rollup merge of #71030 - petrochenkov:linkorder2, r=nagisa rustc_target: Refactor target specifications related to Windows and UEFI - LLD support is improved. - Code is cleaned up. - Target specs are organized in a more hierarchical way. - Possible issues in UWP and UEFI platforms are identified (see FIXMEs). The code is better read per-commit.

view details

push time in a month

PR opened rust-lang/rust

Rollup of 4 pull requests

Successful merges:

  • #70891 (unit rvalue, use constant () instead of tuple)
  • #71030 (rustc_target: Refactor target specifications related to Windows and UEFI)
  • #71100 (Miri: expand frame hooks)
  • #71116 (Entirely remove DUMMY_HIR_ID)

Failed merges:

r? @ghost

+1255 -563

0 comment

151 changed files

pr created time in a month

push eventCentril/rust

marmeladema

commit sha b9161ab880cb4f58b2b2e74b7a8bed2514f8a753

Do not use `DUMMY_HIR_ID` as placeholder value in node_id_to_hir_id table Some helpers functions have been introduced to deal with (buggy) cases where either a `NodeId` or a `DefId` do not have a corresponding `HirId`. Those cases are tracked in issue #71104.

view details

marmeladema

commit sha c15e13ae167b3f72270e0b99333e71ba1bef9ffc

Remove `DUMMY_HIR_ID`

view details

Mazdak Farrokhzad

commit sha 7341cad3f312df5d735f2a8c3f3eb4480ed3a95d

Rollup merge of #71116 - marmeladema:dummy-hir-id-removal, r=eddyb Entirely remove `DUMMY_HIR_ID` Some helpers functions have been introduced to deal with (buggy) cases where either a `NodeId` or a `DefId` do not have a corresponding `HirId`. Those cases are tracked in issue #71104.

view details

push time in a month

push eventCentril/rust

Ralf Jung

commit sha 1a3bda648747e2d332f58988a12bbed1aefd4cda

Miri: let push_frame hook also access and mutate the rest of the frame data

view details

Ralf Jung

commit sha 7b90ff9ae68cc23fe002c92f30a4aaf2039c5a8f

add after_stack_push hook; add public ImmTy::from_immediate method, and make ImmTy::imm field private

view details

Ralf Jung

commit sha f2d4c93c6c56d8cfe1d69646ba1f788823e6bc35

fmt

view details

Mazdak Farrokhzad

commit sha 8da59521e1d88677fa875770e5a3e091a199265f

Rollup merge of #71100 - RalfJung:miri-frame-hook, r=oli-obk Miri: expand frame hooks This is needed to make https://github.com/rust-lang/miri/pull/1330 work. r? @oli-obk @eddyb

view details

push time in a month

push eventCentril/rust

Bastian Kauschke

commit sha db83fdc46c9d866578de418f17461593f829988c

unit rvalue: use constant `()` instead of tuple

view details

Bastian Kauschke

commit sha 4714e202ae828f4da28c003433b2501006657082

bless mir opt tests

view details

Bastian Kauschke

commit sha 647f810d7b7450845e0f99f63e8797be0c6c3302

update 32 bit mir-opt tests

view details

Mazdak Farrokhzad

commit sha 629e51b7619c99e5810d399146110556a051597a

Rollup merge of #70891 - lcnr:replace-rvalue_aggregate, r=eddyb unit rvalue, use constant `()` instead of tuple fixes #70886 r? @eddyb

view details

push time in a month

create barnchCentril/rust

branch : rollup-jzg6ykc

created branch time in a month

pull request commentrust-lang/rust

Rollup of 5 pull requests

@bors r+ p=5 rollup=never

Centril

comment created time in a month

PR opened rust-lang/rust

Rollup of 5 pull requests

Successful merges:

  • #69903 (Do not ICE in the face of invalid enum discriminant)
  • #70891 (unit rvalue, use constant () instead of tuple)
  • #71030 (rustc_target: Refactor target specifications related to Windows and UEFI)
  • #71100 (Miri: expand frame hooks)
  • #71116 (Entirely remove DUMMY_HIR_ID)

Failed merges:

r? @ghost

+1436 -568

0 comment

155 changed files

pr created time in a month

push eventCentril/rust

marmeladema

commit sha b9161ab880cb4f58b2b2e74b7a8bed2514f8a753

Do not use `DUMMY_HIR_ID` as placeholder value in node_id_to_hir_id table Some helpers functions have been introduced to deal with (buggy) cases where either a `NodeId` or a `DefId` do not have a corresponding `HirId`. Those cases are tracked in issue #71104.

view details

marmeladema

commit sha c15e13ae167b3f72270e0b99333e71ba1bef9ffc

Remove `DUMMY_HIR_ID`

view details

Mazdak Farrokhzad

commit sha 447f4d4c0213e3e8a0d1d812e732c33d1cce9ee1

Rollup merge of #71116 - marmeladema:dummy-hir-id-removal, r=eddyb Entirely remove `DUMMY_HIR_ID` Some helpers functions have been introduced to deal with (buggy) cases where either a `NodeId` or a `DefId` do not have a corresponding `HirId`. Those cases are tracked in issue #71104.

view details

push time in a month

push eventCentril/rust

Ralf Jung

commit sha 1a3bda648747e2d332f58988a12bbed1aefd4cda

Miri: let push_frame hook also access and mutate the rest of the frame data

view details

Ralf Jung

commit sha 7b90ff9ae68cc23fe002c92f30a4aaf2039c5a8f

add after_stack_push hook; add public ImmTy::from_immediate method, and make ImmTy::imm field private

view details

Ralf Jung

commit sha f2d4c93c6c56d8cfe1d69646ba1f788823e6bc35

fmt

view details

Mazdak Farrokhzad

commit sha 6431325652cd2c9637685683f1659d4deca521e9

Rollup merge of #71100 - RalfJung:miri-frame-hook, r=oli-obk Miri: expand frame hooks This is needed to make https://github.com/rust-lang/miri/pull/1330 work. r? @oli-obk @eddyb

view details

push time in a month

push eventCentril/rust

Vadim Petrochenkov

commit sha 3ad8c8858e93020416edef421d489c15e46a0365

rustc_target: Make sure lld-link is treated as link.exe by default The differences if they are discovered will need to be explicitly documented

view details

Vadim Petrochenkov

commit sha 7a4f059add44699af6d24abdcfd39f429dd54084

rustc_target: Move tests into a separate unconfigured file as much as possible.

view details

Vadim Petrochenkov

commit sha cfe90ebfe3599bebf301dbac3e74ed557f7ecf24

linker: Pass `/NODEFAULTLIB` in a more regular way

view details

Vadim Petrochenkov

commit sha 6580ceb9e1d8c0afcb0a53677c6b633c43a7068d

rustc_target: `windows(_uwp)_base` -> `windows(_uwp)_gnu_base` The old naming is from ancient times when there was no MSVC support. Also `uefi_base` -> `uefi_msvc_base`. It will inherit from `msvc_base` in a future commit, plus a GNU UEFI target is also potentially possible.

view details

Vadim Petrochenkov

commit sha 9c9db3ab4b5fcb3349ec744c4f168dd3e753d57b

rustc_target: Remove some useless imports

view details

Vadim Petrochenkov

commit sha fd0e2987eda697cfa1ec754021477f54a46645aa

rustc_target: Inherit `windows_uwp_msvc_base` from `windows_msvc_base`

view details

Vadim Petrochenkov

commit sha 88c480279b9da4487aa779c26f0445aaaf268834

rustc_target: Inherit `windows_uwp_gnu_base` from `windows_gnu_base`

view details

Vadim Petrochenkov

commit sha 57870ea2ca2f9795e875d55d60df57d47e4a3eba

rustc_target: Introduce `msvc_base` and inherit both `windows_msvc_base` and `uefi_msvc_base` from it.

view details

Vadim Petrochenkov

commit sha 8392e477e73c12566803411396b0ff18a0864c81

Address review comments

view details

Mazdak Farrokhzad

commit sha 7276fd0716e2212817469e28487479d1ba42d495

Rollup merge of #71030 - petrochenkov:linkorder2, r=nagisa rustc_target: Refactor target specifications related to Windows and UEFI - LLD support is improved. - Code is cleaned up. - Target specs are organized in a more hierarchical way. - Possible issues in UWP and UEFI platforms are identified (see FIXMEs). The code is better read per-commit.

view details

push time in a month

create barnchCentril/rust

branch : rollup-gwmdp9u

created branch time in a month

push eventCentril/rust

Bastian Kauschke

commit sha db83fdc46c9d866578de418f17461593f829988c

unit rvalue: use constant `()` instead of tuple

view details

Bastian Kauschke

commit sha 4714e202ae828f4da28c003433b2501006657082

bless mir opt tests

view details

Bastian Kauschke

commit sha 647f810d7b7450845e0f99f63e8797be0c6c3302

update 32 bit mir-opt tests

view details

Mazdak Farrokhzad

commit sha 4f84ad279b564a41e9f4f63653b351d878b9cd00

Rollup merge of #70891 - lcnr:replace-rvalue_aggregate, r=eddyb unit rvalue, use constant `()` instead of tuple fixes #70886 r? @eddyb

view details

push time in a month

push eventCentril/rust

Esteban Küber

commit sha 187f270fe23f5df7faa6107bd3b6d42d9339a469

Do not ICE in the face of invalid enum discriminant

view details

Mazdak Farrokhzad

commit sha 02e1a74bdc44fc70f06dac8cc46ee988aaaee6b7

Rollup merge of #69903 - estebank:icemation, r=oli-obk Do not ICE in the face of invalid enum discriminant Fix #67377. r? @pnkfelix

view details

push time in a month

pull request commentrust-lang/rust

[format_args!] Warn on whitespace before the `}` in a format specifier

Please also add a test in src/test/ui/lint.

strega-nil

comment created time in a month

Pull request review commentrust-lang/rust

[format_args!] Warn on whitespace before the `}` in a format specifier

 pub fn expand_preparsed_format_args(         }         e.emit();         return DummyResult::raw_expr(sp, true);+    } else if !parser.warnings.is_empty() {+        let warn = parser.warnings.remove(0);+        let sp = fmt_span.from_inner(warn.span);+        let mut w =+            ecx.struct_span_warn(sp, &format!("format string warning: {}", warn.description));

This should be emitted as a lint rather than a warning using ecx.parse_sess.buffer_lint_with_diagnostic(...).

strega-nil

comment created time in a month

pull request commentrust-lang/rust

Hides default fns inside Fuse impl to avoid exposing it to any crate

Ah OK. :) default(crate) is probably a long way from being implemented.

My personal view is that, for now, we should accept the slight regression here, merge the PR, and try to recover it when we can do so in a correct way.

rakshith-ravi

comment created time in a month

pull request commentrust-lang/rust

Hides default fns inside Fuse impl to avoid exposing it to any crate

@cuviper Hmm; do you know where the regressions are coming from (I haven't checked the diff)? They don't look egregious, so imo correctness comes first in this case, but I wonder if we could have our cake and eat it too?

rakshith-ravi

comment created time in a month

pull request commentrust-lang/rust

[breaking change] Disallow statics initializing themselves

@craterbot check

oli-obk

comment created time in a month

pull request commentrust-lang/rust

ptr: introduce len() method on raw slices

@SimonSapin ah woops, my mistake!

NeoRaider

comment created time in a month

pull request commentrust-lang/rust

Allow `try`-blocks in places where an open delim is expected

@bors r+

lcnr

comment created time in a month

issue commentrust-lang/rustfmt

Strange formatting of `@`, `|`, and parens patterns

category: category @ Record { ... }

has existed since Rust 1.0 I think, so that isn't new, but p0 | ... | pn nested within another pattern is new and currently an unstable feature.

Centril

comment created time in a month

pull request commentrust-lang/rust

Allow `try`-blocks in places where an open delim is expected

cc @scottmcm, this fixes https://github.com/rust-lang/rust/issues/56828 which we agreed was a bug at the time.

@bors r+

lcnr

comment created time in a month

pull request commentrust-lang/rust

Allow `try`-blocks in places where an open delim is expected

Did you intend to include that submodule bump?

lcnr

comment created time in a month

issue commentrust-lang/rust

ICE: No `move_errors` should be allowed in MIR borrowck

The error is constructed here: https://github.com/rust-lang/rust/blob/ba72b15666b2491415aec703a02c2364fe5e2790/src/librustc_mir/util/borrowck_errors.rs#L281-L305 which is called here: https://github.com/rust-lang/rust/blob/ba72b15666b2491415aec703a02c2364fe5e2790/src/librustc_mir/borrow_check/diagnostics/move_errors.rs#L258 and here: https://github.com/rust-lang/rust/blob/ba72b15666b2491415aec703a02c2364fe5e2790/src/librustc_mir/borrow_check/diagnostics/move_errors.rs#L331

jurkstas

comment created time in a month

pull request commentrust-lang/rust

Address concerns of weak-into-raw

cc @RalfJung

vorner

comment created time in a month

Pull request review commentrust-lang/rust

Suggest `-> impl Trait` and `-> Box<dyn Trait>` on fn that doesn't return

 fn check_fn<'a, 'tcx>(      inherited.tables.borrow_mut().liberated_fn_sigs_mut().insert(fn_id, fn_sig); -    fcx.check_return_expr(&body.value);+    if let ty::Dynamic(..) = declared_ret_ty.kind {

In the first branch; You're basing the fact that we can do this here on that the first branch will always error, and I'm slightly concerned that the changes in the first branch could suddenly stop erroring over the years, so a delay_span_bug would be an insurance policy.

estebank

comment created time in a month

Pull request review commentrust-lang/rust

Add `ConstKind::Error` and convert `ErrorHandled::Reported` to it.

 impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {             }              // Already reported in the query.-            ConstEvalFailure(ErrorHandled::Reported) => {+            ConstEvalFailure(ErrorHandled::Reported(ErrorReported) | ErrorHandled::Linted) => {

Sure; could you file an issue or leave a comment though?

eddyb

comment created time in a month

Pull request review commentrust-lang/rust

Add `ConstKind::Error` and convert `ErrorHandled::Reported` to it.

 pub struct CommonLifetimes<'tcx> { }  pub struct CommonConsts<'tcx> {-    pub err: &'tcx Const<'tcx>,+    pub unit: &'tcx Const<'tcx>,

Ah ok, sounds good.

eddyb

comment created time in a month

Pull request review commentrust-lang/rust

Add `ConstKind::Error` and convert `ErrorHandled::Reported` to it.

 impl<'tcx> ConstEvalErr<'tcx> {             err_inval!(Layout(LayoutError::Unknown(_))) | err_inval!(TooGeneric) => {                 return Err(ErrorHandled::TooGeneric);             }-            err_inval!(TypeckError) => return Err(ErrorHandled::Reported),+            err_inval!(TypeckError(error_reported)) => {+                return Err(ErrorHandled::Reported(error_reported));+            }             // We must *always* hard error on these, even if the caller wants just a lint.             err_inval!(Layout(LayoutError::SizeOverflow(_))) => true,

This function unfortunately became a mess over time. :/ I get the feeling we are trying to shove too many different things into one code path here.

My thoughts exactly.

eddyb

comment created time in a month

Pull request review commentrust-lang/rust

Add `ConstKind::Error` and convert `ErrorHandled::Reported` to it.

 pub fn super_relate_consts<R: TypeRelation<'tcx>>(     let tcx = relation.tcx();      let eagerly_eval = |x: &'tcx ty::Const<'tcx>| {+        // FIXME(eddyb) this doesn't account for lifetime inference variables+        // being erased by `eval`, *nor* for the polymorphic aspect of `eval`.+        // That is, we could always use `eval` and it will just return the+        // old value back if it doesn't succeed.         if !x.val.needs_infer() {             return x.eval(tcx, relation.param_env()).val;         }         x.val     }; +    // FIXME(eddyb) doesn't look like everything below checks that `a.ty == b.ty`.+    // We could probably always assert it early, as `const` generic parameters+    // are not allowed to depend on other generic parameters, i.e. are concrete.

Sure I understand all of this; I'm just saying we should avoid too deep of an architectural dependence on the fact that const params can't depend on type params so that it doesn't take a year to dig out of.

eddyb

comment created time in a month

issue commentrust-lang/rust

Match ergonomics means bindings have different types inside and outside of patterns

@varkor Before considering using the edition mechanism, I think it would be prudent to crater run a change and see if anyone is relying on the mut x resetting.

varkor

comment created time in a month

issue commentrust-lang/rust

Tracking issue for RFC 2535, 2530, 2175, "Or patterns, i.e `Foo(Bar(x) | Baz(x))`"

  • On 2020-04-13, https://github.com/rust-lang/rust/pull/67766, written by @sapir and reviewed by @matthewjasper, landed. The PR fixed https://github.com/rust-lang/rust/issues/67691, a bug in the unused_variables lint pertaining to or-patterns.
Centril

comment created time in a month

Pull request review commentrust-lang/rust

On type mismatch involving associated type, suggest constraint

 impl<'tcx> TyCtxt<'tcx> {                     (ty::Param(_), ty::Projection(_)) | (ty::Projection(_), ty::Param(_)) => {                         db.note("you might be missing a type parameter or trait bound");                     }-                    (ty::Param(p), _) | (_, ty::Param(p)) => {+                    (ty::Param(p), ty::Dynamic(..))+                    | (ty::Dynamic(..), ty::Param(p))+                    | (ty::Param(p), ty::Opaque(..))+                    | (ty::Opaque(..), ty::Param(p)) => {
                    (ty::Param(p), ty::Dynamic(..) | ty::Opaque(..))
                    | (ty::Dynamic(..) | ty::Opaque(..), ty::Param(p)) => {
estebank

comment created time in a month

pull request commentrust-lang/rfcs

major change proposal process for compiler team

Well it does for the libs team but probably very rarely for the compiler team. :)

nikomatsakis

comment created time in a month

issue closedrust-lang/rust

Incorrect unused_variables diagnostic for or-ed patterns

With rustc 1.42.0-nightly (0de96d37f 2019-12-19):

For the following code:

pub enum MyEnum {
    A { i: i32, j: i32 },
    B { i: i32, j: i32 },
}

pub fn foo(x: MyEnum) {
    use MyEnum::*;

    match x {
        A { i, j } | B { i, j } => {
            println!("{}", i);
        }
    }
}

I get the following diagnostic:

) rustc +nightly test.rs -o test --crate-type lib
warning: unused variable: `j`
  --> test.rs:10:16
   |
10 |         A { i, j } | B { i, j } => {
   |                ^            ^
   |
   = note: `#[warn(unused_variables)]` on by default
help: try ignoring the field
   |
10 |         A { i, j: _j: _ } | B { i, j } => {
   |                ^^^^^^^

Instead of:

help: try ignoring the field
   |
10 |         A { i, j: _ } | B { i, j: _ } => {
   |                ^^^^            ^^^^

closed time in a month

sapir

issue commentrust-lang/rust

Incorrect unused_variables diagnostic for or-ed patterns

Was fixed in https://github.com/rust-lang/rust/pull/67766.

sapir

comment created time in a month

issue commentrust-lang/rust

ICE: No `move_errors` should be allowed in MIR borrowck

Looks like this compiles but it shouldn't:

struct S;

fn foo() {
    &([S][0],);
}

Dumping the MIR for this you get:

fn  foo() -> () {
    let mut _0: ();                      // return place in scope 0 at src/lib.rs:3:10: 3:10
    let _1: &(S,);                       // in scope 0 at src/lib.rs:4:5: 4:15
    let mut _2: &(S,);                   // in scope 0 at src/lib.rs:4:5: 4:15

    bb0: {
        StorageLive(_1);                 // bb0[0]: scope 0 at src/lib.rs:4:5: 4:15
        _2 = const foo::promoted[0];     // bb0[1]: scope 0 at src/lib.rs:4:5: 4:15
                                         // ty::Const
                                         // + ty: &(S,)
                                         // + val: Unevaluated(DefId(0:5 ~ playground[4e22]::foo[0]), [], Some(promoted[0]))
                                         // mir::Constant
                                         // + span: src/lib.rs:4:5: 4:15
                                         // + literal: Const { ty: &(S,), val: Unevaluated(DefId(0:5 ~ playground[4e22]::foo[0]), [], Some(promoted[0])) }
        _1 = _2;                         // bb0[2]: scope 0 at src/lib.rs:4:5: 4:15
        StorageDead(_1);                 // bb0[3]: scope 0 at src/lib.rs:4:15: 4:16
        return;                          // bb0[4]: scope 0 at src/lib.rs:5:2: 5:2
    }
}

promoted[0] in  foo: &(S,) = {
    let mut _0: &(S,);                   // return place in scope 0 at src/lib.rs:4:5: 4:15
    let mut _1: (S,);                    // in scope 0 at src/lib.rs:4:6: 4:15
    let mut _2: S;                       // in scope 0 at src/lib.rs:4:7: 4:13
    let mut _3: [S; 1];                  // in scope 0 at src/lib.rs:4:7: 4:10
    let mut _4: S;                       // in scope 0 at src/lib.rs:4:8: 4:9
    let mut _5: usize;                   // in scope 0 at src/lib.rs:4:11: 4:12

    bb0: {
        _3 = [move _4];                  // bb0[0]: scope 0 at src/lib.rs:4:7: 4:10
        _5 = const 0usize;               // bb0[1]: scope 0 at src/lib.rs:4:11: 4:12
                                         // ty::Const
                                         // + ty: usize
                                         // + val: Value(Scalar(0x0000000000000000))
                                         // mir::Constant
                                         // + span: src/lib.rs:4:11: 4:12
                                         // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) }
        _2 = move _3[_5];                // bb0[2]: scope 0 at src/lib.rs:4:7: 4:13
        (_1.0: S) = move _2;             // bb0[3]: scope 0 at src/lib.rs:4:6: 4:15
        _0 = &_1;                        // bb0[4]: scope 0 at src/lib.rs:4:5: 4:15
        return;                          // bb0[5]: scope 0 at src/lib.rs:4:5: 4:15
    }
}

Presumably, what should happen here is:

error[E0508]: cannot move out of type `[S; 1]`, a non-copy array
 --> src/lib.rs:4:6
  |
4 |    &([S][0],);
  |      ^^^^^^
  |      |
  |      cannot move out of here
  |      move occurs because value has type `S`, which does not implement the `Copy` trait

The delay_span_bug occurs here:

impl<'tcx> MirPass<'tcx> for ElaborateDrops {
    fn run_pass(&self, tcx: TyCtxt<'tcx>, src: MirSource<'tcx>, body: &mut BodyAndCache<'tcx>) {
        debug!("elaborate_drops({:?} @ {:?})", src, body.span);

        let def_id = src.def_id();
        let param_env = tcx.param_env(src.def_id()).with_reveal_all();
        let move_data = match MoveData::gather_moves(body, tcx, param_env) {
            Ok(move_data) => move_data,
            Err((move_data, _)) => {
                tcx.sess.delay_span_bug(
                    body.span,
                    "No `move_errors` should be allowed in MIR borrowck",
                );
                move_data
            }
        };

cc @oli-obk @matthewjasper

jurkstas

comment created time in a month

issue commentrust-lang/rust

TAIT: Add a test case using `Sized`

@rustbot assign @samrat

Centril

comment created time in a month

push eventCentril/rust

Stefan Lankes

commit sha c6435759b5039fa6483aa5a8775fc7a11db0154f

add basic support of OsStrExt for HermitCore this patch increases the compatibility to other operating systems

view details

Niko Matsakis

commit sha e7f8895359365403a955468156a35bf26a45e0bf

save/restore `pessimistic_yield` when entering bodies This flag is used to make the execution order around `+=` operators pessimistic. Failure to save/restore the flag was causing independent async blocks to effect one another, leading to strange ICEs and failed assumptions.

view details

John Kåre Alsaker

commit sha 87cdfb6e71b0ebe3e41e04d8840a20d7428197be

Add inline attributes for functions used in the query system

view details

David Sonder

commit sha a61a7c599379c068d97119fcbd9a949e8282b1cc

Enable rust-lld on dist-x86_64-musl Add rust-lld to llvm-tools-preview on nightly for musl

view details

Nicholas Nethercote

commit sha 4c8bf5028f31c0d82bbf46a50b2375131a488623

Remove some dead code. The condition checks if `sess.opts.output_types` doesn't contain `OutputType::Assembly` within a match arm that is only reached if `sess.opts.output_types` contains `OutputType::Assembly`.

view details

Nicholas Nethercote

commit sha 72a28e85d77bab7f1073ad2224d536ae232cfc50

Improve `ModuleConfig` initialization. There are three `ModuleConfigs`, one for each `ModuleKind`. The code to initialized them is spaghetti imperative code that sets each field to a default value and then modifies many fields in complicated ways. This makes it very hard to tell what value ends up in each field in each config. For example, the `modules_config.emit_pre_lto_bc` field is set twice, which means it can be set to true and then incorrectly set back to false. (This probably hasn't been noticed because it happens in a very obscure case.) This commit changes the code to a declarative style in which `ModuleConfig::new` initializes all fields and then they are never changed again. This is slightly more concise and much easier to read. (And it fixes the abovementioned `emit_pre_lto_bc` error as well.)

view details

Nicholas Nethercote

commit sha 5131c69dd67d9fc61d593803b252cf93ec369c18

Rename `modules_config` as `regular_config`. That way it matches `ModuleKind::Regular`.

view details

Lzu Tao

commit sha 041e1704fcd9cc932a4fa587c43d32ed9dcb9712

use of wmemchr for faster searching in [u16]

view details

lzutao

commit sha 89bc23643bc4ba979f28d6df8c091813c89c36a9

Use unrolled loop

view details

Camille GILLOT

commit sha 3c0edc895ff4d3d82e93c9dc61bb4a8a24da5fad

Allocate query Vecs on the arena.

view details

Camille GILLOT

commit sha 5e1ad0d1e448a4ead87c52dd622e12a35c66a7f2

Remove Arcs in queries.

view details

Camille GILLOT

commit sha 81f0e90c62bda14f5e7279b3f771f69ac6bc153f

Remove unneeded Lrc in query results.

view details

Camille GILLOT

commit sha 587b9abd4e0a72a3490766399659e393e3ed4da9

Retire rustc::ty::Attributes enum.

view details

Camille GILLOT

commit sha 802c0be3a225ff13826288ee7030899ff21bec33

Fix test.

view details

Jonas Schievink

commit sha 87d859af24f49496e6aa2f65833e1cc2909ccf52

Don't lint for self-recursion when the function can diverge

view details

Jonas Schievink

commit sha 9dd18a31e266b773a8c2b2308f21e7e39139754a

Move closure check upwards

view details

Jonas Schievink

commit sha 60e9927125f6fb191275b7f93f3ed34241fc35ef

Merge redundant match arms

view details

Jonas Schievink

commit sha dec90784ac143aba2eed9363e212a9197482f0ed

Add some comments and rename variable

view details

Stein Somers

commit sha 6ee7e8c978b1e354e210de6abe50d6d5bc1a77cb

Remove the Ord bound that was plaguing drain_filter, and superfluous lifetimes

view details

Niko Matsakis

commit sha cd9f709a33b952d52c34e037dc13adfe0a3efb8d

add nested regression test

view details

push time in a month

pull request commentrust-lang/rust

Document unsafety in core::{option, hash}

cc @RalfJung

LeSeulArtichaut

comment created time in a month

issue commentrust-lang/rust

remove language-level UB for non-UTF-8 str

The RFC format feels excessive as a matter of "filling in the forms" (I don't know that it would add anything). The design choices here aren't too complicated and it doesn't feel like there's any opposition thus far to the change here, given that LLVM et. al cannot exploit this. The FCP should provide the same chance of community input here I feel given the usual coverage in TWiR etc.

RalfJung

comment created time in a month

Pull request review commentrust-lang/rust

Suggest `-> impl Trait` and `-> Box<dyn Trait>` on fn that doesn't return

 fn check_fn<'a, 'tcx>(      inherited.tables.borrow_mut().liberated_fn_sigs_mut().insert(fn_id, fn_sig); -    fcx.check_return_expr(&body.value);+    if let ty::Dynamic(..) = declared_ret_ty.kind {

I think I would be happy if we did at least a delay_span_bug in this branch to be sure that if something goes out of sync, we still have an error.

estebank

comment created time in a month

Pull request review commentrust-lang/rust

Suggest `-> impl Trait` and `-> Box<dyn Trait>` on fn that doesn't return

 LL | fn ban() -> dyn Trait { Struct }    |             ^^^^^^^^^ doesn't have a size known at compile-time    |    = note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>-help: return `impl Trait` instead, as all return paths are of type `Struct`, which implements `Trait`+help: use `impl Trait` as the return type, as all return paths are of type `Struct`, which implements `Trait`    | LL | fn ban() -> impl Trait { Struct }    |             ^^^^^^^^^^ -error[E0277]: the size for values of type `(dyn Trait + 'static)` cannot be known at compilation time+error[E0746]: return type cannot have an unboxed trait object   --> $DIR/dyn-trait-return-should-be-impl-trait.rs:17:13    | LL | fn bak() -> dyn Trait { unimplemented!() }    |             ^^^^^^^^^ doesn't have a size known at compile-time    |-   = help: the trait `std::marker::Sized` is not implemented for `(dyn Trait + 'static)`-   = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>-   = note: the return type of a function must have a statically known size+help: use some type `T` that is `T: Sized` as the return type if all return paths have the same type+   |+LL | fn bak() -> T { unimplemented!() }+   |             ^

todo!() and friends don't really want ! as their type? (() is just arbitrary imo)

estebank

comment created time in a month

Pull request review commentrust-lang/rust

Suggest `-> impl Trait` and `-> Box<dyn Trait>` on fn that doesn't return

 impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {             #using-trait-objects-that-allow-for-values-of-different-types>";         let has_dyn = snippet.split_whitespace().next().map_or(false, |s| s == "dyn");         let trait_obj = if has_dyn { &snippet[4..] } else { &snippet[..] };-        if all_returns_have_same_type {+        if count == 0 {+            // No return paths. Suggest `-> T`, `-> impl Trait`, and if `Trait` is object safe,+            // `-> Box<dyn Trait>`.+            err.note(+                "currently nothing is being returned, depending on the final implementation \+                 you could change the return type in different ways",

Tweaked slightly:

depending on the final implementation, here are some alternatives

estebank

comment created time in a month

Pull request review commentrust-lang/rust

Suggest `-> impl Trait` and `-> Box<dyn Trait>` on fn that doesn't return

 impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {             .iter()             .filter_map(|expr| tables.node_type_opt(expr.hir_id))             .map(|ty| self.resolve_vars_if_possible(&ty));-        let (last_ty, all_returns_have_same_type) = ret_types.clone().fold(-            (None, true),-            |(last_ty, mut same): (std::option::Option<Ty<'_>>, bool), ty| {+        let (last_ty, all_returns_have_same_type, count) = ret_types.clone().fold(+            (None, true, 0),+            |(last_ty, mut same, count): (std::option::Option<Ty<'_>>, bool, usize), ty| {                 let ty = self.resolve_vars_if_possible(&ty);-                same &= last_ty.map_or(true, |last_ty| last_ty == ty) && ty.kind != ty::Error;-                (Some(ty), same)+                same &= last_ty.map_or(true, |last_ty| {+                    // FIXME: ideally we would use `can_coerce` here instead, but `typeck` comes+                    // *after* in the dependency graph.+                    match (&ty.kind, &last_ty.kind) {

Seems like an improvement 👍

estebank

comment created time in a month

Pull request review commentrust-lang/rust

Suggest `-> impl Trait` and `-> Box<dyn Trait>` on fn that doesn't return

 pub trait InferCtxtExt<'tcx> {         trait_ref: &ty::Binder<ty::TraitRef<'tcx>>,     ) -> bool; +    fn suggest_trait_object_return_type_alternatives(

Btw, is there a reason we are adding a bunch of methods to this trait instead of just using free functions? It feels like a rather silly misuse of the trait system (which is intended for bounded ad-hoc polymorphism, not insisting on getting method syntax...).

estebank

comment created time in a month

Pull request review commentrust-lang/rust

More de-abuse of TyKind::Error

 impl<'tcx> Constructor<'tcx> {                                     // Treat all uninhabited types in non-exhaustive variants as                                     // `TyErr`.                                     (_, true, true) => cx.tcx.types.err,-                                    // Treat all non-visible fields as `TyErr`. They can't appear-                                    // in any other pattern from this match (because they are+                                    // Treat all non-visible fields as `()`. They can't appear in

On the other hand it says that we are picking some inhabited dummy, so () is as good as any I suppose.

mark-i-m

comment created time in a month

Pull request review commentrust-lang/rust

More de-abuse of TyKind::Error

 impl<'tcx> Constructor<'tcx> {                                     // Treat all uninhabited types in non-exhaustive variants as                                     // `TyErr`.                                     (_, true, true) => cx.tcx.types.err,-                                    // Treat all non-visible fields as `TyErr`. They can't appear-                                    // in any other pattern from this match (because they are+                                    // Treat all non-visible fields as `()`. They can't appear in

This seems arbitrary; cc @varkor @Nadrieril

mark-i-m

comment created time in a month

pull request commentrust-lang/rfcs

major change proposal process for compiler team

(Except that waiting for one more week after everyone ticked their boxes often feels excessive.)

I think the idea with that is that sometimes, many team members check their boxes very quickly (same day, e.g., in the case of the libs team should all of them) so it goes into FCP immediately, and then the community is given no time to object, if there is no waiting period.

nikomatsakis

comment created time in a month

issue openedrust-lang/rust

TAIT: Add a test case using `Sized`

Note to self (or whoever wants to help out); the following should be added as a test case in src/test/ui/type-alias-impl-trait:

// check-pass

#![feature(type_alias_impl_trait)]

type A = impl Sized;
fn f1() -> A { 0 }

type B = impl ?Sized;
fn f2() -> &'static B { &[0] }

type C = impl ?Sized + 'static;
fn f3() -> &'static C { &[0] }

type D = impl ?Sized;
fn f4() -> &'static D { &1 }

created time in a month

issue openedrust-lang/rust

Interactions in `type_alias_impl_trait` and `associated_type_defaults`

A question about impl Trait in trait type aliases: has any thought been given about how they should handle defaults?

I'm trying to do something like this, without success:

#![feature(type_alias_impl_trait, associated_type_defaults)]

use std::fmt::Debug;

struct Foo {
}

trait Bar {
    type T: Debug = impl Debug;
    fn bar() -> Self::T {
        ()
    }
}

impl Bar for Foo {
    type T = impl Debug;
    fn bar() -> Self::T {
        ()
    }
}

(playground link)

I'd guess this just hasn't been RFC'd yes, but does someone know if thought on the topic have already started?

Originally posted by @Ekleog in https://github.com/rust-lang/rust/issues/63063#issuecomment-612619080

created time in a month

Pull request review commentrust-lang/rust

Add `ConstKind::Error` and convert `ErrorHandled::Reported` to it.

 impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {             }              // Already reported in the query.-            ConstEvalFailure(ErrorHandled::Reported) => {+            ConstEvalFailure(ErrorHandled::Reported(ErrorReported) | ErrorHandled::Linted) => {

On ::Linted, we might still do delay_span_bug... so an ICE is possible?

eddyb

comment created time in a month

Pull request review commentrust-lang/rust

Add `ConstKind::Error` and convert `ErrorHandled::Reported` to it.

 pub struct CommonLifetimes<'tcx> { }  pub struct CommonConsts<'tcx> {-    pub err: &'tcx Const<'tcx>,+    pub unit: &'tcx Const<'tcx>,

Where is this used?

eddyb

comment created time in a month

Pull request review commentrust-lang/rust

Add `ConstKind::Error` and convert `ErrorHandled::Reported` to it.

 impl<'tcx> ConstEvalErr<'tcx> {             err_inval!(Layout(LayoutError::Unknown(_))) | err_inval!(TooGeneric) => {                 return Err(ErrorHandled::TooGeneric);             }-            err_inval!(TypeckError) => return Err(ErrorHandled::Reported),+            err_inval!(TypeckError(error_reported)) => {+                return Err(ErrorHandled::Reported(error_reported));+            }             // We must *always* hard error on these, even if the caller wants just a lint.             err_inval!(Layout(LayoutError::SizeOverflow(_))) => true,

Hmm, this case doesn't early return so it results in Ok(_) and then report_as_lint will turn it into ErrorReported::Lint, which seems wrong?

eddyb

comment created time in a month

Pull request review commentrust-lang/rust

Add `ConstKind::Error` and convert `ErrorHandled::Reported` to it.

 impl FlagComputation {             | &ty::Str             | &ty::Foreign(..) => {} -            // You might think that we could just return Error for-            // any type containing Error as a component, and get-            // rid of the TypeFlags::HAS_TY_ERR flag -- likewise for ty_bot (with-            // the exception of function types that return bot).-            // But doing so caused sporadic memory corruption, and-            // neither I (tjc) nor nmatsakis could figure out why,-            // so we're doing it this way.

Comment not relevant anymore?

eddyb

comment created time in a month

Pull request review commentrust-lang/rust

Add `ConstKind::Error` and convert `ErrorHandled::Reported` to it.

 pub fn super_relate_consts<R: TypeRelation<'tcx>>(     let tcx = relation.tcx();      let eagerly_eval = |x: &'tcx ty::Const<'tcx>| {+        // FIXME(eddyb) this doesn't account for lifetime inference variables+        // being erased by `eval`, *nor* for the polymorphic aspect of `eval`.+        // That is, we could always use `eval` and it will just return the+        // old value back if it doesn't succeed.         if !x.val.needs_infer() {             return x.eval(tcx, relation.param_env()).val;         }         x.val     }; +    // FIXME(eddyb) doesn't look like everything below checks that `a.ty == b.ty`.+    // We could probably always assert it early, as `const` generic parameters+    // are not allowed to depend on other generic parameters, i.e. are concrete.

I think this temporary and won't always remain so, so let's not bake that assumption too deeply into the compiler.

eddyb

comment created time in a month

Pull request review commentrust-lang/rust

Add `ConstKind::Error` and convert `ErrorHandled::Reported` to it.

 impl<'a, 'tcx> TypeFolder<'tcx> for FullTypeResolver<'a, 'tcx> {             match c.val {                 ty::ConstKind::Infer(InferConst::Var(vid)) => {                     self.err = Some(FixupError::UnresolvedConst(vid));-                    return self.tcx().consts.err;+                    return self.tcx().mk_const(ty::Const { val: ty::ConstKind::Error, ty: c.ty });

Here and in the other the places... (method doesn't exist ofc, so will need to be made)

                    return self.tcx().mk_const_err(c.ty);
eddyb

comment created time in a month

pull request commentrust-lang/rust

ptr: introduce slice_len()

cc @rust-lang/wg-const-eval cc @rust-lang/libs r? @oli-obk

NeoRaider

comment created time in a month

issue commentrust-lang/rust

Meta LLVM codegen regression tracking issue

Removing I-unsound as this issue doesn't track a specific known soundness hole.

nikomatsakis

comment created time in a month

issue commentrust-lang/rust

`static FOO:Foo=FOO;` doesn't cause cycle error for zero-sized-type with no public constructor.

Weaponized soundness hole (using https://docs.rs/refl/0.2.1/refl/ as a foundation):

pub static FOO: refl::Id<usize, Box<u8>> = FOO;

fn main() {
    let x: Box<_> = FOO.cast(42usize);
    drop(x);
}

mod refl {
    pub struct Id<S: ?Sized, T: ?Sized>(core::marker::PhantomData<(fn(S) -> S, fn(T) -> T)>);

    impl<S: ?Sized, T: ?Sized> Copy for Id<S, T> {}
    impl<S: ?Sized, T: ?Sized> Clone for Id<S, T> { fn clone(&self) -> Self { *self } }

    impl<S: ?Sized, T: ?Sized> Id<S, T> {
        /// Casts a value of type `S` to `T`.
        ///
        /// This is safe because the `Id` type is always guaranteed to
        /// only be inhabited by `Id<T, T>` types by construction.
        pub fn cast(self, value: S) -> T where S: Sized, T: Sized {
            unsafe {
                // Transmute the value;
                // This is safe since we know by construction that
                // S == T (including lifetime invariance) always holds.
                let cast_value = core::mem::transmute_copy(&value);
    
                // Forget the value;
                // otherwise the destructor of S would be run.
                core::mem::forget(value);
    
                cast_value
            }
        }
    }
}

==>

   Compiling playground v0.0.1 (/playground)
    Finished dev [unoptimized + debuginfo] target(s) in 0.60s
     Running `target/debug/playground`
timeout: the monitored command dumped core
/playground/tools/entrypoint.sh: line 11:     7 Segmentation fault      timeout --signal=KILL ${timeout} "$@"
rodrimati1992

comment created time in a month

Pull request review commentrust-lang/rust

Suggest `-> impl Trait` and `-> Box<dyn Trait>` on fn that doesn't return

 impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {             #using-trait-objects-that-allow-for-values-of-different-types>";         let has_dyn = snippet.split_whitespace().next().map_or(false, |s| s == "dyn");         let trait_obj = if has_dyn { &snippet[4..] } else { &snippet[..] };-        if all_returns_have_same_type {+        if count == 0 {+            // No return paths. Suggest `-> T`, `-> impl Trait`, and if `Trait` is object safe,+            // `-> Box<dyn Trait>`.+            err.note(+                "currently nothing is being returned, depending on the final implementation \+                 you could change the return type in different ways",

nothing is being returned. Depending on the final implementation, change the return type in different ways

then?

estebank

comment created time in 2 months

Pull request review commentrust-lang/rust

Suggest `-> impl Trait` and `-> Box<dyn Trait>` on fn that doesn't return

 impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {             .iter()             .filter_map(|expr| tables.node_type_opt(expr.hir_id))             .map(|ty| self.resolve_vars_if_possible(&ty));-        let (last_ty, all_returns_have_same_type) = ret_types.clone().fold(-            (None, true),-            |(last_ty, mut same): (std::option::Option<Ty<'_>>, bool), ty| {+        let (last_ty, all_returns_have_same_type, count) = ret_types.clone().fold(+            (None, true, 0),+            |(last_ty, mut same, count): (std::option::Option<Ty<'_>>, bool, usize), ty| {                 let ty = self.resolve_vars_if_possible(&ty);-                same &= last_ty.map_or(true, |last_ty| last_ty == ty) && ty.kind != ty::Error;-                (Some(ty), same)+                same &= last_ty.map_or(true, |last_ty| {+                    // FIXME: ideally we would use `can_coerce` here instead, but `typeck` comes+                    // *after* in the dependency graph.+                    match (&ty.kind, &last_ty.kind) {

Can't you use (Infer(a), Infer(b)) => discriminant(a) == discriminant(b)?

estebank

comment created time in 2 months

delete branch Centril/proptest

delete branch : merge-0.9.6-into-master

delete time in 2 months

push eventAltSysrq/proptest

Mazdak Farrokhzad

commit sha eaa3c55179fc954fc153fdcacf927afd231aa992

release 0.9.6, fixing future compat issue

view details

Mazdak Farrokhzad

commit sha 768527ca33c34218cb059ac88d5ef6266aeb82d6

Merge pull request #187 from Centril/merge-0.9.6-into-master Merge 0.9.6 into master

view details

push time in 2 months

PR merged AltSysrq/proptest

Merge 0.9.6 into master

Fixes https://github.com/AltSysrq/proptest/issues/186.

I've already gone ahead and published 0.9.6 with this fix.

+11 -5

0 comment

5 changed files

Centril

pr closed time in 2 months

issue closedAltSysrq/proptest

Nightly 2020-04-08 broke the v0.9.5 builds

latest update on 2020-04-08, rust version 1.44.0-nightly (42abbd887 2020-04-07)

It looks like with this nightly ver. builds might have been failing. I haven't had deep look at that but it seems like overarching lifetimes are the issue.

error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
##[error]  --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/proptest-0.9.5/src/arbitrary/_core/iter.rs:47:23
   |
47 |         base.prop_map(Iterator::cloned).boxed()
   |                       ^^^^^^^^^^^^^^^^
   |
note: first, the lifetime cannot outlive the lifetime `'a` as defined on the impl at 36:9...
  --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/proptest-0.9.5/src/arbitrary/_core/iter.rs:36:9
   |
36 |         'a,
   |         ^^
note: ...so that the types are compatible
  --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/proptest-0.9.5/src/arbitrary/_core/iter.rs:47:23
   |
47 |         base.prop_map(Iterator::cloned).boxed()
   |                       ^^^^^^^^^^^^^^^^
   = note: expected  `&'a T`
              found  `&T`
   = note: but, the lifetime must be valid for the static lifetime...
note: ...so that the type `strategy::map::Map<S, fn(A) -> core::iter::Cloned<A> {<A as core::iter::Iterator>::cloned::<'_, T>}>` will meet its required lifetime bounds
  --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/proptest-0.9.5/src/arbitrary/_core/iter.rs:47:41
   |
47 |         base.prop_map(Iterator::cloned).boxed()
   |                                         ^^^^^

error: aborting due to previous error

closed time in 2 months

vertexclique

issue commentrust-lang/rust

ICE with opaquely typed constant used in pattern

This should be erroring in exhaustiveness checking; ty::Opaque shouldn't be allowed there.

cc @oli-obk @eddyb @pnkfelix @ecstatic-morse

Centril

comment created time in 2 months

issue openedrust-lang/rust

ICE with opaquely typed constant used in pattern

#![feature(impl_trait_in_bindings)]

fn main() {
    const C: impl Copy = 0;
    match C {
        C | _ => {}
    }
}

Backtrace:

error: internal compiler error: src/librustc_mir_build/build/matches/test.rs:417: non_scalar_compare called on non-reference type: impl std::marker::Copy

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:880:9
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1069
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1504
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:198
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:218
  10: rustc_driver::report_ice
  11: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:515
  12: std::panicking::begin_panic
  13: rustc_errors::HandlerInner::bug
  14: rustc_errors::Handler::bug
  15: rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}
  16: rustc_middle::ty::context::tls::with_opt::{{closure}}
  17: rustc_middle::ty::context::tls::with_opt
  18: rustc_middle::util::bug::opt_span_bug_fmt
  19: rustc_middle::util::bug::bug_fmt
  20: rustc_mir_build::build::matches::test::<impl rustc_mir_build::build::Builder>::non_scalar_compare
  21: rustc_mir_build::build::matches::<impl rustc_mir_build::build::Builder>::match_simplified_candidates
  22: rustc_mir_build::build::matches::<impl rustc_mir_build::build::Builder>::match_candidates
  23: rustc_mir_build::build::matches::<impl rustc_mir_build::build::Builder>::lower_match_tree
  24: rustc_mir_build::build::expr::into::<impl rustc_mir_build::build::Builder>::into_expr
  25: rustc_mir_build::build::expr::into::<impl rustc_mir_build::build::Builder>::into_expr
  26: rustc_mir_build::build::block::<impl rustc_mir_build::build::Builder>::ast_block_stmts
  27: rustc_mir_build::build::expr::into::<impl rustc_mir_build::build::Builder>::into_expr
  28: rustc_mir_build::build::expr::into::<impl rustc_mir_build::build::Builder>::into_expr
  29: rustc_mir_build::build::expr::into::<impl rustc_mir_build::build::Builder>::into_expr
  30: rustc_mir_build::build::construct_fn
  31: rustc_middle::ty::context::GlobalCtxt::enter_local
  32: rustc_mir_build::build::mir_built
  33: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::mir_built>::compute
  34: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  35: rustc_query_system::query::plumbing::get_query
  36: rustc_mir::transform::check_unsafety::unsafety_check_result
  37: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::unsafety_check_result>::compute
  38: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  39: rustc_query_system::query::plumbing::get_query
  40: rustc_mir::transform::mir_const
  41: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::mir_const>::compute
  42: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  43: rustc_query_system::query::plumbing::get_query
  44: rustc_mir::transform::mir_validated
  45: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::mir_validated>::compute
  46: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  47: rustc_query_system::query::plumbing::get_query
  48: rustc_mir::borrow_check::mir_borrowck
  49: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::mir_borrowck>::compute
  50: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  51: rustc_query_system::query::plumbing::get_query
  52: rustc_query_system::query::plumbing::ensure_query
  53: rustc_session::utils::<impl rustc_session::session::Session>::time
  54: rustc_interface::passes::analysis
  55: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
  56: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  57: rustc_query_system::query::plumbing::get_query
  58: rustc_middle::ty::context::tls::enter_global
  59: rustc_interface::interface::run_compiler_in_existing_thread_pool
  60: scoped_tls::ScopedKey<T>::set
  61: rustc_ast::attr::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.44.0-nightly (94d346360 2020-04-09) running on x86_64-unknown-linux-gnu

note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [mir_built] building MIR for
#1 [unsafety_check_result] unsafety-checking `main`
#2 [mir_const] processing `main`
#3 [mir_validated] processing `main`
#4 [mir_borrowck] borrow-checking `main`
#5 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error

error: could not compile `playground`.

To learn more, run the command again with --verbose.

created time in 2 months

issue commentAltSysrq/proptest

Nightly 2020-04-08 broke the v0.9.5 builds

I've published 0.9.6, and https://github.com/AltSysrq/proptest/pull/187 also merges the fix there into master.

vertexclique

comment created time in 2 months

issue commentrust-lang/rust

Compile regression "cannot infer an appropriate lifetime for lifetime parameter"

I've gone ahead and released proptest 0.9.6 which has a fix for the problem here.

gz

comment created time in 2 months

created tagAltSysrq/proptest

tag0.9.6

Hypothesis-like property testing for Rust

created time in 2 months

release AltSysrq/proptest

0.9.6

released time in 2 months

PR opened AltSysrq/proptest

Release 0.9.6, fixing future compat issue

Fixes https://github.com/AltSysrq/proptest/issues/186.

I've already gone ahead and published 0.9.6 with this fix.

+11 -5

0 comment

5 changed files

pr created time in 2 months

create barnchCentril/proptest

branch : merge-0.9.6-into-master

created branch time in 2 months

create barnchAltSysrq/proptest

branch : 0.9.6-changes

created branch time in 2 months

create barnchCentril/proptest

branch : release-0.9.6

created branch time in 2 months

Pull request review commentrust-lang/rust

Suggest `-> impl Trait` and `-> Box<dyn Trait>` on fn that doesn't return

 LL |     } LL |     Box::new(42)    | +error[E0308]: `if` and `else` have incompatible types

Why is this happening?

estebank

comment created time in 2 months

Pull request review commentrust-lang/rust

Suggest `-> impl Trait` and `-> Box<dyn Trait>` on fn that doesn't return

 impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {             #using-trait-objects-that-allow-for-values-of-different-types>";         let has_dyn = snippet.split_whitespace().next().map_or(false, |s| s == "dyn");         let trait_obj = if has_dyn { &snippet[4..] } else { &snippet[..] };-        if all_returns_have_same_type {+        if count == 0 {+            // No return paths. Suggest `-> T`, `-> impl Trait`, and if `Trait` is object safe,+            // `-> Box<dyn Trait>`.+            err.note(+                "currently nothing is being returned, depending on the final implementation \+                 you could change the return type in different ways",+            );+            err.span_suggestion(+                ret_ty.span,+                "you could use some type `T` that is `T: Sized` as the return type if all return \+                 paths will have the same type",+                "T".to_string(),+                Applicability::MaybeIncorrect,+            );+            err.span_suggestion(+                ret_ty.span,+                &format!(+                    "you could use `impl {}` as the return type if all return paths will have the \
                    "use `impl {}` as the return type if all return paths have the \
estebank

comment created time in 2 months

Pull request review commentrust-lang/rust

Suggest `-> impl Trait` and `-> Box<dyn Trait>` on fn that doesn't return

 fn check_fn<'a, 'tcx>(      inherited.tables.borrow_mut().liberated_fn_sigs_mut().insert(fn_id, fn_sig); -    fcx.check_return_expr(&body.value);+    if let ty::Dynamic(..) = declared_ret_ty.kind {

Can we move this into check_return_expr instead?

estebank

comment created time in 2 months

Pull request review commentrust-lang/rust

Suggest `-> impl Trait` and `-> Box<dyn Trait>` on fn that doesn't return

 impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {             #using-trait-objects-that-allow-for-values-of-different-types>";         let has_dyn = snippet.split_whitespace().next().map_or(false, |s| s == "dyn");         let trait_obj = if has_dyn { &snippet[4..] } else { &snippet[..] };-        if all_returns_have_same_type {+        if count == 0 {+            // No return paths. Suggest `-> T`, `-> impl Trait`, and if `Trait` is object safe,+            // `-> Box<dyn Trait>`.+            err.note(+                "currently nothing is being returned, depending on the final implementation \+                 you could change the return type in different ways",+            );+            err.span_suggestion(+                ret_ty.span,+                "you could use some type `T` that is `T: Sized` as the return type if all return \+                 paths will have the same type",+                "T".to_string(),+                Applicability::MaybeIncorrect,+            );+            err.span_suggestion(+                ret_ty.span,+                &format!(+                    "you could use `impl {}` as the return type if all return paths will have the \+                     same type but you want to expose only the trait in the signature",+                    trait_obj,+                ),+                format!("impl {}", trait_obj),+                Applicability::MaybeIncorrect,+            );+            err.note(impl_trait_msg);+            if is_object_safe {+                err.span_suggestion(+                    ret_ty.span,+                    &format!(+                        "you could use a boxed trait object if all return paths `impl` trait `{}`",
                        "use a boxed trait object if all return paths `impl` trait `{}`",
estebank

comment created time in 2 months

Pull request review commentrust-lang/rust

Suggest `-> impl Trait` and `-> Box<dyn Trait>` on fn that doesn't return

 impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {             #using-trait-objects-that-allow-for-values-of-different-types>";         let has_dyn = snippet.split_whitespace().next().map_or(false, |s| s == "dyn");         let trait_obj = if has_dyn { &snippet[4..] } else { &snippet[..] };-        if all_returns_have_same_type {+        if count == 0 {+            // No return paths. Suggest `-> T`, `-> impl Trait`, and if `Trait` is object safe,+            // `-> Box<dyn Trait>`.+            err.note(+                "currently nothing is being returned, depending on the final implementation \+                 you could change the return type in different ways",
                 change the return type in different ways",
estebank

comment created time in 2 months

Pull request review commentrust-lang/rust

Suggest `-> impl Trait` and `-> Box<dyn Trait>` on fn that doesn't return

 impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {             #using-trait-objects-that-allow-for-values-of-different-types>";         let has_dyn = snippet.split_whitespace().next().map_or(false, |s| s == "dyn");         let trait_obj = if has_dyn { &snippet[4..] } else { &snippet[..] };-        if all_returns_have_same_type {+        if count == 0 {+            // No return paths. Suggest `-> T`, `-> impl Trait`, and if `Trait` is object safe,+            // `-> Box<dyn Trait>`.+            err.note(+                "currently nothing is being returned, depending on the final implementation \+                 you could change the return type in different ways",+            );+            err.span_suggestion(+                ret_ty.span,+                "you could use some type `T` that is `T: Sized` as the return type if all return \+                 paths will have the same type",
                 paths have the same type",
estebank

comment created time in 2 months

Pull request review commentrust-lang/rust

Suggest `-> impl Trait` and `-> Box<dyn Trait>` on fn that doesn't return

 impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {             #using-trait-objects-that-allow-for-values-of-different-types>";         let has_dyn = snippet.split_whitespace().next().map_or(false, |s| s == "dyn");         let trait_obj = if has_dyn { &snippet[4..] } else { &snippet[..] };-        if all_returns_have_same_type {+        if count == 0 {+            // No return paths. Suggest `-> T`, `-> impl Trait`, and if `Trait` is object safe,+            // `-> Box<dyn Trait>`.+            err.note(+                "currently nothing is being returned, depending on the final implementation \+                 you could change the return type in different ways",+            );+            err.span_suggestion(+                ret_ty.span,+                "you could use some type `T` that is `T: Sized` as the return type if all return \
                "use some type `T` that is `T: Sized` as the return type if all return \
estebank

comment created time in 2 months

more