Skip to content

FAQ links in error messages #2092

Closed
Closed
@nikomatsakis

Description

@nikomatsakis
Contributor

On IRC we were discussing how, for complex errors, we ought to put a link to a FAQ in the error message. Perhaps we could even embed the rust manual and print the relevant paragraph if you use rustc --explain or something.

Some examples of errors that could benefit:

  • ret disallowed from within sugared closure {|| ... }
  • ; required after a statement with non-unit type
  • etc.

This of course would also entail making such a FAQ. :)

Activity

brson

brson commented on Apr 1, 2012

@brson
Contributor

I think this could be really cool, and possibly useful, and has a lot of possibilities. it would be nice if every error had a specific link into the rust documentation for retrieving more info.

brson

brson commented on Apr 24, 2013

@brson
Contributor

A start to this would simply be adding a way to associate specific errors with stable ids. One possible design would be to create two enums, one in syntax and one in rustc:

enum Errors {
    AliasedMutableLocationError,
    etc.
}

Make it implement a trait, NamedError that converts the enum to a crate ID (either syntax or rustc)and an error ID (the enum value).

Then add a transaction API to diagnostics that takes a NamedError, then lets you emit any number of messages related to that error.

alexcrichton

alexcrichton commented on May 7, 2013

@alexcrichton
Member

Just to make sure this was here, I also think it would be great to have example code proving that the check is necessary. Basically some code which shows that if a check weren't in place, the code would crash or it wouldn't be sound in some way.

While I'm at it, I'll also nominate for the production-ready milestone. This would be super-helpful to anyone new to rust.

graydon

graydon commented on May 30, 2013

@graydon
Contributor

see also #6806

graydon

graydon commented on May 30, 2013

@graydon
Contributor

accepted for production-ready milestone

emberian

emberian commented on Aug 1, 2013

@emberian
Member

Triage bump

bblum

bblum commented on Oct 20, 2013

@bblum
Contributor

i noted in the above issue that a good use case for this would be explaining what the send, etc kinds mean.

catamorphism

catamorphism commented on Oct 24, 2013

@catamorphism
Contributor

High, but 1.0. Extra goodwill for anyone who implements this!

emberian

emberian commented on Oct 24, 2013

@emberian
Member

I was thinking how to implement this the other day actually. Every class of error needs a unique ID first, and a way to expose them when doing span_err etc. Once that infrastructure is in place we can actually have a usable FAQ.

brson

brson commented on Jan 10, 2014

@brson
Contributor

I'm starting a patch to do this.

ghost assigned on Jan 10, 2014

12 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-frontendArea: Compiler frontend (errors, parsing and HIR)P-mediumMedium priority

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @graydon@steveklabnik@alexcrichton@brson@nikomatsakis

      Issue actions

        FAQ links in error messages · Issue #2092 · rust-lang/rust