-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Phantom lifetime is ignored #18331
Comments
The output of #![feature(phase)]
#![no_std]
#![feature(globs)]
#[phase(plugin, link)]
extern crate "std" as std;
extern crate "native" as rt;
#[prelude_import]
use std::prelude::*;
struct Doc;
#[cfg(phantom)]
struct Node<'a>;
impl Doc {
#[cfg(phantom)]
fn node<'a>(&'a self) -> Node<'a> { (Node as Node<'<empty>>) }
}
fn main() {
let node;
({
let doc = (Doc as Doc);
((node as Node<'<empty>>) = ((doc as Doc).node() as Node<'_>) as ());
} as ())
} |
Unused lifetimes are currently interpreted as bivariant, yes. You can use the marker types in cc #5922 |
This is a pretty big safety hazard. We need to get a lint working for this. |
A lint for this would definitely be useful! |
Unused lifetimes are now an error:
I think this can be closed. |
Needs test, still? |
Actually this is so ancient, I'm guessing a test was added. |
There are tests for this in src/test/compile-fail/variance-regions-unused-{direct, indirect}.rs. |
Sweet. |
…Veykril internal: Add more trivially `Sized` types to `is_sized` check
The phantom lifetime (I mean the
struct
's lifetime that is not linked to any of its members) seems to be ignored.Without
--cfg phantom
, this isn't be compiled.With
--cfg phantom
, this is compiled.The text was updated successfully, but these errors were encountered: