profile
viewpoint

rust-lang/nomicon 489

The Dark Arts of Advanced and Unsafe Rust Programming

rust-lang/reference 330

The Rust Reference

matthewjasper/book 0

The Rust Programming Language

matthewjasper/cargo 0

The Rust package manager

matthewjasper/chalk 0

A PROLOG-ish interpreter written in Rust, intended eventually for use in the compiler

matthewjasper/compiler-explorer 0

Run compilers interactively from your web browser and interact with the assembly

matthewjasper/intellij-rust 0

Rust plugin for the IntelliJ Platform: https://intellij-rust.github.io/

matthewjasper/miri 0

An interpreter for Rust's mid-level intermediate representation

matthewjasper/nomicon 0

The Dark Arts of Advanced and Unsafe Rust Programming

matthewjasper/reference 0

The Rust Reference

issue commentrust-lang/rust

`rustfmt` no longer builds after rust-lang/rust#77306

.\x.py build .\src\tools\rustfmt\ with debug-assertions = true set in config.toml

rust-highfive

comment created time in 3 hours

pull request commentrust-lang/rust

[WIP] Refactor `Binder` to track bound vars

@bors try @rust-timer queue

jackh726

comment created time in 17 hours

issue commentrust-lang/rust

`rustfmt` no longer builds after rust-lang/rust#77306

 thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `Binder(<smallvec::SmallVec<[u8; _]> as std::ops::Index<std::ops::RangeFull>>)`,
 right: `Binder(<smallvec::SmallVec<[u8; 36]> as std::ops::Index<std::ops::RangeFull>>)`', compiler/rustc_trait_selection/src/traits/codegen/mod.rs:30:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

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

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.49.0-nightly (4d247ad7d 2020-10-18) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z macro-backtrace -Z binary-dep-depinfo -C opt-level=3 -C embed-bitcode=no -C debuginfo=0 -C debug-assertions=on -C overflow-checks=off -C link-args=-Wl,-rpath,$ORIGIN/../lib --crate-type lib

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

query stack during panic:
#0 [codegen_fulfill_obligation] checking if `std::ops::Index` fulfills its obligations
#1 [resolve_instance] resolving instance `<smallvec::SmallVec<[u8; _]> as std::ops::Index<std::ops::RangeFull>>::index`
end of query stack
[RUSTC-TIMING] rustc_ap_rustc_data_structures test:false 1.603
error: could not compile **`rustc-ap-rustc_data_structures`**
rust-highfive

comment created time in 21 hours

Pull request review commentrust-lang/rust

Mark inout asm! operands as used in liveness pass

 impl<'a, 'tcx> Liveness<'a, 'tcx> {                             }                         }                         hir::InlineAsmOperand::InOut { expr, .. } => {-                            succ = self.write_place(expr, succ, ACC_READ | ACC_WRITE);+                            succ = self.write_place(expr, succ, ACC_READ | ACC_WRITE | ACC_USE);

I see. The original change is the only correct fix here then.

oliviacrain

comment created time in a day

PullRequestReviewEvent

Pull request review commentrust-lang/rust

Mark inout asm! operands as used in liveness pass

 impl<'a, 'tcx> Liveness<'a, 'tcx> {                             }                         }                         hir::InlineAsmOperand::InOut { expr, .. } => {-                            succ = self.write_place(expr, succ, ACC_READ | ACC_WRITE);+                            succ = self.write_place(expr, succ, ACC_READ | ACC_WRITE | ACC_USE);

acc looks like it's specifically not overwriting in the WRITE then READ & USED case.

oliviacrain

comment created time in a day

PullRequestReviewEvent

Pull request review commentrust-lang/rust

Mark inout asm! operands as used in liveness pass

 impl<'a, 'tcx> Liveness<'a, 'tcx> {                             }                         }                         hir::InlineAsmOperand::InOut { expr, .. } => {-                            succ = self.write_place(expr, succ, ACC_READ | ACC_WRITE);+                            succ = self.write_place(expr, succ, ACC_READ | ACC_WRITE | ACC_USE);

I think that I would prefer updating the match below.

oliviacrain

comment created time in 2 days

PullRequestReviewEvent

pull request commentrust-lang/rust

Fix trait solving ICEs

After trying to find other options here there doesn't seem to be a much better solution without a much larger change here (e.g. making rustc more like chalk). I think that I slightly prefer this change, which simplifies how winnowing works in exchange for evaluating normalization cycles to Recur instead of Unknown. The patch here is against the head of this PR.

@@ -521,12 +521,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
                             result
                         }
                         Ok(Ok(None)) => Ok(EvaluatedToAmbig),
-                        // EvaluatedToRecur might also be acceptable here, but use
-                        // Unknown for now because it means that we won't dismiss a
-                        // selection candidate solely because it has a projection
-                        // cycle. This is closest to the previous behavior of
-                        // immediately erroring.
-                        Ok(Err(project::InProgress)) => Ok(EvaluatedToUnknown),
+                        Ok(Err(project::InProgress)) => Ok(EvaluatedToRecur),
                         Err(_) => Ok(EvaluatedToErr),
                     }
                 }
@@ -1387,9 +1382,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
             | (ObjectCandidate(i), ObjectCandidate(j)) => {
                 // Arbitrarily pick the lower numbered candidate for backwards
                 // compatibility reasons. Don't let this affect inference.
-                other.evaluation.must_apply_modulo_regions()
-                    && !needs_infer
-                    && (i < j || !victim.evaluation.must_apply_modulo_regions())
+                i < j && !needs_infer
             }
             (ObjectCandidate(_), ProjectionCandidate(_))
             | (ProjectionCandidate(_), ObjectCandidate(_)) => {
matthewjasper

comment created time in 2 days

issue commentrust-lang/rust

#73905 regressed several tests around associated type defaults

They do, this was moved to a different test file because the error prevents further compilation

ishitatsuyuki

comment created time in 2 days

pull request commentrust-lang/rust

stabilize union with 'ManuallyDrop' fields and 'impl Drop for Union'

Yes @bors r+

RalfJung

comment created time in 3 days

issue commentrust-lang/rust

Associated type bounded on another associated type with a default fails

This compiles on nightly now

zacps

comment created time in 4 days

PR merged rust-lang/chalk

Handle cached answers correctly in any_future_answer

This is required for 1 + 2 to typeck correctly.

+31 -3

0 comment

2 changed files

matthewjasper

pr closed time in 5 days

push eventrust-lang/chalk

Matthew Jasper

commit sha 424a76cc9ff9d2930f4de32c31fa578ba8416e09

Handle cached answers correctly in `any_future_answer`

view details

matthewjasper

commit sha d7c75db36d4c08f283a8ead2160efe3e9542ea32

Merge pull request #626 from matthewjasper/slg-ambiguity Handle cached answers correctly in any_future_answer

view details

push time in 5 days

delete branch matthewjasper/chalk

delete branch : slg-ambiguity

delete time in 5 days

pull request commentrust-lang/rust

Add some regression tests

@bors r+

JohnTitor

comment created time in 5 days

push eventmatthewjasper/rust

Mateusz Mikuła

commit sha 0ad3da06843089c0bf10d6caa3fbbc72fa67787a

Enable ASLR for windows-gnu

view details

Tim Nielens

commit sha 390a13b06c79d4177b829097b06453e38188081f

needless-lifetime - fix nested elision site FPs

view details

Tim Nielens

commit sha a60e5de90c7370d4fb3e6561d3cb55495cda2e2a

needless-lifetime / nested elision sites / PR remarks

view details

Tim Nielens

commit sha c8e9e52303da6dff4bc5cc4db3021d608fca6c70

needless-lifetime / add test cases for nested elision sites

view details

Takayuki Nakata

commit sha 1778a1ec4615a42a8ba9497006b07859186c08a1

Restrict `same_item_push` to suppress false positives It emits a lint when the pushed item is a literal, a constant and an immutable binding that are initialized with those.

view details

Takayuki Nakata

commit sha 0117ea2b016133145f9e02e27421ac3672b42f57

Refactoring: use inner function

view details

Takayuki Nakata

commit sha b80576fba633e1fc214c9f6900d7ca3424bda6d0

Some refactoring

view details

Takayuki Nakata

commit sha 14faebe20ea82392f393c3ff5efaab7250e51989

Add some tests to `same_item_push` Add tests in which the variable is initialized with a match expression and function call

view details

Takayuki Nakata

commit sha 2972ad3ef661071531a61ec8999b668a6b734b74

Refactoring: tests in `same_item_push`

view details

Takayuki Nakata

commit sha 730ca457f580247667ed0cd5965bc08752ebc0b3

Address `items_after_statement`

view details

Dylan MacKenzie

commit sha 72b402ed38f0c71461038aef8a49a02e49280788

Add pass names to some common dataflow analyses

view details

Aaron Hill

commit sha cfe07cd42a92610219d6ffc1ae5eefef42f5254a

Use llvm::computeLTOCacheKey to determine post-ThinLTO CGU reuse During incremental ThinLTO compilation, we attempt to re-use the optimized (post-ThinLTO) bitcode file for a module if it is 'safe' to do so. Up until now, 'safe' has meant that the set of modules that our current modules imports from/exports to is unchanged from the previous compilation session. See PR #67020 and PR #71131 for more details. However, this turns out be insufficient to guarantee that it's safe to reuse the post-LTO module (i.e. that optimizing the pre-LTO module would produce the same result). When LLVM optimizes a module during ThinLTO, it may look at other information from the 'module index', such as whether a (non-imported!) global variable is used. If this information changes between compilation runs, we may end up re-using an optimized module that (for example) had dead-code elimination run on a function that is now used by another module. Fortunately, LLVM implements its own ThinLTO module cache, which is used when ThinLTO is performed by a linker plugin (e.g. when clang is used to compile a C proect). Using this cache directly would require extensive refactoring of our code - but fortunately for us, LLVM provides a function that does exactly what we need. The function `llvm::computeLTOCacheKey` is used to compute a SHA-1 hash from all data that might influence the result of ThinLTO on a module. In addition to the module imports/exports that we manually track, it also hashes information about global variables (e.g. their liveness) which might be used during optimization. By using this function, we shouldn't have to worry about new LLVM passes breaking our module re-use behavior. In LLVM, the output of this function forms part of the filename used to store the post-ThinLTO module. To keep our current filename structure intact, this PR just writes out the mapping 'CGU name -> Hash' to a file. To determine if a post-LTO module should be reused, we compare hashes from the previous session. This should unblock PR #75199 - by sheer chance, it seems to have hit this issue due to the particular CGU partitioning and optimization decisions that end up getting made.

view details

rail

commit sha 5e393c7747d081c45414060f81016e9ea3cb961f

Fix a FP in `explicit_counter_loop` Fix a false positive in `explicit_counter_loop` where the loop counter is used after incremented, adjust the test so that counters are incremented at the end of the loop and add the test for this false positive.

view details

Eduardo Broto

commit sha 3e294b22a43be349262405715cf4885296c284ba

Revert "or_fn_call: ignore nullary associated const fns" This reverts commit 7a66e6502dc3c7085b3f4078c01d4957d96175ed.

view details

Eduardo Broto

commit sha ce83d8d4d1b28e73888a616d3ffbf19c6a620588

Revert "Avoid or_fun_call for const_fn with no args" This reverts commit 5d66bd7bb3fd701d70ec11217e3f89fabe5cb0a7.

view details

Eduardo Broto

commit sha 9365660a2fc57210996df733efe468019c671b2f

unnecessary sort by: avoid dereferencing closure param

view details

flip1995

commit sha d1f9cad102b5686f2b827f3c62a02dfe419128a6

Merge commit 'e636b88aa180e8cab9e28802aac90adbc984234d' into clippyup

view details

bors

commit sha 019c0d5f7f90f959ff92684a04b0d766b22527a5

Auto merge of #6076 - rail-rain:fix_fp_explicit_counter_loop, r=matthiaskrgr Fix a FP in `explicit_counter_loop` Fixes #4677 and #6074 Fix a false positive in `explicit_counter_loop` where the loop counter is used after incremented, adjust the test so that counters are incremented at the end of the loop and add the test for this false positive. --- changelog: Fix a false positive in `explicit_counter_loop` where the loop counter is used after incremented

view details

bors

commit sha cc1998f7b3cc04c891f92c62a52c0c45fa4c145a

Auto merge of #6077 - ebroto:revert_or_fun_call_const, r=matthiaskrgr Revert: or_fun_call should lint calls to `const fn`s with no args The changes in #5889 and #5984 were done under the incorrect assumption that a `const fn` with no args was guaranteed to be evaluated at compile time. A `const fn` is only guaranteed to be evaluated at compile time if it's inside a const context (the initializer of a `const` or a `static`). See this [zulip conversation](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Common.20misconception.3A.20.60const.20fn.60.20and.20its.20effect.20on.20codegen/near/208059113) for more details on this common misconception. Given that none of the linted methods by `or_fun_call` can be called in const contexts, the lint should make no exceptions. changelog: [`or_fun_call`] lints again calls to `const fn` with no args

view details

Takayuki Nakata

commit sha 2892a2b0f578edd290b3be6f5e5c3280bc160f24

Fix FP in `print_stdout` This lint shouldn't be emitted in `build.rs` as `println!` and `print!` are used for the build script.

view details

push time in 6 days

pull request commentrust-lang/rust

Moved the main `impl` for FnCtxt to its own file.

@bors r+

Nicholas-Baron

comment created time in 6 days

Pull request review commentrust-lang/rust

[WIP] Add const qualifier in FnSig (for const fn pointers)

 impl<'a, 'tcx> FnCtxt<'a, 'tcx> {                     ]) => {                         // A reborrow has no effect before a dereference.                     }+                    (&[Adjustment { kind: Adjust::Pointer(PointerCast::ReifyFnPointer), .. }],+                     &[Adjustment { kind: Adjust::Pointer(PointerCast::NotConstFnPointer), .. }])  => { }

This arm should extend *entry.get_mut() with adj instead of letting it be overriden below.

filtsin

comment created time in 6 days

PullRequestReviewEvent

push eventmatthewjasper/chalk

Matthew Jasper

commit sha 424a76cc9ff9d2930f4de32c31fa578ba8416e09

Handle cached answers correctly in `any_future_answer`

view details

push time in 6 days

delete branch matthewjasper/rust

delete branch : instrument-trait-selection

delete time in 6 days

PR opened rust-lang/chalk

Handle cached answers correctly in any_future_answer

This is required for 1 + 2 to typeck correctly.

+29 -3

0 comment

2 changed files

pr created time in 7 days

create barnchmatthewjasper/chalk

branch : slg-ambiguity

created branch time in 7 days

issue commentrust-lang/rust

ice with -Zmir-opt-level=2 issue-50865-private-impl-trait/auxiliary/lib.rs

I think that this is a missing normalize call here: https://github.com/rust-lang/rust/blob/8cc82ee340ed96099680ec1165cf5e192d658d0f/compiler/rustc_mir/src/transform/inline.rs#L204

matthiaskrgr

comment created time in 8 days

pull request commentrust-lang/rust

Use tracing spans in rustc_trait_selection

@bors try @rust-timer queue

matthewjasper

comment created time in 8 days

push eventmatthewjasper/rust

Matthew Jasper

commit sha b8d2560dca40edf5584c8e23b81c3e89d19d68dc

Use tracing spans in rustc_trait_selection

view details

push time in 8 days

pull request commentrust-lang/rust

require `Reveal::All` in `normalize_erasing_regions`

It ICEs if an associated type projection isn't well-formed (i.e. the self type doesn't implement the trait that's expected), but doesn't if it does but can't be normalized.

lcnr

comment created time in 8 days

Pull request review commentrust-lang/chalk

Variance

 impl<'t, I: Interner> Unifier<'t, I> {         {

The above comment is not entirely correct with subtyping. It should be

for<'a...> T == for<'b...> U

if

for<'a...> exists<'b...> T :> U &&
for<'b...> exists<'a...> T <: U

and

for<'a...> T <: for<'b...> U

if

for<'b...> exists<'a...> T <: U

The code here should look like this

        if let Variance::Invariant | Variance::Contavariant = variance {
            let a_universal = self.table.instantiate_binders_universally(interner, a);
            let b_existential = self.table.instantiate_binders_existentially(interner, b);
            Zip::zip_with(self, Variance::Contavariant, &a_universal, &b_existential)?;
        }

        if let Variance::Invariant | Variance::Covariant = variance {
            let b_universal = self.table.instantiate_binders_universally(interner, b);
            let a_existential = self.table.instantiate_binders_existentially(interner, a);
            Zip::zip_with(self, Variance::Covariant, &a_existential, &b_universal)
        }
daboross

comment created time in 8 days

PullRequestReviewEvent

pull request commentrust-lang/rust

Use tracing spans in rustc_trait_selection

@bors try @rust-timer queue

matthewjasper

comment created time in 8 days

push eventmatthewjasper/rust

Matthew Jasper

commit sha a555e3e018d4bae90448e51f4ce34bad3da3376d

Use tracing spans in rustc_trait_selection

view details

push time in 8 days

pull request commentrust-lang/rust

Use tracing spans in rustc_trait_selection

This is up to a 0.8% regression. I'll see if reducing the number of spans being used can help here.

matthewjasper

comment created time in 8 days

issue commentrust-lang/rust

Panics in destructors can cause the return value to be leaked

The next step is for me to resurrect #72152 and see how a perf run looks.

arielb1

comment created time in 9 days

PullRequestReviewEvent

pull request commentrust-lang/rust

Add TraitDef::find_map_relevant_impl

@bors r+ rollup=maybe

bugadani

comment created time in 9 days

pull request commentrust-lang/rust

Replace run_compiler with RunCompiler builder pattern

@bors r+

dash2507

comment created time in 9 days

pull request commentrust-lang/rust

require `Reveal::All` in `normalize_erasing_regions`

There are a few places that should (sometimes) be given user facing param envs: https://github.com/rust-lang/rust/blob/12187b7f860e8e823eb5e399946746c4d2c1b1a7/compiler/rustc_lint/src/types.rs#L818 https://github.com/rust-lang/rust/blob/3e14b684dd31794e8dbe6acd7a5f132997ee0c47/compiler/rustc_trait_selection/src/traits/structural_match.rs#L258 https://github.com/rust-lang/rust/blob/3e14b684dd31794e8dbe6acd7a5f132997ee0c47/compiler/rustc_ty/src/needs_drop.rs#L134-L137

lcnr

comment created time in 9 days

pull request commentrust-lang/rust

require `Reveal::All` in `normalize_erasing_regions`

https://github.com/rust-lang/rust/blob/12187b7f860e8e823eb5e399946746c4d2c1b1a7/compiler/rustc_lint/src/types.rs#L818

lcnr

comment created time in 9 days

pull request commentrust-lang/rust

Use tracing spans in rustc_trait_selection

@bors try @rust-timer queue

matthewjasper

comment created time in 9 days

push eventmatthewjasper/rust

Matthew Jasper

commit sha 33566e3c4d5c128db222179e0fd0ea4ac7deff27

Use tracing spans in rustc_trait_selection

view details

push time in 9 days

PR opened rust-lang/rust

Use tracing spans in rustc_trait_selection

Spans are very helpful when debugging this code. It's also hot enough to make a good benchmark.

r? @oli-obk

+172 -295

0 comment

5 changed files

pr created time in 9 days

create barnchmatthewjasper/rust

branch : instrument-trait-selection

created branch time in 9 days

issue commentrust-lang/rust

Type inference regression and ICE in nightly 2020-10-06

There should already be some tests in #73905, if you can find anything not covered by the tests added there then please add some.

mattico

comment created time in 10 days

issue commentrust-lang/rust

Type inference regression and ICE in nightly 2020-10-06

The uom issue is fallout from fixing #27675

The really minimal example of this is

use std::ops::Add;

trait A {
    type U: Add<i64> + Add<u64>;
}

fn f<T: A>(t: T::U) {
    let x = t + Default::default();
}

on stable the compiler will arbitrarily decide to use the Add<u64> impl for +. Some of the changes from #73905 meant that there wasn't a good way to keep this behaviour, so this is now reported as ambiguous (which it is).

mattico

comment created time in 10 days

Pull request review commentrust-lang/rust

Add some regression tests

+// check-pass++#![feature(associated_type_bounds)]++fn foo<F>(_: F)+where+    F: for<'a> Trait<Output: 'a>,

CI runs with debug assertions enabled on some targets, so this needs to be fixed in this PR, or the tests can be left out until a future PR.

JohnTitor

comment created time in 10 days

PullRequestReviewEvent

pull request commentrust-lang/rust

rustc_target: Refactor away `TargetResult`

@bors r+

petrochenkov

comment created time in 10 days

Pull request review commentrust-lang/rust

Add some regression tests

+// check-pass++#![feature(associated_type_bounds)]++fn foo<F>(_: F)+where+    F: for<'a> Trait<Output: 'a>,

This test debug asserts (I think it's a problem of Binder::dummy being used instead of Binder::bind

JohnTitor

comment created time in 10 days

PullRequestReviewEvent

pull request commentrust-lang/rust

Simplify some code in rustc_llvm/build.rs now that LLVM 8 is required

@bors r+

est31

comment created time in 11 days

PR opened rust-lang/rust

Fix trait solving ICEs
  • Selection candidates that are known to be applicable are preferred over candidates that are not.
  • Don't ICE if a projection/object candidate is no longer applicable (this can happen due to cycles in normalization)
  • Normalize supertraits when finding trait object candidates

Closes #77653 Closes #77656

r? @nikomatsakis

+142 -80

0 comment

6 changed files

pr created time in 11 days

create barnchmatthewjasper/rust

branch : fix-trait-ices

created branch time in 11 days

create barnchmatthewjasper/rust

branch : fix-trait-ices

created branch time in 11 days

push eventmatthewjasper/rust

Matthew Jasper

commit sha 2916606046b9124c853069a1879175cc58f2445d

Normalize when finding trait object candidates

view details

push time in 11 days

issue commentrust-lang/rust

[ICE] Encountered errors resolving bounds after type-checking

Small example that I think is the same issue. And an ICE on stable.

trait Proj {
    type S;
}

trait Base<T> {
    fn is_base(&self);
}
trait Der<B: Proj>: Base<B::S> {
    fn is_der(&self);
}

fn f<P: Proj>(obj: &dyn Der<P>) {
    // Uncomment for ICE on stable
    // obj.is_base();
    obj.is_der();
}

impl Proj for () {
    type S = ();
}

pub fn main() {
    let x: fn(_) = f::<()>;
}
lzutao

comment created time in 11 days

issue closedrust-lang/rust

Type alias impl trait types do not check bounds apply to concrete type

The following code runs and prints random values:

#![feature(type_alias_impl_trait)]

type X<'a> = impl Into<&'static str> + From<&'a str>;

fn f<'a: 'static>(t: &'a str) -> X<'a> {
    t
}

fn extend_lt<'a>(o: &'a str) -> &'static str {
    X::<'_>::from(o).into()
}

fn main() {
    let r =
    {
        let s = "abcdef".to_string();
        extend_lt(&s)
    };
    println!("{}", r);
}

<details>

<summary>ICE using the same issue</summary>

#![feature(type_alias_impl_trait)]

type X<T> = impl Clone;

fn f<T: Clone>(t: T) -> X<T> {
    t
}

fn g<T>(o : Option<X<T>>) -> Option<X<T>> {
    o.clone()
}

fn main() {
    g(None::<X<&mut ()>>);
}

</details>

closed time in 13 days

matthewjasper

issue commentrust-lang/rust

Type alias impl trait types do not check bounds apply to concrete type

This is tested in src/test/ui/type-alias-impl-trait/bounds-are-checked.rs already.

Ideally we would not allow f as a defining use because it overconstrains 'a, but it's hard to specify exactly what that means because not all of the parameters of the function have to be arguments of the opaque type.

matthewjasper

comment created time in 13 days

pull request commentrust-lang/rust

Update to chalk 0.31

@bors r+

jackh726

comment created time in 13 days

issue closedrust-lang/rust

ICE when adding GAT feature in combination with async/await

Code

  • crate b (only main.rs) depends on crate a (only lib.rs).
  • Feature GAT is enabled (but not used directly)
  • without feature GAT, the code does not pass cargo check
  • with feature GAT, the code passes cargo check and fails at cargo build, but only when code ill-formed FooImpl is generated.
  • within single crate, the ICE does not happen
  • I cannot reproduce this with any other traits than Future together with async/await

crate a, lib.rs

#![feature(generic_associated_types)]

use std::{future::Future, pin::Pin};
pub trait Foo {
    type Bar: AsRef<()>;
    fn foo(&self) -> Pin<Box<dyn Future<Output = Self::Bar> + '_>>;
}

crate b, main.rs

use futures::executor::block_on;

use a::Foo;
use std::{future::Future, pin::Pin};

fn main() {
    block_on(foo());
}

pub struct FooImpl;

impl Foo for FooImpl {
    type Bar = ();
    fn foo(&self) -> Pin<Box<dyn Future<Output = Self::Bar> + '_>> {
        panic!()
    }
}

async fn foo() {
    bar(&FooImpl).await;
}

async fn bar<F: Foo>(foo: &F) {
    foo.foo().await.as_ref();
}

Meta

rustc --version --verbose:

rustc 1.46.0-nightly (7750c3d46 2020-06-26)
binary: rustc
commit-hash: 7750c3d46bc19784adb1ee6e37a5ec7e4cd7e772
commit-date: 2020-06-26
host: x86_64-unknown-linux-gnu
release: 1.46.0-nightly
LLVM version: 10.0

Error output

error: internal compiler error: src/librustc_trait_selection/traits/codegen/mod.rs:62:17: Encountered error `Unimplemented` selecting `Binder(<() as std::convert::AsRef<()>>)` during codegen

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:916:9
note: run with `RUST_BACKTRACE=1` environment variable to display a 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.46.0-nightly (7750c3d46 2020-06-26) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin

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

error: aborting due to previous error

<details><summary><strong>Backtrace</strong></summary> <p>

error: internal compiler error: src/librustc_trait_selection/traits/codegen/mod.rs:62:17: Encountered error `Unimplemented` selecting `Binder(<() as std::convert::AsRef<()>>)` during codegen

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:916: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:1076
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1537
   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:217
  10: rustc_driver::report_ice
  11: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:524
  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_middle::ty::context::GlobalCtxt::enter_local
  21: rustc_trait_selection::traits::codegen::codegen_fulfill_obligation
  22: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::codegen_fulfill_obligation>::compute
  23: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  24: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  25: rustc_data_structures::stack::ensure_sufficient_stack
  26: rustc_query_system::query::plumbing::get_query_impl
  27: rustc_ty::instance::resolve_instance
  28: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::resolve_instance>::compute
  29: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  30: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  31: rustc_data_structures::stack::ensure_sufficient_stack
  32: rustc_query_system::query::plumbing::get_query_impl
  33: rustc_middle::ty::instance::Instance::resolve
  34: <rustc_mir::monomorphize::collector::MirNeighborCollector as rustc_middle::mir::visit::Visitor>::visit_terminator
  35: rustc_mir::monomorphize::collector::collect_neighbours
  36: rustc_data_structures::stack::ensure_sufficient_stack
  37: rustc_mir::monomorphize::collector::collect_items_rec
  38: rustc_mir::monomorphize::collector::collect_items_rec
  39: rustc_mir::monomorphize::collector::collect_items_rec
  40: rustc_mir::monomorphize::collector::collect_items_rec
  41: rustc_mir::monomorphize::collector::collect_items_rec
  42: rustc_mir::monomorphize::collector::collect_items_rec
  43: rustc_mir::monomorphize::collector::collect_items_rec
  44: rustc_mir::monomorphize::collector::collect_items_rec
  45: rustc_mir::monomorphize::collector::collect_items_rec
  46: rustc_mir::monomorphize::collector::collect_items_rec
  47: rustc_mir::monomorphize::collector::collect_items_rec
  48: rustc_mir::monomorphize::collector::collect_crate_mono_items
  49: rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items
  50: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::collect_and_partition_mono_items>::compute
  51: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  52: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  53: rustc_query_system::query::plumbing::get_query_impl
  54: rustc_codegen_ssa::base::codegen_crate
  55: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  56: rustc_session::utils::<impl rustc_session::session::Session>::time
  57: rustc_interface::passes::start_codegen
  58: rustc_middle::ty::context::tls::enter_global
  59: rustc_interface::queries::Queries::ongoing_codegen
  60: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  61: rustc_span::with_source_map
  62: rustc_interface::interface::run_compiler_in_existing_thread_pool
  63: scoped_tls::ScopedKey<T>::set
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.46.0-nightly (7750c3d46 2020-06-26) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin

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

query stack during panic:
#0 [codegen_fulfill_obligation] checking if `std::convert::AsRef` fulfills its obligations
#1 [resolve_instance] resolving instance `<() as std::convert::AsRef<()>>::as_ref`
#2 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: aborting due to previous error

</p> </details>

closed time in 13 days

power-fungus

delete branch matthewjasper/rust

delete branch : projection-bounds-2

delete time in 13 days

pull request commentrust-lang/rust

Separate projection bounds and predicates

@bors r=nikomatsakis

matthewjasper

comment created time in 13 days

push eventmatthewjasper/rust

Alexis Bourget

commit sha 492826ac144666c75d68bc0a0121453ecc08561f

Add a note about the panic behavior of math operations on time objects

view details

LingMan

commit sha a6ff925f8b5598a1f6d84964525baa1d4a08fd63

Reduce boilerplate with the matches! macro Replaces simple bool `match`es of the form match $expr { $pattern => true _ => false } and their inverse with invocations of the matches! macro.

view details

Valerii Lashmanov

commit sha 5c224a484dc6ba2a70c9cd0d73a04849f6d7aa68

MiniSet/MiniMap moved and renamed into SsoHashSet/SsoHashMap It is a more descriptive name and with upcoming changes there will be nothing "mini" about them.

view details

Valerii Lashmanov

commit sha 0600b178aa0e9f310067bf8ccaf736e77a03eb1d

SsoHashSet/SsoHashMap API greatly expanded Now both provide almost complete API of their non-SSO counterparts.

view details

Valerii Lashmanov

commit sha 41942fac7d0711c6b3d0faa69748e22c0eb41388

SsoHashSet reimplemented as a wrapper on top of SsoHashMap SsoHashSet::replace had to be removed because it requires missing API from SsoHashMap. It's not a widely used function, so I think it's ok to omit it for now. EitherIter moved into its own file. Also sprinkled code with #[inline] attributes where appropriate.

view details

Valerii Lashmanov

commit sha 92a0668c20b8dea00d8739dce2243113f518b427

SsoHashMap minor refactoring, SSO_ARRAY_SIZE introduced

view details

Valerii Lashmanov

commit sha d1d2184db407dbdc0a0872c9efb4ff58457e1c9a

SsoHashSet/Map - genericiy over Q removed Due to performance regression, see SsoHashMap comment.

view details

Felix S. Klock II

commit sha b4e77d21bcf8b15ef7d873005382ba8ca309faf5

rewrite old test so that its attributes are consistent with what we want in the language. (Note that the fact this test existed is a slight sign that we may need a crater run on this bugfix...)

view details

Tamir Duberstein

commit sha 9601724b11bbd9081b1bee6f7e478a5d2b9ace41

Avoid unchecked casts in net parser

view details

Tamir Duberstein

commit sha f78a7ade61c1c218eead76854abb7d83bb6c6f75

Inline "eof" methods

view details

Felix S. Klock II

commit sha afa2a675453091773eb9dd1b19389725526224b9

Prevent forbid from being ignored if overriden at the same level. That is, this changes `#[forbid(foo)] #[allow(foo)]` from allowing foo to forbidding foo.

view details

Robin Schoonover

commit sha 5ab19676ed25ce52769b06a2fc7319b93d6c64dd

Remove extra indirection in LitKind::ByteStr

view details

Robin Schoonover

commit sha 62f7712a1fd500604f76442f627ea35ce7217177

Change clippy's Constant back to refcount clone byte strings

view details

Camelid

commit sha b205436ff66db720cb4b0c503d14ff0a571b14c7

Allow anyone to set regression labels

view details

Thom Chiovoloni

commit sha afe83d4c1ca70149b463ac7548cf5d204d3d5844

Rename bootstrap/defaults/{config.toml.PROFILE => config.PROFILE.toml}

view details

Thom Chiovoloni

commit sha 5388eb41e940cddaf8ae4ea812c4e04a3e9d9401

Add changelog entry mentioning the renamed profile files

view details

Camelid

commit sha c877ff3664abea60d69b8acf8e7dce85c2ffd859

Fix rustdoc warnings about invalid Rust syntax

view details

Guillaume Gomez

commit sha b1ce6190ae4cb412c21207932924889e7201d4df

Add missing examples for MaybeUninit

view details

Ivan Tham

commit sha 554145609484d111f6ca3acaca644ae881c20a10

Hint doc use convert::identity relative link

view details

Rich Kadel

commit sha f5aebad28fe69f53497ce0107103c6d5d37b25dc

Updates to experimental coverage counter injection This is a combination of 18 commits. Commit #2: Additional examples and some small improvements. Commit #3: fixed mir-opt non-mir extensions and spanview title elements Corrected a fairly recent assumption in runtest.rs that all MIR dump files end in .mir. (It was appending .mir to the graphviz .dot and spanview .html file names when generating blessed output files. That also left outdated files in the baseline alongside the files with the incorrect names, which I've now removed.) Updated spanview HTML title elements to match their content, replacing a hardcoded and incorrect name that was left in accidentally when originally submitted. Commit #4: added more test examples also improved Makefiles with support for non-zero exit status and to force validation of tests unless a specific test overrides it with a specific comment. Commit #5: Fixed rare issues after testing on real-world crate Commit #6: Addressed PR feedback, and removed temporary -Zexperimental-coverage -Zinstrument-coverage once again supports the latest capabilities of LLVM instrprof coverage instrumentation. Also fixed a bug in spanview. Commit #7: Fix closure handling, add tests for closures and inner items And cleaned up other tests for consistency, and to make it more clear where spans start/end by breaking up lines. Commit #8: renamed "typical" test results "expected" Now that the `llvm-cov show` tests are improved to normally expect matching actuals, and to allow individual tests to override that expectation. Commit #9: test coverage of inline generic struct function Commit #10: Addressed review feedback * Removed unnecessary Unreachable filter. * Replaced a match wildcard with remining variants. * Added more comments to help clarify the role of successors() in the CFG traversal Commit #11: refactoring based on feedback * refactored `fn coverage_spans()`. * changed the way I expand an empty coverage span to improve performance * fixed a typo that I had accidently left in, in visit.rs Commit #12: Optimized use of SourceMap and SourceFile Commit #13: Fixed a regression, and synched with upstream Some generated test file names changed due to some new change upstream. Commit #14: Stripping out crate disambiguators from demangled names These can vary depending on the test platform. Commit #15: Ignore llvm-cov show diff on test with generics, expand IO error message Tests with generics produce llvm-cov show results with demangled names that can include an unstable "crate disambiguator" (hex value). The value changes when run in the Rust CI Windows environment. I added a sed filter to strip them out (in a prior commit), but sed also appears to fail in the same environment. Until I can figure out a workaround, I'm just going to ignore this specific test result. I added a FIXME to follow up later, but it's not that critical. I also saw an error with Windows GNU, but the IO error did not specify a path for the directory or file that triggered the error. I updated the error messages to provide more info for next, time but also noticed some other tests with similar steps did not fail. Looks spurious. Commit #16: Modify rust-demangler to strip disambiguators by default Commit #17: Remove std::process::exit from coverage tests Due to Issue #77553, programs that call std::process::exit() do not generate coverage results on Windows MSVC. Commit #18: fix: test file paths exceeding Windows max path len

view details

push time in 13 days

pull request commentrust-lang/rust

Separate projection bounds and predicates

@bors r=nikomatsakis

matthewjasper

comment created time in 13 days

push eventmatthewjasper/rust

Matthew Jasper

commit sha a73fdef403503b3ce588cae4216a2014d5454442

Fix NLL compare mode tests

view details

push time in 13 days

push eventmatthewjasper/rust

Nazım Can Altınova

commit sha a313abe3ba989ba4b6c041627c903488886f8559

Manually implement Debug for BTreeMap::{IntoKeys,IntoValues} structs

view details

Nazım Can Altınova

commit sha 456738e3d1ad7dadffaed287d3055ca38b5fa375

Only print values in the Debug of HashMap::ValuesMut struct

view details

Nazım Can Altınova

commit sha c346e89db8a57e15111daa35685a2542d3be7c77

Manually implement Debug for BTreeMap::ValuesMut struct Deriving debug prints all the values including keys. But ValuesMut struct should only print the values.

view details

Nazım Can Altınova

commit sha 8faf550e5f7211188bc9560ae459c155fb1aafdf

Remove the unused bounds from Debug impl of HashMap::{IntoKeys,IntoValues}

view details

kadmin

commit sha 8894b366fdb976a703fe76010f6e56c591cada1f

Remove error message in specific case In the case that a trait is not implemented for an ADT with type errors, cancel the error.

view details

CAD97

commit sha 728938346b02a9688c44253c19b15baa7551fd80

Adjust rc::Weak::from_raw to support unsized T

view details

CAD97

commit sha 0c61ce2cf0560577923abafab2e5bfce14516525

?Sized bounds for rc::Weak::as_ptr and friends

view details

CAD97

commit sha 5e7406c9569dce75a042ce079918cf03cfca842a

Adjust sync::Weak::from_raw to support unsized T

view details

CAD97

commit sha 9d9903c5a50bb1f5b5fc3045b86172279eff7d30

Allow Weak::as_ptr and friends for unsized T

view details

CAD97

commit sha 3d07108d3600dff50e564f57dd390337dbe14d55

Add tests for weak into/from raw

view details

Jubilee Young

commit sha 247b73939a619ea4dcb2affbe1c285d20d93a0b8

Move Wrapping<T> ui tests into library

view details

Jubilee Young

commit sha 797cb9526a627c37b9bb9f6be6d3b54789b67c26

Fix to libstd test

view details

Jubilee Young

commit sha ac96f5b39ca7d9fad8571595c476c2db0bce8438

Test and reject out-of-bounds shuffle vectors

view details

Hoe Hao Cheng

commit sha 3c582db8cb43dac1d13dd653078a68753d4baa99

Implement as_ne_bytes for floats and integers

view details

sharnoff

commit sha 8a011b5da2cc289fb7d970492ea4111980676412

minor doc changes, attribute orderings

view details

Guillaume Gomez

commit sha 980e1ff40f51b6b4b86ee70809d0a0055e6f9cc6

Add missing examples for Fd traits

view details

Mara Bos

commit sha 07fd17f7014de6dc209c7dc4de159a2a5acea173

Only use LOCAL_{STDOUT,STDERR} when set_{print/panic} is used. The thread local LOCAL_STDOUT and LOCAL_STDERR are only used by the test crate to capture output from tests when running them in the same process in differen threads. However, every program will check these variables on every print, even outside of testing. This involves allocating a thread local key, and registering a thread local destructor. This can be somewhat expensive. This change keeps a global flag (LOCAL_STREAMS) which will be set to true when either of these local streams is used. (So, effectively only in test and benchmark runs.) When this flag is off, these thread locals are not even looked at and therefore will not be initialized on the first output on every thread, which also means no thread local destructors will be registered.

view details

Mara Bos

commit sha ed3ead013f40c65e2972c794a71b756237a31b46

Relax memory ordering of LOCAL_STREAMS and document it.

view details

Mara Bos

commit sha de597fca40d129435c53a69c6662d7bfac29771d

Optimize set_{panic,print}(None).

view details

Oliver Scherer

commit sha 43c181bac4d88dbe7bdd762688dcf18313f01093

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

view details

push time in 14 days

pull request commentrust-lang/rust

Update to chalk 0.31

@bors r+

jackh726

comment created time in 15 days

Pull request review commentrust-lang/rust

[WIP] Add const qualifier in FnSig (for const fn pointers)

 impl<'a, 'tcx> FnCtxt<'a, 'tcx> {                             // We have a LUB of prev_ty and new_ty, just return it.

The patterns in the match on (&prev_ty.kind, &new_ty.kind) should use &ty::FnDef(..) | &ty::FnPtr(..) instead of &ty::FnDef(..)

filtsin

comment created time in 15 days

Pull request review commentrust-lang/rust

[WIP] Add const qualifier in FnSig (for const fn pointers)

 impl<'a, 'tcx> FnCtxt<'a, 'tcx> {             let fn_ptr = self.tcx.mk_fn_ptr(sig);             let prev_adjustment = match prev_ty.kind {                 ty::Closure(..) => Adjust::Pointer(PointerCast::ClosureFnPointer(a_sig.unsafety())),-                ty::FnDef(..) => Adjust::Pointer(PointerCast::ReifyFnPointer),+                ty::FnDef(..) => {+                    if prev_drop_const {+                        Adjust::Pointer(PointerCast::ReifyNotConstFnPointer)+                    } else {+                        Adjust::Pointer(PointerCast::ReifyFnPointer)+                    }+                }

This match and the next would be changed to return an Option and an arm for ty::FnPtr(..) should be added here. Some(Adjust::Pointer(PointerCast::NotConstFnPointer)) would be returned if prev_drop_const, otherwise None would be returned. The apply_adjustments calls would be skipped if None is returned from the match.

apply_adjustments would need to be changed to handle the case where a NotConstFnPointer adjustment is applied when there is already a ReifyFnPointer adjustment (by merging them to a NotConstFnPointer adjustment).

filtsin

comment created time in 15 days

PullRequestReviewEvent
PullRequestReviewEvent

pull request commentrust-lang/rust

Update to chalk 0.31

r? matthewjasper @bors r+

jackh726

comment created time in 15 days

pull request commentrust-lang/rust

Add check for doc alias attribute at crate level

@bors r+

GuillaumeGomez

comment created time in 15 days

Pull request review commentrust-lang/rust

Separate projection bounds and predicates

 pub fn elaborate_predicates<'tcx>(     tcx: TyCtxt<'tcx>,     predicates: impl Iterator<Item = ty::Predicate<'tcx>>, ) -> Elaborator<'tcx> {-    let obligations = predicates.map(|predicate| predicate_obligation(predicate, None)).collect();+    let obligations = predicates+        .map(|predicate| {+            predicate_obligation(predicate, ty::ParamEnv::empty(), ObligationCause::dummy())+        })+        .collect();

It looks like only the predicates from the obligations returned by elaborate_predicates are used.

matthewjasper

comment created time in 15 days

PullRequestReviewEvent

push eventrust-lang/chalk

Jack Huey

commit sha a1dc34d0eb66ceaa0b35b1436abf590f7b254f58

Add static lifetime

view details

matthewjasper

commit sha 3a852d963e6ab586e006c9098be6c13fc0753efb

Merge pull request #617 from jackh726/static Add static lifetime

view details

push time in 16 days

PR merged rust-lang/chalk

Add static lifetime
+163 -72

0 comment

15 changed files

jackh726

pr closed time in 16 days

Pull request review commentrust-lang/chalk

Add static lifetime

+//! Tests for the static lifetime++use super::*;+++#[test]+fn static_lowering() {+    lowering_success! {+        program {+            struct A<'a> where 'a: 'static {}+            trait A<'a> where 'a: 'static {}

Seeing a name collision here is somewhat surprising, even if it's allowed. Can the struct and trait have different names?

jackh726

comment created time in 16 days

PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commentrust-lang/rust

Re-land PR #71840 (Rework MIR drop tree lowering)

+// compile-flags: -C opt-level=3+// aux-build: issue-72470-lib.rs+// edition:2018+// check-pass
// build-pass

This is a test for an llvm bug

Aaron1011

comment created time in 16 days

Pull request review commentrust-lang/rust

Re-land PR #71840 (Rework MIR drop tree lowering)

 crate enum BreakableTarget {     Return, } -impl CachedBlock {-    fn invalidate(&mut self) {-        *self = CachedBlock::default();-    }+rustc_index::newtype_index! {+    struct DropIdx { .. }+} -    fn get(&self, generator_drop: bool) -> Option<BasicBlock> {-        if generator_drop { self.generator_drop } else { self.unwind }-    }+const ROOT_NODE: DropIdx = DropIdx::from_u32(0); -    fn ref_mut(&mut self, generator_drop: bool) -> &mut Option<BasicBlock> {-        if generator_drop { &mut self.generator_drop } else { &mut self.unwind }-    }+/// A tree of drops that we have deferred lowering. It's used for:+///+/// * Drops on unwind paths+/// * Drops on generator drop paths (when a suspended generator is dropped)+/// * Drops on return and loop exit paths+///+/// Once no more nodes could be added to the tree, we lower it to MIR in one go+/// in `build_drop_tree`.
/// in `build_mir`.
Aaron1011

comment created time in 16 days

Pull request review commentrust-lang/rust

Re-land PR #71840 (Rework MIR drop tree lowering)

 crate enum BreakableTarget {     Return, } -impl CachedBlock {-    fn invalidate(&mut self) {-        *self = CachedBlock::default();-    }+rustc_index::newtype_index! {+    struct DropIdx { .. }+} -    fn get(&self, generator_drop: bool) -> Option<BasicBlock> {-        if generator_drop { self.generator_drop } else { self.unwind }-    }+const ROOT_NODE: DropIdx = DropIdx::from_u32(0); -    fn ref_mut(&mut self, generator_drop: bool) -> &mut Option<BasicBlock> {-        if generator_drop { &mut self.generator_drop } else { &mut self.unwind }-    }+/// A tree of drops that we have deferred lowering. It's used for:+///+/// * Drops on unwind paths+/// * Drops on generator drop paths (when a suspended generator is dropped)+/// * Drops on return and loop exit paths+///+/// Once no more nodes could be added to the tree, we lower it to MIR in one go+/// in `build_drop_tree`.+#[derive(Debug)]+struct DropTree {+    /// Drops in the tree.+    drops: IndexVec<DropIdx, (DropData, DropIdx)>,+    /// Map for finding the inverse of the `next_drop` relation:+    ///+    /// `previous_drops[(drops[i].1, drops[i].0.local, drops[i].0.kind] == i`
    /// `previous_drops[(drops[i].1, drops[i].0.local, drops[i].0.kind)] == i`
Aaron1011

comment created time in 16 days

PullRequestReviewEvent
PullRequestReviewEvent

pull request commentrust-lang/rust

Re-land PR #71840 (Rework MIR drop tree lowering)

cc @oli-obk who originally reviewed this.

Aaron1011

comment created time in 17 days

push eventmatthewjasper/rust

Mara Bos

commit sha 84ef603c8400db203fefd714de963c88e5523424

Fix 'FIXME' about using NonZeroU32 instead of u32. It was blocked by #58732 (const fn NonZeroU32::new), which is fixed now.

view details

Mara Bos

commit sha f289468045c248e3543f2b0cd50cc37ecd3fd717

Stabilize slice_ptr_range. Closes #65807.

view details

Eric Huss

commit sha c297e20e03452c659b6d3f026ce4beee42ed8738

Add accessors to Command.

view details

Mara Bos

commit sha 6f6336b4a187b03312b978703496ea0ee9020ec9

Split sys_common::Mutex in StaticMutex and MovableMutex. The (unsafe) Mutex from sys_common had a rather complicated interface. You were supposed to call init() manually, unless you could guarantee it was neither moved nor used reentrantly. Calling `destroy()` was also optional, although it was unclear if 1) resources might be leaked or not, and 2) if destroy() should only be called when `init()` was called. This allowed for a number of interesting (confusing?) different ways to use this Mutex, all captured in a single type. In practice, this type was only ever used in two ways: 1. As a static variable. In this case, neither init() nor destroy() are called. The variable is never moved, and it is never used reentrantly. It is only ever locked using the LockGuard, never with raw_lock. 2. As a Boxed variable. In this case, both init() and destroy() are called, it will be moved and possibly used reentrantly. No other combinations are used anywhere in `std`. This change simplifies things by splitting this Mutex type into two types matching the two use cases: StaticMutex and MovableMutex. The interface of both new types is now both safer and simpler. The first one does not call nor expose init/destroy, and the second one calls those automatically in its new() and Drop functions. Also, the locking functions of MovableMutex are no longer unsafe.

view details

Mara Bos

commit sha 825dda80601bdb34ef21065052a8866df0fe0838

Fix ui test. This test checks if the compiler complains about accesing a private field before complaining (or crashing) about the private function on it not marked as stable/unstable. The interface of the internal type (sys_common's Mutex) used for this was changed. With this change, it uses another function to test for the same issue.

view details

Dániel Buga

commit sha 89b8a97aead4aa366eb2587ffdcfa7df39f3815a

Refactor memchr to allow optimization

view details

Ingvar Stepanyan

commit sha 494d6e514bb29341270720067d9842e8862704f8

Fix is_absolute on WASI WASI does not match `cfg(unix)`, but its paths are Unix-like (`/some/path`) and don't have Windows-like prefixes. Without this change, `is_absolute` for paths like `/some/path` was returning `false`on a WASI target, which is obviously not true and undesirable.

view details

Vadim Petrochenkov

commit sha 384eb2691f53bb0cdeb17a5ccf73c83e861d9aa1

rustc_metadata: Do not forget to encode inherent impls for foreign types

view details

Scott McMurray

commit sha 20202da09e86bd15ffcd0ce22b5ebe8a27ef17a0

Improve the example for ptr::copy Fixes #77220

view details

Joshua Nelson

commit sha 8164218181d8fc22a7247a686ec9af9d61f70d44

Fix some clippy issues Found while working on https://github.com/rust-lang/rust/pull/77351; these are just the ones that could be fixed automatically.

view details

scottmcm

commit sha e58f3d352d1c6f0ccc0b089754939bbcb7a2c294

Things are only moved if non-copy

view details

Stein Somers

commit sha 424347527dca62e648425298838e6b6bca095c9f

BTreeMap: use Unique::from to avoid a cast where type information exists

view details

Dániel Buga

commit sha de623bfaf77a69d86e1561f6b4e0fdd9d193cf60

Only test on x86_64

view details

Mara Bos

commit sha 8b2bdfd453d196f4d108183efe1f5a58292d5f11

Improve std::sys::windows::compat. - Module name can now be any string, not just an ident. (Not all Windows api modules are valid Rust identifiers.) - Adds c::FuncName::is_available() for checking if a function is really available without having to do a duplicate lookup. - Add comment explaining the lack of locking. - Use `$_:block` to simplify the macro_rules. - Apply allow(unused_variables) only to the fallback instead of everything.

view details

Mara Bos

commit sha 93310efdbe80d01e287b935e0f86a834bc6c4574

Use AcquireSRWLockExclusive::is_available() instead of an extra lookup.

view details

Mara Bos

commit sha 09cbaf436713ddb864725a50ccdff67e2ab9bc77

Formatting.

view details

Mara Bos

commit sha 63b6007d5b68023e02a43c2f9c2ed21762cd8011

Work around potential merging/duplication issues in sys/windows/compat.

view details

Mara Bos

commit sha 2140d80a9d69cce7a9fb2c90051af4328737a446

Add note about possible future improvement Co-authored-by: David Tolnay <dtolnay@gmail.com>

view details

Mark Rousskov

commit sha 9a3b9b44dee67517aa9dd8812ca34c3389347305

Update rls * https://github.com/rust-lang/rls/pull/1700

view details

Pietro Albini

commit sha b710f9c5d54ae9269f9ca6e002ad9300ecb3ab9e

ci: switch to environment files to change the environment on GHA See GitHub's blog post on why the change was necessary: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/

view details

push time in 17 days

push eventmatthewjasper/rust

Without Boats

commit sha 82f5928ca68acceb1d1bd9e2b09554744e4a1dfe

Make RawFd implement the RawFd traits

view details

Without Boats

commit sha acc136ce0a665a32ddf1a16544b6f6d7a7153c30

fix typos

view details

Without Boats

commit sha 3fe279fc658450a3e3140f014554139493674217

spend another CI build to delete a double newline

view details

Without Boats

commit sha 35b30e29bffe8c4aa896ce53ded67c54401f7643

try again to appease tidy

view details

Tim Vermeulen

commit sha ecacc7534b6bf50205c37c89402565b82d95a257

Add advance_by and advance_back_by

view details

Matthias Krüger

commit sha 2ad46acd7fee4e193aff3fd243ca91ca092a42aa

EarlyOtherwiseBranch::run_pass(): don't convert Place to Place (clippy::useless_conversion)

view details

Matthias Krüger

commit sha d7a5c574b1010360fd840f5dfc810f2aa782eac5

use std::mem::take(x) instead of std::mem::replace(x, Default::default()) (clippy::mem_replace_with_default)

view details

Eric Huss

commit sha c29a29cba099aef1e05c83970decdcbedaabd69a

Defer Apple SDKROOT detection to link time.

view details

Eric Huss

commit sha de725fe56f338a2ceedf5dd9df5bcd86a24f8f53

Remove note about missing ios/tvos targets in platform docs. I misunderstood how this works, and I have fixed the linux builds to support ios/tvos.

view details

Lzu Tao

commit sha d31ca4fc8ede3b4a28abea7df57e01591ee8bb7d

Move Utf8Error to new mod

view details

Lzu Tao

commit sha 5b533fccf39501bd5ca8a436da6f2d8b5999664d

Move traits implementation of str to new mod Also move FromStr trait

view details

Lzu Tao

commit sha 5f0d724e298ee4e19bef4e863c176dd87ef6400f

Move str's impl of iterations to new mod

view details

Lzu Tao

commit sha 90c813a0f0b5042a2bbf2d9ebf27f21acdbc9f77

Move utf-8 validating helpers to new mod

view details

Lzu Tao

commit sha 653b5bf18c962a35bb6d90e13e6681446cc49878

Move functions converting bytes to str to new mod

view details

Lzu Tao

commit sha 37cd79cd323a7f1adcad66205c7855fb6c92f062

Gather all ZST structs of str together

view details

Lzu Tao

commit sha dce7248a39e7f8907cb9c5cfe719f6f63da1fa1f

Remove unneeded tidy comment

view details

Stein Somers

commit sha 3e485d7cf59dafbc37467c3ef1acc51f26b381d9

BTreeMap: keep an eye out on the size of the main components

view details

Eric Huss

commit sha 7420d7a98044ea1bf727ab369cbc77232dd99694

Move add_apple_sdk out of add_pre_link_args.

view details

Mara Bos

commit sha 1464fc3a0cb2b8a92c54357fcff7c632b334cb29

Move thread parker to a separate module.

view details

Mara Bos

commit sha ec13df4ec4780b679dde227db2185a82cf31c93b

Add fast futex-based thread parker for Linux.

view details

push time in 18 days

Pull request review commentrust-lang/rust

Separate projection bounds and predicates

 impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {         // relying on projections in the impl-trait-ref.         //         // e.g., `impl<U: Tr, V: Iterator<Item=U>> Foo<<U as Tr>::T> for V`-        impl_obligations.append(&mut substs.obligations);+        substs.obligations.append(&mut impl_obligations);

This affects semantics. Evaluation is done in a single pass. The change is so that evaluating substs.obligations resolves some type variables before evaluating impl_obligations.

matthewjasper

comment created time in 18 days

PullRequestReviewEvent

pull request commentrust-lang/rust

Rename Iterator::get_unchecked

#77308 backported this

matthewjasper

comment created time in 18 days

push eventmatthewjasper/rust

Laurence Tratt

commit sha 73ada2d40429488aaaacf37b608bababc137b910

Explicitly document the size guarantees that Option makes. Triggered by a discussion on wg-unsafe-code-guidelines about which layouts of `Option<T>` one can guarantee are optimised to a single pointer.

view details

Laurence Tratt

commit sha f5118a525fcf9db4102d903650331039158eff11

Clarify and add guarantee about `transmute`.

view details

Laurence Tratt

commit sha 83f47aa11bd664ed8a15ef9833063833b7b3e71c

Be clear about the reverse `transmute` guarantees.

view details

Laurence Tratt

commit sha f3d7196caec3f54e572c7389b1cef9fd9e62c1ed

Be clearer about Some/None transmute.

view details

Laurence Tratt

commit sha 8cb8955d570c76631840bfc98825ca49c0dd8eea

Change notation. Co-authored-by: Ralf Jung <post@ralfj.de>

view details

Laurence Tratt

commit sha 55802e3bf3bf6d1db5c76aea581a7912bd752890

Add Rust function pointers. Co-authored-by: Ralf Jung <post@ralfj.de>

view details

Laurence Tratt

commit sha 68209c3fe4e0f5c3758f18e98efc175af31c2e51

Rename the types for clarity.

view details

Laurence Tratt

commit sha 9bac5774d7b452b2227c9fb77a4c6de3f432ee55

Grammar tweak.

view details

Esteban Küber

commit sha 2ac89ff994c9ddcc49eed2b06ff5327bc09f4118

Point at named argument not found when using `format_args_capture` instead of whole format string

view details

David Wood

commit sha 01f65afa4adff6dfbea84621e6851c028aaa7159

diag: improve closure/generic parameter mismatch This commit improves the diagnostic when a type parameter is expected and a closure is found, noting that each closure has a distinct type and therefore could not always match the caller-chosen type of the parameter. Signed-off-by: David Wood <david@davidtw.co>

view details

Pietro Albini

commit sha 0917b2123fff6cf5357b5edd5db6d675313ab8bd

build-manifest: move PkgType into the versions module

view details

Pietro Albini

commit sha 3bddfea7e23341f788526f8b303b9a27038511e3

build-manifest: stop receiving release numbers from bootstrap

view details

Mara Bos

commit sha 26d6081f1d1a2005be87bbe47f6fcda270cfd016

Relax promises about condition variable. This allows for futex or thread parking based implementations in the future.

view details

Oliver Scherer

commit sha b54f122a1cb2593325501a2ed5b3fbfc47293615

Merge tuple and struct pattern generation.

view details

Oliver Scherer

commit sha 34c62e0abc82b7302a3b0ee16dfe445e1330ce4c

Add a query for dereferencing constants of reference type

view details

Oliver Scherer

commit sha b2532a87306fafd097241a80f92f68b10df0cba4

Implement destructuring for all aggregates and for references

view details

Lzu Tao

commit sha 3e08354fb0dc7a5f7733da9b308d483b9c1d2514

Correct file path after some restructures in compiler

view details

Lzu Tao

commit sha 4387480dea6e2611483d431857f0f85b65e3c00c

Add unstably const support for assume intrinsic

view details

Oliver Scherer

commit sha 3795886f7e1f3dc5f5dd207ba4a7c092fe929486

Split check for `PartialEq` impl into a method

view details

Oliver Scherer

commit sha aba5ea1430df393eddc90068e838de6b1707c0d8

Lint on function pointers used in patterns

view details

push time in 19 days

delete branch matthewjasper/rust

delete branch : defer-typeof-impl-trait

delete time in 21 days

pull request commentrust-lang/rust

Deduplicate and generalize some (de/)serializer impls

@bors r+

oli-obk

comment created time in 21 days

PR opened rust-lang/rust

Compute underlying type of impl trait types later in compilation

Also change a bug! to delay_span_bug Closes #74018

+375 -430

0 comment

33 changed files

pr created time in 23 days

create barnchmatthewjasper/rust

branch : defer-typeof-impl-trait

created branch time in 23 days

Pull request review commentrust-lang/rust

Provide structured suggestions when finding structs when expecting a trait

 impl<'a> LateResolutionVisitor<'a, '_, '_> {             }         } -        if !self.type_ascription_suggestion(&mut err, base_span)-            && !self.r.add_typo_suggestion(&mut err, typo_sugg, ident_span)-        {-            // Fallback label.-            err.span_label(base_span, fallback_label);--            match self.diagnostic_metadata.current_let_binding {-                Some((pat_sp, Some(ty_sp), None)) if ty_sp.contains(base_span) && could_be_expr => {-                    err.span_suggestion_short(-                        pat_sp.between(ty_sp),-                        "use `=` if you meant to assign",-                        " = ".to_string(),-                        Applicability::MaybeIncorrect,+        if !self.type_ascription_suggestion(&mut err, base_span) {+            let mut fallback = false;+            if let PathSource::Trait(AliasPossibility::Maybe) = source {

I would expect this to also checking that res is Some(_) (and maybe even that it's a type).

estebank

comment created time in 23 days

Pull request review commentrust-lang/rust

Provide structured suggestions when finding structs when expecting a trait

 impl<'a> LateResolutionVisitor<'a, '_, '_> {             }         } -        if !self.type_ascription_suggestion(&mut err, base_span)-            && !self.r.add_typo_suggestion(&mut err, typo_sugg, ident_span)-        {-            // Fallback label.-            err.span_label(base_span, fallback_label);--            match self.diagnostic_metadata.current_let_binding {-                Some((pat_sp, Some(ty_sp), None)) if ty_sp.contains(base_span) && could_be_expr => {-                    err.span_suggestion_short(-                        pat_sp.between(ty_sp),-                        "use `=` if you meant to assign",-                        " = ".to_string(),-                        Applicability::MaybeIncorrect,+        if !self.type_ascription_suggestion(&mut err, base_span) {+            let mut fallback = false;+            if let PathSource::Trait(AliasPossibility::Maybe) = source {+                if let Some(bounds @ [_, .., _]) = self.diagnostic_metadata.current_trait_object {+                    fallback = true;+                    let spans: Vec<Span> = bounds+                        .iter()+                        .map(|bound| bound.span())+                        .filter(|&sp| sp != base_span)+                        .collect();++                    let start_span = bounds.iter().map(|bound| bound.span()).next().unwrap();+                    // `end_span` is the end of the poly trait ref (Foo + 'baz + Bar><)+                    let end_span = bounds.iter().map(|bound| bound.span()).last().unwrap();+                    // `last_bound_span` is the last bound of the poly trait ref (Foo + >'baz< + Bar)+                    let last_bound_span = spans.last().cloned().unwrap();+                    let mut multi_span: MultiSpan = spans.clone().into();+                    for sp in spans {+                        let msg = if sp == last_bound_span {+                            format!(+                                "...because of {} bound{}",+                                if bounds.len() <= 2 { "this" } else { "these" },+                                if bounds.len() <= 2 { "" } else { "s" },+                            )+                        } else {+                            String::new()+                        };+                        multi_span.push_span_label(sp, msg);+                    }+                    multi_span.push_span_label(+                        base_span,+                        "expected this type to be a trait...".to_string(),+                    );+                    err.span_help(+                        multi_span,+                        "`+` is used to constrain a \"trait object\" type with lifetimes or \+                         auto-traits; structs and enums can't be bound in that way",                     );+                    if bounds.iter().all(|bound| match bound {+                        ast::GenericBound::Outlives(_) => true,+                        ast::GenericBound::Trait(tr, _) => tr.span == base_span,+                    }) {+                        let mut sugg = vec![];+                        if base_span != start_span {+                            sugg.push((start_span.until(base_span), String::new()));+                        }+                        if base_span != end_span {+                            sugg.push((base_span.shrink_to_hi().to(end_span), String::new()));+                        }++                        err.multipart_suggestion(+                            "if you meant to use a type and not a trait here, remove the bounds",+                            sugg,+                            Applicability::MaybeIncorrect,+                        );+                    }+                }+            }++            fallback |= self.restrict_assoc_type_in_where_clause(span, &mut err);++            if !self.r.add_typo_suggestion(&mut err, typo_sugg, ident_span) {+                fallback = true;+                match self.diagnostic_metadata.current_let_binding {+                    Some((pat_sp, Some(ty_sp), None))+                        if ty_sp.contains(base_span) && could_be_expr =>+                    {+                        err.span_suggestion_short(+                            pat_sp.between(ty_sp),+                            "use `=` if you meant to assign",+                            " = ".to_string(),+                            Applicability::MaybeIncorrect,+                        );+                    }+                    _ => {}                 }-                _ => {}+            }+            if fallback {+                // Fallback label.+                err.span_label(base_span, fallback_label);             }         }         (err, candidates)     } +    /// Given `where <T as Bar>::Baz: String`, suggest `where T: Bar<Baz = String>`.+    fn restrict_assoc_type_in_where_clause(+        &mut self,+        span: Span,+        err: &mut DiagnosticBuilder<'_>,+    ) -> bool {+        // Detect that we are actually in a `where` predicate.+        let (bounded_ty, bounds, where_span) =+            if let Some(ast::WherePredicate::BoundPredicate(ast::WhereBoundPredicate {+                bounded_ty,+                bound_generic_params,+                bounds,+                span,+            })) = self.diagnostic_metadata.current_where_predicate+            {+                if !bound_generic_params.is_empty() {+                    return false;+                }+                (bounded_ty, bounds, span)+            } else {+                return false;+            };++        // Confirm that the target is an associated type.+        let (ty, position, path) = if let ast::TyKind::Path(+            Some(ast::QSelf { ty, position, .. }),+            path,+        ) = &bounded_ty.kind+        {+            // use this to verify that ident is a type param.+            let partial_res = if let Ok(Some(partial_res)) = self.resolve_qpath_anywhere(+                bounded_ty.id,+                None,+                &Segment::from_path(path),+                Namespace::TypeNS,+                span,+                true,+                CrateLint::No,+            ) {+                partial_res+            } else {+                return false;+            };+            if !(matches!(+                partial_res.base_res(),+                hir::def::Res::Def(hir::def::DefKind::AssocTy, _)

Why is this needed. This suggestion would also make sense for <&T as Trait>::Assoc: String

estebank

comment created time in 23 days

more