Skip to content

Conversation

@epage
Copy link
Contributor

@epage epage commented Nov 26, 2025

Like raw string literals. As discussed on #148051.

Part of #136889

@epage epage added the F-frontmatter `#![feature(frontmatter)]` label Nov 26, 2025
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 26, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 26, 2025

r? @davidtwco

rustbot has assigned @davidtwco.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@epage epage mentioned this pull request Nov 26, 2025
10 tasks
@rust-log-analyzer

This comment has been minimized.

@Kivooeo
Copy link
Member

Kivooeo commented Nov 26, 2025

Looks good, but... This error message seems a bit verbose, maybe we shouldn't show all this "-"'s or something, like, just say something "hey, this line is a bit longer than it should be, can you fix it"

@epage
Copy link
Contributor Author

epage commented Nov 26, 2025

For raw string literals, we show

error: too many `#` symbols: raw strings may be delimited by up to 255 `#` symbols, but found 256
  --> $DIR/too-many-hash.rs:4:19
   |
LL | ... = r###################################################...######################################;
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 1 previous error

I'm assuming this isn't being collapsed down because it is multi-line (@Muscraft maybe a potential future change for annotate-snippets).

Maybe if I switch the span to just the opening, it will look better.

@epage
Copy link
Contributor Author

epage commented Nov 26, 2025

I tried only showing the one line and it doesn't get snipped in the middle like too-many-hash.rs.

Is there a way for me to have the span without it getting rendered in my error or are you recommending I remove the span completely?

@Kivooeo
Copy link
Member

Kivooeo commented Nov 26, 2025

Is there a way for me to have the span without it getting rendered in my error or are you recommending I remove the span completely?

Honestly I don't have exact or better solution that I can suggest you here, just wondering about how can we make it less verbose

Can you show output without span completely to just see how it looks

@epage
Copy link
Contributor Author

epage commented Nov 26, 2025

I just pushed

error: too many `-` symbols: frontmatter openings may be delimited by up to 255 `-` symbols, but found 256
  --> $DIR/fence-too-many-dashes.rs:1:1
   |
LL | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 1 previous error


I'll now update it to no span

@Kivooeo
Copy link
Member

Kivooeo commented Nov 26, 2025

upd to prev message:

I like the output from too-many-hash.rs, it looks like a good solution for this PR as well!

But again, I can't help you with implementing or something since I don't know much about this in particular

@epage
Copy link
Contributor Author

epage commented Nov 26, 2025

Without a span

error: too many `-` symbols: frontmatter openings may be delimited by up to 255 `-` symbols, but found 256

error: aborting due to 1 previous error

not pushed yet as I'm looking how to handle this in the ui test

@epage
Copy link
Contributor Author

epage commented Nov 26, 2025

Found it, ~?

@Kivooeo
Copy link
Member

Kivooeo commented Nov 26, 2025

I personally think that no span is fine in case we couldn't adopt approach from fence-too-many-dashes.rs

I may take a look tomorrow on how it was made in there for hashes, it's really looks cool

I also have a conjecture about how it was made (but it's just a wild guess): it was just hard coded - suggestion always have 38 hashes on right side and 58 on left side despite amount of actual hashes, the only thing is depends on amount of hashes is last part in error message

error: too many `#` symbols: raw strings may be delimited by up to 255 `#` symbols, but found 256

But still, it looks like an actual span, maybe some magic with BytePos... Yeah I will take a look on implementation for this just out of curiosity

@epage
Copy link
Contributor Author

epage commented Nov 26, 2025

the error emitter / annotate-snippets has logic to shrink code snippets to fit on a screen. I'm unsure why it isn't activating in this case. I had wondered if there is an issue with the emitter assuming an infinite screen size for tests but I didn't see too-many-hash.rs overriding a screen size.

Copy link
Member

@davidtwco davidtwco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - this is an pretty niche error so I don't think it needs to be perfectly worded and we can always improve it in future

View changes since this review

@davidtwco
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Dec 1, 2025

📌 Commit 70b6d77 has been approved by davidtwco

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 1, 2025
bors added a commit that referenced this pull request Dec 1, 2025
Rollup of 9 pull requests

Successful merges:

 - #148690 (Implement `clamp_magnitude` method for primitive floats & signed integers)
 - #149102 (stabilize maybe_uninit_slice)
 - #149269 (cmse: do not calculate the layout of a type with infer types)
 - #149299 (Fudge infer vars in the cause code of `Obligation` intentionally)
 - #149344 (Don't suggest unwrap for Result in const)
 - #149358 (fix(parse): Limit frontmatter fences to 255 dashes )
 - #149445 (make assoc fn inherit const stability from inherent `const impl` blocks)
 - #149479 (Fix indent in E0591.md)
 - #149496 (Fix #148889: Add label rib when visiting delegation body)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit af631a5 into rust-lang:main Dec 1, 2025
11 checks passed
@rustbot rustbot added this to the 1.93.0 milestone Dec 1, 2025
rust-timer added a commit that referenced this pull request Dec 1, 2025
Rollup merge of #149358 - epage:fence-length, r=davidtwco

fix(parse): Limit frontmatter fences to 255 dashes

Like raw string literals.  As discussed on #148051.

Part of  #136889
epage added a commit to epage/cargo that referenced this pull request Dec 3, 2025
epage added a commit to epage/cargo that referenced this pull request Dec 3, 2025
github-merge-queue bot pushed a commit to rust-lang/cargo that referenced this pull request Dec 3, 2025
### What does this PR try to resolve?

Port rust-lang/rust#149358 over to Cargo

### How to test and review this PR?
@epage epage deleted the fence-length branch December 4, 2025 15:33
mattheww added a commit to mattheww/lexeywan that referenced this pull request Dec 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

F-frontmatter `#![feature(frontmatter)]` S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants