diff options
Diffstat (limited to 'src/test/ui')
| -rw-r--r-- | src/test/ui/nll/user-annotations/issue-55219.rs | 20 | ||||
| -rw-r--r-- | src/test/ui/nll/user-annotations/issue-55241.rs | 28 | ||||
| -rw-r--r-- | src/test/ui/regions/regions-free-region-ordering-caller1.nll.stderr | 19 |
3 files changed, 50 insertions, 17 deletions
diff --git a/src/test/ui/nll/user-annotations/issue-55219.rs b/src/test/ui/nll/user-annotations/issue-55219.rs new file mode 100644 index 00000000000..7daa5a59b99 --- /dev/null +++ b/src/test/ui/nll/user-annotations/issue-55219.rs @@ -0,0 +1,20 @@ +// Regression test for #55219: +// +// The `Self::HASH_LEN` here expands to a "self-type" where `T` is not +// known. This unbound inference variable was causing an ICE. +// +// run-pass + +#![feature(nll)] + +pub struct Foo<T>(T); + +impl<T> Foo<T> { + const HASH_LEN: usize = 20; + + fn stuff() { + let _ = Self::HASH_LEN; + } +} + +fn main() { } diff --git a/src/test/ui/nll/user-annotations/issue-55241.rs b/src/test/ui/nll/user-annotations/issue-55241.rs new file mode 100644 index 00000000000..e5600803df8 --- /dev/null +++ b/src/test/ui/nll/user-annotations/issue-55241.rs @@ -0,0 +1,28 @@ +// Regression test for #55241: +// +// The reference to `C::HASHED_NULL_NODE` resulted in a type like `<C +// as NodeCodec<_>>::Out`; normalizing this type requires knowing the +// value of `_`; solving that requires having normalized, so we can +// test against `C: NodeCodec<H>` in the environment. +// +// run-pass + +#![feature(nll)] + +pub trait Hasher { + type Out: Eq; +} + +pub trait NodeCodec<H: Hasher> { + const HASHED_NULL_NODE: H::Out; +} + +pub trait Trie<H: Hasher, C: NodeCodec<H>> { + /// Return the root of the trie. + fn root(&self) -> &H::Out; + + /// Is the trie empty? + fn is_empty(&self) -> bool { *self.root() == C::HASHED_NULL_NODE } +} + +fn main() { } diff --git a/src/test/ui/regions/regions-free-region-ordering-caller1.nll.stderr b/src/test/ui/regions/regions-free-region-ordering-caller1.nll.stderr index c6bd5b7fa0d..39f193c55f7 100644 --- a/src/test/ui/regions/regions-free-region-ordering-caller1.nll.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-caller1.nll.stderr @@ -12,21 +12,6 @@ LL | let z: &'a & usize = &(&y); LL | } | - temporary value is freed at the end of this statement -error[E0597]: `y` does not live long enough - --> $DIR/regions-free-region-ordering-caller1.rs:19:27 - | -LL | fn call1<'a>(x: &'a usize) { - | -- lifetime `'a` defined here -... -LL | let z: &'a & usize = &(&y); - | ----------- ^^^^ borrowed value does not live long enough - | | - | type annotation requires that `y` is borrowed for `'a` -... -LL | } - | - `y` dropped here while still borrowed - -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors occurred: E0597, E0716. -For more information about an error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0716`. |
