profile
viewpoint
Bastian Kauschke lcnr Germany NaCl (he/him)

lcnr/crow 89

A simple pixel perfect 2D rendering engine

lcnr/akari 35

A showcase game for the crow rendering engine

distransient/gmtk2019 5

"Only One"

lcnr/computer 2

A simple computer made from scratch

lcnr/binary 1

Efficient type based integers

lcnr/amethyst 0

Data-oriented and data-driven game engine written in Rust

lcnr/arewegameyet 0

The repository for arewegameyet.rs

lcnr/awesome-rust-mentors 0

A list of rust lang mentors tagged by topics of interest

pull request commentrust-lang/rust

Support const args in type dependent paths (Take 2)

@bors try @rust-timer queue

lcnr

comment created time in 4 hours

push eventlcnr/rust

Bastian Kauschke

commit sha 26f789f87b073a641d599e24c47d69d22b27c5a0

update const arg queries

view details

push time in 4 hours

issue commentrust-lang/rust

cycle error when dealing with an unevaluated const in the type of a const param

We really just have to stop using the parent generics in the type of const params :shrug: There is not much else we can do here

lcnr

comment created time in 9 hours

pull request commentrust-lang/rust

Support const args in type dependent paths (Take 2)

@rust-timer build b68a4014ccd7f0a6a24bd4662f34b565ca658c28

lcnr

comment created time in 14 hours

push eventlcnr/rust

Bastian Kauschke

commit sha 4f64463d592c5a87879ee8f71f907d59705ea0e8

cycle

view details

push time in 18 hours

pull request commentrust-lang/rust

Support const args in type dependent paths (Take 2)

@bors try @rust-timer queue

lcnr

comment created time in 18 hours

push eventlcnr/rust

Bastian Kauschke

commit sha 26ad65e7ac660a24f37813cb754fcaa1db0d9940

update test

view details

push time in 19 hours

push eventlcnr/rust

Bastian Kauschke

commit sha 6fa206c8741fe07d94ce40c44add0ce77469d7de

update test

view details

push time in 19 hours

push eventlcnr/rust

Bastian Kauschke

commit sha dcb7e7bf55d9ab48cad90fcf22accbdf9002b399

mir opt cross compile

view details

Bastian Kauschke

commit sha ecfa41ac1b62f9199ea0e04adc510438ac3c81f4

only call `typeck_tables_of_const_arg` for const args

view details

push time in 19 hours

Pull request review commentrust-lang/rust

Support const args in type dependent paths (Take 2)

+// run-pass+#![feature(const_generics)]+#![allow(incomplete_features)]++trait SliceExt<T: Clone> {+    fn array_windows<'a, const N: usize>(&'a self) -> ArrayWindows<'a, T, N>;+}++impl <T: Clone> SliceExt<T> for [T] {+   fn array_windows<'a, const N: usize>(&'a self) -> ArrayWindows<'a, T, N> {+       ArrayWindows{ idx: 0, slice: &self }+   }+}++struct ArrayWindows<'a, T, const N: usize> {+    slice: &'a [T],+    idx: usize,+}++impl <'a, T: Clone, const N: usize> Iterator for ArrayWindows<'a, T, N> {+    type Item = [T; N];+    fn next(&mut self) -> Option<Self::Item> {+        let mut res = unsafe{ std::mem::zeroed() };

It is :+1: I personally don't mind that though, as this is directly taken from https://github.com/rust-lang/rust/issues/61936#issuecomment-604090012 as a regression test.

lcnr

comment created time in 20 hours

pull request commentrust-lang/rust

Support const args in type dependent paths

over the next few weeks

i guess time is relative #74113

lcnr

comment created time in a day

pull request commentrust-lang/rust

Support const args in type dependent paths (Take 2)

@bors try @rust-timer queue

lcnr

comment created time in a day

push eventlcnr/rust

Bastian Kauschke

commit sha 1e024497e93622372493afb5caeec62361730257

mir_built is a lie

view details

push time in a day

push eventlcnr/rust

Bastian Kauschke

commit sha 3f372436e737455071a7d186d6033f3b8bc465ea

decode stuff

view details

Bastian Kauschke

commit sha 0c5695aaf76a37d4ebc8102e06de91c64dacb303

mir_built is a lie

view details

push time in a day

PR opened rust-lang/rust

Support const args in type dependent paths

once more, except it is sound this time :smiling_face_with_three_hearts:

#![feature(const_generics)]

struct A;
impl A {
    fn foo<const N: usize>(&self) -> usize { N }
}
struct B;
impl B {
    fn foo<const N: usize>(&self) -> usize { 42 }
}

fn main() {
    let a = A;
    a.foo::<7>();
}

When calling type_of for generic const arguments, we now use the TypeckTables of the surrounding body to get the expected type.

