You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
struct Wrapper(~str);
impl Wrapper {
pub fn new() -> Wrapper {
Wrapper(~"Bob")
}
pub fn say_hi(&self) {
println(fmt!("hello %s", **self));
}
}
impl Drop for Wrapper {
fn drop(&mut self) {}
}
fn main() {
{
// This runs without complaint.
let x = Wrapper::new();
x.say_hi();
}
{
// This fails to compile.
// error: internal compiler error: drop_ty_immediate: non-box ty
Wrapper::new().say_hi();
}
}
I originally ran accross this when wrapping a *T, but it also fails when I try to wrap int and other numeric types, bool, Option<T>, ~T, and other structs that also wrap a single value of those types.
The text was updated successfully, but these errors were encountered:
dcrewi
added a commit
to dcrewi/rust
that referenced
this issue
Sep 28, 2013
Fix `range_{plus,minus}_one` bad suggestions
Fixesrust-lang#9431.
The current `range_plus_one` and `range_minus_one` suggestions are completely incorrect when macros are involved.
This commit resolves this by disabling the lints for any range expression that is expanded from a macro. The reasons for this are that it is very difficult to create a correct suggestion in this case and that false negatives are less important for pedantic lints.
changelog: Fix `range_{plus,minus}_one` bad suggestions
Minimal test case:
I originally ran accross this when wrapping a
*T
, but it also fails when I try to wrapint
and other numeric types,bool
,Option<T>
,~T
, and other structs that also wrap a single value of those types.The text was updated successfully, but these errors were encountered: