Skip to content

rustc doesn't output anything but exits with 101 and doesn't emit any files #52913

Closed

Description

@LukasKalbertodt
trait Foo {
    type Out;
}

impl<T> Foo for Box<T> {
    type Out where T: Clone = T;
}

fn main() {}

Compiling this code results in no output by rustc. But rustc exits with 101 and does not produce any artifacts. (On Playground)

The error happens with:

  • rustc 1.27.1 (5f2b325f6 2018-07-07),
  • rustc 1.27.2 (58cc626de 2018-07-18), and
  • rustc 1.29.0-nightly (874dec25e 2018-07-21)

Activity

  1. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    C-bugCategory: This is a bug.
    on Jul 31, 2018
  2. shepmaster commented on Jul 31, 2018

    @shepmaster
    Member
    $ rustc -Z time-passes a.rs
      time: 0.001	parsing
      time: 0.000	recursion limit
      time: 0.000	crate injection
      time: 0.000	plugin loading
      time: 0.000	plugin registration
      time: 0.000	pre ast expansion lint checks
        time: 0.037	expand crate
        time: 0.000	check unused macros
      time: 0.037	expansion
      time: 0.000	maybe building test harness
      time: 0.000	maybe creating a macro crate
      time: 0.000	creating allocators
      time: 0.000	AST validation
      time: 0.000	name resolution
      time: 0.000	complete gated feature checking
      time: 0.000	lowering ast -> hir
      time: 0.000	early lint checks
      time: 0.000	indexing hir
      time: 0.000	load query result cache
      time: 0.000	looking for entry point
      time: 0.000	looking for plugin registrar
      time: 0.000	loop checking
      time: 0.000	attribute checking
      time: 0.000	stability checking
    

    If I set breakpoints on

    • rustc::middle::stability::check_unstable_api_usage
    • rustc_typeck::check_crate
    • rustc_passes::rvalue_promotion::check_crate

    It hits the first two but not the third, seemingly pointing to rustc_typeck::check_crate returning an Err.

  3. kennytm commented on Aug 1, 2018

    @kennytm
    Member

    The silent exit is a regression. From godbolt,

    • 1.23.0

      error: expected `=`, found `where`
       --> <source>:6:14
        |
      6 |     type Out where T: Clone = T;
        |              ^^^^^
      error[E0046]: not all trait items implemented, missing: `Out`
       --> <source>:5:1
        |
      2 |       type Out;
        |       --------- `Out` from trait
      ...
      5 | / impl<T> Foo for Box<T> {
      6 | |     type Out where T: Clone = T;
      7 | | }
        | |_^ missing `Out` in implementation
      error: aborting due to 2 previous errors
      

      exit code = 101

    • 1.24.0–1.25.0

      error: cannot continue compilation due to previous error
      

      exit code = 101

    • 1.26.0–1.28.0(beta)

      No message, exit code = 101

    • 1.29.0(nightly)

      No message, exit code = 1

  4. Mark-Simulacrum commented on Aug 1, 2018

    @Mark-Simulacrum
    Member

    cc @rust-lang/compiler -- it'd be good to find out why we stopped providing any output at all here

  5. estebank commented on Aug 1, 2018

    @estebank
    Contributor

    I'm worried it might be one of my parser changes to provide better diagnostics... I would probably check for any odd looking err.cancel().

  6. estebank commented on Aug 1, 2018

    @estebank
    Contributor

    self.parse_trait_item_assoc_ty()?

    /// Parses the following grammar:
    /// TraitItemAssocTy = Ident ["<"...">"] [":" [GenericBounds]] ["where" ...] ["=" Ty]
    fn parse_trait_item_assoc_ty(&mut self)
    -> PResult<'a, (Ident, TraitItemKind, ast::Generics)> {
    let ident = self.parse_ident()?;
    let mut generics = self.parse_generics()?;
    // Parse optional colon and param bounds.
    let bounds = if self.eat(&token::Colon) {
    self.parse_generic_bounds()?
    } else {
    Vec::new()
    };
    generics.where_clause = self.parse_where_clause()?;
    let default = if self.eat(&token::Eq) {
    Some(self.parse_ty()?)
    } else {
    None
    };
    self.expect(&token::Semi)?;
    Ok((ident, TraitItemKind::Type(bounds, default), generics))
    }

  7. estebank commented on Aug 1, 2018

    @estebank
    Contributor

    It's not the parsing itself, it's that in 1.24 the feature was introduced: #45904.

  8. nikomatsakis commented on Aug 9, 2018

    @nikomatsakis
    Contributor

    @estebank do you think you see what the problem is?

  9. nikomatsakis commented on Aug 9, 2018

    @nikomatsakis
    Contributor

    Calling P-high but we don't yet have an obvious assignee. Still, seems bad that there is no diagnostic output at all! Not a good look.

  10. varkor commented on Aug 9, 2018

    @varkor
    Contributor

    The core issue is reported in #47206. However, the example here also demonstrates that where clauses aren't being feature gated properly.

  11. varkor commented on Aug 9, 2018

    @varkor
    Contributor

    I've made #53235 to address the surface problem, which is that you can trigger this on stable, without declaring the generic_associated_types feature. I thought it was better to fix that part of the problem straight away.

  12. varkor commented on Aug 9, 2018

    @varkor
    Contributor

    Narrowing it down a little more:

    hir::TyKind::Path(hir::QPath::Resolved(ref maybe_qself, ref path)) => {
    debug!("ast_ty_to_ty: maybe_qself={:?} path={:?}", maybe_qself, path);
    let opt_self_ty = maybe_qself.as_ref().map(|qself| {
    self.ast_ty_to_ty(qself)
    });
    self.def_to_ty(opt_self_ty, path, false)
    }

    path.def is Def::Err at this point when the where clauses are defined, so something's going wrong before that point.

  13. added a commit that references this issue on Aug 22, 2018
    e3668a3
  14. added
    A-GATsArea: Generic associated types (GATs)
    on Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-GATsArea: Generic associated types (GATs)C-bugCategory: This is a bug.F-generic_associated_types`#![feature(generic_associated_types)]` a.k.a. GATsP-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions