Commit Graph

51956 Commits

Author SHA1 Message Date
Niko Matsakis 726ba6630d Rebase over my PR 2016-03-25 14:36:49 -04:00
Guillaume Gomez 311ee0157a Add an example for E0034 2016-03-25 19:29:07 +01:00
Niko Matsakis 8a7b1bca04 Update backtrace test for FIXME on windows 2016-03-25 14:07:21 -04:00
Niko Matsakis 24059f74d7 Drive-by fix for unnecessary `&mut` 2016-03-25 14:07:21 -04:00
Niko Matsakis fd25a63ba9 document test, don't use grep 2016-03-25 14:07:20 -04:00
Niko Matsakis ab0a87243e test for immediate symbol name hashing 2016-03-25 14:07:20 -04:00
Niko Matsakis 87debd9328 include the immediate type in the symbol name hash
the intention is to give some simple protection like link-guards
but not impede ability to upgrade dylib in place
2016-03-25 14:07:20 -04:00
Niko Matsakis 814477a893 Revert "workarounds to make link guards work on windows"
This reverts commit b52004d202ddfffa100d4963216e1673a0be0b95.
2016-03-25 14:07:20 -04:00
Niko Matsakis 4c527457f1 rip out link guards
As discussed in
https://github.com/rust-lang/rust/pull/32293#issuecomment-200597130,
adding link guards are a heuristic that is causing undue complications:

- the link guards inject extra public symbols, which is not always OK.
- link guards as implemented could be a non-trivial performance hit,
  because no attempt is made to "de-duplicate" the dependency graph,
  so at worst you have O(N!) calls to the link guard functions.

Nonetheless, link guards are very helpful in detecting errors, so it may
be worth adding them back in some modified form in the future.
2016-03-25 14:07:20 -04:00
Niko Matsakis b385ce1223 workarounds to make link guards work on windows
Link guards cause problems in some specific scenarios on windows because
they force libcore to be instantiated, since we do not GC functions
effectively on windows.

The changes here are two:

1. disable core for rsbegin/rsend
2. make panic_fmt an extern fn for smallest-hello-world so that it
   is not marked as "internal" for LLVM
2016-03-25 14:07:20 -04:00
Niko Matsakis 751c24d345 renumber error from E0522 to E0523
another name was added in the meantime
2016-03-25 14:07:20 -04:00
Niko Matsakis b184d2712f check only that symbol names are deterministic
Full binary reproducible builds are not possible on all platforms
because linker injects a certain amount of randomness, apparently. Or,
at minimum, they don't work reliably yet.
2016-03-25 14:07:20 -04:00
Niko Matsakis 7e8e6712b5 Remove static linking hack since we are now passing absolute paths 2016-03-25 14:07:20 -04:00
Niko Matsakis bca94230f3 Fix accursed issue-4264.pp 2016-03-25 14:07:20 -04:00
Niko Matsakis e8dfaa71e6 Correections due to refactoring . 2016-03-25 14:07:20 -04:00
Niko Matsakis 5a68116240 pacify the merciless tidy: s/E0521/E0522
Gah. I always find it confusing that make tidy gives me the highest error
code, but not the **next** error code.
2016-03-25 14:07:20 -04:00
Niko Matsakis af057bdb1c renumber diagnostic to avoid conflict
specialization nabbed E0520
2016-03-25 14:07:20 -04:00
Niko Matsakis 86fa58d6c8 remove unused variable in compiletest 2016-03-25 14:07:19 -04:00
Niko Matsakis 977636156a unit-test symbol-names and item-paths 2016-03-25 14:07:19 -04:00
Niko Matsakis 2291abf313 refactor item-paths in diagnostics, symbol names
This change has a few parts. We introduce a new `item_path` module for
constructing item paths. The job of this module is basically to make
nice, user-readable paths -- but these paths are not necessarily 100%
unique. They meant to help a *human* find code, but not necessarily a
compute. These paths are used to drive `item_path_str` but also symbol
names.

Because the paths are not unique, we also modify the symbol name hash to
include the full `DefPath`, whereas before it included only those
aspects of the def-path that were not included in the "informative"
symbol name.

Eventually, I'd like to make the item-path infrastructure a bit more
declarative.  Right now it's based purely on strings. In particular, for
impls, we should supply the raw types to the `ItemPathBuffer`, so that
symbol names can be encoded using the C++ encoding scheme for better
integration with tooling.
2016-03-25 14:07:19 -04:00
Niko Matsakis cd5cf09635 add krate_attrs accessor
makes better edges in dep graph
2016-03-25 14:07:19 -04:00
Niko Matsakis ab9b844146 track the extern-crate def-id rather than path
We used to track, for each crate, a path that led to the extern-crate
that imported it. Instead of that, track the def-id of the extern crate,
along with a bit more information, and derive the path on the fly.
2016-03-25 14:07:19 -04:00
Niko Matsakis 6056c5fbed fallout: update codegen-units tests 2016-03-25 14:07:19 -04:00
Niko Matsakis 5e26508744 refactor DefPathData variants
In particular, remove the name from the Impl, since that name is
synthesized and is not predictable (it tends to break incr. comp.).

Also rename the variants to be a bit more uniform and remove some
distinctions that we were not really taking advantage of anywhere.
2016-03-25 14:07:19 -04:00
Niko Matsakis 7b6270b537 store krate information more uniformly
make DefPath store krate and enable uniform access to crate_name/crate_disambiguator
2016-03-25 14:07:19 -04:00
Niko Matsakis 65c0b7c292 track def-id for inlined items 2016-03-25 14:07:19 -04:00
Michael Woerister 2475707322 Add a "link-guard" to avoid accidentally linking to a wrong dylib at runtime.
We want to prevent compiling something against one version
of a dynamic library and then, at runtime accidentally
using a different version of the dynamic library. With the
old symbol-naming scheme this could not happen because every
symbol had the SVH in it and you'd get an error by the
dynamic linker when using the wrong version of a dylib. With
the new naming scheme this isn't the case any more, so this
patch adds the "link-guard" to prevent this error case.

This is implemented as follows:

- In every crate that we compile, we emit a function called
  "__rustc_link_guard_<crate-name>_<crate-svh>"
- The body of this function contains calls to the
  "__rustc_link_guard" functions of all dependencies.
- An executable contains a call to it's own
  "__rustc_link_guard" function.

As a consequence the "__rustc_link_guard" function call graph
mirrors the crate graph and the dynamic linker will fail if a
wrong dylib is loaded somewhere because its
"__rustc_link_guard" function will contain a different SVH in
its name.
2016-03-25 14:07:19 -04:00
Michael Woerister 82b5f1d869 Remove old symbol naming code. 2016-03-25 14:07:18 -04:00
Michael Woerister 2eebb7b605 Make the compiler emit an error if the crate graph contains two crates with the same crate-name and crate-salt but different SVHs. 2016-03-25 14:07:18 -04:00
Michael Woerister fafdfa8bdc Salt test crates in buildsystem. 2016-03-25 14:07:18 -04:00
Michael Woerister 9c965b786c Add a test to verify that we have reproducible compiler builds. 2016-03-25 14:07:18 -04:00
Michael Woerister 7def3768c6 Use new symbol names for items of various kinds. 2016-03-25 14:07:18 -04:00
Michael Woerister 68de171890 Use new symbol naming scheme for object shims. 2016-03-25 14:07:18 -04:00
Michael Woerister 8ef638e6fa Use new symbol naming scheme for fn-once-shims. 2016-03-25 14:07:18 -04:00
Michael Woerister 23e54b24ad Use new symbol naming scheme for fn-pointer-shims. 2016-03-25 14:07:18 -04:00
Michael Woerister 7a5a988579 Make drop glue use new symbol naming scheme. 2016-03-25 14:07:18 -04:00
Michael Woerister 6f60c9e1fd Make closures use stable symbol names. 2016-03-25 14:07:18 -04:00
Michael Woerister c77f44eeee Make monomorphized functions use stable symbol names. 2016-03-25 14:07:18 -04:00
Michael Woerister 3a756fea50 Make the definite name of the local crate available in the tcx. 2016-03-25 14:07:17 -04:00
Michael Woerister 32a2e9a8e1 Compute a salt from arguments passed via -Cmetadata. 2016-03-25 14:07:17 -04:00
Michael Woerister c7e54d7279 Make library paths passed by compiletest tool absolute.
Otherwise, changing the current working directory can mess up runtime linking.
2016-03-25 14:07:17 -04:00
Michael Woerister 606c985a50 Make CrateStore::crate_name() return an InternedString to avoid unnecessary allocations. 2016-03-25 14:07:17 -04:00
Michael Woerister 5027a79279 Add missing entries for enum variants in trans::CrateContext::external_srcs. 2016-03-25 14:07:17 -04:00
Michael Woerister 6fdeecf62f CrateStore: Allow for custom def_id_to_string mappings in encode_type(). 2016-03-25 14:07:17 -04:00
bors cf9274b727 Auto merge of #32407 - alexcrichton:netbsd-gcc-s-link, r=aturon
std: Link to gcc_s on NetBSD

Currently the nightlies we're producing fail when linking some C code into a
Rust application with the error message:

    libgcc_s.so.1: error adding symbols: DSO missing from command line

By linking `gcc_s` instead of `gcc` this error goes away. I haven't tested this
on NetBSD itself, but should help get the Linux cross-compile image moreso up
and working!
2016-03-25 11:00:01 -07:00
Brian Anderson c7049f6450 Fix the name of the 'check-cargotest' step 2016-03-25 17:33:10 +00:00
Niko Matsakis e539b74f54 use new visitor to erase regions 2016-03-25 13:10:45 -04:00
Alejandro Wainzinger 6ce63fb3f1 Add note on `str` being an unsized type in strings section of book. 2016-03-25 23:25:40 +09:00
Niko Matsakis 93e44432e1 check for both partialeq and eq 2016-03-25 10:02:56 -04:00
bors 64a13a4660 Auto merge of #31908 - jseyfried:disallow_shadowed_traits, r=nikomatsakis
Disallow methods from traits that are not in scope

This PR only allows a trait method to be used if the trait is in scope (fixes #31379).
This is a [breaking-change]. For example, the following would break:
```rust
mod foo {
    pub trait T { fn f(&self) {} }
    impl T for () {}
}

mod bar { pub use foo::T; }

fn main() {
    pub use bar::*;
    struct T; // This shadows the trait `T`,
    ().f() // making this an error.
}
```
r? @nikomatsakis
2016-03-25 05:03:13 -07:00