Skip to content

Rolling up PRs in the queue #22192

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

Merged
merged 40 commits into from
Feb 12, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
51ed1ec
lint: Deny #[no_mangle] const items
richo Feb 3, 2015
73d5d89
lint: Warn about no-mangled statics that are not exported
richo Feb 3, 2015
b6f55ef
lint: Document the why and how of the no_mangle const lint
richo Feb 3, 2015
73201fd
Make the live code analysis visit method declarations.
LeoTestard Feb 7, 2015
b24c6fd
fix and macro-ify map benches, fixes #22134
Gankra Feb 10, 2015
07f1d3d
Remove FIXME in librbml
steveklabnik Feb 11, 2015
c324a8a
Documentation fix for PathBuf#pop
ogham Feb 11, 2015
d8d3761
Tweak wording of copy_nonoverlapping_memory to remove misleading 'all…
huonw Feb 11, 2015
d428871
Forbid undefined names in macro use / macro reexport
kmcallister Feb 11, 2015
a941fdb
Fail nicely when copying artefacts fails
nagisa Feb 10, 2015
92b7222
openbsd don't support TLS
semarie Feb 11, 2015
f9a1087
Feature-gate the `#[unsafe_no_drop_flag]` attribute.
pnkfelix Feb 11, 2015
2af968e
Eliminate assoc type projection predicate candidate duplicates
edwardw Feb 11, 2015
2f48651
Revert #22051
nagisa Feb 11, 2015
d4985ac
Add read and write rights to group and other when creating file
GuillaumeGomez Feb 11, 2015
bbbb571
rustc: Fix a number of stability lint holes
alexcrichton Feb 10, 2015
a828e79
std: Tweak the std::env OsString/String interface
alexcrichton Feb 11, 2015
8b8331a
rollup merge of #21881: richo/lint-no-mangle-const
alexcrichton Feb 11, 2015
c9fdfdb
rollup merge of #22048: LeoTestard/impl-patterns-used
alexcrichton Feb 11, 2015
84e5c11
rollup merge of #22127: alexcrichton/stability-holes
alexcrichton Feb 11, 2015
18d31cc
rollup merge of #22150: nagisa/de-perm-frost
alexcrichton Feb 11, 2015
fcf679c
rollup merge of #22151: Gankro/macro-bench
alexcrichton Feb 11, 2015
92e7aeb
rollup merge of #22161: steveklabnik/close_2741
alexcrichton Feb 11, 2015
5e2b69c
rollup merge of #22162: ogham/patch-1
alexcrichton Feb 11, 2015
4876716
rollup merge of #22164: huonw/alloc--
alexcrichton Feb 11, 2015
7362bd5
rollup merge of #22167: kmcallister/undef-macro
alexcrichton Feb 11, 2015
5bcf2a9
rollup merge of #22177: semarie/openbsd-notls
alexcrichton Feb 11, 2015
76a3852
rollup merge of #22184: nagisa/revert-emissions
alexcrichton Feb 11, 2015
9675f51
rollup merge of #22185: edwardw/default-methods
alexcrichton Feb 11, 2015
43a2004
rollup merge of #22186: GuillaumeGomez/fix-fs
alexcrichton Feb 11, 2015
9492275
rollup merge of #22188: alexcrichton/envv2
alexcrichton Feb 11, 2015
aa0db17
rollup merge of #22178: pnkfelix/featuregate-unsafe-no-drop-flag
alexcrichton Feb 11, 2015
cf475e6
implement missing iterator traits for slice::Windows
dcrewi Feb 11, 2015
315730f
Test fixes and rebase conflicts
alexcrichton Feb 11, 2015
395709c
std: Add a `net` module for TCP/UDP
alexcrichton Feb 6, 2015
a105636
rollup merge of #22015: alexcrichton/netv2
alexcrichton Feb 11, 2015
adcda46
rollup merge of #22166: dcrewi/iter-impls-for-windows
alexcrichton Feb 11, 2015
d2f990f
More test fixes and rebase conflicts
alexcrichton Feb 11, 2015
18bafad
rollup merge of #22197: alexcrichton/do-not-link-plugins
alexcrichton Feb 12, 2015
fb1f4d1
Even more test fixes
alexcrichton Feb 12, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
lint: Deny #[no_mangle] const items
This renames the PrivateNoMangleFns lint to allow both to happen in a
single pass, since they do roughly the same work.
  • Loading branch information
richo committed Feb 3, 2015
commit 51ed1ecefd016bd90b09fea399b9a989d756609d
19 changes: 16 additions & 3 deletions src/librustc/lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2065,12 +2065,19 @@ declare_lint! {
"functions marked #[no_mangle] should be exported"
}

declare_lint! {
NO_MANGLE_CONST_ITEMS,
Deny,
"const items will not have their symbols exported"
}

#[derive(Copy)]
pub struct PrivateNoMangleFns;
pub struct InvalidNoMangleItems;

impl LintPass for PrivateNoMangleFns {
impl LintPass for InvalidNoMangleItems {
fn get_lints(&self) -> LintArray {
lint_array!(PRIVATE_NO_MANGLE_FNS)
lint_array!(PRIVATE_NO_MANGLE_FNS,
NO_MANGLE_CONST_ITEMS)
}

fn check_item(&mut self, cx: &Context, it: &ast::Item) {
Expand All @@ -2083,6 +2090,12 @@ impl LintPass for PrivateNoMangleFns {
cx.span_lint(PRIVATE_NO_MANGLE_FNS, it.span, msg.as_slice());
}
},
ast::ItemConst(..) => {
if attr::contains_name(it.attrs.as_slice(), "no_mangle") {
let msg = "const items should never be #[no_mangle]";
cx.span_lint(NO_MANGLE_CONST_ITEMS, it.span, msg);
}
}
_ => {},
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/lint/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ impl LintStore {
UnstableFeatures,
Stability,
UnconditionalRecursion,
PrivateNoMangleFns,
InvalidNoMangleItems,
);

add_builtin_with_new!(sess,
Expand Down
9 changes: 8 additions & 1 deletion src/test/compile-fail/lint-unexported-no-mangle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,20 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags:-F private_no_mangle_fns
// compile-flags:-F private_no_mangle_fns -F no_mangle_const_items

// FIXME(#19495) no_mangle'ing main ICE's.
#[no_mangle]
fn foo() { //~ ERROR function foo is marked #[no_mangle], but not exported
}

#[allow(dead_code)]
#[no_mangle]
const FOO: u64 = 1; //~ ERROR const items should never be #[no_mangle]

#[no_mangle]
pub const PUB_FOO: u64 = 1; //~ ERROR const items should never be #[no_mangle]

#[no_mangle]
pub fn bar() {
}
Expand Down