This alone causes cycle errors though, as we now have typeck_tables_of(main) -> ... -> type_of(main_ANON0 := 7) -> typeck_tables_of(main) :zap: (see https://github.com/rust-lang/rust/issues/68400#issuecomment-611760290)

To prevent this we must not call type_of(const_arg) during typeck_tables_of. This is achieved by calling type_of(param_def_id) instead.

TODO: document this approach, unlike #71154 some queries are now split into query_name and query_name_of_const_arg

r? @eddyb @varkor

+1287 -452

0 comment

82 changed files

pr created time in a day

push eventlcnr/rust

Bastian Kauschke

commit sha 93740fbd4b2ba4190946aea4702ebeac25483926

mir opt diff

view details

Bastian Kauschke

commit sha 104c2d75035fa6fe8a9b731785a032cee460432a

ui test diff

view details

push time in a day

push eventlcnr/rust

djugei

commit sha b4337ab8c387658b7012fa242e429f46c5f31141

added .collect() into String from Box<str> with fake feature/stability annotation

view details

Tomasz Miąsko

commit sha 291dce91b24d70382ebf1116fa836fd91960de84

Fallback to xml.etree.ElementTree The xml.etree.cElementTree has been deprecated since Python 3.3 and removed in Python 3.9 https://bugs.python.org/issue36543.

view details

mark

commit sha 3f6928f1f6eff367e6ddbfb63ebc5e568ffe0eb1

move contributing.md to rustc-dev-guide and point at getting started

view details

David Hewitt

commit sha 6b95f3102d657a5cd0549213a073b28c7e0fe609

Add `format_args_capture` feature

view details

Simonas Kazlauskas

commit sha df88972f8ce9ddbebec6d551810f7127fe25d2a3

Update psm version This new version includes a fix for building on aarch64 windows.

view details

Ivan Tham

commit sha f772587aba7b2be9a2fa708a26ba2605e32148ff

Add unstable docs for rustc_attrs

view details

Vadim Petrochenkov

commit sha 79a42e37084d0fc584c9f312c2a355104a113889

linker: Create GNU_EH_FRAME header by default when producing ELFs

view details

Ivan Tham

commit sha 725918f17e9a2c1e8a0ffec658d1363681f768bd

Update src/doc/unstable-book/src/language-features/rustc-attrs.md Co-authored-by: Ralf Jung <post@ralfj.de>

view details

David Hewitt

commit sha 8caf60407033e84592821a3f7b3917fe80d343e0

Improve messaging from PR feedback

view details

Vadim Petrochenkov

commit sha 7055c23d2cb3baabbae6af7ab196e43035260856

ast_pretty: Pass some token streams and trees by reference

view details

David Hewitt

commit sha a1217cb29de22aae3cda717e78d1edd3e9d8ffd1

Add `format_args_capture` to the unstable book

view details

Ivan Tham

commit sha 0e6f1093be08949b6ac4ba3d92ad4e97d0137dc5

Add preamable on rustc-attrs doc discussion

view details

CAD97

commit sha db539c649866d9a25cb18a741436b3086b5d6e04

Use raw_ref_op in A|Rc::as_ptr

view details

CAD97

commit sha e4bdf47f4c0773bba93f50900612242b929eca0b

Do not require ptr validity in rc::data_offset

view details

CAD97

commit sha d8a9c61e1a23b73c04d3058a11d1b8b2a46d635e

Use impl for Weak::as_ptr that works for unsized T

view details

pierwill

commit sha 49662726afdd6f4538bada73db771b939d92bd22

Add newline to rustc MultiSpan docs Also adds back-ticks when referring to the contents of this collection.

view details

Ivan Tham

commit sha 49b4804d291bc8cc93e7b4b8c24f344aa3e3f484

Ignore example compile in rustc-attrs doc

view details

Rich Kadel

commit sha 5239a68e72d1a0c7cba2cfd219a7da911360fbb7

add spans to injected coverage counters added regions with counter expressions and counters. Added codegen_llvm/coverageinfo mod for upcoming coverage map Move coverage region collection to CodegenCx finalization Moved from `query coverageinfo` (renamed from `query coverage_data`), as discussed in the PR at: https://github.com/rust-lang/rust/pull/73684#issuecomment-649882503 Address merge conflict in MIR instrument_coverage test The MIR test output format changed for int types. moved debug messages out of block.rs This makes the block.rs calls to add coverage mapping data to the CodegenCx much more concise and readable. move coverage intrinsic handling into llvm impl I realized that having half of the coverage intrinsic handling in `rustc_codegen_ssa` and half in `rustc_codegen_llvm` meant that any non-llvm backend would be bound to the same decisions about how the coverage-related MIR terminators should be handled. To fix this, I moved the non-codegen portion of coverage intrinsic handling into its own trait, and implemented it in `rustc_codegen_llvm` alongside `codegen_intrinsic_call`. I also added the (required?) stubs for the new intrinsics to `IntrepretCx::emulate_intrinsic()`, to ensure calls to this function do not fail if called with these new but known intrinsics. address PR Feedback on 28 June 2020 2:48pm PDT

view details

Dan Aloni

commit sha aab37fe52c0f142d116fee67d6eddedc7825dcc7

Add test for issue #56175

view details

Dan Aloni

commit sha 5427d3bf7c38df0c37597272bf34c6710cab3c52

Fix try_print_visible_def_path for Rust 2018 The recursive check of `try_print_visible_def_path` did not properly handle the Rust 2018 case of crate-paths without 'extern crate'. Instead, it returned a "not found" via (false, self). This fixes issue #56175.

view details

push time in a day

issue commentrust-lang/rust

[ICE] Static items with an fn type which uses a wildcard results in an ICE

Regressed between version 1.43.0 and 1.44.1

RDambrosio016

comment created time in a day

push eventlcnr/rust

Bastian Kauschke

commit sha a866f016efc830fe8a9964b9b8583ff3533c3e61

wording

view details

push time in a day

push eventlcnr/rust

Bastian Kauschke

commit sha 240601dfd359c3ea74b5037a00d5d5eef931cef8

add doc comment

view details

push time in a day

push eventlcnr/rust

Bastian Kauschke

commit sha b35f0eb27c87b8460a87c1b28c7458d814a77c75

add doc comment

view details

push time in a day

push eventlcnr/rust

Bastian Kauschke

commit sha c9bf4ba1ec58757e131d1288e6948a8993827614

add doc comment

view details

push time in a day

pull request commentrust-lang/rust

implement the occurs check for const vars

@nikomatsakis @varkor I tried adding a comment which explains what we are trying to prevent here, please tell me if there is anything else you want me to elaborate on.

lcnr

comment created time in a day

push eventlcnr/rust

Bastian Kauschke

commit sha e329efed6380050098c7ba79b43668a41c474cd1

add doc comment

view details

push time in a day

push eventlcnr/rust

Bastian Kauschke

commit sha dfd6b8f0404bc935efc2bf1654d5c420b8772158

add doc comment

view details

push time in a day

issue commentrust-lang/rust

Tracking Issue for `fn VecDeque::make_contiguous`

Don't think so, don't have the time to push this to stabilization myself though.

lcnr

comment created time in a day

issue openedrust-lang/rust

cycle error when dealing with an unevaluated const in the type of a const param

#![feature(const_generics)]

fn foo<const N: [u8; { 3 + 1 }]>() {}

should compile, but currently results in the following. I am kind of surprised that this ends up with 3 separate cycle errors.

warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
 --> src/lib.rs:1:12
  |
1 | #![feature(const_generics)]
  |            ^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default
  = note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information

error[E0391]: cycle detected when computing type of `foo::N`
 --> src/lib.rs:3:14
  |
3 | fn foo<const N: [u8; { 3 + 1 }]>() {}
  |              ^
  |
  = note: ...which again requires computing type of `foo::N`, completing the cycle
note: cycle used when computing type of `foo`
 --> src/lib.rs:3:1
  |
3 | fn foo<const N: [u8; { 3 + 1 }]>() {}
  | ^^^^^^^^^^^^^^^^^^^^

error[E0391]: cycle detected when computing type of `foo::N`
 --> src/lib.rs:3:14
  |
3 | fn foo<const N: [u8; { 3 + 1 }]>() {}
  |              ^
  |
note: ...which requires const-evaluating + checking `foo::{{constant}}#0`...
 --> src/lib.rs:3:22
  |
3 | fn foo<const N: [u8; { 3 + 1 }]>() {}
  |                      ^^^^^^^^^
note: ...which requires const-evaluating + checking `foo::{{constant}}#0`...
 --> src/lib.rs:3:22
  |
3 | fn foo<const N: [u8; { 3 + 1 }]>() {}
  |                      ^^^^^^^^^
note: ...which requires const-evaluating `foo::{{constant}}#0`...
 --> src/lib.rs:3:22
  |
3 | fn foo<const N: [u8; { 3 + 1 }]>() {}
  |                      ^^^^^^^^^
note: ...which requires optimizing MIR for `foo::{{constant}}#0`...
 --> src/lib.rs:3:22
  |
3 | fn foo<const N: [u8; { 3 + 1 }]>() {}
  |                      ^^^^^^^^^
note: ...which requires elaborating drops for `foo::{{constant}}#0`...
 --> src/lib.rs:3:22
  |
3 | fn foo<const N: [u8; { 3 + 1 }]>() {}
  |                      ^^^^^^^^^
note: ...which requires borrow-checking `foo::{{constant}}#0`...
 --> src/lib.rs:3:22
  |
3 | fn foo<const N: [u8; { 3 + 1 }]>() {}
  |                      ^^^^^^^^^
note: ...which requires processing `foo::{{constant}}#0`...
 --> src/lib.rs:3:22
  |
3 | fn foo<const N: [u8; { 3 + 1 }]>() {}
  |                      ^^^^^^^^^
note: ...which requires const checking `foo::{{constant}}#0`...
 --> src/lib.rs:3:22
  |
3 | fn foo<const N: [u8; { 3 + 1 }]>() {}
  |                      ^^^^^^^^^
note: ...which requires processing MIR for `foo::{{constant}}#0`...
 --> src/lib.rs:3:22
  |
3 | fn foo<const N: [u8; { 3 + 1 }]>() {}
  |                      ^^^^^^^^^
note: ...which requires unsafety-checking `foo::{{constant}}#0`...
 --> src/lib.rs:3:22
  |
3 | fn foo<const N: [u8; { 3 + 1 }]>() {}
  |                      ^^^^^^^^^
note: ...which requires building MIR for `foo::{{constant}}#0`...
 --> src/lib.rs:3:22
  |
3 | fn foo<const N: [u8; { 3 + 1 }]>() {}
  |                      ^^^^^^^^^
  = note: ...which again requires computing type of `foo::N`, completing the cycle
note: cycle used when computing type of `foo`
 --> src/lib.rs:3:1
  |
3 | fn foo<const N: [u8; { 3 + 1 }]>() {}
  | ^^^^^^^^^^^^^^^^^^^^

error[E0391]: cycle detected when computing type of `foo::N`
 --> src/lib.rs:3:14
  |
3 | fn foo<const N: [u8; { 3 + 1 }]>() {}
  |              ^
  |
note: ...which requires const-evaluating + checking `foo::{{constant}}#0`...
 --> src/lib.rs:3:22
  |
3 | fn foo<const N: [u8; { 3 + 1 }]>() {}
  |                      ^^^^^^^^^
note: ...which requires const-evaluating + checking `foo::{{constant}}#0`...
 --> src/lib.rs:3:22
  |
3 | fn foo<const N: [u8; { 3 + 1 }]>() {}
  |                      ^^^^^^^^^
note: ...which requires const-evaluating `foo::{{constant}}#0`...
 --> src/lib.rs:3:22
  |
3 | fn foo<const N: [u8; { 3 + 1 }]>() {}
  |                      ^^^^^^^^^
note: ...which requires optimizing MIR for `foo::{{constant}}#0`...
 --> src/lib.rs:3:22
  |
3 | fn foo<const N: [u8; { 3 + 1 }]>() {}
  |                      ^^^^^^^^^
note: ...which requires elaborating drops for `foo::{{constant}}#0`...
 --> src/lib.rs:3:22
  |
3 | fn foo<const N: [u8; { 3 + 1 }]>() {}
  |                      ^^^^^^^^^
note: ...which requires borrow-checking `foo::{{constant}}#0`...
 --> src/lib.rs:3:22
  |
3 | fn foo<const N: [u8; { 3 + 1 }]>() {}
  |                      ^^^^^^^^^
  = note: ...which again requires computing type of `foo::N`, completing the cycle
note: cycle used when computing type of `foo`
 --> src/lib.rs:3:1
  |
3 | fn foo<const N: [u8; { 3 + 1 }]>() {}
  | ^^^^^^^^^^^^^^^^^^^^

created time in a day

issue openedrust-lang/rustfmt

destructive formatting when dealing with const generics

When formatting

#![feature(const_generics)]

fn foo<
    const N: [u8; {
        struct Inner<'a>(&'a ());
        3
    }],
>() {}

rustfmt changes the empty function argument list from () to (&'a (), which is incorrect.

#![feature(const_generics)]

fn foo<
    const N: [u8; {
        struct Inner<'a>(&'a ());
        3
    }],
>(&'a () {
}

Note that the original code snippet current does not yet compile due to the unfinished nature of const generics, it should compile in the future though.

created time in a day

delete branch lcnr/rust

delete branch : make_contiguous

delete time in 2 days

issue commentrust-lang/rust

Tracking issue for Lazy Normalization of Constants

Lazy normalization of constants can be experimented with by either using #![feature(const_generics)] or just #![feature(lazy_normalization_consts)].

nikomatsakis

comment created time in 2 days

push eventlcnr/rust

djugei

commit sha b4337ab8c387658b7012fa242e429f46c5f31141

added .collect() into String from Box<str> with fake feature/stability annotation

view details

Tomasz Miąsko

commit sha 291dce91b24d70382ebf1116fa836fd91960de84

Fallback to xml.etree.ElementTree The xml.etree.cElementTree has been deprecated since Python 3.3 and removed in Python 3.9 https://bugs.python.org/issue36543.

view details

mark

commit sha 3f6928f1f6eff367e6ddbfb63ebc5e568ffe0eb1

move contributing.md to rustc-dev-guide and point at getting started

view details

David Hewitt

commit sha 6b95f3102d657a5cd0549213a073b28c7e0fe609

Add `format_args_capture` feature

view details

Simonas Kazlauskas

commit sha df88972f8ce9ddbebec6d551810f7127fe25d2a3

Update psm version This new version includes a fix for building on aarch64 windows.

view details

Ivan Tham

commit sha f772587aba7b2be9a2fa708a26ba2605e32148ff

Add unstable docs for rustc_attrs

view details

Vadim Petrochenkov

commit sha 79a42e37084d0fc584c9f312c2a355104a113889

linker: Create GNU_EH_FRAME header by default when producing ELFs

view details

Ivan Tham

commit sha 725918f17e9a2c1e8a0ffec658d1363681f768bd

Update src/doc/unstable-book/src/language-features/rustc-attrs.md Co-authored-by: Ralf Jung <post@ralfj.de>

view details

David Hewitt

commit sha 8caf60407033e84592821a3f7b3917fe80d343e0

Improve messaging from PR feedback

view details

Vadim Petrochenkov

commit sha 7055c23d2cb3baabbae6af7ab196e43035260856

ast_pretty: Pass some token streams and trees by reference

view details

David Hewitt

commit sha a1217cb29de22aae3cda717e78d1edd3e9d8ffd1

Add `format_args_capture` to the unstable book

view details

Ivan Tham

commit sha 0e6f1093be08949b6ac4ba3d92ad4e97d0137dc5

Add preamable on rustc-attrs doc discussion

view details

CAD97

commit sha db539c649866d9a25cb18a741436b3086b5d6e04

Use raw_ref_op in A|Rc::as_ptr

view details

CAD97

commit sha e4bdf47f4c0773bba93f50900612242b929eca0b

Do not require ptr validity in rc::data_offset

view details

CAD97

commit sha d8a9c61e1a23b73c04d3058a11d1b8b2a46d635e

Use impl for Weak::as_ptr that works for unsized T

view details

pierwill

commit sha 49662726afdd6f4538bada73db771b939d92bd22

Add newline to rustc MultiSpan docs Also adds back-ticks when referring to the contents of this collection.

view details

Ivan Tham

commit sha 49b4804d291bc8cc93e7b4b8c24f344aa3e3f484

Ignore example compile in rustc-attrs doc

view details

Rich Kadel

commit sha 5239a68e72d1a0c7cba2cfd219a7da911360fbb7

add spans to injected coverage counters added regions with counter expressions and counters. Added codegen_llvm/coverageinfo mod for upcoming coverage map Move coverage region collection to CodegenCx finalization Moved from `query coverageinfo` (renamed from `query coverage_data`), as discussed in the PR at: https://github.com/rust-lang/rust/pull/73684#issuecomment-649882503 Address merge conflict in MIR instrument_coverage test The MIR test output format changed for int types. moved debug messages out of block.rs This makes the block.rs calls to add coverage mapping data to the CodegenCx much more concise and readable. move coverage intrinsic handling into llvm impl I realized that having half of the coverage intrinsic handling in `rustc_codegen_ssa` and half in `rustc_codegen_llvm` meant that any non-llvm backend would be bound to the same decisions about how the coverage-related MIR terminators should be handled. To fix this, I moved the non-codegen portion of coverage intrinsic handling into its own trait, and implemented it in `rustc_codegen_llvm` alongside `codegen_intrinsic_call`. I also added the (required?) stubs for the new intrinsics to `IntrepretCx::emulate_intrinsic()`, to ensure calls to this function do not fail if called with these new but known intrinsics. address PR Feedback on 28 June 2020 2:48pm PDT

view details

Dan Aloni

commit sha aab37fe52c0f142d116fee67d6eddedc7825dcc7

Add test for issue #56175

view details

Dan Aloni

commit sha 5427d3bf7c38df0c37597272bf34c6710cab3c52

Fix try_print_visible_def_path for Rust 2018 The recursive check of `try_print_visible_def_path` did not properly handle the Rust 2018 case of crate-paths without 'extern crate'. Instead, it returned a "not found" via (false, self). This fixes issue #56175.

view details

push time in 2 days

delete branch lcnr/rust

delete branch : lazy_normalisation_consts

delete time in 2 days

delete branch lcnr/rust

delete branch : ConstCx-local-def-id

delete time in 2 days

delete branch lcnr/rust

delete branch : expected_found

delete time in 2 days

PR closed rust-lang/rust

shrink TypeError by 8 bytes

Let's see if this has an influence on perf

r? @ghost

+18 -23

7 comments

3 changed files

lcnr

pr closed time in 2 days

pull request commentrust-lang/rust

shrink TypeError by 8 bytes

Isn't really relevant :shrug: I personally think the current state is better in this case

lcnr

comment created time in 2 days

PR closed rust-lang/rust

Support const args in type dependent paths F-const_generics S-waiting-on-review
#![feature(const_generics)]

struct A;
impl A {
    fn foo<const N: usize>(&self) -> usize { N }
}
struct B;
impl B {
    fn foo<const N: usize>(&self) -> usize { 42 }
}

fn main() {
    let a = A;
    a.foo::<7>();
}

When calling type_of for generic const arguments, we now use the TypeckTables of the surrounding body to get the expected type.

This alone causes cycle errors though, as we now have typeck_tables_of(main) -> ... -> type_of(main_ANON0 := 7) -> typeck_tables_of(main) :zap: (see https://github.com/rust-lang/rust/issues/68400#issuecomment-611760290)

To prevent this we must not call type_of(const_arg) during typeck_tables_of. This is achieved by calling type_of(param_def_id) instead. As this DefId can't always be easily known, I changed some DefIds to ty::WithOptParam<DefId> which contains the relevant param id. This also changes some queries which may be called during typeck.

To prevent us from computing these queries twice, WithOptParam must always use the correct DefId of the parameter. This means that it is either constructed using the new method tcx.with_opt_param(def_id) or manually if and only if a param DefId is available.

To simplify WithOptParam creation, I changed IntoQueryParam from private to pub(crate). I only use the existing definition of LocalDefId -> DefId.

const_param_of requires the HIR, meaning that it can only return the correct parameter DefId while compiling the crate containing the const argument.

To fix this, const_param_of is called for all const arguments during analysis. (I currently use par_body_owner here, as all const arguments should be a body afaik)

This PR may have missed some type_of(const_arg) during typeck. While this is unfortunate, these cases should only introduce cycle errors and not lead to miscompilations. We should not have to worry about these cases while merging this IMO.

r? @varkor fixes #70507, fixes #69816, fixes #63695, fixes #61936, fixes #71516

+1179 -505

91 comments

105 changed files

lcnr

pr closed time in 3 days

pull request commentrust-lang/rust

Support const args in type dependent paths

Will open a new PR in the next few weeks as I have to rewrite most of this anyways

lcnr

comment created time in 3 days

pull request commentrust-lang/rust

Remove trait LengthAtMost32

One thing which concerns me is Default for arrays, which afaik we can't implement using const generics rn as the current Default impl does not have a T: Default bound for N == 0.

So I fear that we will end up with Default being the only trait which is not implemented for all arrays.

kpp

comment created time in 3 days

pull request commentrust-lang/rust

remove LengthAtMost32 on AsRef/Borrow impl for array

One thing which concerns me is Default for arrays, which afaik we can't implement using const generics rn as the current Default impl does not have a T: Default bound for N == 0.

So I kind of fear that we will end up with Default being the only trait which is not implemented for all arrays.

burrbull

comment created time in 3 days

issue commentrust-lang/rust

Strange span in borrow error in nested match.

Without using any methods:

fn main() {
    let _arg = match Some(()) {
        Some(arg) => {
            match Some(&arg) {
                Some(s) => s,
                None => return,
            }
        }
        None => return,
    };
}

results in

error[E0597]: `arg` does not live long enough
  --> src/main.rs:6:24
   |
4  |     let _arg = match Some(()) {
   |         ---- borrow later stored here
5  |         Some(arg) => {
6  |             match Some(&arg) {
   |                        ^^^^ borrowed value does not live long enough
...
11 |         None => return,
   |            - `arg` dropped here while still borrowed
ehuss

comment created time in 3 days

issue commentrust-lang/rust

ICE on improperly implemented TryFrom

Thanks! Further minimized:

use std::convert::{TryFrom, TryInto};
use std::io;

pub struct MyStream;
pub struct OtherStream;

pub async fn connect() -> io::Result<MyStream> {
    let stream: MyStream = OtherStream.try_into()?;
    Ok(stream)
}

impl TryFrom<OtherStream> for MyStream {}

sbosnick

comment created time in 3 days

pull request commentrust-lang/rust

shrink TypeError by 8 bytes

@bors try @rust-timer queue

lcnr

comment created time in 3 days

PR opened rust-lang/rust

shrink TypeError by 8 bytes

Let's see if this has an influence on perf

r? @ghost

+18 -23

0 comment

3 changed files

pr created time in 3 days

create barnchlcnr/rust

branch : shrink-TypeError

created branch time in 3 days

PR opened rust-lang/rust

expected found `&T` -> `T`
+30 -35

0 comment

2 changed files

pr created time in 3 days

create barnchlcnr/rust

branch : expected_found

created branch time in 3 days

delete branch lcnr/rust

delete branch : stacky-mc-stack-stack

delete time in 3 days

issue commentrust-lang/rust

No warning on assigning to field of const that doesn't succeed

I am not completely sure if this behavior is intended. But even if this is not a bug, we should still at least warn here.

Inline snippet

struct Foo {
    val: i32,
}

const FOO: Foo = Foo { val: 100 };

const fn bar() -> i32 {
    FOO.val = -100;
    FOO.val
}

fn main() {
    println!("{}", FOO.val);
    println!("{}", bar());
}
CraftSpider

comment created time in 3 days

Pull request review commentrust-lang/rust

implement the occurs check for const vars

 fn float_unification_error<'tcx>(     let (ty::FloatVarValue(a), ty::FloatVarValue(b)) = v;     TypeError::FloatMismatch(ty::relate::expected_found_bool(a_is_expected, &a, &b)) }++struct ConstOccursChecker<'cx, 'tcx> {+    infcx: &'cx InferCtxt<'cx, 'tcx>,++    /// The vid of the const variable that is in the process of being+    /// instantiated; if we find this within the const we are folding,+    /// that means we would have created a cyclic const.+    target_vid: ty::ConstVid<'tcx>,++    cycle: bool,+}++impl<'cx, 'tcx> ConstOccursChecker<'cx, 'tcx> {+    fn check(mut self, t: &'tcx ty::Const<'tcx>) -> RelateResult<'tcx, ()> {+        self.visit_const(t);+        if self.cycle { Err(TypeError::CyclicConst(t)) } else { Ok(()) }+    }+}++impl TypeVisitor<'tcx> for ConstOccursChecker<'_, 'tcx> {+    fn visit_ty(&mut self, t: Ty<'tcx>) -> bool {+        debug!("ConstOccursChecker: t={:?}", t);++        match t.kind {+            ty::Infer(ty::TyVar(vid)) => {+                let vid = self.infcx.inner.borrow_mut().type_variables().root_var(vid);+                let probe = self.infcx.inner.borrow_mut().type_variables().probe(vid);+                match probe {+                    TypeVariableValue::Known { value: u } => {+                        debug!("ConstOccursChecker: known value {:?}", u);+                        self.visit_ty(u)+                    }+                    TypeVariableValue::Unknown { universe: _ } => {+                        // FIXME: We may have to do something similar to what+                        // `Generalizer` is doing here.+                        false

I am not too familiar with what has to be done with UniverseIndex here, when instantiating type inference variables, we sometimes adjust them, which we might also have to do for consts

https://github.com/rust-lang/rust/blob/0cd7ff7ddfb75a38dca81ad3e76b1e984129e939/src/librustc_infer/infer/combine.rs#L660-L668

and

https://github.com/rust-lang/rust/blob/0cd7ff7ddfb75a38dca81ad3e76b1e984129e939/src/librustc_infer/infer/combine.rs#L558-L587

lcnr

comment created time in 3 days

push eventlcnr/rust

Bastian Kauschke

commit sha 0275ec089d5108ef73015ed9b1f856d54882df2e

implement the occurs check for const vars

view details

push time in 3 days

PR closed rust-lang/rust

Check substs of ConstKind::Unevaluated in generalize A-const-generics A-inference A-lazy-normalization F-const_generics S-waiting-on-review

This prevents the stack overflow mentioned in https://github.com/rust-lang/rust/issues/72129#issuecomment-627181925.

While I think this change makes sense, I am not completely certain and there may be a better solution I am missing.

The stack overflow was caused by unifying a type inference variable with an unevaluated const which had exactly this inference variable in it's substitutions. Meaning something has probably already gone wrong when reaching this.

i.e: we previously ended up with

TyVar(_#1t) := [
    ();
    Const { ty: usize, val: Unevaluated(DefId(0:7 ~ issue_69654_run_pass[317d]::{{impl}}[0]::{{constant}}[0]), [TyVar(_#1t)], None) }
]

in the TypeVariableTable.

r? @nikomatsakis @varkor

+201 -9

4 comments

11 changed files

lcnr

pr closed time in 3 days

pull request commentrust-lang/rust

Check substs of ConstKind::Unevaluated in generalize

an actual fix is in #74040

lcnr

comment created time in 3 days

PR opened rust-lang/rust

implement the occurs check for const vars

r? @nikomatsakis @varkor @eddyb let's just ping everyone here :sweat_smile:

+239 -4

0 comment

12 changed files

pr created time in 3 days

push eventlcnr/rust

Bastian Kauschke

commit sha c161bc5fbbbbe9cb42734ffd542c5c8d9432bca0

implement the occurs check for const vars

view details

push time in 3 days

create barnchlcnr/rust

branch : const-occurs-check

created branch time in 3 days

pull request commentrust-lang/rust

Convert more `DefId`s to `LocalDefId`s

@bors r=varkor

lcnr

comment created time in 4 days

push eventlcnr/rust

Bastian Kauschke

commit sha 6d55dfaf6f98d7519db6516c242082cfd8d8f77b

fix rebase

view details

push time in 4 days

push eventlcnr/rust

Chris Denton

commit sha 912963bd0856239828253af8d04e4f62e75cafd7

Remove legacy InnoSetup GUI installer On Windows the InnoSetup installer was superseded by the MSI installer. It's no longer needed.

view details

Eduardo Sánchez Muñoz

commit sha f03cf9916a1932f47b788a9de9256269cc172fe9

Add a fast path for `std::thread::panicking`. This is done by adding a global atomic variable (non-TLS) that counts how many threads are panicking. In order to check if the current thread is panicking, this variable is read and, if it is zero, no thread (including the one where `panicking` is being called) is panicking and `panicking` can return `false` immediately without needing to access TLS. If the global counter is not zero, the local counter is accessed from TLS to check if the current thread is panicking.

view details

Tomasz Miąsko

commit sha e4b7d2c5071d1066159702d8176c6d87d843403e

Omit DW_AT_linkage_name when it is the same as DW_AT_name The DWARF standard suggests that it might be useful to include `DW_AT_linkage_name` when it is *distinct* from the identifier name.

view details

Nathan West

commit sha 358dc1d8c2e10eceaf3c04d532bbde73b0dd4bb7

Added io forwarding methods to the stdio structs

view details

Alexis Bourget

commit sha 2031e99d772091854d716df5bdf227f8be9b6397

Added implementations for TryFrom<{int}> for NonZero{int}

view details

Alexis Bourget

commit sha d8b51f180a9c6ced4397ce5568fa8ab553a7143e

Added tests for the implementations

view details

Guillaume Gomez

commit sha b97487bad8608afe05f34f07016aa6276c1a291d

Add check for doc alias attribute format

view details

Guillaume Gomez

commit sha 2d6267a7a8ae0399f2d363b6ac667fee0b53a1a0

Add test for doc alias attribute validation

view details

Vadim Petrochenkov

commit sha 69b2179afe695d1a93b792cfd7c4197ca63ce658

Print accessed env vars as special comments into depinfo files

view details

TrolledWoods

commit sha 0c5c644c91edf6ed949cfa5ffc524f43369df604

Mention that BTreeMap::new() doesn't allocate I think it would be nice to mention this, so you don't have to dig through the src to look at the definition of new().

view details

Carol (Nichols || Goulding)

commit sha e85df08bdec792f512c1f92dbdb126c49ac57d0c

Don't move cursor in search box when using arrows to navigate search results

view details

Yoshua Wuyts

commit sha 8bc6b5b45c9f9710852e2b9c57eb3d44d08ad245

stabilize leading_trailing_ones

view details

Alexis Bourget

commit sha 0dcb392e9889ab6976973a2f7140d18a80178202

Added implementations for NonZero(U|I)size

view details

Alexis Bourget

commit sha 2b8e2f836f59db23630a06554b8e1a33f6c502f5

Correctly format the tests and import TryFrom

view details

Alexis Bourget

commit sha 6c8d8d6a6055d19dc33cc8b33b082d17583a0e47

Fix test call for error case

view details

Tomasz Miąsko

commit sha 291dce91b24d70382ebf1116fa836fd91960de84

Fallback to xml.etree.ElementTree The xml.etree.cElementTree has been deprecated since Python 3.3 and removed in Python 3.9 https://bugs.python.org/issue36543.

view details

Devin R

commit sha a4b8bb88f210de7fa2d82fe64b48331126eb7462

warn on macro_use attr cargo dev update lints use if_chain clean up alot, span_lint_and_sugg find imported macros for sugg

view details

Devin R

commit sha ede366be637657280ca506c5bad0f41f96c47340

collected all the imports and names how to compare macro to import path add more imports to test

view details

Devin R

commit sha 8ffbf6f94d9cc77ade0596ee104f3549b8db452d

use hashset not map for keeping track of seen macro refs remove stdout, fix clippy warnings, fmtcar

view details

Devin R

commit sha 1d9e80ad7b5b69caa8b9f9c44d47f26c4bbc4c7b

remove session

view details

push time in 4 days

push eventlcnr/rust

Bastian Kauschke

commit sha f5305c3d16fb8221463ef604a1ea5ac11506ba6d

nit Co-authored-by: varkor <github@varkor.com>

view details

push time in 4 days

PR opened rust-lang/rust

Convert more `DefId`s to `LocalDefId`s
+40 -49

0 comment

11 changed files

pr created time in 4 days

create barnchlcnr/rust

branch : ConstCx-local-def-id

created branch time in 4 days

issue openedrust-lang/rustfmt

internal error when trying to format a range of closures

rustfmt 1.4.18-nightly (2020-06-13 c1e9b7b) fails to format the following code with

error[internal]: left behind trailing whitespace
 --> /playground/src/main.rs:9:9:9
  |
9 |         } 
  |          ^
  |

warning: rustfmt has failed to format. See previous 1 errors.

code:

fn main() {
    let requires_multiline = 7;

    let _ = {
        || if true {
            requires_multiline
        } else {
            requires_multiline
        } 
        ..19;
    };
}

Note the whitespace after the else block.

playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=8a81daef86da5d4971114ecfc6b5d43d

created time in 4 days

pull request commentrust-lang/rust

add `lazy_normalization_consts` feature gate

@bors r=varkor

I forgot to incorporate the comment fix in my rebase :sweat_smile:

lcnr

comment created time in 4 days

push eventlcnr/rust

Bastian Kauschke

commit sha 7a3081baaf81c1d924f3143479ec0c4a8f1e62b7

add `lazy_normalization_consts` feature gate

view details

push time in 4 days

pull request commentrust-lang/rust

add `lazy_normalization_consts` feature gate

@bors r-

lcnr

comment created time in 4 days

pull request commentrust-lang/rust

add `lazy_normalization_consts` feature gate

@bors r=varkor

lcnr

comment created time in 4 days

push eventlcnr/rust

Tomasz Miąsko

commit sha 291dce91b24d70382ebf1116fa836fd91960de84

Fallback to xml.etree.ElementTree The xml.etree.cElementTree has been deprecated since Python 3.3 and removed in Python 3.9 https://bugs.python.org/issue36543.

view details

mark

commit sha 3f6928f1f6eff367e6ddbfb63ebc5e568ffe0eb1

move contributing.md to rustc-dev-guide and point at getting started

view details

David Hewitt

commit sha 6b95f3102d657a5cd0549213a073b28c7e0fe609

Add `format_args_capture` feature

view details

Simonas Kazlauskas

commit sha df88972f8ce9ddbebec6d551810f7127fe25d2a3

Update psm version This new version includes a fix for building on aarch64 windows.

view details

Vadim Petrochenkov

commit sha 79a42e37084d0fc584c9f312c2a355104a113889

linker: Create GNU_EH_FRAME header by default when producing ELFs

view details

David Hewitt

commit sha 8caf60407033e84592821a3f7b3917fe80d343e0

Improve messaging from PR feedback

view details

Vadim Petrochenkov

commit sha 7055c23d2cb3baabbae6af7ab196e43035260856

ast_pretty: Pass some token streams and trees by reference

view details

David Hewitt

commit sha a1217cb29de22aae3cda717e78d1edd3e9d8ffd1

Add `format_args_capture` to the unstable book

view details

CAD97

commit sha db539c649866d9a25cb18a741436b3086b5d6e04

Use raw_ref_op in A|Rc::as_ptr

view details

CAD97

commit sha e4bdf47f4c0773bba93f50900612242b929eca0b

Do not require ptr validity in rc::data_offset

view details

CAD97

commit sha d8a9c61e1a23b73c04d3058a11d1b8b2a46d635e

Use impl for Weak::as_ptr that works for unsized T

view details

pierwill

commit sha 49662726afdd6f4538bada73db771b939d92bd22

Add newline to rustc MultiSpan docs Also adds back-ticks when referring to the contents of this collection.

view details

Rich Kadel

commit sha 5239a68e72d1a0c7cba2cfd219a7da911360fbb7

add spans to injected coverage counters added regions with counter expressions and counters. Added codegen_llvm/coverageinfo mod for upcoming coverage map Move coverage region collection to CodegenCx finalization Moved from `query coverageinfo` (renamed from `query coverage_data`), as discussed in the PR at: https://github.com/rust-lang/rust/pull/73684#issuecomment-649882503 Address merge conflict in MIR instrument_coverage test The MIR test output format changed for int types. moved debug messages out of block.rs This makes the block.rs calls to add coverage mapping data to the CodegenCx much more concise and readable. move coverage intrinsic handling into llvm impl I realized that having half of the coverage intrinsic handling in `rustc_codegen_ssa` and half in `rustc_codegen_llvm` meant that any non-llvm backend would be bound to the same decisions about how the coverage-related MIR terminators should be handled. To fix this, I moved the non-codegen portion of coverage intrinsic handling into its own trait, and implemented it in `rustc_codegen_llvm` alongside `codegen_intrinsic_call`. I also added the (required?) stubs for the new intrinsics to `IntrepretCx::emulate_intrinsic()`, to ensure calls to this function do not fail if called with these new but known intrinsics. address PR Feedback on 28 June 2020 2:48pm PDT

view details

Nicholas Nethercote

commit sha 3f79d2f33e8b69812c9b981ff4adea0a1e7b9cb8

Avoid `unwrap_or_else` in `RawVec::allocate_in`. This reduces the amount of LLVM IR generated by up to 1 or 2%.

view details

Eric Huss

commit sha 915486364759689dce6932d67599d5ea234cd91a

Compile rustdoc less often.

view details

Pietro Albini

commit sha 844dc31494ad130169477c57c9ba10acd5e8923f

ci: fix wasm32 broken due to a NodeJS version bump Emscripten's SDK recently bumped the version of NodeJS they shipped, but our Dockerfile for the wasm32 builder hardcoded the version number. This will cause consistent CI failures once the currently cached image is rebuilt (either due to a change or due to the cache expiring). This commit fixes the problem by finding the latest version of NodeJS in the Emscripten SDK and symlinking it to a "latest" directory, which is then added to the PATH.

view details

LeSeulArtichaut

commit sha 8ee1dec77b89d6341a147d91af8733f8e0b5efc7

Deny unsafe ops in unsafe fns, part 1

view details

LeSeulArtichaut

commit sha 8a515e963cf2711192495802d7bbf2e49979cdf2

Deny unsafe ops in unsafe fns, part 2

view details

LeSeulArtichaut

commit sha ac7539c6d1036e42e84d388a57a656c420cb9eee

Deny unsafe ops in unsafe fns, part 3

view details

LeSeulArtichaut

commit sha c68f478131a94f5a69d91db1af35cb506f673ec2

Deny unsafe ops in unsafe fns, part 4

view details

push time in 4 days

delete branch rust-lang/rust

delete branch : lcnr-patch-1

delete time in 4 days

push eventlcnr/rust

Bastian Kauschke

commit sha 6b147d4574c90a28c2c5b5022b3a738fc75fb6d2

const_eval_resolve

view details

Bastian Kauschke

commit sha cff29ea27c6d19815de686c125fe8297c24fe842

typeck all the tables

view details

Bastian Kauschke

commit sha 6a64a66bc9d2f7f4b26e206a5de2daf183e8c4c9

InstanceDef::Item

view details

Bastian Kauschke

commit sha 32945b5dfe469faefe29e5357d2276a07738c7de

optimized_mir

view details

Bastian Kauschke

commit sha cf3fc4116546d1e50bed5f058709ecb4140c9911

continue mir pipeline

view details

push time in 4 days

pull request commentrust-lang/rust

add `lazy_normalization_consts` feature gate

@bors r=varkor

lcnr

comment created time in 4 days

push eventlcnr/rust

Bastian Kauschke

commit sha a9f129f18f4d4a998a38d5d9d06165991ef45848

fix wording Co-authored-by: varkor <github@varkor.com>

view details

push time in 4 days

Pull request review commentrust-lang/rust

Eliminate `ObligationCauseData`.

 impl<'tcx> TraitObligationExt<'tcx> for TraitObligation<'tcx> {         // by using -Z verbose or just a CLI argument.         let derived_cause = DerivedObligationCause {             parent_trait_ref: obligation.predicate.to_poly_trait_ref(),-            parent_code: Rc::new(obligation.cause.code.clone()),+            parent_code: Rc::new(obligation.cause.code().clone()),

in general, all occurences of parent_code currently reallocate

nnethercote

comment created time in 4 days

Pull request review commentrust-lang/rust

Eliminate `ObligationCauseData`.

 impl<'tcx> TraitObligationExt<'tcx> for TraitObligation<'tcx> {         // by using -Z verbose or just a CLI argument.         let derived_cause = DerivedObligationCause {             parent_trait_ref: obligation.predicate.to_poly_trait_ref(),-            parent_code: Rc::new(obligation.cause.code.clone()),+            parent_code: Rc::new(obligation.cause.code().clone()),
            parent_code: obligation.cause.code(),

And also change parent_code to Option<Rc<ObligationCauseCode>>

nnethercote

comment created time in 4 days

push eventlcnr/rust

Bastian Kauschke

commit sha a12789d680433963aa539585982bc7319759fa3a

const_eval_resolve

view details

Bastian Kauschke

commit sha 80c281cac8a1b3a15dcb78e0bb11a11f9da6aa51

typeck all the tables

view details

Bastian Kauschke

commit sha aac4c77721b5bf2c529a8b932ff161710fd85907

InstanceDef::Item

view details

push time in 4 days

push eventlcnr/rust

Bastian Kauschke

commit sha dfbdac0207cb1225feb41f348eb3380181c7eefc

add `lazy_normalization_consts` feature gate

view details

push time in 4 days

push eventlcnr/rust

Bastian Kauschke

commit sha e8072b68bcd642c652ed64178f64cb0e4616f8a7

add `lazy_normalization_consts` feature gate

view details

push time in 4 days

PR opened rust-lang/rust

add `lazy_normalization_consts` feature gate

In #71973 I underestimated the amount of code which is influenced by lazy normalization of consts and decided against having a separate feature flag for this.

Looking a bit more into this, the following issues are already working with lazy norm in its current state #47814 #57739 #73980

I therefore think it is worth it to enable lazy norm separately. Note that #![feature(const_generics)] still automatically activates this feature, so using #![feature(const_generics, lazy_normalization_consts)] is redundant.

r? @varkor @nikomatsakis

+103 -1

0 comment

10 changed files

pr created time in 4 days

create barnchlcnr/rust

branch : lazy_normalisation_consts

created branch time in 4 days

issue commentrust-lang/rust

ICE when using associated constant as an array size when implementing trait for all types

This is blocked on lazy normalization of constants, see #72219 for more details.

liquidblock

comment created time in 4 days

issue commentrust-lang/rust

ICE when using associated constant in type

This is blocked on lazy normalization of constants, see #72219 for more details.

nbdd0121

comment created time in 4 days

issue commentrust-lang/rust

ICE using associated constant in generic type

Requires lazy normalization of constants, see #72219 for more details

Michael-F-Bryan

comment created time in 4 days

pull request commentrust-lang/rust

fix typo

Now that I am a contributor github creates these branches as part of rust-lang instead of on my fork :/

That's not good

lcnr

comment created time in 4 days

PR opened rust-lang/rust

fix typo

r? @Dylan-DPC

+1 -1

0 comment

1 changed file

pr created time in 5 days

create barnchrust-lang/rust

branch : lcnr-patch-1

created branch time in 5 days

issue commentrust-lang/rust

Handle generic associated constants in const qualification for structural match

@bjorn3 what exactly do you mean here? https://github.com/rust-lang/rust/blob/master/src/test/ui/consts/const_in_pattern/issue-73431.rs was the issue which first hit this problem.

#73431 is similar to this part of my code snippet:

    match 42 {
        // This should be accepted.
        A::<usize>::VALUE => (),
        _ => (),
    }
ecstatic-morse

comment created time in 5 days

pull request commentrust-lang/rust

Improve `assert_eq` message

@bors try @rust-timer queue

a1phyr

comment created time in 5 days

create barnchlcnr/rust

branch : type-dependent-consts-2

created branch time in 5 days

pull request commentrust-lang/rust

Check substs of ConstKind::Unevaluated in generalize

I want to actually run CI here, so we have the up to date test failures, so while this is still not ready, we now have CI

lcnr

comment created time in 5 days

pull request commentrust-lang/rust

Check substs of ConstKind::Unevaluated in generalize

I think I found the underlying problem causing the stack overflows, as this PR is currently not enough.

Afaict we need some kind of occurs check in https://github.com/rust-lang/rust/blob/8a6d4342be6a6acbade8e7ef65e73d27ee8c9144/src/librustc_infer/infer/combine.rs#L160-L166

We currently unify ConstKind::infer(InferConst::Var(_cvar)) with ConstKInd::Unevaluated(def, substs = [ConstKind::infer(InferConst::Var(_cvar))]) which looking at the substs in generalize is not enough (as we only generalize for type vars).

We probably need something similar to sub_root_var to correctly detect cycles.

Does this seem correct?

lcnr

comment created time in 5 days

push eventlcnr/rust

Bastian Kauschke

commit sha 831c0df868af2cb0c25507b8fdc9dd478d9b4f9b

add more tests

view details

push time in 5 days

push eventlcnr/rust

Bastian Kauschke

commit sha 14e1c151a19922472c8f718fb5060ade461d6d96

add more tests

view details

push time in 5 days

Pull request review commentrust-lang/rust

Check substs of ConstKind::Unevaluated in generalize

 impl TypeRelation<'tcx> for Generalizer<'_, 'tcx> {     ) -> RelateResult<'tcx, &'tcx ty::Const<'tcx>> {         assert_eq!(c, c2); // we are abusing TypeRelation here; both LHS and RHS ought to be == +        debug!("generalize: consts c={:?}", c);         match c.val {             ty::ConstKind::Infer(InferConst::Var(vid)) => {-                let mut inner = self.infcx.inner.borrow_mut();-                let variable_table = &mut inner.const_unification_table();-                let var_value = variable_table.probe_value(vid);+                let var_value =+                    self.infcx.inner.borrow_mut().const_unification_table().probe_value(vid);

Further minimized, we don't even need explicit const params (i.e. lazy norm would break stable code if it were always active)

#![feature(const_generics)]

// The goal is is to get an unevaluated const `ct` with a `Ty::Infer(TyVar(_#1t)` subst.
//
// If we are then able to infer `ty::Infer(TyVar(_#1t) := Ty<ct>`, we should be able
// to get a stack overflow.
fn bind<T>() -> (T, [u8; 6 + 1]) {
    todo!()
} 

fn main() {
    let (mut t, foo) = bind();
    // `t` is `ty::Infer(TyVar(_#1t))`,
    // `foo` contains `ty::Infer(TyVar(_#1t))` in it's substs
    t = foo; // ! MISSED OCCURS CHECK => STACKOVERFLOW !
}

lcnr

comment created time in 5 days

Pull request review commentrust-lang/rust

Check substs of ConstKind::Unevaluated in generalize

 impl TypeRelation<'tcx> for Generalizer<'_, 'tcx> {     ) -> RelateResult<'tcx, &'tcx ty::Const<'tcx>> {         assert_eq!(c, c2); // we are abusing TypeRelation here; both LHS and RHS ought to be == +        debug!("generalize: consts c={:?}", c);         match c.val {             ty::ConstKind::Infer(InferConst::Var(vid)) => {-                let mut inner = self.infcx.inner.borrow_mut();-                let variable_table = &mut inner.const_unification_table();-                let var_value = variable_table.probe_value(vid);+                let var_value =+                    self.infcx.inner.borrow_mut().const_unification_table().probe_value(vid);

And the same problem for ty vars

#![feature(const_generics)]

// The goal is is to get an unevaluated const `ct` with a `Ty::Infer(TyVar(_#1t)` subst.
//
// If we are then able to infer `ty::Infer(TyVar(_#1t) := Ty<ct>`, we should be able
// to get a stack overflow.

struct Foo<const N: usize>;

trait Bind<T> {
    fn bind() -> (T, Self);
}

// `N` has to be `ConstKind::Unevaluated`.
impl<T> Bind<T> for Foo<{ 6 + 1 }> {
    fn bind() -> (T, Self) {
        (panic!(), Foo)
    }
}

fn main() {
    let (mut t, foo) = Foo::bind();
    // `t` is `ty::Infer(TyVar(_#1t))`,
    // `foo` contains `ty::Infer(TyVar(_#1t))` in it's substs
    t = foo; // ! MISSED OCCURS CHECK => STACKOVERFLOW !
}
lcnr

comment created time in 5 days

Pull request review commentrust-lang/rust

Check substs of ConstKind::Unevaluated in generalize

 impl TypeRelation<'tcx> for Generalizer<'_, 'tcx> {     ) -> RelateResult<'tcx, &'tcx ty::Const<'tcx>> {         assert_eq!(c, c2); // we are abusing TypeRelation here; both LHS and RHS ought to be == +        debug!("generalize: consts c={:?}", c);         match c.val {             ty::ConstKind::Infer(InferConst::Var(vid)) => {-                let mut inner = self.infcx.inner.borrow_mut();-                let variable_table = &mut inner.const_unification_table();-                let var_value = variable_table.probe_value(vid);+                let var_value =+                    self.infcx.inner.borrow_mut().const_unification_table().probe_value(vid);

I don't quite get why subtyping is relevant here :thinking:

Currently looking into getting a potentially more helpful example, the minimized const generics example is

#![feature(const_generics)]
trait Bar<const M: usize> {}
impl<const N: usize> Bar<N> for A<{ 6 + 1 }> {}

struct A<const N: usize>
where
    A<N>: Bar<N>;

fn main() {
    let _ = A;
}
lcnr

comment created time in 5 days

Pull request review commentrust-lang/rust

correctly dedup `ExistentialPredicate`s

 impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {             )

Okay, so I've rebased this rn, I think the current state is sound, if somewhat :ghost: spooky :ghost: Not sure what's the least invasive way to clean this up though...

lcnr

comment created time in 5 days

push eventlcnr/rust

Chris Denton

commit sha 912963bd0856239828253af8d04e4f62e75cafd7

Remove legacy InnoSetup GUI installer On Windows the InnoSetup installer was superseded by the MSI installer. It's no longer needed.

view details

Nathan West

commit sha 358dc1d8c2e10eceaf3c04d532bbde73b0dd4bb7

Added io forwarding methods to the stdio structs

view details

Yoshua Wuyts

commit sha 8bc6b5b45c9f9710852e2b9c57eb3d44d08ad245

stabilize leading_trailing_ones

view details

Alexis Bourget

commit sha 93cbad6ed5f6a40bdd1e8cee6a9b1a39f17ab166

Add documentation to point to `!is_dir` instead of `is_file`

view details

Alexis Bourget

commit sha ec63f9d99b4faec04db0f924c24be9529f4febed

Added the note to Metadata too

view details

Alexis Bourget

commit sha c1243dbcd96f43d013e38f01efe91eb35b81fa18

Make a note about is_dir vs is_file in Path too

view details

Caleb Zulawski

commit sha 144206e6d8c1ab4ffdbaf6d7b0f5a4201c0f2da4

Don't implement Fn* traits for #[target_feature] functions

view details

Caleb Zulawski

commit sha c98b4c8fdde7812d7af5a060a1e22fd7e3775d3f

Add error note when trying fn as Fn trait

view details

pankajchaudhary5

commit sha 46bfc48272ba5312c439557e2901e1a4778e9487

Added proper explanation of ErrorCode-E0687

view details

Nathan West

commit sha b60cefee0addb02b5bd146893d358bb52bc829e2

Removed write_fmt forwarding, to fix recursive borrow issues

view details

Nathan West

commit sha 14d385bedeeec7fcb48f4c9bb881b1cdae011da0

Restore some write_fmts

view details

Matthias Krüger

commit sha 1d0378c454de72ddcfc08bcc105744923ef2d4d4

impl From<char> for String This allows us to write fn char_to_string() -> String { 'a'.into() } which was not possible before.

view details

Tomasz Miąsko

commit sha 5c20ef433b48fce78c07208710bcc8b53965eeb1

bootstrap: Configurable musl libdir Make it possible to customize the location of musl libdir using musl-libdir in config.toml, e.g., to use lib64 instead of lib.

view details

Matthias Krüger

commit sha 2cde4932c7e8bd6000378af41029299ccf6eea69

add test for char into string

view details

VillSnow

commit sha 4c8ce48a15c88715955e56c9c35959d9dffad5ec

Add partition_point

view details

VillSnow

commit sha c9b49157057a83a97801f9e726ed8051fb1d2231

fix: doc test

view details

Ralf Jung

commit sha 810f309ff30fe7a75917f9e5359074dc991b4590

MIR sanity check: validate types on assignment

view details

Ralf Jung

commit sha 50d7deac4de3bfde44a634ff4dabf3115f694c79

prepare visit_statement for checking more kinds of statements

view details

Ralf Jung

commit sha 93e3552d040edfa67cdedfe2fe4a44fe0c4ead59

also normalize constants when comparing types

view details

Ralf Jung

commit sha 9576e307a7b8ac0c812fac927d247761662e7d1a

also normalize_erasing_regions

view details

push time in 5 days

issue commentlcnr/rubot

A way to get current PV/evaluation of the position

Added some docs to detailed_select and published version 0.3.0.

I do think having good wasm support is a very good thing. I don't have too much time rn and am not too familiar with the current state of rust in this area though. So while I will very gladly review changes/give feedback, I won't work on this myself, at least not in the near future.

sphynx

comment created time in 5 days

created taglcnr/rubot

tagv0.3.0

A rust library for easily usable game bots.

created time in 5 days

release lcnr/rubot

v0.3.0

released time in 5 days

more