Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

error[E0428]: the name sentry is defined multiple times #29

Closed
ctaggart opened this issue Sep 28, 2017 · 5 comments
Closed

error[E0428]: the name sentry is defined multiple times #29

ctaggart opened this issue Sep 28, 2017 · 5 comments

Comments

@ctaggart
Copy link
Owner

error[E0428]: the name `sentry` is defined multiple times
    --> src/lib.rs:2320:9
     |
2284 |         pub struct sentry {}
     |         -------------------- previous definition of the type `sentry` here
...
2320 |         pub struct sentry {}
     |         ^^^^^^^^^^^^^^^^^^^^ `sentry` redefined here
     |
     = note: `sentry` must be defined only once in the type namespace of this module
@ctaggart
Copy link
Owner Author

https://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-html-USERS-4.0/ostream-source.html

00056 template<typename _CharT, typename _Traits>
00057 class basic_ostream : virtual public basic_ios<_CharT, _Traits>

00116 class sentry;
00117 friend class sentry;

@ctaggart
Copy link
Owner Author

After a few hours, it didn't find what I wanted. I must have something wrong in the script.

(93.2 %, 276922 bytes)
(100.0 %, 0 bytes)

The file being reduced has reached zero size; our work here is done.

If you did not want a zero size file, you must help C-Reduce out by
making sure that your interestingness test does not find files like
this to be interesting.


real    290m57,710s
user    489m35,680s
sys     100m6,760s
#!/usr/bin/env bash
set -eu
clang-3.9 --std=c++11 -c __bindgen.ii

~/rust-bindgen/target/release/bindgen \
    --output __bindgen.rs \
    --enable-cxx-namespaces \
    --whitelist-type octave.* \
    --whitelist-function octave.* \
    --use-core \
    __bindgen.ii \
    -- -v -x c++ -std=c++11 \
    2>/dev/null

rustc ~/octh/bindgen.rs \
    2>&1 \
    | grep 'error\[E0428\]: the name `sentry` is defined multiple times'

# time creduce ./bindgen-bug.sh __bindgen.ii

@ctaggart
Copy link
Owner Author

ctaggart commented Sep 29, 2017

Oh, I see my script problem. I had created an ~/octh/bindgen.rs with this, hoping it would pick up a file local to the temporary creduce directory. Guess this doesn't work:

#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]

extern crate core;

include!("__bindgen.rs");

Deleting that file, and switching back to:

#!/usr/bin/env bash
set -eu
clang-3.9 --std=c++11 -c __bindgen.ii

~/rust-bindgen/target/release/bindgen \
    --output __bindgen.rs \
    --enable-cxx-namespaces \
    --whitelist-type octave.* \
    --whitelist-function octave.* \
    --use-core \
    --raw-line "extern crate core;" \
    __bindgen.ii \
    -- -v -x c++ -std=c++11 \
    2>/dev/null

rustc __bindgen.rs \
    2>&1 \
    | grep 'error\[E0428\]: the name `sentry` is defined multiple times'

# time creduce ./bindgen-bug.sh __bindgen.ii

@ctaggart
Copy link
Owner Author

namespace a {
template <typename, typename> class b;
template <typename, typename = int> class c;
class B {
  typedef b<int, int> d;
};
class e {
  B g;
};
template <typename, typename> class c : e { class sentry; };
template <typename f, typename h> class c<f, h>::sentry {};
template <typename, typename> class b { class sentry; };
template <typename f, typename h> class b<f, h>::sentry {};
}
class octave_diary_stream : a::c<char> {};
real    310m8,693s
user    509m37,296s
sys     149m29,884s

@ctaggart
Copy link
Owner Author

ctaggart commented Oct 2, 2017

Fixed in bindgen. Just do a cargo update.

@ctaggart ctaggart closed this as completed Oct 2, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant