1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 #![crate_type = "rlib"]
17 mod crate_with_invalid_spans_macros;
19 pub fn exported_generic<T>(x: T, y: u32) -> (T, u32) {
20 // Using the add1 macro will produce an invalid span, because the `y` passed
21 // to the macro will have a span from this file, but the rest of the code
22 // generated from the macro will have spans from the macro-defining file.
23 // The AST node for the (1 + y) expression generated by the macro will then
24 // take it's `lo` span bound from the `1` literal in the macro-defining file
25 // and it's `hi` bound from `y` in this file, which should be lower than the
26 // `lo` and even lower than the lower bound of the FileMap it is supposedly
27 // contained in because the FileMap for this file was allocated earlier than
28 // the FileMap of the macro-defining file.