Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust 1.19 regression, treebitmap 0.2.2 #42467

Closed
brson opened this issue Jun 6, 2017 · 3 comments
Closed

Rust 1.19 regression, treebitmap 0.2.2 #42467

brson opened this issue Jun 6, 2017 · 3 comments
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta.

Comments

@brson
Copy link
Contributor

brson commented Jun 6, 2017

https://github.com/hroi/treebitmap

commit 67b8a1d591dd13a26b36519a92f5215a53c5c02e
Author: Hroi Sigurdsson <[email protected]>
Date:   Mon Jan 23 16:15:28 2017 +0100

    travis
brian@ip-10-145-43-250:/mnt2/dev⟫ rustc +nightly -Vv
rustc 1.19.0-nightly (0418fa9d3 2017-06-04)
binary: rustc
commit-hash: 0418fa9d382a47d782cc1e195c14573be9c32095
commit-date: 2017-06-04
host: x86_64-unknown-linux-gnu
release: 1.19.0-nightly
LLVM version: 4.0


brian@ip-10-145-43-250:~/dev/slate/treebitmap⟫ cargo +nightly test
   Compiling treebitmap v0.2.2 (file:///mnt2/dev/slate/treebitmap)
error[E0311]: the parameter type `T` may not live long enough
   --> src/tree_bitmap/mod.rs:479:9
    |
479 | impl<T> IntoIterator for TreeBitmap<T> {
    |         ^^^^^^^^^^^^
    |
    = help: consider adding an explicit lifetime bound for `T`
    = note: the parameter type `T` must be valid for the empty lifetime...
note: ...so that the type `T` will meet its required lifetime bounds
   --> src/tree_bitmap/mod.rs:479:9
    |
479 | impl<T> IntoIterator for TreeBitmap<T> {
    |         ^^^^^^^^^^^^

error[E0311]: the parameter type `T` may not live long enough
   --> src/tree_bitmap/mod.rs:479:9
    |
479 | impl<T> IntoIterator for TreeBitmap<T> {
    |         ^^^^^^^^^^^^
    |
    = help: consider adding an explicit lifetime bound for `T`
    = note: the parameter type `T` must be valid for the empty lifetime...
note: ...so that the type `T` will meet its required lifetime bounds
   --> src/tree_bitmap/mod.rs:479:9
    |
479 | impl<T> IntoIterator for TreeBitmap<T> {
    |         ^^^^^^^^^^^^

error[E0311]: the parameter type `T` may not live long enough
   --> src/lib.rs:259:17
    |
259 |         impl<T> IntoIterator for IpLookupTable<$addr_type, T> {
    |                 ^^^^^^^^^^^^
...
273 | impl_ops!(Ipv4Addr);
    | -------------------- in this macro invocation
    |
    = help: consider adding an explicit lifetime bound for `T`
    = note: the parameter type `T` must be valid for the empty lifetime...
note: ...so that the type `T` will meet its required lifetime bounds
   --> src/lib.rs:259:17
    |
259 |         impl<T> IntoIterator for IpLookupTable<$addr_type, T> {
    |                 ^^^^^^^^^^^^
...
273 | impl_ops!(Ipv4Addr);
    | -------------------- in this macro invocation

error[E0311]: the parameter type `T` may not live long enough
   --> src/lib.rs:259:17
    |
259 |         impl<T> IntoIterator for IpLookupTable<$addr_type, T> {
    |                 ^^^^^^^^^^^^
...
273 | impl_ops!(Ipv4Addr);
    | -------------------- in this macro invocation
    |
    = help: consider adding an explicit lifetime bound for `T`
    = note: the parameter type `T` must be valid for the empty lifetime...
note: ...so that the type `T` will meet its required lifetime bounds
   --> src/lib.rs:259:17
    |
259 |         impl<T> IntoIterator for IpLookupTable<$addr_type, T> {
    |                 ^^^^^^^^^^^^
...
273 | impl_ops!(Ipv4Addr);
    | -------------------- in this macro invocation

error[E0311]: the parameter type `T` may not live long enough
   --> src/lib.rs:259:17
    |
259 |         impl<T> IntoIterator for IpLookupTable<$addr_type, T> {
    |                 ^^^^^^^^^^^^
...
274 | impl_ops!(Ipv6Addr);
    | -------------------- in this macro invocation
    |
    = help: consider adding an explicit lifetime bound for `T`
    = note: the parameter type `T` must be valid for the empty lifetime...
note: ...so that the type `T` will meet its required lifetime bounds
   --> src/lib.rs:259:17
    |
259 |         impl<T> IntoIterator for IpLookupTable<$addr_type, T> {
    |                 ^^^^^^^^^^^^
...
274 | impl_ops!(Ipv6Addr);
    | -------------------- in this macro invocation

error[E0311]: the parameter type `T` may not live long enough
   --> src/lib.rs:259:17
    |
259 |         impl<T> IntoIterator for IpLookupTable<$addr_type, T> {
    |                 ^^^^^^^^^^^^
...
274 | impl_ops!(Ipv6Addr);
    | -------------------- in this macro invocation
    |
    = help: consider adding an explicit lifetime bound for `T`
    = note: the parameter type `T` must be valid for the empty lifetime...
note: ...so that the type `T` will meet its required lifetime bounds
   --> src/lib.rs:259:17
    |
259 |         impl<T> IntoIterator for IpLookupTable<$addr_type, T> {
    |                 ^^^^^^^^^^^^
...
274 | impl_ops!(Ipv6Addr);
    | -------------------- in this macro invocation

error: aborting due to previous error(s)

error: Could not compile `treebitmap`.
Build failed, waiting for other jobs to finish...
error[E0311]: the parameter type `T` may not live long enough
   --> src/tree_bitmap/mod.rs:479:9
    |
479 | impl<T> IntoIterator for TreeBitmap<T> {
    |         ^^^^^^^^^^^^
    |
    = help: consider adding an explicit lifetime bound for `T`
    = note: the parameter type `T` must be valid for the empty lifetime...
note: ...so that the type `T` will meet its required lifetime bounds
   --> src/tree_bitmap/mod.rs:479:9
    |
479 | impl<T> IntoIterator for TreeBitmap<T> {
    |         ^^^^^^^^^^^^

error[E0311]: the parameter type `T` may not live long enough
   --> src/tree_bitmap/mod.rs:479:9
    |
479 | impl<T> IntoIterator for TreeBitmap<T> {
    |         ^^^^^^^^^^^^
    |
    = help: consider adding an explicit lifetime bound for `T`
    = note: the parameter type `T` must be valid for the empty lifetime...
note: ...so that the type `T` will meet its required lifetime bounds
   --> src/tree_bitmap/mod.rs:479:9
    |
479 | impl<T> IntoIterator for TreeBitmap<T> {
    |         ^^^^^^^^^^^^

error[E0311]: the parameter type `T` may not live long enough
   --> src/lib.rs:259:17
    |
259 |         impl<T> IntoIterator for IpLookupTable<$addr_type, T> {
    |                 ^^^^^^^^^^^^
...
273 | impl_ops!(Ipv4Addr);
    | -------------------- in this macro invocation
    |
    = help: consider adding an explicit lifetime bound for `T`
    = note: the parameter type `T` must be valid for the empty lifetime...
note: ...so that the type `T` will meet its required lifetime bounds
   --> src/lib.rs:259:17
    |
259 |         impl<T> IntoIterator for IpLookupTable<$addr_type, T> {
    |                 ^^^^^^^^^^^^
...
273 | impl_ops!(Ipv4Addr);
    | -------------------- in this macro invocation

error[E0311]: the parameter type `T` may not live long enough
   --> src/lib.rs:259:17
    |
259 |         impl<T> IntoIterator for IpLookupTable<$addr_type, T> {
    |                 ^^^^^^^^^^^^
...
273 | impl_ops!(Ipv4Addr);
    | -------------------- in this macro invocation
    |
    = help: consider adding an explicit lifetime bound for `T`
    = note: the parameter type `T` must be valid for the empty lifetime...
note: ...so that the type `T` will meet its required lifetime bounds
   --> src/lib.rs:259:17
    |
259 |         impl<T> IntoIterator for IpLookupTable<$addr_type, T> {
    |                 ^^^^^^^^^^^^
...
273 | impl_ops!(Ipv4Addr);
    | -------------------- in this macro invocation

error[E0311]: the parameter type `T` may not live long enough
   --> src/lib.rs:259:17
    |
259 |         impl<T> IntoIterator for IpLookupTable<$addr_type, T> {
    |                 ^^^^^^^^^^^^
...
274 | impl_ops!(Ipv6Addr);
    | -------------------- in this macro invocation
    |
    = help: consider adding an explicit lifetime bound for `T`
    = note: the parameter type `T` must be valid for the empty lifetime...
note: ...so that the type `T` will meet its required lifetime bounds
   --> src/lib.rs:259:17
    |
259 |         impl<T> IntoIterator for IpLookupTable<$addr_type, T> {
    |                 ^^^^^^^^^^^^
...
274 | impl_ops!(Ipv6Addr);
    | -------------------- in this macro invocation

error[E0311]: the parameter type `T` may not live long enough
   --> src/lib.rs:259:17
    |
259 |         impl<T> IntoIterator for IpLookupTable<$addr_type, T> {
    |                 ^^^^^^^^^^^^
...
274 | impl_ops!(Ipv6Addr);
    | -------------------- in this macro invocation
    |
    = help: consider adding an explicit lifetime bound for `T`
    = note: the parameter type `T` must be valid for the empty lifetime...
note: ...so that the type `T` will meet its required lifetime bounds
   --> src/lib.rs:259:17
    |
259 |         impl<T> IntoIterator for IpLookupTable<$addr_type, T> {
    |                 ^^^^^^^^^^^^
...
274 | impl_ops!(Ipv6Addr);
    | -------------------- in this macro invocation

error: aborting due to previous error(s)

error: build failed

cc @hroi

@brson brson added the regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. label Jun 6, 2017
@Mark-Simulacrum
Copy link
Member

Bisected to 826d8f3 -- #41914 cc @eddyb

@eddyb
Copy link
Member

eddyb commented Jun 6, 2017

Reduces to (note the T: 'a with 'a not used anywhere):

struct Foo<T>(T);

struct IntoIter<T>(T);

impl<'a, T: 'a> Iterator for IntoIter<T> {
    type Item = ();

    fn next(&mut self) -> Option<()> {
        None
    }
}

impl<T> IntoIterator for Foo<T> {
    type Item = ();
    type IntoIter = IntoIter<T>;

    fn into_iter(self) -> IntoIter<T> {
        IntoIter(self.0)
    }
}

fn main() {}

cc @rust-lang/lang I thought we decided that kind of "use" of a parameter is invalid?

EDIT: @nikomatsakis tells me this was allowed for backwards compatibility (and it's harmless).

@eddyb eddyb added regression-from-stable-to-beta Performance or correctness regression from stable to beta. and removed regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Jun 6, 2017
bors added a commit that referenced this issue Jun 7, 2017
rustc: T: 'empty always holds for all types.

Fixes #42467 by special-casing `ReEmpty` to always hold, even for parameters.
The reason this is the case is that `ReEmpty` is the result of inferring a region variable with no constraints attached to it, so there is no lifetime a type would contain which would be strictly shorter.

r? @nikomatsakis
@kennytm
Copy link
Member

kennytm commented Jun 7, 2017

There should be a lint about the useless lifetime (this line in real code) though.

nikomatsakis added a commit to nikomatsakis/rust that referenced this issue Feb 6, 2020
We currently have a kind of arbitrary check for `Verify` conditions
which says that if the "test region" is `'empty`, then the check
passes. This was added to fix rust-lang#42467 -- it happens to be correct for
the purposes that we use verify bounds for, but it doesn't feel
generally correct. Replace with a more principled test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta.
Projects
None yet
Development

No branches or pull requests

4 participants