Optimized error reporting for recursive requirements #47720
This commit is contained in:
parent
6272b60dca
commit
80b8c808ba
3 changed files with 72 additions and 9 deletions
27
src/test/ui/recursive-requirements.rs
Normal file
27
src/test/ui/recursive-requirements.rs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::marker::PhantomData;
|
||||
|
||||
struct AssertSync<T: Sync>(PhantomData<T>);
|
||||
|
||||
pub struct Foo {
|
||||
bar: *const Bar,
|
||||
phantom: PhantomData<Bar>,
|
||||
}
|
||||
|
||||
pub struct Bar {
|
||||
foo: *const Foo,
|
||||
phantom: PhantomData<Foo>,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let _: AssertSync<Foo> = unimplemented!(); //~ ERROR E0275
|
||||
}
|
||||
14
src/test/ui/recursive-requirements.stderr
Normal file
14
src/test/ui/recursive-requirements.stderr
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
error[E0275]: overflow evaluating the requirement `Foo: std::marker::Sync`
|
||||
--> $DIR/recursive-requirements.rs:26:12
|
||||
|
|
||||
26 | let _: AssertSync<Foo> = unimplemented!(); //~ ERROR E0275
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider adding a `#![recursion_limit="128"]` attribute to your crate
|
||||
= note: required because it appears within the type `std::marker::PhantomData<Foo>`
|
||||
= note: required because it appears within the type `Bar`
|
||||
= note: required because it appears within the type `std::marker::PhantomData<Bar>`
|
||||
= note: required because it appears within the type `Foo`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue