Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regression: new resolution failures in 1.74 #117056

Closed
Mark-Simulacrum opened this issue Oct 22, 2023 · 15 comments
Closed

regression: new resolution failures in 1.74 #117056

Mark-Simulacrum opened this issue Oct 22, 2023 · 15 comments
Labels
P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Milestone

Comments

@Mark-Simulacrum
Copy link
Member

Mark-Simulacrum commented Oct 22, 2023

I'm grouping these together but we should make sure all of them are fixed / tested before closing this:

cc #117053 which is a similar-looking problem, maybe duplicate of this

[INFO] [stdout] error[E0425]: cannot find function `create_lookup_table` in module `instruction`
[INFO] [stdout]   --> programs/swap/src/action/create_address_lookup_table.rs:51:26
[INFO] [stdout]    |
[INFO] [stdout] 51 |             instruction::create_lookup_table(
[INFO] [stdout]    |                          ^^^^^^^^^^^^^^^^^^^ not found in `instruction`
[INFO] [stdout]    |
[INFO] [stdout] help: consider importing this function
[INFO] [stdout]    |
[INFO] [stdout] 1  + use solana_address_lookup_table_program::instruction::create_lookup_table;
[INFO] [stdout]    |
[INFO] [stdout] help: if you import `create_lookup_table`, refer to it directly
[INFO] [stdout]    |
[INFO] [stdout] 51 -             instruction::create_lookup_table(
[INFO] [stdout] 51 +             create_lookup_table(
@Mark-Simulacrum Mark-Simulacrum added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. regression-from-stable-to-beta Performance or correctness regression from stable to beta. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc labels Oct 22, 2023
@Mark-Simulacrum Mark-Simulacrum added this to the 1.74.0 milestone Oct 22, 2023
@rustbot rustbot added I-prioritize Issue: Indicates that prioritization has been requested for this issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Oct 22, 2023
@apiraino
Copy link
Contributor

I bisected to something different (if my bisection is correct): rollup eb76764 and specifically it says "Regression in rust-lang-ci@7e4f5ec" so cc @jhpratt ?

searched nightlies: from nightly-2023-04-30 to nightly-2023-10-23
regressed nightly: nightly-2023-06-29
searched commit range: 5ea6668...5bd28f5
regressed commit: eb76764

bisected with cargo-bisect-rustc v0.6.7

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc 2023-04-30 --regress error -- check 

@apiraino apiraino removed the E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc label Oct 23, 2023
@apiraino
Copy link
Contributor

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-high

@rustbot rustbot added P-high High priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Oct 23, 2023
@lqd
Copy link
Member

lqd commented Oct 23, 2023

@apiraino That rollup landed in 1.72.

@lqd
Copy link
Member

lqd commented Oct 23, 2023

As mark suggests there are different sources here. I haven't checked all of them, but the last 3 look like this:

@jhpratt
Copy link
Member

jhpratt commented Oct 23, 2023

I haven't had anything land in this release cycle, so a bisection that leads to me must be incorrect.

@compiler-errors
Copy link
Member

I'll investigate luminance-{,web}gl tomorrow.

@apiraino
Copy link
Contributor

thanks @lqd (and sorry for the wrong bisection and ping)

@jhpratt
Copy link
Member

jhpratt commented Oct 24, 2023

No worries!

@wesleywiser
Copy link
Member

Bisected nosana-ci.nosana-jobs:

searched toolchains b053db2 through b11431e

Regression in 735bb7e

@apiraino
Copy link
Contributor

thanks @wesleywiser. Also tagging @bvanjoi about this beta regression since author of #115269

@lqd
Copy link
Member

lqd commented Oct 26, 2023

@bvanjoi
Copy link
Contributor

bvanjoi commented Oct 27, 2023

reduced for hamesterswap:

mod b {
  pub mod instruction {
    pub fn b() {}
  }
}

use b::*;

macro_rules! m {
  () => {
    pub mod instruction {
      pub fn a() {}
    }        
  };
}


// the `hamesterswap-program` uses a procedural macro to generate the instruction module.
// I believe its effect is similar to that of declarative macros
m!();


mod mm {
  use crate::*;
  fn f() {
    instruction::b();
  }
}

I think this is the expected behavior.

@bvanjoi
Copy link
Contributor

bvanjoi commented Oct 27, 2023

reduced for ratio-staking:

// rustc code.rs --cfg 'feature="cpi"'
mod common {
  pub mod cpi {
    pub fn a() {} 
  }

  pub mod macros {
    #[macro_export]
    macro_rules! g {
        () => {
          cpi::a()
        }
    }
  }
}

use common::*;

macro_rules! m {
  () => {
    #[cfg(feature = "cpi")]
    pub mod cpi {
      pub fn b() {}
    }
  };
}

m!();

mod instructions {
  mod stake {
    use crate::*;    
    fn f() {
      g!()
    }
  }
}

I also think that this is the anticipated behavior

Moreover, nosana-jobs employs the same logic as this.

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 28, 2023
bors added a commit to rust-lang-ci/rust that referenced this issue Nov 4, 2023
…try>

Make sure that predicates with unmentioned bound vars are still considered global in the old solver

In the old solver, we consider predicates with late-bound vars to not be "global":
https://github.com/rust-lang/rust/blob/9c8a2694fadf3900c4d7880f6357cee60e9aa39b/compiler/rustc_trait_selection/src/traits/select/mod.rs#L1840-L1844

The implementation of `has_late_bound_vars` was modified in rust-lang#115834 so that we'd properly anonymize binders that had late-bound vars but didn't reference them. This fixed an ICE.

However, this also led to a behavioral change in rust-lang#117056 (comment) for a couple of crates, which now consider `for<'a> GL33: Shader` (note the binder var that is *not* used in the predicate) to not be "global". This forces associated types to not be normalizable due to the old trait solver being dumb.

This PR distinguishes types which *reference* late-bound vars and binders which *have* late-bound vars. The latter is represented with the new type flag `TypeFlags::HAS_BINDER_VARS`, which is used when we only care about knowing whether binders have vars in their bound var list (even if they're not used, like for binder anonymization).

This should fix (after beta backport) the `luminance-gl` and `luminance-webgl` crates in rust-lang#117056.

r? types
**(priority is kinda high on a review here given beta becomes stable on November 16.)**
bors added a commit to rust-lang-ci/rust that referenced this issue Nov 4, 2023
…try>

Make sure that predicates with unmentioned bound vars are still considered global in the old solver

In the old solver, we consider predicates with late-bound vars to not be "global":
https://github.com/rust-lang/rust/blob/9c8a2694fadf3900c4d7880f6357cee60e9aa39b/compiler/rustc_trait_selection/src/traits/select/mod.rs#L1840-L1844

The implementation of `has_late_bound_vars` was modified in rust-lang#115834 so that we'd properly anonymize binders that had late-bound vars but didn't reference them. This fixed an ICE.

However, this also led to a behavioral change in rust-lang#117056 (comment) for a couple of crates, which now consider `for<'a> GL33: Shader` (note the binder var that is *not* used in the predicate) to not be "global". This forces associated types to not be normalizable due to the old trait solver being dumb.

This PR distinguishes types which *reference* late-bound vars and binders which *have* late-bound vars. The latter is represented with the new type flag `TypeFlags::HAS_BINDER_VARS`, which is used when we only care about knowing whether binders have vars in their bound var list (even if they're not used, like for binder anonymization).

This should fix (after beta backport) the `luminance-gl` and `luminance-webgl` crates in rust-lang#117056.

r? types
**(priority is kinda high on a review here given beta becomes stable on November 16.)**
bors added a commit to rust-lang-ci/rust that referenced this issue Nov 5, 2023
…ackh726

Make sure that predicates with unmentioned bound vars are still considered global in the old solver

In the old solver, we consider predicates with late-bound vars to not be "global":
https://github.com/rust-lang/rust/blob/9c8a2694fadf3900c4d7880f6357cee60e9aa39b/compiler/rustc_trait_selection/src/traits/select/mod.rs#L1840-L1844

The implementation of `has_late_bound_vars` was modified in rust-lang#115834 so that we'd properly anonymize binders that had late-bound vars but didn't reference them. This fixed an ICE.

However, this also led to a behavioral change in rust-lang#117056 (comment) for a couple of crates, which now consider `for<'a> GL33: Shader` (note the binder var that is *not* used in the predicate) to not be "global". This forces associated types to not be normalizable due to the old trait solver being dumb.

This PR distinguishes types which *reference* late-bound vars and binders which *have* late-bound vars. The latter is represented with the new type flag `TypeFlags::HAS_BINDER_VARS`, which is used when we only care about knowing whether binders have vars in their bound var list (even if they're not used, like for binder anonymization).

This should fix (after beta backport) the `luminance-gl` and `luminance-webgl` crates in rust-lang#117056.

r? types
**(priority is kinda high on a review here given beta becomes stable on November 16.)**
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Nov 15, 2023
Make sure that predicates with unmentioned bound vars are still considered global in the old solver

In the old solver, we consider predicates with late-bound vars to not be "global":
https://github.com/rust-lang/rust/blob/9c8a2694fadf3900c4d7880f6357cee60e9aa39b/compiler/rustc_trait_selection/src/traits/select/mod.rs#L1840-L1844

The implementation of `has_late_bound_vars` was modified in #115834 so that we'd properly anonymize binders that had late-bound vars but didn't reference them. This fixed an ICE.

However, this also led to a behavioral change in rust-lang/rust#117056 (comment) for a couple of crates, which now consider `for<'a> GL33: Shader` (note the binder var that is *not* used in the predicate) to not be "global". This forces associated types to not be normalizable due to the old trait solver being dumb.

This PR distinguishes types which *reference* late-bound vars and binders which *have* late-bound vars. The latter is represented with the new type flag `TypeFlags::HAS_BINDER_VARS`, which is used when we only care about knowing whether binders have vars in their bound var list (even if they're not used, like for binder anonymization).

This should fix (after beta backport) the `luminance-gl` and `luminance-webgl` crates in #117056.

r? types
**(priority is kinda high on a review here given beta becomes stable on November 16.)**
@apiraino
Copy link
Contributor

A few fixes landed since a few weeks. Can this issue be closed?

@wesleywiser wesleywiser added regression-from-stable-to-stable Performance or correctness regression from one stable version to another. and removed regression-from-stable-to-beta Performance or correctness regression from stable to beta. labels Dec 28, 2023
@wesleywiser
Copy link
Member

Revisting, of the 6 crater failures found above, two have been fixed leaving the following:

The first three are all instances of the same underlying issue and the fourth was known to be a bug fix. It sounds like this is anticipated fallout from the change to fix issues in macro expansion and a PR has been submitted the active project in that set. I'm therefore going to close this issue.

lnicola pushed a commit to lnicola/rust-analyzer that referenced this issue Apr 7, 2024
Make sure that predicates with unmentioned bound vars are still considered global in the old solver

In the old solver, we consider predicates with late-bound vars to not be "global":
https://github.com/rust-lang/rust/blob/9c8a2694fadf3900c4d7880f6357cee60e9aa39b/compiler/rustc_trait_selection/src/traits/select/mod.rs#L1840-L1844

The implementation of `has_late_bound_vars` was modified in #115834 so that we'd properly anonymize binders that had late-bound vars but didn't reference them. This fixed an ICE.

However, this also led to a behavioral change in rust-lang/rust#117056 (comment) for a couple of crates, which now consider `for<'a> GL33: Shader` (note the binder var that is *not* used in the predicate) to not be "global". This forces associated types to not be normalizable due to the old trait solver being dumb.

This PR distinguishes types which *reference* late-bound vars and binders which *have* late-bound vars. The latter is represented with the new type flag `TypeFlags::HAS_BINDER_VARS`, which is used when we only care about knowing whether binders have vars in their bound var list (even if they're not used, like for binder anonymization).

This should fix (after beta backport) the `luminance-gl` and `luminance-webgl` crates in #117056.

r? types
**(priority is kinda high on a review here given beta becomes stable on November 16.)**
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this issue Apr 27, 2024
Make sure that predicates with unmentioned bound vars are still considered global in the old solver

In the old solver, we consider predicates with late-bound vars to not be "global":
https://github.com/rust-lang/rust/blob/9c8a2694fadf3900c4d7880f6357cee60e9aa39b/compiler/rustc_trait_selection/src/traits/select/mod.rs#L1840-L1844

The implementation of `has_late_bound_vars` was modified in #115834 so that we'd properly anonymize binders that had late-bound vars but didn't reference them. This fixed an ICE.

However, this also led to a behavioral change in rust-lang/rust#117056 (comment) for a couple of crates, which now consider `for<'a> GL33: Shader` (note the binder var that is *not* used in the predicate) to not be "global". This forces associated types to not be normalizable due to the old trait solver being dumb.

This PR distinguishes types which *reference* late-bound vars and binders which *have* late-bound vars. The latter is represented with the new type flag `TypeFlags::HAS_BINDER_VARS`, which is used when we only care about knowing whether binders have vars in their bound var list (even if they're not used, like for binder anonymization).

This should fix (after beta backport) the `luminance-gl` and `luminance-webgl` crates in #117056.

r? types
**(priority is kinda high on a review here given beta becomes stable on November 16.)**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

9 participants