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

"can't use generic parameters from outer function" only when in nightly #111541

Closed
b-paul opened this issue May 13, 2023 · 3 comments · Fixed by #111557
Closed

"can't use generic parameters from outer function" only when in nightly #111541

b-paul opened this issue May 13, 2023 · 3 comments · Fixed by #111557
Assignees
Labels
C-bug Category: This is a bug. P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@b-paul
Copy link

b-paul commented May 13, 2023

Code

I made a blank cargo project (ran cargo init in an empty directory), and added dependencies to my Cargo.toml like so:

[package]
name = "typst-test"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
typst = { git = "https://github.com/typst/typst.git" }
typst-library = { git = "https://github.com/typst/typst.git" }

Originally when I went to run RUSTFLAGS="-Z macro-backtrace" cargo build, I was in nightly, and got a compile error error[E0401]: can't use generic parameters from outer function (full error below). Then, when i switched to stable, there was no error and everything built fine!

 > RUSTFLAGS="-Z macro-backtrace" cargo b
   Compiling hayagriva v0.3.0
   Compiling typst v0.3.0 (https://github.com/typst/typst.git#4b17c3f5)
error[E0401]: can't use generic parameters from outer function
   --> /home/bpaul/.cargo/git/checkouts/typst-6808799b0d8fdaa9/4b17c3f/src/model/content.rs:545:1
    |
545 | #[element]
    | ^^^^^^^^^^
    | |
    | use of generic parameter from outer function
    | can't use `Self` here
    | in this procedural macro expansion
    |
   ::: /home/bpaul/.cargo/git/checkouts/typst-6808799b0d8fdaa9/4b17c3f/macros/src/lib.rs:31:1
    |
31  | pub fn element(stream: BoundaryStream, item: BoundaryStream) -> BoundaryStream {
    | ------------------------------------------------------------------------------ in this expansion of `#[element]`

error[E0401]: can't use generic parameters from outer function
   --> /home/bpaul/.cargo/git/checkouts/typst-6808799b0d8fdaa9/4b17c3f/src/model/content.rs:550:1
    |
550 | #[element]
    | ^^^^^^^^^^
    | |
    | use of generic parameter from outer function
    | can't use `Self` here
    | in this procedural macro expansion
    |
   ::: /home/bpaul/.cargo/git/checkouts/typst-6808799b0d8fdaa9/4b17c3f/macros/src/lib.rs:31:1
    |
31  | pub fn element(stream: BoundaryStream, item: BoundaryStream) -> BoundaryStream {
    | ------------------------------------------------------------------------------ in this expansion of `#[element]`

error[E0401]: can't use generic parameters from outer function
   --> /home/bpaul/.cargo/git/checkouts/typst-6808799b0d8fdaa9/4b17c3f/src/model/content.rs:557:1
    |
557 | #[element(Behave)]
    | ^^^^^^^^^^^^^^^^^^
    | |
    | use of generic parameter from outer function
    | can't use `Self` here
    | in this procedural macro expansion
    |
   ::: /home/bpaul/.cargo/git/checkouts/typst-6808799b0d8fdaa9/4b17c3f/macros/src/lib.rs:31:1
    |
31  | pub fn element(stream: BoundaryStream, item: BoundaryStream) -> BoundaryStream {
    | ------------------------------------------------------------------------------ in this expansion of `#[element]`

For more information about this error, try `rustc --explain E0401`.
error: could not compile `typst` (lib) due to 3 previous errors
warning: build failed, waiting for other jobs to finish...

Version it worked on

It most recently worked on: Rust 1.69

Version with regression

rustc --version --verbose:

rustc 1.71.0-nightly (4a59ba4d5 2023-05-12)
binary: rustc
commit-hash: 4a59ba4d54a3ec0d8ea1e82b7eeb5c8b0162de04
commit-date: 2023-05-12
host: x86_64-unknown-linux-gnu
release: 1.71.0-nightly
LLVM version: 16.0.2

@rustbot modify labels: +regression-from-stable-to-nightly -regression-untriaged

@b-paul b-paul added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels May 13, 2023
@rustbot rustbot added I-prioritize Issue: Indicates that prioritization has been requested for this issue. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. and removed regression-untriaged Untriaged performance or correctness regression. labels May 13, 2023
@Noratrieb
Copy link
Member

searched nightlies: from nightly-2023-02-15 to nightly-2023-05-13
regressed nightly: nightly-2023-05-05
searched commit range: 473f916...74c4821
regressed commit: eac3558

bisected with cargo-bisect-rustc v0.6.6

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

cargo bisect-rustc 2023-02-15 --access github

rollup #111174

it didn't want to bisect the perf builds for some reason but i guess #111020 or #111103 could be at fault? haven't looked into the actual issue in detail, since it's behind a macro

@cjgillot @BoxyUwU you probably know something about this anyways even if it may not be your fault

@BoxyUwU
Copy link
Member

BoxyUwU commented May 13, 2023

its not #111103 that is generic_const_exprs only code

@apiraino
Copy link
Contributor

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-high +T-compiler

@rustbot rustbot added P-high High priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels May 16, 2023
@bors bors closed this as completed in ff364b0 May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants