-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deduplicate errors in the obligation forest.
Fixes #40827.
- Loading branch information
Showing
5 changed files
with
162 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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::rc::Rc; | ||
use std::sync::Arc; | ||
|
||
struct Foo(Arc<Bar>); | ||
|
||
enum Bar { | ||
A(Rc<Foo>), | ||
B(Option<Foo>), | ||
} | ||
|
||
fn f<T: Send>(_: T) {} | ||
|
||
fn main() { | ||
f(Foo(Arc::new(Bar::B(None)))); | ||
//~^ ERROR E0277 | ||
//~| ERROR E0277 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
error[E0277]: `std::rc::Rc<Foo>` cannot be sent between threads safely | ||
--> $DIR/issue-40827.rs:24:5 | ||
| | ||
LL | f(Foo(Arc::new(Bar::B(None)))); | ||
| ^ `std::rc::Rc<Foo>` cannot be sent between threads safely | ||
| | ||
= help: within `Bar`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<Foo>` | ||
= note: required because it appears within the type `Bar` | ||
= note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc<Bar>` | ||
= note: required because it appears within the type `Foo` | ||
note: required by `f` | ||
--> $DIR/issue-40827.rs:21:1 | ||
| | ||
LL | fn f<T: Send>(_: T) {} | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
|
||
error[E0277]: `std::rc::Rc<Foo>` cannot be shared between threads safely | ||
--> $DIR/issue-40827.rs:24:5 | ||
| | ||
LL | f(Foo(Arc::new(Bar::B(None)))); | ||
| ^ `std::rc::Rc<Foo>` cannot be shared between threads safely | ||
| | ||
= help: within `Bar`, the trait `std::marker::Sync` is not implemented for `std::rc::Rc<Foo>` | ||
= note: required because it appears within the type `Bar` | ||
= note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc<Bar>` | ||
= note: required because it appears within the type `Foo` | ||
note: required by `f` | ||
--> $DIR/issue-40827.rs:21:1 | ||
| | ||
LL | fn f<T: Send>(_: T) {} | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0277`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,33 @@ | ||
error[E0275]: overflow evaluating the requirement `Foo: std::marker::Sync` | ||
error[E0277]: `*const Bar` cannot be shared between threads safely | ||
--> $DIR/recursive-requirements.rs:26:12 | ||
| | ||
LL | let _: AssertSync<Foo> = unimplemented!(); //~ ERROR E0275 | ||
| ^^^^^^^^^^^^^^^ | ||
LL | let _: AssertSync<Foo> = unimplemented!(); | ||
| ^^^^^^^^^^^^^^^ `*const Bar` cannot be shared between threads safely | ||
| | ||
= help: consider adding a `#![recursion_limit="128"]` attribute to your crate | ||
= note: required because it appears within the type `std::marker::PhantomData<Foo>` | ||
= help: within `Foo`, the trait `std::marker::Sync` is not implemented for `*const Bar` | ||
= note: required because it appears within the type `Foo` | ||
note: required by `AssertSync` | ||
--> $DIR/recursive-requirements.rs:13:1 | ||
| | ||
LL | struct AssertSync<T: Sync>(PhantomData<T>); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error[E0277]: `*const Foo` cannot be shared between threads safely | ||
--> $DIR/recursive-requirements.rs:26:12 | ||
| | ||
LL | let _: AssertSync<Foo> = unimplemented!(); | ||
| ^^^^^^^^^^^^^^^ `*const Foo` cannot be shared between threads safely | ||
| | ||
= help: within `Foo`, the trait `std::marker::Sync` is not implemented for `*const 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` | ||
note: required by `AssertSync` | ||
--> $DIR/recursive-requirements.rs:13:1 | ||
| | ||
LL | struct AssertSync<T: Sync>(PhantomData<T>); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0275`. | ||
For more information about this error, try `rustc --explain E0277`. |