Issue 89275 fix and test
Issue 89275 fix and test Fix librustdoc OverflowError usage rust tidy run Issue 89275 fix and test
This commit is contained in:
parent
25ec827385
commit
0950d5afe2
10 changed files with 82 additions and 18 deletions
29
src/test/ui/typeck/issue-89275.rs
Normal file
29
src/test/ui/typeck/issue-89275.rs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#![recursion_limit = "5"] // To reduce noise
|
||||
|
||||
//expect mutability error when ambiguous traits are in scope
|
||||
//and not an overflow error on the span in the main function.
|
||||
|
||||
struct Ratio<T>(T);
|
||||
|
||||
pub trait Pow {
|
||||
fn pow(self) -> Self;
|
||||
}
|
||||
|
||||
impl<'a, T> Pow for &'a Ratio<T>
|
||||
where
|
||||
&'a T: Pow,
|
||||
{
|
||||
fn pow(self) -> Self {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
fn downcast<'a, W: ?Sized>() -> &'a W {
|
||||
todo!()
|
||||
}
|
||||
|
||||
struct Other;
|
||||
|
||||
fn main() {
|
||||
let other: &mut Other = downcast();//~ERROR 28:29: 28:39: mismatched types [E0308]
|
||||
}
|
||||
14
src/test/ui/typeck/issue-89275.stderr
Normal file
14
src/test/ui/typeck/issue-89275.stderr
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-89275.rs:28:29
|
||||
|
|
||||
LL | let other: &mut Other = downcast();
|
||||
| ---------- ^^^^^^^^^^ types differ in mutability
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
= note: expected mutable reference `&mut Other`
|
||||
found reference `&_`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue