forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stop special-casing
'static
in evaluate
- Loading branch information
Showing
7 changed files
with
151 additions
and
102 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
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
6 changes: 5 additions & 1 deletion
6
tests/ui/marker_trait_attr/overlap-marker-trait-with-static-lifetime.rs
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
31 changes: 31 additions & 0 deletions
31
tests/ui/marker_trait_attr/overlap-marker-trait-with-static-lifetime.stderr
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,31 @@ | ||
error[E0283]: type annotations needed: cannot satisfy `&'static (): Marker` | ||
--> $DIR/overlap-marker-trait-with-static-lifetime.rs:11:17 | ||
| | ||
LL | impl Marker for &'static () {} | ||
| ^^^^^^^^^^^ | ||
| | ||
note: multiple `impl`s satisfying `&'static (): Marker` found | ||
--> $DIR/overlap-marker-trait-with-static-lifetime.rs:11:1 | ||
| | ||
LL | impl Marker for &'static () {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
LL | impl Marker for &'static () {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error[E0283]: type annotations needed: cannot satisfy `&'static (): Marker` | ||
--> $DIR/overlap-marker-trait-with-static-lifetime.rs:12:17 | ||
| | ||
LL | impl Marker for &'static () {} | ||
| ^^^^^^^^^^^ | ||
| | ||
note: multiple `impl`s satisfying `&'static (): Marker` found | ||
--> $DIR/overlap-marker-trait-with-static-lifetime.rs:11:1 | ||
| | ||
LL | impl Marker for &'static () {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
LL | impl Marker for &'static () {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0283`. |
14 changes: 11 additions & 3 deletions
14
tests/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.rs
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,9 +1,17 @@ | ||
// check-pass | ||
// known-bug: #109481 | ||
// | ||
// While the `T: Copy` is always applicable when checking | ||
// that the impl `impl<T: Copy> F for T {}` is well formed, | ||
// the old trait solver can only approximate this by checking | ||
// that there are no inference variables in the obligation and | ||
// no region constraints in the evaluation result. | ||
// | ||
// Because of this we end up with ambiguity here. | ||
#![feature(marker_trait_attr)] | ||
|
||
#[marker] | ||
pub trait F {} | ||
impl<T> F for T where T: Copy {} | ||
impl<T> F for T where T: 'static {} | ||
impl<T: Copy> F for T {} | ||
impl<T: 'static> F for T {} | ||
|
||
fn main() {} |
14 changes: 14 additions & 0 deletions
14
tests/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.stderr
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,14 @@ | ||
error[E0310]: the parameter type `T` may not live long enough | ||
--> $DIR/overlapping-impl-1-modulo-regions.rs:14:21 | ||
| | ||
LL | impl<T: Copy> F for T {} | ||
| ^ ...so that the type `T` will meet its required lifetime bounds | ||
| | ||
help: consider adding an explicit lifetime bound... | ||
| | ||
LL | impl<T: Copy + 'static> F for T {} | ||
| +++++++++ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0310`. |